UI fixes and optimizations.
This commit is contained in:
parent
c5252e06a7
commit
826a31e57d
@ -1070,6 +1070,9 @@ input[type=number]::-webkit-outer-spin-button {
|
|||||||
background: var(--c-5);
|
background: var(--c-5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.selected input[type=number],
|
||||||
|
.selected input[type=text],
|
||||||
|
.selected button.btn,
|
||||||
#pcont .expand, #pcont .expand:hover {
|
#pcont .expand, #pcont .expand:hover {
|
||||||
background-color: var(--c-2);
|
background-color: var(--c-2);
|
||||||
}
|
}
|
||||||
@ -1142,6 +1145,7 @@ input[type="text"].fnd:focus {
|
|||||||
background-color: var(--c-4);
|
background-color: var(--c-4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.selected button.btn:hover,
|
||||||
input[type="text"].fnd:not(:placeholder-shown),
|
input[type="text"].fnd:not(:placeholder-shown),
|
||||||
input[type="text"].fnd:hover {
|
input[type="text"].fnd:hover {
|
||||||
background-color: var(--c-3);
|
background-color: var(--c-3);
|
||||||
|
@ -274,9 +274,8 @@ function showToast(text, error = false)
|
|||||||
if (error) console.log(text);
|
if (error) console.log(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
function showErrorToast() {
|
function showErrorToast()
|
||||||
// if we received a timeout force WS reconnect
|
{
|
||||||
setTimeout(makeWS,500);
|
|
||||||
showToast('Connection to light failed!', true);
|
showToast('Connection to light failed!', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1070,8 +1069,8 @@ function cmpP(a, b)
|
|||||||
}
|
}
|
||||||
|
|
||||||
function makeWS() {
|
function makeWS() {
|
||||||
if (ws) { ws.close(); ws=null; }
|
//if (ws) { ws.close(); ws=null; }
|
||||||
if (lastinfo.ws < 0) return;
|
if (ws || lastinfo.ws < 0) return;
|
||||||
ws = new WebSocket('ws://'+(loc?locip:window.location.hostname)+'/ws');
|
ws = new WebSocket('ws://'+(loc?locip:window.location.hostname)+'/ws');
|
||||||
ws.binaryType = "arraybuffer";
|
ws.binaryType = "arraybuffer";
|
||||||
ws.onmessage = (e)=>{
|
ws.onmessage = (e)=>{
|
||||||
@ -1098,7 +1097,8 @@ function makeWS() {
|
|||||||
};
|
};
|
||||||
ws.onclose = (e)=>{
|
ws.onclose = (e)=>{
|
||||||
gId('connind').style.backgroundColor = "var(--c-r)";
|
gId('connind').style.backgroundColor = "var(--c-r)";
|
||||||
setTimeout(makeWS,500); //retry WS connection
|
setTimeout(makeWS,1500); //retry WS connection
|
||||||
|
ws = null;
|
||||||
}
|
}
|
||||||
ws.onopen = (e)=>{
|
ws.onopen = (e)=>{
|
||||||
//ws.send("{'v':true}"); //unnecessary (https://github.com/Aircoookie/WLED/blob/master/wled00/ws.cpp#L18)
|
//ws.send("{'v':true}"); //unnecessary (https://github.com/Aircoookie/WLED/blob/master/wled00/ws.cpp#L18)
|
||||||
@ -1337,7 +1337,7 @@ function requestJson(command=null)
|
|||||||
{
|
{
|
||||||
gId('connind').style.backgroundColor = "var(--c-r)";
|
gId('connind').style.backgroundColor = "var(--c-r)";
|
||||||
if (command && !reqsLegal) return; //stop post requests from chrome onchange event on page restore
|
if (command && !reqsLegal) return; //stop post requests from chrome onchange event on page restore
|
||||||
if (!jsonTimeout) jsonTimeout = setTimeout(showErrorToast, 3000);
|
if (!jsonTimeout) jsonTimeout = setTimeout(()=>{if (ws) ws.close(); ws=null; showErrorToast()}, 3000);
|
||||||
var req = null;
|
var req = null;
|
||||||
var url = (loc?`http://${locip}`:'') + '/json/si';
|
var url = (loc?`http://${locip}`:'') + '/json/si';
|
||||||
var useWs = (ws && ws.readyState === WebSocket.OPEN);
|
var useWs = (ws && ws.readyState === WebSocket.OPEN);
|
||||||
@ -1358,7 +1358,7 @@ function requestJson(command=null)
|
|||||||
ws.send(req?req:'{"v":true}');
|
ws.send(req?req:'{"v":true}');
|
||||||
return;
|
return;
|
||||||
} else if (command && command.ps) { //refresh UI if we don't use WS (async loading of presets)
|
} else if (command && command.ps) { //refresh UI if we don't use WS (async loading of presets)
|
||||||
setTimeout(requestJson,200);
|
setTimeout(requestJson,250);
|
||||||
}
|
}
|
||||||
|
|
||||||
fetch(url, {
|
fetch(url, {
|
||||||
@ -1369,12 +1369,12 @@ function requestJson(command=null)
|
|||||||
body: req
|
body: req
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
|
clearTimeout(jsonTimeout);
|
||||||
|
jsonTimeout = null;
|
||||||
if (!res.ok) showErrorToast();
|
if (!res.ok) showErrorToast();
|
||||||
return res.json();
|
return res.json();
|
||||||
})
|
})
|
||||||
.then(json => {
|
.then(json => {
|
||||||
clearTimeout(jsonTimeout);
|
|
||||||
jsonTimeout = null;
|
|
||||||
lastUpdate = new Date();
|
lastUpdate = new Date();
|
||||||
clearErrorToast();
|
clearErrorToast();
|
||||||
gId('connind').style.backgroundColor = "var(--c-g)";
|
gId('connind').style.backgroundColor = "var(--c-g)";
|
||||||
@ -1387,7 +1387,7 @@ function requestJson(command=null)
|
|||||||
}
|
}
|
||||||
var s = json.state ? json.state : json;
|
var s = json.state ? json.state : json;
|
||||||
readState(s);
|
readState(s);
|
||||||
makeWS();
|
if (!(ws && ws.readyState === WebSocket.OPEN)) makeWS();
|
||||||
reqsLegal = true;
|
reqsLegal = true;
|
||||||
})
|
})
|
||||||
.catch((e)=>{
|
.catch((e)=>{
|
||||||
|
2300
wled00/html_ui.h
2300
wled00/html_ui.h
File diff suppressed because it is too large
Load Diff
@ -8,7 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// version code in format yymmddb (b = daily build)
|
// version code in format yymmddb (b = daily build)
|
||||||
#define VERSION 2202221
|
#define VERSION 2202231
|
||||||
|
|
||||||
//uncomment this if you have a "my_config.h" file you'd like to use
|
//uncomment this if you have a "my_config.h" file you'd like to use
|
||||||
//#define WLED_USE_MY_CONFIG
|
//#define WLED_USE_MY_CONFIG
|
||||||
|
Loading…
Reference in New Issue
Block a user