Index: firmware/App/Monitors/Battery.c =================================================================== diff -u -rbbbc0d82d0f73ca7b0aa4e23fc9dbe38ee089655 -rf65325ed47c1d70a3abf8a6f853f858b57228734 --- firmware/App/Monitors/Battery.c (.../Battery.c) (revision bbbc0d82d0f73ca7b0aa4e23fc9dbe38ee089655) +++ firmware/App/Monitors/Battery.c (.../Battery.c) (revision f65325ed47c1d70a3abf8a6f853f858b57228734) @@ -15,10 +15,11 @@ * ***************************************************************************/ +#include + #include "Battery.h" #include "BatteryDriver.h" #include "Messaging.h" -#include "math.h" #include "PersistentAlarm.h" #include "TaskGeneral.h" #include "TestSupport.h" @@ -78,7 +79,7 @@ { initSetupI2cDriver(); - (void)enableBatteryChargerAdc(); + enableBatteryChargerAdc(); currentBmValue = BEGINNING_OF_LIST; lastBatteryMonitorTime = 0; @@ -194,7 +195,6 @@ { lastBatteryMonitorTime = getMSTimerCount(); getBatteryManagementData(); - } } @@ -214,11 +214,6 @@ static void getBatteryManagementData( void ) { U32 responseData; - float TS_ratio = 0.0f; - float V_TS = 0.0f; - float R_NTC = 0.0f; - float T_K = 0.0f; - float T_C = 0.0f; // Increment the position in the enum. Starting value is BEGINNING_OF_LIST (0), so on the first // cycle through this function it will be set to the first valid position (1) @@ -272,6 +267,12 @@ responseData = 0U; if ( TRUE == getBatteryData( BATTERY_CHARGER_ADDRESS, BATTERY_CHARGER_TS, &responseData ) ) { + float TS_ratio = 0.0f; + float V_TS = 0.0f; + float R_NTC = 0.0f; + float T_K = 0.0f; + float T_C = 0.0f; + TS_ratio = responseData/1024.0f; V_TS = TS_ratio * V_REGN; R_NTC = R_PULLUP * V_TS / (V_REGN - V_TS); @@ -344,13 +345,17 @@ * @brief * The isBatteryRemainingCapacityLessThan60Wh function checks whether the * battery remaining capacity is below the equivalent of 60 Wh. - * @details \b Inputs: batteryRegisterOverrides[] + * @details \b Inputs: none * @details \b Outputs: none * @return TRUE if the battery remaining capacity is below 60 Wh, FALSE if not *************************************************************************/ BOOL isBatteryRemainingCapacityLessThan60Wh( void ) { - return ( getBatteryRegisterValue( BATTERY_PACK_REMAINING_CAPACITY ) < BATTERY_60WH_CAPACITY_MAH ) ? TRUE : FALSE; + U32 result = 0U; + + result = ( getBatteryRegisterValue( BATTERY_PACK_REMAINING_CAPACITY ) < BATTERY_60WH_CAPACITY_MAH ) ? TRUE : FALSE; + + return result; } /*********************************************************************//** @@ -385,10 +390,12 @@ } } + /************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/ + /*********************************************************************//** * @brief * The testBatteryRegisterOverride function overrides one battery register