Fix for ESP32-S3-WROOM-1: safe GPIO pins, serial flush, delays

- Switch pins: 2-7, 15-18 (avoids USB 19/20, PSRAM 26-32, JTAG 34-37)
- LED pins: 38-42, 45-48, 21 (high GPIOs, no special functions)
- Add Serial.flush() after init messages
- Increase startup delays for reliable serial output
- Board: esp32-s3-devkitc-1-n16r8
This commit is contained in:
2026-06-23 13:22:49 +00:00
parent bb32ec65d1
commit c94be67384
4 changed files with 31 additions and 20 deletions
+4 -4
View File
@@ -2,7 +2,7 @@
#include <Arduino.h>
static const uint8_t SWITCH_PINS[10] = {
1, 2, 3, 4, 5, 6, 7, 8, 9, 10
2, 3, 4, 5, 6, 7, 15, 16, 17, 18
};
DefaultSwitchStub::DefaultSwitchStub() : initialized(false) {
@@ -21,7 +21,7 @@ void DefaultSwitchStub::begin() {
pinMode(switch_states[i].gpio_pin, INPUT_PULLUP);
}
initialized = true;
Serial.printf("[SW] Initialized %d switches on GPIOs: ", NUM_SWITCHES);
Serial.printf("[SW] %d switches on GPIOs: ", NUM_SWITCHES);
for (int i = 0; i < NUM_SWITCHES; i++) {
Serial.printf("%d ", switch_states[i].gpio_pin);
}
@@ -57,12 +57,12 @@ void DefaultSwitchStub::configure_switch(uint8_t switch_id, uint8_t gpio_pin) {
if (initialized) {
pinMode(gpio_pin, INPUT_PULLUP);
}
Serial.printf("[SW] Switch %d configured to GPIO %d\n", switch_id, gpio_pin);
Serial.printf("[SW] Switch %d -> GPIO %d\n", switch_id, gpio_pin);
}
void DefaultSwitchStub::set_debounce_time(uint32_t time_ms) {
for (int i = 0; i < NUM_SWITCHES; i++) {
switch_states[i].debounce_time = time_ms;
}
Serial.printf("[SW] Debounce time set to %lu ms\n", time_ms);
Serial.printf("[SW] Debounce: %lu ms\n", time_ms);
}