|
@@ -33,7 +33,8 @@
|
|
|
#include "wifi.h"
|
|
#include "wifi.h"
|
|
|
#include <sys/msg.h>
|
|
#include <sys/msg.h>
|
|
|
#include "stdlib.h"
|
|
#include "stdlib.h"
|
|
|
-
|
|
|
|
|
|
|
+#include "led.h"
|
|
|
|
|
+#include "beep.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
static void* power_thread(void* arg)
|
|
static void* power_thread(void* arg)
|
|
@@ -1565,6 +1566,7 @@ static void* breaker_thread(void *arg)
|
|
|
GlobalBreakerManager *temp = NULL;
|
|
GlobalBreakerManager *temp = NULL;
|
|
|
uint16_t value = 0;
|
|
uint16_t value = 0;
|
|
|
breaker_scanner_t* breaker_scann = get_breaker_scanner();
|
|
breaker_scanner_t* breaker_scann = get_breaker_scanner();
|
|
|
|
|
+ uint32_t pre_breaker_status;
|
|
|
|
|
|
|
|
while (h->quit==0)
|
|
while (h->quit==0)
|
|
|
{
|
|
{
|
|
@@ -1574,7 +1576,7 @@ static void* breaker_thread(void *arg)
|
|
|
if(h->quit) {
|
|
if(h->quit) {
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ pre_breaker_status=temp->breaker_status ;
|
|
|
// if(temp->breaker_gather_addr != 0)
|
|
// if(temp->breaker_gather_addr != 0)
|
|
|
// {
|
|
// {
|
|
|
// value = 0;
|
|
// value = 0;
|
|
@@ -1711,6 +1713,25 @@ static void* breaker_thread(void *arg)
|
|
|
{
|
|
{
|
|
|
hlw8110_read_Status(NULL,(int*)(&temp->breaker_status));
|
|
hlw8110_read_Status(NULL,(int*)(&temp->breaker_status));
|
|
|
}
|
|
}
|
|
|
|
|
+#ifdef USE_BREAKER_ALARM
|
|
|
|
|
+ if (pre_breaker_status && !temp->breaker_status)
|
|
|
|
|
+ {
|
|
|
|
|
+ time_t now;
|
|
|
|
|
+ time(&now);
|
|
|
|
|
+ struct tm *t;
|
|
|
|
|
+ t = localtime(&now);
|
|
|
|
|
+
|
|
|
|
|
+ char buffer[80];
|
|
|
|
|
+ strftime(buffer, sizeof(buffer), "%Y-%m-%d %H:%M:%S", t);
|
|
|
|
|
+ char AlarmText[256];
|
|
|
|
|
+ snprintf(AlarmText, sizeof(AlarmText), "断路器 %d 断开", temp->breaker_id);
|
|
|
|
|
+ log_i(AlarmText);
|
|
|
|
|
+
|
|
|
|
|
+ int nAlarmID = dev_insert_alarm_info(_globalDeviceManager->db, temp->product_id, 0, buffer, AlarmText);
|
|
|
|
|
+
|
|
|
|
|
+ set_led_beep(LED_MODE_WARN2, BEEP_MODE_WARN2);
|
|
|
|
|
+ }
|
|
|
|
|
+#endif
|
|
|
}
|
|
}
|
|
|
lock_s_release(LOCK_ID_BREAKER);
|
|
lock_s_release(LOCK_ID_BREAKER);
|
|
|
sleep(1);
|
|
sleep(1);
|