#751 add check for required libraries

Add check that the required files in DSMLIB exist
This commit is contained in:
Frankie Arzu 2022-11-20 11:22:35 -06:00
parent bb9873d772
commit 0c52932305
2 changed files with 20 additions and 7 deletions

View File

@ -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

View File

@ -22,16 +22,23 @@ 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 +104,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