@@ -533,7 +533,8 @@ local function parseParameterInfoMessage(data)
533533 allParamsLoaded = 1
534534 fieldId = 1
535535 createDeviceFields ()
536- else
536+ elseif allParamsLoaded == 0 then
537+ -- advance to the next field if doing a full load
537538 fieldId = 1 + (fieldId % (# fields - 1 ))
538539 end
539540 fieldTimeout = getTime () + 200
@@ -554,11 +555,11 @@ local function parseElrsInfoMessage(data)
554555
555556 local badPkt = data [3 ]
556557 local goodPkt = (data [4 ]* 256 ) + data [5 ]
557- local state = (bit32.btest (elrsFlags , 1 ) and " C" ) or " -"
558- goodBadPkt = string.format (" %u/%u %s" , badPkt , goodPkt , state )
559-
560558 elrsFlags = data [6 ]
561559 elrsFlagsInfo = fieldGetString (data , 7 )
560+
561+ local state = (bit32.btest (elrsFlags , 1 ) and " C" ) or " -"
562+ goodBadPkt = string.format (" %u/%u %s" , badPkt , goodPkt , state )
562563end
563564
564565local function refreshNext ()
@@ -583,14 +584,7 @@ local function refreshNext()
583584 elseif time > devicesRefreshTimeout and fields_count < 1 then
584585 devicesRefreshTimeout = time + 100 -- 1s
585586 crossfireTelemetryPush (0x28 , { 0x00 , 0xEA })
586- elseif time > fieldTimeout and fields_count ~= 0 and not edit then
587- if allParamsLoaded < 1 or statusComplete == 0 then
588- crossfireTelemetryPush (0x2C , { deviceId , handsetId , fieldId , fieldChunk })
589- fieldTimeout = time + 50 -- 0.5s
590- end
591- end
592-
593- if time > linkstatTimeout then
587+ elseif time > linkstatTimeout then
594588 if not deviceIsELRS_TX and allParamsLoaded == 1 then
595589 goodBadPkt = " "
596590 -- enable both line below to do what the legacy lua is doing which is reloading all params in an interval
@@ -600,7 +594,13 @@ local function refreshNext()
600594 crossfireTelemetryPush (0x2D , { deviceId , handsetId , 0x0 , 0x0 }) -- request linkstat
601595 end
602596 linkstatTimeout = time + 100
597+ elseif time > fieldTimeout and fields_count ~= 0 and not edit then
598+ if allParamsLoaded < 1 or statusComplete == 0 then
599+ crossfireTelemetryPush (0x2C , { deviceId , handsetId , fieldId , fieldChunk })
600+ fieldTimeout = time + 50 -- 0.5s
601+ end
603602 end
603+
604604 if time > titleShowWarnTimeout then
605605 -- if elrsFlags bit set is bit higher than bit 0 and bit 1, it is warning flags
606606 titleShowWarn = (elrsFlags > 3 and not titleShowWarn ) or nil
@@ -729,7 +729,7 @@ local function handleDevicePageEvent(event)
729729 -- data again, with a short delay to allow the module EEPROM to
730730 -- commit. Do this before save() to allow save to override
731731 fieldTimeout = getTime () + 20
732- fieldId , fieldChunk = field .id , 0
732+ fieldId , fieldChunk , statusComplete = field .id , 0 , 0
733733 fieldData = {}
734734 end
735735 functions [field .type + 1 ].save (field )
0 commit comments