diff --git a/wled00/FX.h b/wled00/FX.h index 32086c50..ad1fd292 100644 --- a/wled00/FX.h +++ b/wled00/FX.h @@ -16,6 +16,10 @@ bool canUseSerial(void); // WLEDMM implemented in wled_serial.cpp void strip_wait_until_idle(String whoCalledMe); // WLEDMM implemented in FX_fcn.cpp bool strip_uses_global_leds(void) __attribute__((pure)); // WLEDMM implemented in FX_fcn.cpp +#ifdef WLED_ENABLE_GIF +struct Segment; // forward declaration +void endImagePlayback(Segment *seg); // implemented in image_loader.cpp +#endif #define FASTLED_INTERNAL //remove annoying pragma messages #define USE_GET_MILLISECOND_TIMER @@ -585,6 +589,9 @@ typedef struct Segment { #ifdef ARDUINO_ARCH_ESP32 strip_wait_until_idle("~Segment()"); #endif + #ifdef WLED_ENABLE_GIF + endImagePlayback(this); + #endif if ((Segment::_globalLeds == nullptr) && !strip_uses_global_leds() && (ledsrgb != nullptr)) {free(ledsrgb); ledsrgb = nullptr;} // WLEDMM we need "!strip_uses_global_leds()" to avoid crashes (#104) if (name) { delete[] name; name = nullptr; } diff --git a/wled00/FX_fcn.cpp b/wled00/FX_fcn.cpp index 879b93a2..991ed761 100644 --- a/wled00/FX_fcn.cpp +++ b/wled00/FX_fcn.cpp @@ -542,6 +542,9 @@ void Segment::setUp(uint16_t i1, uint16_t i2, uint8_t grp, uint8_t spc, uint16_t if (stop>start) markForBlank(); //turn old segment range off // WLEDMM stop > start // toDo: check if this can be skipped when boundsUnchanged if (i2 <= i1) { //disable segment + #ifdef WLED_ENABLE_GIF + endImagePlayback(this); + #endif stop = 0; markForReset(); return;