Skip to content

Commit

Permalink
HUB75 small speedup
Browse files Browse the repository at this point in the history
gave me 1-3 extra FPS on -S3 with 128x64
  • Loading branch information
softhack007 committed Nov 24, 2024
1 parent 37c7bb1 commit 61c2ba9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions wled00/bus_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
Expand Down Expand Up @@ -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();
}
}
Expand Down
2 changes: 1 addition & 1 deletion wled00/bus_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down

0 comments on commit 61c2ba9

Please sign in to comment.