Skip to content

Commit 5fc1d69

Browse files
committed
Doc updates + Ethernet / Art-Net-In small changes
Back-End ======== - Ethernet: set pins to int8_t (to allow for -1) - Module - Art-Net-In: universe Min/Max to uint16_t, max 32K
1 parent 40743fd commit 5fc1d69

File tree

6 files changed

+33
-40
lines changed

6 files changed

+33
-40
lines changed

docs/develop/development.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ Firmware binaries come in 2 flavours: including boot and partition (merged) and
115115
* replace port and file to match your setup
116116
* optionally add erase-flash before write-flash
117117
* -b 2000000: Baud rate: lower if too high for your device
118-
* use ./build/release/MoonLight_esp32-s3-devkitc-1-n16r8v_0-6-0.bin and address 0x10000 to flash only the MoonLight partition
118+
* use ./build/release/MoonLight_esp32-s3-devkitc-1-n16r8v_0-6-1.bin and address 0x10000 to flash only the MoonLight partition
119119

120120
### Adding an ESP32 device Definition
121121

docs/gettingstarted/installation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,5 +178,5 @@ ESPConnect is a browser-based control center for ESP32- and ESP8266-class boards
178178
* Select Flash Tools, go to Flash Firmware
179179
* Open a firmware.bin file.
180180
* Files ending with _webflash.bin (e.g. MoonLight_esp32-d0_0-6-1_webflash.bin) also formats the partition: choose Flash offset 0x0 or recommended offsets Bootloader. webflash files can be found [here](https://github.com/MoonModules/MoonLight/tree/main/firmware/installer) and are used by the [MoonLight Installer](https://moonmodules.org/MoonLight/gettingstarted/installer/) as well.
181-
* Files ending with .bin, without _webflash (e.g. MoonLight_esp32-d0_0-6-1.bin). Choose recommended offsets App0 (Or App1?). Only use if you previously had MoonLight installed on the device, so the partitions has already been set. These files can be found in [published releases](https://github.com/MoonModules/MoonLight/releases).
181+
* Files ending with .bin, without _webflash (e.g. MoonLight_esp32-d0_0-6-1.bin). Choose recommended offsets App0. Only use if you previously had MoonLight installed on the device, so the partitions has already been set. These files can be found in [published releases](https://github.com/MoonModules/MoonLight/releases).
182182
* Nightly builds if shared on [discord](https://discord.gg/MTn9mVUG5n).

docs/moonbase/inputoutput.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ For each board the following presets are defined:
6363

6464
* Dig 2Go, Dig Uno, Dig Quad: Choose the esp32-d0 (4MB) board in the [MoonLight Installer](https://moonmodules.org/MoonLight/gettingstarted/installer/)
6565
* Dig Octa: Choose the esp32-d0-16mb board in the [MoonLight Installer](https://moonmodules.org/MoonLight/gettingstarted/installer/)
66-
* On first install, erase flash first (Especially when other firmware like WLED was on it) as MoonLight uses a partition scheme with 3MB of flash (no ota at the moment).
66+
* On first install, erase flash first (Especially when other firmware like WLED was on it) as MoonLight uses a partition scheme with 3MB of flash (currently no OTA support).
6767
* You might need to reset your router if you first run WLED on the same MCU and no new IP is assigned.
6868

6969
!!! Tip "Dig Uno USB"

lib/framework/EthernetSettingsService.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,15 @@ class EthernetSettingsService : public StatefulService<EthernetSettings>
112112

113113
// 🌙 compiler directives to variables
114114
#ifdef CONFIG_IDF_TARGET_ESP32S3
115-
uint8_t v_ETH_SPI_SCK = UINT8_MAX; //42; v_ETH_SPI_SCK is check if configured, see configureNetwork and ModuleIO
116-
uint8_t v_ETH_SPI_MISO = 44;
117-
uint8_t v_ETH_SPI_MOSI = 43;
115+
int8_t v_ETH_SPI_SCK = INT8_MAX; //42; v_ETH_SPI_SCK is check if configured, see configureNetwork and ModuleIO
116+
int8_t v_ETH_SPI_MISO = 44;
117+
int8_t v_ETH_SPI_MOSI = 43;
118118

119119
eth_phy_type_t v_ETH_PHY_TYPE = ETH_PHY_W5500; //currently only one supported for S3 ...
120120
int32_t v_ETH_PHY_ADDR = 1;
121-
int v_ETH_PHY_CS = 41;
122-
int v_ETH_PHY_IRQ = 2; // -1 if you won't wire
123-
int v_ETH_PHY_RST = 1; // -1 if you won't wire
121+
int8_t v_ETH_PHY_CS = 41;
122+
int8_t v_ETH_PHY_IRQ = 2; // -1 if you won't wire
123+
int8_t v_ETH_PHY_RST = 1; // -1 if you won't wire
124124
#endif
125125

126126
private:

src/MoonBase/Modules/ModuleIO.h

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -498,50 +498,43 @@ class ModuleIO : public Module {
498498
EXT_LOGD(MB_TAG, "Try to configure ethernet");
499499
EthernetSettingsService* ess = _sveltekit->getEthernetSettingsService();
500500
#ifdef CONFIG_IDF_TARGET_ESP32S3
501-
ess->v_ETH_SPI_SCK = UINT8_MAX;
502-
ess->v_ETH_SPI_MISO = UINT8_MAX;
503-
ess->v_ETH_SPI_MOSI = UINT8_MAX;
504-
ess->v_ETH_PHY_CS = UINT8_MAX;
505-
ess->v_ETH_PHY_IRQ = UINT8_MAX;
501+
ess->v_ETH_SPI_SCK = INT8_MAX;
502+
ess->v_ETH_SPI_MISO = INT8_MAX;
503+
ess->v_ETH_SPI_MOSI = INT8_MAX;
504+
ess->v_ETH_PHY_CS = INT8_MAX;
505+
ess->v_ETH_PHY_IRQ = INT8_MAX;
506+
507+
auto assignIfValid = [](uint8_t gpio, uint8_t usage, int8_t& target) {
508+
if (GPIO_IS_VALID_GPIO(gpio))
509+
target = gpio;
510+
else
511+
EXT_LOGE(MB_TAG, "%d: gpio %d not valid", usage, gpio);
512+
};
513+
506514
// if ethernet pins change
507515
// find the pins needed
508516
for (JsonObject pinObject : _state.data["pins"].as<JsonArray>()) {
509517
uint8_t usage = pinObject["usage"];
510518
uint8_t gpio = pinObject["GPIO"];
511519
if (usage == pin_SPI_SCK) {
512-
if (GPIO_IS_VALID_GPIO(gpio))
513-
ess->v_ETH_SPI_SCK = gpio;
514-
else
515-
EXT_LOGE(MB_TAG, "%d: gpio %d not valid", usage, gpio);
520+
assignIfValid(gpio, usage, ess->v_ETH_SPI_SCK);
516521
}
517522
if (usage == pin_SPI_MISO) {
518-
if (GPIO_IS_VALID_GPIO(gpio))
519-
ess->v_ETH_SPI_MISO = gpio;
520-
else
521-
EXT_LOGE(MB_TAG, "%d: gpio %d not valid", usage, gpio);
523+
assignIfValid(gpio, usage, ess->v_ETH_SPI_MISO);
522524
}
523525
if (usage == pin_SPI_MOSI) {
524-
if (GPIO_IS_VALID_GPIO(gpio))
525-
ess->v_ETH_SPI_MOSI = gpio;
526-
else
527-
EXT_LOGE(MB_TAG, "%d: gpio %d not valid", usage, gpio);
526+
assignIfValid(gpio, usage, ess->v_ETH_SPI_MOSI);
528527
}
529528
if (usage == pin_PHY_CS) {
530-
if (GPIO_IS_VALID_GPIO(gpio))
531-
ess->v_ETH_PHY_CS = gpio;
532-
else
533-
EXT_LOGE(MB_TAG, "%d: gpio %d not valid", usage, gpio);
529+
assignIfValid(gpio, usage, ess->v_ETH_PHY_CS);
534530
}
535531
if (usage == pin_PHY_IRQ) {
536-
if (GPIO_IS_VALID_GPIO(gpio))
537-
ess->v_ETH_PHY_IRQ = gpio;
538-
else
539-
EXT_LOGE(MB_TAG, "%d: gpio %d not valid", usage, gpio);
532+
assignIfValid(gpio, usage, ess->v_ETH_PHY_IRQ);
540533
}
541534
}
542535

543536
// allocate the pins found
544-
if (ess->v_ETH_SPI_SCK != UINT8_MAX && ess->v_ETH_SPI_MISO != UINT8_MAX && ess->v_ETH_SPI_MOSI != UINT8_MAX && ess->v_ETH_PHY_CS != UINT8_MAX && ess->v_ETH_PHY_IRQ != UINT8_MAX) {
537+
if (ess->v_ETH_SPI_SCK != INT8_MAX && ess->v_ETH_SPI_MISO != INT8_MAX && ess->v_ETH_SPI_MOSI != INT8_MAX && ess->v_ETH_PHY_CS != INT8_MAX && ess->v_ETH_PHY_IRQ != INT8_MAX) {
545538
// ess->v_ETH_PHY_TYPE = ETH_PHY_W5500;
546539
// ess->v_ETH_PHY_ADDR = 1;
547540
ess->v_ETH_PHY_RST = -1; // not wired

src/MoonLight/Nodes/Drivers/D_ArtnetIn.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ class ArtNetInDriver : public Node {
2828
bool ddp = false;
2929
uint8_t view = 0; // physical layer
3030
uint16_t port = 6454;
31-
uint8_t universeMin = 0;
32-
uint8_t universeMax = 255;
31+
uint16_t universeMin = 0;
32+
uint16_t universeMax = 255;
3333

3434
void setup() override {
3535
addControl(ddp, "DDP", "checkbox");
3636
addControl(port, "port", "number", 0, 65538);
37-
addControl(universeMin, "universeMin", "number", 0, 65538);
38-
addControl(universeMax, "universeMax", "number", 0, 65538);
37+
addControl(universeMin, "universeMin", "number", 0, 32767);
38+
addControl(universeMax, "universeMax", "number", 0, 32767);
3939
addControl(view, "view", "select");
4040
addControlValue("Physical layer");
4141
uint8_t i = 1; // start with one
@@ -149,7 +149,7 @@ class ArtNetInDriver : public Node {
149149
void handleDDP() {
150150
DDPHeader* header = (DDPHeader*)packetBuffer;
151151

152-
bool pushFlag = (header->flags & 0x80) != 0;
152+
// bool pushFlag = (header->flags & 0x80) != 0;
153153
uint8_t dataType = header->dataType;
154154

155155
uint32_t offset = (header->offset >> 24) | ((header->offset >> 8) & 0xFF00) | ((header->offset << 8) & 0xFF0000) | (header->offset << 24);

0 commit comments

Comments
 (0)