Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/gettingstarted/installer.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ For devices that already have MoonLight installed, go to [Update](#update-moonli

## Prepare an ESP32 device

Recommended plug-and-play device to get started with, up to 1024 LEDs @ 30FPS (one output) or 4096 LEDs over the network (Art-Net): [QuinLED-dig2go](https://quinled.info/quinled-dig2go/)
Recommended plug-and-play device to get started, up to 2048 LEDs @ 30FPS (two outputs) or 10K+ LEDs over the network (Art-Net): [QuinLED-DigNext2](https://quinled.info/dig-next-2)

![Dig2Go](https://shop.allnetchina.cn/cdn/shop/products/Led_4.jpg?v=1680836018&width=1600){: style="width:250px"}
![DigNext2](https://quinled.info/wp-content/uploads/2026/01/P1087754-Enhanced-NR-2560x1358.jpg){: style="width:250px"}

Recommended low-cost DIY board up to 10K LEDs: [ESP32-S3 n16r8](https://s.click.aliexpress.com/e/_DBAtJ2H){:target="_blank"}

Expand Down
3 changes: 0 additions & 3 deletions firmware/esp32-d0.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ build_flags = ${env.build_flags}
; ${ESP32_LEDSDRIVER.build_flags} ;use the LedsDriver class only for setBrightness and setColorCorrection and LUT
${HP_ALL_DRIVERS.build_flags}
; -D ML_LIVE_MAPPING
; -D FASTLED_RMT_BUILTIN_DRIVER=true
; -D FASTLED_ESP32_HAS_RMT5 ; avoid flickering (on IDF 5 with WiFi)
; -D FASTLED_RMT5=1
lib_deps = ${env.lib_deps}
${moonlight.lib_deps}
; ${livescripts.lib_deps}
Expand Down
5 changes: 1 addition & 4 deletions firmware/esp32-s3.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,11 @@ build_flags =
; -D ARDUINO_USB_MSC_ON_BOOT=0 ;Mass Storage Class, disable
; -D ARDUINO_USB_DFU_ON_BOOT=0 ;download firmware update, disable
; -D ML_LIVE_MAPPING
; Do not use the following FastLED settings! As we use the better version of this in Parallel LED Driverer
; -D FASTLED_USES_ESP32S3_I2S ; S3 boards use the I2S driver (RMT is not supporting more then 4 outputs)
; -DCOLOR_ORDER_RGB=1 ; not working yet, see also https://github.com/FastLED/FastLED/issues/1966, should use ML_COLOR_ORDER / FastLED.addLeds(RGB_ORDER), workaround change #define COLOR_ORDER_RBG in driver.h
lib_deps =
${env.lib_deps}
${moonlight.lib_deps}
${livescripts.lib_deps}
${HP_ALL_DRIVERS.lib_deps} ; FASTLED_USES_ESP32S3_I2S instead!
${HP_ALL_DRIVERS.lib_deps}



Expand Down
4 changes: 3 additions & 1 deletion lib/framework/CoreDump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
#include "esp_partition.h"
#include "esp_flash.h"

#define MIN(a, b) ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a < _b ? _a : _b; })
#ifndef MIN // 🌙
#define MIN(a, b) ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a < _b ? _a : _b; })
#endif

CoreDump::CoreDump(PsychicHttpServer *server,
SecurityManager *securityManager) : _server(server),
Expand Down
2 changes: 1 addition & 1 deletion lib/framework/WiFiSettingsService.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class WiFiSettings
root["hostname"] = settings.hostname;
root["connection_mode"] = settings.staConnectionMode;
root["txPower"] = settings.txPower;//(uint8_t )WiFi.getTxPower();
root["txPowerMeasured"] = abs(WiFi.getTxPower());
root["txPowerMeasured"] = std::abs(WiFi.getTxPower()); // 🌙 std:: to avoid ambuigity
root["trackAnalytics"] = settings.trackAnalytics;

// create JSON array from root
Expand Down
27 changes: 11 additions & 16 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,20 @@ framework = arduino ;espidf will not work as libs rely on arduino (e.g. PhysicHT
; platform = https://github.com/tasmota/platform-espressif32/releases/download/2025.05.30/platform-espressif32.zip ;; Platform Tasmota Arduino Core 3.1.3.250504based on IDF 5.3.3.250501platform_packages
; platform_packages = framework-arduinoespressif32 @ 3.1.3

platform = https://github.com/pioarduino/platform-espressif32/releases/download/55.03.35/platform-espressif32.zip ; Sep 20, check latest: https://github.com/pioarduino/platform-espressif32/releases
platform = https://github.com/pioarduino/platform-espressif32/releases/download/55.03.37/platform-espressif32.zip ; Sep 20, check latest: https://github.com/pioarduino/platform-espressif32/releases
build_flags =
${factory_settings.build_flags}
${features.build_flags}
-D BUILD_TARGET=\"$PIOENV\"
-D APP_NAME=\"MoonLight\" ; 🌙 Must only contain characters from [a-zA-Z0-9-_] as this is converted into a filename
-D APP_VERSION=\"0.8.1\" ; semver compatible version string
-D APP_DATE=\"20260204\" ; 🌙
-D APP_DATE=\"20260212\" ; 🌙

-D PLATFORM_VERSION=\"pioarduino-55.03.35\" ; 🌙 make sure it matches with above plaftform
-D PLATFORM_VERSION=\"pioarduino-55.03.37\" ; 🌙 make sure it matches with above plaftform

-D FT_MOONBASE=1

-D HTTPD_STACK_SIZE=5120 ; default 4096 but not enough for more complex read and update
-D HTTPD_STACK_SIZE=6144 ; default 4096 but not enough for more complex read and update , 5120 not enough when switching from FastLED to parallel LED driver
-D SVELTEKIT_STACK_SIZE=6144 ; psramFound() ? 8 * 1024 : 6 * 1024🌙 4096 to 8192 / 6144

; 🌙 Move ESP32SvelteKit (HTTP/WebSocket) to Core 1 (APP_CPU) to avoid WiFi preemption on Core 0
Expand Down Expand Up @@ -114,7 +114,7 @@ build_flags =
; Uncomment to use JSON instead of MessagePack for event messages. Default is MessagePack.
; -D EVENT_USE_JSON=1 ; 💫 switch off for FT_MONITOR

-D NROF_END_POINTS=160 ; 💫 increase number of endpoints to 160, default is 120, one PsychicEndpoint is 56 bytes -> 8960 bytes
-D NROF_END_POINTS=160 ; 💫 sets _server->config.max_uri_handlers. increase number of endpoints to 160, default is 120, one PsychicEndpoint is 56 bytes -> 8960 bytes

lib_compat_mode = strict

Expand Down Expand Up @@ -149,17 +149,12 @@ build_flags =
-D FT_MOONLIGHT=1
-D FT_MONITOR=1
-D EFFECTS_STACK_SIZE=3072 ; psramFound() ? 4 * 1024 : 3 * 1024
-D DRIVERS_STACK_SIZE=4096 ; psramFound() ? 4 * 1024 : 3 * 1024

; FastLED pre-compiled settings:
; ML_CHIPSET: Used by FastLED driver.init
-D ML_CHIPSET=WS2812B ; RGB, for fairy lights or https://www.waveshare.com/wiki/ESP32-S3-Matrix
; -D ML_CHIPSET=APA106 ; for Cube202020 / some fairy curtain strings do not work with WS2812B
; -D ML_CHIPSET=SK6812 ; 🚧
-D ML_COLOR_ORDER=GRB ; define your color order here if needed (why WS2812 has GRB instead of RGB?) Only for FastLED, PD software configurable
; -D ML_RGBW=1 ; define whether to enable RGBW (1 = yes, 0 = no) ... could be derived from ML_CHIPSET???
-D DRIVERS_STACK_SIZE=4096 ; psramFound() ? 4 * 1024 : 3 * 1024, 4096 is sufficient for now

; -D FASTLED_TESTING ; causes duplicate definition of initSpiHardware(); - workaround: removed implementation in spi_hw_manager_esp32.cpp.hpp
-D FASTLED_BUILD=\"20260212\"
lib_deps =
https://github.com/FastLED/FastLED.git#3.10.3 ; sept 2025
https://github.com/FastLED/FastLED#ea5d2d7aadcd5697f912a1c32bb3b7e9891f949b ; master 20260212
https://github.com/ewowi/WLED-sync#25f280b5e8e47e49a95282d0b78a5ce5301af4fe ; sourceIP + fftUdp.clear() if arduino >=3 (20251104)

; 💫 currently only enabled on s3 as esp32dev runs over 100%
Expand Down Expand Up @@ -194,7 +189,7 @@ lib_deps =
[HP_ALL_DRIVERS]
build_flags =
-D HP_ALL_DRIVERS
-D HP_ALL_VERSION=\"20260120\"
-D HP_ALL_BUILD=\"20260120\"
lib_deps =
; https://github.com/ewowi/I2SClocklessLedDriver.git#5d5508ca38a15497392950d4249cd0d910c3505d
; https://github.com/ewowi/I2SClocklessLedDriver.git#d8cdb31f8b0d52c0562eb5b0ce4723e26f0dc62f
Expand Down
4 changes: 2 additions & 2 deletions src/MoonBase/Module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ bool ModuleState::checkReOrderSwap(const JsonString& parent, const JsonVariant&
uint8_t parkedAtIndex;
uint8_t parkedFromIndex = UINT8_MAX;

// size_t minSize = min(stateArray.size(), newArray.size());
// size_t minSize = MIN(stateArray.size(), newArray.size());
for (uint8_t stateIndex = 0; stateIndex < stateArray.size(); stateIndex++) { //} JsonObject stateObject : stateArray) {
for (uint8_t newIndex = 0; newIndex < stateArray.size(); newIndex++) { //} JsonObject newObject : newArray) {
if (stateIndex != newIndex && stateArray[stateIndex] == newArray[newIndex]) {
Expand Down Expand Up @@ -160,7 +160,7 @@ bool ModuleState::compareRecursive(const JsonString& parent, const JsonVariant&

// EXT_LOGD(MB_TAG, "compare %s[%d] %s = %s -> %s", parent.c_str(), index, key.c_str(), stateValue.as<const char*>(), newValue.as<const char*>());

for (int i = 0; i < max(stateArray.size(), newArray.size()); i++) { // compare each item in the array
for (int i = 0; i < MAX(stateArray.size(), newArray.size()); i++) { // compare each item in the array
// EXT_LOGD(MB_TAG, "compare %s[%d] %s = %s -> %s", parent.c_str(), index, key.c_str(), stateArray[i].as<const char*>(), newArray[i].as<const char*>());
if (i >= stateArray.size()) { // newArray has added a row
// EXT_LOGD(MB_TAG, "add %s.%s[%d] (%d/%d) d: %d", parent.c_str(), key.c_str(), i, stateArray.size(), newArray.size(), depth);
Expand Down
2 changes: 1 addition & 1 deletion src/MoonBase/Module.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class Module : public StatefulService<ModuleState> {

if (requestUIUpdate) {
requestUIUpdate = false; // reset the flag
EXT_LOGD(ML_TAG, "requestUIUpdate");
EXT_LOGD(ML_TAG, "requestUIUpdate %s", _moduleName);

// update state to UI
update(
Expand Down
2 changes: 1 addition & 1 deletion src/MoonBase/Nodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ void LiveScriptNode::setup() {
addExternal("uint32_t millis()", (void*)millis);
addExternal("uint32_t now()", (void*)millis); // todo: synchronized time (sys->now)
addExternal("uint16_t random16(uint16_t)", (void*)(uint16_t (*)(uint16_t))random16);
addExternal("void delay(uint32_t)", (void*)delay);
addExternal("void delay(uint32_t)", (void*)((void (*)(uint32_t))delay));
addExternal("void pinMode(uint8_t,uint8_t)", (void*)pinMode);
addExternal("void digitalWrite(uint8_t,uint8_t)", (void*)digitalWrite);

Expand Down
2 changes: 1 addition & 1 deletion src/MoonBase/SharedHttpEndpoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ class SharedHttpEndpoint {

private:
esp_err_t handleGet(PsychicRequest* request) {
EXT_LOGD(ML_TAG, "search module %s", request->path().c_str());
Module* module = findModule(request->path());
EXT_LOGD(ML_TAG, "search module %s: %p", request->path().c_str(), module);
if (!module) return request->reply(404);

PsychicJsonResponse response = PsychicJsonResponse(request, false);
Expand Down
2 changes: 1 addition & 1 deletion src/MoonBase/SharedWebSocketServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ class SharedWebSocketServer {

// Handle incoming frame data
if (frame->type == HTTPD_WS_TYPE_TEXT) {
EXT_LOGD(ML_TAG, "search module %s", request->url());
Module* module = findModule(request->url());
EXT_LOGD(ML_TAG, "search module %s: %p", request->path().c_str(), module);
if (module) {
JsonDocument doc;
DeserializationError error = deserializeJson(doc, (char*)frame->payload, frame->len);
Expand Down
11 changes: 10 additions & 1 deletion src/MoonBase/Utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,15 @@
#define MB_TAG "🌙"
#define ML_TAG "💫"

#ifndef MIN
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#endif

#ifndef MAX
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
#endif


struct Coord3D {
int x;
int y;
Expand Down Expand Up @@ -134,7 +143,7 @@ struct Coord3D {
return *this;
}

Coord3D maximum(const Coord3D rhs) const { return Coord3D(max(x, rhs.x), max(y, rhs.y), max(z, rhs.z)); }
Coord3D maximum(const Coord3D rhs) const { return Coord3D(MAX(x, rhs.x), MAX(y, rhs.y), MAX(z, rhs.z)); }

unsigned distanceSquared(const Coord3D rhs) const {
Coord3D delta = (*this - rhs);
Expand Down
4 changes: 2 additions & 2 deletions src/MoonLight/Layers/VirtualLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

// convenience functions to call fastled functions out of the Leds namespace (there naming conflict)
void fastled_fadeToBlackBy(CRGB* leds, uint16_t num_leds, uint8_t fadeBy) { fadeToBlackBy(leds, num_leds, fadeBy); } // supports max UINT16_MAX leds !
void fastled_fill_solid(struct CRGB* targetArray, int numToFill, const CRGB& color) { fill_solid(targetArray, numToFill, color); }
void fastled_fill_rainbow(struct CRGB* targetArray, int numToFill, uint8_t initialhue, uint8_t deltahue) { fill_rainbow(targetArray, numToFill, initialhue, deltahue); }
void fastled_fill_solid(CRGB* targetArray, int numToFill, const CRGB& color) { fill_solid(targetArray, numToFill, color); }
void fastled_fill_rainbow(CRGB* targetArray, int numToFill, uint8_t initialhue, uint8_t deltahue) { fill_rainbow(targetArray, (uint16_t)numToFill, initialhue, deltahue); }

VirtualLayer::VirtualLayer() { EXT_LOGV(ML_TAG, "constructor"); }

Expand Down
27 changes: 16 additions & 11 deletions src/MoonLight/Layers/VirtualLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,12 @@ class VirtualLayer {
void setRGB(const nrOfLights_t indexV, CRGB color) {
if (indexV < mappingTableSize && mappingTable[indexV].mapType == m_zeroLights) {
#ifdef BOARD_HAS_PSRAM
memcpy(mappingTable[indexV].rgb, &color, 3);
memcpy(mappingTable[indexV].rgb, (void*)&color, 3);
#else
mappingTable[indexV].rgb = ((min(color[0] + 3, 255) >> 3) << 9) + ((min(color[1] + 3, 255) >> 3) << 4) + (min(color[2] + 7, 255) >> 4);
mappingTable[indexV].rgb = ((MIN(color[0] + 3, 255) >> 3) << 9) + ((MIN(color[1] + 3, 255) >> 3) << 4) + (MIN(color[2] + 7, 255) >> 4);
#endif
} else
forEachLightIndex(indexV, [&](nrOfLights_t indexP) { memcpy(&layerP->lights.channelsE[indexP * layerP->lights.header.channelsPerLight + layerP->lights.header.offsetRGBW], &color, sizeof(color)); });
forEachLightIndex(indexV, [&](nrOfLights_t indexP) { memcpy(&layerP->lights.channelsE[indexP * layerP->lights.header.channelsPerLight + layerP->lights.header.offsetRGBW], (void*)&color, sizeof(color)); });
}
void setRGB(Coord3D pos, CRGB color) { setRGB(XYZ(pos), color); }

Expand Down Expand Up @@ -198,17 +198,17 @@ class VirtualLayer {
void setGobo(Coord3D pos, const uint8_t value) { setGobo(XYZ(pos), value); }

void setRGB1(const nrOfLights_t indexV, CRGB color) {
if (layerP->lights.header.offsetRGBW1 != UINT8_MAX) forEachLightIndex(indexV, [&](nrOfLights_t indexP) { memcpy(&layerP->lights.channelsE[indexP * layerP->lights.header.channelsPerLight + layerP->lights.header.offsetRGBW1], &color, sizeof(color)); });
if (layerP->lights.header.offsetRGBW1 != UINT8_MAX) forEachLightIndex(indexV, [&](nrOfLights_t indexP) { memcpy(&layerP->lights.channelsE[indexP * layerP->lights.header.channelsPerLight + layerP->lights.header.offsetRGBW1], (void*)&color, sizeof(color)); });
}
void setRGB1(Coord3D pos, CRGB color) { setRGB1(XYZ(pos), color); }

void setRGB2(const nrOfLights_t indexV, CRGB color) {
if (layerP->lights.header.offsetRGBW2 != UINT8_MAX) forEachLightIndex(indexV, [&](nrOfLights_t indexP) { memcpy(&layerP->lights.channelsE[indexP * layerP->lights.header.channelsPerLight + layerP->lights.header.offsetRGBW2], &color, sizeof(color)); });
if (layerP->lights.header.offsetRGBW2 != UINT8_MAX) forEachLightIndex(indexV, [&](nrOfLights_t indexP) { memcpy(&layerP->lights.channelsE[indexP * layerP->lights.header.channelsPerLight + layerP->lights.header.offsetRGBW2], (void*)&color, sizeof(color)); });
}
void setRGB2(Coord3D pos, CRGB color) { setRGB2(XYZ(pos), color); }

void setRGB3(const nrOfLights_t indexV, CRGB color) {
if (layerP->lights.header.offsetRGBW3 != UINT8_MAX) forEachLightIndex(indexV, [&](nrOfLights_t indexP) { memcpy(&layerP->lights.channelsE[indexP * layerP->lights.header.channelsPerLight + layerP->lights.header.offsetRGBW3], &color, sizeof(color)); });
if (layerP->lights.header.offsetRGBW3 != UINT8_MAX) forEachLightIndex(indexV, [&](nrOfLights_t indexP) { memcpy(&layerP->lights.channelsE[indexP * layerP->lights.header.channelsPerLight + layerP->lights.header.offsetRGBW3], (void*)&color, sizeof(color)); });
}
void setRGB3(Coord3D pos, CRGB color) { setRGB3(XYZ(pos), color); }

Expand Down Expand Up @@ -238,13 +238,18 @@ class VirtualLayer {
#endif
} else {
CRGB color = CRGB::Black;
forEachLightIndex(indexV, [&](nrOfLights_t indexP) { memcpy(&color, &layerP->lights.channelsE[indexP * layerP->lights.header.channelsPerLight + layerP->lights.header.offsetRGBW], sizeof(color)); }, true);
forEachLightIndex(indexV, [&](nrOfLights_t indexP) { memcpy((void*)&color, &layerP->lights.channelsE[indexP * layerP->lights.header.channelsPerLight + layerP->lights.header.offsetRGBW], sizeof(color)); }, true);
return color;
}
}
CRGB getRGB(Coord3D pos) { return getRGB(XYZ(pos)); }

void addRGB(const Coord3D& position, const CRGB& color) { setRGB(position, getRGB(position) + color); }
void addRGB(const Coord3D& position, const CRGB& color) {
// setRGB(position, getRGB(position) + color); + not working anymore in newest FastLED ???
CRGB result = getRGB(position);
result += color;
setRGB(position, result);
}

void blendColor(const nrOfLights_t indexV, const CRGB& color, uint8_t blendAmount) { setRGB(indexV, blend(color, getRGB(indexV), blendAmount)); }
void blendColor(Coord3D position, const CRGB& color, const uint8_t blendAmount) { blendColor(XYZ(position), color, blendAmount); }
Expand All @@ -255,23 +260,23 @@ class VirtualLayer {
CRGB getRGB1(const nrOfLights_t indexV) {
if (layerP->lights.header.offsetRGBW1 == UINT8_MAX) return CRGB::Black;
CRGB color = CRGB::Black;
forEachLightIndex(indexV, [&](nrOfLights_t indexP) { memcpy(&color, &layerP->lights.channelsE[indexP * layerP->lights.header.channelsPerLight + layerP->lights.header.offsetRGBW1], sizeof(color)); }, true);
forEachLightIndex(indexV, [&](nrOfLights_t indexP) { memcpy((void*)&color, &layerP->lights.channelsE[indexP * layerP->lights.header.channelsPerLight + layerP->lights.header.offsetRGBW1], sizeof(color)); }, true);
return color;
}
CRGB getRGB1(Coord3D pos) { return getRGB1(XYZ(pos)); }

CRGB getRGB2(const nrOfLights_t indexV) {
if (layerP->lights.header.offsetRGBW2 == UINT8_MAX) return CRGB::Black;
CRGB color = CRGB::Black;
forEachLightIndex(indexV, [&](nrOfLights_t indexP) { memcpy(&color, &layerP->lights.channelsE[indexP * layerP->lights.header.channelsPerLight + layerP->lights.header.offsetRGBW2], sizeof(color)); }, true);
forEachLightIndex(indexV, [&](nrOfLights_t indexP) { memcpy((void*)&color, &layerP->lights.channelsE[indexP * layerP->lights.header.channelsPerLight + layerP->lights.header.offsetRGBW2], sizeof(color)); }, true);
return color;
}
CRGB getRGB2(Coord3D pos) { return getRGB2(XYZ(pos)); }

CRGB getRGB3(const nrOfLights_t indexV) {
if (layerP->lights.header.offsetRGBW3 == UINT8_MAX) return CRGB::Black;
CRGB color = CRGB::Black;
forEachLightIndex(indexV, [&](nrOfLights_t indexP) { memcpy(&color, &layerP->lights.channelsE[indexP * layerP->lights.header.channelsPerLight + layerP->lights.header.offsetRGBW3], sizeof(color)); }, true);
forEachLightIndex(indexV, [&](nrOfLights_t indexP) { memcpy((void*)&color, &layerP->lights.channelsE[indexP * layerP->lights.header.channelsPerLight + layerP->lights.header.offsetRGBW3], sizeof(color)); }, true);
return color;
}
CRGB getRGB3(Coord3D pos) { return getRGB3(XYZ(pos)); }
Expand Down
6 changes: 3 additions & 3 deletions src/MoonLight/Nodes/Drivers/D_ArtnetIn.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class ArtNetInDriver : public Node {
continue;
}

artnetUdp.read(packetBuffer, min(packetSize, (int)sizeof(packetBuffer)));
artnetUdp.read(packetBuffer, MIN(packetSize, sizeof(packetBuffer)));

if (ddp)
handleDDP();
Expand Down Expand Up @@ -124,7 +124,7 @@ class ArtNetInDriver : public Node {
uint8_t* dmxData = packetBuffer + sizeof(ArtNetHeader);

int startPixel = (universe - universeMin) * (512 / layerP.lights.header.channelsPerLight);
int numPixels = min((uint16_t)(dataLength / layerP.lights.header.channelsPerLight), (uint16_t)(layerP.lights.header.nrOfLights - startPixel));
int numPixels = MIN(dataLength / layerP.lights.header.channelsPerLight, layerP.lights.header.nrOfLights - startPixel);

for (int i = 0; i < numPixels; i++) {
int ledIndex = startPixel + i;
Expand Down Expand Up @@ -155,7 +155,7 @@ class ArtNetInDriver : public Node {
uint8_t* pixelData = packetBuffer + sizeof(DDPHeader);

int startPixel = offset / layerP.lights.header.channelsPerLight;
int numPixels = min((uint16_t)(dataLen / layerP.lights.header.channelsPerLight), (uint16_t)(layerP.lights.header.nrOfLights - startPixel));
int numPixels = MIN(dataLen / layerP.lights.header.channelsPerLight, layerP.lights.header.nrOfLights - startPixel);

for (int i = 0; i < numPixels; i++) {
int ledIndex = startPixel + i;
Expand Down
2 changes: 1 addition & 1 deletion src/MoonLight/Nodes/Drivers/D_ArtnetOut.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class ArtNetOutDriver : public DriverNode {
TickType_t xLastWakeTime = xTaskGetTickCount();

void loop() override {
DriverNode::loop();
DriverNode::loop(); // this populates the LUT tables

LightsHeader* header = &layerP.lights.header;

Expand Down
Loading