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:
+14
-12
@@ -2,7 +2,7 @@
|
||||
#include <Arduino.h>
|
||||
|
||||
static const uint8_t LED_PINS[10] = {
|
||||
11, 12, 13, 14, 15, 16, 17, 18, 19, 20
|
||||
38, 39, 40, 41, 42, 45, 46, 47, 48, 21
|
||||
};
|
||||
|
||||
DefaultLedStub::DefaultLedStub() : initialized(false) {
|
||||
@@ -22,21 +22,23 @@ void DefaultLedStub::begin() {
|
||||
}
|
||||
initialized = true;
|
||||
|
||||
Serial.println("[LED] Startup colour cycle...");
|
||||
Serial.println("[LED] Startup animation...");
|
||||
|
||||
for (int i = 0; i < NUM_LEDS; i++) {
|
||||
digitalWrite(LED_PINS[i], HIGH);
|
||||
Serial.printf("[LED] LED %d ON (GPIO %d)\n", i, LED_PINS[i]);
|
||||
Serial.printf("[LED] LED %d ON (GPIO %d)\n", i, LED_PINS[i]);
|
||||
delay(150);
|
||||
}
|
||||
|
||||
delay(300);
|
||||
|
||||
for (int i = NUM_LEDS - 1; i >= 0; i--) {
|
||||
digitalWrite(LED_PINS[i], LOW);
|
||||
Serial.printf("[LED] LED %d OFF (GPIO %d)\n", i, LED_PINS[i]);
|
||||
delay(100);
|
||||
}
|
||||
|
||||
for (int i = 0; i < NUM_LEDS; i++) {
|
||||
digitalWrite(LED_PINS[i], LOW);
|
||||
delay(50);
|
||||
}
|
||||
|
||||
clear_all();
|
||||
Serial.println("[LED] Startup cycle complete");
|
||||
Serial.println("[LED] Startup complete");
|
||||
}
|
||||
|
||||
void DefaultLedStub::set_led_state(uint8_t note, uint8_t channel, uint8_t velocity) {
|
||||
@@ -57,7 +59,7 @@ void DefaultLedStub::set_led_state(uint8_t note, uint8_t channel, uint8_t veloci
|
||||
note, led_index, channel, velocity,
|
||||
velocity > 0 ? "ON" : "OFF");
|
||||
} else {
|
||||
Serial.printf("[LED] Index out of range: %d (Note: %d)\n", led_index, note);
|
||||
Serial.printf("[LED] Out of range: %d (Note: %d)\n", led_index, note);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,5 +71,5 @@ void DefaultLedStub::clear_all() {
|
||||
digitalWrite(LED_PINS[i], LOW);
|
||||
}
|
||||
}
|
||||
Serial.println("[LED] All LEDs cleared");
|
||||
Serial.println("[LED] All cleared");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user