Ver Fonte

小电流短路过滤小于1s间隔的事件

Signed-off-by: huhui <huhui@sharkgulf.com>
huhui há 4 anos atrás
pai
commit
a613a378e7
1 ficheiros alterados com 9 adições e 0 exclusões
  1. 9 0
      Application/app/event_record.c

+ 9 - 0
Application/app/event_record.c

@@ -10,6 +10,15 @@ static int event_w_idx = 0;
 static bool _event_full = false;
 
 void push_event(event_id_t id, s32 data) {
+	if (id == Aux_Current_Short) {//when multi aux short, only recode the old
+		for (int i = 0; i < MAX_EVENT_SIZE; i++) {
+			if (_event[i].id == Aux_Current_Short) {
+				if (shark_get_seconds() - _event[i].timestamp <= 1) {
+					return;
+				}
+			}
+		}
+	}
 	event_record_t *pevent = &_event[event_w_idx];
 	event_w_idx = (event_w_idx + 1) % MAX_EVENT_SIZE;
 	if (event_w_idx == 0) {