|
@@ -70,7 +70,9 @@ void UPS_Monitor(void *params)
|
|
|
UPS_BatteryConnectMonitor();
|
|
|
}
|
|
|
UPS_ConnectMonitor();
|
|
|
+#ifndef HARDWARE_BT6708
|
|
|
UPS_DI0Monitor();
|
|
|
+#endif
|
|
|
#ifdef HARDWARE_BT6702
|
|
|
UPS_CriticalAlarmMonitor();
|
|
|
UPS_NonCriticalAlarmMonitor();
|
|
@@ -79,7 +81,7 @@ void UPS_Monitor(void *params)
|
|
|
vTaskDelay(1000);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+#ifndef HARDWARE_BT6708
|
|
|
|
|
|
* @brief Мониторинг бита DI0 state
|
|
|
*/
|
|
@@ -142,7 +144,7 @@ void relay_setup_log(uint8_t *curr_source, ro_type_source_t src_act_ro, uint8_t
|
|
|
SNMP_SendUserTrap((DO0_TOGGLED+i));
|
|
|
if(state_relay){
|
|
|
flUpdateLog = true;
|
|
|
-#if defined HARDWARE_BT6706 || HARDWARE_BT6708
|
|
|
+#if defined HARDWARE_BT6706
|
|
|
log_event_data((LOG_DO0_STATE + i), "Разомкнуто");
|
|
|
#elif HARDWARE_BT6702
|
|
|
log_event_data((LOG_DO0_STATE + i), "Замкнуто");
|
|
@@ -151,7 +153,7 @@ void relay_setup_log(uint8_t *curr_source, ro_type_source_t src_act_ro, uint8_t
|
|
|
}
|
|
|
else{
|
|
|
flUpdateLog = true;
|
|
|
-#if defined HARDWARE_BT6706 || HARDWARE_BT6708
|
|
|
+#if defined HARDWARE_BT6706
|
|
|
log_event_data((LOG_DO0_STATE + i), "Замкнуто");
|
|
|
#elif HARDWARE_BT6702
|
|
|
log_event_data((LOG_DO0_STATE + i), "Разомкнуто");
|
|
@@ -161,13 +163,14 @@ 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 i = 0;
|
|
|
|
|
|
for(i = 0; i < OUTPUTS_TOTAL_COUNT; i ++){
|
|
|
if(curr_source[i] != prev_source[i] && (prev_source[i] == src_act_ro || curr_source[i] == src_act_ro)){
|
|
|
-#if defined HARDWARE_BT6706 || HARDWARE_BT6708
|
|
|
+#if defined HARDWARE_BT6706
|
|
|
if(curr_source[i] != src_act_ro){
|
|
|
flUpdateLog = true;
|
|
|
SetROInt(0, i);
|
|
@@ -198,6 +201,8 @@ void relay_setup_log_change(uint8_t *curr_source, uint8_t *prev_source, ro_type_
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+#endif
|
|
|
+
|
|
|
|
|
|
#ifdef HARDWARE_BT6702
|
|
|
|
|
@@ -348,7 +353,7 @@ void UPS_LineFailMonitor(void)
|
|
|
static uint8_t lineFailOldState = 0;
|
|
|
uint8_t lineFailCurrent;
|
|
|
|
|
|
-#if defined HARDWARE_BT6706 || HARDWARE_BT6708
|
|
|
+#if defined HARDWARE_BT6706
|
|
|
uint8_t i = 0;
|
|
|
static uint8_t OldROtype_Sourse[OUTPUTS_TOTAL_COUNT] = {0};
|
|
|
uint8_t CurrROtype_Sourse[OUTPUTS_TOTAL_COUNT] = {0};
|
|
@@ -367,12 +372,12 @@ void UPS_LineFailMonitor(void)
|
|
|
log_event_data(LOG_ALARM_LINE, "Авария");
|
|
|
SNMP_SendUserTrap(LINE_ALARM);
|
|
|
flUpdateLog = true;
|
|
|
-#if defined HARDWARE_BT6706 || HARDWARE_BT6708
|
|
|
+#if defined HARDWARE_BT6706
|
|
|
relay_setup_log(CurrROtype_Sourse, AC_PRESENT, 1);
|
|
|
#endif
|
|
|
}
|
|
|
else{
|
|
|
-#if defined HARDWARE_BT6706 || HARDWARE_BT6708
|
|
|
+#if defined HARDWARE_BT6706
|
|
|
relay_setup_log(CurrROtype_Sourse, AC_PRESENT, 0);
|
|
|
#endif
|
|
|
log_event_data(LOG_ALARM_LINE, "Норма");
|
|
@@ -391,7 +396,7 @@ void UPS_LineFailMonitor(void)
|
|
|
if (lineFailCurrent != lineFailOldState)
|
|
|
{
|
|
|
if (lineFailCurrent){
|
|
|
-#if defined HARDWARE_BT6706 || HARDWARE_BT6708
|
|
|
+#if defined HARDWARE_BT6706
|
|
|
relay_setup_log(CurrROtype_Sourse, AC_PRESENT, 1);
|
|
|
#endif
|
|
|
|
|
@@ -400,7 +405,7 @@ void UPS_LineFailMonitor(void)
|
|
|
flUpdateLog = true;
|
|
|
}
|
|
|
else{
|
|
|
-#if defined HARDWARE_BT6706 || HARDWARE_BT6708
|
|
|
+#if defined HARDWARE_BT6706
|
|
|
relay_setup_log(CurrROtype_Sourse, AC_PRESENT, 0);
|
|
|
#endif
|
|
|
log_event_data(LOG_ALARM_LINE, "Норма");
|
|
@@ -409,7 +414,7 @@ void UPS_LineFailMonitor(void)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-#if defined HARDWARE_BT6706 || HARDWARE_BT6708
|
|
|
+#if defined HARDWARE_BT6706
|
|
|
else{
|
|
|
if (lineFailCurrent)
|
|
|
relay_setup_log_change(CurrROtype_Sourse, OldROtype_Sourse, AC_PRESENT);
|
|
@@ -432,7 +437,7 @@ void UPS_VACoutputMonitor(void)
|
|
|
|
|
|
static uint8_t stateCurrentVACoutput = HYST_IDLE;
|
|
|
uint8_t VACoutputCurrent;
|
|
|
-
|
|
|
+#if defined HARDWARE_BT6706
|
|
|
uint8_t i = 0;
|
|
|
static bool isValueRecv = false;
|
|
|
static uint8_t OldROtype_Sourse[OUTPUTS_TOTAL_COUNT] = {0};
|
|
@@ -443,7 +448,7 @@ void UPS_VACoutputMonitor(void)
|
|
|
if(!isValueRecv)
|
|
|
OldROtype_Sourse[i] = CurrROtype_Sourse[i];
|
|
|
}
|
|
|
-
|
|
|
+#endif
|
|
|
|
|
|
VACoutputCurrent = UPS.VAC_out;
|
|
|
|
|
@@ -455,16 +460,18 @@ void UPS_VACoutputMonitor(void)
|
|
|
LED_On(LED_MINOR_R);
|
|
|
LED_On(LED_MINOR_G);
|
|
|
stateCurrentVACoutput = HYST_UP;
|
|
|
-
|
|
|
+#if defined HARDWARE_BT6706
|
|
|
relay_setup_log(CurrROtype_Sourse, DC_PRESENT, 1);
|
|
|
-
|
|
|
+#endif
|
|
|
log_event_data(LOG_ALARM_VAC_OUTPUT, "Авария");
|
|
|
|
|
|
|
|
|
flUpdateLog = true;
|
|
|
}
|
|
|
else{
|
|
|
+#if defined HARDWARE_BT6706
|
|
|
relay_setup_log_change(CurrROtype_Sourse, OldROtype_Sourse, DC_PRESENT);
|
|
|
+#endif
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -475,19 +482,20 @@ void UPS_VACoutputMonitor(void)
|
|
|
LED_Off(LED_MINOR_R);
|
|
|
LED_Off(LED_MINOR_G);
|
|
|
stateCurrentVACoutput = HYST_IDLE;
|
|
|
-
|
|
|
+#if defined HARDWARE_BT6706
|
|
|
relay_setup_log(CurrROtype_Sourse, DC_PRESENT, 0);
|
|
|
-
|
|
|
+#endif
|
|
|
log_event_data(LOG_ALARM_VAC_OUTPUT, "Норма");
|
|
|
|
|
|
|
|
|
flUpdateLog = true;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+#if defined HARDWARE_BT6706
|
|
|
for(i = 0; i < OUTPUTS_TOTAL_COUNT; i ++){
|
|
|
OldROtype_Sourse[i] = CurrROtype_Sourse[i];
|
|
|
}
|
|
|
+#endif
|
|
|
}
|
|
|
|
|
|
#endif
|
|
@@ -502,7 +510,7 @@ void UPS_LowBatMonitor(void)
|
|
|
static bool flag_alarm_time = false;
|
|
|
uint8_t lowBatCurrent;
|
|
|
|
|
|
-#if defined HARDWARE_BT6706 || HARDWARE_BT6708
|
|
|
+#if defined HARDWARE_BT6706
|
|
|
uint8_t i = 0;
|
|
|
static uint8_t OldROtype_Sourse[OUTPUTS_TOTAL_COUNT] = {0};
|
|
|
uint8_t CurrROtype_Sourse[OUTPUTS_TOTAL_COUNT] = {0};
|
|
@@ -523,7 +531,7 @@ void UPS_LowBatMonitor(void)
|
|
|
log_event_data(LOG_ALARM_LOW_BAT, "Авария");
|
|
|
SNMP_SendUserTrap(LOW_BAT_ALARM);
|
|
|
flUpdateLog = true;
|
|
|
-#if defined HARDWARE_BT6706 || HARDWARE_BT6708
|
|
|
+#if defined HARDWARE_BT6706
|
|
|
relay_setup_log(CurrROtype_Sourse, CHARGE_AKB, 1);
|
|
|
#endif
|
|
|
}
|
|
@@ -531,7 +539,7 @@ void UPS_LowBatMonitor(void)
|
|
|
SNMP_SendUserTrap(LOW_BAT_NORM);
|
|
|
log_event_data(LOG_ALARM_LOW_BAT, "Норма");
|
|
|
flUpdateLog = true;
|
|
|
-#if defined HARDWARE_BT6706 || HARDWARE_BT6708
|
|
|
+#if defined HARDWARE_BT6706
|
|
|
relay_setup_log(CurrROtype_Sourse, CHARGE_AKB, 0);
|
|
|
#endif
|
|
|
}
|
|
@@ -554,7 +562,7 @@ void UPS_LowBatMonitor(void)
|
|
|
SNMP_SendUserTrap(LOW_BAT_NORM);
|
|
|
log_event_data(LOG_ALARM_LOW_BAT, "Норма");
|
|
|
flUpdateLog = true;
|
|
|
-#if defined HARDWARE_BT6706 || HARDWARE_BT6708
|
|
|
+#if defined HARDWARE_BT6706
|
|
|
relay_setup_log(CurrROtype_Sourse, CHARGE_AKB, 0);
|
|
|
#endif
|
|
|
}
|
|
@@ -563,7 +571,7 @@ void UPS_LowBatMonitor(void)
|
|
|
flag_alarm_time = true;
|
|
|
}
|
|
|
}
|
|
|
-#if defined HARDWARE_BT6706 || HARDWARE_BT6708
|
|
|
+#if defined HARDWARE_BT6706
|
|
|
else{
|
|
|
flag_alarm_time = false;
|
|
|
if (lowBatCurrent)
|
|
@@ -733,7 +741,7 @@ void UPS_BatteryConnectMonitor(void)
|
|
|
static uint8_t AKBconnectOldState = 0;
|
|
|
uint8_t AKBconnectCurrent;
|
|
|
|
|
|
-#if defined HARDWARE_BT6706 || HARDWARE_BT6708
|
|
|
+#if defined HARDWARE_BT6706
|
|
|
uint8_t i = 0;
|
|
|
static uint8_t OldROtype_Sourse[OUTPUTS_TOTAL_COUNT] = {0};
|
|
|
uint8_t CurrROtype_Sourse[OUTPUTS_TOTAL_COUNT] = {0};
|
|
@@ -757,7 +765,7 @@ void UPS_BatteryConnectMonitor(void)
|
|
|
log_event_data(LOG_ALARM_AKB, "Авария");
|
|
|
SNMP_SendUserTrap(BATTERY_CONNECT_ALARM);
|
|
|
flUpdateLog = true;
|
|
|
-#if defined HARDWARE_BT6706 || HARDWARE_BT6708
|
|
|
+#if defined HARDWARE_BT6706
|
|
|
relay_setup_log(CurrROtype_Sourse, OFF_AKB, 1);
|
|
|
#endif
|
|
|
}
|
|
@@ -765,7 +773,7 @@ void UPS_BatteryConnectMonitor(void)
|
|
|
log_event_data(LOG_ALARM_AKB, "Норма");
|
|
|
SNMP_SendUserTrap(BATTERY_CONNECT_NORM);
|
|
|
flUpdateLog = true;
|
|
|
-#if defined HARDWARE_BT6706 || HARDWARE_BT6708
|
|
|
+#if defined HARDWARE_BT6706
|
|
|
relay_setup_log(CurrROtype_Sourse, OFF_AKB, 0);
|
|
|
#endif
|
|
|
}
|
|
@@ -780,7 +788,7 @@ void UPS_BatteryConnectMonitor(void)
|
|
|
log_event_data(LOG_ALARM_AKB, "Норма");
|
|
|
SNMP_SendUserTrap(BATTERY_CONNECT_NORM);
|
|
|
flUpdateLog = true;
|
|
|
-#if defined HARDWARE_BT6706 || HARDWARE_BT6708
|
|
|
+#if defined HARDWARE_BT6706
|
|
|
relay_setup_log(CurrROtype_Sourse, OFF_AKB, 0);
|
|
|
#endif
|
|
|
}
|
|
@@ -788,7 +796,7 @@ void UPS_BatteryConnectMonitor(void)
|
|
|
log_event_data(LOG_ALARM_AKB, "Авария");
|
|
|
SNMP_SendUserTrap(BATTERY_CONNECT_ALARM);
|
|
|
flUpdateLog = true;
|
|
|
-#if defined HARDWARE_BT6706 || HARDWARE_BT6708
|
|
|
+#if defined HARDWARE_BT6706
|
|
|
relay_setup_log(CurrROtype_Sourse, OFF_AKB, 1);
|
|
|
#endif
|
|
|
}
|
|
@@ -797,7 +805,7 @@ void UPS_BatteryConnectMonitor(void)
|
|
|
flag_alarm_time = true;
|
|
|
}
|
|
|
}
|
|
|
-#if defined HARDWARE_BT6706 || HARDWARE_BT6708
|
|
|
+#if defined HARDWARE_BT6706
|
|
|
else{
|
|
|
flag_alarm_time = false;
|
|
|
if (AKBconnectCurrent)
|