diff --git a/README.md b/README.md index 5ffa1ae..ba2d0a9 100644 --- a/README.md +++ b/README.md @@ -86,10 +86,13 @@ Eine Anleitung dafür findet man [hier](https://discourse.voss.earth/t/tonuino-s # Installation -Die SD Karte (Ordner mp3 und advert) hat sich gegenüber der Version 3.1.10 geändert. Hier kann man die Dateien downloaden: [tonuino.github.io/TonUINO-TNG/sd-card.zip](https://tonuino.github.io/TonUINO-TNG/sd-card.zip) +Die SD Karte (Ordner mp3 und advert) hat sich gegenüber der Version 3.1.11 geändert. Hier kann man die Dateien downloaden: [tonuino.github.io/TonUINO-TNG/sd-card.zip](https://tonuino.github.io/TonUINO-TNG/sd-card.zip) # Change Log +## Version 3.1.12 (15.08.2024) +- [Issue 220](https://github.com/tonuino/TonUINO-TNG/issues/220): New shortcut for switching BT on/off + ## Version 3.1.11 (31.07.2024) - [Issue 212](https://github.com/tonuino/TonUINO-TNG/issues/212): Sleep Timer Modification card doesn't work properly with NeoPixel Ring - [Issue 215](https://github.com/tonuino/TonUINO-TNG/issues/215): New optional Feature: Support BT Modul diff --git a/TonUINO-TNG.ino b/TonUINO-TNG.ino index ddf88d3..7e28696 100644 --- a/TonUINO-TNG.ino +++ b/TonUINO-TNG.ino @@ -35,7 +35,7 @@ void setup() LOG(init_log, s_error, F("TonUINO Version 3.1 - refactored by Boerge1\n")); LOG(init_log, s_error, F("created by Thorsten Voß and licensed under GNU/GPL.")); LOG(init_log, s_error, F("Information and contribution at https://tonuino.de.\n")); - LOG(init_log, s_error, F("V3.1.11 31.07.24\n")); + LOG(init_log, s_error, F("V3.1.12 15.08.24\n")); #ifdef TonUINO_Classic LOG(init_log, s_error, F("C "), lf_no); diff --git a/audio_messages_de.txt b/audio_messages_de.txt index e4943cb..08002cb 100644 --- a/audio_messages_de.txt +++ b/audio_messages_de.txt @@ -28,6 +28,7 @@ mp3/0320_mode_audio_book_single.mp3|Hörbuch Modus einzeln: Den nächsten Titel mp3/0321_mode_repeat_last_card.mp3|Wiederhole Karte Modus: Die letzte Karte oder der letzte Shortcut wird wiederholt. mp3/0322_mode_quiz_game.mp3|Quiz Spiel Modus: Spiele ein Quiz. mp3/0323_mode_memory_game.mp3|Memory Spiel Modus: Spiele ein Memory. +mp3/0324_mode_switch_bt.mp3|Switch Bluetooth: Schalte Bluetooth an oder aus. mp3/0327_select_file.mp3|OK, wähle nun bitte die Datei mit den Lautstärketasten aus. mp3/0328_select_first_file.mp3|OK, wähle nun bitte die Startdatei mit den Lautstärketasten aus. mp3/0329_select_last_file.mp3|Wähle nun bitte die Enddatei mit den Lautstärketasten aus. diff --git a/sd-card/mp3/0324_mode_switch_bt.mp3 b/sd-card/mp3/0324_mode_switch_bt.mp3 new file mode 100644 index 0000000..6df2a76 Binary files /dev/null and b/sd-card/mp3/0324_mode_switch_bt.mp3 differ diff --git a/src/chip_card.hpp b/src/chip_card.hpp index 3bd48d9..3e91603 100644 --- a/src/chip_card.hpp +++ b/src/chip_card.hpp @@ -24,6 +24,7 @@ enum class pmode_t: uint8_t { repeat_last = 11, quiz_game = 12, memory_game = 13, + switch_bt = 14, // modifier modes sleep_timer = 1, diff --git a/src/mp3.hpp b/src/mp3.hpp index 4c7060d..43f9164 100644 --- a/src/mp3.hpp +++ b/src/mp3.hpp @@ -57,6 +57,7 @@ enum class mp3Tracks: uint16_t { t_321_mode_repeat_last_card = 321, t_322_mode_quiz_game = 322, t_323_mode_memory_game = 323, + t_324_mode_switch_bt = 324, t_327_select_file = 327, t_328_select_first_file = 328, t_329_select_last_file = 329, diff --git a/src/state_machine.cpp b/src/state_machine.cpp index 6bd7d5c..0968037 100644 --- a/src/state_machine.cpp +++ b/src/state_machine.cpp @@ -140,7 +140,7 @@ void ChMode::entry() { folder = folderSettings{}; - numberOfOptions = 13; + numberOfOptions = 14; startMessage = mp3Tracks::t_310_select_mode; messageOffset = mp3Tracks::t_310_select_mode; preview = false; @@ -169,7 +169,7 @@ void ChMode::react(command_e const &cmd_e) { transit(); return; } - if (folder.mode == pmode_t::repeat_last) { + if (folder.mode == pmode_t::repeat_last || folder.mode == pmode_t::switch_bt) { folder.folder = 0xff; // dummy value > 0 to make readCard() returning true transit(); return; @@ -480,6 +480,12 @@ bool Base::readCard() { case Chip_card::readCardEvent::none : return false; case Chip_card::readCardEvent::known: +#ifdef BT_MODULE + if (lastCardRead.mode == pmode_t::switch_bt) { + tonuino.switchBtModuleOnOff(); + return false; + } +#endif if (lastCardRead.folder == 0) { if (lastCardRead.mode == pmode_t::admin_card) { LOG(state_log, s_debug, str_Base(), str_to(), str_Admin_Entry()); @@ -515,6 +521,12 @@ bool Base::readCard() { bool Base::handleShortcut(uint8_t shortCut) { folderSettings sc_folderSettings = settings.getShortCut(shortCut); if (sc_folderSettings.folder != 0) { +#ifdef BT_MODULE + if (sc_folderSettings.mode == pmode_t::switch_bt) { + tonuino.switchBtModuleOnOff(); + return false; // do not end the current play + } +#endif // BT_MODULE if (sc_folderSettings.mode != pmode_t::repeat_last) tonuino.setMyFolder(sc_folderSettings, false /*myFolderIsCard*/); if (tonuino.getFolder() != 0) { diff --git a/src/tonuino.cpp b/src/tonuino.cpp index c7f87e9..2819236 100644 --- a/src/tonuino.cpp +++ b/src/tonuino.cpp @@ -354,6 +354,15 @@ void Tonuino::shutdown() { } #ifdef BT_MODULE +void Tonuino::switchBtModuleOnOff() { + btModuleOn = not btModuleOn; + if (btModuleOn) + mp3.playAdvertisement(advertTracks::t_320_bt_on , false/*olnyIfIsPlaying*/); + else + mp3.playAdvertisement(advertTracks::t_321_bt_off, false/*olnyIfIsPlaying*/); + digitalWrite(btModuleOnPin, getLevel(btModuleOnPinType, btModuleOn ? level::active : level::inactive)); +} + void Tonuino::btModulePairing() { if (not btModulePairingTimer.isActive()) { mp3.playAdvertisement(advertTracks::t_322_bt_pairing, false/*olnyIfIsPlaying*/); @@ -405,12 +414,7 @@ bool Tonuino::specialCard(const folderSettings &nfcTag) { #ifdef BT_MODULE case pmode_t::bt_module: LOG(card_log, s_info, F("toggle bt module from "), btModuleOn); - btModuleOn = not btModuleOn; - if (btModuleOn) - mp3.playAdvertisement(advertTracks::t_320_bt_on , false/*olnyIfIsPlaying*/); - else - mp3.playAdvertisement(advertTracks::t_321_bt_off, false/*olnyIfIsPlaying*/); - digitalWrite(btModuleOnPin, getLevel(btModuleOnPinType, btModuleOn ? level::active : level::inactive)); + switchBtModuleOnOff(); break; #endif // BT_MODULE diff --git a/src/tonuino.hpp b/src/tonuino.hpp index 56ec5a4..33d9309 100644 --- a/src/tonuino.hpp +++ b/src/tonuino.hpp @@ -69,6 +69,7 @@ class Tonuino { #ifdef BT_MODULE bool isBtModuleOn() { return btModuleOn; } + void switchBtModuleOnOff(); void btModulePairing(); #endif