min, max and step are sent as Numbers to the webUI

This commit is contained in:
proddy
2023-04-30 09:57:25 +02:00
parent 8a02f2a27a
commit d618d09bdf

View File

@@ -922,20 +922,19 @@ void EMSdevice::generate_values_web(JsonObject & output) {
} }
} }
// handle INTs // handle INTs
// add steps to numeric values with numeric_operator // add min and max values and steps, as integer values
else { else {
char s[10];
if (dv.numeric_operator > 0) { if (dv.numeric_operator > 0) {
obj["s"] = Helpers::render_value(s, (float)1 / dv.numeric_operator, 1); obj["s"] = (float)1 / dv.numeric_operator;
} else if (dv.numeric_operator < 0) { } else if (dv.numeric_operator < 0) {
obj["s"] = Helpers::render_value(s, (float)(-1) * dv.numeric_operator, 0); obj["s"] = (float)(-1) * dv.numeric_operator;
} }
int16_t dv_set_min; int16_t dv_set_min;
uint16_t dv_set_max; uint16_t dv_set_max;
if (dv.get_min_max(dv_set_min, dv_set_max)) { if (dv.get_min_max(dv_set_min, dv_set_max)) {
obj["m"] = Helpers::render_value(s, dv_set_min, 0); obj["m"] = dv_set_min;
obj["x"] = Helpers::render_value(s, dv_set_max, 0); obj["x"] = dv_set_max;
} }
} }
} }