From 03cfae45f8e79a562e8db039ce7de843d4243425 Mon Sep 17 00:00:00 2001 From: Blaz Kristan Date: Sat, 12 Feb 2022 23:14:00 +0100 Subject: [PATCH] Allow float in usermod array elements. --- wled00/set.cpp | 7 +++++-- wled00/wled.h | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/wled00/set.cpp b/wled00/set.cpp index 69fef0bd..ac5877cd 100644 --- a/wled00/set.cpp +++ b/wled00/set.cpp @@ -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 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("["); diff --git a/wled00/wled.h b/wled00/wled.h index 3ebbd0cd..46e05ddf 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -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