Skip to content
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

nrf_fuel_gauge: Update nrf_fuel_gauge to v0.11.1 #1469

Merged
merged 1 commit into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
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
25 changes: 25 additions & 0 deletions nrf_fuel_gauge/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,31 @@ Changelog

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

Main branch
***********

Changes
=======

* Updated to library version 0.11.1.
* 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.
This means that you must ensure that the battery model is kept valid while using the library, either in ROM or RAM.
* The :c:func:`nrf_fuel_gauge_process` function has a new argument to specify when bus voltage is present.
That is, when system is powered by vbus instead of or in addition to the battery.

Added
=====

* The :c:func:`nrf_fuel_gauge_opt_params_default_get` convenience function to initialize the :c:struct:`nrf_fuel_gauge_config_parameters` structure.
* The :c:func:`nrf_fuel_gauge_opt_params_adjust` function to adjust certain parameters without reinitializing the library.
* New configuration parameters in the :c:struct:`nrf_fuel_gauge_config_parameters` structure.
* New configuration parameter in the :c:struct:`nrf_fuel_gauge_runtime_parameters` structure.

Bug fixes
=========

* 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.

nRF Connect SDK v2.6.0
**********************

Expand Down
42 changes: 36 additions & 6 deletions nrf_fuel_gauge/include/nrf_fuel_gauge.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ extern const char *nrf_fuel_gauge_version;
extern const char *nrf_fuel_gauge_build_date;

/**
* @brief Battery model parameters.
* @brief Secondary cell (rechargeable) battery model parameters.
*
* @details Parameter details purposefully not documented.
*/
Expand Down Expand Up @@ -84,13 +84,22 @@ struct nrf_fuel_gauge_state_info {
/**
* @brief Optional static configuration parameters.
*
* @details Parameter details purposefully not documented.
* @details Some parameter details purposefully not documented.
*/
struct nrf_fuel_gauge_config_parameters {
float tau;
float tau1;
float tau2;
float neta1;
float neta2;
float neta3;
float beta1;
float beta2;
/**@brief Minimum duration of battery charge/discharge before TTE becomes available [s] */
float tte_min_time;
/**@brief Reset threshold for TTE calculation. If short-term state-of-charge gradient differs
* from the long-term state-of-charge by this factor or more, the TTE state is reset.
*/
float tte_reset_threshold;
};

/**
Expand All @@ -103,6 +112,7 @@ struct nrf_fuel_gauge_runtime_parameters {
float b;
float c;
float d;
bool discard_positive_deltaz;
};

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

/**
* @brief Initialize optional configuration parameters to default values.
*
* @param[out] opt_params Pointer to the parameter structure.
*/
void nrf_fuel_gauge_opt_params_default_get(struct nrf_fuel_gauge_config_parameters *opt_params);

/**
* @brief Initialize the nRF Fuel Gauge library.
*
* @note The battery model referenced in @ref parameters must be kept valid as long as the library
* is in use.
*
* @param[in] parameters Pointer to the parameter structure.
* @param[out] v0 Adjusted battery voltage (optional, for logging purposes).
*
Expand All @@ -139,12 +159,13 @@ int nrf_fuel_gauge_init(const struct nrf_fuel_gauge_init_parameters *parameters,
* @param i Measured battery current [A].
* @param T Measured battery temperature [C].
* @param t_delta Time delta since previous processed measurement [s].
* @param vbus_present True if vbus voltage is present, for devices that supports this.
* @param state Pointer to state info struct (optional, set to null to ignore).
*
* @retval Predicted state-of-charge [%].
*/
float nrf_fuel_gauge_process(
float v, float i, float T, float t_delta, struct nrf_fuel_gauge_state_info *state);
float nrf_fuel_gauge_process(float v, float i, float T, float t_delta, bool vbus_present,
struct nrf_fuel_gauge_state_info *state);

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

/**
* @brief Update optional parameters.
*
* @details Parameter details purposefully not documented.
*
* @param opt_params New parameter values.
*/
void nrf_fuel_gauge_opt_params_adjust(const struct nrf_fuel_gauge_config_parameters *opt_params);

#ifdef __cplusplus
}
#endif
Expand Down
Binary file modified nrf_fuel_gauge/lib/cortex-m3/soft-float/libnrf_fuel_gauge.a
Binary file not shown.
Binary file modified nrf_fuel_gauge/lib/cortex-m33/hard-float/libnrf_fuel_gauge.a
Binary file not shown.
Binary file modified nrf_fuel_gauge/lib/cortex-m33/soft-float/libnrf_fuel_gauge.a
Binary file not shown.
Binary file modified nrf_fuel_gauge/lib/cortex-m4/hard-float/libnrf_fuel_gauge.a
Binary file not shown.
Binary file modified nrf_fuel_gauge/lib/cortex-m4/soft-float/libnrf_fuel_gauge.a
Binary file not shown.
Loading