feat: add pump corrosion protection feature, extend error handling for pump operations, and enhance configuration options

This commit is contained in:
2026-04-16 21:56:46 +02:00
parent b740574c68
commit 0f6cb5243c
6 changed files with 95 additions and 18 deletions

View File

@@ -4,6 +4,7 @@ import {BatteryBoardVersion, BoardHardware, BoardVersion} from "./api";
export class HardwareConfigView {
private readonly hardware_board_value: HTMLSelectElement;
private readonly hardware_battery_value: HTMLSelectElement;
private readonly hardware_pump_corrosion_protection: HTMLInputElement;
constructor(controller:Controller){
(document.getElementById("hardwareview") as HTMLElement).innerHTML = require('./hardware.html') as string;
@@ -29,17 +30,22 @@ export class HardwareConfigView {
option.innerText = version.toString();
this.hardware_battery_value.appendChild(option);
})
this.hardware_pump_corrosion_protection = document.getElementById("hardware_pump_corrosion_protection") as HTMLInputElement;
this.hardware_pump_corrosion_protection.onchange = controller.configChanged
}
setConfig(hardware: BoardHardware) {
this.hardware_board_value.value = hardware.board.toString()
this.hardware_battery_value.value = hardware.battery.toString()
this.hardware_pump_corrosion_protection.checked = hardware.pump_corrosion_protection
}
getConfig(): BoardHardware {
return {
board : BoardVersion[this.hardware_board_value.value as keyof typeof BoardVersion],
battery : BatteryBoardVersion[this.hardware_battery_value.value as keyof typeof BatteryBoardVersion],
pump_corrosion_protection : this.hardware_pump_corrosion_protection.checked,
}
}
}