Browse Source

Adding feature SAVE_PLAYPOS_WHEN_RFID_CHANGE + bugfix

master
Torsten Stauder 4 years ago
parent
commit
23b3199e92
  1. 2
      README.md
  2. 1
      changelog.md
  3. 27
      src/AudioPlayer.cpp
  4. 2
      src/revision.h

2
README.md

@ -13,9 +13,9 @@ I started this project back in october 2019 and never expected it to become that
* Partition-layout for ESP32 is changed along with this branch. This step was necessary in order to resize (enlarge) the memory-region where especially the assignments for the RFID-tags are saved. As all permanent settings (e.g. WiFi-settings) are saved there too, it's necessary to re-enter WiFi-credentials after update. But the most important thing is to recover the assignments for the RFID-tags. Please consult my [migration-document](https://forum.espuino.de/t/wechsel-zum-refactoring-branch-was-ist-zu-beachten/510). * Partition-layout for ESP32 is changed along with this branch. This step was necessary in order to resize (enlarge) the memory-region where especially the assignments for the RFID-tags are saved. As all permanent settings (e.g. WiFi-settings) are saved there too, it's necessary to re-enter WiFi-credentials after update. But the most important thing is to recover the assignments for the RFID-tags. Please consult my [migration-document](https://forum.espuino.de/t/wechsel-zum-refactoring-branch-was-ist-zu-beachten/510).
## Changelog ## Changelog
Last three events: Last three events:
* 28.10.2021: Added feature `SAVE_PLAYPOS_WHEN_RFID_CHANGE`. When enabled last playposition for audiobook is saved when new RFID-tag is applied. Without having this feature enabled, it's necessary to press pause first, in order to do this manually.
* 27.10.2021: Added feature `SAVE_PLAYPOS_BEFORE_SHUTDOWN`. When enabled last playposition for audiobook is saved when shutdown is initiated. Without having this feature enabled, it's necessary to press pause first, in order to do this manually. * 27.10.2021: Added feature `SAVE_PLAYPOS_BEFORE_SHUTDOWN`. When enabled last playposition for audiobook is saved when shutdown is initiated. Without having this feature enabled, it's necessary to press pause first, in order to do this manually.
* 30.09.2021: Added feature `PAUSE_WHEN_RFID_REMOVED` for RC522 after having it already for PN5180 (thanks @elmar-ops for contribution) * 30.09.2021: Added feature `PAUSE_WHEN_RFID_REMOVED` for RC522 after having it already for PN5180 (thanks @elmar-ops for contribution)
* 23.07.2021: Adding new playmode: from local .m3u-file (files or webstreams)
## Known bugs ## Known bugs
* Some webstreams don't run. Guess it's a combination of saturated connection-pool and lack of heap-memory. Works probably better if ESP32-WROVER (e.g. Lolin D32 pro) is used, as this chip has PSRAM. Advice: Don't enable modules (e.g. MQTT) if you don't need them as this could save memory (and trouble). * Some webstreams don't run. Guess it's a combination of saturated connection-pool and lack of heap-memory. Works probably better if ESP32-WROVER (e.g. Lolin D32 pro) is used, as this chip has PSRAM. Advice: Don't enable modules (e.g. MQTT) if you don't need them as this could save memory (and trouble).
* For ESPuinos making use of SPI for SD (instead of SD_MMC), there's currently a problem that sometimes leads to incomplete file-transfers via webtransfer or FTP. I'm about to [investigate...](https://forum.espuino.de/t/probleme-beim-webtransfer/542) * For ESPuinos making use of SPI for SD (instead of SD_MMC), there's currently a problem that sometimes leads to incomplete file-transfers via webtransfer or FTP. I'm about to [investigate...](https://forum.espuino.de/t/probleme-beim-webtransfer/542)

1
changelog.md

@ -12,6 +12,7 @@
* 23.07.2021: Adding new playmode: from local .m3u-file (files or webstreams) * 23.07.2021: Adding new playmode: from local .m3u-file (files or webstreams)
* 30.09.2021: Added feature `PAUSE_WHEN_RFID_REMOVED` for RC522 after having it already for PN5180 (thanks @elmar-ops for contribution) * 30.09.2021: Added feature `PAUSE_WHEN_RFID_REMOVED` for RC522 after having it already for PN5180 (thanks @elmar-ops for contribution)
* 27.10.2021: Added feature `SAVE_PLAYPOS_BEFORE_SHUTDOWN`. When enabled last playposition for audiobook is saved when shutdown is initiated. Without having this feature enabled, it's necessary to press pause first, in order to do this manually. * 27.10.2021: Added feature `SAVE_PLAYPOS_BEFORE_SHUTDOWN`. When enabled last playposition for audiobook is saved when shutdown is initiated. Without having this feature enabled, it's necessary to press pause first, in order to do this manually.
* 28.10.2021: Added feature `SAVE_PLAYPOS_WHEN_RFID_CHANGE`. When enabled last playposition for audiobook is saved when new RFID-tag is applied. Without having this feature enabled, it's necessary to press pause first, in order to do this manually.
## Old (monolithic main.cpp) ## Old (monolithic main.cpp)
* 11.07.2020: Added support for reversed Neopixel addressing. * 11.07.2020: Added support for reversed Neopixel addressing.
* 09.10.2020: mqttUser / mqttPassword can now be configured via webgui. * 09.10.2020: mqttUser / mqttPassword can now be configured via webgui.

27
src/AudioPlayer.cpp

@ -734,6 +734,15 @@ void AudioPlayer_VolumeToQueueSender(const int32_t _newVolume, bool reAdjustRota
// Receives de-serialized RFID-data (from NVS) and dispatches playlists for the given // Receives de-serialized RFID-data (from NVS) and dispatches playlists for the given
// playmode to the track-queue. // playmode to the track-queue.
void AudioPlayer_TrackQueueDispatcher(const char *_itemToPlay, const uint32_t _lastPlayPos, const uint32_t _playMode, const uint16_t _trackLastPlayed) { void AudioPlayer_TrackQueueDispatcher(const char *_itemToPlay, const uint32_t _lastPlayPos, const uint32_t _playMode, const uint16_t _trackLastPlayed) {
// Make sure last playposition for audiobook is saved when new RFID-tag is applied
#ifdef SAVE_PLAYPOS_WHEN_RFID_CHANGE
if (!gPlayProperties.pausePlay && (gPlayProperties.playMode == AUDIOBOOK || gPlayProperties.playMode == AUDIOBOOK_LOOP)) {
AudioPlayer_TrackControlToQueueSender(PAUSEPLAY);
while (!gPlayProperties.pausePlay) { // Make sure to wait until playback is paused in order to be sure that playposition saved in NVS
vTaskDelay(portTICK_RATE_MS * 100u);
}
}
#endif
char *filename; char *filename;
filename = (char *) x_malloc(sizeof(char) * 255); filename = (char *) x_malloc(sizeof(char) * 255);
@ -761,12 +770,26 @@ void AudioPlayer_TrackQueueDispatcher(const char *_itemToPlay, const uint32_t _l
if (musicFiles == NULL) { if (musicFiles == NULL) {
Log_Println((char *) FPSTR(errorOccured), LOGLEVEL_ERROR); Log_Println((char *) FPSTR(errorOccured), LOGLEVEL_ERROR);
System_IndicateError(); System_IndicateError();
gPlayProperties.playMode = NO_PLAYLIST;
if (!gPlayProperties.pausePlay) {
AudioPlayer_TrackControlToQueueSender(STOP);
while (!gPlayProperties.pausePlay) {
vTaskDelay(portTICK_RATE_MS * 10u);
}
} else {
gPlayProperties.playMode = NO_PLAYLIST;
}
return; return;
} else if (!strcmp(*(musicFiles - 1), "0")) { } else if (!strcmp(*(musicFiles - 1), "0")) {
Log_Println((char *) FPSTR(noMp3FilesInDir), LOGLEVEL_NOTICE); Log_Println((char *) FPSTR(noMp3FilesInDir), LOGLEVEL_NOTICE);
System_IndicateError(); System_IndicateError();
gPlayProperties.playMode = NO_PLAYLIST;
if (!gPlayProperties.pausePlay) {
AudioPlayer_TrackControlToQueueSender(STOP);
while (!gPlayProperties.pausePlay) {
vTaskDelay(portTICK_RATE_MS * 10u);
}
} else {
gPlayProperties.playMode = NO_PLAYLIST;
}
free(filename); free(filename);
return; return;
} }

2
src/revision.h

@ -1,4 +1,4 @@
#ifndef __REVISION_H__ #ifndef __REVISION_H__
#define __REVISION_H__ #define __REVISION_H__
constexpr const char softwareRevision[] PROGMEM = "Software-revision: 20211027-1";
constexpr const char softwareRevision[] PROGMEM = "Software-revision: 20211028-1";
#endif #endif
Loading…
Cancel
Save