Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/mdev' into GoL-Fast
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon502 committed Nov 14, 2024
2 parents 5d27e8f + 5ea3aa9 commit 192b4a8
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 38 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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/

Expand Down
33 changes: 28 additions & 5 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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}
Expand All @@ -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}
Expand Down Expand Up @@ -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
Expand Down
18 changes: 9 additions & 9 deletions wled00/FX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2589,7 +2589,7 @@ uint16_t ripple_base()
} else {//randomly create new wave
if (random16(IBN + 10000) <= (SEGMENT.intensity >> (SEGMENT.is2D()*3))) {
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
}
}
Expand Down Expand Up @@ -5884,7 +5884,7 @@ uint16_t mode_2Dmatrix(void) { // Matrix2D. By Jeremy Williams.

// spawn new falling code
if (random8() <= SEGMENT.intensity || emptyScreen) {
uint8_t spawnX = random8(cols);
uint16_t spawnX = random16(cols);
SEGMENT.setPixelColorXY(spawnX, 0, spawnColor);
// update hint for next run
SEGENV.aux0 = spawnX;
Expand Down Expand Up @@ -6357,8 +6357,8 @@ uint16_t mode_2Dcrazybees(void) {
void aimed(uint_fast16_t w, uint_fast16_t h) {
if (!true) //WLEDMM SuperSync
random16_set_seed(strip.now);
aimX = random8(0, w);
aimY = random8(0, h);
aimX = random8(0, min(UINT8_MAX, int(w)));
aimY = random8(0, min(UINT8_MAX, int(h)));
hue = random8();
deltaX = abs(aimX - posX);
deltaY = abs(aimY - posY);
Expand All @@ -6377,8 +6377,8 @@ uint16_t mode_2Dcrazybees(void) {
SEGMENT.setUpLeds();
SEGMENT.fill(BLACK);
for (size_t i = 0; i < n; i++) {
bee[i].posX = random8(0, cols);
bee[i].posY = random8(0, rows);
bee[i].posX = random8(0, min(UINT8_MAX, int(cols)));
bee[i].posY = random8(0, min(UINT8_MAX, int(rows)));
bee[i].aimed(cols, rows);
}
}
Expand Down Expand Up @@ -8502,7 +8502,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;
Expand Down Expand Up @@ -8539,8 +8539,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
Expand Down
12 changes: 6 additions & 6 deletions wled00/FX.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions wled00/FX_2Dfcn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
23 changes: 13 additions & 10 deletions wled00/FX_fcn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -873,8 +873,11 @@ uint16_t Segment::calc_virtualLength() const {
vLen = max(vW,vH); // get the longest dimension
break;
case M12_pArc:
vLen = sqrt16(vW * vW + vH * vH);
if (vW != vH) vLen++; // round up
{ unsigned vLen2 = vW * vW + vH * vH; // length ^2
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;
case M12_jMap: //WLEDMM jMap
if (jMap)
Expand All @@ -888,7 +891,7 @@ uint16_t Segment::calc_virtualLength() const {
if (nrOfVStrips()>1)
vLen = max(vW,vH) * 4;//0.5; // get the longest dimension
else
vLen = max(vW,vH) * 0.5; // get the longest dimension
vLen = max(vW,vH) * 0.5f; // get the longest dimension
break;
case M12_sPinwheel:
vLen = getPinwheelLength(vW, vH);
Expand All @@ -906,23 +909,23 @@ uint16_t Segment::calc_virtualLength() const {
//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) {
float i2;
if (i<=SEGLEN*0.25) { //top, left to right
i2 = i/(SEGLEN*0.25);
if (i<=SEGLEN*0.25f) { //top, left to right
i2 = i/(SEGLEN*0.25f);
x = vW / 2 - vStrip - 1 + i2 * vStrip * 2;
y = vH / 2 - vStrip - 1;
}
else if (i <= SEGLEN * 0.5) { //right, top to bottom
i2 = (i-SEGLEN*0.25)/(SEGLEN*0.25);
else if (i <= SEGLEN * 0.5f) { //right, top to bottom
i2 = (i-SEGLEN*0.25f)/(SEGLEN*0.25f);
x = vW / 2 + vStrip;
y = vH / 2 - vStrip - 1 + i2 * vStrip * 2;
}
else if (i <= SEGLEN * 0.75) { //bottom, right to left
i2 = (i-SEGLEN*0.5)/(SEGLEN*0.25);
else if (i <= SEGLEN * 0.75f) { //bottom, right to left
i2 = (i-SEGLEN*0.5f)/(SEGLEN*0.25f);
x = vW / 2 + vStrip - i2 * vStrip * 2;
y = vH / 2 + vStrip;
}
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;
y = vH / 2 + vStrip - i2 * vStrip * 2;
}
Expand Down
8 changes: 4 additions & 4 deletions wled00/data/settings_2D.htm
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@
<option value="1">Vertical</option>
</select><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>
Offset X:<input id="P${i}X" name="P${i}X" type="number" min="0" max="255" 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>
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="1023" value="0" oninput="draw()">
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>`;
p.insertAdjacentHTML("beforeend", b);
}
Expand Down Expand Up @@ -401,7 +401,7 @@ <h3 id="title">Matrix Setup</h3>
<h3 id="title">Matrix Generator <button type="button" id="expGen" onclick="expand(this,gId('mxGen'));">&gt;</button></h3>
</div>
<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()">
Vertical panels: <input name="MPV" type="number" min="1" max="8" value="1" oninput="fieldChange()"><br>
<div id="blockPanelOrientation">
Expand Down
2 changes: 1 addition & 1 deletion wled00/wled.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

// 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.
#define _MoonModules_WLED_
Expand Down

0 comments on commit 192b4a8

Please sign in to comment.