ID of album to play now comes from a file ids.txt within the folder. This is as of yet untested.

This commit is contained in:
2019-11-12 19:29:55 +01:00
parent 903cb3f020
commit 35f9ed8177
3 changed files with 81 additions and 13 deletions

View File

@ -64,9 +64,14 @@ void Controller::_check_rfid() {
if (uid > 0) {
_mqtt_client->publish_rfid_uid(uid);
_no_rfid_card_count = 0;
INFO("New RFID card uid: %08x\n", uid);
String s_uid = String(uid, HEX);
_player->play_album(s_uid);
String temp = String(uid, HEX);
String s_uid = "";
for (int i=0; i<(8-s_uid.length()); i++) {
s_uid.concat("0");
}
s_uid.concat(temp);
INFO("New RFID card uid: %s\n", s_uid.c_str());
_player->play_id(s_uid);
} else {
if (_no_rfid_card_count >= 1) {
INFO("No more RFID card.\n");
@ -105,7 +110,7 @@ void Controller::_execute_serial_command(String cmd) {
} else if (cmd.equals("play")) {
_player->play_random_album();
} else if (cmd.startsWith("play ")) {
_player->play_album(cmd.substring(5));
_player->play_id(cmd.substring(5));
} else if (cmd.startsWith("sys ")) {
_player->play_system_sound(cmd.substring(4));
} else if (cmd.equals("stop")) {