I need some help with my script. I was able to read the GV value, but I cannot store a new value. For the sake of test, this is the script I used for reading and writing the GV:
local data
local outputs= {"data"}
function run(store)
model.setGlobalVariable(1, 8, (500-1000))
-- data=(model.getGlobalVariable(0,8)+1000)*10.24
return data
end
return {run=run, output=outputs}
For the variable value I used fixed numbers form -500 to 1900. (500 above)
I manually set the GV 1 to -950.
I am running companion 2.0.18
What am I doing wrong?
Cannot make setGlobalVariable to save data
Re: Cannot make setGlobalVariable to save data
Not sure, but (once I remove the --) it works for me.
-
- Posts: 183
- Joined: Sat Mar 29, 2014 10:44 pm
- Country: United States
- Location: Coral Springs, FL
Re: Cannot make setGlobalVariable to save data
Thank you Kilrah. Your screen picture explained what I was doing wrong. I was expecting the value in the flight modes tab of the edit model window would change.
Richard
Re: Cannot make setGlobalVariable to save data
The simulator in companion does not carry results back into the editor, everything done in it is lost when closed.
You can use the standalone simulator for that (Firmware simulator 2.0 in your start menu), which works like the radio and keeps settings in a file in your user documents folder.
You can use the standalone simulator for that (Firmware simulator 2.0 in your start menu), which works like the radio and keeps settings in a file in your user documents folder.