Oh..
#define RTS 9
unsigned long cmillis, lastread, nextscan, roundrobintimer = 0;
setup partially:
// Setup serial output
Serial.begin(115200);
// Setup rs485
digitalWrite(RTS, LOW);
pinMode(RTS, OUTPUT);
digitalWrite(RTS, LOW);
Serial1.begin(115200);
Serial1.flush();
setupCommands();
setupGraphics();
drawWindow();
drawScreen();
nextscan = millis() + 2000;
lastread = millis();
loop:
void loop() {
cmillis = millis();
// if ( lastread != cmillis ) {
while ( Serial1.available() != 0 )
COM.receive(Serial1.read());
// lastread = millis();
// }
if (( roundrobintimer != 0 ) && ( cmillis < roundrobintimer )) roundrobintimer = 0;
if (( infoRoundRobin != 0 ) && ( cmillis < infoRoundRobin )) infoRoundRobin = 0;
if (( infoRoundRobin == 0 ) && ( infoTimer != 0 ) && ( cmillis > infoTimer )) {
drawBottomBar();
infoTimer = 0;
}
if (( roundrobintimer == 0 ) && ( cmillis > nextscan )) {
if (!loginInProgress) readFingerPrint();
roundrobintimer = nextscan;
nextscan = cmillis + 700;
roundrobintimer = nextscan > roundrobintimer ? 0 : roundrobintimer;
}
}