diff --git a/gbg_program/_wifi.ino b/gbg_program/_wifi.ino index c10ecfc..fa4ed94 100644 --- a/gbg_program/_wifi.ino +++ b/gbg_program/_wifi.ino @@ -71,7 +71,8 @@ void runWifiInput(float& speedInput, float& turnInput) { } break; case 1: - if (((millis() - lastRemoteCommandMillis) > signalLossTimeout)) { // timeout must be on in remote control mode (also enforced on website end) + deactivateIfRemoteDisconnects = true; // timeout must be on in remote control mode (also enforced on website end) + if (deactivateIfRemoteDisconnects && ((millis() - lastRemoteCommandMillis) > signalLossTimeout)) { speedInput = 0; turnInput = 0; } else { diff --git a/gbg_program/_wifi_site.html b/gbg_program/_wifi_site.html index ab884c0..82e20b7 100644 --- a/gbg_program/_wifi_site.html +++ b/gbg_program/_wifi_site.html @@ -14,12 +14,10 @@

remote override mode
- +
- +

@@ -52,8 +50,24 @@ try { var fetched = await fetch('/status' + remoteData, { signal: abortcontroller.signal }); fetchedResponse = await fetched.json(); - console.log(fetchedResponse); + + let radios = document.getElementsByName("remote-mode"); + let value = fetchedResponse["m"]; + + for (let i = 0, length = radios.length; i < length; i++) { + radios[i].checked = radios[i].value === value; + } + + if (value === 1) {//modes that give a choice about deactivate when timeout + document.getElementById("timeout").disabled = false; + } else { + document.getElementById("timeout").disabled = true; + } + + document.getElementById("timeout").checked = fetchedResponse["d"] == 1; + document.getElementById("status").innerHTML = "status: " + (fetchedResponse["a"] == 1 ? "on" : "off"); + } catch (e) { document.getElementById("status").innerHTML = "status: Disconnected"; }