Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
9618a79
Initial plan
Copilot Sep 14, 2025
5b3e81c
Implement OTA release compatibility checking system
Copilot Sep 14, 2025
ee1cda9
Complete OTA release compatibility system with comprehensive testing
Copilot Sep 14, 2025
59af24a
Fix OTA release checking to use flexible string search instead of har…
Copilot Sep 14, 2025
c6d1d01
Improve OTA release checking with scoring-based candidate selection
Copilot Sep 14, 2025
34e50af
Remove build artifacts from repository
Copilot Sep 14, 2025
4ee73d5
Implement metadata-based OTA release checking system
Copilot Sep 14, 2025
024362b
Replace metadata header approach with ESP-IDF custom description section
Copilot Sep 14, 2025
95f0938
Fix runtime release name replacement - move to build-time
Copilot Sep 14, 2025
78519cc
Add ESP8266 support to OTA release compatibility system using .ver_nu…
Copilot Sep 14, 2025
41454ba
Address review feedback: unify structures, remove code duplication, i…
Copilot Sep 14, 2025
c9b7f40
Rename ignoreRelease to skipValidation in OTA validation system
Copilot Sep 14, 2025
e6b9f6a
Address review feedback: unify structures, fix C++11 compatibility, i…
Copilot Sep 17, 2025
b6d01bb
Address final review feedback: improve error handling, remove debug d…
Copilot Sep 17, 2025
ddbf15e
Address final review feedback: revert unnecessary files, use F-string…
Copilot Sep 17, 2025
450ae16
Fix file reverts and implement efficient metadata validation without …
Copilot Sep 20, 2025
96c303c
Implement correct metadata validation logic as requested in review co…
Copilot Sep 20, 2025
2c76bc1
Checkpoint OTA refactor
willmmiles Sep 21, 2025
b982478
Don't disconnect if an update is in progress
willmmiles Sep 22, 2025
a03002a
Refactor OTA update messaging
willmmiles Sep 22, 2025
1371f76
Fix up validation failure messaging
willmmiles Sep 22, 2025
49e6ae4
OTA: Update commentary on hashing strategy
willmmiles Sep 22, 2025
50e7a25
OTA: Reduce error message string size
willmmiles Sep 22, 2025
a96bbf6
OTA: Fix build issues
willmmiles Sep 22, 2025
0bdc328
Fix update validation checkbox
willmmiles Sep 23, 2025
5934655
Update UI: Use json/info instead of xml.cpp
willmmiles Sep 23, 2025
f4a5bcb
Split metadata from OTA logic
willmmiles Oct 6, 2025
94911ac
Process metadata only in metadata.cpp
willmmiles Oct 6, 2025
ded6ac0
Fix OTA update on ESP32
willmmiles Oct 6, 2025
da3d25e
set_metadata: Omit unset metadata
willmmiles Oct 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 47 additions & 7 deletions pio-scripts/set_repo.py → pio-scripts/set_metadata.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Import('env')
import subprocess
import json
import re

def get_github_repo():
Expand Down Expand Up @@ -42,7 +43,7 @@ def get_github_repo():

# Check if it's a GitHub URL
if 'github.com' not in remote_url.lower():
return 'unknown'
return None

# Parse GitHub URL patterns:
# https://github.com/owner/repo.git
Expand All @@ -63,17 +64,56 @@ def get_github_repo():
if ssh_match:
return ssh_match.group(1)

return 'unknown'
return None

except FileNotFoundError:
# Git CLI is not installed or not in PATH
return 'unknown'
return None
except subprocess.CalledProcessError:
# Git command failed (e.g., not a git repo, no remote, etc.)
return 'unknown'
return None
except Exception:
# Any other unexpected error
return 'unknown'
return None

repo = get_github_repo()
env.Append(BUILD_FLAGS=[f'-DWLED_REPO=\\"{repo}\\"'])
PACKAGE_FILE = "package.json"

def get_version():
with open(PACKAGE_FILE, "r") as package:
return json.load(package)["version"]
return None


def has_def(cppdefs, name):
""" Returns true if a given name is set in a CPPDEFINES collection """
for f in cppdefs:
if isinstance(f, tuple):
f = f[0]
if f == name:
return True
return False


def add_wled_metadata_flags(env, node):
cdefs = env["CPPDEFINES"].copy()

if not has_def(cdefs, "WLED_REPO"):
repo = get_github_repo()
if repo:
cdefs.append(("WLED_REPO", f"\\\"{repo}\\\""))

if not has_def(cdefs, "WLED_VERSION"):
version = get_version()
if version:
cdefs.append(("WLED_VERSION", get_version()))

