1
0
Fork 0
Commit graph

21 commits

Author SHA1 Message Date
ec5d0d2d66 RFID: Change the checkTag fail return
Previously, checkTag() returned 0 when it failed or when there was no changes.
This is fine if we are only expecting already programmed tags, but as tags
arrive new with blocks zeroed out, which conflicts with the 0 return value.

Introduce a new constant to RFID for the return error, -1, and use it
instead of 0 everywhere.
Update comments and README to highlight this new reserved ID.
2024-03-07 23:05:14 +00:00
7964b47174 Com: Append new line when flusing serial
Our HID implementation sends fixed-length reports, that will be parsed
by the receiving software.
Serial outputs are more geared towards debugging, thus splitting the
messages sent is much more usable.
2024-03-07 21:49:14 +00:00
7253964027 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
46f0e7cf6c 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
4f33a98271 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.
2024-01-06 00:40:27 +00:00
f2dbfd3b37 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
25b2048281 Com: Implement tag programming
Define the protocol allowing the software to track tags
and program them, in the README.

The data structure is shared between a programming command and an
information message, so create a new struct for it and an array
to keep track of it and expose to the rest of the program.
The goal is to keep the protocol core and message construction
entirely inside Com, so this intermediary buffer allows exposing
it outside while hiding the protocol details.

This means that we are starting to receive data from the software,
so implement generic functions to check and receive data as well
as receiveMessage() which parses the message and handles them.
2024-01-06 00:32:19 +00:00
7a706a7637 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
85e3295f40 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
49a57cadc7 Only play effects on arrival, use real tag
Remove the overide of the tag value used for testing.
We don't plan yet on playing effects when a tag leaves, so avoid
playing the effects twice and only do so when arriving.
2023-12-17 21:53:36 +00:00
3b27d9a9ff IDs: Mystery lifted, Loup-Garou !
Update the promo names array with the newest year name.
2023-11-10 17:50:13 +00:00
224bc7a6d5 Speaker: Introduce audio playback
Introduce the Speaker class to play audio from the SD card when detecting
tags.
The only audio supported is WAV.

Audio playback is handled via interrupts, so it might try to read from the
SD card at the same time as the LCD class is trying to read new frames.
Update the LCD animation code to temporarily disable audio interrupts while
reading from the SD card.
2023-10-22 21:19:29 +01:00
b0753ada9f Com: Make the comment length explicit
sendComment cannot send more than 62 bytes, as limited by the HID report.
Sending more is prevented by vsnprintf, but change the function signature
to make it explicit that the array passed to it should be at most 62 bytes.
2023-10-22 21:16:49 +01:00
005f4e1bea LCD: Introduce LCD display and animations
Add support for the LCD and using it for displaying animations.
Animations are automatically played if available for the ID of the
detected tag.

The code should support adding other kind of animations, for tags being
removed or for other UI interactions for example.
2023-10-21 22:01:10 +01:00
7d3d109a3a 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
01496016bd RFID: Update comment refering to -ID
When a tag leaves, we don't negate the ID which would be
implied by writing -ID.
Clarify that we set the sign bit instead.
2023-10-16 22:16:47 +01:00
06d157a5b4 Com: Implement proper communications
Implement a set of functions to create messages following the protocols
defined in the README for communication.
Handle HID, which is used to communicate with the interactive application.

Update README with details on the message structures.
2023-09-24 18:04:27 +01:00
821814e7f6 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
cac66b15b2 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
efdb7807a4 Main structure and setup
pinMode most of what could be useful in the main and put modules
LOW to minimize power draw before the regulator is ON.

Add the skeleton for the setup, main loop and battery level checking.
2023-09-09 19:46:10 +01:00
2c296eff16 Init project
Add LICENSE and README
Basic platformio project structure with required libs
2023-09-09 18:01:24 +01:00