realtime mode bugfixes
- busses: ignore not valid bus instances - "use main segment only": prevent flickering du to intermitted strip.service().
This commit is contained in:
@@ -1908,7 +1908,7 @@ void WS2812FX::service() {
|
|||||||
if(nowUp >= seg.next_time || _triggered || (doShow && seg.mode == FX_MODE_STATIC)) // WLEDMM ">=" instead of ">"
|
if(nowUp >= seg.next_time || _triggered || (doShow && seg.mode == FX_MODE_STATIC)) // WLEDMM ">=" instead of ">"
|
||||||
{
|
{
|
||||||
if (seg.grouping == 0) seg.grouping = 1; //sanity check
|
if (seg.grouping == 0) seg.grouping = 1; //sanity check
|
||||||
doShow = true;
|
if (!seg.freeze) doShow = true;
|
||||||
uint16_t frameDelay = FRAMETIME; // WLEDMM avoid name clash with "delay" function
|
uint16_t frameDelay = FRAMETIME; // WLEDMM avoid name clash with "delay" function
|
||||||
|
|
||||||
if (!seg.freeze) { //only run effect function if not frozen
|
if (!seg.freeze) { //only run effect function if not frozen
|
||||||
|
|||||||
@@ -1308,6 +1308,7 @@ void IRAM_ATTR __attribute__((hot)) BusManager::setPixelColor(uint16_t pix, uint
|
|||||||
|
|
||||||
for (uint_fast8_t i = 0; i < numBusses; i++) { // WLEDMM use fast native types
|
for (uint_fast8_t i = 0; i < numBusses; i++) { // WLEDMM use fast native types
|
||||||
Bus* b = busses[i];
|
Bus* b = busses[i];
|
||||||
|
if (b->isValid() == false) continue; // WLEDMM ignore invalid (=not ready) busses
|
||||||
uint_fast16_t bstart = b->getStart();
|
uint_fast16_t bstart = b->getStart();
|
||||||
if (pix < bstart || pix >= bstart + b->getLength()) continue;
|
if (pix < bstart || pix >= bstart + b->getLength()) continue;
|
||||||
else {
|
else {
|
||||||
@@ -1346,6 +1347,7 @@ uint32_t IRAM_ATTR __attribute__((hot)) BusManager::getPixelColor(uint_fast16_t
|
|||||||
|
|
||||||
for (uint_fast8_t i = 0; i < numBusses; i++) {
|
for (uint_fast8_t i = 0; i < numBusses; i++) {
|
||||||
Bus* b = busses[i];
|
Bus* b = busses[i];
|
||||||
|
if (b->isValid() == false) continue; // WLEDMM ignore invalid (=not ready) busses
|
||||||
uint_fast16_t bstart = b->getStart();
|
uint_fast16_t bstart = b->getStart();
|
||||||
if (pix < bstart || pix >= bstart + b->getLength()) continue;
|
if (pix < bstart || pix >= bstart + b->getLength()) continue;
|
||||||
else {
|
else {
|
||||||
@@ -1369,6 +1371,7 @@ uint32_t IRAM_ATTR __attribute__((hot)) BusManager::getPixelColorRestored(uint_
|
|||||||
|
|
||||||
for (uint_fast8_t i = 0; i < numBusses; i++) {
|
for (uint_fast8_t i = 0; i < numBusses; i++) {
|
||||||
Bus* b = busses[i];
|
Bus* b = busses[i];
|
||||||
|
if (b->isValid() == false) continue; // WLEDMM ignore invalid (=not ready) busses
|
||||||
uint_fast16_t bstart = b->getStart();
|
uint_fast16_t bstart = b->getStart();
|
||||||
if (pix < bstart || pix >= bstart + b->getLength()) continue;
|
if (pix < bstart || pix >= bstart + b->getLength()) continue;
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -190,6 +190,7 @@ class Bus {
|
|||||||
inline uint8_t getAutoWhiteMode() const { return _autoWhiteMode; }
|
inline uint8_t getAutoWhiteMode() const { return _autoWhiteMode; }
|
||||||
inline static void setGlobalAWMode(uint8_t m) { if (m < 5) _gAWM = m; else _gAWM = AW_GLOBAL_DISABLED; }
|
inline static void setGlobalAWMode(uint8_t m) { if (m < 5) _gAWM = m; else _gAWM = AW_GLOBAL_DISABLED; }
|
||||||
inline static uint8_t getGlobalAWMode() { return _gAWM; }
|
inline static uint8_t getGlobalAWMode() { return _gAWM; }
|
||||||
|
inline bool isValid() const {return _valid;}
|
||||||
|
|
||||||
inline static uint32_t restore_Color_Lossy(uint32_t c, uint8_t restoreBri) { // shamelessly grabbed from upstream, who grabbed from NPB, who ..
|
inline static uint32_t restore_Color_Lossy(uint32_t c, uint8_t restoreBri) { // shamelessly grabbed from upstream, who grabbed from NPB, who ..
|
||||||
if (restoreBri < 255) {
|
if (restoreBri < 255) {
|
||||||
|
|||||||
@@ -155,8 +155,13 @@ void realtimeLock(uint32_t timeoutMs, byte md)
|
|||||||
if (!realtimeMode && !realtimeOverride) {
|
if (!realtimeMode && !realtimeOverride) {
|
||||||
// this code runs once when we enter realtime mode
|
// this code runs once when we enter realtime mode
|
||||||
// WLEDMM begin - we need to init segment caches before putting any pixels
|
// WLEDMM begin - we need to init segment caches before putting any pixels
|
||||||
|
USER_PRINT(F("realtimeLock() entering realtime mode [timeoutMs="));
|
||||||
|
USER_PRINT(timeoutMs); USER_PRINT(",mode="); USER_PRINT(md);
|
||||||
|
if (useMainSegmentOnly) USER_PRINTLN(F(", main segment only].")) else USER_PRINTLN(F("]."));
|
||||||
|
USER_FLUSH();
|
||||||
|
|
||||||
if (strip.isServicing()) {
|
if (strip.isServicing()) {
|
||||||
USER_PRINTLN(F("realtimeLock() enter RTM: strip is still drawing effects."));
|
USER_PRINTLN(F("realtimeLock() entering RTM: strip is still drawing effects."));
|
||||||
strip.waitUntilIdle();
|
strip.waitUntilIdle();
|
||||||
}
|
}
|
||||||
strip.service(); // WLEDMM make sure that all segments are properly initialized
|
strip.service(); // WLEDMM make sure that all segments are properly initialized
|
||||||
@@ -211,6 +216,7 @@ void exitRealtime() {
|
|||||||
strip.show(); // possible fix for #3589
|
strip.show(); // possible fix for #3589
|
||||||
}
|
}
|
||||||
busses.invalidateCache(false); // WLEDMM
|
busses.invalidateCache(false); // WLEDMM
|
||||||
|
USER_PRINTLN(F("exitRealtime() realtime mode ended."));
|
||||||
updateInterfaces(CALL_MODE_WS_SEND);
|
updateInterfaces(CALL_MODE_WS_SEND);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user