Merge remote-tracking branch 'upstream/mdev' into GoL-Fast

This commit is contained in:
Brandon502
2024-11-13 22:05:18 -05:00
8 changed files with 67 additions and 38 deletions

3
.gitignore vendored
View File

@@ -13,7 +13,10 @@ esp01-update.sh
platformio_override.ini platformio_override.ini
replace_fs.py replace_fs.py
wled-update.sh wled-update.sh
qodana.yaml
compile_commands.json
/build/
/build_output/ /build_output/
/node_modules/ /node_modules/

View File

@@ -81,7 +81,8 @@ default_envs =
esp32S3_16MB_PSRAM_M_HUB75 ;; for S3 with 16MB flash, and MOONHUB HUB75 adapter board esp32S3_16MB_PSRAM_M_HUB75 ;; for S3 with 16MB flash, and MOONHUB HUB75 adapter board
esp32S3_WROOM-2_M ;; for S3 WROOM-2 esp32S3_WROOM-2_M ;; for S3 WROOM-2
;; esp32s2_tinyUF2_PSRAM_S ;; experimental - only for adafruit -S2 boards with tinyUF2 bootloader !!! ;; 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_4MB_M ;; experimental
esp32c3dev_2MB_M ;; experimental - 2MB Flash, no OTA esp32c3dev_2MB_M ;; experimental - 2MB Flash, no OTA
esp32c3mini_dio_4MB_M ;; for boards that need "dio" flash mode (instead of qio) 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} platform_packages = ${esp32s2.platform_packages}
board = lolin_s2_mini 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 board_build.flash_mode = dio
upload_speed = 256000 ;; 921600 upload_speed = 256000 ;; 921600
build_unflags = ${common.build_unflags} 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 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 ;; disabled because it does not work with ESP-IDF 4.4.x (buggy driver in SparkFunDMX)
-D WLED_ENABLE_DMX_INPUT ;; needs more testing -D WLED_ENABLE_DMX_INPUT ;; needs more testing
-DWLEDMM_FASTPATH ;; needs more testing on -S2
-D WLED_ENABLE_HUB75MATRIX -D WLED_ENABLE_HUB75MATRIX
build_flags = ${common.build_flags} ${esp32s2.build_flags} build_flags = ${common.build_flags} ${esp32s2.build_flags}
;; ${Debug_Flags.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 = lib_ignore =
IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation
OneWire ; not needed as we don't include USERMOD_DALLASTEMPERATURE 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 monitor_filters = esp32_exception_decoder
; RAM: [== ] 21.8% (used 71304 bytes from 327680 bytes) ; RAM: [== ] 20.5% (used 67256 bytes from 327680 bytes)
; Flash: [======== ] 84.0% (used 1596970 bytes from 1900544 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 # esp32-C3 environments

View File

@@ -2589,7 +2589,7 @@ uint16_t ripple_base()
} else {//randomly create new wave } else {//randomly create new wave
if (random16(IBN + 10000) <= (SEGMENT.intensity >> (SEGMENT.is2D()*3))) { if (random16(IBN + 10000) <= (SEGMENT.intensity >> (SEGMENT.is2D()*3))) {
ripples[i].state = 1; ripples[i].state = 1;
ripples[i].pos = SEGMENT.is2D() ? ((random8(SEGENV.virtualWidth())<<8) | (random8(SEGENV.virtualHeight()))) : random16(SEGLEN); ripples[i].pos = SEGMENT.is2D() ? ((random16(SEGENV.virtualWidth())<<8) | (random16(SEGENV.virtualHeight()))) : random16(SEGLEN);
ripples[i].color = random8(); //color ripples[i].color = random8(); //color
} }
} }
@@ -5884,7 +5884,7 @@ uint16_t mode_2Dmatrix(void) { // Matrix2D. By Jeremy Williams.
// spawn new falling code // spawn new falling code
if (random8() <= SEGMENT.intensity || emptyScreen) { if (random8() <= SEGMENT.intensity || emptyScreen) {
uint8_t spawnX = random8(cols); uint16_t spawnX = random16(cols);
SEGMENT.setPixelColorXY(spawnX, 0, spawnColor); SEGMENT.setPixelColorXY(spawnX, 0, spawnColor);
// update hint for next run // update hint for next run
SEGENV.aux0 = spawnX; SEGENV.aux0 = spawnX;
@@ -6357,8 +6357,8 @@ uint16_t mode_2Dcrazybees(void) {
void aimed(uint_fast16_t w, uint_fast16_t h) { void aimed(uint_fast16_t w, uint_fast16_t h) {
if (!true) //WLEDMM SuperSync if (!true) //WLEDMM SuperSync
random16_set_seed(strip.now); random16_set_seed(strip.now);
aimX = random8(0, w); aimX = random8(0, min(UINT8_MAX, int(w)));
aimY = random8(0, h); aimY = random8(0, min(UINT8_MAX, int(h)));
hue = random8(); hue = random8();
deltaX = abs(aimX - posX); deltaX = abs(aimX - posX);
deltaY = abs(aimY - posY); deltaY = abs(aimY - posY);
@@ -6377,8 +6377,8 @@ uint16_t mode_2Dcrazybees(void) {
SEGMENT.setUpLeds(); SEGMENT.setUpLeds();
SEGMENT.fill(BLACK); SEGMENT.fill(BLACK);
for (size_t i = 0; i < n; i++) { for (size_t i = 0; i < n; i++) {
bee[i].posX = random8(0, cols); bee[i].posX = random8(0, min(UINT8_MAX, int(cols)));
bee[i].posY = random8(0, rows); bee[i].posY = random8(0, min(UINT8_MAX, int(rows)));
bee[i].aimed(cols, rows); bee[i].aimed(cols, rows);
} }
} }
@@ -8502,7 +8502,7 @@ uint16_t mode_2Doctopus() {
const uint16_t cols = SEGMENT.virtualWidth(); const uint16_t cols = SEGMENT.virtualWidth();
const uint16_t rows = SEGMENT.virtualHeight(); 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 { typedef struct {
uint8_t angle; uint8_t angle;
@@ -8539,8 +8539,8 @@ uint16_t mode_2Doctopus() {
SEGENV.aux1 = rows; SEGENV.aux1 = rows;
*offsX = SEGMENT.custom1; *offsX = SEGMENT.custom1;
*offsY = SEGMENT.custom2; *offsY = SEGMENT.custom2;
const uint8_t C_X = cols / 2 + (SEGMENT.custom1 - 128)*cols/255; const uint16_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_Y = rows / 2 + (SEGMENT.custom2 - 128)*rows/255;
for (int x = xStart; x < xEnd; x++) { for (int x = xStart; x < xEnd; x++) {
for (int y = yStart; y < yEnd; y++) { 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 rMap[XY(x, y)].angle = int(40.7436f * atan2f((y - C_Y), (x - C_X))); // avoid 128*atan2()/PI

View File

@@ -390,8 +390,8 @@ typedef struct Segment {
bool check2 : 1; // checkmark 2 bool check2 : 1; // checkmark 2
bool check3 : 1; // checkmark 3 bool check3 : 1; // checkmark 3
}; };
uint8_t startY; // start Y coodrinate 2D (top); 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.
uint8_t stopY; // stop Y coordinate 2D (bottom); there should be no more than 255 rows 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 char *name = nullptr; // WLEDMM initialize to nullptr
// runtime data // runtime data
@@ -1017,10 +1017,10 @@ class WS2812FX { // 96 bytes
} panelO; //panelOrientation } panelO; //panelOrientation
typedef struct panel_t { typedef struct panel_t {
uint8_t xOffset; // x offset relative to the top left of matrix in LEDs. WLEDMM 8 bits/256 is enough uint16_t xOffset; // x offset relative to the top left of matrix in LEDs.
uint8_t yOffset; // y offset relative to the top left of matrix in LEDs. WLEDMM 8 bits/256 is enough uint16_t yOffset; // y offset relative to the top left of matrix in LEDs.
uint8_t width; // width of the panel uint16_t width; // width of the panel
uint8_t height; // height of the panel uint16_t height; // height of the panel
union { union {
uint8_t options; uint8_t options;
struct { struct {

View File

@@ -129,11 +129,11 @@ void WS2812FX::setUpMatrix() {
} }
if (needLedMap && customMappingTable != nullptr) { // softhack007 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++) { for (size_t pan = 0; pan < panel.size(); pan++) {
Panel &p = panel[pan]; Panel &p = panel[pan];
uint16_t h = p.vertical ? p.height : p.width; uint_fast16_t h = p.vertical ? p.height : p.width;
uint16_t v = p.vertical ? p.width : p.height; uint_fast16_t v = p.vertical ? p.width : p.height;
for (size_t j = 0; j < v; j++){ for (size_t j = 0; j < v; j++){
for(size_t i = 0; i < h; i++) { for(size_t i = 0; i < h; i++) {
y = (p.vertical?p.rightStart:p.bottomStart) ? v-j-1 : j; y = (p.vertical?p.rightStart:p.bottomStart) ? v-j-1 : j;

View File

@@ -873,8 +873,11 @@ uint16_t Segment::calc_virtualLength() const {
vLen = max(vW,vH); // get the longest dimension vLen = max(vW,vH); // get the longest dimension
break; break;
case M12_pArc: case M12_pArc:
vLen = sqrt16(vW * vW + vH * vH); { unsigned vLen2 = vW * vW + vH * vH; // length ^2
if (vW != vH) vLen++; // round up if (vLen2 < UINT16_MAX) vLen = sqrt16(vLen2); // use faster function for 16bit values
else vLen = sqrtf(vLen2); // fall-back to float if bigger
if (vW != vH) vLen++; // round up
}
break; break;
case M12_jMap: //WLEDMM jMap case M12_jMap: //WLEDMM jMap
if (jMap) if (jMap)
@@ -888,7 +891,7 @@ uint16_t Segment::calc_virtualLength() const {
if (nrOfVStrips()>1) if (nrOfVStrips()>1)
vLen = max(vW,vH) * 4;//0.5; // get the longest dimension vLen = max(vW,vH) * 4;//0.5; // get the longest dimension
else else
vLen = max(vW,vH) * 0.5; // get the longest dimension vLen = max(vW,vH) * 0.5f; // get the longest dimension
break; break;
case M12_sPinwheel: case M12_sPinwheel:
vLen = getPinwheelLength(vW, vH); vLen = getPinwheelLength(vW, vH);
@@ -906,23 +909,23 @@ uint16_t Segment::calc_virtualLength() const {
//WLEDMM used for M12_sBlock //WLEDMM used for M12_sBlock
static void xyFromBlock(uint16_t &x,uint16_t &y, uint16_t i, uint16_t vW, uint16_t vH, uint16_t vStrip) { static void xyFromBlock(uint16_t &x,uint16_t &y, uint16_t i, uint16_t vW, uint16_t vH, uint16_t vStrip) {
float i2; float i2;
if (i<=SEGLEN*0.25) { //top, left to right if (i<=SEGLEN*0.25f) { //top, left to right
i2 = i/(SEGLEN*0.25); i2 = i/(SEGLEN*0.25f);
x = vW / 2 - vStrip - 1 + i2 * vStrip * 2; x = vW / 2 - vStrip - 1 + i2 * vStrip * 2;
y = vH / 2 - vStrip - 1; y = vH / 2 - vStrip - 1;
} }
else if (i <= SEGLEN * 0.5) { //right, top to bottom else if (i <= SEGLEN * 0.5f) { //right, top to bottom
i2 = (i-SEGLEN*0.25)/(SEGLEN*0.25); i2 = (i-SEGLEN*0.25f)/(SEGLEN*0.25f);
x = vW / 2 + vStrip; x = vW / 2 + vStrip;
y = vH / 2 - vStrip - 1 + i2 * vStrip * 2; y = vH / 2 - vStrip - 1 + i2 * vStrip * 2;
} }
else if (i <= SEGLEN * 0.75) { //bottom, right to left else if (i <= SEGLEN * 0.75f) { //bottom, right to left
i2 = (i-SEGLEN*0.5)/(SEGLEN*0.25); i2 = (i-SEGLEN*0.5f)/(SEGLEN*0.25f);
x = vW / 2 + vStrip - i2 * vStrip * 2; x = vW / 2 + vStrip - i2 * vStrip * 2;
y = vH / 2 + vStrip; y = vH / 2 + vStrip;
} }
else if (i <= SEGLEN) { //left, bottom to top else if (i <= SEGLEN) { //left, bottom to top
i2 = (i-SEGLEN*0.75)/(SEGLEN*0.25); i2 = (i-SEGLEN*0.75f)/(SEGLEN*0.25f);
x = vW / 2 - vStrip - 1; x = vW / 2 - vStrip - 1;
y = vH / 2 + vStrip - i2 * vStrip * 2; y = vH / 2 + vStrip - i2 * vStrip * 2;
} }

View File

@@ -111,9 +111,9 @@ Orientation: <select id="P${i}V" name="P${i}V" oninput="draw()">
<option value="1">Vertical</option> <option value="1">Vertical</option>
</select><br> </select><br>
Serpentine: <input id="P${i}S" name="P${i}S" type="checkbox" onclick="draw()"><br> Serpentine: <input id="P${i}S" name="P${i}S" type="checkbox" onclick="draw()"><br>
Dimensions (WxH): <input id="P${i}W" name="P${i}W" type="number" min="1" max="255" value="${pw}" oninput="draw()"> x <input id="P${i}H" name="P${i}H" type="number" min="1" max="255" value="${ph}" oninput="draw()"><br> Dimensions (WxH): <input id="P${i}W" name="P${i}W" type="number" min="1" max="1023" value="${pw}" oninput="draw()"> x <input id="P${i}H" name="P${i}H" type="number" min="1" max="1023" value="${ph}" oninput="draw()"><br>
Offset X:<input id="P${i}X" name="P${i}X" type="number" min="0" max="255" value="0" oninput="draw()"> Offset X:<input id="P${i}X" name="P${i}X" type="number" min="0" max="1023" value="0" oninput="draw()">
Y:<input id="P${i}Y" name="P${i}Y" type="number" min="0" max="255" value="0" oninput="draw()"><br><i>(offset from top-left corner in # LEDs)</i> Y:<input id="P${i}Y" name="P${i}Y" type="number" min="0" max="1023" value="0" oninput="draw()"><br><i>(offset from top-left corner in # LEDs)</i>
</div>`; </div>`;
p.insertAdjacentHTML("beforeend", b); p.insertAdjacentHTML("beforeend", b);
} }
@@ -401,7 +401,7 @@ Y:<input id="P${i}Y" name="P${i}Y" type="number" min="0" max="255" value="0" oni
<h3 id="title">Matrix Generator <button type="button" id="expGen" onclick="expand(this,gId('mxGen'));">&gt;</button></h3> <h3 id="title">Matrix Generator <button type="button" id="expGen" onclick="expand(this,gId('mxGen'));">&gt;</button></h3>
</div> </div>
<div id="mxGen" style="display:none;"> <div id="mxGen" style="display:none;">
Panel dimensions (WxH): <input name="PW" type="number" min="1" max="255" value="8" oninput="fieldChange()"> x <input name="PH" type="number" min="1" max="255" value="8" oninput="fieldChange()"><br> Panel dimensions (WxH): <input name="PW" type="number" min="1" max="1023" value="8" oninput="fieldChange()"> x <input name="PH" type="number" min="1" max="1023" value="8" oninput="fieldChange()"><br>
Horizontal panels: <input name="MPH" type="number" min="1" max="8" value="1" oninput="fieldChange()"> Horizontal panels: <input name="MPH" type="number" min="1" max="8" value="1" oninput="fieldChange()">
Vertical panels: <input name="MPV" type="number" min="1" max="8" value="1" oninput="fieldChange()"><br> Vertical panels: <input name="MPV" type="number" min="1" max="8" value="1" oninput="fieldChange()"><br>
<div id="blockPanelOrientation"> <div id="blockPanelOrientation">

View File

@@ -8,7 +8,7 @@
*/ */
// version code in format yymmddb (b = daily build) // version code in format yymmddb (b = daily build)
#define VERSION 2411080 #define VERSION 2411130
// WLEDMM - you can check for this define in usermods, to only enabled WLEDMM specific code in the "right" fork. Its not defined in AC WLED. // WLEDMM - you can check for this define in usermods, to only enabled WLEDMM specific code in the "right" fork. Its not defined in AC WLED.
#define _MoonModules_WLED_ #define _MoonModules_WLED_