1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-26 01:35:21 +03:00

Prep for upcommnig GasSuite firmware update

This commit is contained in:
3djc 2018-09-21 13:02:22 +02:00
parent 1bd8558eeb
commit 26c4927993

View file

@ -1,4 +1,3 @@
---- #########################################################################
---- # #
---- # Copyright (C) OpenTX #
@ -16,13 +15,12 @@
---- # #
---- #########################################################################
local version = "v1.01"
local version = "v1.1"
local VALUE = 0
local COMBO = 1
local FLPOI = 2
local edit = false
local page = 1
local current = 1 --row
@ -197,8 +195,9 @@ end
local telemetryPopTimeout = 0
local function refreshNext()
if refreshState == 0 and page ~= 3 then --
if #modifications > 0 then --
if refreshState == 0 and page ~= 3 then
if #modifications > 0 then
--
if modifications[1][1] ~= 0x0c then
if modifications[1][1] == 0x22 then
modifications[1][2] = modifications[1][2] + 0xf00
@ -289,7 +288,7 @@ local function refreshNext()
if value3 > 0xf000 then
value3 = value3 - 0x10000
end
if configFields[12][4]== 1 and (field[3] == 0x90 or field[3] == 0x91)then
if configFields[11][4] == 1 and (field[3] == 0x90 or field[3] == 0x91) then
value3 = (value3 * 18)
value3 = math.floor(value3 / 10) + 32
end
@ -331,15 +330,15 @@ local function runFieldsPage(event)
end
end
elseif edit then
if event == EVT_PLUS_FIRST or event == EVT_ROT_RIGHT or event == EVT_PLUS_REPT then
if event == EVT_PLUS_FIRST or event == EVT_ROT_RIGHT or event == EVT_PLUS_REPT or event == EVT_RIGHT_FIRST then
addField(1)
elseif event == EVT_MINUS_FIRST or event == EVT_ROT_LEFT or event == EVT_MINUS_REPT then
elseif event == EVT_MINUS_FIRST or event == EVT_ROT_LEFT or event == EVT_MINUS_REPT or event == EVT_LEFT_FIRST then
addField(-1)
end
else
if event == EVT_MINUS_FIRST or event == EVT_ROT_RIGHT then
if event == EVT_MINUS_FIRST or event == EVT_ROT_RIGHT or event == EVT_DOWN_FIRST then
selectField(1)
elseif event == EVT_PLUS_FIRST or event == EVT_ROT_LEFT then
elseif event == EVT_PLUS_FIRST or event == EVT_ROT_LEFT or event == EVT_UP_FIRST then
selectField(-1)
end
end
@ -375,8 +374,7 @@ local function init()
{ "CDI off speed limit", VALUE, 0x81, nil, 10, 10000 },
{ "Milliliter per pulse", VALUE, 0x80, nil, 1, 2000 },
{ "Volume", VALUE, 0x83, nil, 10, 60000 },
{"Flow trigger", VALUE, 0x84, nil, 5, 50 },
{"Auto Reset", COMBO, 0x85, nil, { "ON", "OFF" }, {1 , 0}},
{ "Auto Reset", COMBO, 0x8d, nil, { "ON", "OFF" }, { 0, 1 } }, -- settings is in fact Flow Save, so inverted
{ "Reset settings", COMBO, 0x86, nil, { "YES", "NO" }, { 1, 0 } },
{ "Volume alarm(%)", VALUE, 0x87, nil, 0, 90 },
{ "Max.Flow alarm", VALUE, 0x88, nil, 0, 2000 },
@ -390,8 +388,7 @@ local function init()
{ "CDI off speed limit(*100RPM)", VALUE, 0x81, nil, 10, 10000 },
{ "Milliliter per pulse(*0.001mL/pul)", VALUE, 0x80, nil, 1, 2000 },
{ "Volume(mL)", VALUE, 0x83, nil, 10, 60000 },
{"Flow trigger(mL/min)", VALUE, 0x84, nil, 5, 50 },
{"Auto Reset", COMBO, 0x85, nil, { "ON", "OFF" }, {1 , 0}},
{ "Auto Reset", COMBO, 0x8d, nil, { "ON", "OFF" }, { 0, 1 } },
{ "Reset to factory settings", COMBO, 0x86, nil, { "YES", "NO" }, { 1, 0 } },
{ "Volume alarm(%)", VALUE, 0x87, nil, 0, 90 },
{ "Max.Flow alarm(mL/min)", VALUE, 0x88, nil, 0, 2000 },
@ -414,7 +411,8 @@ local function background()
thistime = getTime()
lastTime = thistime
refreshNext()
if page == 3 then --alarm
if page == 3 then
--alarm
local alarmnum = 0
if fields[3][4] ~= nil and configFields[9][4] ~= nil then
local speedtest = fields[3][4]
@ -429,7 +427,7 @@ local function background()
end
if fields[5][4] ~= nil and configFields[7][4] ~= nil then
local Residualtest = fields[5][4]
local Residualline = configFields[7][4]
local Residualline = configFields[6][4]
if Residualtest < Residualline then
tonefrq = 400
tonelength = 100
@ -439,8 +437,8 @@ local function background()
end
end
if fields[6][4] ~= nil and configFields[8][4] ~= nil then
local Flowtest = fields[6][4] --
local Flowover = configFields[8][4]
local Flowtest = fields[6][4]
local Flowover = configFields[7][4]
if Flowtest > Flowover then
tonefrq = 400
tonelength = 100
@ -451,7 +449,7 @@ local function background()
end
if fields[1][4] ~= nil and configFields[10][4] ~= nil then
local temp1test = fields[1][4] --
local temp1over = configFields[10][4]
local temp1over = configFields[9][4]
if temp1test > temp1over and (temp1test ~= 500 and temp1test ~= 932) then
tonefrq = 2000
tonelength = 100
@ -462,7 +460,7 @@ local function background()
end
if fields[2][4] ~= nil and configFields[11][4] ~= nil then
local temp2test = fields[2][4]
local temp2over = configFields[11][4]
local temp2over = configFields[10][4]
if temp2test > temp2over and (temp2test ~= 500 and temp2test ~= 932) then
tonefrq = 2000
tonelength = 300
@ -482,9 +480,9 @@ local function run(event)
if event == nil then
error("Cannot be run as a sensor script!")
return 2
elseif event == EVT_PAGE_BREAK or event == EVT_PAGEDN_FIRST then
elseif event == EVT_PAGE_BREAK or event == EVT_PAGEDN_FIRST or event == EVT_RIGHT_FIRST then
selectPage(1)
elseif event == EVT_PAGE_LONG or event == EVT_PAGEUP_FIRST then
elseif event == EVT_PAGE_LONG or event == EVT_PAGEUP_FIRST or event == EVT_LEFT_FIRST then
killEvents(event);
selectPage(-1)
end