Skip to content

Commit dcc1fbc

Browse files
authored
Merge pull request #4846 from Arcitec/improve-version-info
Make version information consistent across update interfaces
2 parents 7285efe + 7865985 commit dcc1fbc

File tree

3 files changed

+24
-15
lines changed

3 files changed

+24
-15
lines changed

wled00/data/settings_sec.htm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ <h3>About</h3>
7676
A huge thank you to everyone who helped me create WLED!<br><br>
7777
(c) 2016-2024 Christian Schwinne <br>
7878
<i>Licensed under the <a href="https://github.com/wled-dev/WLED/blob/main/LICENSE" target="_blank">EUPL v1.2 license</a></i><br><br>
79-
Server message: <span class="sip"> Response error! </span><hr>
79+
Installed version: <span class="sip">WLED ##VERSION##</span><hr>
8080
<div id="toast"></div>
8181
<button type="button" onclick="B()">Back</button><button type="submit">Save</button>
8282
</form>

wled00/data/update.htm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<body onload="GetV()">
2828
<h2>WLED Software Update</h2>
2929
<form method='POST' action='./update' id='upd' enctype='multipart/form-data' onsubmit="toggle('upd')">
30-
Installed version: <span class="sip">##VERSION##</span><br>
30+
Installed version: <span class="sip">WLED ##VERSION##</span><br>
3131
Download the latest binary: <a href="https://github.com/wled-dev/WLED/releases" target="_blank"
3232
style="vertical-align: text-bottom; display: inline-flex;">
3333
<img src="https://img.shields.io/github/release/wled-dev/WLED.svg?style=flat-square"></a><br>

wled00/xml.cpp

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ void XML_response(Print& dest)
2626
);
2727
}
2828

29-
static void extractPin(Print& settingsScript, const JsonObject &obj, const char *key) {
29+
static void extractPin(Print& settingsScript, const JsonObject &obj, const char *key)
30+
{
3031
if (obj[key].is<JsonArray>()) {
3132
JsonArray pins = obj[key].as<JsonArray>();
3233
for (JsonVariant pv : pins) {
@@ -37,6 +38,22 @@ static void extractPin(Print& settingsScript, const JsonObject &obj, const char
3738
}
3839
}
3940

41+
void fillWLEDVersion(char *buf, size_t len)
42+
{
43+
if (!buf || len == 0) return;
44+
45+
snprintf_P(buf,len,PSTR("WLED %s (%d)<br>\\\"%s\\\"<br>(Processor: %s)"),
46+
versionString,
47+
VERSION,
48+
releaseString,
49+
#if defined(ARDUINO_ARCH_ESP32)
50+
ESP.getChipModel()
51+
#else
52+
"ESP8266"
53+
#endif
54+
);
55+
}
56+
4057
// print used pins by scanning JsonObject (1 level deep)
4158
static void fillUMPins(Print& settingsScript, const JsonObject &mods)
4259
{
@@ -72,7 +89,8 @@ static void fillUMPins(Print& settingsScript, const JsonObject &mods)
7289
}
7390
}
7491

75-
void appendGPIOinfo(Print& settingsScript) {
92+
void appendGPIOinfo(Print& settingsScript)
93+
{
7694
settingsScript.print(F("d.um_p=[-1")); // has to have 1 element
7795
if (i2c_sda > -1 && i2c_scl > -1) {
7896
settingsScript.printf_P(PSTR(",%d,%d"), i2c_sda, i2c_scl);
@@ -594,7 +612,7 @@ void getSettingsJS(byte subPage, Print& settingsScript)
594612
printSetFormCheckbox(settingsScript,PSTR("AO"),aOtaEnabled);
595613
printSetFormCheckbox(settingsScript,PSTR("SU"),otaSameSubnet);
596614
char tmp_buf[128];
597-
snprintf_P(tmp_buf,sizeof(tmp_buf),PSTR("WLED %s (build %d)"),versionString,VERSION);
615+
fillWLEDVersion(tmp_buf,sizeof(tmp_buf));
598616
printSetClassElementHTML(settingsScript,PSTR("sip"),0,tmp_buf);
599617
settingsScript.printf_P(PSTR("sd=\"%s\";"), serverDescription);
600618
//hide settings if not compiled
@@ -656,16 +674,7 @@ void getSettingsJS(byte subPage, Print& settingsScript)
656674
if (subPage == SUBPAGE_UPDATE) // update
657675
{
658676
char tmp_buf[128];
659-
snprintf_P(tmp_buf,sizeof(tmp_buf),PSTR("WLED %s<br>%s<br>(%s build %d)"),
660-
versionString,
661-
releaseString,
662-
#if defined(ARDUINO_ARCH_ESP32)
663-
ESP.getChipModel(),
664-
#else
665-
"esp8266",
666-
#endif
667-
VERSION);
668-
677+
fillWLEDVersion(tmp_buf,sizeof(tmp_buf));
669678
printSetClassElementHTML(settingsScript,PSTR("sip"),0,tmp_buf);
670679
#ifndef ARDUINO_ARCH_ESP32
671680
settingsScript.print(F("toggle('rev');")); // hide revert button on ESP8266

0 commit comments

Comments
 (0)