help with fmc message light
help with fmc message light
Hi all I will admit straight away that I'm new to scripting, what I'm trying to achieve is to make an LED light up when the fmc message light illuminates in the sim, I'm using the zibo mod with Xplane. I have spent all day on it and seem more confused than when i started, can't get my head around it.
The dataref for the light is laminar/B738/fmod/fms_message (i think)
Im using arduino mega2560 and the led is connected to A15
If someone could help me out it would give me a starting block to work out some more.
much appreciated
Ian
The dataref for the light is laminar/B738/fmod/fms_message (i think)
Im using arduino mega2560 and the led is connected to A15
If someone could help me out it would give me a starting block to work out some more.
much appreciated
Ian
Re: help with fmc message light
If you post the code you already started we can help you figure out where you are going wrong.
Air Manager panels at https://www.experimentalsimavionics.com
Youtube Channel https://www.youtube.com/channel/UC8ZqXX ... kfZMq5BKig
Air Manager API Tutorial Video Series https://youtube.com/playlist?list=PLNr0 ... baT4gJKg5D
Youtube Channel https://www.youtube.com/channel/UC8ZqXX ... kfZMq5BKig
Air Manager API Tutorial Video Series https://youtube.com/playlist?list=PLNr0 ... baT4gJKg5D
Re: help with fmc message light
I need sleep!
I deleted everything i had to start again as i messed it up so much, this is as far as i've got using samples i found to try and figure it out.
-- This function will be called when new data is available from X-plane
function fmc_message(altitude)
print("fmc_message: " .. altitude)
end
-- subscribe X-plane datarefs on the AirBus
xpl_dataref_subscribe("laminar/B738/fmod/fms_message", "FLOAT", fmc_message)
outp_id = hw_output_add("fmc_message", false)
This is probably all wrong and makes no sense but its updating the console in air manger from 0.0 to 1.0 and back to 0.0 again when i make the message light some on in the sim.
Ian
I deleted everything i had to start again as i messed it up so much, this is as far as i've got using samples i found to try and figure it out.
-- This function will be called when new data is available from X-plane
function fmc_message(altitude)
print("fmc_message: " .. altitude)
end
-- subscribe X-plane datarefs on the AirBus
xpl_dataref_subscribe("laminar/B738/fmod/fms_message", "FLOAT", fmc_message)
outp_id = hw_output_add("fmc_message", false)
This is probably all wrong and makes no sense but its updating the console in air manger from 0.0 to 1.0 and back to 0.0 again when i make the message light some on in the sim.
Ian
Re: help with fmc message light
Ian,
You are almost there. You just need to update the output to toggle your external led.
Notice i’ve posted this code in a code box. Please do this next time as it’s easier for us to read.
You’ll also notice I called the callback data msg_lt as this is more meaningful than altitude which has noting to do with this. Other than that all I added was a couple of lines to handle the hardware output updating.
I hope this helps.
Tony
You are almost there. You just need to update the output to toggle your external led.
Notice i’ve posted this code in a code box. Please do this next time as it’s easier for us to read.
Code: Select all
-- This function will be called when new data is available from X-plane
function fmc_message(msg_lt)
print("fmc_message: " .. msg_lt)
local msg_lt_on = fif(msg_lt == 1, true, false)
hw_output_set(outp_id, msg_lt_on)
end
-- subscribe X-plane datarefs on the AirBus
xpl_dataref_subscribe("laminar/B738/fmod/fms_message", "FLOAT", fmc_message)
outp_id = hw_output_add("fmc_message", false)
I hope this helps.
Tony
Air Manager panels at https://www.experimentalsimavionics.com
Youtube Channel https://www.youtube.com/channel/UC8ZqXX ... kfZMq5BKig
Air Manager API Tutorial Video Series https://youtube.com/playlist?list=PLNr0 ... baT4gJKg5D
Youtube Channel https://www.youtube.com/channel/UC8ZqXX ... kfZMq5BKig
Air Manager API Tutorial Video Series https://youtube.com/playlist?list=PLNr0 ... baT4gJKg5D
Re: help with fmc message light
thanks Tony
seeing the code i require makes it so much easier to understand, when i did it first time round i did change the altitude but forgot this time round.........It was 5am and i'd been experimenting all night
Ian
seeing the code i require makes it so much easier to understand, when i did it first time round i did change the altitude but forgot this time round.........It was 5am and i'd been experimenting all night
Ian
Re: help with fmc message light
Tony
I have now used the code and fired up the sim, The led comes on as it should but goes out after a few seconds while the msg light in the sim remains lit, I noticed in the dataref tool that the msg light data ref is sending 1.0 then a few seconds later 0.0, this is also the case in the air manager console.
How would i keep the led lit to match the fmc in the sim?
Ian
I have now used the code and fired up the sim, The led comes on as it should but goes out after a few seconds while the msg light in the sim remains lit, I noticed in the dataref tool that the msg light data ref is sending 1.0 then a few seconds later 0.0, this is also the case in the air manager console.
How would i keep the led lit to match the fmc in the sim?
Ian
Re: help with fmc message light
Hmm,
You would need a data source that matches what the sim is doing unless you can spot a pattern like the light always stays on for a fixed amount longer than what the dataref says. There must be some trigger that makes the sim light turn off. You just need to figure out what it is.
Tony
You would need a data source that matches what the sim is doing unless you can spot a pattern like the light always stays on for a fixed amount longer than what the dataref says. There must be some trigger that makes the sim light turn off. You just need to figure out what it is.
Tony
Air Manager panels at https://www.experimentalsimavionics.com
Youtube Channel https://www.youtube.com/channel/UC8ZqXX ... kfZMq5BKig
Air Manager API Tutorial Video Series https://youtube.com/playlist?list=PLNr0 ... baT4gJKg5D
Youtube Channel https://www.youtube.com/channel/UC8ZqXX ... kfZMq5BKig
Air Manager API Tutorial Video Series https://youtube.com/playlist?list=PLNr0 ... baT4gJKg5D
Re: help with fmc message light
Tony
ok thanks I'll see what i can find
Thanks for your help so far
Very much appreciated
Ian
ok thanks I'll see what i can find
Thanks for your help so far
Very much appreciated
Ian
Re: help with fmc message light
Tony sussed it,
was using the wrong data ref
This is what was required laminar/B738/fmc/fmc_message instead of laminar/B738/fmod/fms_message
This value stays at 1 while the light on the sim fmc is illuminated thus keeping the physical led lit.
The fmod dataref was for the ding sound that occurs when the light comes on, hence the 0.0, 1.0, 0.0
was using the wrong data ref
This is what was required laminar/B738/fmc/fmc_message instead of laminar/B738/fmod/fms_message
This value stays at 1 while the light on the sim fmc is illuminated thus keeping the physical led lit.
The fmod dataref was for the ding sound that occurs when the light comes on, hence the 0.0, 1.0, 0.0
Re: help with fmc message light
That makes sense. Glad you have it working now
Air Manager panels at https://www.experimentalsimavionics.com
Youtube Channel https://www.youtube.com/channel/UC8ZqXX ... kfZMq5BKig
Air Manager API Tutorial Video Series https://youtube.com/playlist?list=PLNr0 ... baT4gJKg5D
Youtube Channel https://www.youtube.com/channel/UC8ZqXX ... kfZMq5BKig
Air Manager API Tutorial Video Series https://youtube.com/playlist?list=PLNr0 ... baT4gJKg5D