1
0
Fork 0
Commit graph

8 commits

Author SHA1 Message Date
d38b534bbe RFID: Track ID changes
We keep track of the detected tag UUIDs and their figurine ID, but
we don't update it when a programming request succeeds.
Search through the tracked tags for the programmed UUID and update
the stored ID when the change suceeds.
2024-03-05 23:56:00 +00:00
c92c8ce11f RFID: Fix buffer size for writes
The RFID library expects a 16 bytes buffer for writing blocks.
However, we re-use the 18 bytes buffer needed for reading blocks.
Properly remove those two extra bytes when writing blocks.
2024-03-05 23:54:24 +00:00
38e4982aac RFID: Implement tag programming
The software needs tag data to be able to send programming requests, so
go through the active tags and extract the data in the new Com structs.

programTag() handles tag wakeup and selection, so might fail if the
requested tag is on another reader. This allows chaining them together
and not keeping track of which tag which reader sees.

Add an assert in case the communication buffer would get too small to
send all active tags as the protocol does not define a multi-message
response.
2024-01-06 00:36:19 +00:00
324cf50653 RFID: Implement writing to blocks
In order to set the ID to the tag, we need to be able to write blocks.
Implement writeBlock() similarly to readBlock() to allow that.

Make sure to clean the communication buffer and handle failure states,
this will become more important for dual RFID readers as will allow
'chaining' calls and cover both readers without keeping track of
what reader sees what tag.

Only allow to write a byte for now, we don't need more.
2024-01-06 00:25:46 +00:00
73ceeb493c RFID: Clean up and generalize
Add a constant for the ID block used and replace it.

Clean up some comments and clarify expectations.

readBlock() did not properly halt tags after errors and the else
clause was superfluous. Properly handle error status.

Move currentActiveTags to be static and initialize it.
This allows for keeping track of max/current tags accross multiple instances.
2024-01-06 00:15:48 +00:00
6c5a670366 IDs: Introduce ID handling functions and data
IDs will be needed by multiple subsystems, so introduce the needed
variables and handling functions.
2023-10-21 18:23:43 +01:00
8d80dd2604 RFID: Fix tag return when gone
Previously, the return value when a tag was gone was the negative ID.
However, this isn't the most effective to process later as a negative
number uses two's complement, changing all lower bits in addition
to the sign bit.

Change this to just set the sign bit instead. This still produces
a negative number, which is what we want to check to konw if the tag
is new or went away, but maintains the lower bits so the ID can be
retrieved with a simple bit-wise and.
2023-09-24 12:31:01 +01:00
ec2c71b0be RFID: functional tag reading
Add a new class to handle the RFID module and associated data
in order to track active tags.
Update main with RFID initialization and a minimal usage to
check it is working as expected.
2023-09-10 20:28:27 +01:00