|
@@ -499,6 +499,7 @@ void UPS_LowBatMonitor(void)
|
|
|
{
|
|
|
static bool isValueRecv = false;
|
|
|
static uint8_t lowBatOldState = 0;
|
|
|
+ static bool flag_alarm_time = false;
|
|
|
uint8_t lowBatCurrent;
|
|
|
|
|
|
#if defined HARDWARE_BT6706 || HARDWARE_BT6708
|
|
@@ -536,30 +537,35 @@ void UPS_LowBatMonitor(void)
|
|
|
}
|
|
|
return;
|
|
|
}
|
|
|
- if (lowBatCurrent)
|
|
|
- flNonCriticalAlarm = true;
|
|
|
|
|
|
if (lowBatCurrent != lowBatOldState)
|
|
|
{
|
|
|
- if (lowBatCurrent){
|
|
|
- SNMP_SendUserTrap(LOW_BAT_ALARM);
|
|
|
- log_event_data(LOG_ALARM_LOW_BAT, "Авария");
|
|
|
- flUpdateLog = true;
|
|
|
+ if(flag_alarm_time){
|
|
|
+ flag_alarm_time = false;
|
|
|
+ if (lowBatCurrent){
|
|
|
+ SNMP_SendUserTrap(LOW_BAT_ALARM);
|
|
|
+ log_event_data(LOG_ALARM_LOW_BAT, "Авария");
|
|
|
+ flUpdateLog = true;
|
|
|
#ifdef HARDWARE_BT6706
|
|
|
- relay_setup_log(CurrROtype_Sourse, CHARGE_AKB, 1);
|
|
|
+ relay_setup_log(CurrROtype_Sourse, CHARGE_AKB, 1);
|
|
|
#endif
|
|
|
- }
|
|
|
- else{
|
|
|
- SNMP_SendUserTrap(LOW_BAT_NORM);
|
|
|
- log_event_data(LOG_ALARM_LOW_BAT, "Норма");
|
|
|
- flUpdateLog = true;
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ SNMP_SendUserTrap(LOW_BAT_NORM);
|
|
|
+ log_event_data(LOG_ALARM_LOW_BAT, "Норма");
|
|
|
+ flUpdateLog = true;
|
|
|
#if defined HARDWARE_BT6706 || HARDWARE_BT6708
|
|
|
- relay_setup_log(CurrROtype_Sourse, CHARGE_AKB, 0);
|
|
|
+ relay_setup_log(CurrROtype_Sourse, CHARGE_AKB, 0);
|
|
|
#endif
|
|
|
- }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ flag_alarm_time = true;
|
|
|
+ }
|
|
|
}
|
|
|
#if defined HARDWARE_BT6706 || HARDWARE_BT6708
|
|
|
else{
|
|
|
+ flag_alarm_time = false;
|
|
|
if (lowBatCurrent)
|
|
|
relay_setup_log_change(CurrROtype_Sourse, OldROtype_Sourse, CHARGE_AKB);
|
|
|
}
|
|
@@ -569,7 +575,17 @@ void UPS_LowBatMonitor(void)
|
|
|
}
|
|
|
#endif
|
|
|
|
|
|
- lowBatOldState = lowBatCurrent;
|
|
|
+ if(!flag_alarm_time){
|
|
|
+ if (lowBatCurrent){
|
|
|
+ flNonCriticalAlarm = true;
|
|
|
+ }
|
|
|
+ lowBatOldState = lowBatCurrent;
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ if (lowBatOldState){
|
|
|
+ flNonCriticalAlarm = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -713,6 +729,7 @@ void UPS_ConnectMonitor(void)
|
|
|
void UPS_BatteryConnectMonitor(void)
|
|
|
{
|
|
|
static bool isValueRecv = false;
|
|
|
+ static bool flag_alarm_time = false;
|
|
|
static uint8_t AKBconnectOldState = 0;
|
|
|
uint8_t AKBconnectCurrent;
|
|
|
|
|
@@ -754,30 +771,35 @@ void UPS_BatteryConnectMonitor(void)
|
|
|
}
|
|
|
return;
|
|
|
}
|
|
|
- if (AKBconnectCurrent)
|
|
|
- flCriticalAlarm = true;
|
|
|
|
|
|
if (AKBconnectCurrent != AKBconnectOldState)
|
|
|
{
|
|
|
- if (!AKBconnectCurrent){
|
|
|
- log_event_data(LOG_ALARM_AKB, "Норма");
|
|
|
- SNMP_SendUserTrap(BATTERY_CONNECT_NORM);
|
|
|
- flUpdateLog = true;
|
|
|
+ if(flag_alarm_time){
|
|
|
+ flag_alarm_time = false;
|
|
|
+ if (!AKBconnectCurrent){
|
|
|
+ log_event_data(LOG_ALARM_AKB, "Норма");
|
|
|
+ SNMP_SendUserTrap(BATTERY_CONNECT_NORM);
|
|
|
+ flUpdateLog = true;
|
|
|
#if defined HARDWARE_BT6706 || HARDWARE_BT6708
|
|
|
- relay_setup_log(CurrROtype_Sourse, OFF_AKB, 0);
|
|
|
+ relay_setup_log(CurrROtype_Sourse, OFF_AKB, 0);
|
|
|
#endif
|
|
|
- }
|
|
|
- else{
|
|
|
- log_event_data(LOG_ALARM_AKB, "Авария");
|
|
|
- SNMP_SendUserTrap(BATTERY_CONNECT_ALARM);
|
|
|
- flUpdateLog = true;
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ log_event_data(LOG_ALARM_AKB, "Авария");
|
|
|
+ SNMP_SendUserTrap(BATTERY_CONNECT_ALARM);
|
|
|
+ flUpdateLog = true;
|
|
|
#if defined HARDWARE_BT6706 || HARDWARE_BT6708
|
|
|
- relay_setup_log(CurrROtype_Sourse, OFF_AKB, 1);
|
|
|
+ relay_setup_log(CurrROtype_Sourse, OFF_AKB, 1);
|
|
|
#endif
|
|
|
- }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ flag_alarm_time = true;
|
|
|
+ }
|
|
|
}
|
|
|
#if defined HARDWARE_BT6706 || HARDWARE_BT6708
|
|
|
else{
|
|
|
+ flag_alarm_time = false;
|
|
|
if (AKBconnectCurrent)
|
|
|
relay_setup_log_change(CurrROtype_Sourse, OldROtype_Sourse, OFF_AKB);
|
|
|
}
|
|
@@ -787,7 +809,17 @@ void UPS_BatteryConnectMonitor(void)
|
|
|
}
|
|
|
#endif
|
|
|
|
|
|
- AKBconnectOldState = AKBconnectCurrent;
|
|
|
+ if(!flag_alarm_time){
|
|
|
+ if (AKBconnectCurrent){
|
|
|
+ flCriticalAlarm = true;
|
|
|
+ }
|
|
|
+ AKBconnectOldState = AKBconnectCurrent;
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ if (AKBconnectOldState){
|
|
|
+ flCriticalAlarm = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|