#Silly question about output
1 messages · Page 1 of 1 (latest)
Hello, you need to specify what you are doing?
How did you wire?
What do you mean exactly by illuminations?
By default all values start with 0 so you are incorrect in saying the default is on. It is something you did.
Without knowing your installations we can only guess.
Ok so there isnt a way withing the software to default off instead of on and visa Versa
You need to explain what you are trying to do.
Retrigger will sync the state of your panel to the Sim, but it is an all or nothing action.
From your misplaced question in Hubhop, it appears you just want latching switch events, instead of toggle events.
Most (if not all) toggle events code can be easily converted to on off events.
Please make specific questions. That will be easier for everyone to answer.
Specify which Sim, which aircraft, which event you want to convert. Assuming that you have already searched and do not find the on off event preset that you need.
Your panels should reflect the state of the Sim. Not the reverse. You want to turn leds off, then the Sim leds need to be off.
@zealous thorn thank you for response.
As for misplaced questions it's actually a separate issue. Apologies of you have assumed incorrectly.
yes, I realized later that your question there was related to latching switches, whereas here it was leds, I presume. I still don't know anyting about your setup.
Sadly the setup is just fragments of an atr76 cockpit
So just trying to retro fit genuine cockpit aviaonics to simulator. 99% through mobi flight. Most Individuals will be happy with pressong a button twice to replicate action etc but I with to ha e actions operate like the real thing.
Hence my odd questions as until I get somewhere further along not much will happen.
I would preferably need to talk to someone with reasonable hubhop code knowledge
I am fairly good with RPN. As I already mentioned, it is easy to convert a toggle event code into on and off events. Having said that, there are very very many functions in the sim that already have both types of Mobiflight presets, mainly because different folks have different panels with different devices.
In the sim, very often, even when the device in the virtual cockpit is a latching switch, the code is originally made as a toggle event. My interpretation is that it is intended to be operated with mouse clicks and the virtual cockpit will never get out of sync with itself.
No, you should not need to actuate a latching switch twice to have the sim change the state. Mobiflight can very well do it correctly, but it is a different code for on than it is for the off position.
I participated in the community effort to dig up the ATR aircraft events, a year and a half ago, so I am already somewhat familiar with the way this aircraft is coded.
and I say again, please be specific.
@zealous thorn I see you have added a few codes to hubhop atr72-600
@zealous thorn specific is an issue. I am wading my way through this stuff
I'm currently working on atr72-600 EEC1, ATPCS and EEC2. The switches are original and from and ATR72. I have retrofitted the switches to an Arduino mega 2560 and using mobiflight. The EEC2, ATPCS and EEC2 switches have normally closed for both latched and unlatched function. The hubhop code is a toggle function. Which means if something happens within simulator there can be an error of what position the switch is. I would like to understand to code to see if I can change it to a code that is something along the lines of eec1 on and EEC2 off.
So whare is comes down to is where I'm the writing of the code so I depict toggle, latching, on off and selection like mode 1-4.
The code you have made for the MSATR ATPCS TOGGLE is as follows. (L: MSATR_ATPCS)!(>L: MSATR_ATPCS). How would I turn this code into ATPCS ON and ATPCS OFF rather than toggle. I have seen their are various codes that are toggle, on, off, latch etc
That is what I mean by being specific. That makes helping you a lot easier.
The code for this event is intended for unlatched switch.
(L:MSATR_ATPCS) ! (>L:MSATR_ATPCS)
Is the easiest to convert for a latching switch, because the Lvar is boolean, so it only takes two values 0 or 1.
For ON (put in On Press)
1 (>L:MSATR_ATPCS)
For OFF (put in On Release)
0 (>L:MSATR_ATPCS)
Can I do this to any code to convert to on off ?
I assume 0,1,2,3,4,5,6,7 would be eight positions rotary.
Yes, to any toggle that uses a boolean variable.
Do I have to state bool in the code I side brackets? Or is it automatically assumed
It often is as you show. I can't say it is universal.
The APTCS illumination is not working using the hubhop summitted preset.
@zealous thorn it's just that I have a 11way rotary on one panel. So I wasn't sure.
I haven't looked at that aircraft in a long time. Maybe some things have changed.
I don't believe you submitted it. But the one I am using will not illuminate the arm or off illumination.
I have found msfs2020 does not require strict variable units definition. The units can often be left out and are implicit in the operation made. However, I have found instances when reading an A variable, that units are necessary.
Ok inwuld prefer toake the effort and do the work on code just in case
I doesn't hurt to specify them.
I will potentially have 600 possible switches and illuminations so if everything is specificed it helps
well, we need to tackle one to know what the problem with that one switch is, even if it might apply to most of them
the ATPCS ARM led is done with this Lvar
ATPCS Off led is this
are these the ones you already tried and don't work?
@zealous thorn yes that is the code I am using but getting no activation from switch. All illuminating elements are test and confirmed in mobiflight with test function
what does getting no activation from switch mean?
you did use the switch toggle we talked about earlier, yes?
ok, I am testing with msfs2020
If I press the ATPCS button in the middle of the MIP, the off led comes on. I can see the (L:MSATR_ATPCS) lvar toggle between 0 and 1
and MSATR_ATPCS_OFF_LT lvar turning to 1 if the switch lvar is at 0
Msfs will be simulation RW will be real world.
Msfs full throttle the ATPCS arm illuminates this should then turn on arm Illumination in RW. But there is no activation i.e. arm Illumination coming on
How to to see the variables activating?
I see MSATR_ATPCS_ARM_LT going to 1 when I push throttle to max
I am using the dev mode behaviors, Local Variables tab
but you can also create outputs for those two variables and see what is returned from the sim to Mobiflight
In fact, you should already have those outputs created
if you report your leds are not turning on
I am confirming that the Lvars behave as expected.
If your led does not turn on, it is something else.
You should be able to see the output config receive a 1 or 0 in the Flight Sim value column in Mobiflight
Yes output created. But no 1 in output
show the output
of course you need to have connection to the sim and wasm module for this to work
green checkmarks at the bottom of the main window
I am using lamps no LEDs. Keep as originals possible. The lamps and all wires are working
Please see video of mobiflight test routine
test routine normally turns each led on in sequence. It seems yours is reversed.
Demo of activation in sim
please show the output config for the arm and off leds
Mobiflight is not registering the output of the arm or off from MSFS so wondering if it's the code as the hardware is working as designed
sim var, modify and display tabs for review
Not currently at desk
the lvars are working fine
Next chance I get I will upload
let me check with my Mobiflight
Ok
I know this is essentially experimental elements to MSFS so I'm trying to reduce as many issues and snags as possible
OHHH
STUPID TYPO IN THE CODE
the preset has this code
(L:MSATR_ENG_ATPCS_ARM_LT)
should be
(L:MSATR_ATPCS_ARM_LT)
ok, corrected both presets in Hubhop
update your events and you should reselect the preset
it should work fine now
gotta go
So the ENG section of code was wrong. Has it been updated to hubhop. I'm afraid I will have many of these silly questions to come.
I assume the off illumination code has the same typo
I see you have updated off also. Thank you
@zealous thorn thank you for looking into that. Yes indeed the mods work. Sorry for delay. Silly question when I activate the ANN LT test switch all the above should light as a test but I get no output from mobiflight!
Test conditions generally have to be added to the led output configs.
Ok how do I do that as I would like to have everything as per true to life.
I thought it was a matter of selecting all outputs and link to annlt test action
In some aircraft, like PMDG 737,the test logic is already integrated into the led status variable.
Ok. As it's the ATR72 how do I configure codes so when I test lights they illustrate
Do I just add something to end of code ?
You will need to add the test status variable as config reference and then use a Transform
if(#=1,1,$)
Alternatively, If you know RPN, you could add the same type of check directly into the Sim variable call.
(L:normal function) (L:ANN_LT_test status) or
Lvar Names are just for example.
@zealous thorn so this `if(#=1,1,$)' after the code variable
Not a separate action that illustrates all the bulbs via one code
So for instance for the (L:MASTR_ENG_EEC1_FAULT_LT), if(#=1,1,$), This would allow the bulb to light when tested
I assumed the Illuminations would just light up as the simulator would be triggered via simulator out in mobiflight.
there are two worlds: all RPN code (the (L:FOOBAR) stuff) happens inside the MSFS2020 preset code field
it gets run inside the simulator
and config references and if($=1 or #=1, then, else) stuff happens within MobiFlight: "transform" modifiers and many other input fields support config reference placeholders and ncalc syntax
but those two dont work together
(L:normal function) (L:ANN_LT_test status) or
``` so this but with the codes but addressed to bulb needed
All I need to know is what do I put on front or behind the output strong to get it to illuminatewhen I test illumination
if you want to have a config reference to test against, you need to do it outside of the RPN code
this is a bit confusing at first because the whole RPN code stuff is kind of a side effect in MSFS2020
oh wait
so its two ways, if you do like jaime said, you make your own L-var based on the light test switch
and then you can do like you said
but
its a variable, and it has to have a value.
In your OnPress of the light test switch you can set:
1 (>L:MyLightsTest, bool)
(set MyLightsTest L-variable to 1, it is a boolean (on/off type) variable
and then lets say your warning light is for pitot heat being on, for example - this can be anything
(A:PITOT HEAT,Bool)
this returns either 0 or 1
so
(A:PITOT HEAT,Bool) (L:MyLightsTest, bool) or
reads pitot heat A-var, and reads the MyLightsTest and does an "or" comparison for them
alternatively you can also do this with config references and modifiers, but cannot mix the two
Ok was hoping is was something simple like - test function added to code. So I could just attach to each code in a copy and paste function. So example of idea, overhead fully functional and when I set Ann Lt switch to test all illumination light as per real life cockpit. How would that be done without huge amounts of code changes?
So an evening sillier question why don't the announcers light when test switch is activated. Surely as the Illuminations are allocated with code should that not trigger it?
I think it depends on the way the aircraft is programmed. In the simulated warning light there is usually a sim variable that the panel code monitors (like oil pressure) and then if it is over a certain value, the light is shown
and then there might be another check in the code that also monitors the light test variable
another option like what PMDG does I think is that there is a custom airplane state that is maintained in the custom code and the warning lights are just communicated in sim variables outside this "airplane model" code
so the light just listens to the "oil pressure light" simvar
and then the custom code lights up all warning light variables if light test is pressed
harder to explain a bit but it depends if your led listens to "oil pressure" simvar, or "oil pressure warning light" simvar, depending on how the plane is programmed
you cannot obviously crank up the actual oil pressure or set engines on fire when testing warning lights
Ok so there is no generic variables to just test LEDs like you would in real aircraft?
Ok say we disregard the simulator part is there a way to test lamp using a switch directly to mobiflight? Like a hardware test function
Im clearly missing something here, is there a way to monitor the simulation outputs
Each and every output config in Mobiflight is constantly monitoring the status of that Sim output.
@zealous thorn brilliant where do I see that?
Mobiflight has an Outputs and Inputs section in the main window. All output configs are in Outputs section. If you create an output for say
(A:PITOT HEAT,Bool)
Mobiflight subscribes to that variable in the sim and receives its output, which is displayed in the Flight Sim value column.
From there you can do whatever you want in Mobiflight with that value.
Like turning on-off a Led, using it as a config reference, moving a servo motor or displaying the value in a 7-segment display.
I don't know what you are missing. Each led output can turn on or off depending on the value received by the output config for that led. You can combine two sim variables into one output result by using a Transform. It can be as simple as
if($=1 or #=1, 1,0)
In words, if either $ or # are equal to 1, then set the value to 1, all else, set it to 0.
$ and # are placeholders to two sim variables.
Ok I have done that as a mobiflight variable but when I test annlt to test nothing lights up. Excuse the confusion.
We need to see screenshots of your input and output configs. You haven't specified which aircraft you are working on? Mobiflight variables have nothing to do with sim variables, but you mention annlt, which I would understand to be a sim variable, so I don't understand what you are doing.
@zealous thorn same as before atr72-600
ok, sorry, I cannot remember what everyone is working on.
@zealous thorn that's ok I can understand you give a fair bit of advice.
We were working on the eec switches previously. All working and responding to custom codes. I went to trigger the Illumination test i.e. ANNLT TEST. Unfortunately non on the lamps turned on.
OK, the ANNLT TEST switch position input code sets the value to 0
0 (>L:MSATR_ITLS_ANNLT)
So doing this internally in Mobiflight. First create an output for this same Lvar (L:MSATR_ITLS_ANNLT)
there is no magic automatic solution
you have to add the transform check in every led output config.