Skip to content

Commit 834acc0

Browse files
authored
Merge branch 'wled:main' into main
2 parents d1c93ab + ca5debe commit 834acc0

File tree

8 files changed

+68
-22
lines changed

8 files changed

+68
-22
lines changed

.github/copilot-instructions.md

Lines changed: 43 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,27 @@ The build has two main phases:
3030
- Common environments: `nodemcuv2`, `esp32dev`, `esp8266_2m`
3131
- List all targets: `pio run --list-targets`
3232

33+
## Before Finishing Work
34+
35+
**CRITICAL: You MUST complete ALL of these steps before marking your work as complete:**
36+
37+
1. **Run the test suite**: `npm test` -- Set timeout to 2+ minutes. NEVER CANCEL.
38+
- All tests MUST pass
39+
- If tests fail, fix the issue before proceeding
40+
41+
2. **Build at least one hardware environment**: `pio run -e esp32dev` -- Set timeout to 30+ minutes. NEVER CANCEL.
42+
- Choose `esp32dev` as it's a common, representative environment
43+
- See "Hardware Compilation" section above for the full list of common environments
44+
- The build MUST complete successfully without errors
45+
- If the build fails, fix the issue before proceeding
46+
- **DO NOT skip this step** - it validates that firmware compiles with your changes
47+
48+
3. **For web UI changes only**: Manually test the interface
49+
- See "Manual Testing Scenarios" section below
50+
- Verify the UI loads and functions correctly
51+
52+
**If any of these validation steps fail, you MUST fix the issues before finishing. Do NOT mark work as complete with failing builds or tests.**
53+
3354
## Validation and Testing
3455

3556
### Web UI Testing
@@ -44,7 +65,7 @@ The build has two main phases:
4465
- **Code style**: Use tabs for web files (.html/.css/.js), spaces (2 per level) for C++ files
4566
- **C++ formatting available**: `clang-format` is installed but not in CI
4667
- **Always run tests before finishing**: `npm test`
47-
- **Always run a build for the common environment before finishing**
68+
- **MANDATORY: Always run a hardware build before finishing** (see "Before Finishing Work" section below)
4869

4970
### Manual Testing Scenarios
5071
After making changes to web UI, always test:
@@ -100,10 +121,16 @@ package.json # Node.js dependencies and scripts
100121

101122
## Build Timing and Timeouts
102123

103-
- **Web UI build**: 3 seconds - Set timeout to 30 seconds minimum
104-
- **Test suite**: 40 seconds - Set timeout to 2 minutes minimum
105-
- **Hardware builds**: 15+ minutes - Set timeout to 30+ minutes minimum
106-
- **NEVER CANCEL long-running builds** - PlatformIO downloads and compilation can take significant time
124+
**IMPORTANT: Use these timeout values when running builds:**
125+
126+
- **Web UI build** (`npm run build`): 3 seconds typical - Set timeout to 30 seconds minimum
127+
- **Test suite** (`npm test`): 40 seconds typical - Set timeout to 120 seconds (2 minutes) minimum
128+
- **Hardware builds** (`pio run -e [target]`): 15-20 minutes typical for first build - Set timeout to 1800 seconds (30 minutes) minimum
129+
- Subsequent builds are faster due to caching
130+
- First builds download toolchains and dependencies which takes significant time
131+
- **NEVER CANCEL long-running builds** - PlatformIO downloads and compilation require patience
132+
133+
**When validating your changes before finishing, you MUST wait for the hardware build to complete successfully. Set the timeout appropriately and be patient.**
107134

108135
## Troubleshooting
109136

@@ -129,11 +156,17 @@ package.json # Node.js dependencies and scripts
129156
- **Hardware builds require appropriate ESP32/ESP8266 development board**
130157

