Skip to content

Commit

Permalink
workaround for erroneous zone count
Browse files Browse the repository at this point in the history
  • Loading branch information
mkalkbrenner committed Dec 5, 2024
1 parent 5639d70 commit a7bf486
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 3 additions & 3 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ build_flags =
-DNO_GFX=1
-DZEDMD_WIFI=1
-DDISPLAY_LED_MATRIX=1
-DPIXEL_COLOR_DEPTH_BITS=7
-DPIXEL_COLOR_DEPTH_BITS=8
-DNO_FAST_FUNCTIONS=1
-DMINIZ_NO_STDIO=1
-DMINIZ_NO_TIME=1
Expand Down Expand Up @@ -129,7 +129,7 @@ build_flags =
-DZEDMD_HD=1
-DZEDMD_WIFI=1
-DDISPLAY_LED_MATRIX=1
-DPIXEL_COLOR_DEPTH_BITS=7
-DPIXEL_COLOR_DEPTH_BITS=8
-DNO_FAST_FUNCTIONS=1
-DMINIZ_NO_STDIO=1
-DMINIZ_NO_TIME=1
Expand Down Expand Up @@ -157,7 +157,7 @@ build_flags =
-DZEDMD_HD_HALF=1
-DZEDMD_WIFI=1
-DDISPLAY_LED_MATRIX=1
-DPIXEL_COLOR_DEPTH_BITS=7
-DPIXEL_COLOR_DEPTH_BITS=8
-DNO_FAST_FUNCTIONS=1
-DMINIZ_NO_STDIO=1
-DMINIZ_NO_TIME=1
Expand Down
6 changes: 6 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -847,6 +847,9 @@ void IRAM_ATTR HandlePacket(AsyncUDPPacket packet) {
uint8_t numZones = pPacket[1] & 127;
uint16_t size = (int)(pPacket[3]) + (((int)pPacket[2]) << 8);

// Maybe a bug in libzedmd, but sometimes we get 0 zones.
if (0 == numZones) break;

#if !defined(BOARD_HAS_PSRAM)
renderBuffer = (uint8_t *)malloc(ZONE_SIZE * numZones + numZones);
if (renderBuffer == nullptr) {
Expand Down Expand Up @@ -902,6 +905,9 @@ void IRAM_ATTR HandlePacket(AsyncUDPPacket packet) {
uint8_t numZones = pPacket[1] & 127;
uint16_t size = (int)(pPacket[3]) + (((int)pPacket[2]) << 8);

// Maybe a bug in libzedmd, but sometimes we get 0 zones.
if (0 == numZones) break;

#if !defined(BOARD_HAS_PSRAM)
renderBuffer =
(uint8_t *)malloc(RGB565_ZONE_SIZE * numZones + numZones);
Expand Down

0 comments on commit a7bf486

Please sign in to comment.