changeset 647:94cb5e76b3b5

FCHG: fixed corner case bug of missing discharge init on charger unplug also turn on LEDC during i2v calibration
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 16 Apr 2020 16:48:08 +0000
parents 8c74c177e914
children 337e6d3a4454
files src/cs/drivers/drv_app/fchg/fchg_process.c
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/cs/drivers/drv_app/fchg/fchg_process.c	Tue Apr 14 20:09:37 2020 +0000
+++ b/src/cs/drivers/drv_app/fchg/fchg_process.c	Thu Apr 16 16:48:08 2020 +0000
@@ -69,7 +69,7 @@
 	 * of the I to V converter
 	 */
 	ABB_Write_Register_on_page(PAGE0, BCICTL2, 0x0010);
-	ABB_Write_Register_on_page(PAGE0, BCICTL2, 0x0019);
+	ABB_Write_Register_on_page(PAGE0, BCICTL2, 0x0019 | LEDC);
 }
 
 static void start_ci_charging(void)
@@ -298,6 +298,7 @@
 				RV_TRACE_LEVEL_DEBUG_LOW, FCHG_USE_ID);
 		if (!(msg->data[9] & CHGPRES)) {
 			pwr_ctrl->state = FCHG_STATE_NO_EXT_PWR;
+			pwr_init_discharge();
 			return;
 		}
 		start_ci_charging();
@@ -307,6 +308,7 @@
 		if (!(msg->data[9] & CHGPRES)) {
 			ABB_Write_Register_on_page(PAGE0, BCICTL2, 0);
 			pwr_ctrl->state = FCHG_STATE_NO_EXT_PWR;
+			pwr_init_discharge();
 			return;
 		}
 		if (charging_time_limit_check())
@@ -318,6 +320,7 @@
 		if (!(msg->data[9] & CHGPRES)) {
 			ABB_Write_Register_on_page(PAGE0, BCICTL2, 0);
 			pwr_ctrl->state = FCHG_STATE_NO_EXT_PWR;
+			pwr_init_discharge();
 			return;
 		}
 		if (cv_ichg_process(msg->data[2]))