Added CLEAR client command support
This commit is contained in:
parent
27310df527
commit
7c3ef92a18
|
@ -1,7 +1,6 @@
|
|||
#include "M5Core2.h"
|
||||
#include <M5GFX.h>
|
||||
#include "M5_LoRaWAN.h"
|
||||
#include "freertos/queue.h"
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include "Ubuntu_24px.h"
|
||||
|
@ -173,11 +172,15 @@ void receiveMsg() {
|
|||
if(recvMsg.length() != 0 && recvMsg.substring(0, 8) == "OK+RECV:") {
|
||||
String decodedMsg = decodeMsg(split(recvMsg, ',', 3));
|
||||
Serial.println(decodedMsg);
|
||||
if(decodedMsg.substring(0,5) == "CLEAR") {
|
||||
memset(departures, 0, sizeof(departures));
|
||||
departureIndex = 0;
|
||||
} else
|
||||
if(decodedMsg.substring(0,5) == "TIME|") {
|
||||
unixtime = (decodedMsg.substring(5,30).toInt()) - last_update*6;
|
||||
Serial.println(unixtime);
|
||||
} else {
|
||||
addDeparture(decodedMsg);
|
||||
}
|
||||
addDeparture(decodedMsg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -273,7 +276,6 @@ void displayDepartures(int lines) {
|
|||
departures[i].departure -= 1;
|
||||
if(displayedIndex < lines) {
|
||||
String lineLastStop = departures[i].line + departures[i].last_stop;
|
||||
// TODO: Not sure if 999 wouldn't be displayed as 100
|
||||
if(!stringInArray(lineLastStop, displayed, displayedIndex) && departures[i].departure < 999) {
|
||||
displayed[displayedIndex] = lineLastStop;
|
||||
displayDeparture(departures[i], displayedIndex);
|
||||
|
|
Loading…
Reference in a new issue