Various changes

This commit is contained in:
2025-04-13 23:12:38 +02:00
parent 716cf2355f
commit c88b401675
4 changed files with 34 additions and 13 deletions

20
readme.md Normal file
View File

@@ -0,0 +1,20 @@
Wallas DT/GB Heater Controller on an ESP32C3
============================================
## Getting Started
As described in the chapter on Risc-V target installation in the [Rust on ESP Book](https://docs.esp-rs.org/book/installation/riscv.html),
you should install the ESP32c3 target for your rust toolchain by doing:
```bash
rustup toolchain install stable --component rust-src
rustup target add riscv32imc-unknown-none-elf
```
It is advised to run the `--release` version of the application, thus to build and run, do:
```bash
cargo build --release
cargo run --release
```

View File

@@ -117,12 +117,12 @@ fn page(heading: &str, content: Markup) -> Markup {
br; br;
"RISC-V is a registered trademark of RISC-V International · Wallas is a registered trademark of Wallas-Marin Oy · Espressif is a registered trademark of Espressif Systems" "RISC-V is a registered trademark of RISC-V International · Wallas is a registered trademark of Wallas-Marin Oy · Espressif is a registered trademark of Espressif Systems"
} }
dialog #message .dialog-center; dialog #message .dialog-center {};
dialog #"set-target" .dialog-center { dialog #"set-target" .dialog-center {
span ."cancel-x" { "🗙" }; span ."cancel-x" { "🗙" };
form { form {
div #"temperature-form" { div #"temperature-form" {
input #target type="tage" min="5" max="25" name="target"; input #target type="range" min="5" max="25" name="target";
br; br;
label #"target-label" for="target" { "Target temperature in °C" }; label #"target-label" for="target" { "Target temperature in °C" };
br; br;

View File

@@ -46,7 +46,7 @@ async function LoadLatest(platest) {
target = json.target; target = json.target;
platest.innerHTML = `Temperature was ${temperature}°C at ${time} UTC, target temperature was ${target}°C`; platest.innerHTML = `Temperature was ${temperature}°C at ${time} UTC, target temperature was ${target}°C`;
} }
}) }).catch((error) => { console.log("server unable to respond") });
await sleep(10000); await sleep(10000);
} }
}; };
@@ -125,10 +125,9 @@ async function LoadGraph(pgraph) {
target_polyline = appendSVGElement(svg, "polyline", {"class": "data target", "points": target_points_str}); target_polyline = appendSVGElement(svg, "polyline", {"class": "data target", "points": target_points_str});
temperature_polyline = appendSVGElement(svg, "polyline", {"class": "data temperature", "points": temperature_points_str}); temperature_polyline = appendSVGElement(svg, "polyline", {"class": "data temperature", "points": temperature_points_str});
//temperature_polyline.onmouseover = () => { console.log("yup"); };
pgraph.replaceChildren(graph); pgraph.replaceChildren(graph);
} }
}) }).catch((error) => { console.log("server unable to respond"); });
await sleep(10000); await sleep(10000);
} }
} }
@@ -136,7 +135,6 @@ async function LoadGraph(pgraph) {
async function set_temperature_dialog() { async function set_temperature_dialog() {
var target = null; var target = null;
await fetch("/api/v1/latest").then((response) => response.json()).then((json) => { await fetch("/api/v1/latest").then((response) => response.json()).then((json) => {
console.log(json);
if (json.target) { if (json.target) {
if (json.target < 5) { if (json.target < 5) {
target = 5; target = 5;
@@ -146,7 +144,8 @@ async function set_temperature_dialog() {
target = json.target; target = json.target;
} }
} }
}); }).catch((error) => { console.log("server unable to respond"); });
if (target == null) return;
var dialog = document.querySelector("dialog#set-target"); var dialog = document.querySelector("dialog#set-target");
dialog.showModal(); dialog.showModal();
var target_label = document.querySelector("label#target-label"); var target_label = document.querySelector("label#target-label");
@@ -177,11 +176,12 @@ async function wallas_command(cmd, no_atok, success) {
} else if (response.status == 204) { } else if (response.status == 204) {
dialog.innerHTML = success; dialog.innerHTML = success;
} else { } else {
dialog.innerHTML = "Trouble communicating with Wallas Heater, try again later"; dialog.innerHTML = "Controller has trouble communicating with Wallas Heater, try again later";
} }
}).catch((error) => { console.log("server unable to respond");
dialog.innerHTML = "Controller is unable to respond"; });
setTimeout(() => { setTimeout(() => {
dialog.close(); dialog.close();
}, 5000); }, 5000);
}); }
}

View File

@@ -83,6 +83,7 @@ button {
background-color: rgb(160, 171, 185); background-color: rgb(160, 171, 185);
border: 2px solid rgb(160, 171, 185); border: 2px solid rgb(160, 171, 185);
padding: 15px; padding: 15px;
margin: 0 0.5em 0 0.5em;
border-radius: 5px; border-radius: 5px;
} }
button:hover { button:hover {