131158
## CI/CD Pipeline
132-
The GitHub Actions workflow:
159+
160+
**The GitHub Actions CI workflow will:**
133161
1. Installs Node.js and Python dependencies
134-
2. Runs `npm test` to validate build system
135-
3. Builds web UI with `npm run build`
136-
4. Compiles firmware for multiple hardware targets
162+
2. Runs `npm test` to validate build system (MUST pass)
163+
3. Builds web UI with `npm run build` (automatically run by PlatformIO)
164+
4. Compiles firmware for ALL hardware targets listed in `default_envs` (MUST succeed for all)
137165
5. Uploads build artifacts
138166

139-
Match this workflow in your local development to ensure CI success.
167+
**To ensure CI success, you MUST locally:**
168+
- Run `npm test` and ensure it passes
169+
- Run `pio run -e esp32dev` (or another common environment from "Hardware Compilation" section) and ensure it completes successfully
170+
- If either fails locally, it WILL fail in CI
171+
172+
**Match this workflow in your local development to ensure CI success. Do not mark work complete until you have validated builds locally.**

platformio.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ board_build.partitions = ${esp32.large_partitions}
450450
board_upload.flash_size = 8MB
451451
board_upload.maximum_size = 8388608
452452
; board_build.f_flash = 80000000L
453-
; board_build.flash_mode = qio
453+
board_build.flash_mode = dio
454454

455455
[env:esp32dev_16M]
456456
board = esp32dev