# This transforms the node in to a Builder; it cannot be modified again
return env.Object(
node,
CPPDEFINES=cdefs
)

env.AddBuildMiddleware(
add_wled_metadata_flags,
"*/wled_metadata.cpp"
)
8 changes: 0 additions & 8 deletions pio-scripts/set_version.py

This file was deleted.

3 changes: 1 addition & 2 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,7 @@ ldscript_4m1m = eagle.flash.4m1m.ld

[scripts_defaults]
extra_scripts =
pre:pio-scripts/set_version.py
pre:pio-scripts/set_repo.py
pre:pio-scripts/set_metadata.py
post:pio-scripts/output_bins.py
post:pio-scripts/strip-floats.py
pre:pio-scripts/user_config_copy.py
Expand Down
6 changes: 0 additions & 6 deletions tools/cdata.js
Original file line number Diff line number Diff line change
Expand Up @@ -388,12 +388,6 @@ const char PAGE_dmxmap[] PROGMEM = R"=====()=====";
name: "PAGE_update",
method: "gzip",
filter: "html-minify",
mangle: (str) =>
str
.replace(
/function GetV().*\<\/script\>/gms,
"</script><script src=\"/settings/s.js?p=9\"></script>"
)
},
{
file: "welcome.htm",
Expand Down
27 changes: 25 additions & 2 deletions wled00/data/update.htm
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,26 @@
}
window.open(getURL("/update?revert"),"_self");
}
function GetV() {/*injected values here*/}
function GetV() {
// Fetch device info via JSON API instead of compiling it in
fetch('/json/info')
.then(response => response.json())
.then(data => {
document.querySelector('.installed-version').textContent = `${data.brand} ${data.ver} (${data.vid})`;
document.querySelector('.release-name').textContent = data.release;
// TODO - assemble update URL
// TODO - can this be done at build time?
if (data.arch == "esp8266") {
toggle('rev');
}
})
.catch(error => {
console.log('Could not fetch device info:', error);
// Fallback to compiled-in value if API call fails
document.querySelector('.installed-version').textContent = 'Unknown';
document.querySelector('.release-name').textContent = 'Unknown';
});
}
</script>
<style>
@import url("style.css");
Expand All @@ -27,11 +46,15 @@
<body onload="GetV()">
<h2>WLED Software Update</h2>
<form method='POST' action='./update' id='upd' enctype='multipart/form-data' onsubmit="toggle('upd')">
Installed version: <span class="sip">WLED ##VERSION##</span><br>
Installed version: <span class="sip installed-version">Loading...</span><br>
Release: <span class="sip release-name">Loading...</span><br>
Download the latest binary: <a href="https://github.com/wled-dev/WLED/releases" target="_blank"
style="vertical-align: text-bottom; display: inline-flex;">
<img src="https://img.shields.io/github/release/wled-dev/WLED.svg?style=flat-square"></a><br>
<input type="hidden" name="skipValidation" value="" id="sV">
<input type='file' name='update' required><br> <!--should have accept='.bin', but it prevents file upload from android app-->
<input type='checkbox' onchange="sV.value=checked?1:''" id="skipValidation">
<label for='skipValidation'>Ignore firmware validation</label><br>
<button type="submit">Update!</button><br>
<hr class="sml">
<button id="rev" type="button" onclick="cR()">Revert update</button><br>
Expand Down
4 changes: 2 additions & 2 deletions wled00/dmx_input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ static dmx_config_t createConfig()
config.software_version_id = VERSION;
strcpy(config.device_label, "WLED_MM");

const std::string versionString = "WLED_V" + std::to_string(VERSION);
strncpy(config.software_version_label, versionString.c_str(), 32);
const std::string dmxWledVersionString = "WLED_V" + std::to_string(VERSION);
strncpy(config.software_version_label, dmxWledVersionString.c_str(), 32);
config.software_version_label[32] = '\0'; // zero termination in case versionString string was longer than 32 chars

config.personalities[0].description = "SINGLE_RGB";
Expand Down
2 changes: 1 addition & 1 deletion wled00/e131.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ void prepareArtnetPollReply(ArtPollReply *reply) {

reply->reply_port = ARTNET_DEFAULT_PORT;

char * numberEnd = versionString;
char * numberEnd = (char*) versionString; // strtol promises not to try to edit this.
reply->reply_version_h = (uint8_t)strtol(numberEnd, &numberEnd, 10);
numberEnd++;
reply->reply_version_l = (uint8_t)strtol(numberEnd, &numberEnd, 10);
Expand Down
Loading