Bug with am_variable_subscribe

Discuss suspected bugs with other users and Sim Innovations Staff

Moderators: russ, Ralph

Post Reply
Message
Author
Yves Levesque
Posts: 6
Joined: Fri Jan 22, 2016 5:23 pm

Bug with am_variable_subscribe

#1 Post by Yves Levesque »

I have a new problem with AM 2.1.2
The callback function is frequently re-triggered without any am_variable_write () call.
This happens with FSX and P3D.
It could be once a second or many times per second.
I don't think this was present in 2.1.1

If I run a simple instrument with only this demo am_variable_subscribe script, New data1: 0 is frequently printed .

-- This function will be called when new data is available from another instrument
function new_data_callback(data1)
print("New data1: " .. data1)
end

-- subscribe to Air Manager variable
am_variable_subscribe("my_variable", "FLOAT", new_data_callback)

Yves

jml79
Posts: 87
Joined: Wed Jan 06, 2016 4:33 am

Re: Bug with am_variable_subscribe

#2 Post by jml79 »

I have noticed this recently while debugging an instrument. Except I'm using X-plane 10.45. While monitoring the reference /sim/ice/pitot_heat1_on or something very close to that, a 0 would be output multiple times with no change to the variable. Odd.

User avatar
Corjan
Posts: 2936
Joined: Thu Nov 19, 2015 9:04 am

Re: Bug with am_variable_subscribe

#3 Post by Corjan »

Hi,

Hmz, that should not happen. I will investigate coming week.

Thanks for submitting this problem,

Corjan

User avatar
Corjan
Posts: 2936
Joined: Thu Nov 19, 2015 9:04 am

Re: Bug with am_variable_subscribe

#4 Post by Corjan »

Hi,

Just had a look in the code, and I found the source of the problem. The scary part is that this bug applies to all subscriptions. In theory, the instrument code should be able to handle multiple callbacks with the same value though.

The fix will be included in the upcoming 2.1.3. Let me know with a PM or something if you want a BETA version of 2.1.3.

Corjan

jml79
Posts: 87
Joined: Wed Jan 06, 2016 4:33 am

Re: Bug with am_variable_subscribe

#5 Post by jml79 »

It does seem to work still. If yves hadn't mentioned it I wouldn't have given more than a passing thought. But I have some iPad specific instruments I hope to have in before 2.1.3 please let me know roughly before you are going to compile the iPad release. :-)

Post Reply