Added sleep mode for VS1053, HTTP server, tar upload, JSON status, RFID card removal debouncing, ...

This commit is contained in:
2019-08-12 20:15:00 +02:00
parent cd4251df86
commit 651a4e8510
8 changed files with 286 additions and 13 deletions

View File

@ -53,12 +53,18 @@ void Controller::_check_rfid() {
uint32_t uid = _get_rfid_card_uid();
if (uid != _last_rfid_card_uid) {
if (uid > 0) {
_no_rfid_card_count = 0;
INFO("New RFID card uid: %08x\n", uid);
String s_uid = String(uid, HEX);
_player->play_album(s_uid);
} else {
INFO("No more RFID card.");
_player->stop();
if (_no_rfid_card_count >= 1) {
INFO("No more RFID card.");
_player->stop();
} else {
_no_rfid_card_count++;
return;
}
}
_last_rfid_card_uid = uid;
}
@ -80,12 +86,14 @@ void Controller::_check_serial() {
}
void Controller::_execute_serial_command(String cmd) {
DEBUG("Executing command: %s", cmd.c_str());
DEBUG("Executing command: %s\n", cmd.c_str());
if (cmd.equals("ls")) {
_execute_command_ls("/");
} else if (cmd.startsWith("ls ")) {
_execute_command_ls(cmd.substring(3));
} else if (cmd.equals("play")) {
_player->play_random_album();
} else if (cmd.startsWith("play ")) {
_player->play_album(cmd.substring(5));
} else if (cmd.startsWith("sys ")) {