Fixed xmit and mode working when powering up

This commit is contained in:
Dan
2020-02-28 22:51:45 +00:00
parent e8d6ab1689
commit b3e7e87a25

View File

@@ -1351,8 +1351,10 @@ end )
-- Runs when the user presses any of the antenna mode buttons on the remote -- Runs when the user presses any of the antenna mode buttons on the remote
RegisterNUICallback( "setAntennaMode", function( data ) RegisterNUICallback( "setAntennaMode", function( data )
-- Only run the codw if the radar has power and is not powering up
if ( RADAR:IsPowerOn() and not RADAR:IsPoweringUp() ) then
-- As the mode buttons are used to exit the menu, we check for that -- As the mode buttons are used to exit the menu, we check for that
if ( RADAR:IsPowerOn() and RADAR:IsMenuOpen() ) then if ( RADAR:IsMenuOpen() ) then
-- Set the internal menu state to be closed (false) -- Set the internal menu state to be closed (false)
RADAR:SetMenuState( false ) RADAR:SetMenuState( false )
@@ -1371,12 +1373,15 @@ RegisterNUICallback( "setAntennaMode", function( data )
SendNUIMessage( { _type = "audio", name = "beep", vol = RADAR:GetSettingValue( "beep" ) } ) SendNUIMessage( { _type = "audio", name = "beep", vol = RADAR:GetSettingValue( "beep" ) } )
end ) end )
end end
end
end ) end )
-- Runs when the user presses either of the XMIT/HOLD buttons on the remote -- Runs when the user presses either of the XMIT/HOLD buttons on the remote
RegisterNUICallback( "toggleAntenna", function( data ) RegisterNUICallback( "toggleAntenna", function( data )
-- Only run the codw if the radar has power and is not powering up
if ( RADAR:IsPowerOn() and not RADAR:IsPoweringUp() ) then
-- As the xmit/hold buttons are used to change settings in the menu, we check for that -- As the xmit/hold buttons are used to change settings in the menu, we check for that
if ( RADAR:IsPowerOn() and RADAR:IsMenuOpen() ) then if ( RADAR:IsMenuOpen() ) then
-- Change the menu option based on which button is pressed -- Change the menu option based on which button is pressed
RADAR:ChangeMenuOption( data.value ) RADAR:ChangeMenuOption( data.value )
@@ -1392,12 +1397,13 @@ RegisterNUICallback( "toggleAntenna", function( data )
SendNUIMessage( { _type = "audio", name = RADAR:IsAntennaTransmitting( data.value ) and "xmit_on" or "xmit_off", vol = RADAR:GetSettingValue( "beep" ) } ) SendNUIMessage( { _type = "audio", name = RADAR:IsAntennaTransmitting( data.value ) and "xmit_on" or "xmit_off", vol = RADAR:GetSettingValue( "beep" ) } )
end ) end )
end end
end
end ) end )
-- Runs when the user presses the menu button on the remote control -- Runs when the user presses the menu button on the remote control
RegisterNUICallback( "menu", function() RegisterNUICallback( "menu", function()
-- Only run the codw if the radar has power -- Only run the codw if the radar has power and is not powering up
if ( RADAR:IsPowerOn() ) then if ( RADAR:IsPowerOn() and not RADAR:IsPoweringUp() ) then
-- As the menu button is a multipurpose button, we first check to see if the menu is already open -- As the menu button is a multipurpose button, we first check to see if the menu is already open
if ( RADAR:IsMenuOpen() ) then if ( RADAR:IsMenuOpen() ) then
-- As the menu is already open, we then iterate to the next option in the settings list -- As the menu is already open, we then iterate to the next option in the settings list