Skip to content

Commit 44b470a

Browse files
committed
update audio-lib and webserver, improve RFID-Task-Resume, pause LED-Task for upload again
1 parent 2be3608 commit 44b470a

File tree

7 files changed

+21
-11
lines changed

7 files changed

+21
-11
lines changed

platformio.ini

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ extra_scripts =
3131
pre:updateSdkConfig.py
3232
pre:processHtml.py
3333
lib_deps =
34-
https://github.com/schreibfaul1/ESP32-audioI2S.git#f394a91 ; v3.3.2 + bugfix large files
34+
https://github.com/schreibfaul1/ESP32-audioI2S.git#160b164 ; v3.4.0
3535
https://github.com/madhephaestus/ESP32Encoder.git#2c986e0
3636
https://github.com/peterus/ESP-FTP-Server-Lib.git#554959f
37-
https://github.com/FastLED/FastLED.git#8abc9c6 ; v3.10.1+ fix of issue 16188
38-
https://github.com/ESP32Async/ESPAsyncWebServer.git#f06bca1 ; v3.7.8
37+
https://github.com/FastLED/FastLED.git#f5c78fd ; v3.10.1+ fix of issue 16188
38+
https://github.com/ESP32Async/ESPAsyncWebServer.git#35ee69e ; v3.7.10
3939
https://github.com/bblanchon/ArduinoJson.git#3252013 ; v7.4.1
4040
https://github.com/pschatzmann/arduino-audio-tools.git#c19fbd6 ; v1.0.2
4141
https://github.com/pschatzmann/ESP32-A2DP.git#8faaafa ; v1.8.7

src/AudioPlayer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,9 +437,9 @@ void AudioPlayer_Loop() {
437437
gPlayProperties.currentRelPos = ((double) (audio->getFilePos() - audioDataStartPos - audio->inBufferFilled()) / (fileSize - audioDataStartPos)) * 100;
438438
}
439439
} else {
440-
if (gPlayProperties.isWebstream && (audio->inBufferSize() > 0)) {
440+
if (gPlayProperties.isWebstream && (audio->getInBufferSize() > 0)) {
441441
// calc current fillbuffer percent for webstream with unknown size/end
442-
gPlayProperties.currentRelPos = (double) (audio->inBufferFilled() / (double) audio->inBufferSize()) * 100;
442+
gPlayProperties.currentRelPos = (double) (audio->inBufferFilled() / (double) audio->getInBufferSize()) * 100;
443443
} else {
444444
gPlayProperties.currentRelPos = 0;
445445
}

src/Rfid.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ void Rfid_Cyclic(void);
1111
void Rfid_Exit(void);
1212
void Rfid_TaskPause(void);
1313
void Rfid_TaskResume(void);
14+
void Rfid_TaskReset(void);
1415
void Rfid_WakeupCheck(void);
1516
void Rfid_PreferenceLookupHandler(void);

src/RfidCommon.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ void Rfid_TaskPause(void) {
117117
}
118118
void Rfid_TaskResume(void) {
119119
#if defined(RFID_READER_ENABLED)
120+
Rfid_TaskReset(); // Reset state machine to initial state
120121
vTaskResume(rfidTaskHandle);
121122
#endif
122123
}

src/RfidMfrc522.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ void Rfid_Init(void) {
6464
#endif
6565
}
6666

67+
void Rfid_TaskReset(void) {
68+
Rfid_LastRfidCheckTimestamp = millis();
69+
}
70+
6771
void Rfid_Task(void *parameter) {
6872
uint8_t control = 0x00;
6973

src/RfidPn5180.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ extern TwoWire i2cBusTwo;
4343
#ifdef RFID_READER_TYPE_PN5180
4444
static void Rfid_Task(void *parameter);
4545
TaskHandle_t rfidTaskHandle;
46+
uint8_t stateMachine = RFID_PN5180_STATE_INIT;
4647

4748
#ifdef PN5180_ENABLE_LPCD
4849
void Rfid_EnableLpcd(void);
@@ -106,6 +107,10 @@ void Rfid_Cyclic(void) {
106107
// Not necessary as cyclic stuff performed by task Rfid_Task()
107108
}
108109

110+
void Rfid_TaskReset(void) {
111+
stateMachine = RFID_PN5180_NFC14443_STATE_RESET;
112+
}
113+
109114
void Rfid_Task(void *parameter) {
110115
static PN5180ISO14443 nfc14443(RFID_CS, RFID_BUSY, RFID_RST);
111116
static PN5180ISO15693 nfc15693(RFID_CS, RFID_BUSY, RFID_RST);
@@ -114,7 +119,6 @@ void Rfid_Task(void *parameter) {
114119
byte lastValidcardId[cardIdSize];
115120
bool cardAppliedCurrentRun = false;
116121
bool cardAppliedLastRun = false;
117-
uint8_t stateMachine = RFID_PN5180_STATE_INIT;
118122
static byte cardId[cardIdSize], lastCardId[cardIdSize];
119123
uint8_t uid[10];
120124
bool showDisablePrivacyNotification = true;

src/Web.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ void webserverStart(void) {
443443
if (!index) {
444444
// pause some tasks to get more free CPU time for the upload
445445
// Audio_TaskPause();
446-
// Led_TaskPause();
446+
Led_TaskPause();
447447
Rfid_TaskPause();
448448
Update.begin();
449449
Log_Println(fwStart, LOGLEVEL_NOTICE);
@@ -455,7 +455,7 @@ void webserverStart(void) {
455455
if (final) {
456456
Update.end(true);
457457
// resume the paused tasks
458-
// Led_TaskResume();
458+
Led_TaskResume();
459459
// Audio_TaskResume();
460460
Rfid_TaskResume();
461461
Log_Println(fwEnd, LOGLEVEL_NOTICE);
@@ -1640,7 +1640,7 @@ void explorerHandleFileStorageTask(void *parameter) {
16401640

16411641
// pause some tasks to get more free CPU time for the upload
16421642
// Audio_TaskPause();
1643-
// Led_TaskPause();
1643+
Led_TaskPause();
16441644
Rfid_TaskPause();
16451645

16461646
for (;;) {
@@ -1677,7 +1677,7 @@ void explorerHandleFileStorageTask(void *parameter) {
16771677
Log_Println(webTxCanceled, LOGLEVEL_ERROR);
16781678
free(parameter);
16791679
// resume the paused tasks
1680-
// Led_TaskResume();
1680+
Led_TaskResume();
16811681
// Audio_TaskResume();
16821682
Rfid_TaskResume();
16831683
// destroy double buffer memory, since the upload was interrupted
@@ -1692,7 +1692,7 @@ void explorerHandleFileStorageTask(void *parameter) {
16921692
}
16931693
free(parameter);
16941694
// resume the paused tasks
1695-
// Led_TaskResume();
1695+
Led_TaskResume();
16961696
// Audio_TaskResume();
16971697
Rfid_TaskResume();
16981698
// send signal to upload function to terminate

0 commit comments

Comments
 (0)