Skip to content

Commit f603d7c

Browse files
authored
Use two param popupConfirmation on FreedomTX (ExpressLRS#1096)
1 parent 70125d9 commit f603d7c

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

src/lua/elrsV2.lua

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -782,6 +782,11 @@ local function runDevicePage(event)
782782
end
783783
end
784784

785+
local function popupCompat(t, m, e)
786+
-- Only use 2 of 3 arguments for older platforms
787+
return popupConfirmation(t, e)
788+
end
789+
785790
local function runPopupPage(event)
786791
if event == EVT_VIRTUAL_EXIT then -- exit script
787792
crossfireTelemetryPush(0x2D, { deviceId, handsetId, fieldPopup.id, 5 })
@@ -790,11 +795,11 @@ local function runPopupPage(event)
790795

791796
local result
792797
if fieldPopup.status == 0 and fieldPopup.lastStatus ~= 0 then -- stopped
793-
popupConfirmation(fieldPopup.info, "Stopped!", event)
798+
popupCompat(fieldPopup.info, "Stopped!", event)
794799
reloadAllField()
795800
fieldPopup = nil
796801
elseif fieldPopup.status == 3 then -- confirmation required
797-
result = popupConfirmation(fieldPopup.info, "PRESS [OK] to confirm", event)
802+
result = popupCompat(fieldPopup.info, "PRESS [OK] to confirm", event)
798803
fieldPopup.lastStatus = fieldPopup.status
799804
if result == "OK" then
800805
crossfireTelemetryPush(0x2D, { deviceId, handsetId, fieldPopup.id, 4 })
@@ -807,7 +812,7 @@ local function runPopupPage(event)
807812
if statusComplete then
808813
commandRunningIndicator = (commandRunningIndicator % 4) + 1
809814
end
810-
result = popupConfirmation(fieldPopup.info .. " [" .. string.sub("|/-\\", commandRunningIndicator, commandRunningIndicator) .. "]", "Press [RTN] to exit", event)
815+
result = popupCompat(fieldPopup.info .. " [" .. string.sub("|/-\\", commandRunningIndicator, commandRunningIndicator) .. "]", "Press [RTN] to exit", event)
811816
fieldPopup.lastStatus = fieldPopup.status
812817
if result == "CANCEL" then
813818
crossfireTelemetryPush(0x2D, { deviceId, handsetId, fieldPopup.id, 5 })
@@ -822,6 +827,13 @@ local function setLCDvar()
822827
lcd_title = (lcd.RGB ~= nil) and lcd_title_color or lcd_title_bw
823828
lcd_title_color = nil
824829
lcd_title_bw = nil
830+
-- Determine if popupConfirmation takes 3 arguments or 2
831+
--if pcall(popupConfirmation, "", "", EVT_VIRTUAL_EXIT) then
832+
-- major 1 is assumed to be FreedomTX
833+
local ver, radio, major = getVersion()
834+
if major ~= 1 then
835+
popupCompat = popupConfirmation
836+
end
825837
if LCD_W == 480 then
826838
COL2 = 240
827839
maxLineIndex = 10

0 commit comments

Comments
 (0)