FxParticlesystem Fix memory calculation of framebuffer size #275
Updated memory calculation for CRGB to use virtual width and height. Somehow virtualLength is not reliable, so use vWidth * vHeight
This commit is contained in:
@@ -1103,7 +1103,7 @@ bool allocateParticleSystemMemory2D(uint32_t numparticles, uint32_t numsources,
|
|||||||
if (sizecontrol)
|
if (sizecontrol)
|
||||||
requiredmemory += sizeof(PSsizeControl) * numparticles;
|
requiredmemory += sizeof(PSsizeControl) * numparticles;
|
||||||
requiredmemory += sizeof(PSsource) * numsources;
|
requiredmemory += sizeof(PSsource) * numsources;
|
||||||
requiredmemory += sizeof(CRGB) * SEGMENT.virtualLength(); // virtualLength is witdh * height
|
requiredmemory += sizeof(CRGB) * uint32_t(SEGMENT.calc_virtualWidth()) * uint32_t(SEGMENT.calc_virtualHeight()); // virtualLength not reliable, better to use vWidth * vHeight
|
||||||
requiredmemory += additionalbytes + 3; // add 3 to ensure there is room for stuffing bytes
|
requiredmemory += additionalbytes + 3; // add 3 to ensure there is room for stuffing bytes
|
||||||
//requiredmemory = (requiredmemory + 3) & ~0x03; // align memory block to next 4-byte boundary
|
//requiredmemory = (requiredmemory + 3) & ~0x03; // align memory block to next 4-byte boundary
|
||||||
PSPRINTLN("mem alloc: " + String(requiredmemory));
|
PSPRINTLN("mem alloc: " + String(requiredmemory));
|
||||||
@@ -1938,4 +1938,4 @@ static bool checkBoundsAndWrap(int32_t &position, const int32_t max, const int32
|
|||||||
c.b = ((c.b * scale) >> 8);
|
c.b = ((c.b * scale) >> 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // !(defined(WLED_DISABLE_PARTICLESYSTEM2D) && defined(WLED_DISABLE_PARTICLESYSTEM1D))
|
#endif // !(defined(WLED_DISABLE_PARTICLESYSTEM2D) && defined(WLED_DISABLE_PARTICLESYSTEM1D))
|
||||||
|
|||||||
Reference in New Issue
Block a user