Jump to content

Recommended Posts

Posted (edited)

I am using FlyWithLua to customize my joystick buttons.

Most everything works (thanks Hotstart by including the DataRefs and Commands in the documentation).

My problem is with the master caution and master warning commands

It looks like they are using the default xplane command (sim/annunciator/clear_master_caution)

When I run a command_once statement, nothing happens.

The other two functions work fine

Can anyone tell me where I am going wrong?

Thanks

 

function tbmuser_pitot_heat_on_LR()
 
command_once("tbm900/actuators/ice/pitot_r_on")
command_once("tbm900/actuators/ice/pitot_l_on")
 
end
create_command("tbmuser/test/pitot_heat", "pitot_heat_on_LR", "tbmuser_pitot_heat_on_LR()", "", "")
 
function tbmuser_pitot_heat_off_LR()
 
command_once("tbm900/actuators/ice/pitot_l_off")
command_once("tbm900/actuators/ice/pitot_r_off")
 
end
create_command("tbmuser/test/pitot_heat_off", "pitot_heat_off_LR", "tbmuser_pitot_heat_off_LR()", "", "")
 
function tbmuser_alarm_off()
 
command_once("sim/annunciator/clear_master_caution")
command_once("sim/annunciator/clear_master_warning")
 
 
end
create_command("tbmuser/test/alarm_off", "alarms_off", "tbmuser_alarm_off()", "", "")

 

 

Edited by skiselkov
Posted

The issue is with using command_once. The avionics system needs to have the command activated for at least 1 full frame. However command_once immediately fires all 3 phases of the command (begin+continue+end). That means the CAS control logic never sees the button "depressed" during the flight loop callback. The fix is to call command_begin and then call command_end on the NEXT simulator frame.

Posted

Thank you so much for your help.

Not sure what you mean by NEXT frame.

I tried the below commands but it does not work

Do I need to add a timer to wait for the next frame?

Thanks again.

function tbmuser_alarm_off()
 
command_begin("sim/annunciator/clear_master_caution")
command_end("sim/annunciator/clear_master_caution")

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...