remove HAL implementation files for v3 and v4, and the build script

This commit is contained in:
2026-01-04 18:41:38 +01:00
parent 412a26390a
commit d33b05e1d7
21 changed files with 504 additions and 1418 deletions

View File

@@ -175,12 +175,12 @@ export interface BatteryState {
}
export interface DetectionPlant {
a: boolean,
b: boolean
sensor_a: boolean,
sensor_b: boolean
}
export interface DetectionResult {
plants: DetectionPlant[]
plant: DetectionPlant[]
}
export interface TankInfo {
@@ -202,3 +202,4 @@ export interface TankInfo {
water_temp: number | null,
temp_sensor_error: string | null
}

View File

@@ -2,6 +2,7 @@ import {deepEqual} from 'fast-equals';
declare var PUBLIC_URL: string;
console.log("Url is " + PUBLIC_URL);
console.log("Public url is " + PUBLIC_URL);
document.body.innerHTML = require('./main.html') as string;
@@ -28,7 +29,7 @@ import {
SetTime, SSIDList, TankInfo,
TestPump,
VersionInfo,
FileList, SolarState, PumpTestResult
FileList, SolarState, PumpTestResult, DetectionResult
} from "./api";
import {SolarView} from "./solarview";
import {toast} from "./toast";
@@ -289,6 +290,7 @@ export class Controller {
method: "POST",
body: pretty
}).then(
_ => controller.progressview.removeProgress("write_rtc")
)
}
@@ -376,11 +378,15 @@ export class Controller {
fetch(PUBLIC_URL + "/detect_sensors", { method: "POST" })
.then(response => response.json())
.then (json => json as DetectionResult)
.then(json => {
clearTimeout(timerId);
controller.progressview.removeProgress("detect_sensors");
const pretty = JSON.stringify(json);
toast.info("Detection result: " + pretty);
console.log(pretty);
this.plantViews.applyDetectionResult(json);
})
.catch(error => {
clearTimeout(timerId);

View File

@@ -1,4 +1,4 @@
import {PlantConfig, PumpTestResult} from "./api";
import {DetectionPlant, DetectionResult, PlantConfig, PumpTestResult} from "./api";
const PLANT_COUNT = 8;
@@ -47,6 +47,13 @@ export class PlantViews {
const plantView = this.plants[plantId];
plantView.setTestResult(response)
}
applyDetectionResult(json: DetectionResult) {
for (let i = 0; i < PLANT_COUNT; i++) {
var plantResult = json.plant[i];
this.plants[i].setDetectionResult(plantResult);
}
}
}
@@ -80,9 +87,12 @@ export class PlantView {
private readonly pump_test_pump_time: HTMLElement;
private readonly pump_test_flow_ml: HTMLElement;
private readonly pump_test_flow_raw: HTMLElement;
private showDisabled: boolean = false;
private readonly controller: Controller;
constructor(plantId: number, parent: HTMLDivElement, controller: Controller) {
this.controller = controller;
this.plantId = plantId;
this.plantDiv = document.createElement("div")! as HTMLDivElement
const template = require('./plant.html') as string;
@@ -217,6 +227,14 @@ export class PlantView {
let showTarget = plantConfig.mode === "TargetMoisture"
let showMin = plantConfig.mode === "MinMoisture"
if(this.showDisabled || plantConfig.sensor_a || plantConfig.sensor_b) {
console.log("Showing plant " + this.plantId);
this.plantDiv.style.display = "block";
} else {
console.log("Hiding plant " + this.plantId);
this.plantDiv.style.display = "none";
}
console.log("updateVisibility showsensor: " + showSensor + " pump " + showPump + " target " +showTarget + " min " + showMin)
for (const element of Array.from(sensorOnly)) {
@@ -315,4 +333,20 @@ export class PlantView {
this.updateVisibility(conv);
return conv;
}
setDetectionResult(plantResult: DetectionPlant) {
var changed = false;
if (this.sensorAInstalled.checked != plantResult.sensor_b){
changed = true;
this.sensorAInstalled.checked = plantResult.sensor_a;
}
if (this.sensorBInstalled.checked != plantResult.sensor_b){
changed = true;
this.sensorBInstalled.checked = plantResult.sensor_b;
}
if (changed) {
this.controller.configChanged();
}
}
}

View File

@@ -1,5 +1,5 @@
import { Controller } from "./main";
import {TankConfig, TankInfo} from "./api";
import {DetectionResult, TankConfig, TankInfo} from "./api";
export class TankConfigView {
private readonly tank_useable_ml: HTMLInputElement;
@@ -157,4 +157,6 @@ export class TankConfigView {
ml_per_pulse: this.ml_per_pulse.valueAsNumber
}
}
}
}

View File

@@ -20,6 +20,7 @@ class ToastService {
}
error(message: string) {
console.error(message);
const el = this.createToast(message, 'error');
this.container.appendChild(el);
// Only dismiss on click