trying to reduce flickering
The NeoPixelBus RMT driver seems to get stalled when ESP.get.... functions are called (big kernel lock?). Also its glitching during flash file access. This change tries to avoid some conflicts by first checking that the driver is not sending.
This commit is contained in:
@@ -1192,8 +1192,8 @@ class PolyBus {
|
||||
if (num > 7) return I_NONE;
|
||||
#else
|
||||
if (num > 8) return I_NONE;
|
||||
if (num == 1) offset = 2; // use I2S#1 as 2nd bus - seems to be a good compromise for performance, and reduces flickering for some users
|
||||
// if (num == 0) offset = 2; // un-comment to use I2S#1 as 1st bus - sometimes helps, if you experience flickering during Wifi or filesystem activity.
|
||||
//if (num == 1) offset = 2; // use I2S#1 as 2nd bus - seems to be a good compromise for performance, and reduces flickering for some users
|
||||
if (num == 0) offset = 2; // un-comment to use I2S#1 as 1st bus - sometimes helps, if you experience flickering during Wifi or filesystem activity.
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -35,6 +35,14 @@ static File f; // don't export to other cpp files
|
||||
|
||||
//wrapper to find out how long closing takes
|
||||
void closeFile() {
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
// WLEDMM: file.close() triggers flash writing. While flash is writing, the NPB RMT driver cannot fill its buffer which may create glitches.
|
||||
unsigned long t_wait = millis();
|
||||
while(strip.isUpdating() && (millis() - t_wait < 72)) delay(1); // WLEDMM try to catch a moment when strip is idle
|
||||
while(strip.isUpdating() && (millis() - t_wait < 96)) delay(0); // try harder
|
||||
//if (strip.isUpdating()) USER_PRINTLN("closeFile: strip still updating.");
|
||||
delay(2); // might help
|
||||
#endif
|
||||
#ifdef WLED_DEBUG_FS
|
||||
DEBUGFS_PRINT(F("Close -> "));
|
||||
uint32_t s = millis();
|
||||
|
||||
@@ -1032,6 +1032,14 @@ void serializeInfo(JsonObject root)
|
||||
if(ESP.getChipCores() > 1) // WLEDMM
|
||||
root[F("resetReason1")] = (int)rtc_get_reset_reason(1);
|
||||
#endif
|
||||
|
||||
#if defined(ARDUINO_ARCH_ESP32)
|
||||
unsigned long t_wait = millis();
|
||||
while(strip.isUpdating() && (millis() - t_wait < 125)) delay(1); // WLEDMM try to catch a moment when strip is idle
|
||||
while(strip.isUpdating() && (millis() - t_wait < 160)) yield(); // try harder
|
||||
//if (strip.isUpdating()) USER_PRINTLN("serializeInfo: strip still updating.");
|
||||
#endif
|
||||
|
||||
root[F("lwip")] = 0; //deprecated
|
||||
root[F("totalheap")] = ESP.getHeapSize(); //WLEDMM
|
||||
#else
|
||||
|
||||
@@ -1031,6 +1031,12 @@ bool WLED::initEthernet()
|
||||
|
||||
void WLED::initConnection()
|
||||
{
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
unsigned long t_wait = millis();
|
||||
while(strip.isUpdating() && (millis() - t_wait < 86)) delay(1); // WLEDMM try to catch a moment when strip is idle
|
||||
//if (strip.isUpdating()) USER_PRINTLN("WLED::initConnection: strip still updating.");
|
||||
#endif
|
||||
|
||||
#ifdef WLED_ENABLE_WEBSOCKETS
|
||||
ws.onEvent(wsEvent);
|
||||
#endif
|
||||
@@ -1208,7 +1214,7 @@ void WLED::handleConnection()
|
||||
static unsigned retryCount = 0; // WLEDMM
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
// reconnect WiFi to clear stale allocations if heap gets too low
|
||||
if (now - heapTime > 5000) { // WLEDMM: updated with better logic for small heap available by block, not total.
|
||||
if ((!strip.isUpdating()) && (now - heapTime > 5000)) { // WLEDMM: updated with better logic for small heap available by block, not total. // WLEDMM trying to use a moment when the strip is idle
|
||||
#if defined(ARDUINO_ARCH_ESP32S2)
|
||||
uint32_t heap = ESP.getFreeHeap(); // WLEDMM works better on -S2
|
||||
#else
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
// version code in format yymmddb (b = daily build)
|
||||
#define VERSION 2404230
|
||||
#define VERSION 2404260
|
||||
|
||||
// WLEDMM - you can check for this define in usermods, to only enabled WLEDMM specific code in the "right" fork. Its not defined in AC WLED.
|
||||
#define _MoonModules_WLED_
|
||||
|
||||
Reference in New Issue
Block a user