Http Version - Fix to show error when requests fail, and changed display type of distance in UI from float to Int

This commit is contained in:
unrealdragon 2026-08-12 14:32:54 +05:30
commit e1d57eae32

View file

@ -39,10 +39,10 @@ Window {
color: "#0A0F0F0F"
SettingsBarIcon {
height: top_bar.height - 20
width: top_bar.width / 12
width: height
anchors {
top: parent.top
left: parent.left
right: parent.right
bottomMargin: 5
topMargin: 5
leftMargin: 5
@ -77,10 +77,10 @@ Window {
anchors {
top: top_bar.bottom
horizontalCenter: parent.horizontalCenter
topMargin: 0
topMargin: 100
}
height: (parent.height - top_bar.height) / 1.2
width: parent.width / 1.2
height: (parent.height - top_bar.height) / 2
width: parent.width / 2.2
base_color: root.background_color
distance: 0
tank_lid_color: "#F0121212"
@ -119,8 +119,15 @@ Window {
bottomMargin: 50
}
onConnect: {
requester.start();
root.status = "Waiting to Send.";
if(connect_button.mode === 0)
{
requester.start();
root.status = "Waiting to Send.";
}
else {
root.status = "Stopped.";
requester.stop();
}
}
}
}
@ -134,6 +141,10 @@ Window {
tank.setDistance(water_level);
tank.rate_of_fill = fill_rate;
tank.expected_to_fill = expected;
status.color = root.accent_color;
}
onRequestFailed: () => {
status.color = root.danger_color;
}
}
@ -145,7 +156,7 @@ Window {
console.log("Loading initial config");
setConfig(config);
if(root.status === "Initializing") {
root.status = "Waiting to connect.";
root.status = "Press Connect.";
}
}
function setConfig(config) {