ESP32-S3 support: WROOM-1-N8R8 config and stability fixes#562
ESP32-S3 support: WROOM-1-N8R8 config and stability fixes#562laith-dosinfection wants to merge 1 commit intosle118:master-v4.3from
Conversation
…hout LMS Configure sdkconfig for ESP32-S3-WROOM-1-N8R8 (quad flash, octal PSRAM 8MB). Fix crash loop when no LMS server is present by keeping slimproto retrying in the background instead of rebooting, allowing AirPlay/Spotify/BT sinks to continue operating independently. Fix heap corruption in HTTP redirect handler caused by 1-byte buffer overflow. Use CMAKE_OBJCOPY instead of hardcoded toolchain prefix for cross-target compatibility. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
This pull request migrates the project target from ESP32 to ESP32-S3, involving extensive updates to the SDK configuration, toolchain prefixes, and flash settings. It also refactors the Squeezelite execution logic to avoid system reboots when a server is unavailable, implementing background retry loops instead. Additionally, a potential buffer overflow in the HTTP redirect handler was corrected. Review feedback highlights opportunities to improve resource management by deleting finished tasks rather than suspending them and suggests enhancing system responsiveness by replacing long sleep intervals with more granular checks of the running state.
| vTaskSuspend(NULL); | ||
| } else { | ||
| cmd_send_messaging("cfg-audio-tmpl",MESSAGING_ERROR,"Correct command line and reboot\n"); | ||
| vTaskSuspend(NULL); |
There was a problem hiding this comment.
Using vTaskSuspend(NULL) keeps the task and its allocated stack memory in the system indefinitely. Since the task has finished its execution and is not intended to be resumed, it should be deleted to free up resources. vTaskDelete(NULL) is the standard way to terminate a task in ESP-IDF and ensure its resources are reclaimed by the idle task.
vTaskDelete(NULL);
} else {
cmd_send_messaging("cfg-audio-tmpl",MESSAGING_ERROR,"Correct command line and reboot\n");
vTaskDelete(NULL);| if (!slimproto_ip) { | ||
| LOG_INFO("no server found, will keep retrying in background"); | ||
| while (running && !slimproto_ip) { | ||
| sleep(30); |
There was a problem hiding this comment.
The sleep(30) call blocks the task for a significant duration, making it unresponsive to changes in the running flag (e.g., during a system shutdown or service stop) until the timer expires. Consider implementing a more responsive wait, such as a loop with shorter delays (e.g., 1 second) that checks the running flag frequently, or using a semaphore/event group with a timeout.
| if (!slimproto_ip) { | ||
| LOG_INFO("no server found, retrying in 30s"); | ||
| failed_connect = 0; | ||
| sleep(30); |
Summary
This branch adds working ESP32-S3 support, tested on an ESP32-S3-WROOM-1-N8R8 module with a PCM5102A DAC. Built and verified with ESP-IDF v4.4.8.
xtensa-esp32-elf-objcopywith${CMAKE_OBJCOPY}in CMakeLists.txt so the build works for both ESP32 and ESP32-S3http_server_handlers.c— allocated buffer didn't account for trailing/in redirect URL, corrupting the heap tail marker and crashing on first WiFi setup connectionTested with AirPlay streaming — stable operation over multiple hours with no reboots.
Happy to keep this as an S3-specific branch if that makes more sense than merging into the main line. Appreciate all the great work on this project!
Test plan
🤖 Generated with Claude Code