diff --git a/README.md b/README.md index 8e02875..5ffa1ae 100644 --- a/README.md +++ b/README.md @@ -90,9 +90,10 @@ Die SD Karte (Ordner mp3 und advert) hat sich gegenüber der Version 3.1.10 geä # Change Log -## Version 3.1.11 (30.07.2024) +## 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 +- [Issue 217](https://github.com/tonuino/TonUINO-TNG/issues/217): Improve and fix handling of some DF Player ## Version 3.1.10 (27.06.2024) - [Issue 210](https://github.com/tonuino/TonUINO-TNG/issues/210): Make text in the admin menu for switching volume button more clearer diff --git a/TonUINO-TNG.ino b/TonUINO-TNG.ino index 295e1ad..ddf88d3 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 30.07.24\n")); + LOG(init_log, s_error, F("V3.1.11 31.07.24\n")); #ifdef TonUINO_Classic LOG(init_log, s_error, F("C "), lf_no); diff --git a/src/constants.hpp b/src/constants.hpp index e9df081..852b8ef 100644 --- a/src/constants.hpp +++ b/src/constants.hpp @@ -111,13 +111,18 @@ * um einen speziellen Chip auf dem DfMiniMp3 Player zu ünterstützen bitte in eine der nächste Zeilen den Kommentar entfernen * * GD3200B: bad behavior of getFolderTrackCount() - ignores the parameter folder + * bad behavior of callback OnPlayFinished - it is also called on advertise tracks * MH2024K16SS: no checksums - * LISP3: bad behavior of callback OnPlayFinished - it is also called on advertise tracks (also on some MH2024K24SS) + * LISP3: bad behavior of callback OnPlayFinished - it is also called on advertise tracks + * MP3-TF-16P V3.0 with MH2024K24SS: + * very slow + * bad behavior of callback OnPlayFinished - it is also called on advertise tracks * LKP Player: no ACK for requests (use Mp3ChipIncongruousNoAck for them) */ //#define DFMiniMp3_T_CHIP_GD3200B //#define DFMiniMp3_T_CHIP_MH2024K16SS //#define DFMiniMp3_T_CHIP_LISP3 +//#define DFMiniMp3_T_CHIP_MH2024K24SS_MP3_TF_16P_V3_0 #define DFMiniMp3_T_CHIP_Mp3ChipIncongruousNoAck // ###################################################################### @@ -377,7 +382,13 @@ inline constexpr uint8_t dfPlayer_transmitPin = 3; inline constexpr uint8_t maxTracksInFolder = 255; inline constexpr uint8_t dfPlayer_busyPin = 4; inline constexpr levelType dfPlayer_busyPinType = levelType::activeHigh; +#if defined(DFMiniMp3_T_CHIP_MH2024K24SS_MP3_TF_16P_V3_0) +inline constexpr unsigned long dfPlayer_timeUntilStarts = 2500; +#elif defined(DFMiniMp3_T_CHIP_GD3200B) +inline constexpr unsigned long dfPlayer_timeUntilStarts = 1500; +#else inline constexpr unsigned long dfPlayer_timeUntilStarts = 1000; +#endif // ####### tonuino ##################################### diff --git a/src/mp3.cpp b/src/mp3.cpp index 3cc8491..38754be 100644 --- a/src/mp3.cpp +++ b/src/mp3.cpp @@ -25,12 +25,12 @@ void Mp3Notify::PrintlnSourceAction(DfMp3_PlaySources source, const __FlashStrin } void Mp3Notify::OnPlayFinished(DfMp3&, DfMp3_PlaySources /*source*/, uint16_t track) { - LOG(mp3_log, s_debug, F("Track beendet: "), track); + LOG(mp3_log, s_info, F("Track beendet: "), track); if (track == lastTrackFinished) return; else lastTrackFinished = track; -#ifdef DFMiniMp3_T_CHIP_LISP3 +#ifdef DFMiniMp3_IGNORE_ONPLAYFINISHED_FOR_ADV if (Tonuino::getTonuino().getMp3().resetPlayingAdv()) return; #endif @@ -88,7 +88,7 @@ void Mp3::waitForTrackToStart() { void Mp3::playAdvertisement(uint16_t track, bool olnyIfIsPlaying) { LOG(mp3_log, s_info, F("play adv: "), track); -#ifdef DFMiniMp3_T_CHIP_LISP3 +#ifdef DFMiniMp3_IGNORE_ONPLAYFINISHED_FOR_ADV advPlaying = true; #endif if (isPlaying()) { @@ -101,6 +101,7 @@ void Mp3::playAdvertisement(uint16_t track, bool olnyIfIsPlaying) { } else { Base::playFolderTrack(1, 1); + delay(dfPlayer_timeUntilStarts); } waitForTrackToStart(); LOG(mp3_log, s_debug, F("playAdvertisement: "), track); diff --git a/src/mp3.hpp b/src/mp3.hpp index bc600b1..4c7060d 100644 --- a/src/mp3.hpp +++ b/src/mp3.hpp @@ -27,6 +27,10 @@ class Mp3Notify; #define DFMiniMp3_T_CHIP_VARIANT Mp3ChipIncongruousNoAck #endif +#if defined(DFMiniMp3_T_CHIP_GD3200B) or defined(DFMiniMp3_T_CHIP_LISP3) or defined(DFMiniMp3_T_CHIP_MH2024K24SS_MP3_TF_16P_V3_0) +#define DFMiniMp3_IGNORE_ONPLAYFINISHED_FOR_ADV +#endif + // define a handy type using serial and our notify class #ifdef DFMiniMp3_T_CHIP_VARIANT using DfMp3 = DFMiniMp3; @@ -209,7 +213,7 @@ class Mp3: public DfMp3 { void clearAllQueue() { clearFolderQueue(); clearMp3Queue(); } bool isPlayingFolder() { return playing == play_folder; } bool isPlayingMp3 () { return playing == play_mp3 ; } -#ifdef DFMiniMp3_T_CHIP_LISP3 +#ifdef DFMiniMp3_IGNORE_ONPLAYFINISHED_FOR_ADV bool resetPlayingAdv() { bool ret = advPlaying; advPlaying = false; return ret; } #endif // firstTrack and lastTrack -> index in folder starting with 1 @@ -293,7 +297,7 @@ class Mp3: public DfMp3 { Timer startTrackTimer{}; Timer missingOnPlayFinishedTimer{}; bool isPause{}; -#ifdef DFMiniMp3_T_CHIP_LISP3 +#ifdef DFMiniMp3_IGNORE_ONPLAYFINISHED_FOR_ADV bool advPlaying{false}; #endif