-
-
Notifications
You must be signed in to change notification settings - Fork 720
battery type selection #6050
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
battery type selection #6050
Conversation
|
| model | device_test | click_test | persistence_test |
|---|---|---|---|
| T2T1 | test(all) main(all) ![]() |
test(all) main(all) ![]() |
test(all) main(all) ![]() |
| T3B1 | test(all) main(all) ![]() |
test(all) main(all) ![]() |
test(all) main(all) ![]() |
| T3T1 | test(all) main(all) ![]() |
test(all) main(all) ![]() |
test(all) main(all) ![]() |
| T3W1 | test(all) main(all) ![]() |
test(all) main(all) ![]() |
test(all) main(all) ![]() |
Latest CI run: 18933393067
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces battery type selection support by reading battery configuration from OTP (One-Time Programmable) storage and using it to dynamically select the appropriate battery model parameters for the fuel gauge system.
- Adds
battery_typefield to unit properties read from OTP storage - Refactors battery model functions to use a
battery_model_tstructure instead of global constants - Initializes battery model parameters in fuel gauge based on the detected battery type
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| core/embed/util/unit_properties/stm32/unit_properties.c | Reads battery type from OTP data[4] and marks it as valid |
| core/embed/util/unit_properties/inc/util/unit_properties.h | Adds battery_type field and validity flag to unit_properties_t struct |
| core/embed/sys/power_manager/stm32u5/power_monitoring.c | Updates battery function calls to pass model pointer |
| core/embed/sys/power_manager/stm32u5/power_manager.c | Adds initialization check and passes model pointer to battery functions |
| core/embed/sys/power_manager/fuel_gauge/fuel_gauge.h | Adds battery_model_t member to fuel_gauge_state_t |
| core/embed/sys/power_manager/fuel_gauge/fuel_gauge.c | Initializes battery model parameters based on battery type from unit properties |
| core/embed/sys/power_manager/fuel_gauge/battery_model.h | Defines battery_model_t struct and updates all function signatures to accept model pointer |
| core/embed/sys/power_manager/fuel_gauge/battery_model.c | Refactors all functions to use model pointer instead of global constants |
| core/embed/sys/power_manager/fuel_gauge/battery_data_jyhpfl333838.h | Renames all constants with JYHPFL333838 prefix for model-specific identification |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
f4d4aae to
c43f2f7
Compare
…types [no changelog]
…cally selected battery model [no changelog]
[no changelog]
52ee6d0 to
fc3936b
Compare




































This PR does some preparation for using two different battery vendors in one device.
The battery model is selected based on info in unit properties. The model/fuel gauge is adjusted so that dynamic model selection is enabled.