Allow float in usermod array elements.

pull/2737/head
Blaz Kristan 2022-02-12 23:14:00 +01:00
rodzic 4f83325e3c
commit 03cfae45f8
2 zmienionych plików z 6 dodań i 3 usunięć

Wyświetl plik

@ -484,12 +484,15 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
// check if parameters represent array
if (name.endsWith("[]")) {
name.replace("[]","");
value.replace(",","."); // just in case conversion
if (!subObj[name].is<JsonArray>()) {
JsonArray ar = subObj.createNestedArray(name);
ar.add(value.toInt());
if (value.indexOf(".") >= 0) ar.add(value.toFloat()); // we do have a float
else ar.add(value.toInt()); // we may have an int
j=0;
} else {
subObj[name].add(value.toInt());
if (value.indexOf(".") >= 0) subObj[name].add(value.toFloat()); // we do have a float
else subObj[name].add(value.toInt()); // we may have an int
j++;
}
DEBUG_PRINT("[");

Wyświetl plik

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