Do RFID scans only at specified intervals. System sounds are now supported, as well as more sound formats (.ogg, .mp4...).

This commit is contained in:
2019-08-08 05:31:27 +02:00
parent b8d4d6bb92
commit 1bf2b04303
6 changed files with 97 additions and 54 deletions

View File

@ -13,7 +13,11 @@ Controller::Controller(Player* p) {
}
void Controller::loop() {
_check_rfid();
unsigned long now = millis();
if ((_last_rfid_scan_at < now - RFID_SCAN_INTERVAL) || (now < _last_rfid_scan_at)) {
_check_rfid();
_last_rfid_scan_at = now;
}
_check_serial();
}
@ -44,6 +48,8 @@ void Controller::_check_serial() {
_player->vol_down();
} else if (c==' ') {
_player->play_album("12345678");
} else if (c=='q') {
_player->play_system_sound("12345678/Biene Maja.mp3");
}
}
}