Help with si_variable_write required

Peer support for Air Manager desktop users

Moderators: russ, Ralph

Post Reply
Message
Author
Tetrachromat
Posts: 236
Joined: Sun Feb 14, 2021 6:55 pm

Help with si_variable_write required

#1 Post by Tetrachromat »

I have an issue with that function si_variable_write.

Note: This is with AM 4.1 BETA 12 and the new plugin 3.7 BETA 1.

I can create a new IIC variable with si_variable_create.

Code: Select all

variable = "gci/axis/throttle1"
type = "DOUBLE"
initial = -1.0
var_id = si_variable_create(variable, type, initial)
It returns some var_id and I save it to a data structure.

I can subscribe to the same variable, same type.

Code: Select all

function new_data_callback(data1)
  log("New data: " .. data1)
end

si_variable_subscribe("gci/axis/throttle1", "DOUBLE", new_data_callback)
The callback function receives the initial value (-1.0)

But when i write to the var_id retrieved from my data structure, e.g.

Code: Select all

value = 0.5
si_variable_write(var_id, value)
the callback does not receive any new data.

I have already compared the var_id created and the var_id used. They are the same when logged. E.g. 'userdata: 000001F41C127870'

I'm stuck. I can't see what I am doing wrong. Is that the correct procedure to work with IIC?

Paul

User avatar
Ralph
Posts: 7876
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: Help with si_variable_write required

#2 Post by Ralph »

One of the most common mistakes with IIC is not having the simulator running.

Tetrachromat
Posts: 236
Joined: Sun Feb 14, 2021 6:55 pm

Re: Help with si_variable_write required

#3 Post by Tetrachromat »

Yes, that is true.

But not in that case. MSFS2020 is running. Instruments are showing the correct values received through subscriptions from the sim. Just writing to IIC variables is an issue.

Tetrachromat
Posts: 236
Joined: Sun Feb 14, 2021 6:55 pm

Re: Help with si_variable_write required

#4 Post by Tetrachromat »

Just checked the plugin log (fs2020_log.txt):

Ther are two entries related to that variable

Code: Select all

02-10-2021 20:50:26 INFO SimBusServerProviderPool: Succesfull bind to variable "gci/axis/throttle1" with unit "DOUBLE"
02-10-2021 20:50:26 INFO SimBusServerProviderPool: Succesfull bind to variable "gci/axis/throttle1" (no unit)
What do the two entries represent? The creation, the subscription or the writing?

Paul

Tetrachromat
Posts: 236
Joined: Sun Feb 14, 2021 6:55 pm

Re: Help with si_variable_write required

#5 Post by Tetrachromat »

Found that Topic. It is not exactly the same issue, but it contains valuable info.

From it I take that he first entry is representing the creation of the variable. The second entry with (no unit) is the writing to that variable.

Additionally: I can't add subsriptions manually in the Data Viewer. see the image below.
Screenshot Data Viewer.png

Tetrachromat
Posts: 236
Joined: Sun Feb 14, 2021 6:55 pm

Re: Help with si_variable_write required

#6 Post by Tetrachromat »

@Ralph
This is to report that IIC communication is not working anymore since AM BETA 8.

I did revert back to all the previous BETA versions. si_variable_write does not work for all versions back to BETA 8. Only BETA 7 or previous do work.

There must have been a change in BETA 8 that inhibits si_variable_write from doing its job.

I did my test with the following simplified instruments and panel:
Test IIC Communiccation Instruments.siff
(3.56 KiB) Downloaded 86 times
Test IIC Communiccation Panel.siff
(2.03 KiB) Downloaded 85 times

Post Reply