Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: FreescaleIAP mbed-rtos mbed
Fork of BAE_CODE_MARCH_2017 by
Diff: EPS.cpp
- Revision:
- 75:d05b0005ca50
- Parent:
- 74:2c82080db98b
- Child:
- 76:293693fb7949
--- a/EPS.cpp Sat Dec 10 09:57:10 2016 +0000
+++ b/EPS.cpp Sat Dec 10 10:51:46 2016 +0000
@@ -100,8 +100,8 @@
DigitalIn EPS_BATTERY_GAUGE_ALERT(PIN73);
//i2c.frequency(10000)
-extern int eps_btg_read_flag; // flag to check I2C ack on reading from BTG
-extern int eps_btg_writ_flag; // flag to check I2C ack on writing from BTG
+extern int eps_btg_read_flag; // flag to check I2C ack on reading from BTG: 1 indicates read failure, 0 indicates success
+extern int eps_btg_writ_flag; // flag to check I2C ack on writing from BTG: 1 indicates write failure, 0 indicates success
const char RCOMP0= 0x97;// don't know what it is now
BAE_HK_actual actual_data;
@@ -217,10 +217,10 @@
unsigned short value_u= (short int )value;
//value_u &=0x0001;
- if(value_u & 0x0001 == 0x0001) // battery gauge not initialised
+ if(value_u & 0x0001 == 0x0001 && eps_btg_read_flag == 0) // battery gauge not initialised
{
- //actual_data.power_mode = 1;
- actual_data.power_mode = 0;
+
+ actual_data.power_mode = 0; // indicates btg not working / NA
EPS_BATTERY_GAUGE_STATUS = 0; //clear EPS_BATTERY_GAUGE_STATUS
eps_pc.printf(" init BTG fail - %d\n\r", value_u);
}
@@ -1357,7 +1357,7 @@
if(ack == 0)
return ((buff[0] << 8) | buff[1]) * 0.00390625;
else
- return 200;
+ return 200; //SOC not available
}
