mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
send "step" as string
This commit is contained in:
@@ -130,7 +130,7 @@ export interface DeviceValue {
|
|||||||
c?: string; // command, optional
|
c?: string; // command, optional
|
||||||
l?: string[]; // list, optional
|
l?: string[]; // list, optional
|
||||||
h?: string; // help text, optional
|
h?: string; // help text, optional
|
||||||
s?: number; // steps for up/down, optional
|
s?: string; // steps for up/down, optional
|
||||||
m?: number; // min, optional
|
m?: number; // min, optional
|
||||||
x?: number; // max, optional
|
x?: number; // max, optional
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -983,19 +983,14 @@ void EMSdevice::generate_values_web(JsonObject & output) {
|
|||||||
}
|
}
|
||||||
// handle INTs
|
// handle INTs
|
||||||
else {
|
else {
|
||||||
// add step if it's not 1
|
|
||||||
if (dv.numeric_operator > 0) {
|
|
||||||
obj["s"] = (float)1 / dv.numeric_operator;
|
|
||||||
} else if (dv.numeric_operator < 0) {
|
|
||||||
obj["s"] = (float)(-1) * dv.numeric_operator;
|
|
||||||
}
|
|
||||||
|
|
||||||
// add min and max values, if available
|
// add min and max values, if available
|
||||||
int16_t dv_set_min;
|
int16_t dv_set_min;
|
||||||
uint32_t dv_set_max;
|
uint32_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"] = dv_set_min;
|
obj["m"] = dv_set_min;
|
||||||
obj["x"] = dv_set_max;
|
obj["x"] = dv_set_max;
|
||||||
|
char s[10];
|
||||||
|
obj["s"] = Helpers::render_value(s, (uint32_t)1, dv.numeric_operator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user