From 8f4b6d01d426cac2c951c18eaf5eedccf5fd9ada Mon Sep 17 00:00:00 2001
From: Frank <91616163+softhack007@users.noreply.github.com>
Date: Sun, 10 Nov 2024 20:51:30 +0100
Subject: [PATCH 1/6] add [env:esp32s2_PSRAM_S]
with reduced functionality, to be OTA compatible to upstream WLED
---
platformio.ini | 33 ++++++++++++++++++++++++++++-----
1 file changed, 28 insertions(+), 5 deletions(-)
diff --git a/platformio.ini b/platformio.ini
index 248d27fea3..49f9da49a3 100644
--- a/platformio.ini
+++ b/platformio.ini
@@ -81,7 +81,8 @@ default_envs =
esp32S3_16MB_PSRAM_M_HUB75 ;; for S3 with 16MB flash, and MOONHUB HUB75 adapter board
esp32S3_WROOM-2_M ;; for S3 WROOM-2
;; esp32s2_tinyUF2_PSRAM_S ;; experimental - only for adafruit -S2 boards with tinyUF2 bootloader !!!
- esp32s2_PSRAM_M ;; experimental
+ esp32s2_PSRAM_S ;; OTA-compatible with upstream
+ esp32s2_PSRAM_M ;; for lolin S2 mini
esp32c3dev_4MB_M ;; experimental
esp32c3dev_2MB_M ;; experimental - 2MB Flash, no OTA
esp32c3mini_dio_4MB_M ;; for boards that need "dio" flash mode (instead of qio)
@@ -2299,7 +2300,7 @@ platform = ${esp32s2.platform} ;; using 5.2.0, due to
platform_packages = ${esp32s2.platform_packages}
board = lolin_s2_mini
-board_build.partitions = tools/WLED_ESP32_4MB_256KB_FS.csv ;; 1.8MB firmware, 256KB filesystem (esptool erase_flash needed when changing from "standard WLED" partitions)
+board_build.partitions = ${esp32.extended_partitions} ;; 1.65MB firmware, 700KB filesystem (esptool erase_flash needed when changing from "standard WLED" partitions)
board_build.flash_mode = dio
upload_speed = 256000 ;; 921600
build_unflags = ${common.build_unflags}
@@ -2308,7 +2309,6 @@ build_unflags = ${common.build_unflags}
-D USERMOD_DALLASTEMPERATURE ;; disabled because it hangs during usermod setup on -S3 (autodetect broken?)
-D WLED_ENABLE_DMX ;; disabled because it does not work with ESP-IDF 4.4.x (buggy driver in SparkFunDMX)
-D WLED_ENABLE_DMX_INPUT ;; needs more testing
- -DWLEDMM_FASTPATH ;; needs more testing on -S2
-D WLED_ENABLE_HUB75MATRIX
build_flags = ${common.build_flags} ${esp32s2.build_flags}
;; ${Debug_Flags.build_flags}
@@ -2340,9 +2340,32 @@ lib_deps = ${esp32s2.lib_deps} ${common_mm.lib_deps_S} ${common_mm.lib_deps_V4_M
lib_ignore =
IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation
OneWire ; not needed as we don't include USERMOD_DALLASTEMPERATURE
+ ${common_mm.HUB75_lib_ignore}
+ ${common_mm.DMXin_lib_ignore}
monitor_filters = esp32_exception_decoder
-; RAM: [== ] 21.8% (used 71304 bytes from 327680 bytes)
-; Flash: [======== ] 84.0% (used 1596970 bytes from 1900544 bytes)
+; RAM: [== ] 20.5% (used 67256 bytes from 327680 bytes)
+; Flash: [========= ] 93.3% (used 1590266 bytes from 1703936 bytes)
+
+[env:esp32s2_PSRAM_S]
+extends = env:esp32s2_PSRAM_M
+board_build.partitions = ${esp32.default_partitions} ;; 1.55MB firmware, 1MB filesystem
+build_unflags = ${env:esp32s2_PSRAM_M.build_unflags}
+ -DWLED_DISABLE_ADALIGHT
+ -D WLED_RELEASE_NAME=esp32s2_4MB_M
+ -DUSE_ALT_DISPLAY
+ -DUSERMOD_FOUR_LINE_DISPLAY
+ -DUSERMOD_ROTARY_ENCODER_UI
+ -DUSERMOD_ANIMARTRIX
+ ;; -DUSERMOD_ARTIFX ;; uncomment to reduce flash size
+build_flags = ${env:esp32s2_PSRAM_M.build_flags}
+ -D WLED_RELEASE_NAME=esp32s2_4MB_S
+lib_deps = ${env:esp32s2_PSRAM_M.lib_deps}
+lib_ignore = ${env:esp32s2_PSRAM_M.lib_ignore}
+ U8g2
+ ${common_mm.animartrix_lib_ignore}
+; RAM: [== ] 20.4% (used 66792 bytes from 327680 bytes)
+; Flash: [========= ] 94.8% (used 1490390 bytes from 1572864 bytes)
+
# ------------------------------------------------------------------------------
# esp32-C3 environments
From 7a3a1ce177c49a5cb495122b2ee03016dc91bf33 Mon Sep 17 00:00:00 2001
From: Frank <91616163+softhack007@users.noreply.github.com>
Date: Sun, 10 Nov 2024 21:37:10 +0100
Subject: [PATCH 2/6] add some CLion internal files to .gitignore
---
.gitignore | 3 +++
1 file changed, 3 insertions(+)
diff --git a/.gitignore b/.gitignore
index cdfd81d0f1..574299fb97 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,7 +13,10 @@ esp01-update.sh
platformio_override.ini
replace_fs.py
wled-update.sh
+Qodana.yaml
+compile_commands.json
+/build/
/build_output/
/node_modules/
From df9b1a41a9e3d36bb0973e467f6fef9c801dd868 Mon Sep 17 00:00:00 2001
From: Frank <91616163+softhack007@users.noreply.github.com>
Date: Mon, 11 Nov 2024 11:55:58 +0100
Subject: [PATCH 3/6] Update .gitignore
lowercase
---
.gitignore | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.gitignore b/.gitignore
index 574299fb97..5a9283257a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,7 +13,7 @@ esp01-update.sh
platformio_override.ini
replace_fs.py
wled-update.sh
-Qodana.yaml
+qodana.yaml
compile_commands.json
/build/
From 202255849fceaf29703e5f1eafb98d0fc5546f97 Mon Sep 17 00:00:00 2001
From: Frank <91616163+softhack007@users.noreply.github.com>
Date: Wed, 13 Nov 2024 23:06:27 +0100
Subject: [PATCH 4/6] fix errors when width>255 or height>255
some effects still don't work when x y dimensions do not fit into 8bit
---
wled00/FX.cpp | 6 +++---
wled00/FX.h | 12 ++++++------
wled00/FX_2Dfcn.cpp | 6 +++---
wled00/data/settings_2D.htm | 8 ++++----
wled00/wled.h | 2 +-
5 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/wled00/FX.cpp b/wled00/FX.cpp
index 0bface88ac..79614d224c 100644
--- a/wled00/FX.cpp
+++ b/wled00/FX.cpp
@@ -8421,7 +8421,7 @@ uint16_t mode_2Doctopus() {
const uint16_t cols = SEGMENT.virtualWidth();
const uint16_t rows = SEGMENT.virtualHeight();
- const uint8_t mapp = 180 / MAX(cols,rows);
+ const uint16_t mapp = max(1, 180 / MAX(cols,rows)); // WLEDMM make sure this value is not 0
typedef struct {
uint8_t angle;
@@ -8458,8 +8458,8 @@ uint16_t mode_2Doctopus() {
SEGENV.aux1 = rows;
*offsX = SEGMENT.custom1;
*offsY = SEGMENT.custom2;
- const uint8_t C_X = cols / 2 + (SEGMENT.custom1 - 128)*cols/255;
- const uint8_t C_Y = rows / 2 + (SEGMENT.custom2 - 128)*rows/255;
+ const uint16_t C_X = cols / 2 + (SEGMENT.custom1 - 128)*cols/255;
+ const uint16_t C_Y = rows / 2 + (SEGMENT.custom2 - 128)*rows/255;
for (int x = xStart; x < xEnd; x++) {
for (int y = yStart; y < yEnd; y++) {
rMap[XY(x, y)].angle = int(40.7436f * atan2f((y - C_Y), (x - C_X))); // avoid 128*atan2()/PI
diff --git a/wled00/FX.h b/wled00/FX.h
index 413b87cd20..c06934629d 100644
--- a/wled00/FX.h
+++ b/wled00/FX.h
@@ -390,8 +390,8 @@ typedef struct Segment {
bool check2 : 1; // checkmark 2
bool check3 : 1; // checkmark 3
};
- uint8_t startY; // start Y coodrinate 2D (top); there should be no more than 255 rows
- uint8_t stopY; // stop Y coordinate 2D (bottom); there should be no more than 255 rows
+ uint16_t startY; // start Y coodrinate 2D (top); there should be no more than 255 rows, but we cannot be sure.
+ uint16_t stopY; // stop Y coordinate 2D (bottom); there should be no more than 255 rows, but we cannot be sure.
char *name = nullptr; // WLEDMM initialize to nullptr
// runtime data
@@ -1017,10 +1017,10 @@ class WS2812FX { // 96 bytes
} panelO; //panelOrientation
typedef struct panel_t {
- uint8_t xOffset; // x offset relative to the top left of matrix in LEDs. WLEDMM 8 bits/256 is enough
- uint8_t yOffset; // y offset relative to the top left of matrix in LEDs. WLEDMM 8 bits/256 is enough
- uint8_t width; // width of the panel
- uint8_t height; // height of the panel
+ uint16_t xOffset; // x offset relative to the top left of matrix in LEDs.
+ uint16_t yOffset; // y offset relative to the top left of matrix in LEDs.
+ uint16_t width; // width of the panel
+ uint16_t height; // height of the panel
union {
uint8_t options;
struct {
diff --git a/wled00/FX_2Dfcn.cpp b/wled00/FX_2Dfcn.cpp
index 57612247d3..f6d2bc0b6c 100644
--- a/wled00/FX_2Dfcn.cpp
+++ b/wled00/FX_2Dfcn.cpp
@@ -129,11 +129,11 @@ void WS2812FX::setUpMatrix() {
}
if (needLedMap && customMappingTable != nullptr) { // softhack007
- uint16_t x, y, pix=0; //pixel
+ uint_fast16_t x, y, pix=0; //pixel
for (size_t pan = 0; pan < panel.size(); pan++) {
Panel &p = panel[pan];
- uint16_t h = p.vertical ? p.height : p.width;
- uint16_t v = p.vertical ? p.width : p.height;
+ uint_fast16_t h = p.vertical ? p.height : p.width;
+ uint_fast16_t v = p.vertical ? p.width : p.height;
for (size_t j = 0; j < v; j++){
for(size_t i = 0; i < h; i++) {
y = (p.vertical?p.rightStart:p.bottomStart) ? v-j-1 : j;
diff --git a/wled00/data/settings_2D.htm b/wled00/data/settings_2D.htm
index c602b98c69..c57bf3d9ec 100644
--- a/wled00/data/settings_2D.htm
+++ b/wled00/data/settings_2D.htm
@@ -111,9 +111,9 @@
Serpentine:
-Dimensions (WxH): x
-Offset X:
-Y:
(offset from top-left corner in # LEDs)
+Dimensions (WxH): x
+Offset X:
+Y:
(offset from top-left corner in # LEDs)
`;
p.insertAdjacentHTML("beforeend", b);
}
@@ -401,7 +401,7 @@