FS2020 Variable Write Bug

Discuss suspected bugs with other users and Sim Innovations Staff

Moderators: Ralph, russ

Message
Author
FLRob27
Posts: 11
Joined: Wed Feb 24, 2021 3:10 am

FS2020 Variable Write Bug

#1 Post by FLRob27 »

I believe I've found a bug that has to do with Variable_Write to Number Type "0". This came up after the latest Plugin Release early last month. I'm not sure anyone is even aware of this or not, but if a L-Variable subscribe starts out as double "1" (as verified in the AM Data Viewer) and you use that subscribe to set a switch position, AM will not control that switch until you change the switch position in the Virtual Cockpit (to position 0), then AM will control/recognize that variable and switch until you restart your PC (which probably really has something to do with the first time the plugin is ran).

For a test case, you may use the Working Title CJ4. If you first load FS2020 and load the CJ4 somewhere, turn on the Seatbelt sign (on the Pedestal Light Panel), then run the Simstrumentation CJ4 Light Panel (It's in the AM Store), you'll see that the panel knows the state of the switch, since the Blue LED is illuminated for "Belt", but if you click on the belt button to turn it off on the AM Panel, it recognizes the event and makes a sound, but doesn't ever send the Variable_Write to 0, but as soon as you turn it off in the Virtual Cockpit (aka Variable goes to 0), you then have full control of it in Air Manger. I have a feeling that if I dig hard in some of the other stock or user submitted instruments I'd probably find the same issue as using the switch position is common. It may not have been reported to anyone yet since most planes start knobs/switches in position 0 and not 1.

This is a big issue in the Aerosoft CRJ as a majority of their switches don't start in position 0 and you have to go through and toggle switches in the Virtual Cockpit to get AM working.

Let me know if there is something wrong or that can be done differently. Always open for suggestions!

Thanks for the help!

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

Re: FS2020 Variable Write Bug

#2 Post by Ralph »

I've read it 3 times, but I still do not understand what you're saying.

FLRob27
Posts: 11
Joined: Wed Feb 24, 2021 3:10 am

Re: FS2020 Variable Write Bug

#3 Post by FLRob27 »

Yeah sometimes trying to explain something a simpler version is better. Short version: If a variable starts out as 1, AM will not write 0 to it. The subscribe reads the variable correctly, but the write never seems to send. Probably good to note that that the subscribe and write are to the same exact variable name.

So you can’t control the variable, and it’s painful if the variable is a switch and you would assume all switches default state start out in 0, but some don’t.

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

Re: FS2020 Variable Write Bug

#4 Post by Tetrachromat »

I think this observation applies only to L-Vars that are mapped to B-Vars for triggering the animation of controls in the virtual cockpit.

I have observed the same for some switches (yoke lock as well) in the Twin Otter by Aerosoft.

This kind of B-Var mapping has the property that the L-Var is often reset to 0 after the animation is triggered. So if you read the same L-Var through subscription is does not represent the switch state in the sim.

You need to subscribe to another L-Var to get the switch state from the sim. But sometimes there is no such L-Var implemented by the aircraft creator. Then you are dependent on the availability of a regular (SDK) variable.

That means it is not a AM issue. This is a implementation issue for the aricraft creator.

Paul

FLRob27
Posts: 11
Joined: Wed Feb 24, 2021 3:10 am

Re: FS2020 Variable Write Bug

#5 Post by FLRob27 »

@Tetrachromat I do understand what you're saying about the "L-Var is often reset to 0 after the animation is triggered", as I've coded almost the entire CRJ cockpit, but in this case that's not exactly what I'm referring too.

I'm specifically talking about LVars that do hold state. Basically, if the plane loads a variable in state Number "1", you can't use AM to control it until you set the switch in the Virtual Cockpit to whatever position "0" represents. Then you can toggle the switch between 1 and 0. Anyone should be able to replicate this bug very quickly and watch the variables right in the AM Data Viewer.

I will point out that in my example about I used the Working Title CJ4 and am telling you guys to turn on a switch, then load the AM Panel and you're probably like well just don't turn that on first and you're problem is solved, but the real issue is the CRJ, but since that's paidware, I picked a freeware example to prove my point :)

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

Re: FS2020 Variable Write Bug

#6 Post by Ralph »

Can you come up with a variable in one of the default aircraft? That would make it a lot easier to test.

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

Re: FS2020 Variable Write Bug

#7 Post by Tetrachromat »

@FLRob27 OK, I can see that your issue is different from mine.

If you start (or restart) the flight, before starting the AM panel or toggling the switch, what initial value does the data viewer show for the L-Var?

I ask, because I checked again in the Twin Otter, and I have a similar issue like yours on the BUS TIE switch. When functioning properly the L:DHC6_BUS_TIE variable shows the value '0' for OPEN state and '100' for NORMAL state.

On flight startup/restart, the BUS TIE cockpit switch is shown in the NORMAL position. But the value in the data viewer is '0' when I would expect it to be '100'.
grafik.png
From that state, when runnig the AM panel I cannot control BUS TIE with the panel switch.

Only after toggling the cockpit switch to OPEN and back to NORMAL the data viewer shows the correct value of '100' and I am able to control BUS TIE with the panel switch.

Does this look like your issue?

FLRob27
Posts: 11
Joined: Wed Feb 24, 2021 3:10 am

Re: FS2020 Variable Write Bug

#8 Post by FLRob27 »

Ralph wrote: Sun May 08, 2022 7:34 am Can you come up with a variable in one of the default aircraft? That would make it a lot easier to test.
I don’t think any of the default planes use LVars, but I’m not certain the bug is only found on LVars, as I doubt AM knows the difference between Variables? If that’s the case I might be able to point it out easier.

I’ll look deeper.

FLRob27
Posts: 11
Joined: Wed Feb 24, 2021 3:10 am

Re: FS2020 Variable Write Bug

#9 Post by FLRob27 »

I did find that default planes do in fact use L-Vars quite frequently, I just had to find a plane with a 3 position switch, so I went right to an airliner!
Here are the steps to verify the issue.
#1-Load MSFS2020, choose the 787-10 Dreamliner and a parking spot at any airport.
#2-Once loaded in the Virtual Cockpit, look above to the overhead panel, and you'll see an Electrical Panel (left side) with a white APU knob. Set that APU knob to "ON".
#3-Start Air Manager and import and run the attached instrument which subscribes to the APU Knob.
#4-Try and turn the APU knob to the left from Air Manager, You should not be able to from Air Manager until you set the Virtual Cockpit knob back to "Off". But you can turn the knob to the right to position 2, I can't explain why you can turn to the right but not to the left. But in most switch cases, there are only 2 positions, 0 and 1, thus it's a bigger issue.
The APU knob positions are 0-Off, 1-On, 2-Start.

If you don't see the problem, your Air Manager might have been previous subscribed to it, so restart your computer.

I do believe this issue is related to the latest plugin, where @Corjan mentioned he made some changes when we were having the duplicate event issue. We are no longer having a duplicate event, but we now have to write a "0" after every event in order to "free" the variable up. So I suppose the issues are really related.
!!787_LVar_test - .siff
(15.92 KiB) Downloaded 60 times

FLRob27
Posts: 11
Joined: Wed Feb 24, 2021 3:10 am

Re: FS2020 Variable Write Bug

#10 Post by FLRob27 »

Bounce, This bug is still unresolved in the latest AM release. While it's not a common bug, it's very prevalent in anything that uses LVARs.

Post Reply