Skip to content

Commit 7fdc3ac

Browse files
committed
add Serg mini and universal shield
Back-end ======== - IO Module : add Serg mini and universal shield - Lights control: MoonModules palette default - Parlio: parlio_config.data_gpio_nums: only defined pins
1 parent b1db675 commit 7fdc3ac

File tree

5 files changed

+63
-27
lines changed

5 files changed

+63
-27
lines changed

firmware/esp32-p4.ini

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ upload_speed = 921600
2626
; framework = arduino
2727
; monitor_speed = 115200
2828
build_flags = ${esp32-p4-base.build_flags}
29-
-Wl,-wrap,esp_dma_capable_malloc ;; makes SDIO for ESP-Hosted use PSRAM if available.
30-
29+
; -Wl,-wrap,esp_dma_capable_malloc ;; makes SDIO for ESP-Hosted use PSRAM if available. (calls to esp_dma_capable_malloc() get redirected to __wrap_esp_dma_capable_malloc())
3130
lib_deps = ${esp32-p4-base.lib_deps}
3231
; RAM: [= ] 11.2% (used 36580 bytes from 327680 bytes)
3332
; Flash: [======== ] 82.3% (used 1726193 bytes from 2097152 bytes)

platformio.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ build_flags =
5656
-D BUILD_TARGET=\"$PIOENV\"
5757
-D APP_NAME=\"MoonLight\" ; 🌙 Must only contain characters from [a-zA-Z0-9-_] as this is converted into a filename
5858
-D APP_VERSION=\"0.6.1\" ; semver compatible version string
59-
-D APP_DATE=\"2025121212\" ; 🌙
59+
-D APP_DATE=\"2025121309\" ; 🌙
6060

6161
-D PLATFORM_VERSION=\"pioarduino-55.03.34\" ; 🌙 make sure it matches with above plaftform
6262

src/MoonBase/Modules/ModuleIO.h

