From 9987416a4aa1967324a83eca618df84211a60a1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Kristan?= Date: Mon, 14 Feb 2022 12:19:33 +0100 Subject: [PATCH] Allow float array values in usermod config. --- wled00/set.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/wled00/set.cpp b/wled00/set.cpp index 7b32d090b..2d2c9cf7a 100644 --- a/wled00/set.cpp +++ b/wled00/set.cpp @@ -503,12 +503,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 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("[");