Skip to content

Commit 0ad4fee

Browse files
committed
MCH P4 nano shield: specify jumper1
1 parent f3ea59d commit 0ad4fee

File tree

4 files changed

+24
-16
lines changed

4 files changed

+24
-16
lines changed

docs/moonbase/inputoutput.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ For each board the following presets are defined:
7272
* Choose the esp32-p4-nano board in the [MoonLight Installer](../../gettingstarted/installer/)
7373
* On new boards, the WiFi coprocessor needs to be updated first to a recent version, currently v2.0.17, see the link in the [MoonLight Installer](../../gettingstarted/installer/)
7474
* After install, select the MHC P4 shield board preset to have the pins assigned correctly.
75-
* Add the Parallel LED Driver, see [Drivers](). It uses @troyhacks his parallel IO driver to drive all the 12 LED pins of the P4 shield.
75+
* Assuming 100W LED power!! Change if not!
76+
* Jumper1: off (default): 16 LED pins. On: 8 LED pins, 4 RS-485 pins and 4 exposed pins (set the switches on the board!)
77+
* Add the Parallel LED Driver, see [Drivers](../../moonlight/drivers/). It uses @troyhacks his parallel IO driver to drive all the 12 LED pins of the P4 shield.
7678

7779
![ESP32-P4 shield](https://shop.myhome-control.de/thumbnail/87/41/c2/1762031307/WLED_ESP32_P4_Shield_02_1920x1326.jpg?ts=1762031315){: style="width:320px"}
7880

src/MoonBase/Modules/ModuleIO.h

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -375,22 +375,28 @@ class ModuleIO : public Module {
375375
pinAssigner.assignPin(19, pin_Relay_LightsOn);
376376
} else if (boardID == board_MHCD0) {
377377
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"] = 10; // USB compliant
380-
uint8_t ledPins[16] = {21, 20, 25, 5, 7, 23, 8, 27, 3, 22, 24, 4, 46, 47, 2, 48}; // LED_PINS
381-
for (int i = 0; i < sizeof(ledPins); i++) pinAssigner.assignPin(ledPins[i], pin_LED);
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
382+
for (int i = 0; i < sizeof(ledPins); i++) pinAssigner.assignPin(ledPins[i], pin_LED);
383+
// per default used as LED Pins
384+
pinAssigner.assignPin(3, pin_RS485);
385+
pinAssigner.assignPin(4, pin_RS485);
386+
pinAssigner.assignPin(22, pin_RS485);
387+
pinAssigner.assignPin(24, pin_RS485);
388+
pinAssigner.assignPin(2, pin_Exposed);
389+
pinAssigner.assignPin(46, pin_Exposed);
390+
pinAssigner.assignPin(47, pin_Exposed);
391+
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
394+
for (int i = 0; i < sizeof(ledPins); i++) pinAssigner.assignPin(ledPins[i], pin_LED);
395+
}
382396
pinAssigner.assignPin(33, pin_I2S_SD);
383397
pinAssigner.assignPin(26, pin_I2S_WS);
384398
pinAssigner.assignPin(32, pin_I2S_SCK);
385399
pinAssigner.assignPin(36, pin_I2S_MCLK);
386-
pinAssigner.assignPin(3, pin_RS485);
387-
pinAssigner.assignPin(4, pin_RS485);
388-
pinAssigner.assignPin(22, pin_RS485);
389-
pinAssigner.assignPin(24, pin_RS485);
390-
pinAssigner.assignPin(2, pin_Exposed);
391-
pinAssigner.assignPin(46, pin_Exposed);
392-
pinAssigner.assignPin(47, pin_Exposed);
393-
pinAssigner.assignPin(48, pin_Exposed);
394400
} else if (boardID == board_YvesV48) {
395401
pinAssigner.assignPin(3, pin_LED);
396402
} else if (boardID == board_TroyP4Nano) {

src/MoonLight/Nodes/Drivers/D_ParallelLEDDriver.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ class ParallelLEDDriver : public DriverNode {
5959
#ifndef CONFIG_IDF_TARGET_ESP32P4
6060
if (ledsDriver.total_leds > 0) ledsDriver.showPixels(WAIT);
6161
#else
62-
// Pass the LUT tables instead of brightness
63-
// No brightness parameter - LUTs are accessed directly!
62+
// LUTs are accessed directly within show_parlio via extern ledsDriver
63+
// No brightness parameter needed
6464
show_parlio(pins, layer->layerP->lights.header.nrOfLights, layer->layerP->lights.channels,
6565
// REMOVED: ledsDriver._brightness,
6666
layer->layerP->lights.header.channelsPerLight == 4, nrOfPins, layer->layerP->ledsPerPin[0], layer->layerP->lights.header.offsetRed, layer->layerP->lights.header.offsetGreen, layer->layerP->lights.header.offsetBlue);

src/MoonLight/Nodes/Drivers/parlio.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ inline void transpose_32_slices(uint32_t (&transposed_slices)[32], // Output bu
3232
for (uint32_t pin = 0; pin < num_active_pins; ++pin) {
3333
const uint32_t pixel_idx = (pin * pixels_per_pin) + pixel_in_pin;
3434
const uint32_t component_idx = (pixel_idx * COMPONENTS_PER_PIXEL) + component_in_pixel;
35-
const uint8_t data_byte = brightness_cache[input_buffer[component_idx]]; // replace by rgbw lut tables!
35+
const uint8_t data_byte = brightness_cache[input_buffer[component_idx]];
3636
const uint32_t waveform = waveform_cache[data_byte];
3737
const uint32_t pin_bit = (1 << pin);
3838

0 commit comments

Comments
 (0)