Browse Source

change alarm mask (add low temperature)

balbekova 6 years ago
parent
commit
675043c264
1 changed files with 9 additions and 9 deletions
  1. 9 9
      modules/monitor/ups_monitor.c

+ 9 - 9
modules/monitor/ups_monitor.c

@@ -86,7 +86,7 @@ void UPS_DI0Monitor(void)
 
   DI0StateCurrent = get_state_din_outs(DIN1) ^ sSettings.sInOuts.din_type_act[0];
 
-  UPS.Alarm = (UPS.Alarm & 0x0f) | (DI0StateCurrent << 4);
+  UPS.Alarm = (UPS.Alarm & 0xef) | (DI0StateCurrent << 4);
 
   	if (!isValueRecv) {
 	  isValueRecv = true;
@@ -672,7 +672,7 @@ void UPS_PowerMonitor(void)
   if (load > sSettings.sAlarmManager.load_range.high)
   {
 	flCriticalAlarm = true;
-	UPS.Alarm = (UPS.Alarm & 0x0e) | (1 << 0);
+	UPS.Alarm = (UPS.Alarm & 0xfe) | (1 << 0);
     if (stateCurrent == HYST_IDLE)
 	{
       LED_On(LED_MINOR_R);
@@ -688,7 +688,7 @@ void UPS_PowerMonitor(void)
   /* Отслеживается нормализация */
   else if (load < (sSettings.sAlarmManager.load_range.high - sSettings.sAlarmManager.load_range.hyst))
   {
-	UPS.Alarm = (UPS.Alarm & 0x0e);
+	UPS.Alarm = (UPS.Alarm & 0xfe);
     if (stateCurrent == HYST_UP)
 	{
     	LED_Off(LED_MINOR_R);
@@ -717,7 +717,7 @@ void UPS_TemperatureHighRangeMonitor(void)
   if (temperature > sSettings.sAlarmManager.Temprature_range.high)
   {
 	flCriticalAlarm = true;
-	UPS.Alarm = (UPS.Alarm & 0x0d) | (1 << 1);
+	UPS.Alarm = (UPS.Alarm & 0xfd) | (1 << 1);
     if (stateCurrent == HYST_IDLE)
 	{
 	  stateCurrent = HYST_UP;
@@ -732,7 +732,7 @@ void UPS_TemperatureHighRangeMonitor(void)
   /* Отслеживается нормализация */
   else if (temperature < (sSettings.sAlarmManager.Temprature_range.high - sSettings.sAlarmManager.Temprature_range.hyst))
   {
-	  UPS.Alarm = (UPS.Alarm & 0x0d);
+	  UPS.Alarm = (UPS.Alarm & 0xfd);
     if (stateCurrent == HYST_UP)
 	{
 	  stateCurrent = HYST_IDLE;
@@ -759,7 +759,7 @@ void UPS_TemperatureLowRangeMonitor(void)
   if (temperature < sSettings.sAlarmManager.Temprature_range.low)
   {
 	flCriticalAlarm = true;
-	UPS.Alarm = (UPS.Alarm & 0x0d) | (1 << 1);
+	UPS.Alarm = (UPS.Alarm & 0xdf) | (1 << 5);
     if (stateCurrent == HYST_IDLE)
 	{
 	  stateCurrent = HYST_DOWN;
@@ -774,7 +774,7 @@ void UPS_TemperatureLowRangeMonitor(void)
   /* Отслеживается нормализация */
   else if (temperature > (sSettings.sAlarmManager.Temprature_range.low + sSettings.sAlarmManager.Temprature_range.hyst))
   {
-	  UPS.Alarm = (UPS.Alarm & 0x0d);
+	  UPS.Alarm = (UPS.Alarm & 0xdf);
     if (stateCurrent == HYST_DOWN)
 	{
 	  stateCurrent = HYST_IDLE;
@@ -798,7 +798,7 @@ void UPS_ConnectMonitor(void)
   
   connectCurrent = UPS.Present;
   
-  UPS.Alarm = (UPS.Alarm & 0x0b) | ((connectCurrent^1) << 2);
+  UPS.Alarm = (UPS.Alarm & 0xfb) | ((connectCurrent^1) << 2);
 
   if (!isValueRecv) {
     isValueRecv = true;
@@ -860,7 +860,7 @@ void UPS_BatteryConnectMonitor(void)
 	  AKBconnectCurrent = 0;
   }
 
-  UPS.Alarm = (UPS.Alarm & 0x07) | (AKBconnectCurrent << 3);
+  UPS.Alarm = (UPS.Alarm & 0xf7) | (AKBconnectCurrent << 3);
 
   if (!isValueRecv) {
     isValueRecv = true;