Hi, here's real quiz for the smart folks,
If there isn't a command in the dataref tool list for a particular Xplane switch, (in my case I'm looking for the Cessna 172 fuel valve shut off) can this be assigned in some other fashion to control it with hardware?
I found this ( laminar/c172/fuel/fuel_cutoff_selector ) The dataref tool toggles a value of 1 and zero when I activate it on and off with my mouse, but it wasn't under the command list.
Hope this makes sense.
Mikemike
XPL command missing??
Re: XPL command missing??
Yes is the simple answer. If that Datarefs is writable then just change the dataref with xpl_dataref_write(). If not then you can do it by setting the fuel selector to 0. If you want to get smart you can inhibit the fuel selector moving when you do this so the graphic at least stays where you left it.
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: XPL command missing??
Ok, I will give that a try.
Thanks!
Thanks!
Re: XPL command missing??
sim/fuel/fuel_selector_lft and sim/fuel/fuel_selector_ctr for example don't work? Then you'll indeed have to write the dataref.
Re: XPL command missing??
ok thanks,
I wasn't aware that you could write new datarefs. I just assumed that if it wasnt originally coded into the sim program then I would be out of luck.
Mikemike
I wasn't aware that you could write new datarefs. I just assumed that if it wasnt originally coded into the sim program then I would be out of luck.
Mikemike
Re: XPL command missing??
Code: Select all
--function fuel_valve (position)
-- if position == 0 then
-- print("switch position moved 0")
-- end
-- if position == 1 then
-- print("switch position moved 1")
-- end
--end
---------------------------------------------------------------------------------------
function fuel_valve(position)
if position == 1 then
xpl_dataref_write("sim/cockpit/engine/fuel_tank_selector", "INT", 0)
elseif position == 0 then
xpl_dataref_write("sim/cockpit/engine/fuel_tank_selector", "INT", 4)
end
end
---------------------------------------------------------------------------------------
hw_switch_add ("ARDUINO_MEGA2560_A_D12", fuel_valve)
Mikemike
Re: XPL command missing??
Yes all prints should be removed from final code. Each print takes time and slows down execution.
Strictly speaking if they only get used a few time’s in code you shouldn’t notice it but you certainly wouldn’t want them in a fast updating callback. It’s just good practice to remove or comment out them all.
Strictly speaking if they only get used a few time’s in code you shouldn’t notice it but you certainly wouldn’t want them in a fast updating callback. It’s just good practice to remove or comment out them all.
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: XPL command missing??
I see, Thank you.Sling wrote: ↑Fri Feb 26, 2021 2:47 am Yes all prints should be removed from final code. Each print takes time and slows down execution.
Strictly speaking if they only get used a few time’s in code you shouldn’t notice it but you certainly wouldn’t want them in a fast updating callback. It’s just good practice to remove or comment out them all.
Mike
Re: XPL command missing??
Hi,
Did you get the fuel cutoff valve working? If you did, can you please send me a copy? I would like to add it to my simulator.
Thanks,
Rich
Did you get the fuel cutoff valve working? If you did, can you please send me a copy? I would like to add it to my simulator.
Thanks,
Rich