Added comments & filtered out >99 min
This commit is contained in:
parent
8fba6818ca
commit
5cd0fa2906
|
@ -116,7 +116,7 @@ struct departure {
|
|||
|
||||
// Global departure list
|
||||
|
||||
struct departure departures[20];
|
||||
struct departure departures[50];
|
||||
int departureIndex = 0;
|
||||
|
||||
// Departure functions
|
||||
|
@ -173,12 +173,13 @@ void addDeparture(String s) {
|
|||
}
|
||||
|
||||
void displayDepartures(int lines) {
|
||||
String displayed[20];
|
||||
String displayed[50];
|
||||
int displayedIndex = 0;
|
||||
for(int i=0; i < departureIndex && displayedIndex < lines; i++) {
|
||||
String lineLastStop = departures[i].line + departures[i].last_stop;
|
||||
departures[i].departure -= 1;
|
||||
if(!stringInArray(lineLastStop, displayed, displayedIndex)) {
|
||||
// TODO: Not sure if 999 wouldn't be displayed as 100
|
||||
if(!stringInArray(lineLastStop, displayed, displayedIndex) && departures[i].departure < 999) {
|
||||
displayed[displayedIndex] = lineLastStop;
|
||||
M5.Lcd.fillRect(0, displayedIndex*30, 320, 30, BLACK);
|
||||
displayDeparture(departures[i], displayedIndex);
|
||||
|
@ -204,9 +205,10 @@ void loop() {
|
|||
addDeparture(decodedMsg);
|
||||
}
|
||||
seconds = time(NULL);
|
||||
// TODO: Not sure if time is ticking correctly (check by adding real date & time and keep it running)
|
||||
if(seconds / 6 > last_update) {
|
||||
last_update++;
|
||||
int lines = 8;
|
||||
int lines = 7;
|
||||
displayDepartures(lines);
|
||||
M5.Lcd.drawString(String(last_update), 0, lines*30);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue