small fixes

very minor changes:
* HUB75 bus don't leave _len uninitialized, handle display == nullptr before using display members
* __attribute__((pure)) was in the wrong location
* wled00.ino: made lps (loops-per-second) calculation a bit more accurate
This commit is contained in:
Frank
2024-10-03 00:19:18 +02:00
parent 3a38d0cfed
commit 1e5b246871
3 changed files with 12 additions and 3 deletions

View File

@@ -945,9 +945,9 @@ class WS2812FX { // 96 bytes
milliampsPerLed,
cctBlending,
getActiveSegmentsNum(void) const,
getFirstSelectedSegId(void) __attribute__((pure)),
__attribute__((pure)) getFirstSelectedSegId(void),
getLastActiveSegmentId(void) const,
getActiveSegsLightCapabilities(bool selectedOnly = false) __attribute__((pure)),
__attribute__((pure)) getActiveSegsLightCapabilities(bool selectedOnly = false),
setPixelSegment(uint8_t n);
inline uint8_t getBrightness(void) const { return _brightness; }

View File

@@ -527,6 +527,7 @@ BusHub75Matrix::BusHub75Matrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWh
_valid = false;
fourScanPanel = nullptr;
_len = 0;
mxconfig.double_buff = false; // Use our own memory-optimised buffer rather than the driver's own double-buffer
@@ -744,6 +745,11 @@ BusHub75Matrix::BusHub75Matrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWh
// OK, now we can create our matrix object
display = new MatrixPanel_I2S_DMA(mxconfig);
if (display == nullptr) {
USER_PRINTLN("****** MatrixPanel_I2S_DMA !KABOOM! driver allocation failed ***********");
USER_PRINT(F("heap usage: ")); USER_PRINTLN(lastHeap - ESP.getFreeHeap());
return;
}
this->_len = (display->width() * display->height());

View File

@@ -74,7 +74,10 @@ void loop() {
//WLEDMM show loops per second
loopCounter++;
if (millis() - lastMillis >= 10000) {
//USER_PRINTF("%lu lps\n",loopCounter/10);
long delta = millis() - lastMillis;
if (delta > 0) {
//USER_PRINTF("%lu lps\n",(loopCounter*1000U) / delta);
}
lastMillis = millis();
loopCounter = 0;
}