fix(radio): reset statistics values on model change (#7518)

This commit is contained in:
3djc
2026-07-04 18:34:15 +10:00
committed by GitHub
parent 057883da83
commit 45e8d93eec
4 changed files with 10 additions and 2 deletions
+1
View File
@@ -66,6 +66,7 @@ ScriptInputsOutputs scriptInputsOutputs[MAX_SCRIPTS];
uint16_t maxLuaInterval = 0;
uint16_t maxLuaDuration = 0;
uint32_t lastLuaTime = 0;
tmr10ms_t luaCycleStart;
char lua_warning_info[LUA_WARNING_INFO_LEN+1];
uint8_t errorState;
+1
View File
@@ -208,6 +208,7 @@ extern struct our_longjmp * global_lj;
extern uint16_t maxLuaInterval;
extern uint16_t maxLuaDuration;
extern uint32_t lastLuaTime;
extern uint8_t instructionsPercent;
#define LUA_TASK_PERIOD_TICKS 5 // 50 ms
-2
View File
@@ -358,7 +358,6 @@ void guiMain(event_t evt)
{
#if defined(LUA)
uint32_t t0 = get_tmr10ms();
static uint32_t lastLuaTime = 0;
uint16_t interval = (lastLuaTime == 0 ? 0 : (t0 - lastLuaTime));
lastLuaTime = t0;
if (interval > maxLuaInterval) {
@@ -443,7 +442,6 @@ void guiMain(event_t evt)
#if defined(LUA)
// TODO better lua stopwatch
uint32_t t0 = get_tmr10ms();
static uint32_t lastLuaTime = 0;
uint16_t interval = (lastLuaTime == 0 ? 0 : (t0 - lastLuaTime));
lastLuaTime = t0;
if (interval > maxLuaInterval) {
+8
View File
@@ -317,6 +317,14 @@ if(g_model.rssiSource) {
LUA_LOAD_MODEL_SCRIPTS();
SEND_FAILSAFE_1S();
// Reset debug stats for the newly loaded model (after checkAll() warnings)
maxMixerDuration = 0;
#if defined(LUA)
maxLuaInterval = 0;
maxLuaDuration = 0;
lastLuaTime = 0; // avoids counting the load time as one huge interval spike
#endif
}
void storageFlushCurrentModel()