Pump Time (s):
diff --git a/rust/src_webpack/src/plant.ts b/rust/src_webpack/src/plant.ts
index 6f29fc4..12e33b2 100644
--- a/rust/src_webpack/src/plant.ts
+++ b/rust/src_webpack/src/plant.ts
@@ -59,6 +59,7 @@ export class PlantView {
private readonly header: HTMLElement;
private readonly testButton: HTMLButtonElement;
private readonly targetMoisture: HTMLInputElement;
+ private readonly minMoisture: HTMLInputElement;
private readonly pumpTimeS: HTMLInputElement;
private readonly pumpCooldown: HTMLInputElement;
private readonly pumpHourStart: HTMLSelectElement;
@@ -118,6 +119,11 @@ export class PlantView {
controller.configChanged()
}
+ this.minMoisture = document.getElementById("plant_" + plantId + "_min_moisture")! as HTMLInputElement;
+ this.minMoisture.onchange = function () {
+ controller.configChanged()
+ }
+
this.pumpTimeS = document.getElementById("plant_" + plantId + "_pump_time_s") as HTMLInputElement;
this.pumpTimeS.onchange = function () {
controller.configChanged()
@@ -203,13 +209,15 @@ export class PlantView {
let sensorOnly = document.getElementsByClassName("plantSensorEnabledOnly_"+ this.plantId)
let pumpOnly = document.getElementsByClassName("plantPumpEnabledOnly_"+ this.plantId)
let targetOnly = document.getElementsByClassName("plantTargetEnabledOnly_"+ this.plantId)
+ let minOnly = document.getElementsByClassName("plantMinEnabledOnly_"+ this.plantId)
console.log("updateVisibility plantConfig: " + plantConfig.mode)
let showSensor = plantConfig.sensor_a || plantConfig.sensor_b
let showPump = plantConfig.mode !== "OFF"
let showTarget = plantConfig.mode === "TargetMoisture"
+ let showMin = plantConfig.mode === "MinMoisture"
- console.log("updateVisibility showsensor: " + showSensor + " pump " + showPump + " target " +showTarget)
+ console.log("updateVisibility showsensor: " + showSensor + " pump " + showPump + " target " +showTarget + " min " + showMin)
for (const element of Array.from(sensorOnly)) {
if (showSensor) {
@@ -234,6 +242,14 @@ export class PlantView {
element.classList.add("plantHidden_" + this.plantId)
}
}
+
+ for (const element of Array.from(minOnly)) {
+ if (showMin) {
+ element.classList.remove("plantHidden_" + this.plantId)
+ } else {
+ element.classList.add("plantHidden_" + this.plantId)
+ }
+ }
}
setTestResult(result: PumpTestResult) {
@@ -255,6 +271,7 @@ export class PlantView {
setConfig(plantConfig: PlantConfig) {
this.mode.value = plantConfig.mode;
this.targetMoisture.value = plantConfig.target_moisture.toString();
+ this.minMoisture.value = plantConfig.min_moisture?.toString() || "";
this.pumpTimeS.value = plantConfig.pump_time_s.toString();
this.pumpCooldown.value = plantConfig.pump_cooldown_min.toString();
this.pumpHourStart.value = plantConfig.pump_hour_start.toString();
@@ -280,6 +297,7 @@ export class PlantView {
let conv: PlantConfig = {
mode: this.mode.value,
target_moisture: this.targetMoisture.valueAsNumber,
+ min_moisture: this.minMoisture.valueAsNumber,
pump_time_s: this.pumpTimeS.valueAsNumber,
pump_cooldown_min: this.pumpCooldown.valueAsNumber,
pump_hour_start: +this.pumpHourStart.value,