Skip to content

Commit 9edd538

Browse files
authored
Merge branch 'wled:main' into main
2 parents 90e36cf + 7e490fc commit 9edd538

File tree

11 files changed

+62
-34
lines changed

11 files changed

+62
-34
lines changed

.github/copilot-instructions.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ wled00/ # Main firmware source (C++)
8585
│ ├── settings*.htm # Settings pages
8686
│ └── *.js/*.css # Frontend resources
8787
├── *.cpp/*.h # Firmware source files
88-
└── html_*.h # Generated embedded web files (DO NOT EDIT)
88+
└── html_*.h # Auto-generated embedded web files (DO NOT EDIT, DO NOT COMMIT)
8989
tools/ # Build tools (Node.js)
9090
├── cdata.js # Web UI build script
9191
└── cdata-test.js # Test suite
@@ -101,7 +101,7 @@ package.json # Node.js dependencies and scripts
101101
- `wled00/wled.h` - Main firmware configuration
102102
- `platformio.ini` - Hardware build targets and settings
103103

104-
### Development Workflow
104+
### Development Workflow (applies to agent mode only)
105105
1. **For web UI changes**:
106106
- Edit files in `wled00/data/`
107107
- Run `npm run build` to regenerate headers
@@ -148,10 +148,13 @@ package.json # Node.js dependencies and scripts
148148

149149
## Important Notes
150150

151-
- **DO NOT edit `wled00/html_*.h` files** - they are auto-generated
152-
- **Always commit both source files AND generated html_*.h files**
153-
- **Web UI must be built before firmware compilation**
151+
- **Always commit source files**
152+
- **Web UI re-built is part of the platformio firmware compilation**
153+
- **do not commit generated html_*.h files**
154+
- **DO NOT edit `wled00/html_*.h` files** - they are auto-generated. If needed, modify Web UI files in `wled00/data/`.
154155
- **Test web interface manually after any web UI changes**
156+
- When reviewing a PR: the PR author does not need to update/commit generated html_*.h files - these files will be auto-generated when building the firmware binary.
157+
- If updating Web UI files in `wled00/data/`, make use of common functions availeable in `wled00/data/common.js` where possible.
155158
- **Use VS Code with PlatformIO extension for best development experience**
156159
- **Hardware builds require appropriate ESP32/ESP8266 development board**
157160

usermods/audioreactive/audio_source.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ class I2SAdcSource : public I2SSource {
624624
}
625625

626626
// see example in https://github.com/espressif/arduino-esp32/blob/master/libraries/ESP32/examples/I2S/HiFreq_ADC/HiFreq_ADC.ino
627-
adc1_config_channel_atten(adc1_channel_t(channel), ADC_ATTEN_DB_11); // configure ADC input amplification
627+
adc1_config_channel_atten(adc1_channel_t(channel), ADC_ATTEN_DB_12); // configure ADC input amplification
628628

629629
#if defined(I2S_GRAB_ADC1_COMPLETELY)
630630
// according to docs from espressif, the ADC needs to be started explicitly

usermods/pixels_dice_tray/led_effects.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ static pixels::RollEvent GetLastRollForSegment() {
4040
* Alternating pixels running function (copied static function).
4141
*/
4242
// paletteBlend: 0 - wrap when moving, 1 - always wrap, 2 - never wrap, 3 - none (undefined)
43-
#define PALETTE_SOLID_WRAP (strip.paletteBlend == 1 || strip.paletteBlend == 3)
43+
#define PALETTE_SOLID_WRAP (paletteBlend == 1 || paletteBlend == 3)
4444
static void running_copy(uint32_t color1, uint32_t color2, bool theatre = false) {
4545
int width = (theatre ? 3 : 1) + (SEGMENT.intensity >> 4); // window
4646
uint32_t cycleTime = 50 + (255 - SEGMENT.speed);

usermods/user_fx/user_fx.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// for information how FX metadata strings work see https://kno.wled.ge/interfaces/json-api/#effect-metadata
44

55
// paletteBlend: 0 - wrap when moving, 1 - always wrap, 2 - never wrap, 3 - none (undefined)
6-
#define PALETTE_SOLID_WRAP (strip.paletteBlend == 1 || strip.paletteBlend == 3)
6+
#define PALETTE_SOLID_WRAP (paletteBlend == 1 || paletteBlend == 3)
77

88
#define indexToVStrip(index, stripNr) ((index) | (int((stripNr)+1)<<16))
99

@@ -874,7 +874,7 @@ static void handleBoundary(Ant& ant, float& position, bool gatherFood, bool atSt
874874
// Helper function to calculate ant color
875875
static uint32_t getAntColor(int antIndex, int numAnts, bool usePalette) {
876876
if (usePalette)
877-
return SEGMENT.color_from_palette(antIndex * 255 / numAnts, false, (strip.paletteBlend == 1 || strip.paletteBlend == 3), 255);
877+
return SEGMENT.color_from_palette(antIndex * 255 / numAnts, false, (paletteBlend == 1 || paletteBlend == 3), 255);
878878
// Alternate between two colors for default palette
879879
return (antIndex % 3 == 1) ? SEGCOLOR(0) : SEGCOLOR(2);
880880
}

wled00/FX.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@
6565

6666
#define IBN 5100
6767
// paletteBlend: 0 - wrap when moving, 1 - always wrap, 2 - never wrap, 3 - none (undefined)
68-
#define PALETTE_SOLID_WRAP (strip.paletteBlend == 1 || strip.paletteBlend == 3)
69-
#define PALETTE_MOVING_WRAP !(strip.paletteBlend == 2 || (strip.paletteBlend == 0 && SEGMENT.speed == 0))
68+
#define PALETTE_SOLID_WRAP (paletteBlend == 1 || paletteBlend == 3)
69+
#define PALETTE_MOVING_WRAP !(paletteBlend == 2 || (paletteBlend == 0 && SEGMENT.speed == 0))
7070

7171
#define indexToVStrip(index, stripNr) ((index) | (int((stripNr)+1)<<16))
7272

@@ -3398,7 +3398,7 @@ void mode_glitter()
33983398
counter = counter >> 8;
33993399
}
34003400

3401-
bool noWrap = (strip.paletteBlend == 2 || (strip.paletteBlend == 0 && SEGMENT.speed == 0));
3401+
bool noWrap = (paletteBlend == 2 || (paletteBlend == 0 && SEGMENT.speed == 0));
34023402
for (unsigned i = 0; i < SEGLEN; i++) {
34033403
unsigned colorIndex = (i * 255 / SEGLEN) - counter;
34043404
if (noWrap) colorIndex = map(colorIndex, 0, 255, 0, 240); //cut off blend at palette "end"

wled00/FX.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,6 @@ class WS2812FX {
834834
public:
835835

836836
WS2812FX() :
837-
paletteBlend(0),
838837
now(millis()),
839838
timebase(0),
840839
isMatrix(false),
@@ -936,7 +935,7 @@ class WS2812FX {
936935
inline bool isSuspended() const { return _suspend; } // returns true if strip.service() execution is suspended
937936
inline bool needsUpdate() const { return _triggered; } // returns true if strip received a trigger() request
938937

939-
uint8_t paletteBlend;
938+
// uint8_t paletteBlend; // obsolete - use global paletteBlend instead of strip.paletteBlend
940939
uint8_t getActiveSegmentsNum() const;
941940
uint8_t getFirstSelectedSegId() const;
942941
uint8_t getLastActiveSegmentId() const;

wled00/cfg.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,8 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
176176
CJSON(cctICused, hw_led[F("ic")]);
177177
uint8_t cctBlending = hw_led[F("cb")] | Bus::getCCTBlend();
178178
Bus::setCCTBlend(cctBlending);
179-
strip.setTargetFps(hw_led["fps"]); //NOP if 0, default 42 FPS
179+
unsigned targetFPS = hw_led["fps"] | WLED_FPS;
180+
strip.setTargetFps(targetFPS); //unlimited if 0, default 42 FPS
180181

181182
#ifndef WLED_DISABLE_2D
182183
// 2D Matrix Settings

wled00/data/settings_sec.htm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport">
55
<meta charset="utf-8">
6-
<title>Misc Settings</title>
6+
<title>Security & Update Setup</title>
77
<style> html { visibility: hidden; } </style> <!-- prevent white & ugly display while loading, unhidden in loadResources() -->
88
<script>
99
// load common.js with retry on error
@@ -45,7 +45,7 @@
4545
<div class="helpB"><button type="button" onclick="H('features/settings/#security-settings')">?</button></div>
4646
<button type="button" onclick="B()">Back</button><button type="submit">Save</button><hr>
4747
</div>
48-
<h2>Security & Update setup</h2>
48+
<h2>Security & Update Setup</h2>
4949
<div class="sec">
5050
Settings PIN: <input type="password" id="PIN" name="PIN" size="4" maxlength="4" minlength="4" onkeydown="checkNum(this)" pattern="[0-9]*" inputmode="numeric" title="Please enter a 4 digit number"><br>
5151
<div class="warn">&#9888; Unencrypted transmission. Be prudent when selecting PIN, do NOT use your banking, door, SIM, etc. pin!</div><br>

wled00/data/update.htm

Lines changed: 40 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,21 @@
1919
}
2020
function GetV() {
2121
// Fetch device info via JSON API instead of compiling it in
22-
fetch('/json/info')
22+
fetch(getURL('/json/info'))
2323
.then(response => response.json())
2424
.then(data => {
2525
document.querySelector('.installed-version').textContent = `${data.brand} ${data.ver} (${data.vid})`;
2626
document.querySelector('.release-name').textContent = data.release;
27-
// TODO - assemble update URL
27+
// assemble update URL and update release badge
28+
if (data.repo && data.repo !== "unknown") {
29+
const repoUrl = "https://github.com/" + data.repo + "/releases/latest";
30+
const badgeUrl = "https://img.shields.io/github/release/" + data.repo + ".svg?style=flat-square";
31+
document.querySelector('.release-repo').href = repoUrl;
32+
document.querySelector('.release-badge').src = badgeUrl;
33+
toggle('release-download'); // only show release download item after receiving a valid data.repo
34+
} else {
35+
gId('Norelease-download').classList.add("hide"); // repo invalid -> hide everything
36+
}
2837
// TODO - can this be done at build time?
2938
if (data.arch == "esp8266") {
3039
toggle('rev');
@@ -33,7 +42,7 @@
3342
if (allowBl) {
3443
toggle('bootupd')
3544
if (data.bootloaderSHA256) {
36-
gId('bootloader-hash').innerText = 'Current bootloader SHA256: ' + data.bootloaderSHA256;
45+
gId('bootloader-hash').innerText = 'Current bootloader SHA256: \n' + data.bootloaderSHA256;
3746
}
3847
}
3948
})
@@ -42,9 +51,12 @@
4251
// Fallback to compiled-in value if API call fails
4352
document.querySelector('.installed-version').textContent = 'Unknown';
4453
document.querySelector('.release-name').textContent = 'Unknown';
54+
gId('Norelease-download').classList.add("hide"); // fetch failed -> hide everything
4555
});
4656
}
4757
function hideforms() {
58+
gId('toprow').classList.add("hide"); // hide top row with "back" button
59+
gId('backbtn').classList.add("hide"); // hide "back" button on bottom of the page
4860
gId('bootupd').classList.add("hide");
4961
toggle('upd');
5062
}
@@ -54,32 +66,45 @@
5466
</style>
5567
</head>
5668
<body onload="GetV();">
57-
<h2>WLED Software Update</h2>
69+
<div id="toprow" class="toprow">
70+
<div class="helpB"><button type="button" aria-label="Help" title="Help" onclick="H('basics/getting-started/#software-update-procedure')">?</button></div>
71+
<button type="button" onclick="B()">Back</button>
72+
</div>
73+
<br>
5874
<form method='POST' action='./update' id='upd' enctype='multipart/form-data' onsubmit="hideforms()">
75+
<div class="sec">
76+
<h2>WLED Software Update</h2>
77+
<p>
5978
Installed version: <span class="sip installed-version">Loading...</span><br>
6079
Release: <span class="sip release-name">Loading...</span><br>
61-
Download the latest binary: <a href="https://github.com/wled-dev/WLED/releases" target="_blank"
80+
<span id="Norelease-download">Latest binary: Checking...<br></span>
81+
<span id="release-download" class="hide">
82+
Download the latest binary: <a class="release-repo" href="https://github.com/wled/WLED/releases/latest" target="_blank" rel="noopener noreferrer"
6283
style="vertical-align: text-bottom; display: inline-flex;">
63-
<img src="https://img.shields.io/github/release/wled-dev/WLED.svg?style=flat-square"></a><br>
84+
<img class="release-badge" alt="badge"></a><br> <!-- start with an empty placeholder, src will be filled after fetching /json/info -->
85+
</span>
86+
</p>
6487
<input type="hidden" name="skipValidation" value="" id="sV">
6588
<input type='file' name='update' required><br> <!--should have accept='.bin', but it prevents file upload from android app-->
6689
<input type='checkbox' onchange="sV.value=checked?1:''" id="skipValidation">
6790
<label for='skipValidation'>Ignore firmware validation</label><br>
68-
<button type="submit">Update!</button><br>
69-
<hr class="sml">
70-
<button id="rev" type="button" onclick="cR()">Revert update</button><br>
71-
<button type="button" onclick="B()">Back</button>
91+
<button type="submit">Update WLED!</button><br>
92+
<span id="rev">
93+
<hr class="sml">
94+
<button type="button" onclick="cR()">Revert update</button><br>
95+
</span>
96+
</div>
7297
</form>
73-
<div id="bootupd" class="hide">
74-
<hr class="sml">
98+
<div id="bootupd" class="hide sec">
7599
<h2>Bootloader Update</h2>
76-
<div id="bootloader-hash" class="sip" style="margin-bottom:8px;"></div>
100+
<div id="bootloader-hash" class="sip" style="margin-bottom:8px;font-size:15px;white-space:pre-wrap;word-break:break-all;"></div>
77101
<form method='POST' action='./updatebootloader' enctype='multipart/form-data' onsubmit="hideforms()">
78-
<b>Warning:</b> Only upload verified ESP32 bootloader files!<br>
102+
<b>Warning:</b> Only upload verified ESP32 bootloader files!<br><br>
79103
<input type='file' name='update' required><br>
80104
<button type="submit">Update Bootloader</button>
81105
</form>
82106
</div>
83-
<div id="Noupd" class="hide"><b>Updating...</b><br>Please do not close or refresh the page :)</div>
107+
<div id="Noupd" class="hide sec"><b>Updating...</b><br>Please do not close or refresh the page :)</div>
108+
<p><button id="backbtn" type="button" onclick="B()">Back</button></p>
84109
</body>
85110
</html>

wled00/json.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -810,7 +810,7 @@ void serializeInfo(JsonObject root)
810810
wifi_info[F("txPower")] = (int) WiFi.getTxPower();
811811
wifi_info[F("sleep")] = (bool) WiFi.getSleep();
812812
#endif
813-
#if !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32S3)
813+
#if defined(ARDUINO_ARCH_ESP32) && defined(CONFIG_IDF_TARGET_ESP32) // classic esp32 only: report "esp32" without package details
814814
root[F("arch")] = "esp32";
815815
#else
816816
root[F("arch")] = ESP.getChipModel();

0 commit comments

Comments
 (0)