Fix for ESP8266 bootloop.

Reordered preset sorting.
This commit is contained in:
Blaz Kristan 2022-02-02 22:00:31 +01:00
parent 8a30c6347e
commit fa0936da3c
4 changed files with 1620 additions and 1611 deletions

View File

@ -1069,9 +1069,13 @@ function displayRover(i,s)
function cmpP(a, b)
{
if (!a[1].n) return (a[0] > b[0]);
// playlists follow presets
var name = (a[1].playlist ? '~' : ' ') + a[1].n;
return name.localeCompare((b[1].playlist ? '~' : ' ') + b[1].n, undefined, {numeric: true});
// sort playlists first, followed by presets with characters and last presets with special 1st character
const c = a[1].n.charCodeAt(0);
const d = b[1].n.charCodeAt(0);
if ((c>47 && c<58) || (c>64 && c<91) || (c>96 && c<123) || c>255) x = '='; else x = '>';
if ((d>47 && d<58) || (d>64 && d<91) || (d>96 && d<123) || d>255) y = '='; else y = '>';
const n = (a[1].playlist ? '<' : x) + a[1].n;
return n.localeCompare((b[1].playlist ? '<' : y) + b[1].n, undefined, {numeric: true});
}
function makeWS() {

File diff suppressed because it is too large Load Diff

View File

@ -25,7 +25,7 @@ void handlePresets()
if (presetToApply == 0 || fileDoc) return; //JSON buffer allocated (apply preset in next cycle) or no preset waiting
JsonObject fdo;
const char *filename = presetToApply < 255 ? PSTR("/presets.json") : PSTR("/tmp.json");
const char *filename = presetToApply < 255 ? "/presets.json" : "/tmp.json";
// allocate buffer
DEBUG_PRINTLN(F("Apply preset JSON buffer requested."));
@ -83,7 +83,7 @@ void savePreset(byte index, bool persist, const char* pname, JsonObject saveobj)
JsonObject sObj = saveobj;
bool bufferAllocated = false;
const char *filename = persist ? PSTR("/presets.json") : PSTR("/tmp.json");
const char *filename = persist ? "/presets.json" : "/tmp.json";
if (!fileDoc) {
// called from handleSet() HTTP API

View File

@ -8,7 +8,7 @@
*/
// version code in format yymmddb (b = daily build)
#define VERSION 2202021
#define VERSION 2202022
//uncomment this if you have a "my_config.h" file you'd like to use
//#define WLED_USE_MY_CONFIG