Fix the issue where the default configuration parameters for the log#11493
Open
yangbryant wants to merge 1 commit intoiNavFlight:maintenance-9.xfrom
Open
Fix the issue where the default configuration parameters for the log#11493yangbryant wants to merge 1 commit intoiNavFlight:maintenance-9.xfrom
yangbryant wants to merge 1 commit intoiNavFlight:maintenance-9.xfrom
Conversation
…do not take effect
Contributor
Review Summary by QodoFix default log configuration parameters not taking effect
WalkthroughsDescription• This description is generated by an AI tool. It may have inaccuracies • Fixes default log configuration parameters not taking effect • Changes PG_REGISTER to PG_REGISTER_WITH_RESET_TEMPLATE macro • Ensures reset template is properly applied to log configuration Diagramflowchart LR
A["PG_REGISTER macro"] -- "replaced with" --> B["PG_REGISTER_WITH_RESET_TEMPLATE"]
B -- "applies reset template" --> C["Default log config parameters"]
C -- "now take effect" --> D["Log configuration initialized correctly"]
File Changes1. src/main/common/log.c
|
Contributor
Code Review by Qodo
|
| 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); |
Contributor
There was a problem hiding this comment.
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix the issue where the default configuration parameters for the log do not take effect