Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/common/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
static serialPort_t * logPort = NULL;
static mspPort_t * mspLogPort = NULL;

PG_REGISTER(logConfig_t, logConfig, PG_LOG_CONFIG, 0);
PG_REGISTER_WITH_RESET_TEMPLATE(logConfig_t, logConfig, PG_LOG_CONFIG, 0);
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.

Action required

1. Defaults won't migrate 🐞 Bug ≡ Correctness

logConfig is still registered with version 0, so pgLoad() will restore any existing EEPROM
record over the new reset-template defaults and the fixed defaults won't take effect until EEPROM is
reset. This undermines the PR goal for users upgrading from builds that previously saved a
zero-initialized logConfig.
Agent Prompt
### Issue description
`logConfig` now has a reset template wired via `PG_REGISTER_WITH_RESET_TEMPLATE`, but because the registered version is still `0`, any existing EEPROM record with version `0` will be copied back over the template defaults during `pgLoad()`. This prevents the new defaults from taking effect for upgraded devices unless they reset EEPROM.

### Issue Context
- `pgLoad()` resets to defaults and then restores EEPROM data only when `version == pgVersion(reg)`.
- `ensureEEPROMContainsValidData()` will reset and write defaults when EEPROM is invalid; older firmware likely wrote a zero-initialized `logConfig` due to being registered without a reset template.

### Fix Focus Areas
- src/main/common/log.c[57-57]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


PG_RESET_TEMPLATE(logConfig_t, logConfig,
.level = SETTING_LOG_LEVEL_DEFAULT,
Expand Down
Loading