Skip to content

Commit

Permalink
Fix default value for discharge current limit
Browse files Browse the repository at this point in the history
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.`
  • Loading branch information
ranma committed Sep 28, 2024
1 parent aa159fd commit cb7c169
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/defaults.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cb7c169

Please sign in to comment.