diff --git a/scripts/dashx/app/app.lua b/scripts/dashx/app/app.lua index 3d9e99a..507b610 100644 --- a/scripts/dashx/app/app.lua +++ b/scripts/dashx/app/app.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) dashx Project @@ -24,7 +25,7 @@ app.initialized = false local utils = dashx.utils local log = utils.log -local compile = dashx.compiler.loadfile +local compile = loadfile local arg = {...} diff --git a/scripts/dashx/app/lib/ui.lua b/scripts/dashx/app/lib/ui.lua index 848804f..dd4fe97 100644 --- a/scripts/dashx/app/lib/ui.lua +++ b/scripts/dashx/app/lib/ui.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) dashx Project @@ -961,7 +962,7 @@ local function getHelpData(section) local helpPath = "app/modules/" .. section .. "/help.lua" if dashx.utils.file_exists(helpPath) then local ok, helpData = pcall(function() - return assert(dashx.compiler.loadfile(helpPath))() + return assert(loadfile(helpPath))() end) ui._helpCache[section] = (ok and type(helpData)=="table") and helpData or false else @@ -1005,14 +1006,14 @@ function ui.openPage(idx, title, script, extra1, extra2, extra3, extra5, extra6) -- Load the module local modulePath = "app/modules/" .. script - dashx.app.Page = assert(dashx.compiler.loadfile(modulePath))(idx) + dashx.app.Page = assert(loadfile(modulePath))(idx) -- Load the help file if it exists local section = script:match("([^/]+)") local helpData = getHelpData(section) dashx.app.fieldHelpTxt = helpData and helpData.fields or nil - -- dashx.app.Page = assert(dashx.compiler.loadfile(modulePath))(idx) + -- dashx.app.Page = assert(loadfile(modulePath))(idx) -- If the Page has its own openPage function, use it and return early if dashx.app.Page.openPage then dashx.app.Page.openPage(idx, title, script, extra1, extra2, extra3, extra5, extra6) @@ -1094,7 +1095,7 @@ function ui.openPageDashboard(idx, title, script, source, folder) -- Load the module local modulePath = script - dashx.app.Page = assert(dashx.compiler.loadfile(modulePath))(idx) + dashx.app.Page = assert(loadfile(modulePath))(idx) -- load up the menu local w, h = dashx.utils.getWindowSize() diff --git a/scripts/dashx/app/lib/utils.lua b/scripts/dashx/app/lib/utils.lua index 3c809c2..8028af3 100644 --- a/scripts/dashx/app/lib/utils.lua +++ b/scripts/dashx/app/lib/utils.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) dashx Project diff --git a/scripts/dashx/app/modules/init.lua b/scripts/dashx/app/modules/init.lua index bedff0e..8d3af18 100644 --- a/scripts/dashx/app/modules/init.lua +++ b/scripts/dashx/app/modules/init.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) dashx Project @@ -19,7 +20,7 @@ ]] -- local pages = {} -local sections = dashx.compiler.loadfile("app/modules/sections.lua")() +local sections = loadfile("app/modules/sections.lua")() -- find the modules (this should already have been done in the tasks/tasks.lua script but we catch and retry on the offchance it hasn't) if dashx.app.moduleList == nil then dashx.app.moduleList = dashx.utils.findModules() end diff --git a/scripts/dashx/app/modules/logs/help.lua b/scripts/dashx/app/modules/logs/help.lua index 3c196d0..534004e 100644 --- a/scripts/dashx/app/modules/logs/help.lua +++ b/scripts/dashx/app/modules/logs/help.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) dashx Project * diff --git a/scripts/dashx/app/modules/logs/init.lua b/scripts/dashx/app/modules/logs/init.lua index 8bd77aa..9e5269d 100644 --- a/scripts/dashx/app/modules/logs/init.lua +++ b/scripts/dashx/app/modules/logs/init.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) dashx Project * diff --git a/scripts/dashx/app/modules/logs/lib/utils.lua b/scripts/dashx/app/modules/logs/lib/utils.lua index 7ff378e..9a80b40 100644 --- a/scripts/dashx/app/modules/logs/lib/utils.lua +++ b/scripts/dashx/app/modules/logs/lib/utils.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") local utils = {} --- Resolves model name from telemetry folder's configuration file diff --git a/scripts/dashx/app/modules/logs/logs_logs.lua b/scripts/dashx/app/modules/logs/logs_logs.lua index d877b98..26bbbc6 100644 --- a/scripts/dashx/app/modules/logs/logs_logs.lua +++ b/scripts/dashx/app/modules/logs/logs_logs.lua @@ -1,4 +1,5 @@ -local utils = assert(dashx.compiler.loadfile("SCRIPTS:/" .. dashx.config.baseDir .. "/app/modules/logs/lib/utils.lua"))() +local dashx = require("dashx") +local utils = assert(loadfile("SCRIPTS:/" .. dashx.config.baseDir .. "/app/modules/logs/lib/utils.lua"))() local triggerOverRide = false local triggerOverRideAll = false diff --git a/scripts/dashx/app/modules/logs/logs_view.lua b/scripts/dashx/app/modules/logs/logs_view.lua index 551b271..7758c14 100644 --- a/scripts/dashx/app/modules/logs/logs_view.lua +++ b/scripts/dashx/app/modules/logs/logs_view.lua @@ -1,5 +1,6 @@ +local dashx = require("dashx") -- display vars -local utils = assert(dashx.compiler.loadfile("SCRIPTS:/" .. dashx.config.baseDir .. "/app/modules/logs/lib/utils.lua"))() +local utils = assert(loadfile("SCRIPTS:/" .. dashx.config.baseDir .. "/app/modules/logs/lib/utils.lua"))() local res = system.getVersion() local LCD_W = res.lcdWidth local LCD_H = res.lcdHeight diff --git a/scripts/dashx/app/modules/model/help.lua b/scripts/dashx/app/modules/model/help.lua index 968317e..cfada9a 100644 --- a/scripts/dashx/app/modules/model/help.lua +++ b/scripts/dashx/app/modules/model/help.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) dashx Project * diff --git a/scripts/dashx/app/modules/model/init.lua b/scripts/dashx/app/modules/model/init.lua index 009c9bb..b465d4a 100644 --- a/scripts/dashx/app/modules/model/init.lua +++ b/scripts/dashx/app/modules/model/init.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) dashx Project * diff --git a/scripts/dashx/app/modules/model/model.lua b/scripts/dashx/app/modules/model/model.lua index 0fef06d..b12fb61 100644 --- a/scripts/dashx/app/modules/model/model.lua +++ b/scripts/dashx/app/modules/model/model.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") local enableWakeup = false local S_PAGES = { @@ -91,7 +92,7 @@ local function openPage(pidx, title, script) if dashx.preferences.menulastselected["model"] == nil then dashx.preferences.menulastselected["model"] = 1 end - local Menu = assert(dashx.compiler.loadfile("app/modules/" .. script))() + local Menu = assert(loadfile("app/modules/" .. script))() local pages = S_PAGES local lc = 0 local bx = 0 diff --git a/scripts/dashx/app/modules/model/tools/battery.lua b/scripts/dashx/app/modules/model/tools/battery.lua index adb3878..fb29b8d 100644 --- a/scripts/dashx/app/modules/model/tools/battery.lua +++ b/scripts/dashx/app/modules/model/tools/battery.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") local settings = {} local enableWakeup = false diff --git a/scripts/dashx/app/modules/model/tools/triggers.lua b/scripts/dashx/app/modules/model/tools/triggers.lua index f5d10fe..822ada3 100644 --- a/scripts/dashx/app/modules/model/tools/triggers.lua +++ b/scripts/dashx/app/modules/model/tools/triggers.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") local enableWakeup = false diff --git a/scripts/dashx/app/modules/sections.lua b/scripts/dashx/app/modules/sections.lua index a2323f9..32c8f87 100644 --- a/scripts/dashx/app/modules/sections.lua +++ b/scripts/dashx/app/modules/sections.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) dashx Project diff --git a/scripts/dashx/app/modules/settings/help.lua b/scripts/dashx/app/modules/settings/help.lua index 968317e..cfada9a 100644 --- a/scripts/dashx/app/modules/settings/help.lua +++ b/scripts/dashx/app/modules/settings/help.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) dashx Project * diff --git a/scripts/dashx/app/modules/settings/init.lua b/scripts/dashx/app/modules/settings/init.lua index b691b59..0a73384 100644 --- a/scripts/dashx/app/modules/settings/init.lua +++ b/scripts/dashx/app/modules/settings/init.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) dashx Project * diff --git a/scripts/dashx/app/modules/settings/settings.lua b/scripts/dashx/app/modules/settings/settings.lua index 0f3d537..4c8dd40 100644 --- a/scripts/dashx/app/modules/settings/settings.lua +++ b/scripts/dashx/app/modules/settings/settings.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") local S_PAGES = { @@ -95,7 +96,7 @@ local function openPage(pidx, title, script) if dashx.preferences.menulastselected["settings"] == nil then dashx.preferences.menulastselected["settings"] = 1 end - local Menu = assert(dashx.compiler.loadfile("app/modules/" .. script))() + local Menu = assert(loadfile("app/modules/" .. script))() local pages = S_PAGES local lc = 0 local bx = 0 diff --git a/scripts/dashx/app/modules/settings/tools/audio.lua b/scripts/dashx/app/modules/settings/tools/audio.lua index 0cd0444..35d02a7 100644 --- a/scripts/dashx/app/modules/settings/tools/audio.lua +++ b/scripts/dashx/app/modules/settings/tools/audio.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") @@ -79,7 +80,7 @@ local function openPage(pidx, title, script) if dashx.preferences.menulastselected["settings_dashboard"] == nil then dashx.preferences.menulastselected["settings_dashboard"] = 1 end - local Menu = assert(dashx.compiler.loadfile("app/modules/" .. script))() + local Menu = assert(loadfile("app/modules/" .. script))() local pages = S_PAGES local lc = 0 local bx = 0 diff --git a/scripts/dashx/app/modules/settings/tools/audio_events.lua b/scripts/dashx/app/modules/settings/tools/audio_events.lua index 776c502..d30fc17 100644 --- a/scripts/dashx/app/modules/settings/tools/audio_events.lua +++ b/scripts/dashx/app/modules/settings/tools/audio_events.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") local settings = {} local enableWakeup = false diff --git a/scripts/dashx/app/modules/settings/tools/audio_switches.lua b/scripts/dashx/app/modules/settings/tools/audio_switches.lua index 7fa5e6e..79077d7 100644 --- a/scripts/dashx/app/modules/settings/tools/audio_switches.lua +++ b/scripts/dashx/app/modules/settings/tools/audio_switches.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") local settings = {} local enableWakeup = false diff --git a/scripts/dashx/app/modules/settings/tools/dashboard.lua b/scripts/dashx/app/modules/settings/tools/dashboard.lua index 99d7b7f..016641c 100644 --- a/scripts/dashx/app/modules/settings/tools/dashboard.lua +++ b/scripts/dashx/app/modules/settings/tools/dashboard.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") @@ -79,7 +80,7 @@ local function openPage(pidx, title, script) if dashx.preferences.menulastselected["settings_dashboard"] == nil then dashx.preferences.menulastselected["settings_dashboard"] = 1 end - local Menu = assert(dashx.compiler.loadfile("app/modules/" .. script))() + local Menu = assert(loadfile("app/modules/" .. script))() local pages = S_PAGES local lc = 0 local bx = 0 diff --git a/scripts/dashx/app/modules/settings/tools/dashboard_settings.lua b/scripts/dashx/app/modules/settings/tools/dashboard_settings.lua index a0c850e..85bb082 100644 --- a/scripts/dashx/app/modules/settings/tools/dashboard_settings.lua +++ b/scripts/dashx/app/modules/settings/tools/dashboard_settings.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") local themesBasePath = "SCRIPTS:/" .. dashx.config.baseDir .. "/widgets/dashboard/themes/" diff --git a/scripts/dashx/app/modules/settings/tools/dashboard_theme.lua b/scripts/dashx/app/modules/settings/tools/dashboard_theme.lua index 88128b4..a256836 100644 --- a/scripts/dashx/app/modules/settings/tools/dashboard_theme.lua +++ b/scripts/dashx/app/modules/settings/tools/dashboard_theme.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") local settings = {} local settings_model = {} diff --git a/scripts/dashx/app/modules/settings/tools/development.lua b/scripts/dashx/app/modules/settings/tools/development.lua index 0341abd..f2d4b78 100644 --- a/scripts/dashx/app/modules/settings/tools/development.lua +++ b/scripts/dashx/app/modules/settings/tools/development.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") local settings = {} local enableWakeup = false @@ -36,23 +37,6 @@ formFieldCount = formFieldCount + 1 end) - formFieldCount = formFieldCount + 1 - dashx.session.formLineCnt = dashx.session.formLineCnt + 1 - dashx.app.formLines[dashx.session.formLineCnt] = form.addLine("@i18n(app.modules.settings.txt_compilation)@") - dashx.app.formFields[formFieldCount] = form.addBooleanField(dashx.app.formLines[dashx.session.formLineCnt], - nil, - function() - if dashx.preferences and dashx.preferences.developer then - return settings['compile'] - end - end, - function(newValue) - if dashx.preferences and dashx.preferences.developer then - settings.compile = newValue - end - end) - - local logpanel = form.addExpansionPanel("@i18n(app.modules.settings.txt_logging)@") logpanel:open(false) diff --git a/scripts/dashx/app/modules/settings/tools/general.lua b/scripts/dashx/app/modules/settings/tools/general.lua index fe251fa..6232a5e 100644 --- a/scripts/dashx/app/modules/settings/tools/general.lua +++ b/scripts/dashx/app/modules/settings/tools/general.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") local settings = {} local enableWakeup = false diff --git a/scripts/dashx/app/modules/settings/tools/localizations.lua b/scripts/dashx/app/modules/settings/tools/localizations.lua index aac87e9..d4d33e4 100644 --- a/scripts/dashx/app/modules/settings/tools/localizations.lua +++ b/scripts/dashx/app/modules/settings/tools/localizations.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") local settings = {} local enableWakeup = false diff --git a/scripts/dashx/app/radios.lua b/scripts/dashx/app/radios.lua index 7d46baa..da769ad 100644 --- a/scripts/dashx/app/radios.lua +++ b/scripts/dashx/app/radios.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") local LCD_W, LCD_H = dashx.utils.getWindowSize() local resolution = LCD_W .. "x" .. LCD_H diff --git a/scripts/dashx/lib/compile.lua b/scripts/dashx/lib/compile.lua deleted file mode 100644 index 15abf2a..0000000 --- a/scripts/dashx/lib/compile.lua +++ /dev/null @@ -1,233 +0,0 @@ ---[[ - * dashx - Deferred/Throttled Lua Script Compilation and Caching - * ENV-aware, keyed by config.baseDir to allow coexistence with other suites. - * License GPLv3: https://www.gnu.org/licenses/gpl-3.0.en.html -]] - -local compile = {} -local arg = {...} -local config = arg[1] or {} --- Use the suite key passed from main.lua (dashx.config.baseDir = "dashx") -local SUITE = (config and config.baseDir) or "dashx" - --- Environment captured from loader (includes `dashx` from main.lua) -local ENV = _ENV or _G - --- Always run loaded chunks under ENV (Lua 5.1 fallback uses setfenv) -local function loadfile_in_env(path) - if setfenv and _VERSION == "Lua 5.1" then - local chunk, err = loadfile(path) - if not chunk then return nil, err end - setfenv(chunk, ENV) - return chunk - else - -- nil mode = accept text/bytecode; third arg = env (ETHOS-friendly) - return loadfile(path, nil, ENV) - end -end - -compile._startTime = os.clock() -compile._startupDelay = 15 -- seconds before starting any compiles - --- Optional timing flag (if present in preferences) -local logTimings = true -if dashx and dashx.config then - if type(dashx.preferences.developer.compilerTiming) == "boolean" then - logTimings = dashx.preferences.developer.compilerTiming or false - end -end - --- Suite-specific compiled directory to avoid cross-suite clashes -local compiledDir = "cache/" .. SUITE .. "/" -local SCRIPT_PREFIX = "SCRIPTS:" - --- Ensure cache directories exist -os.mkdir("cache") -os.mkdir(compiledDir) - --- Index compiled files -local disk_cache = {} -do - local list = system.listFiles and system.listFiles(compiledDir) or {} - for _, fname in ipairs(list) do - disk_cache[fname] = true - end -end - --- Unique, cache-safe compiled filename (prefix with suite) -local function cachename(name) - if name:sub(1, #SCRIPT_PREFIX) == SCRIPT_PREFIX then - name = name:sub(#SCRIPT_PREFIX + 1) - end - name = name:gsub("/", "_") - name = name:gsub("^_", "", 1) - return SUITE .. "__" .. name -end - --------------------------------------------------- --- Adaptive LRU Cache (in-memory loaders, interval-based eviction) --------------------------------------------------- -local LUA_RAM_THRESHOLD = 32 * 1024 -- 32 KB free (bytes) -local LRU_HARD_LIMIT = 50 -- absolute maximum (safety) -local EVICT_INTERVAL = 5 -- seconds between eviction checks - -local function LRUCache() - local self = { cache = {}, order = {}, _last_evict = 0 } - - function self:get(key) - local value = self.cache[key] - if value then - for i, k in ipairs(self.order) do - if k == key then - table.remove(self.order, i) - break - end - end - table.insert(self.order, key) - end - return value - end - - function self:evict_if_low_memory() - self._last_evict = os.clock() - local usage = system.getMemoryUsage and system.getMemoryUsage() - while #self.order > 0 do - if usage and usage.luaRamAvailable and usage.luaRamAvailable < LUA_RAM_THRESHOLD then - local oldest = table.remove(self.order, 1) - self.cache[oldest] = nil - usage = system.getMemoryUsage() - elseif #self.order > LRU_HARD_LIMIT then - local oldest = table.remove(self.order, 1) - self.cache[oldest] = nil - else - break - end - end - end - - function self:set(key, value) - if not self.cache[key] then - table.insert(self.order, key) - else - for i, k in ipairs(self.order) do - if k == key then - table.remove(self.order, i) - break - end - end - table.insert(self.order, key) - end - self.cache[key] = value - - local now = os.clock() - if now - self._last_evict > EVICT_INTERVAL then - self:evict_if_low_memory() - end - end - - return self -end - -local lru_cache = LRUCache() - --------------------------------------------------- --- Throttled Compile Queue System --------------------------------------------------- -compile._queue = {} -compile._queued_map = {} - -function compile._enqueue(script, cache_path, cache_fname) - if not compile._queued_map[cache_fname] then - table.insert(compile._queue, { script = script, cache_path = cache_path, cache_fname = cache_fname }) - compile._queued_map[cache_fname] = true - end -end - -function compile.wakeup() - local now = os.clock() - if (now - compile._startTime) < compile._startupDelay then return end - if #compile._queue == 0 then return end - - local entry = table.remove(compile._queue, 1) - compile._queued_map[entry.cache_fname] = nil - - local ok, err = pcall(function() - system.compile(entry.script) - os.rename(entry.script .. "c", entry.cache_path) - disk_cache[entry.cache_fname] = true - end) - - if dashx and dashx.utils then - if ok then - dashx.utils.log("Deferred-compiled (throttled): " .. entry.script, "info") - else - dashx.utils.log("Deferred-compile error: " .. tostring(err), "debug") - end - end -end - --- ENV-aware loadfile with compiled fallback -function compile.loadfile(script) - local startTime - if logTimings then startTime = os.clock() end - - local cache_fname = cachename(script) .. "c" - local cache_key = cache_fname - - local loader = lru_cache:get(cache_key) - local which - - if not loader then - if not dashx.preferences.developer.compile then - loader, which = loadfile_in_env(script), "raw" - else - local cache_path = compiledDir .. cache_fname - if disk_cache[cache_fname] then - loader, which = loadfile_in_env(cache_path), "compiled" - else - compile._enqueue(script, cache_path, cache_fname) - loader, which = loadfile_in_env(script), "raw (queued for deferred compile)" - end - end - - if loader then - lru_cache:set(cache_key, loader) - end - else - which = "in-memory" - end - - if not loader then - return nil, ("Failed to load script '%s' (%s)"):format(script, which or "unknown") - end - - return loader -end - -function compile.dofile(script, ...) - local chunk = compile.loadfile(script) - return chunk(...) -end - -function compile.require(modname) - -- Suite-scoped module cache to avoid clashes across suites - local key = SUITE .. ":" .. modname - if package.loaded[key] then - return package.loaded[key] - end - - local raw_path = modname:gsub("%%.", "/") .. ".lua" - local chunk - - if not dashx.preferences.developer.compile then - chunk = assert(loadfile_in_env(raw_path)) - else - chunk = compile.loadfile(raw_path) - end - - local result = chunk() - package.loaded[key] = (result == nil) and true or result - return package.loaded[key] -end - -return compile diff --git a/scripts/dashx/lib/ini.lua b/scripts/dashx/lib/ini.lua index 186a24f..aa14322 100644 --- a/scripts/dashx/lib/ini.lua +++ b/scripts/dashx/lib/ini.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") local ini = {} -- Reads a file's full contents into a string, compatible with limited Lua diff --git a/scripts/dashx/lib/utils.lua b/scripts/dashx/lib/utils.lua index 67ecb61..f04836c 100644 --- a/scripts/dashx/lib/utils.lua +++ b/scripts/dashx/lib/utils.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) dashx Project @@ -556,7 +557,7 @@ function utils.findModules() if v ~= ".." and v ~= "." and not v:match("%.%a+$") then local init_path = modules_path .. v .. '/init.lua' - local func, err = dashx.compiler.loadfile(init_path) + local func, err = loadfile(init_path) if not func then dashx.utils.log("Failed to load module init " .. init_path .. ": " .. err, "info") else @@ -599,7 +600,7 @@ function utils.findWidgets() if v ~= ".." and v ~= "." and not v:match("%.%a+$") then local init_path = widgets_path .. v .. '/init.lua' -- try loading directly - local func, err = dashx.compiler.loadfile(init_path) + local func, err = loadfile(init_path) if not func then dashx.utils.log( "Failed to load widget init " .. init_path .. ": " .. err, diff --git a/scripts/dashx/main.lua b/scripts/dashx/main.lua index 2e39ff7..de5d0aa 100644 --- a/scripts/dashx/main.lua +++ b/scripts/dashx/main.lua @@ -8,13 +8,15 @@ local dashx = {} dashx.session = {} --- Shared environment so every chunk sees `dashx` without touching _G -local ENV = setmetatable({ dashx = dashx }, { +-- Namespace for the suite (kept local; not global) +local dashx = {} +package.loaded.dashx = dashx + +-- If you still want to ban accidental globals in this chunk: +local _ENV = setmetatable({ dashx = dashx }, { __index = _G, - -- Uncomment to forbid accidental globals from modules: - __newindex = function(_, k) error("attempt to create global '"..tostring(k).."'", 2) end + __newindex = function(_, k) error("attempt to create global '"..tostring(k).."'", 2) end }) - -- initialise legacy font if not already set (ethos 1.6 vs 1.7) if not FONT_M then FONT_M = FONT_STD end @@ -37,7 +39,7 @@ config.watchdogParam = 10 dashx.config = config -- INI utilities (never compiled) loaded inside ENV -dashx.ini = assert(loadfile("lib/ini.lua", "t", ENV))(config) +dashx.ini = assert(loadfile("lib/ini.lua", "t", _ENV))(config) -- set defaults for user preferences local userpref_defaults ={ @@ -94,17 +96,14 @@ end dashx.config.bgTaskName = dashx.config.toolName .. " [Background]" dashx.config.bgTaskKey = "dshxbg" --- compiler (loaded into ENV so it can load the rest into the same ENV) -dashx.compiler = assert(loadfile("lib/compile.lua","t",ENV))(dashx.config) - -- library with utility functions used throughout the suite -dashx.utils = assert(dashx.compiler.loadfile("lib/utils.lua"))(dashx.config) +dashx.utils = assert(loadfile("lib/utils.lua"))(dashx.config) -- main app -dashx.app = assert(dashx.compiler.loadfile("app/app.lua"))(dashx.config) +dashx.app = assert(loadfile("app/app.lua"))(dashx.config) -- tasks -dashx.tasks = assert(dashx.compiler.loadfile("tasks/tasks.lua"))(dashx.config) +dashx.tasks = assert(loadfile("tasks/tasks.lua"))(dashx.config) -- configure the flight mode dashx.flightmode = { current = "preflight" } @@ -177,7 +176,7 @@ local function init() local cachePath = "cache/" .. cacheFile local widgetList - local loadf, loadErr = dashx.compiler.loadfile(cachePath) + local loadf, loadErr = loadfile(cachePath) if loadf then local ok, cached = pcall(loadf) if ok and type(cached) == "table" then @@ -198,7 +197,7 @@ local function init() dashx.widgets = {} for _, v in ipairs(widgetList) do if v.script then - local scriptModule = assert(dashx.compiler.loadfile("widgets/" .. v.folder .. "/" .. v.script))(config) + local scriptModule = assert(loadfile("widgets/" .. v.folder .. "/" .. v.script))(config) local varname = v.varname or v.script:gsub("%.lua$", "") if dashx.widgets[varname] then math.randomseed(os.time()) diff --git a/scripts/dashx/sim/sensors/accx.lua b/scripts/dashx/sim/sensors/accx.lua index 414988c..f8af46d 100644 --- a/scripts/dashx/sim/sensors/accx.lua +++ b/scripts/dashx/sim/sensors/accx.lua @@ -1 +1,2 @@ +local dashx = require("dashx") return 0 \ No newline at end of file diff --git a/scripts/dashx/sim/sensors/accy.lua b/scripts/dashx/sim/sensors/accy.lua index 414988c..f8af46d 100644 --- a/scripts/dashx/sim/sensors/accy.lua +++ b/scripts/dashx/sim/sensors/accy.lua @@ -1 +1,2 @@ +local dashx = require("dashx") return 0 \ No newline at end of file diff --git a/scripts/dashx/sim/sensors/accz.lua b/scripts/dashx/sim/sensors/accz.lua index 414988c..f8af46d 100644 --- a/scripts/dashx/sim/sensors/accz.lua +++ b/scripts/dashx/sim/sensors/accz.lua @@ -1 +1,2 @@ +local dashx = require("dashx") return 0 \ No newline at end of file diff --git a/scripts/dashx/sim/sensors/adj_f.lua b/scripts/dashx/sim/sensors/adj_f.lua index 9a76ec8..c784044 100644 --- a/scripts/dashx/sim/sensors/adj_f.lua +++ b/scripts/dashx/sim/sensors/adj_f.lua @@ -1 +1,2 @@ +local dashx = require("dashx") return 0.0 \ No newline at end of file diff --git a/scripts/dashx/sim/sensors/adj_v.lua b/scripts/dashx/sim/sensors/adj_v.lua index 9a76ec8..c784044 100644 --- a/scripts/dashx/sim/sensors/adj_v.lua +++ b/scripts/dashx/sim/sensors/adj_v.lua @@ -1 +1,2 @@ +local dashx = require("dashx") return 0.0 \ No newline at end of file diff --git a/scripts/dashx/sim/sensors/altitude.lua b/scripts/dashx/sim/sensors/altitude.lua index b890270..0237864 100644 --- a/scripts/dashx/sim/sensors/altitude.lua +++ b/scripts/dashx/sim/sensors/altitude.lua @@ -1 +1,2 @@ +local dashx = require("dashx") return math.random(31, 34) \ No newline at end of file diff --git a/scripts/dashx/sim/sensors/armdisableflags.lua b/scripts/dashx/sim/sensors/armdisableflags.lua index 414988c..f8af46d 100644 --- a/scripts/dashx/sim/sensors/armdisableflags.lua +++ b/scripts/dashx/sim/sensors/armdisableflags.lua @@ -1 +1,2 @@ +local dashx = require("dashx") return 0 \ No newline at end of file diff --git a/scripts/dashx/sim/sensors/armed.lua b/scripts/dashx/sim/sensors/armed.lua index 414988c..f8af46d 100644 --- a/scripts/dashx/sim/sensors/armed.lua +++ b/scripts/dashx/sim/sensors/armed.lua @@ -1 +1,2 @@ +local dashx = require("dashx") return 0 \ No newline at end of file diff --git a/scripts/dashx/sim/sensors/armflags.lua b/scripts/dashx/sim/sensors/armflags.lua index 9a76ec8..c784044 100644 --- a/scripts/dashx/sim/sensors/armflags.lua +++ b/scripts/dashx/sim/sensors/armflags.lua @@ -1 +1,2 @@ +local dashx = require("dashx") return 0.0 \ No newline at end of file diff --git a/scripts/dashx/sim/sensors/attpitch.lua b/scripts/dashx/sim/sensors/attpitch.lua index add6be0..54006cd 100644 --- a/scripts/dashx/sim/sensors/attpitch.lua +++ b/scripts/dashx/sim/sensors/attpitch.lua @@ -1 +1,2 @@ +local dashx = require("dashx") return math.random(80, 120) \ No newline at end of file diff --git a/scripts/dashx/sim/sensors/attroll.lua b/scripts/dashx/sim/sensors/attroll.lua index add6be0..54006cd 100644 --- a/scripts/dashx/sim/sensors/attroll.lua +++ b/scripts/dashx/sim/sensors/attroll.lua @@ -1 +1,2 @@ +local dashx = require("dashx") return math.random(80, 120) \ No newline at end of file diff --git a/scripts/dashx/sim/sensors/attyaw.lua b/scripts/dashx/sim/sensors/attyaw.lua index fa43595..c5953e8 100644 --- a/scripts/dashx/sim/sensors/attyaw.lua +++ b/scripts/dashx/sim/sensors/attyaw.lua @@ -1 +1,2 @@ +local dashx = require("dashx") return math.random(160, 240) \ No newline at end of file diff --git a/scripts/dashx/sim/sensors/bec_voltage.lua b/scripts/dashx/sim/sensors/bec_voltage.lua index fb5ed59..b47c1a1 100644 --- a/scripts/dashx/sim/sensors/bec_voltage.lua +++ b/scripts/dashx/sim/sensors/bec_voltage.lua @@ -1 +1,2 @@ +local dashx = require("dashx") return math.random(760, 840) \ No newline at end of file diff --git a/scripts/dashx/sim/sensors/cell_count.lua b/scripts/dashx/sim/sensors/cell_count.lua index 7835c86..74ad81e 100644 --- a/scripts/dashx/sim/sensors/cell_count.lua +++ b/scripts/dashx/sim/sensors/cell_count.lua @@ -1 +1,2 @@ +local dashx = require("dashx") return 6.0 \ No newline at end of file diff --git a/scripts/dashx/sim/sensors/consumption.lua b/scripts/dashx/sim/sensors/consumption.lua index 414988c..f8af46d 100644 --- a/scripts/dashx/sim/sensors/consumption.lua +++ b/scripts/dashx/sim/sensors/consumption.lua @@ -1 +1,2 @@ +local dashx = require("dashx") return 0 \ No newline at end of file diff --git a/scripts/dashx/sim/sensors/current.lua b/scripts/dashx/sim/sensors/current.lua index f15b259..bf061af 100644 --- a/scripts/dashx/sim/sensors/current.lua +++ b/scripts/dashx/sim/sensors/current.lua @@ -1 +1,2 @@ +local dashx = require("dashx") return math.random(0, 0) \ No newline at end of file diff --git a/scripts/dashx/sim/sensors/fuel.lua b/scripts/dashx/sim/sensors/fuel.lua index 04b024f..842c2b6 100644 --- a/scripts/dashx/sim/sensors/fuel.lua +++ b/scripts/dashx/sim/sensors/fuel.lua @@ -1 +1,2 @@ +local dashx = require("dashx") return math.random(84, 85) \ No newline at end of file diff --git a/scripts/dashx/sim/sensors/governor.lua b/scripts/dashx/sim/sensors/governor.lua index 9a76ec8..c784044 100644 --- a/scripts/dashx/sim/sensors/governor.lua +++ b/scripts/dashx/sim/sensors/governor.lua @@ -1 +1,2 @@ +local dashx = require("dashx") return 0.0 \ No newline at end of file diff --git a/scripts/dashx/sim/sensors/gps_sats.lua b/scripts/dashx/sim/sensors/gps_sats.lua index b3eb2f2..f48bc8d 100644 --- a/scripts/dashx/sim/sensors/gps_sats.lua +++ b/scripts/dashx/sim/sensors/gps_sats.lua @@ -1 +1,2 @@ +local dashx = require("dashx") return 6 \ No newline at end of file diff --git a/scripts/dashx/sim/sensors/groundspeed.lua b/scripts/dashx/sim/sensors/groundspeed.lua index 83500cc..2b2876e 100644 --- a/scripts/dashx/sim/sensors/groundspeed.lua +++ b/scripts/dashx/sim/sensors/groundspeed.lua @@ -1 +1,2 @@ +local dashx = require("dashx") return math.random(57, 63) \ No newline at end of file diff --git a/scripts/dashx/sim/sensors/isconnected.lua b/scripts/dashx/sim/sensors/isconnected.lua index 414988c..f8af46d 100644 --- a/scripts/dashx/sim/sensors/isconnected.lua +++ b/scripts/dashx/sim/sensors/isconnected.lua @@ -1 +1,2 @@ +local dashx = require("dashx") return 0 \ No newline at end of file diff --git a/scripts/dashx/sim/sensors/pid_profile.lua b/scripts/dashx/sim/sensors/pid_profile.lua index fe312f2..7c7433a 100644 --- a/scripts/dashx/sim/sensors/pid_profile.lua +++ b/scripts/dashx/sim/sensors/pid_profile.lua @@ -1 +1,2 @@ +local dashx = require("dashx") return 1.0 \ No newline at end of file diff --git a/scripts/dashx/sim/sensors/profile.lua b/scripts/dashx/sim/sensors/profile.lua index 5efef61..84ce43f 100644 --- a/scripts/dashx/sim/sensors/profile.lua +++ b/scripts/dashx/sim/sensors/profile.lua @@ -1 +1,2 @@ +local dashx = require("dashx") return 1 \ No newline at end of file diff --git a/scripts/dashx/sim/sensors/rate_profile.lua b/scripts/dashx/sim/sensors/rate_profile.lua index fe312f2..7c7433a 100644 --- a/scripts/dashx/sim/sensors/rate_profile.lua +++ b/scripts/dashx/sim/sensors/rate_profile.lua @@ -1 +1,2 @@ +local dashx = require("dashx") return 1.0 \ No newline at end of file diff --git a/scripts/dashx/sim/sensors/rpm.lua b/scripts/dashx/sim/sensors/rpm.lua index 3670158..22c8748 100644 --- a/scripts/dashx/sim/sensors/rpm.lua +++ b/scripts/dashx/sim/sensors/rpm.lua @@ -1 +1,2 @@ +local dashx = require("dashx") return math.random(1620, 1980) \ No newline at end of file diff --git a/scripts/dashx/sim/sensors/simevent_telemetry_state.lua b/scripts/dashx/sim/sensors/simevent_telemetry_state.lua index 414988c..f8af46d 100644 --- a/scripts/dashx/sim/sensors/simevent_telemetry_state.lua +++ b/scripts/dashx/sim/sensors/simevent_telemetry_state.lua @@ -1 +1,2 @@ +local dashx = require("dashx") return 0 \ No newline at end of file diff --git a/scripts/dashx/sim/sensors/temp_esc.lua b/scripts/dashx/sim/sensors/temp_esc.lua index f3f8ed0..fc5e1c9 100644 --- a/scripts/dashx/sim/sensors/temp_esc.lua +++ b/scripts/dashx/sim/sensors/temp_esc.lua @@ -1 +1,2 @@ +local dashx = require("dashx") return math.random(47, 52) \ No newline at end of file diff --git a/scripts/dashx/sim/sensors/temp_mcu.lua b/scripts/dashx/sim/sensors/temp_mcu.lua index 6e85c76..4e88d54 100644 --- a/scripts/dashx/sim/sensors/temp_mcu.lua +++ b/scripts/dashx/sim/sensors/temp_mcu.lua @@ -1 +1,2 @@ +local dashx = require("dashx") return math.random(28, 31) \ No newline at end of file diff --git a/scripts/dashx/sim/sensors/throttle_percent.lua b/scripts/dashx/sim/sensors/throttle_percent.lua index 5e0aec0..26eabf7 100644 --- a/scripts/dashx/sim/sensors/throttle_percent.lua +++ b/scripts/dashx/sim/sensors/throttle_percent.lua @@ -1 +1,2 @@ +local dashx = require("dashx") return math.random(76, 84) \ No newline at end of file diff --git a/scripts/dashx/sim/sensors/voltage.lua b/scripts/dashx/sim/sensors/voltage.lua index cc62ae2..76f25ba 100644 --- a/scripts/dashx/sim/sensors/voltage.lua +++ b/scripts/dashx/sim/sensors/voltage.lua @@ -1 +1,2 @@ +local dashx = require("dashx") return math.random(2520, 2520) \ No newline at end of file diff --git a/scripts/dashx/tasks/callback/callback.lua b/scripts/dashx/tasks/callback/callback.lua index 9c585cf..2d5513a 100644 --- a/scripts/dashx/tasks/callback/callback.lua +++ b/scripts/dashx/tasks/callback/callback.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) dashx Project diff --git a/scripts/dashx/tasks/callback/init.lua b/scripts/dashx/tasks/callback/init.lua index b89b0a0..bdf769e 100644 --- a/scripts/dashx/tasks/callback/init.lua +++ b/scripts/dashx/tasks/callback/init.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) dashx Project * diff --git a/scripts/dashx/tasks/compiler/compiler.lua b/scripts/dashx/tasks/compiler/compiler.lua deleted file mode 100644 index c4983c3..0000000 --- a/scripts/dashx/tasks/compiler/compiler.lua +++ /dev/null @@ -1,32 +0,0 @@ ---[[ - - * Copyright (C) dashx Project - * - * - * License GPLv3: https://www.gnu.org/licenses/gpl-3.0.en.html - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * Note. Some icons have been sourced from https://www.flaticon.com/ - * - -]] -- -local arg = {...} - -local compiler = {} - - -function compiler.wakeup() - - dashx.compiler.wakeup() - -end - -return compiler diff --git a/scripts/dashx/tasks/compiler/init.lua b/scripts/dashx/tasks/compiler/init.lua deleted file mode 100644 index e7f882e..0000000 --- a/scripts/dashx/tasks/compiler/init.lua +++ /dev/null @@ -1,27 +0,0 @@ ---[[ - * Copyright (C) dashx Project - * - * - * License GPLv3: https://www.gnu.org/licenses/gpl-3.0.en.html - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * Note. Some icons have been sourced from https://www.flaticon.com/ - * -]] -- -local init = { - interval = 5, -- run every 5 seconds - script = "compiler.lua", -- run this script - linkrequired = false, -- run this script only if link is established - spreadschedule = true, -- run on every loop - simulatoronly = false, -- run this script in simulation mode -} - -return init diff --git a/scripts/dashx/tasks/developer/developer.lua b/scripts/dashx/tasks/developer/developer.lua index 6ac1e33..56550cf 100644 --- a/scripts/dashx/tasks/developer/developer.lua +++ b/scripts/dashx/tasks/developer/developer.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) dashx Project diff --git a/scripts/dashx/tasks/developer/init.lua b/scripts/dashx/tasks/developer/init.lua index 9f7d667..528e82a 100644 --- a/scripts/dashx/tasks/developer/init.lua +++ b/scripts/dashx/tasks/developer/init.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) dashx Project * diff --git a/scripts/dashx/tasks/events/events.lua b/scripts/dashx/tasks/events/events.lua index e1d72e3..fd4ef2f 100644 --- a/scripts/dashx/tasks/events/events.lua +++ b/scripts/dashx/tasks/events/events.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) dashx Project * @@ -28,7 +29,7 @@ local taskExecutionPercent = 50 -- 50% of tasks will run each cycle -- Dynamically load task modules and populate wakeupHandlers for _, name in ipairs(taskNames) do - events[name] = assert(dashx.compiler.loadfile("tasks/events/tasks/" .. name .. ".lua"))(dashx.config) + events[name] = assert(loadfile("tasks/events/tasks/" .. name .. ".lua"))(dashx.config) table.insert(wakeupHandlers, function() events[name].wakeup() end) end diff --git a/scripts/dashx/tasks/events/init.lua b/scripts/dashx/tasks/events/init.lua index e644cc6..7c56534 100644 --- a/scripts/dashx/tasks/events/init.lua +++ b/scripts/dashx/tasks/events/init.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) dashx Project * diff --git a/scripts/dashx/tasks/events/tasks/flightmode.lua b/scripts/dashx/tasks/events/tasks/flightmode.lua index d8eb217..06f9505 100644 --- a/scripts/dashx/tasks/events/tasks/flightmode.lua +++ b/scripts/dashx/tasks/events/tasks/flightmode.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) dashx Project * diff --git a/scripts/dashx/tasks/events/tasks/rxmap.lua b/scripts/dashx/tasks/events/tasks/rxmap.lua index 1415738..120d8f5 100644 --- a/scripts/dashx/tasks/events/tasks/rxmap.lua +++ b/scripts/dashx/tasks/events/tasks/rxmap.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) dashx Project * diff --git a/scripts/dashx/tasks/events/tasks/stats.lua b/scripts/dashx/tasks/events/tasks/stats.lua index 20547bf..b7d89f8 100644 --- a/scripts/dashx/tasks/events/tasks/stats.lua +++ b/scripts/dashx/tasks/events/tasks/stats.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) dashx Project * diff --git a/scripts/dashx/tasks/events/tasks/switches.lua b/scripts/dashx/tasks/events/tasks/switches.lua index 5847f16..a1d96c6 100644 --- a/scripts/dashx/tasks/events/tasks/switches.lua +++ b/scripts/dashx/tasks/events/tasks/switches.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) dashx Project * diff --git a/scripts/dashx/tasks/events/tasks/telemetry.lua b/scripts/dashx/tasks/events/tasks/telemetry.lua index 1447b50..d2e9acc 100644 --- a/scripts/dashx/tasks/events/tasks/telemetry.lua +++ b/scripts/dashx/tasks/events/tasks/telemetry.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) dashx Project * diff --git a/scripts/dashx/tasks/events/tasks/timer.lua b/scripts/dashx/tasks/events/tasks/timer.lua index 8a0085a..b63e19a 100644 --- a/scripts/dashx/tasks/events/tasks/timer.lua +++ b/scripts/dashx/tasks/events/tasks/timer.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) dashx Project * diff --git a/scripts/dashx/tasks/logger/init.lua b/scripts/dashx/tasks/logger/init.lua index dd5b649..c4033df 100644 --- a/scripts/dashx/tasks/logger/init.lua +++ b/scripts/dashx/tasks/logger/init.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) dashx Project * diff --git a/scripts/dashx/tasks/logger/lib/log.lua b/scripts/dashx/tasks/logger/lib/log.lua index 3e689f0..51d1a1d 100644 --- a/scripts/dashx/tasks/logger/lib/log.lua +++ b/scripts/dashx/tasks/logger/lib/log.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) dashx Project diff --git a/scripts/dashx/tasks/logger/logger.lua b/scripts/dashx/tasks/logger/logger.lua index 632b130..9213e8d 100644 --- a/scripts/dashx/tasks/logger/logger.lua +++ b/scripts/dashx/tasks/logger/logger.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) dashx Project @@ -43,7 +44,7 @@ local logger = {} os.mkdir("LOGS:") os.mkdir("LOGS:/dashx") os.mkdir("LOGS:/dashx/logs") -logger.queue = assert(dashx.compiler.loadfile("tasks/logger/lib/log.lua"))(config) +logger.queue = assert(loadfile("tasks/logger/lib/log.lua"))(config) logger.queue.config.log_file = "LOGS:/dashx/logs/dashx_" .. os.date("%Y-%m-%d_%H-%M-%S") .. ".log" logger.queue.config.min_print_level = dashx.preferences.developer.loglevel logger.queue.config.log_to_file = tostring(dashx.preferences.developer.logtofile) diff --git a/scripts/dashx/tasks/logging/init.lua b/scripts/dashx/tasks/logging/init.lua index fec520f..e6a5865 100644 --- a/scripts/dashx/tasks/logging/init.lua +++ b/scripts/dashx/tasks/logging/init.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) dashx Project * diff --git a/scripts/dashx/tasks/logging/logging.lua b/scripts/dashx/tasks/logging/logging.lua index 768b6b7..d34f9f9 100644 --- a/scripts/dashx/tasks/logging/logging.lua +++ b/scripts/dashx/tasks/logging/logging.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) Rotorflight Project diff --git a/scripts/dashx/tasks/onconnect/init.lua b/scripts/dashx/tasks/onconnect/init.lua index e45be39..3a1aa0a 100644 --- a/scripts/dashx/tasks/onconnect/init.lua +++ b/scripts/dashx/tasks/onconnect/init.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) dashx Project * diff --git a/scripts/dashx/tasks/onconnect/tasks.lua b/scripts/dashx/tasks/onconnect/tasks.lua index 9d852ce..1efb081 100644 --- a/scripts/dashx/tasks/onconnect/tasks.lua +++ b/scripts/dashx/tasks/onconnect/tasks.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) Rotorflight Project * License GPLv3: https://www.gnu.org/licenses/gpl-3.0.en.html @@ -39,7 +40,7 @@ function tasks.findTasks() if file:match("%.lua$") then local fullPath = dirPath .. file local name = level .. "/" .. file:gsub("%.lua$", "") - local chunk, err = dashx.compiler.loadfile(fullPath) + local chunk, err = loadfile(fullPath) if not chunk then dashx.utils.log("Error loading task " .. fullPath .. ": " .. err, "error") else diff --git a/scripts/dashx/tasks/onconnect/tasks/high/apiversion.lua b/scripts/dashx/tasks/onconnect/tasks/high/apiversion.lua index 753766b..b76d535 100644 --- a/scripts/dashx/tasks/onconnect/tasks/high/apiversion.lua +++ b/scripts/dashx/tasks/onconnect/tasks/high/apiversion.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) dashx Project * diff --git a/scripts/dashx/tasks/onconnect/tasks/high/sensorstats.lua b/scripts/dashx/tasks/onconnect/tasks/high/sensorstats.lua index 786987b..b8df5af 100644 --- a/scripts/dashx/tasks/onconnect/tasks/high/sensorstats.lua +++ b/scripts/dashx/tasks/onconnect/tasks/high/sensorstats.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) dashx Project * diff --git a/scripts/dashx/tasks/onconnect/tasks/high/timer.lua b/scripts/dashx/tasks/onconnect/tasks/high/timer.lua index 0f8b8fa..5f42a9e 100644 --- a/scripts/dashx/tasks/onconnect/tasks/high/timer.lua +++ b/scripts/dashx/tasks/onconnect/tasks/high/timer.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) dashx Project * diff --git a/scripts/dashx/tasks/onconnect/tasks/high/uid.lua b/scripts/dashx/tasks/onconnect/tasks/high/uid.lua index cebe02b..4a5ecc3 100644 --- a/scripts/dashx/tasks/onconnect/tasks/high/uid.lua +++ b/scripts/dashx/tasks/onconnect/tasks/high/uid.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) dashx Project * diff --git a/scripts/dashx/tasks/onconnect/tasks/low/battery.lua b/scripts/dashx/tasks/onconnect/tasks/low/battery.lua index 10c9f33..9622a96 100644 --- a/scripts/dashx/tasks/onconnect/tasks/low/battery.lua +++ b/scripts/dashx/tasks/onconnect/tasks/low/battery.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) dashx Project * diff --git a/scripts/dashx/tasks/onconnect/tasks/low/rxmap.lua b/scripts/dashx/tasks/onconnect/tasks/low/rxmap.lua index 7aac473..0171106 100644 --- a/scripts/dashx/tasks/onconnect/tasks/low/rxmap.lua +++ b/scripts/dashx/tasks/onconnect/tasks/low/rxmap.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) dashx Project * diff --git a/scripts/dashx/tasks/onconnect/tasks/medium/modelpreferences.lua b/scripts/dashx/tasks/onconnect/tasks/medium/modelpreferences.lua index f155ecb..232d86f 100644 --- a/scripts/dashx/tasks/onconnect/tasks/medium/modelpreferences.lua +++ b/scripts/dashx/tasks/onconnect/tasks/medium/modelpreferences.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) dashx Project * diff --git a/scripts/dashx/tasks/sensors/frsky.lua b/scripts/dashx/tasks/sensors/frsky.lua index 9393525..0c9629b 100644 --- a/scripts/dashx/tasks/sensors/frsky.lua +++ b/scripts/dashx/tasks/sensors/frsky.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) Inav Project diff --git a/scripts/dashx/tasks/sensors/init.lua b/scripts/dashx/tasks/sensors/init.lua index edb4517..7247e19 100644 --- a/scripts/dashx/tasks/sensors/init.lua +++ b/scripts/dashx/tasks/sensors/init.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) dashx Project * diff --git a/scripts/dashx/tasks/sensors/lib/smartfuel.lua b/scripts/dashx/tasks/sensors/lib/smartfuel.lua index 9aca8a9..0b31517 100644 --- a/scripts/dashx/tasks/sensors/lib/smartfuel.lua +++ b/scripts/dashx/tasks/sensors/lib/smartfuel.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) Rotorflight Project * diff --git a/scripts/dashx/tasks/sensors/lib/smartfuelvoltage.lua b/scripts/dashx/tasks/sensors/lib/smartfuelvoltage.lua index 9416b1b..e6e48a6 100644 --- a/scripts/dashx/tasks/sensors/lib/smartfuelvoltage.lua +++ b/scripts/dashx/tasks/sensors/lib/smartfuelvoltage.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) Rotorflight Project * diff --git a/scripts/dashx/tasks/sensors/sensors.lua b/scripts/dashx/tasks/sensors/sensors.lua index 2ba5937..2d55d13 100644 --- a/scripts/dashx/tasks/sensors/sensors.lua +++ b/scripts/dashx/tasks/sensors/sensors.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) dashx Project @@ -29,7 +30,7 @@ local delayDuration = 2 -- seconds local delayStartTime = nil local delayPending = false -local smart = assert(dashx.compiler.loadfile("tasks/sensors/smart.lua"))(config) +local smart = assert(loadfile("tasks/sensors/smart.lua"))(config) local log = dashx.utils.log local tasks = dashx.tasks @@ -58,12 +59,12 @@ local function loadSensorModule() if system:getVersion().simulation == true then if not loadedSensorModule or loadedSensorModule.name ~= "sim" then --log("Loading Simulator sensor module","info") - loadedSensorModule = {name = "sim", module = assert(dashx.compiler.loadfile("tasks/sensors/sim.lua"))(config)} + loadedSensorModule = {name = "sim", module = assert(loadfile("tasks/sensors/sim.lua"))(config)} end elseif protocol == "sport" then if not loadedSensorModule or loadedSensorModule.name ~= "frsky" then --log("Loading FrSky sensor module","info") - loadedSensorModule = {name = "frsky", module = assert(dashx.compiler.loadfile("tasks/sensors/frsky.lua"))(config)} + loadedSensorModule = {name = "frsky", module = assert(loadfile("tasks/sensors/frsky.lua"))(config)} end else loadedSensorModule = nil -- No matching sensor, clear to save memory diff --git a/scripts/dashx/tasks/sensors/sim.lua b/scripts/dashx/tasks/sensors/sim.lua index dd3689b..fa77c3c 100644 --- a/scripts/dashx/tasks/sensors/sim.lua +++ b/scripts/dashx/tasks/sensors/sim.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) dashx Project diff --git a/scripts/dashx/tasks/sensors/smart.lua b/scripts/dashx/tasks/sensors/smart.lua index ae720eb..9034d41 100644 --- a/scripts/dashx/tasks/sensors/smart.lua +++ b/scripts/dashx/tasks/sensors/smart.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) dashx Project @@ -58,8 +59,8 @@ local smart = {} -local smartfuel = assert(dashx.compiler.loadfile("tasks/sensors/lib/smartfuel.lua"))() -local smartfuelvoltage = assert(dashx.compiler.loadfile("tasks/sensors/lib/smartfuelvoltage.lua"))() +local smartfuel = assert(loadfile("tasks/sensors/lib/smartfuel.lua"))() +local smartfuelvoltage = assert(loadfile("tasks/sensors/lib/smartfuelvoltage.lua"))() -- container vars local log diff --git a/scripts/dashx/tasks/simevent/init.lua b/scripts/dashx/tasks/simevent/init.lua index 9e5253c..c7a674b 100644 --- a/scripts/dashx/tasks/simevent/init.lua +++ b/scripts/dashx/tasks/simevent/init.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) dashx Project * diff --git a/scripts/dashx/tasks/simevent/simevent.lua b/scripts/dashx/tasks/simevent/simevent.lua index ddd801c..70e3052 100644 --- a/scripts/dashx/tasks/simevent/simevent.lua +++ b/scripts/dashx/tasks/simevent/simevent.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") -- simevent.lua local simevent = {} diff --git a/scripts/dashx/tasks/tasks.lua b/scripts/dashx/tasks/tasks.lua index 96b11e1..d66f48c 100644 --- a/scripts/dashx/tasks/tasks.lua +++ b/scripts/dashx/tasks/tasks.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) DASHX Project @@ -45,7 +46,7 @@ -- keep these constant / cheap definitions at file scope local utils = dashx.utils -local compiler = dashx.compiler.loadfile +local compiler = loadfile local currentTelemetrySensor local tasksPerCycle diff --git a/scripts/dashx/tasks/telemetry/init.lua b/scripts/dashx/tasks/telemetry/init.lua index 53084e5..7e4cb99 100644 --- a/scripts/dashx/tasks/telemetry/init.lua +++ b/scripts/dashx/tasks/telemetry/init.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) dashx Project * diff --git a/scripts/dashx/tasks/telemetry/telemetry.lua b/scripts/dashx/tasks/telemetry/telemetry.lua index dc1b794..6ab9c9c 100644 --- a/scripts/dashx/tasks/telemetry/telemetry.lua +++ b/scripts/dashx/tasks/telemetry/telemetry.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) dashx Project * @@ -318,7 +319,7 @@ local sensorTable = { }, altitude = { - name = "@i18n(sensors.altitude)@", + name = "@i18n(telemetry.sensors.altitude)@", mandatory = false, stats = true, switch_alerts = true, @@ -430,7 +431,7 @@ local sensorTable = { }, bec_voltage = { - name = "@i18n(sensors.bec_voltage)@", + name = "@i18n(telemetry.sensors.bec_voltage)@", mandatory = true, stats = true, set_telemetry_sensors = 43, diff --git a/scripts/dashx/tasks/timer/init.lua b/scripts/dashx/tasks/timer/init.lua index 8fcdac1..37eca54 100644 --- a/scripts/dashx/tasks/timer/init.lua +++ b/scripts/dashx/tasks/timer/init.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) dashx Project * diff --git a/scripts/dashx/tasks/timer/timer.lua b/scripts/dashx/tasks/timer/timer.lua index 2984266..af386a4 100644 --- a/scripts/dashx/tasks/timer/timer.lua +++ b/scripts/dashx/tasks/timer/timer.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) dashx Project * diff --git a/scripts/dashx/widgets/dashboard/dashboard.lua b/scripts/dashx/widgets/dashboard/dashboard.lua index 5a47a24..776e1a7 100644 --- a/scripts/dashx/widgets/dashboard/dashboard.lua +++ b/scripts/dashx/widgets/dashboard/dashboard.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) Rotorflight Project * @@ -19,7 +20,7 @@ local dashboard = {} -- main namespace for all dashboard functionality -- cache some functions and variables for performance -local compile = dashx.compiler.loadfile +local compile = loadfile local baseDir = dashx.config.baseDir local preferences = dashx.config.preferences diff --git a/scripts/dashx/widgets/dashboard/init.lua b/scripts/dashx/widgets/dashboard/init.lua index 11c3185..2a496a6 100644 --- a/scripts/dashx/widgets/dashboard/init.lua +++ b/scripts/dashx/widgets/dashboard/init.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) dashx Project * diff --git a/scripts/dashx/widgets/dashboard/lib/loaders.lua b/scripts/dashx/widgets/dashboard/lib/loaders.lua index 5c0d0a2..5a05715 100644 --- a/scripts/dashx/widgets/dashboard/lib/loaders.lua +++ b/scripts/dashx/widgets/dashboard/lib/loaders.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") -- loaders.lua local loaders = {} diff --git a/scripts/dashx/widgets/dashboard/lib/utils.lua b/scripts/dashx/widgets/dashboard/lib/utils.lua index 09445cc..e800a28 100644 --- a/scripts/dashx/widgets/dashboard/lib/utils.lua +++ b/scripts/dashx/widgets/dashboard/lib/utils.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) dashx Project * diff --git a/scripts/dashx/widgets/dashboard/objects/dial.lua b/scripts/dashx/widgets/dashboard/objects/dial.lua index fdb64c0..e33883d 100644 --- a/scripts/dashx/widgets/dashboard/objects/dial.lua +++ b/scripts/dashx/widgets/dashboard/objects/dial.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") local wrapper = {} local renders = dashx.widgets.dashboard.renders @@ -39,7 +40,7 @@ function wrapper.wakeup(box) if not renders[subtype] then local path = folder .. subtype .. ".lua" - local loader = dashx.compiler.loadfile(path) + local loader = loadfile(path) if loader then renders[subtype] = loader() else diff --git a/scripts/dashx/widgets/dashboard/objects/dial/image.lua b/scripts/dashx/widgets/dashboard/objects/dial/image.lua index 2740dd0..0bf5a69 100644 --- a/scripts/dashx/widgets/dashboard/objects/dial/image.lua +++ b/scripts/dashx/widgets/dashboard/objects/dial/image.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ Dial Image Widget Configurable Parameters (box table fields): diff --git a/scripts/dashx/widgets/dashboard/objects/dial/rainbow.lua b/scripts/dashx/widgets/dashboard/objects/dial/rainbow.lua index 4fde1de..f05515e 100644 --- a/scripts/dashx/widgets/dashboard/objects/dial/rainbow.lua +++ b/scripts/dashx/widgets/dashboard/objects/dial/rainbow.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ Rainbow Gauge Widget diff --git a/scripts/dashx/widgets/dashboard/objects/func.lua b/scripts/dashx/widgets/dashboard/objects/func.lua index 7394f36..2800cc3 100644 --- a/scripts/dashx/widgets/dashboard/objects/func.lua +++ b/scripts/dashx/widgets/dashboard/objects/func.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") local wrapper = {} local renders = dashx.widgets.dashboard.renders @@ -39,7 +40,7 @@ function wrapper.wakeup(box) if not renders[subtype] then local path = folder .. subtype .. ".lua" - local loader = dashx.compiler.loadfile(path) + local loader = loadfile(path) if loader then renders[subtype] = loader() else diff --git a/scripts/dashx/widgets/dashboard/objects/func/func.lua b/scripts/dashx/widgets/dashboard/objects/func/func.lua index 3aadff3..c8821c7 100644 --- a/scripts/dashx/widgets/dashboard/objects/func/func.lua +++ b/scripts/dashx/widgets/dashboard/objects/func/func.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ Custom Function Widget Configurable Arguments (box table keys): diff --git a/scripts/dashx/widgets/dashboard/objects/gauge.lua b/scripts/dashx/widgets/dashboard/objects/gauge.lua index c18aeab..1d31508 100644 --- a/scripts/dashx/widgets/dashboard/objects/gauge.lua +++ b/scripts/dashx/widgets/dashboard/objects/gauge.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") local wrapper = {} local renders = dashx.widgets.dashboard.renders @@ -39,7 +40,7 @@ function wrapper.wakeup(box) if not renders[subtype] then local path = folder .. subtype .. ".lua" - local loader = dashx.compiler.loadfile(path) + local loader = loadfile(path) if loader then renders[subtype] = loader() else diff --git a/scripts/dashx/widgets/dashboard/objects/gauge/arc.lua b/scripts/dashx/widgets/dashboard/objects/gauge/arc.lua index 6f476cd..452df2c 100644 --- a/scripts/dashx/widgets/dashboard/objects/gauge/arc.lua +++ b/scripts/dashx/widgets/dashboard/objects/gauge/arc.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ Arc Gauge Widget Configurable Parameters (box table fields): diff --git a/scripts/dashx/widgets/dashboard/objects/gauge/bar.lua b/scripts/dashx/widgets/dashboard/objects/gauge/bar.lua index 4ee9136..3bb2d4c 100644 --- a/scripts/dashx/widgets/dashboard/objects/gauge/bar.lua +++ b/scripts/dashx/widgets/dashboard/objects/gauge/bar.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ Bar Gauge Widget Configurable Parameters (box table fields): diff --git a/scripts/dashx/widgets/dashboard/objects/gauge/ring.lua b/scripts/dashx/widgets/dashboard/objects/gauge/ring.lua index 0e99b79..df0d798 100644 --- a/scripts/dashx/widgets/dashboard/objects/gauge/ring.lua +++ b/scripts/dashx/widgets/dashboard/objects/gauge/ring.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ Rainbow Gauge Widget Configurable Parameters (box table fields): diff --git a/scripts/dashx/widgets/dashboard/objects/gauge/step.lua b/scripts/dashx/widgets/dashboard/objects/gauge/step.lua index 19bd885..5d83bef 100644 --- a/scripts/dashx/widgets/dashboard/objects/gauge/step.lua +++ b/scripts/dashx/widgets/dashboard/objects/gauge/step.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ Step Bar Widget Configurable Parameters (box table fields): diff --git a/scripts/dashx/widgets/dashboard/objects/image.lua b/scripts/dashx/widgets/dashboard/objects/image.lua index 08c0d3c..1654f35 100644 --- a/scripts/dashx/widgets/dashboard/objects/image.lua +++ b/scripts/dashx/widgets/dashboard/objects/image.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") local wrapper = {} local renders = dashx.widgets.dashboard.renders @@ -39,7 +40,7 @@ function wrapper.wakeup(box) if not renders[subtype] then local path = folder .. subtype .. ".lua" - local loader = dashx.compiler.loadfile(path) + local loader = loadfile(path) if loader then renders[subtype] = loader() else diff --git a/scripts/dashx/widgets/dashboard/objects/image/image.lua b/scripts/dashx/widgets/dashboard/objects/image/image.lua index d2c8c31..3aa693b 100644 --- a/scripts/dashx/widgets/dashboard/objects/image/image.lua +++ b/scripts/dashx/widgets/dashboard/objects/image/image.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ Image Box Widget Configurable Parameters (box table fields): diff --git a/scripts/dashx/widgets/dashboard/objects/image/model.lua b/scripts/dashx/widgets/dashboard/objects/image/model.lua index d8355cc..e224ae6 100644 --- a/scripts/dashx/widgets/dashboard/objects/image/model.lua +++ b/scripts/dashx/widgets/dashboard/objects/image/model.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ Model Image Widget Configurable Parameters (box table fields): diff --git a/scripts/dashx/widgets/dashboard/objects/navigation.lua b/scripts/dashx/widgets/dashboard/objects/navigation.lua index 42d15e7..768168f 100644 --- a/scripts/dashx/widgets/dashboard/objects/navigation.lua +++ b/scripts/dashx/widgets/dashboard/objects/navigation.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") local wrapper = {} local renders = dashx.widgets.dashboard.renders @@ -41,7 +42,7 @@ function wrapper.wakeup(box) if not renders[subtype] then local path = folder .. subtype .. ".lua" - local loader = dashx.compiler.loadfile(path) + local loader = loadfile(path) if loader then renders[subtype] = loader() else diff --git a/scripts/dashx/widgets/dashboard/objects/navigation/ah.lua b/scripts/dashx/widgets/dashboard/objects/navigation/ah.lua index 5add527..acafee0 100644 --- a/scripts/dashx/widgets/dashboard/objects/navigation/ah.lua +++ b/scripts/dashx/widgets/dashboard/objects/navigation/ah.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ Attitude Horizon Widget (AH) Configurable Parameters (box table fields): diff --git a/scripts/dashx/widgets/dashboard/objects/text.lua b/scripts/dashx/widgets/dashboard/objects/text.lua index d6ce6e1..a64574d 100644 --- a/scripts/dashx/widgets/dashboard/objects/text.lua +++ b/scripts/dashx/widgets/dashboard/objects/text.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") local wrapper = {} local renders = dashx.widgets.dashboard.renders @@ -39,7 +40,7 @@ function wrapper.wakeup(box) if not renders[subtype] then local path = folder .. subtype .. ".lua" - local loader = dashx.compiler.loadfile(path) + local loader = loadfile(path) if loader then renders[subtype] = loader() else diff --git a/scripts/dashx/widgets/dashboard/objects/text/apiversion.lua b/scripts/dashx/widgets/dashboard/objects/text/apiversion.lua index 3101c2a..eb36744 100644 --- a/scripts/dashx/widgets/dashboard/objects/text/apiversion.lua +++ b/scripts/dashx/widgets/dashboard/objects/text/apiversion.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ API Version Widget Configurable Parameters (box table fields): diff --git a/scripts/dashx/widgets/dashboard/objects/text/armflags.lua b/scripts/dashx/widgets/dashboard/objects/text/armflags.lua index 05138db..1184d1d 100644 --- a/scripts/dashx/widgets/dashboard/objects/text/armflags.lua +++ b/scripts/dashx/widgets/dashboard/objects/text/armflags.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ Arm Flags Widget Configurable Parameters (box table fields): diff --git a/scripts/dashx/widgets/dashboard/objects/text/clock.lua b/scripts/dashx/widgets/dashboard/objects/text/clock.lua index 60c5606..7b6ccae 100644 --- a/scripts/dashx/widgets/dashboard/objects/text/clock.lua +++ b/scripts/dashx/widgets/dashboard/objects/text/clock.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ Clock Widget Configurable Parameters (box table fields): diff --git a/scripts/dashx/widgets/dashboard/objects/text/craftname.lua b/scripts/dashx/widgets/dashboard/objects/text/craftname.lua index afd60bc..092401e 100644 --- a/scripts/dashx/widgets/dashboard/objects/text/craftname.lua +++ b/scripts/dashx/widgets/dashboard/objects/text/craftname.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ Craft Name Widget Configurable Parameters (box table fields): diff --git a/scripts/dashx/widgets/dashboard/objects/text/governor.lua b/scripts/dashx/widgets/dashboard/objects/text/governor.lua index 03c1d36..0e9fe85 100644 --- a/scripts/dashx/widgets/dashboard/objects/text/governor.lua +++ b/scripts/dashx/widgets/dashboard/objects/text/governor.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ Governor State Widget Configurable Parameters (box table fields): diff --git a/scripts/dashx/widgets/dashboard/objects/text/pidrates.lua b/scripts/dashx/widgets/dashboard/objects/text/pidrates.lua index 5be7982..a125d8a 100644 --- a/scripts/dashx/widgets/dashboard/objects/text/pidrates.lua +++ b/scripts/dashx/widgets/dashboard/objects/text/pidrates.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ PID/Rates Profile Display Object diff --git a/scripts/dashx/widgets/dashboard/objects/text/session.lua b/scripts/dashx/widgets/dashboard/objects/text/session.lua index 71ccea6..36d8dae 100644 --- a/scripts/dashx/widgets/dashboard/objects/text/session.lua +++ b/scripts/dashx/widgets/dashboard/objects/text/session.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ Session Value Widget Configurable Parameters (box table fields): diff --git a/scripts/dashx/widgets/dashboard/objects/text/stats.lua b/scripts/dashx/widgets/dashboard/objects/text/stats.lua index b4e49af..f71b198 100644 --- a/scripts/dashx/widgets/dashboard/objects/text/stats.lua +++ b/scripts/dashx/widgets/dashboard/objects/text/stats.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ Stats Display Widget Configurable Parameters (box table fields): diff --git a/scripts/dashx/widgets/dashboard/objects/text/telemetry.lua b/scripts/dashx/widgets/dashboard/objects/text/telemetry.lua index 141059d..20ebcab 100644 --- a/scripts/dashx/widgets/dashboard/objects/text/telemetry.lua +++ b/scripts/dashx/widgets/dashboard/objects/text/telemetry.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ Telemetry Value Widget Configurable Parameters (box table fields): diff --git a/scripts/dashx/widgets/dashboard/objects/text/text.lua b/scripts/dashx/widgets/dashboard/objects/text/text.lua index 72d6ad1..04af7bd 100644 --- a/scripts/dashx/widgets/dashboard/objects/text/text.lua +++ b/scripts/dashx/widgets/dashboard/objects/text/text.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ Text Display Widget (Static/Label) diff --git a/scripts/dashx/widgets/dashboard/objects/text/watts.lua b/scripts/dashx/widgets/dashboard/objects/text/watts.lua index 766d407..2bd36c0 100644 --- a/scripts/dashx/widgets/dashboard/objects/text/watts.lua +++ b/scripts/dashx/widgets/dashboard/objects/text/watts.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ Dynamic Power (Watts) Display Widget diff --git a/scripts/dashx/widgets/dashboard/objects/time.lua b/scripts/dashx/widgets/dashboard/objects/time.lua index 8a70d76..98471cd 100644 --- a/scripts/dashx/widgets/dashboard/objects/time.lua +++ b/scripts/dashx/widgets/dashboard/objects/time.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") local wrapper = {} local renders = dashx.widgets.dashboard.renders @@ -40,7 +41,7 @@ function wrapper.wakeup(box) if not renders[subtype] then local path = folder .. subtype .. ".lua" - local loader = dashx.compiler.loadfile(path) + local loader = loadfile(path) if loader then renders[subtype] = loader() else diff --git a/scripts/dashx/widgets/dashboard/objects/time/count.lua b/scripts/dashx/widgets/dashboard/objects/time/count.lua index 8f97c18..fb6a44d 100644 --- a/scripts/dashx/widgets/dashboard/objects/time/count.lua +++ b/scripts/dashx/widgets/dashboard/objects/time/count.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ Flight Count Widget Configurable Parameters (box table fields): diff --git a/scripts/dashx/widgets/dashboard/objects/time/flight.lua b/scripts/dashx/widgets/dashboard/objects/time/flight.lua index 4cb255c..2d60c24 100644 --- a/scripts/dashx/widgets/dashboard/objects/time/flight.lua +++ b/scripts/dashx/widgets/dashboard/objects/time/flight.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ Flight Time Widget Configurable Parameters (box table fields): diff --git a/scripts/dashx/widgets/dashboard/objects/time/total.lua b/scripts/dashx/widgets/dashboard/objects/time/total.lua index d36f8cd..d6ac5dd 100644 --- a/scripts/dashx/widgets/dashboard/objects/time/total.lua +++ b/scripts/dashx/widgets/dashboard/objects/time/total.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ Total Flight Time Widget Configurable Parameters (box table fields): diff --git a/scripts/dashx/widgets/dashboard/themes/@rt-rc/inflight.lua b/scripts/dashx/widgets/dashboard/themes/@rt-rc/inflight.lua index e1fdbbe..e7d40ee 100644 --- a/scripts/dashx/widgets/dashboard/themes/@rt-rc/inflight.lua +++ b/scripts/dashx/widgets/dashboard/themes/@rt-rc/inflight.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) Rotorflight Project * diff --git a/scripts/dashx/widgets/dashboard/themes/@rt-rc/init.lua b/scripts/dashx/widgets/dashboard/themes/@rt-rc/init.lua index 459ece8..c88df5b 100644 --- a/scripts/dashx/widgets/dashboard/themes/@rt-rc/init.lua +++ b/scripts/dashx/widgets/dashboard/themes/@rt-rc/init.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) dashx Project * diff --git a/scripts/dashx/widgets/dashboard/themes/@rt-rc/postflight.lua b/scripts/dashx/widgets/dashboard/themes/@rt-rc/postflight.lua index 318d6a0..cab11f6 100644 --- a/scripts/dashx/widgets/dashboard/themes/@rt-rc/postflight.lua +++ b/scripts/dashx/widgets/dashboard/themes/@rt-rc/postflight.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) Rotorflight Project * diff --git a/scripts/dashx/widgets/dashboard/themes/@rt-rc/preflight.lua b/scripts/dashx/widgets/dashboard/themes/@rt-rc/preflight.lua index d3d4c5f..1e0264b 100644 --- a/scripts/dashx/widgets/dashboard/themes/@rt-rc/preflight.lua +++ b/scripts/dashx/widgets/dashboard/themes/@rt-rc/preflight.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) Rotorflight Project * diff --git a/scripts/dashx/widgets/dashboard/themes/default/inflight.lua b/scripts/dashx/widgets/dashboard/themes/default/inflight.lua index a84370c..7ccaed2 100644 --- a/scripts/dashx/widgets/dashboard/themes/default/inflight.lua +++ b/scripts/dashx/widgets/dashboard/themes/default/inflight.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) Rotorflight Project * diff --git a/scripts/dashx/widgets/dashboard/themes/default/init.lua b/scripts/dashx/widgets/dashboard/themes/default/init.lua index 6ed39f3..09b1a01 100644 --- a/scripts/dashx/widgets/dashboard/themes/default/init.lua +++ b/scripts/dashx/widgets/dashboard/themes/default/init.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) dashx Project * diff --git a/scripts/dashx/widgets/dashboard/themes/default/postflight.lua b/scripts/dashx/widgets/dashboard/themes/default/postflight.lua index a522280..ac8af2c 100644 --- a/scripts/dashx/widgets/dashboard/themes/default/postflight.lua +++ b/scripts/dashx/widgets/dashboard/themes/default/postflight.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) Rotorflight Project * diff --git a/scripts/dashx/widgets/dashboard/themes/default/preflight.lua b/scripts/dashx/widgets/dashboard/themes/default/preflight.lua index 7e188d2..5e2d50f 100644 --- a/scripts/dashx/widgets/dashboard/themes/default/preflight.lua +++ b/scripts/dashx/widgets/dashboard/themes/default/preflight.lua @@ -1,3 +1,4 @@ +local dashx = require("dashx") --[[ * Copyright (C) Rotorflight Project *