mirror of
https://github.com/sweidac/kidsbox.git
synced 2025-07-28 03:41:54 +02:00
Adds play/pause by tag support.
This commit is contained in:
@@ -23,17 +23,20 @@ RFIDInterface::RFIDInterface() {
|
||||
.mosi_io = 13,
|
||||
.sck_io = 23,
|
||||
.sda_io = 18,
|
||||
.callback = [](uint8_t* sn) { // serial number is always 5 bytes long
|
||||
ESP_LOGI(TAG, "Tag: %#x %#x %#x %#x %#x",
|
||||
sn[0], sn[1], sn[2], sn[3], sn[4]
|
||||
);
|
||||
.callback = [](uint8_t* sn) {
|
||||
if (sn == NULL) {
|
||||
ESP_LOGI(TAG, "Tag removed");
|
||||
|
||||
sprintf(lastTagId, "%#x_%#x_%#x_%#x_%#x", sn[0], sn[1], sn[2], sn[3], sn[4]);
|
||||
if (callback) {
|
||||
callback(NULL);
|
||||
}
|
||||
} else { // serial number is always 5 bytes long
|
||||
sprintf(lastTagId, "%#x_%#x_%#x_%#x_%#x", sn[0], sn[1], sn[2], sn[3], sn[4]);
|
||||
ESP_LOGI(TAG, "tag id: %s", lastTagId);
|
||||
|
||||
ESP_LOGI(TAG, "sprintf tag id: %s", lastTagId);
|
||||
|
||||
if (callback) {
|
||||
callback(getLastTagId());
|
||||
if (callback) {
|
||||
callback(getLastTagId());
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user