Index: firmware/App/Drivers/Battery.c =================================================================== diff -u -r6a56af179b733faed0a3d3013a2b0459d8d4cc61 -rcf62b937520e0ec38b86d65f1adbbc962d64f2a7 --- firmware/App/Drivers/Battery.c (.../Battery.c) (revision 6a56af179b733faed0a3d3013a2b0459d8d4cc61) +++ firmware/App/Drivers/Battery.c (.../Battery.c) (revision cf62b937520e0ec38b86d65f1adbbc962d64f2a7) @@ -138,7 +138,6 @@ static OVERRIDE_F32_T batteryRemCapacity_mAh = { 0.0, 0.0, 0.0, 0 }; ///< Battery pack remaining capacity (in mAh). static U32 lastBatteryMonitorTime = 0; ///< Previous battery monitor time. -static U32 lostACPowerPersistentCount = 0; ///< Persistent count for AC power lost alarm. static U32 commFaultPersistentCount = 0; ///< Persistence count for battery comm fault. static BATTERY_MANAGEMENT_ENUM_T current_BM_value; @@ -171,7 +170,6 @@ void initBattery( void ) { lastBatteryMonitorTime = 0; - lostACPowerPersistentCount = 0; commFaultPersistentCount = 0; current_BM_value = BEGINNING_OF_LIST; @@ -472,6 +470,8 @@ *************************************************************************/ static void getBatteryManagementData(void) { + HD_OP_MODE_T opMode = getCurrentOperationMode(); + // 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) current_BM_value += 1; @@ -624,17 +624,22 @@ { if ( 0 == ( BatteryStatusData.BatteryChargerStatus & BATTERY_CHARGER_STATUS_AC_PRESENT_MASK ) ) { - if ( ++lostACPowerPersistentCount > AC_POWER_LOST_PERSISTENT_COUNT ) - { #ifndef DISABLE_BATT_COMM + // Standby, Service, or Treatment Parameters mode + if ( opMode == MODE_STAN || opMode == MODE_SERV || opMode == MODE_TPAR ) + { SET_ALARM_WITH_1_U32_DATA( ALARM_ID_HD_AC_POWER_LOST, BatteryStatusData.BatteryChargerStatus ); -#endif } + // Pre-Treatment, Treatment, or Post-Treatment mode + else if( opMode == MODE_PRET || opMode == MODE_TREA || opMode == MODE_POST ) + { + SET_ALARM_WITH_1_U32_DATA( ALARM_ID_HD_AC_POWER_LOST_SECOND, BatteryStatusData.BatteryChargerStatus ); + } +#endif } else { clearAlarmCondition( ALARM_ID_HD_AC_POWER_LOST ); - lostACPowerPersistentCount = 0; } }