Clean up RFP ESP32-S3 target and tooling
Some checks failed
WLED CI / wled_build (push) Has been cancelled
Deploy Nightly / wled_build (push) Has been cancelled
Deploy Nightly / Deploy nightly (push) Has been cancelled

This commit is contained in:
2026-04-17 01:00:37 +02:00
parent 3a01c00635
commit 95137a6d65
7 changed files with 278 additions and 43 deletions

View File

@@ -168,6 +168,9 @@ String PinManagerClass::getPinSpecialText(int gpio) { // special purpose PIN in
#endif
#if defined(STATUSPIXELPIN)
if (gpio == STATUSPIXELPIN) return(F("WLED Status Pixel"));
#endif
#if defined(STATUSLED)
if (gpio == STATUSLED) return(F("WLED Status LED"));
#endif

View File

@@ -71,6 +71,73 @@
#endif
// WLEDMM end
#if defined(STATUSLED) || defined(STATUSPIXELPIN)
static inline void writeStatusIndicator(uint32_t color) {
#if defined(STATUSPIXELPIN)
if (statusPixelBus != nullptr) {
if (statusPixelBus->canShow()) {
statusPixelBus->setPixelColor(0, color);
statusPixelBus->show();
}
return;
}
#endif
#if defined(STATUSLED)
#if STATUSLED >= 0
#ifdef STATUSLEDINVERTED
digitalWrite(STATUSLED, color ? LOW : HIGH);
#else
digitalWrite(STATUSLED, color ? HIGH : LOW);
#endif
#else
busses.setStatusPixel(color);
#endif
#endif
}
#endif
#if defined(STATUSPIXELPIN)
#ifndef STATUSPIXELCOLORORDER
#define STATUSPIXELCOLORORDER COL_ORDER_GRB
#endif
static void initStatusPixelBus() {
if (statusPixelBus != nullptr) return;
if (pinManager.isPinAllocated(STATUSPIXELPIN)) {
USER_PRINTF("Skipping status pixel on GPIO %u because the pin is already in use.\n", STATUSPIXELPIN);
return;
}
#if defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32S2)
constexpr uint8_t maxStatusPixelBusses = 4;
#elif defined(CONFIG_IDF_TARGET_ESP32C3)
constexpr uint8_t maxStatusPixelBusses = 2;
#else
constexpr uint8_t maxStatusPixelBusses = 8;
#endif
uint8_t busIndex = busses.getNumBusses();
if (busIndex >= maxStatusPixelBusses) {
USER_PRINTLN(F("Skipping status pixel because no free hardware LED channel is left."));
return;
}
uint8_t pins[] = {STATUSPIXELPIN};
BusConfig statusCfg(TYPE_WS2812_RGB, pins, 0, 1, STATUSPIXELCOLORORDER, false, 0, RGBW_MODE_MANUAL_ONLY);
statusPixelBus = new BusDigital(statusCfg, busIndex, busses.getColorOrderMap());
if (statusPixelBus == nullptr || !statusPixelBus->isOk()) {
delete statusPixelBus;
statusPixelBus = nullptr;
USER_PRINTLN(F("Failed to initialize onboard status pixel."));
return;
}
statusPixelBus->setBrightness(255, true);
writeStatusIndicator(0);
}
#endif
#if INCLUDE_xTaskGetHandle && defined(ARDUINO_ARCH_ESP32) && (defined(WLED_DEBUG) || defined(WLED_DEBUG_HEAP))
// WLEDMM stack debug tool - find async_tcp task, and queries it's free stack
@@ -883,6 +950,9 @@ void WLED::setup()
DEBUG_PRINTLN(F("Initializing strip"));
beginStrip();
#if defined(STATUSPIXELPIN)
initStatusPixelBus();
#endif
DEBUG_PRINT(F("heap ")); DEBUG_PRINTLN(getFreeHeapSize());
USER_PRINTLN(F("\nUsermods setup ..."));
@@ -1568,58 +1638,79 @@ void WLED::handleConnection()
}
// If status LED pin is allocated for other uses, does nothing
// else blink at 1Hz when WLED_CONNECTED is false (no WiFi, ?? no Ethernet ??)
// else blink at 2Hz when MQTT is enabled but not connected
// else turn the status LED off
// green blink = DDP realtime active
// blue blink = AP active
// green solid = network connected
// amber fast blink = MQTT configured but disconnected
// red fast blink = WiFi configured but currently disconnected
// off = idle / no status to show
void WLED::handleStatusLED()
{
#if defined(STATUSLED)
[[maybe_unused]] uint32_t c = 0;
#if defined(STATUSLED) || defined(STATUSPIXELPIN)
uint32_t c = 0;
uint8_t nextType = 0;
uint16_t blinkIntervalMs = 0;
#if STATUSLED>=0
#if defined(STATUSLED) && STATUSLED>=0
if (pinManager.isPinAllocated(STATUSLED)) {
return; //lower priority if something else uses the same pin
}
#endif
if (WLED_CONNECTED) {
if (realtimeMode == REALTIME_MODE_DDP) {
c = RGBW32(0,255,0,0);
ledStatusType = 2;
} else if (WLED_MQTT_CONNECTED) {
c = RGBW32(0,128,0,0);
ledStatusType = 4;
nextType = 2;
blinkIntervalMs = 250;
} else if (apActive) {
c = RGBW32(0,0,255,0);
ledStatusType = 1;
}
if (ledStatusType) {
if (millis() - ledStatusLastMillis >= (1000/ledStatusType)) {
ledStatusLastMillis = millis();
#if 1
// WLEDMM un-comment this to stop the blinking
if ((ledStatusType != 2) && (ledStatusType != 4))
ledStatusState = !ledStatusState;
else
ledStatusState = HIGH;
#else
ledStatusState = !ledStatusState;
#endif
#if STATUSLED>=0
digitalWrite(STATUSLED, ledStatusState);
#else
busses.setStatusPixel(ledStatusState ? c : 0);
#endif
}
} else {
#if STATUSLED>=0
#ifdef STATUSLEDINVERTED
digitalWrite(STATUSLED, HIGH);
#else
digitalWrite(STATUSLED, LOW);
#endif
#else
busses.setStatusPixel(0);
nextType = 2;
blinkIntervalMs = 500;
} else if (WLED_CONNECTED) {
#ifndef WLED_DISABLE_MQTT
if (mqttEnabled && mqttServer[0] != 0 && !WLED_MQTT_CONNECTED) {
c = RGBW32(255,96,0,0);
nextType = 3;
blinkIntervalMs = 250;
} else
#endif
{
c = RGBW32(0,255,0,0);
nextType = 1;
}
} else if (WLED_WIFI_CONFIGURED) {
c = RGBW32(255,0,0,0);
nextType = 3;
blinkIntervalMs = 250;
}
if (nextType != ledStatusType) {
ledStatusType = nextType;
ledStatusLastMillis = millis();
ledStatusState = (nextType == 1);
writeStatusIndicator(ledStatusState ? c : 0);
return;
}
if (nextType == 0) {
if (ledStatusState) {
ledStatusState = false;
writeStatusIndicator(0);
}
return;
}
if (nextType == 1) {
if (!ledStatusState) {
ledStatusState = true;
writeStatusIndicator(c);
}
return;
}
if (millis() - ledStatusLastMillis >= blinkIntervalMs) {
ledStatusLastMillis = millis();
ledStatusState = !ledStatusState;
writeStatusIndicator(ledStatusState ? c : 0);
}
#endif
}

View File

@@ -751,12 +751,15 @@ WLED_GLOBAL bool doSerializeConfig _INIT(false); // flag to initiate savi
WLED_GLOBAL bool doReboot _INIT(false); // flag to initiate reboot from async handlers
WLED_GLOBAL bool doPublishMqtt _INIT(false);
// status led
#if defined(STATUSLED)
// status led / status pixel
#if defined(STATUSLED) || defined(STATUSPIXELPIN)
WLED_GLOBAL unsigned long ledStatusLastMillis _INIT(0);
WLED_GLOBAL uint8_t ledStatusType _INIT(0); // current status type - corresponds to number of blinks per second
WLED_GLOBAL uint8_t ledStatusType _INIT(0); // 0=off, 1=solid, 2=slow blink, 3=fast blink
WLED_GLOBAL bool ledStatusState _INIT(false); // the current LED state
#endif
#if defined(STATUSPIXELPIN)
WLED_GLOBAL BusDigital* statusPixelBus _INIT(nullptr);
#endif
// server library objects
WLED_GLOBAL AsyncWebServer server _INIT_N(((80)));