added remaining settings to websocket-functionality
This commit is contained in:
parent
d524b919fd
commit
cebf0db60c
@ -122,7 +122,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<div class="col text-center">
|
<div class="col text-center">
|
||||||
<button id="resettank" class="btn-wsevent btn btn-outline-primary ml-2">Tank zurücksetzen</button>
|
<button id="resettank" class="btn-wsevent confirm btn btn-outline-primary ml-2">Tank zurücksetzen</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</p>
|
</p>
|
||||||
@ -195,7 +195,7 @@
|
|||||||
<h4>Gerät neustarten</h4>
|
<h4>Gerät neustarten</h4>
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<div class="col text-center">
|
<div class="col text-center">
|
||||||
<button id="reboot" class="btn-wsevent btn btn-outline-primary">Reboot</button>
|
<button id="reboot" class="btn-wsevent confirm btn btn-outline-primary">Reboot</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</p>
|
</p>
|
||||||
@ -230,7 +230,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<div class="col text-center">
|
<div class="col text-center">
|
||||||
<button id="sourcesave" class="btn-wsevent btn btn-outline-primary">Übernehmen</button>
|
<button id="sourcesave" class="btn-wsevent confirm btn btn-outline-primary">Übernehmen</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</p>
|
</p>
|
||||||
|
@ -25,9 +25,7 @@ function initButtons() {
|
|||||||
if (elements.length > 0) {
|
if (elements.length > 0) {
|
||||||
for (var i = 0; i < elements.length; i++) {
|
for (var i = 0; i < elements.length; i++) {
|
||||||
let element = elements[i];
|
let element = elements[i];
|
||||||
element.addEventListener("click", function () {
|
element.addEventListener("click", sendButton);
|
||||||
websocket_sendevent("btn-" + element.id, 0);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -55,6 +53,18 @@ function onClose(event) {
|
|||||||
overlay.style.display = "flex";
|
overlay.style.display = "flex";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function sendButton(event) {
|
||||||
|
var targetElement = event.target;
|
||||||
|
|
||||||
|
if (
|
||||||
|
targetElement.classList.contains("confirm") &&
|
||||||
|
window.confirm("Sicher?") == false
|
||||||
|
)
|
||||||
|
return;
|
||||||
|
|
||||||
|
websocket_sendevent("btn-" + targetElement.id, targetElement.value);
|
||||||
|
}
|
||||||
|
|
||||||
function onMessage(event) {
|
function onMessage(event) {
|
||||||
var data = event.data;
|
var data = event.data;
|
||||||
console.log("ws_msg:" + event.data + "\n");
|
console.log("ws_msg:" + event.data + "\n");
|
||||||
|
@ -492,6 +492,10 @@ void Websocket_HandleButtons(uint8_t *data)
|
|||||||
{
|
{
|
||||||
globals.systemStatus = sysStat_Shutdown;
|
globals.systemStatus = sysStat_Shutdown;
|
||||||
}
|
}
|
||||||
|
else if (strcmp(identifier, "resettank") == 0)
|
||||||
|
{
|
||||||
|
PersistenceData.tankRemain_microL = LubeConfig.tankCapacity_ml * 1000;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Debug_pushMessage("Got unknown Button-id '%s' from ws-client\n", identifier);
|
Debug_pushMessage("Got unknown Button-id '%s' from ws-client\n", identifier);
|
||||||
@ -532,6 +536,38 @@ void Websocket_HandleSettings(uint8_t *data)
|
|||||||
int index = findIndexByString(value, GPSBaudRateString, GPSBaudRateString_Elements);
|
int index = findIndexByString(value, GPSBaudRateString, GPSBaudRateString_Elements);
|
||||||
LubeConfig.GPSBaudRate = (GPSBaudRate_t)index;
|
LubeConfig.GPSBaudRate = (GPSBaudRate_t)index;
|
||||||
}
|
}
|
||||||
|
else if (strcmp(identifier, "ledmaxbrightness") == 0)
|
||||||
|
{
|
||||||
|
LubeConfig.LED_Max_Brightness = atoi(value);
|
||||||
|
}
|
||||||
|
else if (strcmp(identifier, "ledminbrightness") == 0)
|
||||||
|
{
|
||||||
|
LubeConfig.LED_Min_Brightness = atoi(value);
|
||||||
|
}
|
||||||
|
else if (strcmp(identifier, "pumppulse") == 0)
|
||||||
|
{
|
||||||
|
LubeConfig.BleedingPulses = atoi(value);
|
||||||
|
}
|
||||||
|
else if (strcmp(identifier, "tankwarn") == 0)
|
||||||
|
{
|
||||||
|
LubeConfig.TankRemindAtPercentage = atoi(value);
|
||||||
|
}
|
||||||
|
else if (strcmp(identifier, "tankcap") == 0)
|
||||||
|
{
|
||||||
|
LubeConfig.tankCapacity_ml = atoi(value);
|
||||||
|
}
|
||||||
|
else if (strcmp(identifier, "lubedistancerain") == 0)
|
||||||
|
{
|
||||||
|
LubeConfig.DistancePerLube_Rain = atoi(value);
|
||||||
|
}
|
||||||
|
else if (strcmp(identifier, "lubedistancenormal") == 0)
|
||||||
|
{
|
||||||
|
LubeConfig.DistancePerLube_Default = atoi(value);
|
||||||
|
}
|
||||||
|
else if (strcmp(identifier, "ledmodeflash") == 0)
|
||||||
|
{
|
||||||
|
LubeConfig.LED_Mode_Flash = value[0] == '1' ? true : false;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Debug_pushMessage("Got unknown Settings-id and value '%s' from ws-client\n", identifier);
|
Debug_pushMessage("Got unknown Settings-id and value '%s' from ws-client\n", identifier);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user