Skip to content

Commit d935652

Browse files
nordic-aukorlubos
authored andcommitted
nrf_fuel_gauge: Update nrf_fuel_gauge to v0.11.1
Update nrf_fuel_gauge to v0.11.1, which brings improvements to TTE, reduced RAM usage, and other tweaks. Signed-off-by: Audun Korneliussen <[email protected]>
1 parent eec620f commit d935652

File tree

7 files changed

+61
-6
lines changed

7 files changed

+61
-6
lines changed

nrf_fuel_gauge/CHANGELOG.rst

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,31 @@ Changelog
99

1010
All notable changes to this project are documented on this page.
1111

12+
Main branch
13+
***********
14+
15+
Changes
16+
=======
17+
18+
* Updated to library version 0.11.1.
19+
* The :c:func:`nrf_fuel_gauge_init` function no longer copies the battery model pointed to in the :c:struct:`nrf_fuel_gauge_init_parameters` structure.
20+
This means that you must ensure that the battery model is kept valid while using the library, either in ROM or RAM.
21+
* The :c:func:`nrf_fuel_gauge_process` function has a new argument to specify when bus voltage is present.
22+
That is, when system is powered by vbus instead of or in addition to the battery.
23+
24+
Added
25+
=====
26+
27+
* The :c:func:`nrf_fuel_gauge_opt_params_default_get` convenience function to initialize the :c:struct:`nrf_fuel_gauge_config_parameters` structure.
28+
* The :c:func:`nrf_fuel_gauge_opt_params_adjust` function to adjust certain parameters without reinitializing the library.
29+
* New configuration parameters in the :c:struct:`nrf_fuel_gauge_config_parameters` structure.
30+
* New configuration parameter in the :c:struct:`nrf_fuel_gauge_runtime_parameters` structure.
31+
32+
Bug fixes
33+
=========
34+
35+
* Fixed an issue where battery models with less than three temperature points could generate wrong state-of-charge after using the :c:func:`nrf_fuel_gauge_idle_set` function.
36+
1237
nRF Connect SDK v2.6.0
1338
**********************
1439

nrf_fuel_gauge/include/nrf_fuel_gauge.h

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ extern const char *nrf_fuel_gauge_version;
4646
extern const char *nrf_fuel_gauge_build_date;
4747

4848
/**
49-
* @brief Battery model parameters.
49+
* @brief Secondary cell (rechargeable) battery model parameters.
5050
*
5151
* @details Parameter details purposefully not documented.
5252
*/
@@ -84,13 +84,22 @@ struct nrf_fuel_gauge_state_info {
8484
/**
8585
* @brief Optional static configuration parameters.
8686
*
87-
* @details Parameter details purposefully not documented.
87+
* @details Some parameter details purposefully not documented.
8888
*/
8989
struct nrf_fuel_gauge_config_parameters {
90-
float tau;
90+
float tau1;
91+
float tau2;
9192
float neta1;
9293
float neta2;
9394
float neta3;
95+
float beta1;
96+
float beta2;
97+
/**@brief Minimum duration of battery charge/discharge before TTE becomes available [s] */
98+
float tte_min_time;
99+
/**@brief Reset threshold for TTE calculation. If short-term state-of-charge gradient differs
100+
* from the long-term state-of-charge by this factor or more, the TTE state is reset.
101+
*/
102+
float tte_reset_threshold;
94103
};
95104

96105
/**
@@ -103,6 +112,7 @@ struct nrf_fuel_gauge_runtime_parameters {
103112
float b;
104113
float c;
105114
float d;
115+
bool discard_positive_deltaz;
106116
};
107117

108118
/**
@@ -115,15 +125,25 @@ struct nrf_fuel_gauge_init_parameters {
115125
float i0;
116126
/** Initial temperature in centigrades [C]. */
117127
float t0;
118-
/** Battery model */
128+
/** Pointer to static battery model. The model is not copied and must be kept valid. */
119129
const struct battery_model *model;
120130
/** Optional configuration parameters. Set to NULL to use default values. */
121131
const struct nrf_fuel_gauge_config_parameters *opt_params;
122132
};
123133

134+
/**
135+
* @brief Initialize optional configuration parameters to default values.
136+
*
137+
* @param[out] opt_params Pointer to the parameter structure.
138+
*/
139+
void nrf_fuel_gauge_opt_params_default_get(struct nrf_fuel_gauge_config_parameters *opt_params);
140+
124141
/**
125142
* @brief Initialize the nRF Fuel Gauge library.
126143
*
144+
* @note The battery model referenced in @ref parameters must be kept valid as long as the library
145+
* is in use.
146+
*
127147
* @param[in] parameters Pointer to the parameter structure.
128148
* @param[out] v0 Adjusted battery voltage (optional, for logging purposes).
129149
*
@@ -139,12 +159,13 @@ int nrf_fuel_gauge_init(const struct nrf_fuel_gauge_init_parameters *parameters,
139159
* @param i Measured battery current [A].
140160
* @param T Measured battery temperature [C].
141161
* @param t_delta Time delta since previous processed measurement [s].
162+
* @param vbus_present True if vbus voltage is present, for devices that supports this.
142163
* @param state Pointer to state info struct (optional, set to null to ignore).
143164
*
144165
* @retval Predicted state-of-charge [%].
145166
*/
146-
float nrf_fuel_gauge_process(
147-
float v, float i, float T, float t_delta, struct nrf_fuel_gauge_state_info *state);
167+
float nrf_fuel_gauge_process(float v, float i, float T, float t_delta, bool vbus_present,
168+
struct nrf_fuel_gauge_state_info *state);
148169

149170
/**
150171
* @brief Get predicted "time-to-empty" discharge duration.
@@ -199,6 +220,15 @@ void nrf_fuel_gauge_idle_set(float v, float T, float i_avg);
199220
*/
200221
void nrf_fuel_gauge_param_adjust(const struct nrf_fuel_gauge_runtime_parameters *params);
201222

223+
/**
224+
* @brief Update optional parameters.
225+
*
226+
* @details Parameter details purposefully not documented.
227+
*
228+
* @param opt_params New parameter values.
229+
*/
230+
void nrf_fuel_gauge_opt_params_adjust(const struct nrf_fuel_gauge_config_parameters *opt_params);
231+
202232
#ifdef __cplusplus
203233
}
204234
#endif
1.45 KB
Binary file not shown.
1.05 KB
Binary file not shown.
1.45 KB
Binary file not shown.
1.02 KB
Binary file not shown.
1.27 KB
Binary file not shown.

0 commit comments

Comments
 (0)