feat: add pump corrosion protection feature, extend error handling for pump operations, and enhance configuration options
This commit is contained in:
@@ -98,6 +98,7 @@ export enum BoardVersion {
|
||||
export interface BoardHardware {
|
||||
board: BoardVersion,
|
||||
battery: BatteryBoardVersion,
|
||||
pump_corrosion_protection: boolean,
|
||||
}
|
||||
|
||||
export interface PlantControllerConfig {
|
||||
|
||||
@@ -18,3 +18,7 @@
|
||||
<select class="boardvalue" id="hardware_battery_value">
|
||||
</select>
|
||||
</div>
|
||||
<div class="flexcontainer">
|
||||
<div class="boardkey">Pump corrosion protection (weekly)</div>
|
||||
<input type="checkbox" id="hardware_pump_corrosion_protection">
|
||||
</div>
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user