lancealotg Posted May 10, 2019 Report Posted May 10, 2019 (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 May 10, 2019 by skiselkov Quote
skiselkov Posted May 10, 2019 Report Posted May 10, 2019 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. Quote
lancealotg Posted May 10, 2019 Author Report Posted May 10, 2019 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") Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.