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")

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

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