Allow float array values in usermod config.
This commit is contained in:
parent
31e33e0a8b
commit
9987416a4a
@ -503,12 +503,15 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
|
|||||||
// check if parameters represent array
|
// check if parameters represent array
|
||||||
if (name.endsWith("[]")) {
|
if (name.endsWith("[]")) {
|
||||||
name.replace("[]","");
|
name.replace("[]","");
|
||||||
|
value.replace(",","."); // just in case conversion
|
||||||
if (!subObj[name].is<JsonArray>()) {
|
if (!subObj[name].is<JsonArray>()) {
|
||||||
JsonArray ar = subObj.createNestedArray(name);
|
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;
|
j=0;
|
||||||
} else {
|
} 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++;
|
j++;
|
||||||
}
|
}
|
||||||
DEBUG_PRINT("[");
|
DEBUG_PRINT("[");
|
||||||
|
Loading…
Reference in New Issue
Block a user