Cannot make setGlobalVariable to save data

Help with any software/desktop related issues. e.g. companion9x, eePe, etc
Post Reply
Richard
Posts: 183
Joined: Sat Mar 29, 2014 10:44 pm
Country: United States
Location: Coral Springs, FL

Cannot make setGlobalVariable to save data

Post by Richard »

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?
Richard

User avatar
Kilrah
Posts: 11108
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: Cannot make setGlobalVariable to save data

Post by Kilrah »

Not sure, but (once I remove the --) it works for me.
screenshot-1.png
screenshot-1.png (1.45 KiB) Viewed 3080 times
Richard
Posts: 183
Joined: Sat Mar 29, 2014 10:44 pm
Country: United States
Location: Coral Springs, FL

Re: Cannot make setGlobalVariable to save data

Post by Richard »

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.
screen.jpg
Richard
User avatar
Kilrah
Posts: 11108
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: Cannot make setGlobalVariable to save data

Post by Kilrah »

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.
Richard
Posts: 183
Joined: Sat Mar 29, 2014 10:44 pm
Country: United States
Location: Coral Springs, FL

Re: Cannot make setGlobalVariable to save data

Post by Richard »

Thanks a lot for the lead!!
Richard

Post Reply

Return to “Software”