From a8cce3066ec5a25c6d2ea1b0a6617346f229114c Mon Sep 17 00:00:00 2001 From: Tobias Diedrich Date: Sat, 28 Sep 2024 18:32:16 +0200 Subject: [PATCH] Fix default value for discharge current limit If the default type is an int, setting to a fractional value is not possible. Presumably this is because in `target.DischargeCurrentLimit = source["discharge_current_limit"] | BATTERY_DISCHARGE_CURRENT_LIMIT;` the JSON library uses the default to force the expected type and on type mismatch the default is used. As per https://arduinojson.org/v7/api/jsonvariant/or/: `defaultValue: the value to return if the JsonVariant is null or incompatible with the requested type.` --- include/defaults.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/defaults.h b/include/defaults.h index 67b1d122e..2ab8ec9e8 100644 --- a/include/defaults.h +++ b/include/defaults.h @@ -155,7 +155,7 @@ #define BATTERY_JKBMS_INTERFACE 0 #define BATTERY_JKBMS_POLLING_INTERVAL 5 #define BATTERY_ENABLE_DISCHARGE_CURRENT_LIMIT false -#define BATTERY_DISCHARGE_CURRENT_LIMIT 0 +#define BATTERY_DISCHARGE_CURRENT_LIMIT 0.0 #define BATTERY_USE_BATTERY_REPORTED_DISCHARGE_CURRENT_LIMIT false #define HUAWEI_ENABLED false