Skip to content

Commit b6cd35e

Browse files
committed
LED Map improvements and cache alignment for weird sized matricies
1 parent d7a519c commit b6cd35e

File tree

11 files changed

+325
-179
lines changed

11 files changed

+325
-179
lines changed

usermods/usermod_v2_artnetmap/usermod_v2_artnetmap.h

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,6 @@ class ArtNetMapUsermod : public Usermod {
7373
return numOutputs > 0 ? maxUni + 1 : 0;
7474
}
7575

76-
// Get total LED count
77-
uint32_t getTotalLeds() {
78-
uint32_t total = 0;
79-
for (uint16_t i = 0; i < numOutputs; i++) {
80-
total += ledsPerOutput[i];
81-
}
82-
return total;
83-
}
84-
8576
// Generate sequential outputs
8677
void generateSequential(uint16_t count, uint16_t universesPerOutput, uint32_t leds) {
8778
numOutputs = min((uint16_t)ARTNETMAP_MAX_OUTPUTS, count);
@@ -184,6 +175,16 @@ class ArtNetMapUsermod : public Usermod {
184175

185176
public:
186177

178+
// Get total LED count
179+
uint32_t getTotalLeds() {
180+
uint32_t total = 0;
181+
for (uint16_t i = 0; i < numOutputs; i++) {
182+
total += ledsPerOutput[i];
183+
}
184+
return total;
185+
}
186+
187+
187188
ArtNetMapUsermod(bool enabled) : Usermod("ArtNetMap", enabled) {
188189
// Initialize arrays
189190
for (uint16_t i = 0; i < ARTNETMAP_MAX_OUTPUTS; i++) {

wled00/ArtNetReceiver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ void ArtNetReceiver::_process_frame_internal() {
154154
if (!bus->isOk()) return;
155155
uint8_t* busPixelData = bus->getPixelData();
156156
uint32_t busLedCount = bus->getLength();
157-
uint32_t bus_len_bytes = busLedCount * 3;
157+
uint32_t bus_len_bytes = bus->getPixelDataSize();
158158

159159
#if defined(CONFIG_IDF_TARGET_ESP32P4)
160160
// You will need p4_mul16x16.S for this to work.

wled00/FX.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ inline bool ppaEffectBegin(PPAEffectContext& ctx) {
139139
if (!bus->isOk()) return false;
140140

141141
ctx.busPixelData = bus->getPixelData();
142-
ctx.busPixelSize = ctx.max_width * ctx.max_height * 3;
142+
ctx.busPixelSize = bus->getPixelDataSize();
143143

144144
if (ctx.busPixelData == nullptr || ctx.busPixelSize == 0) {
145145
ctx.valid = false;
@@ -9751,7 +9751,7 @@ uint16_t mode_PPA_IMAGEPLAYER() {
97519751
if (bus) {
97529752
if (!bus->isOk()) return false;
97539753
busPixelData = bus->getPixelData();
9754-
busPixelSize = SEGMENT.length() * 3;
9754+
busPixelSize = bus->getPixelDataSize();
97559755
if (busPixelData == NULL || busPixelSize == 0) return 1;
97569756
} else {
97579757
return 1;
@@ -10274,7 +10274,7 @@ uint16_t mode_PRO_LINK() {
1027410274
if (bus) {
1027510275
if (!bus->isOk()) return false;
1027610276
busPixelData = bus->getPixelData();
10277-
busPixelSize = SEGMENT.length() * 3;
10277+
busPixelSize = bus->getPixelDataSize();
1027810278
if (!busPixelData || busPixelSize == 0) return 1;
1027910279
} else {
1028010280
return 1;
@@ -10576,7 +10576,7 @@ uint16_t mode_DJLight_Circles(void) {
1057610576
if (bus) {
1057710577
if (!bus->isOk()) return false;
1057810578
busPixelData = bus->getPixelData();
10579-
busPixelSize = SEGMENT.length() * 3;
10579+
busPixelSize = bus->getPixelDataSize();
1058010580
if (!busPixelData || busPixelSize == 0) return FRAMETIME;
1058110581
} else {
1058210582
return FRAMETIME;
@@ -10786,7 +10786,7 @@ uint16_t mode_DJLight_Circles(void) {
1078610786
srm_config.in.pic_h = rows;
1078710787
srm_config.in.block_w = qw;
1078810788
srm_config.in.block_h = qh;
10789-
srm_config.out.block_offset_x = qw;
10789+
srm_config.out.block_offset_x = cols - qw;
1079010790
srm_config.out.block_offset_y = 0;
1079110791
srm_config.mirror_x = true;
1079210792
srm_config.mirror_y = false;
@@ -10796,7 +10796,7 @@ uint16_t mode_DJLight_Circles(void) {
1079610796
srm_config.in.block_w = cols;
1079710797
srm_config.in.block_h = qh;
1079810798
srm_config.out.block_offset_x = 0;
10799-
srm_config.out.block_offset_y = qh;
10799+
srm_config.out.block_offset_y = rows - qh;
1080010800
srm_config.mirror_x = false;
1080110801
srm_config.mirror_y = true;
1080210802
ESP_ERROR_CHECK_WITHOUT_ABORT(ppa_do_scale_rotate_mirror(ppa_srm_handle, &srm_config));
@@ -10843,7 +10843,7 @@ uint16_t IRAM_ATTR mode_AkemiPPA() {
1084310843
if (bus) {
1084410844
if (!bus->isOk()) return false;
1084510845
busPixelData = bus->getPixelData();
10846-
busPixelSize = SEGMENT.length() * 3;
10846+
busPixelSize = bus->getPixelDataSize();
1084710847
if (busPixelData == NULL || busPixelSize == 0) return mode_static();
1084810848
} else {
1084910849
return mode_static();

wled00/FX.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -976,6 +976,7 @@ class WS2812FX { // 96 bytes
976976
show(void),
977977
setTargetFps(uint8_t fps),
978978
enumerateLedmaps(); //WLEDMM (from fcn_declare)
979+
void createLedmapBinaryCache();
979980

980981
void setColor(uint8_t slot, uint8_t r, uint8_t g, uint8_t b, uint8_t w = 0) { setColor(slot, RGBW32(r,g,b,w)); }
981982
void fill(uint32_t c) { for (int i = 0; i < getLengthTotal(); i++) setPixelColor(i, c); } // fill whole strip with color (inline)

0 commit comments

Comments
 (0)