From 0160b5b5a18ad62b561c8e5696f07c92a00191fa Mon Sep 17 00:00:00 2001 From: Martin Date: Sun, 15 Dec 2024 19:45:42 +0100 Subject: [PATCH 1/4] Double flag handshake implementation --- include/esPod.h | 6 ++++++ src/esPod.cpp | 36 ++++++++++++++++++++++++------------ 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/include/esPod.h b/include/esPod.h index 04804ae..33017ed 100644 --- a/include/esPod.h +++ b/include/esPod.h @@ -120,11 +120,17 @@ class esPod const char* _serialNumber = "AB345F7HIJK"; //MINI metadata + bool _accessoryNameReceived = false; bool _accessoryNameRequested = false; + bool _accessoryCapabilitiesReceived = false; bool _accessoryCapabilitiesRequested = false; + bool _accessoryFirmwareReceived = false; bool _accessoryFirmwareRequested = false; + bool _accessoryManufReceived = false; bool _accessoryManufRequested = false; + bool _accessoryModelReceived = false; bool _accessoryModelRequested = false; + bool _accessoryHardwareReceived = false; bool _accessoryHardwareRequested = false; //Handler functions diff --git a/src/esPod.cpp b/src/esPod.cpp index 7b768c1..ed2f7fc 100644 --- a/src/esPod.cpp +++ b/src/esPod.cpp @@ -73,11 +73,17 @@ void esPod::resetState(){ _rxInProgress = false; //Mini metadata + _accessoryCapabilitiesReceived = false; _accessoryCapabilitiesRequested = false; + _accessoryFirmwareReceived = false; _accessoryFirmwareRequested = false; + _accessoryHardwareReceived = false; _accessoryHardwareRequested = false; + _accessoryManufReceived = false; _accessoryManufRequested = false; + _accessoryModelReceived = false; _accessoryModelRequested = false; + _accessoryNameReceived = false; _accessoryNameRequested = false; } @@ -616,9 +622,10 @@ void esPod::processLingo0x00(const byte *byteArray, uint32_t len) { ESP_LOGI(IPOD_TAG,"CMD: 0x%02x IdentifyDeviceLingoes",cmdID); L0x00_0x02_iPodAck(iPodAck_OK,cmdID);//Acknowledge, start capabilities pingpong - if(!_accessoryCapabilitiesRequested) + if(!_accessoryCapabilitiesReceived && !_accessoryCapabilitiesRequested) { L0x00_0x27_GetAccessoryInfo(0x00); //Immediately request general capabilities + _accessoryCapabilitiesRequested = true; } } @@ -630,47 +637,52 @@ void esPod::processLingo0x00(const byte *byteArray, uint32_t len) switch (byteArray[1]) //Ping-pong the next request based on the current response { case 0x00: - _accessoryCapabilitiesRequested = true; - if (!_accessoryNameRequested) + _accessoryCapabilitiesReceived = true; + if (!_accessoryNameReceived && !_accessoryNameRequested) { L0x00_0x27_GetAccessoryInfo(0x01); //Request the name + _accessoryNameRequested = true; } break; case 0x01: - _accessoryNameRequested = true; - if (!_accessoryFirmwareRequested) + _accessoryNameReceived = true; + if (!_accessoryFirmwareReceived && !_accessoryFirmwareRequested) { L0x00_0x27_GetAccessoryInfo(0x04); //Request the firmware version + _accessoryFirmwareRequested = true; } break; case 0x04: - _accessoryFirmwareRequested = true; - if (!_accessoryHardwareRequested) + _accessoryFirmwareReceived = true; + if (!_accessoryHardwareReceived && !_accessoryHardwareRequested) { L0x00_0x27_GetAccessoryInfo(0x05); //Request the hardware number + _accessoryHardwareRequested = true; } break; case 0x05: - _accessoryHardwareRequested = true; - if (!_accessoryManufRequested) + _accessoryHardwareReceived = true; + if (!_accessoryManufReceived && !_accessoryManufRequested) { L0x00_0x27_GetAccessoryInfo(0x06); //Request the manufacturer name + _accessoryManufRequested = true; } break; case 0x06: - _accessoryManufRequested = true; - if (!_accessoryModelRequested) + _accessoryManufReceived = true; + if (!_accessoryModelReceived && !_accessoryModelRequested) { L0x00_0x27_GetAccessoryInfo(0x07); //Request the model number + _accessoryModelRequested = true; } break; case 0x07: - _accessoryModelRequested = true; //End of the reactionchain + _accessoryModelReceived = true; //End of the reactionchain ESP_LOGI(IPOD_TAG,"Handshake complete."); break; } From c811faca436e3ea34e0eab35353c32f3c94dd3c2 Mon Sep 17 00:00:00 2001 From: Martin Date: Tue, 7 Jan 2025 21:58:54 +0100 Subject: [PATCH 2/4] Update platformio.ini Strict version pointing --- platformio.ini | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/platformio.ini b/platformio.ini index db23989..dfe3033 100644 --- a/platformio.ini +++ b/platformio.ini @@ -23,9 +23,9 @@ build_flags = [env:audioKit] board = esp32dev lib_deps = - https://github.com/pschatzmann/ESP32-A2DP.git@^1.8.4 - https://github.com/pschatzmann/arduino-audio-tools.git@^1.0.1 - https://github.com/pschatzmann/arduino-audio-driver.git@^0.1.0 + https://github.com/pschatzmann/ESP32-A2DP.git#v1.8.5 + https://github.com/pschatzmann/arduino-audio-tools.git#v1.0.1 + https://github.com/pschatzmann/arduino-audio-driver.git#v0.1.1 build_flags = ${env.build_flags} -D BOARD_HAS_PSRAM @@ -112,8 +112,8 @@ build_flags = [env:nodeMCUESP32S_externalDAC] lib_deps = - https://github.com/pschatzmann/ESP32-A2DP.git - https://github.com/pschatzmann/arduino-audio-tools.git + https://github.com/pschatzmann/ESP32-A2DP.git#v1.8.5 + https://github.com/pschatzmann/arduino-audio-tools.git#v1.0.1 monitor_speed = 115200 build_flags = ${env.build_flags} From 0d2ce62130c3b60f5a4183b7dd58c0ceecd7618f Mon Sep 17 00:00:00 2001 From: Martin Date: Tue, 7 Jan 2025 22:36:31 +0100 Subject: [PATCH 3/4] Pinning audio-tools to pre-mutex commit --- platformio.ini | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/platformio.ini b/platformio.ini index dfe3033..224c556 100644 --- a/platformio.ini +++ b/platformio.ini @@ -19,13 +19,18 @@ build_flags = -D BUILD_BRANCH="\"main"\" -D PIOENV="\"$PIOENV"\" -D REFRESH_INTERVAL=10 +lib_deps = + https://github.com/pschatzmann/ESP32-A2DP.git@^1.8.4 + ; https://github.com/pschatzmann/arduino-audio-tools.git@^1.0.1 + https://github.com/pschatzmann/arduino-audio-tools.git#bca62a5a1cfbddbacaf49eac035ca2daf544956c + https://github.com/pschatzmann/arduino-audio-driver.git@^0.1.0 [env:audioKit] board = esp32dev -lib_deps = - https://github.com/pschatzmann/ESP32-A2DP.git#v1.8.5 - https://github.com/pschatzmann/arduino-audio-tools.git#v1.0.1 - https://github.com/pschatzmann/arduino-audio-driver.git#v0.1.1 +; lib_deps = +; https://github.com/pschatzmann/ESP32-A2DP.git@1.8.4 +; https://github.com/pschatzmann/arduino-audio-tools.git@1.0.1 +; https://github.com/pschatzmann/arduino-audio-driver.git@0.1.1 build_flags = ${env.build_flags} -D BOARD_HAS_PSRAM @@ -111,9 +116,9 @@ build_flags = [env:nodeMCUESP32S_externalDAC] -lib_deps = - https://github.com/pschatzmann/ESP32-A2DP.git#v1.8.5 - https://github.com/pschatzmann/arduino-audio-tools.git#v1.0.1 +; lib_deps = +; https://github.com/pschatzmann/ESP32-A2DP.git@1.8.4 +; https://github.com/pschatzmann/arduino-audio-tools.git@1.0.1 monitor_speed = 115200 build_flags = ${env.build_flags} From 5b81e8c49085826ef3a67a72912246c2a75ca2a4 Mon Sep 17 00:00:00 2001 From: Martin Date: Tue, 7 Jan 2025 22:50:30 +0100 Subject: [PATCH 4/4] Update platformio.ini Thank you @pschatzmann !! Fixed issues with incoming mutex in Audio-Tools --- platformio.ini | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/platformio.ini b/platformio.ini index 224c556..8bf21f6 100644 --- a/platformio.ini +++ b/platformio.ini @@ -21,16 +21,11 @@ build_flags = -D REFRESH_INTERVAL=10 lib_deps = https://github.com/pschatzmann/ESP32-A2DP.git@^1.8.4 - ; https://github.com/pschatzmann/arduino-audio-tools.git@^1.0.1 - https://github.com/pschatzmann/arduino-audio-tools.git#bca62a5a1cfbddbacaf49eac035ca2daf544956c + https://github.com/pschatzmann/arduino-audio-tools.git@^1.0.1 https://github.com/pschatzmann/arduino-audio-driver.git@^0.1.0 [env:audioKit] board = esp32dev -; lib_deps = -; https://github.com/pschatzmann/ESP32-A2DP.git@1.8.4 -; https://github.com/pschatzmann/arduino-audio-tools.git@1.0.1 -; https://github.com/pschatzmann/arduino-audio-driver.git@0.1.1 build_flags = ${env.build_flags} -D BOARD_HAS_PSRAM @@ -116,9 +111,6 @@ build_flags = [env:nodeMCUESP32S_externalDAC] -; lib_deps = -; https://github.com/pschatzmann/ESP32-A2DP.git@1.8.4 -; https://github.com/pschatzmann/arduino-audio-tools.git@1.0.1 monitor_speed = 115200 build_flags = ${env.build_flags}