From 56e72ef22db4de414ae7bcf7dbf14d3a408ad1e7 Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Thu, 8 Aug 2024 20:57:15 +0200 Subject: [PATCH] HUB75 live preview --- wled00/bus_manager.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wled00/bus_manager.cpp b/wled00/bus_manager.cpp index 08743552..ced434a4 100644 --- a/wled00/bus_manager.cpp +++ b/wled00/bus_manager.cpp @@ -695,6 +695,8 @@ BusHub75Matrix::BusHub75Matrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWh else { _valid = true; display->clearScreen(); // initially clear the screen buffer + display->setBrightness8(127); // range is 0-255, 0 - 0%, 255 - 100% + _bri = 127; if (_ledBuffer) free(_ledBuffer); // should not happen if (_ledsDirty) free(_ledsDirty); // should not happen @@ -781,13 +783,14 @@ void __attribute__((hot)) BusHub75Matrix::setPixelColor(uint16_t pix, uint32_t c uint32_t BusHub75Matrix::getPixelColor(uint16_t pix) const { if (!_valid || pix >= _len) return BLACK; if (_ledBuffer) - return uint32_t(_ledBuffer[pix]) & 0x00FFFFFF; + return uint32_t(_ledBuffer[pix].scale8(_bri)) & 0x00FFFFFF; // scale8() is needed to mimic NeoPixelBus, which returns scaled-down colours else return BLACK; } void BusHub75Matrix::setBrightness(uint8_t b, bool immediate) { this->display->setBrightness(b); + _bri = b; } void __attribute__((hot)) BusHub75Matrix::show(void) {