wled00/FX.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,8 @@ uint16_t mode_copy_segment(void) {
135135
SEGMENT.fadeToBlackBy(5); // fade out
136136
return FRAMETIME;
137137
}
138-
Segment sourcesegment = strip.getSegment(sourceid);
138+
Segment& sourcesegment = strip.getSegment(sourceid);
139+
139140
if (sourcesegment.isActive()) {
140141
uint32_t sourcecolor;
141142
uint32_t destcolor;
@@ -677,7 +678,7 @@ uint16_t mode_twinkle(void) {
677678
SEGENV.step = it;
678679
}
679680

680-
unsigned PRNG16 = SEGENV.aux1;
681+
uint16_t PRNG16 = SEGENV.aux1;
681682

682683
for (unsigned i = 0; i < SEGENV.aux0; i++)
683684
{
@@ -1714,8 +1715,8 @@ static const char _data_FX_MODE_TRICOLOR_WIPE[] PROGMEM = "Tri Wipe@!;1,2,3;!";
17141715
* Modified by Aircoookie
17151716
*/
17161717
uint16_t mode_tricolor_fade(void) {
1717-
unsigned counter = strip.now * ((SEGMENT.speed >> 3) +1);
1718-
uint16_t prog = (counter * 768) >> 16;
1718+
uint16_t counter = strip.now * ((SEGMENT.speed >> 3) +1);
1719+
uint32_t prog = (counter * 768) >> 16;
17191720

17201721
uint32_t color1 = 0, color2 = 0;
17211722
unsigned stage = 0;

wled00/FX.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,9 @@ class Segment {
625625
DEBUGFX_PRINTLN();
626626
#endif
627627
clearName();
628+
#ifdef WLED_ENABLE_GIF
629+
endImagePlayback(this);
630+
#endif
628631
deallocateData();
629632
p_free(pixels);
630633
}

wled00/FX_fcn.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,9 @@ void Segment::setGeometry(uint16_t i1, uint16_t i2, uint8_t grp, uint8_t spc, ui
448448

449449
// apply change immediately
450450
if (i2 <= i1) { //disable segment
451+
#ifdef WLED_ENABLE_GIF
452+
endImagePlayback(this);
453+
#endif
451454
deallocateData();
452455
p_free(pixels);
453456
pixels = nullptr;
@@ -466,6 +469,9 @@ void Segment::setGeometry(uint16_t i1, uint16_t i2, uint8_t grp, uint8_t spc, ui
466469
#endif
467470
// safety check
468471
if (start >= stop || startY >= stopY) {
472+
#ifdef WLED_ENABLE_GIF
473+
endImagePlayback(this);
474+
#endif
469475
deallocateData();
470476
p_free(pixels);
471477
pixels = nullptr;
@@ -479,6 +485,9 @@ void Segment::setGeometry(uint16_t i1, uint16_t i2, uint8_t grp, uint8_t spc, ui
479485
pixels = static_cast<uint32_t*>(allocate_buffer(length() * sizeof(uint32_t), BFRALLOC_PREFER_PSRAM | BFRALLOC_NOBYTEACCESS));
480486
if (!pixels) {
481487
DEBUGFX_PRINTLN(F("!!! Not enough RAM for pixel buffer !!!"));
488+
#ifdef WLED_ENABLE_GIF
489+
endImagePlayback(this);
490+
#endif
482491
deallocateData();
483492
errorFlag = ERR_NORAM_PX;
484493
stop = 0;

wled00/colors.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,10 @@ uint32_t IRAM_ATTR color_fade(uint32_t c1, uint8_t amount, bool video) {
7272
// video scaling: make sure colors do not dim to zero if they started non-zero unless they distort the hue
7373
uint8_t r = byte(c1>>16), g = byte(c1>>8), b = byte(c1), w = byte(c1>>24); // extract r, g, b, w channels
7474
uint8_t maxc = (r > g) ? ((r > b) ? r : b) : ((g > b) ? g : b); // determine dominant channel for hue preservation
75-
uint8_t quarterMax = maxc >> 2; // note: using half of max results in color artefacts
76-
addRemains = r && r > quarterMax ? 0x00010000 : 0;
77-
addRemains |= g && g > quarterMax ? 0x00000100 : 0;
78-
addRemains |= b && b > quarterMax ? 0x00000001 : 0;
79-
addRemains |= w ? 0x01000000 : 0;
75+
addRemains = r && (r<<5) > maxc ? 0x00010000 : 0; // note: setting color preservation threshold too high results in flickering and
76+
addRemains |= g && (g<<5) > maxc ? 0x00000100 : 0; // jumping colors in low brightness gradients. Multiplying the color preserves
77+
addRemains |= b && (b<<5) > maxc ? 0x00000001 : 0; // better accuracy than dividing the maxc. Shifting by 5 is a good compromise
78+
addRemains |= w ? 0x01000000 : 0; // i.e. remove color channel if <13% of max
8079
}
8180
const uint32_t TWO_CHANNEL_MASK = 0x00FF00FF;
8281
uint32_t rb = (((c1 & TWO_CHANNEL_MASK) * amount) >> 8) & TWO_CHANNEL_MASK; // scale red and blue

wled00/data/settings_sec.htm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ <h2>Security & Update setup</h2>
4848
To enable OTA, for security reasons you need to also enter the correct password!<br>
4949
The password should be changed when OTA is enabled.<br>
5050
<b>Disable OTA when not in use, otherwise an attacker can reflash device software!</b><br>
51-
<i>Settings on this page are only changable if OTA lock is disabled!</i><br>
51+
<i>Settings on this page are only changeable if OTA lock is disabled!</i><br>
5252
Deny access to WiFi settings if locked: <input type="checkbox" name="OW"><br><br>
5353
Factory reset: <input type="checkbox" name="RS"><br>
5454
All settings and presets will be erased.<br><br>

wled00/util.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -896,7 +896,8 @@ static bool detectBootLoop() {
896896
bl_crashcounter++;
897897
if (bl_crashcounter >= BOOTLOOP_THRESHOLD) {
898898
DEBUG_PRINTLN(F("!BOOTLOOP DETECTED!"));
899-
bl_crashcounter = 0;
899+
bl_crashcounter = 0;
900+
if(bl_actiontracker > BOOTLOOP_ACTION_DUMP) bl_actiontracker = BOOTLOOP_ACTION_RESTORE; // reset action tracker if out of bounds
900901
result = true;
901902
}
902903
} else {

0 commit comments

Comments
 (0)