From 60047e2c73c0eec1d1ddf0a46ba0c4b7b0474ffa Mon Sep 17 00:00:00 2001 From: Frankie Arzu <32604366+frankiearzu@users.noreply.github.com> Date: Sun, 20 Nov 2022 11:24:47 -0600 Subject: [PATCH] Frankie dsm fwrd prg enhancements (#762) * #751 DSM Enhancements #751 DSM Forward Programming Enhancements (New GUI, etc) * Make both work on EdgeTx and OpenTX * #751 Turn OFF simulation by default Distribution code with RX simulation OFF Simulation should be only for Development * #751 Update Readme Documentation Updated the Readme.txt documentation and removed compiled luac file that was check in by mistake * #751 Fix problems With Reset RX 1. Fix problem when trying to Factory Reset. Enter Bind Mode. Save backup, Restore Backup 2. Found a way to advance on the Gyro initial Setup menus.. a bit of a hack, but works. 3. Handle RX resets properly. It needed after initial setup * #751 Cosmetic and Show Orientation Images #751 1. Fix problems when text contradictions between Menu/Line Headers and List Values 2. Show Images of RX orientations 3. Able to Hack getting into Initial Setup and other menus who was failing before 4. Custumize the way Flight Mode reports the Value on Screen * #751 add check for required libraries Add check that the required files in DSMLIB exist Co-authored-by: pascallanger --- Lua_scripts/DSM FwdPrg_05_BW.lua | 12 +++++++++--- Lua_scripts/DSM FwdPrg_05_Color.lua | 14 ++++++++++---- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/Lua_scripts/DSM FwdPrg_05_BW.lua b/Lua_scripts/DSM FwdPrg_05_BW.lua index 539d68a..9293e9f 100644 --- a/Lua_scripts/DSM FwdPrg_05_BW.lua +++ b/Lua_scripts/DSM FwdPrg_05_BW.lua @@ -21,13 +21,19 @@ local SIMULATION_ON = false -- FALSE: use real communication to DSM RX (DEFAULT local DEBUG_ON = 1 -- 0=NO DEBUG, 1=HIGH LEVEL 2=LOW LEVEL (Debug logged into the /LOGS/dsm.log) local DEBUG_ON_LCD = false -- Interactive Information on LCD of Menu data from RX +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("/SCRIPTS/TOOLS/DSMLIB/DsmFwPrgSIMLib.lua")(DEBUG_ON) + dsmLib = loadScript(DSMLIB_PATH .. "DsmFwPrgSIMLib.lua")(DEBUG_ON) else - dsmLib = loadScript("/SCRIPTS/TOOLS/DSMLIB/DsmFwPrgLib.lua")(DEBUG_ON) + dsmLib = loadScript(DSMLIB_PATH .. "DsmFwPrgLib.lua")(DEBUG_ON) end local PHASE = dsmLib.PHASE @@ -68,7 +74,7 @@ local function GUI_SwitchSimulationOFF() dsmLib.LOG_close() SIMULATION_ON = false - dsmLib = loadScript("/SCRIPTS/TOOLS/DSMLIB/DsmFwPrgLib.lua")(DEBUG_ON) + dsmLib = loadScript(DSMLIB_PATH .. "DsmFwPrgLib.lua")(DEBUG_ON) DSM_Context = dsmLib.DSM_Context dsmLib.Init(toolName) -- Initialize Library diff --git a/Lua_scripts/DSM FwdPrg_05_Color.lua b/Lua_scripts/DSM FwdPrg_05_Color.lua index 908bf84..e541d9c 100644 --- a/Lua_scripts/DSM FwdPrg_05_Color.lua +++ b/Lua_scripts/DSM FwdPrg_05_Color.lua @@ -22,16 +22,22 @@ local SIMULATION_ON = false -- FALSE: use real communication to DSM RX (DEFAUL local DEBUG_ON = 1 -- 0=NO DEBUG, 1=HIGH LEVEL 2=LOW LEVEL (Debug logged into the /LOGS/dsm.log) local DEBUG_ON_LCD = false -- Interactive Information on LCD of Menu data from RX local USE_SPECKTRUM_COLORS = true -- true: Use spectrum colors, false: use theme colors (default on OpenTX) +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("/SCRIPTS/TOOLS/DSMLIB/DsmFwPrgSIMLib.lua")(DEBUG_ON) + dsmLib = loadScript(DSMLIB_PATH.."DsmFwPrgSIMLib.lua")(DEBUG_ON) else - dsmLib = loadScript("/SCRIPTS/TOOLS/DSMLIB/DsmFwPrgLib.lua")(DEBUG_ON) + dsmLib = loadScript(DSMLIB_PATH.."DsmFwPrgLib.lua")(DEBUG_ON) end -local IMAGE_PATH = "/SCRIPTS/TOOLS/DSMLIB/img/" local PHASE = dsmLib.PHASE local LINE_TYPE = dsmLib.LINE_TYPE @@ -97,7 +103,7 @@ local function GUI_SwitchSimulationOFF() dsmLib.LOG_close() SIMULATION_ON = false - dsmLib = loadScript("/SCRIPTS/TOOLS/DSMLIB/DsmFwPrgLib.lua")(DEBUG_ON) + dsmLib = loadScript(DSMLIB_PATH .. "DsmFwPrgLib.lua")(DEBUG_ON) DSM_Context = dsmLib.DSM_Context dsmLib.Init(toolName) -- Initialize Library