Skip to content

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

Merged
pfeerick merged 1 commit into
mainfrom
3djc/fix-debug-values-modelchange
Jul 4, 2026
Merged

fix(radio): reset statistics values on model change#7518
pfeerick merged 1 commit into
mainfrom
3djc/fix-debug-values-modelchange

Conversation

@3djc

@3djc 3djc commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Summary of changes:

Some of the values displayed on statistic debug screen were showing misleading values after model change, as they were still computed during model change.

This resets those value after model load so they are relevant to the current model only.

Summary by CodeRabbit

  • Bug Fixes
    • Improved timing tracking during model loading so load-related delays no longer skew runtime measurements.
    • Reset Lua-related timing data after loading to avoid false spikes in performance stats.
    • Kept the app’s timing calculations consistent across screens by using a shared timing value.

@3djc 3djc added bug 🪲 Something isn't working backport/2.12 To be backported to a 2.12 release also. labels Jul 3, 2026
@3djc 3djc added this to the 3.0 milestone Jul 3, 2026
@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 659bc6c9-92d7-441d-a280-4bed0fbf38ba

📥 Commits

Reviewing files that changed from the base of the PR and between 3e88e06 and 8b3c2ea.

📒 Files selected for processing (4)
  • radio/src/lua/interface.cpp
  • radio/src/lua/lua_api.h
  • radio/src/main.cpp
  • radio/src/storage/storage_common.cpp
💤 Files with no reviewable changes (1)
  • radio/src/main.cpp

📝 Walkthrough

Walkthrough

Converts lastLuaTime from a local static variable in main.cpp's guiMain Lua timing logic to a global variable declared in interface.cpp and exported via lua_api.h. Additionally, postModelLoad in storage_common.cpp now resets maxMixerDuration and, when LUA is defined, maxLuaInterval, maxLuaDuration, and lastLuaTime.

Changes

Lua Timing Global Variable

Layer / File(s) Summary
Global variable definition and declaration
radio/src/lua/interface.cpp, radio/src/lua/lua_api.h
Adds uint32_t lastLuaTime = 0; global definition and its extern declaration for cross-file access.
Remove local static in guiMain
radio/src/main.cpp
Removes the local static uint32_t lastLuaTime = 0; declarations in both GUI build paths, so the interval calculation now uses the global variable.
Reset timing stats on model load
radio/src/storage/storage_common.cpp
Resets maxMixerDuration and, under LUA, maxLuaInterval, maxLuaDuration, and lastLuaTime at the end of postModelLoad.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely matches the main change: resetting statistics values on model change.
Description check ✅ Passed The description includes the required summary section and clearly explains the user-facing change.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 3djc/fix-debug-values-modelchange

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pfeerick pfeerick added the firmware (fw) General radio firmware issue, not colorlcd or B&W specific label Jul 4, 2026
@pfeerick pfeerick modified the milestones: 3.0, 2.12.3 Jul 4, 2026
@pfeerick
pfeerick merged commit 45e8d93 into main Jul 4, 2026
40 checks passed
@pfeerick
pfeerick deleted the 3djc/fix-debug-values-modelchange branch July 4, 2026 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport/2.12 To be backported to a 2.12 release also. bug 🪲 Something isn't working firmware (fw) General radio firmware issue, not colorlcd or B&W specific

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants