|
@@ -160,40 +160,38 @@ void relay_setup_log(uint8_t *curr_source, ro_type_source_t src_act_ro, uint8_t
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-void relay_setup_log_change(uint8_t *curr_source, uint8_t *prev_source, ro_type_source_t src_act_ro, uint8_t state_relay)
|
|
|
+void relay_setup_log_change(uint8_t *curr_source, uint8_t *prev_source, ro_type_source_t src_act_ro)
|
|
|
{
|
|
|
uint8_t i = 0;
|
|
|
|
|
|
flUpdateLog = true;
|
|
|
for(i = 0; i < OUTPUTS_TOTAL_COUNT; i ++){
|
|
|
- // if(get_state_din_outs(DOUT1 + i)){
|
|
|
- if(curr_source[i] != prev_source[i] && (prev_source[i] == src_act_ro || curr_source[i] == src_act_ro)){
|
|
|
- if(state_relay){
|
|
|
+ if(curr_source[i] != prev_source[i] && (prev_source[i] == src_act_ro || curr_source[i] == src_act_ro)){
|
|
|
#ifdef HARDWARE_BT6706
|
|
|
- log_event_data((LOG_DO0_STATE + i), "Разомкнуто");
|
|
|
+ if(curr_source[i] != src_act_ro){
|
|
|
+ SetROInt(0, i);
|
|
|
+ SNMP_SendUserTrap((DO0_TOGGLED+i));
|
|
|
+ log_event_data((LOG_DO0_STATE + i), "Замкнуто");
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ SetROInt(1, i);
|
|
|
+ SNMP_SendUserTrap((DO0_TOGGLED+i));
|
|
|
+ log_event_data((LOG_DO0_STATE + i), "Разомкнуто");
|
|
|
+ }
|
|
|
#elif HARDWARE_BT6702
|
|
|
- if(curr_source[i] != src_act_ro){
|
|
|
- SetROInt(0, i);
|
|
|
- SNMP_SendUserTrap((DO0_TOGGLED+i));
|
|
|
- log_event_data((LOG_DO0_STATE + i), "Разомкнуто");
|
|
|
- }
|
|
|
- else{
|
|
|
- SetROInt(1, i);
|
|
|
- SNMP_SendUserTrap((DO0_TOGGLED+i));
|
|
|
- log_event_data((LOG_DO0_STATE + i), "Замкнуто");
|
|
|
- }
|
|
|
+ if(curr_source[i] != src_act_ro){
|
|
|
+ SetROInt(0, i);
|
|
|
+ SNMP_SendUserTrap((DO0_TOGGLED+i));
|
|
|
+ log_event_data((LOG_DO0_STATE + i), "Разомкнуто");
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ SetROInt(1, i);
|
|
|
+ SNMP_SendUserTrap((DO0_TOGGLED+i));
|
|
|
+ log_event_data((LOG_DO0_STATE + i), "Замкнуто");
|
|
|
+ }
|
|
|
#endif
|
|
|
|
|
|
- }
|
|
|
-/* else{
|
|
|
-#ifdef HARDWARE_BT6706
|
|
|
- log_event_data((LOG_DO0_STATE + i), "Замкнуто");
|
|
|
-#elif HARDWARE_BT6702
|
|
|
- log_event_data((LOG_DO0_STATE + i), "Разомкнуто");
|
|
|
-#endif
|
|
|
- }*/
|
|
|
- }
|
|
|
-// }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -252,9 +250,7 @@ void UPS_CriticalAlarmMonitor(void)
|
|
|
else
|
|
|
{
|
|
|
if(CriticalAlarmCurrent)
|
|
|
- relay_setup_log_change(CurrROtype_Sourse, OldROtype_Sourse, CRITICAL, 1);
|
|
|
- /* else
|
|
|
- relay_setup_log_change(CurrROtype_Sourse, OldROtype_Sourse, CRITICAL, 0);*/
|
|
|
+ relay_setup_log_change(CurrROtype_Sourse, OldROtype_Sourse, CRITICAL);
|
|
|
|
|
|
}
|
|
|
|
|
@@ -307,9 +303,7 @@ void UPS_NonCriticalAlarmMonitor(void)
|
|
|
else
|
|
|
{
|
|
|
if(NonCriticalAlarmCurrent)
|
|
|
- relay_setup_log_change(CurrROtype_Sourse, OldROtype_Sourse, NON_CRITICAL, 1);
|
|
|
- /* else
|
|
|
- relay_setup_log_change(CurrROtype_Sourse, OldROtype_Sourse, NON_CRITICAL, 0);*/
|
|
|
+ relay_setup_log_change(CurrROtype_Sourse, OldROtype_Sourse, NON_CRITICAL);
|
|
|
}
|
|
|
|
|
|
for(i = 0; i < OUTPUTS_TOTAL_COUNT; i ++){
|
|
@@ -393,9 +387,7 @@ void UPS_LineFailMonitor(void)
|
|
|
#ifdef HARDWARE_BT6706
|
|
|
else{
|
|
|
if (lineFailCurrent)
|
|
|
- relay_setup_log_change(CurrROtype_Sourse, OldROtype_Sourse, AC_PRESENT, 1);
|
|
|
- else
|
|
|
- relay_setup_log_change(CurrROtype_Sourse, OldROtype_Sourse, AC_PRESENT, 0);
|
|
|
+ relay_setup_log_change(CurrROtype_Sourse, OldROtype_Sourse, AC_PRESENT);
|
|
|
}
|
|
|
|
|
|
for(i = 0; i < OUTPUTS_TOTAL_COUNT; i ++){
|
|
@@ -447,7 +439,7 @@ void UPS_VACoutputMonitor(void)
|
|
|
flUpdateLog = true;
|
|
|
}
|
|
|
else{
|
|
|
- relay_setup_log_change(CurrROtype_Sourse, OldROtype_Sourse, DC_PRESENT, 1);
|
|
|
+ relay_setup_log_change(CurrROtype_Sourse, OldROtype_Sourse, DC_PRESENT);
|
|
|
}
|
|
|
}
|
|
|
/* Отслеживается нормализация */
|
|
@@ -466,9 +458,6 @@ void UPS_VACoutputMonitor(void)
|
|
|
// SNMP_SendUserTrap(POWER_NORM);
|
|
|
flUpdateLog = true;
|
|
|
}
|
|
|
- else{
|
|
|
- relay_setup_log_change(CurrROtype_Sourse, OldROtype_Sourse, DC_PRESENT, 0);
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
for(i = 0; i < OUTPUTS_TOTAL_COUNT; i ++){
|
|
@@ -547,9 +536,7 @@ void UPS_LowBatMonitor(void)
|
|
|
#ifdef HARDWARE_BT6706
|
|
|
else{
|
|
|
if (lowBatCurrent)
|
|
|
- relay_setup_log_change(CurrROtype_Sourse, OldROtype_Sourse, CHARGE_AKB, 1);
|
|
|
- else
|
|
|
- relay_setup_log_change(CurrROtype_Sourse, OldROtype_Sourse, CHARGE_AKB, 0);
|
|
|
+ relay_setup_log_change(CurrROtype_Sourse, OldROtype_Sourse, CHARGE_AKB);
|
|
|
}
|
|
|
|
|
|
for(i = 0; i < OUTPUTS_TOTAL_COUNT; i ++){
|
|
@@ -767,9 +754,7 @@ void UPS_BatteryConnectMonitor(void)
|
|
|
#ifdef HARDWARE_BT6706
|
|
|
else{
|
|
|
if (AKBconnectCurrent)
|
|
|
- relay_setup_log_change(CurrROtype_Sourse, OldROtype_Sourse, OFF_AKB, 1);
|
|
|
- else
|
|
|
- relay_setup_log_change(CurrROtype_Sourse, OldROtype_Sourse, OFF_AKB, 0);
|
|
|
+ relay_setup_log_change(CurrROtype_Sourse, OldROtype_Sourse, OFF_AKB);
|
|
|
}
|
|
|
|
|
|
for(i = 0; i < OUTPUTS_TOTAL_COUNT; i ++){
|