diff --git a/src/SCRIPTS/TELEMETRY/iNav.lua b/src/SCRIPTS/TELEMETRY/iNav.lua index 839f7e3..0337f84 100644 --- a/src/SCRIPTS/TELEMETRY/iNav.lua +++ b/src/SCRIPTS/TELEMETRY/iNav.lua @@ -2,7 +2,7 @@ -- Docs: https://github.com/iNavFlight/OpenTX-Telemetry-Widget local zone, options = ... -local VERSION = "2.1.1-a1" +local VERSION = "2.1.1-rc1" local FILE_PATH = "/SCRIPTS/TELEMETRY/iNav/" local SMLCD = LCD_W < 212 local HORUS = LCD_W >= 480 or LCD_H >= 480 diff --git a/src/SCRIPTS/TELEMETRY/iNav/load_e.lua b/src/SCRIPTS/TELEMETRY/iNav/load_e.lua index 9eff527..ebc6cb9 100644 --- a/src/SCRIPTS/TELEMETRY/iNav/load_e.lua +++ b/src/SCRIPTS/TELEMETRY/iNav/load_e.lua @@ -26,7 +26,8 @@ end local log = getDateTime() config[34].x = -1 -local mbase = string.gsub(model.getInfo().name, " ", ".") .. "-20" +-- From EdgeTX 2.7.1 (at least) we don't need to translate spaces +local mbase = model.getInfo().name .. "-20" local mblen = string.len(mbase) local tempf = {} local tempi = 0 diff --git a/src/SCRIPTS/TELEMETRY/iNav/log.lua b/src/SCRIPTS/TELEMETRY/iNav/log.lua index 0888e9d..7ce6b44 100644 --- a/src/SCRIPTS/TELEMETRY/iNav/log.lua +++ b/src/SCRIPTS/TELEMETRY/iNav/log.lua @@ -31,10 +31,9 @@ end local function playLog(data, config, distCalc, date) local gpsTemp = nil - local replc = data.etx and "." or "_" if logfh == nil then - logfh = io.open("/LOGS/" .. string.gsub(model.getInfo().name, " ", replc) .. "-20" .. date .. ".csv") - fake = loadScript(FILE_PATH .. "log_" .. (data.crsf and "c" or "s") .. ".luac", env)() + local mbase = data.etx and model.getInfo().name or string.gsub(model.getInfo().name, " ", "_") + logfh = io.open("/LOGS/" .. mbase .. "-20" .. date .. ".csv") data.showMax = false seek = 0 end @@ -115,7 +114,9 @@ local function playLog(data, config, distCalc, date) if record[i] == "Rud" then break end label[string.lower(record[i])] = i end + if record[i] == "1RSS(dB)" then data.crsf = true end end + fake = loadScript(FILE_PATH .. "log_" .. (data.crsf and "c" or "s") .. ".luac", env)() else -- Fake telemetry specific to Crossfire or S.Port fake(data, config, record, label, toNum) diff --git a/src/SCRIPTS/TELEMETRY/iNav/log_c.lua b/src/SCRIPTS/TELEMETRY/iNav/log_c.lua index b5fb8de..a584e4f 100644 --- a/src/SCRIPTS/TELEMETRY/iNav/log_c.lua +++ b/src/SCRIPTS/TELEMETRY/iNav/log_c.lua @@ -2,34 +2,34 @@ --Date,Time,FM,1RSS(dB),2RSS(dB),RQly(%),RSNR(dB),RFMD,TPWR(mW),TRSS(dB),TQly(%),TSNR(dB),RxBt(V),Curr(A),Capa(mAh),GPS,GSpd(mph),Hdg(@),Alt(ft),Sats,Ptch(rad),Roll(rad),Yaw(rad),Rud,Ele,Thr,Ail,S1,6P,S2,LS,RS,SA,SB,SC,SD,SE,SF,SG,SH,LSW,TxBat(V) local function fake(data, config, record, label, toNum) - data.rssi = toNum(record[label.rqly]) - data.tpwr = toNum(record[label.tpwr]) - data.rfmd = toNum(record[label.rfmd]) - data.pitch = math.deg(toNum(record[label.ptch])) * 10 - data.roll = math.deg(toNum(record[label.roll])) * 10 - data.batt = toNum(record[label.rxbt]) - if data.lang == "fr" and data.batt == 0 then data.batt = toNum(record[label.btrx]) end - -- Overflow shenanigans - local tmp = toNum(record[label.yaw]) - data.heading = math.deg(tmp < 0 and tmp + 6.55 or tmp) - if data.fpv_id > -1 then - tmp = toNum(record[label.hdg]) - data.fpv = (tmp < 0 and tmp + 65.54 or tmp) * 10 - end - --[[ Replacement code once the Crossfire/OpenTX Yaw/Hdg int overflow shenanigans are corrected - data.heading = math.deg(toNum(record[label.yaw])) - if data.fpv_id > -1 then data.fpv =toNum(record[label.hdg]) * 10 end - ]] - data.fuel = toNum(record[label.capa]) - data.fuelRaw = data.fuel - if data.showFuel and config[23].v == 0 then - data.fuel = math.max(math.min(math.floor((1 - (data.fuel) / config[27].v) * 100 + 0.5), 100), 0) - end - -- Don't know the flight mode with Crossfire, so assume armed and ACRO - data.mode = 5 - data.satellites = toNum(record[label.sats]) - --Fake HDOP based on satellite lock count and assume GPS fix when there's at least 6 satellites - data.hdop = data.satellites + (math.floor(math.min(data.satellites + 10, 25) * 0.36 + 0.5) * 100) + (data.satellites >= 6 and 3000 or 0) + data.rssi = toNum(record[label.rqly]) + data.tpwr = toNum(record[label.tpwr]) + data.rfmd = toNum(record[label.rfmd]) + data.pitch = math.deg(toNum(record[label.ptch])) * 10 + data.roll = math.deg(toNum(record[label.roll])) * 10 + data.batt = toNum(record[label.rxbt]) + if data.lang == "fr" and data.batt == 0 then data.batt = toNum(record[label.btrx]) end + -- Overflow shenanigans + local tmp = toNum(record[label.yaw]) + data.heading = math.deg(tmp < 0 and tmp + 6.55 or tmp) + if data.fpv_id > -1 then + tmp = toNum(record[label.hdg]) + data.fpv = (tmp < 0 and tmp + 65.54 or tmp) * 10 + end + --[[ Replacement code once the Crossfire/OpenTX Yaw/Hdg int overflow shenanigans are corrected + data.heading = math.deg(toNum(record[label.yaw])) + if data.fpv_id > -1 then data.fpv =toNum(record[label.hdg]) * 10 end + ]] + data.fuel = toNum(record[label.capa]) + data.fuelRaw = data.fuel + if data.showFuel and config[23].v == 0 then + data.fuel = math.max(math.min(math.floor((1 - (data.fuel) / config[27].v) * 100 + 0.5), 100), 0) + end + -- Don't know the flight mode with Crossfire, so assume armed and ACRO + data.mode = 5 + data.satellites = toNum(record[label.sats]) + --Fake HDOP based on satellite lock count and assume GPS fix when there's at least 6 satellites + data.satellites = data.satellites + (math.floor(math.min(data.satellites + 10, 25) * 0.36 + 0.5) * 100) + (data.satellites >= 6 and 3000 or 0) end return fake diff --git a/src/SCRIPTS/TELEMETRY/iNav/log_s.lua b/src/SCRIPTS/TELEMETRY/iNav/log_s.lua index d8a66ae..120edb2 100644 --- a/src/SCRIPTS/TELEMETRY/iNav/log_s.lua +++ b/src/SCRIPTS/TELEMETRY/iNav/log_s.lua @@ -22,4 +22,4 @@ local function fake(data, config, record, label, toNum) data.batt = toNum(record[label.vfas]) end -return fake \ No newline at end of file +return fake diff --git a/src/SCRIPTS/TELEMETRY/iNav/menu.lua b/src/SCRIPTS/TELEMETRY/iNav/menu.lua index 0c5a654..b03c09e 100644 --- a/src/SCRIPTS/TELEMETRY/iNav/menu.lua +++ b/src/SCRIPTS/TELEMETRY/iNav/menu.lua @@ -136,11 +136,6 @@ local function view(data, config, units, lang, event, gpsDegMin, getTelemetryId, ]] -- Select config option if data.configSelect == 0 then ---[[ - if event ~= 0 then - print("DBG EVT="..event.." VNEXT="..EVT_VIRTUAL_NEXT.." VPREV="..EVT_VIRTUAL_PREV) - end -]] if event == EVT_VIRTUAL_NEXT then -- Next option data.configStatus = data.configStatus == #config and 1 or data.configStatus + 1 data.configTop = data.configStatus > math.min(#config, data.configTop + ROWS) and data.configTop + 1 or (data.configStatus == 1 and 1 or data.configTop)