Lines changed: 57 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ class ModuleIO : public Module {
274274

275275
if (boardID == board_SE16V1) {
276276
object["maxPower"] = 500;
277-
uint8_t ledPins[16] = {47, 48, 21, 38, 14, 39, 13, 40, 12, 41, 11, 42, 10, 2, 3, 1}; // LED_PINS
277+
uint8_t ledPins[] = {47, 48, 21, 38, 14, 39, 13, 40, 12, 41, 11, 42, 10, 2, 3, 1}; // LED_PINS
278278
for (int i = 0; i < sizeof(ledPins); i++) pinAssigner.assignPin(ledPins[i], pin_LED);
279279
pinAssigner.assignPin(0, pin_ButtonPush);
280280
pinAssigner.assignPin(45, pin_ButtonPush);
@@ -310,7 +310,7 @@ class ModuleIO : public Module {
310310
// Dig-Quad-V3
311311
// esp32-d0 (4MB)
312312
object["maxPower"] = 150;
313-
uint8_t ledPins[4] = {16, 3, 1, 4}; // LED_PINS
313+
uint8_t ledPins[] = {16, 3, 1, 4}; // LED_PINS
314314
for (int i = 0; i < sizeof(ledPins); i++) pinAssigner.assignPin(ledPins[i], pin_LED);
315315
pinAssigner.assignPin(0, pin_ButtonPush);
316316

@@ -323,8 +323,8 @@ class ModuleIO : public Module {
323323
// pinAssigner.assignPin(32, pin_Exposed;
324324
} else if (boardID == board_QuinLEDDigOctaV2) {
325325
// Dig-Octa-32-8L
326-
object["maxPower"] = 400; // 10A Fuse * 8 ... 400 W
327-
uint8_t ledPins[8] = {0, 1, 2, 3, 4, 5, 12, 13}; // LED_PINS
326+
object["maxPower"] = 400; // 10A Fuse * 8 ... 400 W
327+
uint8_t ledPins[] = {0, 1, 2, 3, 4, 5, 12, 13}; // LED_PINS
328328
for (int i = 0; i < sizeof(ledPins); i++) pinAssigner.assignPin(ledPins[i], pin_LED);
329329
pinAssigner.assignPin(33, pin_Relay);
330330
pinAssigner.assignPin(34, pin_ButtonPush);
@@ -344,7 +344,7 @@ class ModuleIO : public Module {
344344
pinAssigner.assignPin(25, pin_Exposed);
345345
// pinAssigner.assignPin(xx, pin_I2S_MCLK);
346346
// } else if (boardID == board_QuinLEDPenta) {
347-
// uint8_t ledPins[5] = {14, 13, 12, 4, 2}; // LED_PINS
347+
// uint8_t ledPins[] = {14, 13, 12, 4, 2}; // LED_PINS
348348
// for (int i = 0; i < sizeof(ledPins); i++) pinAssigner.assignPin(ledPins[i], pin_LED);
349349
// pinAssigner.assignPin(34, pin_ButtonPush);
350350
// pinAssigner.assignPin(35, pin_ButtonPush);
@@ -366,19 +366,52 @@ class ModuleIO : public Module {
366366
// pinAssigner.assignPin(5, pin_LED);
367367
} else if (boardID == board_SergMiniShield) {
368368
object["maxPower"] = 50; // 10A Fuse ...
369-
pinAssigner.assignPin(1, pin_LED);
370-
pinAssigner.assignPin(3, pin_LED);
369+
pinAssigner.assignPin(16, pin_LED);
370+
// pinAssigner.assignPin(17, pin_LED); // e.g. apa102...
371+
372+
// pinAssigner.assignPin(??, pin_Button_LightsOn); // which pin ?
373+
pinAssigner.assignPin(19, pin_Relay_LightsOn); // optional
374+
375+
// e.g. for mic
376+
pinAssigner.assignPin(32, pin_I2S_SD);
377+
pinAssigner.assignPin(15, pin_I2S_WS);
378+
pinAssigner.assignPin(14, pin_I2S_SCK);
379+
// pinAssigner.assignPin(36, nc/ao...);
380+
381+
// e.g. for 4 line display
382+
pinAssigner.assignPin(21, pin_I2C_SDA);
383+
pinAssigner.assignPin(22, pin_I2C_SCL);
371384
} else if (boardID == board_SergUniShieldV5) {
372385
object["maxPower"] = 50; // 10A Fuse ...
373-
pinAssigner.assignPin(1, pin_LED);
374-
pinAssigner.assignPin(3, pin_LED);
386+
387+
pinAssigner.assignPin(16, pin_LED); // first pin
388+
if (_state.data["jumper1"])
389+
pinAssigner.assignPin(1, pin_LED);
390+
else // default
391+
pinAssigner.assignPin(3, pin_LED);
392+
393+
pinAssigner.assignPin(17, pin_Button_LightsOn);
375394
pinAssigner.assignPin(19, pin_Relay_LightsOn);
395+
pinAssigner.assignPin(18, pin_Infrared);
396+
397+
// e.g. for mic
398+
pinAssigner.assignPin(32, pin_I2S_SD);
399+
pinAssigner.assignPin(15, pin_I2S_WS);
400+
pinAssigner.assignPin(14, pin_I2S_SCK);
401+
// pinAssigner.assignPin(36, nc/ao...);
402+
403+
// e.g. for 4 line display
404+
pinAssigner.assignPin(21, pin_I2C_SDA);
405+
pinAssigner.assignPin(22, pin_I2C_SCL);
406+
407+
// pinAssigner.assignPin(?, pin_Temperature); // todo: check temp pin
408+
376409
} else if (boardID == board_MHCD0) {
377410
pinAssigner.assignPin(3, pin_Voltage);
378-
} else if (boardID == board_MHCP4Nano) { // https://shop.myhome-control.de/ABC-WLED-ESP32-P4-Shield/HW10027
379-
object["maxPower"] = 100; // Assuming decent LED power!!
380-
if (_state.data["jumper1"]) { // on
381-
uint8_t ledPins[8] = {21, 20, 25, 5, 7, 23, 8, 27}; // 8 LED_PINS
411+
} else if (boardID == board_MHCP4Nano) { // https://shop.myhome-control.de/ABC-WLED-ESP32-P4-Shield/HW10027
412+
object["maxPower"] = 100; // Assuming decent LED power!!
413+
if (_state.data["jumper1"]) { // on
414+
uint8_t ledPins[] = {21, 20, 25, 5, 7, 23, 8, 27}; // 8 LED_PINS
382415
for (int i = 0; i < sizeof(ledPins); i++) pinAssigner.assignPin(ledPins[i], pin_LED);
383416
// per default used as LED Pins
384417
pinAssigner.assignPin(3, pin_RS485);
@@ -389,8 +422,8 @@ class ModuleIO : public Module {
389422
pinAssigner.assignPin(46, pin_Exposed);
390423
pinAssigner.assignPin(47, pin_Exposed);
391424
pinAssigner.assignPin(48, pin_Exposed);
392-
} else { // off - default
393-
uint8_t ledPins[16] = {21, 20, 25, 5, 7, 23, 8, 27, 3, 22, 24, 4, 46, 47, 2, 48}; // 16 LED_PINS
425+
} else { // off - default
426+
uint8_t ledPins[] = {21, 20, 25, 5, 7, 23, 8, 27, 3, 22, 24, 4, 46, 47, 2, 48}; // 16 LED_PINS
394427
for (int i = 0; i < sizeof(ledPins); i++) pinAssigner.assignPin(ledPins[i], pin_LED);
395428
}
396429
pinAssigner.assignPin(33, pin_I2S_SD);
@@ -400,8 +433,8 @@ class ModuleIO : public Module {
400433
} else if (boardID == board_YvesV48) {
401434
pinAssigner.assignPin(3, pin_LED);
402435
} else if (boardID == board_TroyP4Nano) {
403-
object["maxPower"] = 10; // USB compliant
404-
uint8_t ledPins[16] = {2, 3, 4, 5, 6, 20, 21, 22, 23, 26, 27, 32, 33, 36, 47, 48}; // LED_PINS
436+
object["maxPower"] = 10; // USB compliant
437+
uint8_t ledPins[] = {2, 3, 4, 5, 6, 20, 21, 22, 23, 26, 27, 32, 33, 36, 47, 48}; // LED_PINS
405438
for (int i = 0; i < sizeof(ledPins); i++) pinAssigner.assignPin(ledPins[i], pin_LED);
406439
pinAssigner.assignPin(7, pin_I2C_SDA);
407440
pinAssigner.assignPin(8, pin_I2C_SCL);
@@ -428,16 +461,20 @@ class ModuleIO : public Module {
428461
// 53 is for PA enable but it's exposed on header and works for WLED pin output. Best to not use it but left available.
429462
// 54 is "C4 EN pin" so I guess we shouldn't fuck with that.
430463
} else if (boardID == board_AtomS3) {
431-
uint8_t ledPins[4] = {5, 6, 7, 8}; // LED_PINS
464+
uint8_t ledPins[] = {5, 6, 7, 8}; // LED_PINS
432465
for (int i = 0; i < sizeof(ledPins); i++) pinAssigner.assignPin(ledPins[i], pin_LED);
433466
} else if (boardID == board_Cube202010) {
434467
object["maxPower"] = 50;
435-
uint8_t ledPins[10] = {22, 21, 14, 18, 5, 4, 2, 15, 13, 12}; // LED_PINS
436-
// char pins[80] = "2,3,4,16,17,18,19,21,22,23,25,26,27,32,33"; //(D0), more pins possible. to do: complete list.
468+
uint8_t ledPins[] = {22, 21, 14, 18, 5, 4, 2, 15, 13, 12}; // LED_PINS
469+
// char pins[80] = "2,3,4,16,17,18,19,21,22,23,25,26,27,32,33"; //(D0), more pins possible. to do: complete list.
437470
for (int i = 0; i < sizeof(ledPins); i++) pinAssigner.assignPin(ledPins[i], pin_LED);
438471
} else { // default
439472
object["maxPower"] = 10; // USB compliant
473+
#ifdef CONFIG_IDF_TARGET_ESP32P4
474+
pinAssigner.assignPin(37, pin_LED);
475+
#else
440476
pinAssigner.assignPin(16, pin_LED);
477+
#endif
441478

442479
// trying to add more pins, but these pins not liked by esp32-d0-16MB ... 🚧
443480
// pinAssigner.assignPin(4, pin_LED_02;

src/MoonLight/Modules/ModuleLightsControl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class ModuleLightsControl : public Module {
118118
control["default"] = 255;
119119
control["color"] = "Blue";
120120
control = addControl(controls, "palette", "select");
121-
control["default"] = 6;
121+
control["default"] = 9;
122122
addControlValue(control, "Cloud");
123123
addControlValue(control, "Lava");
124124
addControlValue(control, "Ocean");

src/MoonLight/Nodes/Drivers/parlio.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,8 @@ void create_transposed_led_output_optimized(const uint8_t* input_buffer, uint16_
201201
for (uint32_t pixel_in_pin = 0; pixel_in_pin < pixels_per_pin; ++pixel_in_pin) {
202202
for (uint32_t component_in_pixel = 0; component_in_pixel < COMPONENTS_PER_PIXEL; ++component_in_pixel) {
203203
const uint32_t input_component = component_map[component_in_pixel];
204-
//component_in_pixel is always RGB(W) - looping over the input array
205-
//input_component is offsetR,G,B e.g. GRB -> 102, so this loop starts with 1 / green, so green is first processed, then red, then blue
204+
// component_in_pixel is always RGB(W) - looping over the input array
205+
// input_component is offsetR,G,B e.g. GRB -> 102, so this loop starts with 1 / green, so green is first processed, then red, then blue
206206

207207
uint32_t transposed_slices[32];
208208

@@ -295,7 +295,7 @@ uint8_t IRAM_ATTR __attribute__((hot)) show_parlio(uint8_t* parallelPins, uint32
295295
parlio_config.valid_gpio_num = gpio_num_t(-1);
296296
parlio_config.clk_out_gpio_num = gpio_num_t(-1);
297297
for (int i = 0; i < SOC_PARLIO_TX_UNIT_MAX_DATA_WIDTH; ++i) {
298-
parlio_config.data_gpio_nums[i] = gpio_num_t(parallelPins[i]);
298+
parlio_config.data_gpio_nums[i] = (i < outputs) ? gpio_num_t(parallelPins[i]) : gpio_num_t(-1); // @troyhacks update 20251015
299299
}
300300
#ifdef PARLIO_AUTO_OVERCLOCK // This has caused minor annoying glitching.
301301
if (leds_per_output <= 256) {

0 commit comments

Comments
 (0)