feat(core): update battery model with more temperature profiles.
What changed, and why it matters
This commit updates the battery fuel gauge calibration table for a specific Trezor battery model. It replaces 4 temperature data points with 8 more detailed temperature profiles and adjusts the mathematical curves used to estimate battery charge level. There is no indication this change affects security, cryptography, user funds, or device integrity.
No security action required. Treat as normal hardware calibration/data update.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change is confined to core/embed/sys/power_manager/fuel_gauge/battery_data_jyhpfl333838.h. It increases BATTERY_NUM_TEMP_POINTS from 4 to 8, splits the single temperature array into separate discharge and charge temperature arrays, and updates the OCV curve parameters, internal resistance parameters, and capacity tables accordingly. No code logic, control flow, or security-critical code is modified.
Changed components
core/embed/sys/power_manager/fuel_gauge/battery_data_jyhpfl333838.hInspect captured patch +139 / −62
diff --git a/core/embed/sys/power_manager/fuel_gauge/battery_data_jyhpfl333838.h b/core/embed/sys/power_manager/fuel_gauge/battery_data_jyhpfl333838.h
index 726cb2cb9..cdd206c93 100644
--- a/core/embed/sys/power_manager/fuel_gauge/battery_data_jyhpfl333838.h
+++ b/core/embed/sys/power_manager/fuel_gauge/battery_data_jyhpfl333838.h
@@ -34,99 +34,176 @@
*/
// Configuration
-#define BATTERY_NUM_TEMP_POINTS 4
+#define BATTERY_NUM_TEMP_POINTS 8
// SOC breakpoints for piecewise functions
#define BATTERY_SOC_BREAKPOINT_1 0.25f
#define BATTERY_SOC_BREAKPOINT_2 0.8f
-// Temperature points array (in Celsius)
-static const float BATTERY_TEMP_POINTS[BATTERY_NUM_TEMP_POINTS] = {
- 14.99f, 19.83f, 24.88f, 29.87f};
+// Temperature points arrays (in Celsius)
+// Discharge temperatures
+static const float BATTERY_TEMP_POINTS_DISCHG[BATTERY_NUM_TEMP_POINTS] = {
+ 5.78f, 10.64f, 15.55f, 20.65f, 25.46f, 31.41f, 35.41f, 40.39f};
+
+// Charge temperatures
+static const float BATTERY_TEMP_POINTS_CHG[BATTERY_NUM_TEMP_POINTS] = {
+ 7.28f, 12.60f, 17.51f, 22.50f, 27.54f, 32.31f, 37.36f, 42.34f};
// Internal resistance curve parameters (rational function parameters
-// (a+b*t)/(c+d*t)
+// a+b*t)/(c+d*t)
static const float BATTERY_R_INT_PARAMS[4] = {
// a, b, c, d for rational function (a + b*t)/(c + d*t)
- 16.085563f, -0.125445f, 19.792552f, 0.145223f};
+ 2.454393f, 0.067324f, 2.343462f, 0.253930f};
// Discharge OCV curve parameters for each temperature
static const float BATTERY_OCV_DISCHARGE_PARAMS[BATTERY_NUM_TEMP_POINTS][10] = {
- // Temperature: 14.99°C
+ // Temperature: 5.78°C (key: 5)
+ {
+ 0.118793f, 3.223549f, // m, b (linear segment)
+ -28.710519f, -233.020734f, -9.387607f,
+ -69.377452f, // a1, b1, c1, d1 (first rational segment)
+ 1186.538824f, -1183.168718f, 357.662778f,
+ -356.677000f // a3, b3, c3, d3 (third rational segment)
+ },
+ // Temperature: 10.64°C (key: 10)
+ {
+ 0.116677f, 3.228169f, // m, b (linear segment)
+ 38.712861f, 310.693560f, 12.654472f,
+ 92.304022f, // a1, b1, c1, d1 (first rational segment)
+ 1191.497665f, -1188.685202f, 358.808999f,
+ -357.984106f // a3, b3, c3, d3 (third rational segment)
+ },
+ // Temperature: 15.55°C (key: 15)
+ {
+ 0.114203f, 3.232147f, // m, b (linear segment)
+ 46.343674f, 429.794749f, 15.123043f,
+ 128.169726f, // a1, b1, c1, d1 (first rational segment)
+ 2376.881452f, -2370.146392f, 715.418936f,
+ -713.454126f // a3, b3, c3, d3 (third rational segment)
+ },
+ // Temperature: 20.65°C (key: 20)
+ {
+ 0.114704f, 3.233252f, // m, b (linear segment)
+ 134.655526f, 1523.391576f, 43.909469f,
+ 456.507698f, // a1, b1, c1, d1 (first rational segment)
+ 1107.209215f, -1104.640469f, 333.093622f,
+ -332.346061f // a3, b3, c3, d3 (third rational segment)
+ },
+ // Temperature: 25.46°C (key: 25)
{
- 0.106732f, 3.237046f, // m, b (linear segment)
- 150.195726f, 1408.772874f, 49.011575f,
- 419.677576f, // a1, b1, c1, d1 (first rational segment)
- 1095.896717f, -1094.237972f, 329.945276f,
- -329.470389f // a3, b3, c3, d3 (third rational segment)
+ 0.117246f, 3.235164f, // m, b (linear segment)
+ 98.176928f, 1423.543661f, 32.065495f,
+ 428.106598f, // a1, b1, c1, d1 (first rational segment)
+ 2966.477437f, -2956.724203f, 891.503790f,
+ -888.671853f // a3, b3, c3, d3 (third rational segment)
},
- // Temperature: 19.83°C
+ // Temperature: 31.41°C (key: 30)
{
- 0.128675f, 3.229591f, // m, b (linear segment)
- 40.245534f, 455.485581f, 13.138466f,
- 136.444634f, // a1, b1, c1, d1 (first rational segment)
- 1639.259211f, -1636.939286f, 492.018097f,
- -491.352439f // a3, b3, c3, d3 (third rational segment)
+ 0.117384f, 3.238390f, // m, b (linear segment)
+ 85.864212f, 1387.277542f, 28.067560f,
+ 417.373016f, // a1, b1, c1, d1 (first rational segment)
+ 1149.478486f, -1147.371472f, 345.039987f,
+ -344.429990f // a3, b3, c3, d3 (third rational segment)
},
- // Temperature: 24.88°C
+ // Temperature: 35.41°C (key: 35)
{
- 0.121191f, 3.232382f, // m, b (linear segment)
- -82.844039f, -1002.077813f, -27.091776f,
- -300.331893f, // a1, b1, c1, d1 (first rational segment)
- 1123.577420f, -1122.115068f, 337.570875f,
- -337.154857f // a3, b3, c3, d3 (third rational segment)
+ 0.123742f, 3.235846f, // m, b (linear segment)
+ 142.926106f, 2413.781156f, 46.744426f,
+ 726.914288f, // a1, b1, c1, d1 (first rational segment)
+ 4746.864260f, -4740.482325f, 1423.698973f,
+ -1421.856011f // a3, b3, c3, d3 (third rational segment)
},
- // Temperature: 29.87°C
+ // Temperature: 40.39°C (key: 40)
{
- 0.124779f, 3.231043f, // m, b (linear segment)
- -105.157412f, -1529.966103f, -34.445200f,
- -460.150974f, // a1, b1, c1, d1 (first rational segment)
- 2810.755069f, -2807.662591f, 844.042035f,
- -843.161340f // a3, b3, c3, d3 (third rational segment)
+ 0.123445f, 3.236911f, // m, b (linear segment)
+ 123.143807f, 2079.888064f, 40.268920f,
+ 626.146547f, // a1, b1, c1, d1 (first rational segment)
+ 4400.930811f, -4394.510401f, 1319.644484f,
+ -1317.792008f // a3, b3, c3, d3 (third rational segment)
}};
// Charge OCV curve parameters for each temperature
static const float BATTERY_OCV_CHARGE_PARAMS[BATTERY_NUM_TEMP_POINTS][10] = {
- // Temperature: 14.99°C
+ // Temperature: 7.28°C (key: 5)
+ {
+ 0.119977f, 3.292032f, // m, b (linear segment)
+ 853.906052f, 23690.107718f, 265.829386f,
+ 7096.080219f, // a1, b1, c1, d1 (first rational segment)
+ -4674.103115f, 4463.128949f, -1397.627984f,
+ 1339.864213f // a3, b3, c3, d3 (third rational segment)
+ },
+ // Temperature: 12.60°C (key: 10)
+ {
+ 0.129893f, 3.273841f, // m, b (linear segment)
+ 5.758317f, 108.758491f, 1.807241f,
+ 32.631657f, // a1, b1, c1, d1 (first rational segment)
+ 1901.784554f, -1766.844686f, 574.822406f,
+ -537.820435f // a3, b3, c3, d3 (third rational segment)
+ },
+ // Temperature: 17.51°C (key: 15)
+ {
+ 0.115642f, 3.275607f, // m, b (linear segment)
+ 37.820015f, 312.545982f, 11.836739f,
+ 93.014230f, // a1, b1, c1, d1 (first rational segment)
+ 1114.586708f, -1075.733214f, 334.472803f,
+ -323.824737f // a3, b3, c3, d3 (third rational segment)
+ },
+ // Temperature: 22.50°C (key: 20)
+ {
+ 0.118272f, 3.274047f, // m, b (linear segment)
+ 22.731575f, 173.069914f, 7.144899f,
+ 51.331716f, // a1, b1, c1, d1 (first rational segment)
+ 1152.334851f, -1113.108848f, 345.641805f,
+ -334.889218f // a3, b3, c3, d3 (third rational segment)
+ },
+ // Temperature: 27.54°C (key: 25)
{
- 0.155811f, 3.250616f, // m, b (linear segment)
- 882.012695f, 40175.064826f, 303.995510f,
- 12069.381036f, // a1, b1, c1, d1 (first rational segment)
- -4395.474187f, 3903.326115f, -1345.816241f,
- 1210.894940f // a3, b3, c3, d3 (third rational segment)
+ 0.111078f, 3.279982f, // m, b (linear segment)
+ -6.914910f, -92.593412f, -2.171610f,
+ -27.668490f, // a1, b1, c1, d1 (first rational segment)
+ 1252.901718f, -1213.409067f, 375.520632f,
+ -364.700745f // a3, b3, c3, d3 (third rational segment)
},
- // Temperature: 19.83°C
+ // Temperature: 32.31°C (key: 30)
{
- 0.150987f, 3.250656f, // m, b (linear segment)
- 1253.813370f, 53662.474550f, 433.721486f,
- 16108.954614f, // a1, b1, c1, d1 (first rational segment)
- -672.584219f, 615.456869f, -204.657772f,
- 189.004166f // a3, b3, c3, d3 (third rational segment)
+ 0.105869f, 3.277491f, // m, b (linear segment)
+ 85.748575f, 803.500844f, 27.050103f,
+ 238.806153f, // a1, b1, c1, d1 (first rational segment)
+ 639.263868f, -630.230568f, 190.960695f,
+ -188.480780f // a3, b3, c3, d3 (third rational segment)
},
- // Temperature: 24.88°C
+ // Temperature: 37.36°C (key: 35)
{
- 0.137795f, 3.255241f, // m, b (linear segment)
- 11079.770525f, 467803.865900f, 3799.664030f,
- 140476.474886f, // a1, b1, c1, d1 (first rational segment)
- 23060.170644f, -21499.043288f, 6996.033171f,
- -6568.182436f // a3, b3, c3, d3 (third rational segment)
+ 0.103776f, 3.278805f, // m, b (linear segment)
+ -64.738447f, -883.533215f, -20.434949f,
+ -263.970865f, // a1, b1, c1, d1 (first rational segment)
+ 1133.040608f, -1120.212998f, 338.203820f,
+ -334.681274f // a3, b3, c3, d3 (third rational segment)
},
- // Temperature: 29.87°C
+ // Temperature: 42.34°C (key: 40)
{
- 0.133387f, 3.257527f, // m, b (linear segment)
- -51.838664f, -2099.240917f, -17.726544f,
- -630.000601f, // a1, b1, c1, d1 (first rational segment)
- 1610.609673f, -1520.476008f, 486.934271f,
- -462.190000f // a3, b3, c3, d3 (third rational segment)
+ 0.105245f, 3.279165f, // m, b (linear segment)
+ 107.494439f, 1441.391508f, 34.356316f,
+ 428.716770f, // a1, b1, c1, d1 (first rational segment)
+ 943.609378f, -933.154526f, 281.509060f,
+ -278.639013f // a3, b3, c3, d3 (third rational segment)
}};
// Battery capacity data for each temperature
static const float BATTERY_CAPACITY[BATTERY_NUM_TEMP_POINTS][2] = {
- // Temperature: 14.99°C
- {341.15f, 398.60f},
- // Temperature: 19.83°C
- {344.52f, 409.01f},
- // Temperature: 24.88°C
- {350.78f, 401.40f},
- // Temperature: 29.87°C
- {354.19f, 405.16f}};
+ // Temperature: 5.78°C (key: 5)
+ {325.07f, 336.55f},
+ // Temperature: 10.64°C (key: 10)
+ {343.23f, 366.44f},
+ // Temperature: 15.55°C (key: 15)
+ {355.86f, 378.79f},
+ // Temperature: 20.65°C (key: 20)
+ {362.69f, 394.38f},
+ // Temperature: 25.46°C (key: 25)
+ {369.62f, 375.32f},
+ // Temperature: 31.41°C (key: 30)
+ {361.17f, 379.75f},
+ // Temperature: 35.41°C (key: 35)
+ {357.76f, 366.75f},
+ // Temperature: 40.39°C (key: 40)
+ {358.06f, 383.63f}};
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.