From 61c2ba98b7dbed99554cf5d138b23fd9eeabc64c Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Sun, 24 Nov 2024 17:32:59 +0100 Subject: [PATCH] HUB75 small speedup gave me 1-3 extra FPS on -S3 with 128x64 --- wled00/bus_manager.cpp | 12 ++++++------ wled00/bus_manager.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/wled00/bus_manager.cpp b/wled00/bus_manager.cpp index e414bf61..5dd51d0a 100644 --- a/wled00/bus_manager.cpp +++ b/wled00/bus_manager.cpp @@ -1056,7 +1056,7 @@ BusHub75Matrix::BusHub75Matrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWh USER_PRINT(F("heap usage: ")); USER_PRINTLN(int(lastHeap - ESP.getFreeHeap())); } -void __attribute__((hot)) BusHub75Matrix::setPixelColor(uint16_t pix, uint32_t c) { +void __attribute__((hot)) IRAM_ATTR BusHub75Matrix::setPixelColor(uint16_t pix, uint32_t c) { if (!_valid || pix >= _len) return; // if (_cct >= 1900) c = colorBalanceFromKelvin(_cct, c); //color correction from CCT @@ -1097,12 +1097,12 @@ void __attribute__((hot)) BusHub75Matrix::setPixelColor(uint16_t pix, uint32_t c #endif } -uint32_t BusHub75Matrix::getPixelColor(uint16_t pix) const { +uint32_t IRAM_ATTR BusHub75Matrix::getPixelColor(uint16_t pix) const { if (!_valid || pix >= _len || !_ledBuffer) return BLACK; return uint32_t(_ledBuffer[pix].scale8(_bri)) & 0x00FFFFFF; // scale8() is needed to mimic NeoPixelBus, which returns scaled-down colours } -uint32_t __attribute__((hot)) BusHub75Matrix::getPixelColorRestored(uint16_t pix) const { +uint32_t __attribute__((hot)) IRAM_ATTR BusHub75Matrix::getPixelColorRestored(uint16_t pix) const { if (!_valid || pix >= _len || !_ledBuffer) return BLACK; return uint32_t(_ledBuffer[pix]) & 0x00FFFFFF; } @@ -1117,7 +1117,7 @@ void BusHub75Matrix::setBrightness(uint8_t b, bool immediate) { if (display) display->setBrightness(_bri); } -void __attribute__((hot)) BusHub75Matrix::show(void) { +void __attribute__((hot)) IRAM_ATTR BusHub75Matrix::show(void) { if (!_valid) return; MatrixPanel_I2S_DMA* display = BusHub75Matrix::activeDisplay; if (!display) return; @@ -1277,8 +1277,8 @@ void BusManager::removeAll() { lastend = 0; } -void BusManager::show() { - for (uint8_t i = 0; i < numBusses; i++) { +void __attribute__((hot)) BusManager::show() { + for (unsigned i = 0; i < numBusses; i++) { busses[i]->show(); } } diff --git a/wled00/bus_manager.h b/wled00/bus_manager.h index cef0286d..69f3aa2d 100644 --- a/wled00/bus_manager.h +++ b/wled00/bus_manager.h @@ -191,7 +191,7 @@ class Bus { 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 uint32_t restore_Color_Lossy(uint32_t c, uint8_t restoreBri) const { // 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) { uint8_t* chan = (uint8_t*) &c; for (uint_fast8_t i=0; i<4; i++) {