1
0
Fork 0

main: Add message handling

We want to check for new messages at the end of the loop, when all
other events should have happenned.
Handle the two supported messages there : tag info request and tag
programming command.

The timing might need some testing, hopefully it is short enough.
This commit is contained in:
Teo-CD 2024-01-06 00:40:27 +00:00
parent 38e4982aac
commit 5618f52a0e

View file

@ -77,6 +77,16 @@ __attribute__((noreturn)) int main() {
} }
} }
Com::ReceivedMessage message = Com::receiveMessage();
if (message == Com::TAG_INFO_REQUEST) {
uint8_t tagCount = rfid.gatherTagInfo(Com::getTagRecords());
Com::sendTagInfo(tagCount);
} else if (message == Com::TAG_PROGRAMMING) {
if (!rfid.programTag(Com::getTagRecords())) {
Com::sendComment("Tag programming failed.");
}
}
/* TODO: Drop delay, WFE+timer interrupt(s) ? */ /* TODO: Drop delay, WFE+timer interrupt(s) ? */
delay(25); delay(25);
} }