adust pcb to new 3.3 software improvements

This commit is contained in:
2024-12-30 20:19:37 +01:00
parent 58b63fc8ee
commit 1927449c1d
22 changed files with 16833 additions and 13984 deletions

View File

@@ -0,0 +1,47 @@
import { Controller } from "./main";
export class TankConfigView {
private readonly tank_useable_ml: HTMLInputElement;
private readonly tank_empty_percent: HTMLInputElement;
private readonly tank_full_percent: HTMLInputElement;
private readonly tank_warn_percent: HTMLInputElement;
private readonly tank_sensor_enabled: HTMLInputElement;
private readonly tank_allow_pumping_if_sensor_error: HTMLInputElement;
constructor(controller:Controller){
(document.getElementById("tankview") as HTMLElement).innerHTML = require("./tankview.html")
this.tank_useable_ml = document.getElementById("tank_useable_ml") as HTMLInputElement;
this.tank_useable_ml.onchange = controller.configChanged
this.tank_empty_percent = document.getElementById("tank_empty_percent") as HTMLInputElement;
this.tank_empty_percent.onchange = controller.configChanged
this.tank_full_percent = document.getElementById("tank_full_percent") as HTMLInputElement;
this.tank_full_percent.onchange = controller.configChanged
this.tank_warn_percent = document.getElementById("tank_warn_percent") as HTMLInputElement;
this.tank_warn_percent.onchange = controller.configChanged
this.tank_sensor_enabled = document.getElementById("tank_sensor_enabled") as HTMLInputElement;
this.tank_sensor_enabled.onchange = controller.configChanged
this.tank_allow_pumping_if_sensor_error = document.getElementById("tank_allow_pumping_if_sensor_error") as HTMLInputElement;
this.tank_allow_pumping_if_sensor_error.onchange = controller.configChanged
}
setConfig(tank: TankConfig) {
this.tank_allow_pumping_if_sensor_error.checked = tank.tank_allow_pumping_if_sensor_error;
this.tank_empty_percent.value = String(tank.tank_empty_percent)
this.tank_warn_percent.value = String(tank.tank_warn_percent)
this.tank_full_percent.value = String(tank.tank_full_percent)
this.tank_sensor_enabled.checked = tank.tank_sensor_enabled
this.tank_useable_ml.value = String(tank.tank_useable_ml)
}
getConfig(): TankConfig {
return {
tank_allow_pumping_if_sensor_error: this.tank_allow_pumping_if_sensor_error.checked,
tank_empty_percent : this.tank_empty_percent.valueAsNumber,
tank_full_percent: this.tank_full_percent.valueAsNumber,
tank_sensor_enabled: this.tank_sensor_enabled.checked,
tank_useable_ml: this.tank_useable_ml.valueAsNumber,
tank_warn_percent: this.tank_warn_percent.valueAsNumber
}
}
}