# HG changeset patch # User Mychaela Falconia # Date 1512437344 0 # Node ID 6ab14029931c4587ef8c69486fc8ca4498bcf8de # Parent f08212cf0b049e4d2244a24b77a3d703f178016f FCHG: default battery table implemented diff -r f08212cf0b04 -r 6ab14029931c components/fchg --- a/components/fchg Mon Dec 04 06:00:15 2017 +0000 +++ b/components/fchg Tue Dec 05 01:29:04 2017 +0000 @@ -35,4 +35,5 @@ SRCDIR=$SRC/cs/drivers/drv_app/fchg +cfile_plain $SRCDIR/fchg_default_batt.c cfile_plain $SRCDIR/fchg_env.c diff -r f08212cf0b04 -r 6ab14029931c src/cs/drivers/drv_app/fchg/fchg_default_batt.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/cs/drivers/drv_app/fchg/fchg_default_batt.c Tue Dec 05 01:29:04 2017 +0000 @@ -0,0 +1,42 @@ +/* + * This module provides the default table of battery State-of-Charge + * thresholds in the absence of a customized table in FFS. + * + * The present default table has been taken from Pirelli's firmware. + */ + +#include "fchg/fchg_env.h" +#include "rv/rv_general.h" +#include + +static const T_PWR_THRESHOLDS default_batt_table[] = { + {4170, 100}, + {4120, 95}, + {4070, 90}, + {4030, 85}, + {3964, 80}, + {3930, 75}, + {3900, 70}, + {3882, 65}, + {3847, 60}, + {3805, 55}, + {3786, 50}, + {3771, 45}, + {3759, 40}, + {3750, 35}, + {3745, 30}, + {3737, 25}, + {3719, 20}, + {3688, 15}, + {3663, 10}, + {3539, 5}, + {3370, 0} +}; + +void pwr_set_default_batt_table(void) +{ + memcpy(pwr_ctrl->batt_thresholds, default_batt_table, + sizeof default_batt_table); + pwr_ctrl->nb_thresholds = sizeof(default_batt_table) / + sizeof(T_PWR_THRESHOLDS); +}