diff --git a/wled00/FX.cpp b/wled00/FX.cpp index 26633f53..d40013dd 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -2796,7 +2796,7 @@ typedef struct Ball { */ uint16_t mode_bouncing_balls(void) { //allocate segment data - const uint16_t strips = SEGMENT.map1D2D == M12_pBar ? SEGMENT.nrOfVStrips() : 1; + const uint16_t strips = SEGMENT.nrOfVStrips(); // adapt for 2D const size_t maxNumBalls = 16; uint16_t dataSize = sizeof(ball) * maxNumBalls; if (!SEGENV.allocateData(dataSize * strips)) return mode_static(); //allocation failed diff --git a/wled00/FX_fcn.cpp b/wled00/FX_fcn.cpp index 9168965e..1f80d824 100644 --- a/wled00/FX_fcn.cpp +++ b/wled00/FX_fcn.cpp @@ -410,7 +410,11 @@ uint16_t Segment::nrOfVStrips() const { uint16_t vLen = 1; #ifndef WLED_DISABLE_2D if (is2D()) { - vLen = virtualWidth(); + switch (map1D2D) { + case M12_pBar: + vLen = virtualWidth(); + break; + } } #endif return vLen; @@ -1435,7 +1439,7 @@ void WS2812FX::setTransitionMode(bool t) void WS2812FX::printSize() { size_t size = 0; - for (const Segment seg : _segments) size += seg.getSize(); + for (const Segment &seg : _segments) size += seg.getSize(); DEBUG_PRINTF("Segments: %d -> %uB\n", _segments.size(), size); DEBUG_PRINTF("Modes: %d*%d=%uB\n", sizeof(mode_ptr), _mode.size(), (_mode.capacity()*sizeof(mode_ptr))); DEBUG_PRINTF("Data: %d*%d=%uB\n", sizeof(const char *), _modeData.size(), (_modeData.capacity()*sizeof(const char *)));