FreeCalypso > hg > fc-tourmaline
changeset 245:3eccca3ac219
FCBM: charging state display implemented
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Wed, 05 May 2021 07:02:50 +0000 |
parents | 96784b8974eb |
children | d25af5b7e773 |
files | src/cs/services/fcbm/fcbm_charging.c |
diffstat | 1 files changed, 26 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/cs/services/fcbm/fcbm_charging.c Mon May 03 06:51:29 2021 +0000 +++ b/src/cs/services/fcbm/fcbm_charging.c Wed May 05 07:02:50 2021 +0000 @@ -14,6 +14,7 @@ #include "r2d/r2d.h" #include "r2d/r2d_blrr_api.h" #include "abb/abb.h" +#include <stdio.h> #ifdef LSCREEN char fcbm_prod_banner_string[] = "FreeCalypso Handset"; @@ -21,6 +22,19 @@ char fcbm_prod_banner_string[] = "FreeCalypso Lite"; #endif +static char *fchg_states[] = { + "No charge power", + "CHG start delay", + "Ready to charge", + "Charge complete", + "I2V cal phase 1", + "I2V cal phase 2", + "CI charging", + "CV charging", + "Time exceeded", + "No charging" +}; + void fcbm_process_msg_chg_mode(void) { if (fcbm_life_cycle_state != FCBM_STATE_INACTIVE) { @@ -47,7 +61,18 @@ static void charging_info_update(void) { - /* to be filled */ + struct fchg_user_state state; + char str[20]; + + fchg_get_current_state(&state); + fcbm_display_line(3, fchg_states[state.chg_state]); + sprintf(str, "Vbat=%u mV", state.batt_mv); + fcbm_display_line(5, str); + sprintf(str, "Ichg=%u mA", fchg_convert_ichg_to_mA(state.ichg)); + fcbm_display_line(6, str); + sprintf(str, "(%u ADC units)", state.ichg); + fcbm_display_line(7, str); + r2d_flush(); } static void power_off_check(void)