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:
parent
38e4982aac
commit
5618f52a0e
1 changed files with 10 additions and 0 deletions
10
src/main.cpp
10
src/main.cpp
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue