Skip to content

Commit 444b31f

Browse files
committed
no USB serial on WiFi builds, solves S3 issue espressif/arduino-esp32#8322
1 parent 55a1064 commit 444b31f

File tree

3 files changed

+57
-78
lines changed

3 files changed

+57
-78
lines changed

.github/workflows/ZeDMD.yml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
needs: [ version ]
3030
strategy:
3131
matrix:
32-
panels: ['128x32', '256x64', '128x64', '128x32_wifi', '128x64_wifi', 'S3-N16R8_128x32', 'S3-N16R8_128x32_wifi', 'S3-N16R8_256x64', 'S3-N16R8_256x64_wifi', 'S3-N16R8_128x64', 'LilygoS3Amoled_128x32','LilygoS3Amoled_128x32_wifi']
32+
panels: ['128x32', '256x64', '128x64', '128x32_wifi', '128x64_wifi', 'S3-N16R8_128x32', 'S3-N16R8_128x32_wifi', 'S3-N16R8_256x64', 'S3-N16R8_256x64_wifi', 'S3-N16R8_128x64', 'S3-N16R8_128x64_wifi', 'LilygoS3Amoled_128x32','LilygoS3Amoled_128x32_wifi']
3333

3434
name: ZeDMD ${{ matrix.panels }}
3535

@@ -52,7 +52,7 @@ jobs:
5252
python -m pip install --upgrade pip
5353
pip install --upgrade platformio
5454
55-
- if: (!(matrix.panels == 'S3-N16R8_128x32') && !(matrix.panels == 'S3-N16R8_256x64') && !(matrix.panels == 'S3-N16R8_128x64') && !(matrix.panels == 'LilygoS3Amoled_128x32') && !(matrix.panels == 'LilygoS3Amoled_128x32_wifi'))
55+
- if: (!(matrix.panels == 'S3-N16R8_128x32') && !(matrix.panels == 'S3-N16R8_256x64') && !(matrix.panels == 'S3-N16R8_128x64') && !(matrix.panels == 'S3-N16R8_128x32_wifi') && !(matrix.panels == 'S3-N16R8_256x64_wifi') && !(matrix.panels == 'S3-N16R8_128x64_wifi') && !(matrix.panels == 'LilygoS3Amoled_128x32') && !(matrix.panels == 'LilygoS3Amoled_128x32_wifi'))
5656
name: Build ZeDMD
5757
run: |
5858
pio run -e ${{ matrix.panels }}
@@ -64,7 +64,7 @@ jobs:
6464
0x10000 .pio/build/${{ matrix.panels }}/firmware.bin \
6565
0x210000 .pio/build/${{ matrix.panels }}/littlefs.bin
6666
67-
- if: (matrix.panels == 'S3-N16R8_128x32' || matrix.panels == 'S3-N16R8_256x64' || matrix.panels == 'S3-N16R8_128x64' || matrix.panels == 'LilygoS3Amoled_128x32' || matrix.panels == 'LilygoS3Amoled_128x32_wifi')
67+
- if: (matrix.panels == 'S3-N16R8_128x32' || matrix.panels == 'S3-N16R8_256x64' || matrix.panels == 'S3-N16R8_128x64' || matrix.panels == 'S3-N16R8_128x32_wifi' || matrix.panels == 'S3-N16R8_256x64_wifi' || matrix.panels == 'S3-N16R8_128x64_wifi' || matrix.panels == 'LilygoS3Amoled_128x32' || matrix.panels == 'LilygoS3Amoled_128x32_wifi')
6868
name: Build ZeDMD S3
6969
run: |
7070
pio run -e ${{ matrix.panels }}
@@ -102,9 +102,6 @@ jobs:
102102
cd ../ZeDMD-128x32_wifi
103103
echo "${{ needs.version.outputs.tag }}" > version.txt
104104
zip ../ZeDMD-128x32_wifi.zip ZeDMD.bin version.txt
105-
cd ../ZeDMD-256x64_wifi
106-
echo "${{ needs.version.outputs.tag }}" > version.txt
107-
zip ../ZeDMD-256x64_wifi.zip ZeDMD.bin version.txt
108105
cd ../ZeDMD-128x64_wifi
109106
echo "${{ needs.version.outputs.tag }}" > version.txt
110107
zip ../ZeDMD-128x64_wifi.zip ZeDMD.bin version.txt
@@ -117,6 +114,15 @@ jobs:
117114
cd ../ZeDMD-S3-N16R8_128x64
118115
echo "${{ needs.version.outputs.tag }}" > version.txt
119116
zip ../ZeDMD-S3-N16R8_128x64.zip ZeDMD.bin version.txt
117+
cd ../ZeDMD-S3-N16R8_128x32_wifi
118+
echo "${{ needs.version.outputs.tag }}" > version.txt
119+
zip ../ZeDMD-S3-N16R8_128x32_wifi.zip ZeDMD.bin version.txt
120+
cd ../ZeDMD-S3-N16R8_256x64_wifi
121+
echo "${{ needs.version.outputs.tag }}" > version.txt
122+
zip ../ZeDMD-S3-N16R8_256x64_wifi.zip ZeDMD.bin version.txt
123+
cd ../ZeDMD-S3-N16R8_128x64_wifi
124+
echo "${{ needs.version.outputs.tag }}" > version.txt
125+
zip ../ZeDMD-S3-N16R8_128x64_wifi.zip ZeDMD.bin version.txt
120126
cd ../ZeDMD-LilygoS3Amoled_128x32.zip
121127
echo "${{ needs.version.outputs.tag }}" > version.txt
122128
zip ../ZeDMD-LilygoS3Amoled_128x32.zip ZeDMD.bin version.txt
@@ -134,10 +140,12 @@ jobs:
134140
ZeDMD-256x64.zip
135141
ZeDMD-128x64.zip
136142
ZeDMD-128x32_wifi.zip
137-
ZeDMD-256x64_wifi.zip
138143
ZeDMD-128x64_wifi.zip
139144
ZeDMD-S3-N16R8_128x32.zip
140145
ZeDMD-S3-N16R8_256x64.zip
141146
ZeDMD-S3-N16R8_128x64.zip
147+
ZeDMD-S3-N16R8_128x32_wifi.zip
148+
ZeDMD-S3-N16R8_256x64_wifi.zip
149+
ZeDMD-S3-N16R8_128x64_wifi.zip
142150
ZeDMD-S3-LilygoS3Amoled_128x32.zip
143151
ZeDMD-S3-LilygoS3Amoled_128x32_wifi.zip

platformio.ini

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,33 @@ build_flags =
112112
-DMINIZ_NO_ZLIB_COMPATIBLE_NAMES=1
113113
-Os
114114
build_unflags = -Og
115-
monitor_speed = 921600
115+
116+
[env:256x64_wifi]
117+
framework = arduino
118+
119+
board = esp32dev
120+
board_build.partitions = partitions.csv
121+
board_build.filesystem = littlefs
122+
lib_deps =
123+
https://github.com/mrfaptastic/ESP32-HUB75-MatrixPanel-DMA#3.0.11
124+
thomasfredericks/Bounce2
125+
ESP Async WebServer
126+
bitbank2/JPEGDEC@^1.6.1
127+
build_flags =
128+
-DNO_GFX=1
129+
-DZEDMD_HD=1
130+
-DZEDMD_WIFI=1
131+
-DDISPLAY_LED_MATRIX=1
132+
-DPIXEL_COLOR_DEPTH_BITS=7
133+
-DNO_FAST_FUNCTIONS=1
134+
-DMINIZ_NO_STDIO=1
135+
-DMINIZ_NO_TIME=1
136+
-DMINIZ_NO_DEFLATE_APIS=1
137+
-DMINIZ_NO_ARCHIVE_APIS=1
138+
-DMINIZ_NO_ARCHIVE_WRITING_APIS=1
139+
-DMINIZ_NO_ZLIB_COMPATIBLE_NAMES=1
140+
-Os
141+
build_unflags = -Og
116142

117143
[env:128x64_wifi]
118144
framework = arduino
@@ -337,4 +363,3 @@ build_flags =
337363
-DMINIZ_NO_ZLIB_COMPATIBLE_NAMES=1
338364
-Os
339365
build_unflags = -Og
340-
monitor_speed = 921600

src/main.cpp

Lines changed: 15 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,13 +1080,6 @@ void setup() {
10801080
while (true);
10811081
}
10821082

1083-
Serial.setRxBufferSize(SERIAL_BUFFER);
1084-
#if !defined(ARDUINO_ESP32_S3_N16R8) || !defined(DISPLAY_RM67162_AMOLED)
1085-
Serial.setTimeout(SERIAL_TIMEOUT);
1086-
#endif
1087-
Serial.begin(SERIAL_BAUD);
1088-
while (!Serial);
1089-
10901083
DisplayLogo();
10911084

10921085
#ifdef ZEDMD_WIFI
@@ -1129,10 +1122,17 @@ void setup() {
11291122
LoadScreensaverConfig(); // Load Screensaver config, this should be moved to
11301123
// all build configs but we will leave it in WiFi
11311124
// only for now.
1132-
1125+
#else
1126+
Serial.setRxBufferSize(SERIAL_BUFFER);
1127+
#if !defined(ARDUINO_ESP32_S3_N16R8) || !defined(DISPLAY_RM67162_AMOLED)
1128+
Serial.setTimeout(SERIAL_TIMEOUT);
1129+
#endif
1130+
Serial.begin(SERIAL_BAUD);
1131+
while (!Serial);
11331132
#endif
11341133
}
11351134

1135+
#if !defined(ZEDMD_WIFI)
11361136
bool SerialReadBuffer(uint8_t *pBuffer, uint16_t BufferSize,
11371137
bool fixedSize = true) {
11381138
memset(pBuffer, 0, BufferSize);
@@ -1227,7 +1227,6 @@ bool SerialReadBuffer(uint8_t *pBuffer, uint16_t BufferSize,
12271227
}
12281228

12291229
void UpdateColorRotations(void) {
1230-
#if !defined(ZEDMD_WIFI)
12311230
bool rotPaletteAffected[64] = {0};
12321231
unsigned long actime = millis();
12331232
bool rotfound = false;
@@ -1254,7 +1253,6 @@ void UpdateColorRotations(void) {
12541253
if (rotfound == true)
12551254
display->FillPanelUsingChangedPalette(renderBuffer, palette,
12561255
rotPaletteAffected);
1257-
#endif
12581256
}
12591257

12601258
bool WaitForCtrlChars(void) {
@@ -1295,6 +1293,7 @@ bool WaitForCtrlChars(void) {
12951293

12961294
return true;
12971295
}
1296+
#endif
12981297

12991298
void loop() {
13001299
while (MireActive) {
@@ -1334,13 +1333,16 @@ void loop() {
13341333
DisplayLum();
13351334
}
13361335

1336+
#if !defined(ZEDMD_WIFI)
13371337
if (Serial.available() > 0) {
13381338
if (rgbMode != rgbModeLoaded) {
13391339
Restart();
13401340
}
13411341
ClearScreen();
13421342
MireActive = false;
1343-
} else if ((millis() - displayTimeout) > LOGO_TIMEOUT) {
1343+
} else
1344+
#endif
1345+
if ((millis() - displayTimeout) > LOGO_TIMEOUT) {
13441346
if (displayStatus == DISPLAY_STATUS_NORMAL_OPERATION) {
13451347
#if !defined(ZEDMD_WIFI)
13461348
if (rgbMode != rgbModeLoaded) {
@@ -1365,6 +1367,7 @@ void loop() {
13651367
}
13661368
}
13671369

1370+
#if !defined(ZEDMD_WIFI)
13681371
// After handshake, send a (R)eady signal to indicate that a new command could
13691372
// be sent. The client has to wait for it to avoid buffer issues. The
13701373
// handshake itself works without it.
@@ -1455,7 +1458,6 @@ void loop() {
14551458
break;
14561459
}
14571460

1458-
#if !defined(ZEDMD_WIFI)
14591461
case 20: // turn off upscaling
14601462
{
14611463
upscaling = false;
@@ -1467,7 +1469,6 @@ void loop() {
14671469
upscaling = true;
14681470
Serial.write('A');
14691471
break;
1470-
#endif
14711472

14721473
case 22: // set brightness
14731474
{
@@ -1517,65 +1518,11 @@ void loop() {
15171518
break;
15181519
}
15191520

1520-
#ifdef ZEDMD_WIFI
1521-
// These are one time programmig options over USB until ZeDMD could
1522-
// establish the WiFi Connection at startup. When WiFi is finally active,
1523-
// USB is turned off.
1524-
case 27: // set WiFi SSID
1525-
{
1526-
uint8_t tbuf[33];
1527-
if (SerialReadBuffer(tbuf, 33, false)) {
1528-
// tbuf[0] now contains the length of the string
1529-
ssid_length = tbuf[0];
1530-
char *tmp = (char *)malloc(ssid_length);
1531-
memcpy(tmp, &tbuf[1], ssid_length);
1532-
ssid = String(tmp);
1533-
free(tmp);
1534-
Serial.write('A');
1535-
} else {
1536-
Serial.write('E');
1537-
}
1538-
break;
1539-
}
1540-
1541-
case 28: // set WiFi password
1542-
{
1543-
uint8_t tbuf[33];
1544-
if (SerialReadBuffer(tbuf, 33, false)) {
1545-
// tbuf[0] now contains the length of the string
1546-
pwd_length = tbuf[0];
1547-
char *tmp = (char *)malloc(pwd_length);
1548-
memcpy(tmp, &tbuf[1], pwd_length);
1549-
pwd = String(tmp);
1550-
free(tmp);
1551-
Serial.write('A');
1552-
} else {
1553-
Serial.write('E');
1554-
}
1555-
break;
1556-
}
1557-
1558-
case 29: // set WiFi port
1559-
{
1560-
uint8_t tbuf[2];
1561-
if (SerialReadBuffer(tbuf, 2)) {
1562-
port = ((((unsigned int)tbuf[0]) << 8) + ((unsigned int)tbuf[1]));
1563-
Serial.write('A');
1564-
} else {
1565-
Serial.write('E');
1566-
}
1567-
break;
1568-
}
1569-
#endif
1570-
15711521
case 30: // save settings
15721522
{
15731523
Serial.write('A');
15741524
SaveLum();
15751525
SaveRgbOrder();
1576-
#ifdef ZEDMD_WIFI
1577-
SaveWiFiConfig();
1578-
#endif
15791526
break;
15801527
}
15811528

@@ -1633,7 +1580,6 @@ void loop() {
16331580
break;
16341581
}
16351582

1636-
#if !defined(ZEDMD_WIFI)
16371583
case 4: // mode RGB24 zones streaming
16381584
{
16391585
renderBuffer =
@@ -2080,7 +2026,6 @@ void loop() {
20802026
}
20812027
break;
20822028
}
2083-
#endif
20842029
default: {
20852030
display->DisplayText("Unsupported render mode:", 0, 0, 255, 0, 0);
20862031
DisplayNumber(c4, 3, 24 * 4, 0, 255, 0, 0);
@@ -2095,4 +2040,5 @@ void loop() {
20952040

20962041
DisplayDebugInfo();
20972042
}
2043+
#endif
20982044
}

0 commit comments

Comments
 (0)