Skip to content

Fix TX v7 to v8 config upgrades / double reboot on reboot - #3396

Merged
CapnBry merged 5 commits into
ExpressLRS:masterfrom
CapnBry:v8-tx-conf
Nov 15, 2025
Merged

CapnBry merged 5 commits into
ExpressLRS:masterfrom
CapnBry:v8-tx-conf

Conversation

@CapnBry

@CapnBry CapnBry commented Nov 9, 2025

Copy link
Copy Markdown
Member

Updates the TX config's 3.x.x (config v7) to 4.0 (config v8) to work properly and not jumble the model settings on every reboot. Also fix double reboots from occurring on the TX when restarted via ESP.restart()

Config upgrade

When updating from 3.x to 4.0, most model config settings (tlm ratio, switch mode, power, etc) would be jumbled up. This would keep happening across every module restart until a value was changed via the lua, which would lock in all the model settings at whatever they were at that time. All 64 models were jumbled repeatedly so this would be a nightmare for the users to discover. Even flashing back to 3.x the config wasn't reset, now reinterpreting v8's config values as being proper v7. Steps to reproduce:

  • Ranger Micro
  • Load 3.x.x-maint (config version 7)
  • Via lua set: Packet rate 150Hz, tlm ratio 1:64, switch mode hybrid, power 10mW
  • Flash master via wifi
  • Confirm in lua: Packet rate 150Hz, tlm ratio 1:8, switch mode ERR, power 50mw?!
  • Restart handset
  • Confirm in lua: Packet rate 150Hz, tlm ratio 1:2, switch mode Hybrid, power (forgot to write this one down)
  • Restart handset
  • Confirm in lua: Packet rate 150Hz, tlm ratio Std, switch mode Wide, power 1000mW dynamic AUX9
  • Values will keep changing until a value is set via lua

This was due to the version number in the config not being committed as there was no "modified" flag in the config for updating all the models. To fix this I've added a EVENT_CONFIG_VERSION_CHANGED that will be set.

Double Reboot

I've noticed over the last few months that when doing a wifi update, the module will reboot, run for about half a second, then reboot again. I thought this was some sort of desired behavior but was quite surprised last night when PK didn't know this was happening.

The real issue here was that the reboot was happening right in the middle of the config update procedure, leaving some models updated but not getting to the point where the version was saved. It is interesting to note that nvs_set_u32() does make changes despite not calling nvs_commit(). It is possible that due to the software reset, the actual NVS RAM cache still exists, allowing double changes to take place.

The issue here was the device manager starting all core 0 tasks while setup() was still taking place, which caused the RGBLED device to skip the startup rainbow (it doesn't do this on SW reset boot), which needed to know the current ExpressLRS_currAirRate_Modparams to display the right color. This was still nullptr so the core would panic, reboot with PANIC reset boot, causing the rainbow to avoid the issue on the second boot. Wow, right?

Core 0 devices were running due to a EVENT_MODEL_SELECTED improperly unblocking the interlocking multicore devices startup procedure. I've changed the event handler to only unblock core 0 if startup has completed, as well as better documenting the startup procedure.

ESP-based TX config upgrades

ESP-based TXes (generally only RX-as-TX) have broken config updates. I've updated the v7 to v8 to be correct now, and the v6 to v7 to be better, but going from anything other than v7 to v8 (e.g. v5 to v8) will result in improper defaults for new fields. The issue being the earlier upgrades do not know what defaults to use for their older config structures for these new fields. Someone could edit their update procedures to fill in the proper defaults for each stage but I don't want to do it as I'm very tired.

@pkendall64 pkendall64 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Not seen any issues whilst updating.

@mha1 mha1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updating a 3.x.x-maintenance module to V4 went smoothly. All settings transferred ok. No double boot flashing via WiFi.

@CapnBry
CapnBry merged commit 16ed275 into ExpressLRS:master Nov 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants