diff --git a/Lua_scripts/DSM FwdPrg_05_BW.lua b/Lua_scripts/DSM FwdPrg_05_BW.lua index 9293e9f..a7fed61 100644 --- a/Lua_scripts/DSM FwdPrg_05_BW.lua +++ b/Lua_scripts/DSM FwdPrg_05_BW.lua @@ -23,17 +23,12 @@ local DEBUG_ON_LCD = false -- Interactive Information on LCD of Menu data from local DSMLIB_PATH = "/SCRIPTS/TOOLS/DSMLIB/" -local dirExist = fstat(DSMLIB_PATH.."DsmFwPrgLib.lua") -if (dirExist==nil) then error("Make sure "..DSMLIB_PATH.." contains DsmFwPrgLib.lua") end -dirExist = fstat(DSMLIB_PATH.."DsmFwPrgSIMLib.lua") -if (dirExist==nil) then error("Make sure "..DSMLIB_PATH.." contains DsmFwPrgSIMLib.lua") end - local dsmLib if (SIMULATION_ON) then -- library with SIMILATION VERSION. Works really well in Companion for GUI development - dsmLib = loadScript(DSMLIB_PATH .. "DsmFwPrgSIMLib.lua")(DEBUG_ON) + dsmLib = assert(loadScript(DSMLIB_PATH.."DsmFwPrgSIMLib.lua"), "Not-Found: DSMLIB/DsmFwPrgSIMLib.lua")(DEBUG_ON) else - dsmLib = loadScript(DSMLIB_PATH .. "DsmFwPrgLib.lua")(DEBUG_ON) + dsmLib = assert(loadScript(DSMLIB_PATH.."DsmFwPrgLib.lua"),"Not-Found: DSMLIB/DsmFwPrgLib.lua")(DEBUG_ON) end local PHASE = dsmLib.PHASE @@ -42,6 +37,8 @@ local DISP_ATTR = dsmLib.DISP_ATTR local DSM_Context = dsmLib.DSM_Context +local IS_EDGETX = false -- DEFAULT until Init changed it + local LCD_W_USABLE = LCD_W-10 -- X for Menu Lines local LCD_X_LINE_MENU = 10 @@ -388,6 +385,12 @@ local function GUI_HandleEvent(event, touchState) end local function init_screen_pos() + -- osName in OpenTX is nil, otherwise is EDGETX + local ver, radio, maj, minor, rev, osname = getVersion() + if (osname==nil) then osname = "OpenTX" end -- OTX 2.3.14 and below returns nil + + IS_EDGETX = string.sub(osname,1,1) =='E' + if LCD_W == 480 then -- TX16 -- use defaults in the script header elseif LCD_W == 128 then --TX12 (128x64) -- Still needs some work on the vertical @@ -445,8 +448,10 @@ local function DSM_Run(event) refreshInterval = 20 -- 200ms end + if (not IS_EDGETX) then -- OPENTX NEEDS REFRESH ON EVERY CYCLE + GUI_Display() -- Refresh display only if needed and no faster than 500ms, utilize more CPU to speedup DSM communications - if (ctx.Refresh_Display and (getTime()-lastRefresh) > refreshInterval) then --300ms from last refresh + elseif (ctx.Refresh_Display and (getTime()-lastRefresh) > refreshInterval) then --300ms from last refresh GUI_Display() ctx.Refresh_Display=false lastRefresh=getTime() diff --git a/Lua_scripts/DSM FwdPrg_05_Color.lua b/Lua_scripts/DSM FwdPrg_05_Color.lua index e541d9c..b20db2e 100644 --- a/Lua_scripts/DSM FwdPrg_05_Color.lua +++ b/Lua_scripts/DSM FwdPrg_05_Color.lua @@ -25,20 +25,14 @@ local USE_SPECKTRUM_COLORS = true -- true: Use spectrum colors, false: use theme local DSMLIB_PATH = "/SCRIPTS/TOOLS/DSMLIB/" local IMAGE_PATH = DSMLIB_PATH .. "img/" -local dirExist = fstat(DSMLIB_PATH.."DsmFwPrgLib.lua") -if (dirExist==nil) then error("Make sure "..DSMLIB_PATH.." contains DsmFwPrgLib.lua") end -dirExist = fstat(DSMLIB_PATH.."DsmFwPrgSIMLib.lua") -if (dirExist==nil) then error("Make sure "..DSMLIB_PATH.." contains DsmFwPrgSIMLib.lua") end - local dsmLib if (SIMULATION_ON) then -- library with SIMILATION VERSION. Works really well in Companion for GUI development - dsmLib = loadScript(DSMLIB_PATH.."DsmFwPrgSIMLib.lua")(DEBUG_ON) + dsmLib = assert(loadScript(DSMLIB_PATH.."DsmFwPrgSIMLib.lua"), "Not-Found: DSMLIB/DsmFwPrgSIMLib.lua")(DEBUG_ON) else - dsmLib = loadScript(DSMLIB_PATH.."DsmFwPrgLib.lua")(DEBUG_ON) + dsmLib = assert(loadScript(DSMLIB_PATH.."DsmFwPrgLib.lua"),"Not-Found: DSMLIB/DsmFwPrgLib.lua")(DEBUG_ON) end - local PHASE = dsmLib.PHASE local LINE_TYPE = dsmLib.LINE_TYPE local DISP_ATTR = dsmLib.DISP_ATTR @@ -80,7 +74,7 @@ local LCD_MENU_BGCOLOR = MENU_TITLE_BGCOLOR -- LINE SELECTED local LCD_SELECTED_COLOR = TEXT_INVERTED_COLOR local LCD_SELECTED_BGCOLOR = TEXT_INVERTED_BGCOLOR -local LCD_EDIT_BGCOLOR = WARNING_COLOR +local LCD_EDIT_BGCOLOR = MENU_TITLE_BGCOLOR -- WARNING_COLOR -- NORMAL TEXT local LCD_NORMAL_COLOR = TEXT_COLOR local LCD_DISABLE_COLOR = TEXT_DISABLE_COLOR @@ -578,7 +572,9 @@ end local function init_colors() -- osName in OpenTX is nil, otherwise is EDGETX local ver, radio, maj, minor, rev, osname = getVersion() - IS_EDGETX = osname~=nil + if (osname==nil) then osname = "OpenTX" end -- OTX 2.3.14 and below returns nil + + IS_EDGETX = string.sub(osname,1,1) == 'E' if (IS_EDGETX and USE_SPECKTRUM_COLORS) then -- SPECKTRUM COLORS (only works on EDGETX) @@ -632,8 +628,10 @@ local function DSM_Run(event,touchState) refreshInterval = 20 -- 200ms end + if (not IS_EDGETX) then -- OPENTX NEEDS REFRESH ON EVERY CYCLE + GUI_Display() -- Refresh display only if needed and no faster than 300ms, utilize more CPU to speedup DSM communications - if (ctx.Refresh_Display and (getTime()-lastRefresh) > refreshInterval) then --300ms from last refresh + elseif (ctx.Refresh_Display and (getTime()-lastRefresh) > refreshInterval) then --300ms from last refresh GUI_Display() ctx.Refresh_Display=false lastRefresh=getTime() diff --git a/Lua_scripts/DSMLIB/DsmFwPrgSIMLib.lua b/Lua_scripts/DSMLIB/DsmFwPrgSIMLib.lua index adb465c..8a30c21 100644 --- a/Lua_scripts/DSMLIB/DsmFwPrgSIMLib.lua +++ b/Lua_scripts/DSMLIB/DsmFwPrgSIMLib.lua @@ -27,7 +27,7 @@ local DEBUG_ON = ... -- Get DebugON from parameters -local dsmLib = loadScript("/SCRIPTS/TOOLS/DSMLIB/DsmFwPrgLib.lua")(DEBUG_ON) +local dsmLib = assert(loadScript("/SCRIPTS/TOOLS/DSMLIB/DsmFwPrgLib.lua"))(DEBUG_ON) local PHASE = dsmLib.PHASE local LINE_TYPE = dsmLib.LINE_TYPE diff --git a/Lua_scripts/DSMLIB/readme.md b/Lua_scripts/DSMLIB/readme.md index c640887..1a27f2f 100644 --- a/Lua_scripts/DSMLIB/readme.md +++ b/Lua_scripts/DSMLIB/readme.md @@ -27,6 +27,10 @@ Please report of you have test it with other receivers to update the documentati If you get `"Unable to Load menu lines"` when trying to navidate to a menu, could be that the code needs to be specially adapter to mandle that menu in a different way than others. We did that HACK for AR631/AR637 for the `Initial Setup` and `Initial Safe Setup` menus. Before starting the script again, the problem shouls show at the log. Usually not been able to process some `Unknown_0x5` lines who has not been fully reversed engineered (you can share the logs with us to try to understand what is going on. +# Flight mode/Gain channels + +I ran into a case where trying to set Aux2 or Aux3 for flight mode, but the RX was correcting it to Aux1.. the RX only was allowing Gear or Aux1 (AR631/AR637). +This is because the RX don't know that we are using more than 6 channels. To make the RX aware that there are other channels, while edditing the channel, you have to toggle the switch to excersist the channel, and now the RX will recognize it. # Deployment