Index: firmware/App/Drivers/Battery.c =================================================================== diff -u -r630686dd2e148e5e2fef68b5ecd6466d2c75ca9e -r25ee7dc9e64357fd2c1bb27dc8ec017d5ad7d3a9 --- firmware/App/Drivers/Battery.c (.../Battery.c) (revision 630686dd2e148e5e2fef68b5ecd6466d2c75ca9e) +++ firmware/App/Drivers/Battery.c (.../Battery.c) (revision 25ee7dc9e64357fd2c1bb27dc8ec017d5ad7d3a9) @@ -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; @@ -473,6 +471,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; @@ -625,17 +625,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; } }