Fix web server transition length truncated (#807)

Fixes https://github.com/esphome/issues/issues/772
This commit is contained in:
Otto Winter 2019-10-27 12:30:48 +01:00
parent 847fe5adca
commit 82a30558e1
No known key found for this signature in database
GPG key ID: DB66C0BE6013F97E

View file

@ -416,11 +416,15 @@ void WebServer::handle_light_request(AsyncWebServerRequest *request, UrlMatch ma
if (request->hasParam("color_temp")) if (request->hasParam("color_temp"))
call.set_color_temperature(request->getParam("color_temp")->value().toFloat()); call.set_color_temperature(request->getParam("color_temp")->value().toFloat());
if (request->hasParam("flash")) if (request->hasParam("flash")) {
call.set_flash_length((uint32_t) request->getParam("flash")->value().toFloat() * 1000); float length_s = request->getParam("flash")->value().toFloat();
call.set_flash_length(static_cast<uint32_t>(length_s * 1000));
}
if (request->hasParam("transition")) if (request->hasParam("transition")) {
call.set_transition_length((uint32_t) request->getParam("transition")->value().toFloat() * 1000); float length_s = request->getParam("transition")->value().toFloat();
call.set_transition_length(static_cast<uint32_t>(length_s * 1000));
}
if (request->hasParam("effect")) { if (request->hasParam("effect")) {
const char *effect = request->getParam("effect")->value().c_str(); const char *effect = request->getParam("effect")->value().c_str();