FreeCalypso > hg > fc-magnetite
changeset 346:550cfa9e1ca7
aci2: AT+CBC reimplemented in terms of FCHG API
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 15 Dec 2017 22:45:37 +0000 |
parents | 3a7810ca74e2 |
children | 78d1df0b8487 |
files | src/aci2/aci/ati_bas.c |
diffstat | 1 files changed, 22 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/src/aci2/aci/ati_bas.c Fri Dec 15 21:05:00 2017 +0000 +++ b/src/aci2/aci/ati_bas.c Fri Dec 15 22:45:37 2017 +0000 @@ -60,7 +60,7 @@ #include "ati_int.h" #ifndef _SIMULATION_ -#include "ffs\ffs.h" +#include "ffs/ffs.h" #endif #ifdef FF_ATI_BAT @@ -77,6 +77,8 @@ #include "cmh_ss.h" #include "fc-target.cfg" +#include "rv/rv_defined_swe.h" // for RVM_FCHG_SWE +#include "fchg/fchg_api.h" LOCAL T_ATI_RSLT aciPrcsPlusCG (UBYTE srcId, CHAR* cl, CHAR* ef); LOCAL T_ATI_RSLT setaciPrcsVolLevel ( CHAR* cl, UBYTE device ); @@ -1745,36 +1747,38 @@ GLOBAL T_ATI_RSLT atPlusCBC ( char *cl, UBYTE srcId ) { - pwr_Status_Type powerStat; + struct fchg_user_state fchg; UBYTE bcs; TRACE_FUNCTION("atPlusCBC()"); - if ( pwr_GetStatus ( &powerStat ) NEQ DRV_OK ) - { - cmdCmeError ( CME_ERR_Unknown ); - return ATI_FAIL; - } - else +#ifdef RVM_FCHG_SWE + if (fchg_get_current_state(&fchg) == RV_OK) { - switch ( powerStat.Status ) + switch (fchg.chg_state) { - case ( PWR_EXTPOWER_ON ): - bcs = ACI_BCS_NoBatt; - break; - - case ( PWR_CHARGER_ON ): + case FCHG_STATE_CI_CHARGING: + case FCHG_STATE_CV_CHARGING: bcs = ACI_BCS_BattCnctd; break; default: bcs = ACI_BCS_BattPower; - break; } - sprintf(g_sa, "+CBC: %d,%d", bcs, powerStat.ChargeLevel ); - io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); - return ATI_CMPL; + } + else + { + bcs = ACI_BCS_PowerFault; + fchg.batt_percent = 0; } +#else + bcs = ACI_BCS_NoBatt; + fchg.batt_percent = 0; +#endif + + sprintf(g_sa, "+CBC: %d,%d", bcs, fchg.batt_percent ); + io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); + return ATI_CMPL; } /*