Add flowsensor prototype, add canbus to backplane
This commit is contained in:
@@ -71,6 +71,7 @@ export interface TankConfig {
|
||||
tank_warn_percent: number,
|
||||
tank_empty_percent: number,
|
||||
tank_full_percent: number,
|
||||
ml_per_pulse: number
|
||||
}
|
||||
|
||||
|
||||
@@ -122,6 +123,9 @@ export interface PumpTestResult {
|
||||
median_current_ma: number,
|
||||
max_current_ma: number,
|
||||
min_current_ma: number,
|
||||
flow_value_ml: number,
|
||||
flow_value_count: number,
|
||||
pump_time_s: number,
|
||||
error: boolean,
|
||||
}
|
||||
|
||||
@@ -182,4 +186,4 @@ export interface TankInfo {
|
||||
/// water temperature
|
||||
water_temp: number | null,
|
||||
temp_sensor_error: string | null
|
||||
}
|
||||
}
|
@@ -20,16 +20,16 @@
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.plantTargetEnabledOnly_${plantId}{
|
||||
.plantTargetEnabledOnly_ ${plantId} {
|
||||
}
|
||||
|
||||
.plantPumpEnabledOnly_${plantId}{
|
||||
.plantPumpEnabledOnly_ ${plantId} {
|
||||
}
|
||||
|
||||
.plantSensorEnabledOnly_${plantId}{
|
||||
.plantSensorEnabledOnly_ ${plantId} {
|
||||
}
|
||||
|
||||
.plantHidden_${plantId} {
|
||||
.plantHidden_ ${plantId} {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
@@ -129,8 +129,28 @@
|
||||
<span class="plantsensorvalue" id="plant_${plantId}_moisture_b">not measured</span>
|
||||
</div>
|
||||
<div class="flexcontainer plantPumpEnabledOnly_${plantId}">
|
||||
<div class="plantsensorkey">Test Current</div>
|
||||
<span class="plantsensorvalue" id="plant_${plantId}_pump_current_result">not_tested</span>
|
||||
<div class="plantsensorkey">Max Current</div>
|
||||
<span class="plantsensorvalue" id="plant_${plantId}_pump_test_current_max">not_tested</span>
|
||||
</div>
|
||||
<div class="flexcontainer plantPumpEnabledOnly_${plantId}">
|
||||
<div class="plantsensorkey">Min Current</div>
|
||||
<span class="plantsensorvalue" id="plant_${plantId}_pump_test_current_min">not_tested</span>
|
||||
</div>
|
||||
<div class="flexcontainer plantPumpEnabledOnly_${plantId}">
|
||||
<div class="plantsensorkey">Average</div>
|
||||
<span class="plantsensorvalue" id="plant_${plantId}_pump_test_current_average">not_tested</span>
|
||||
</div>
|
||||
<div class="flexcontainer plantPumpEnabledOnly_${plantId}">
|
||||
<div class="plantsensorkey">Pump Time</div>
|
||||
<span class="plantsensorvalue" id="plant_${plantId}_pump_test_pump_time">not_tested</span>
|
||||
</div>
|
||||
<div class="flexcontainer plantPumpEnabledOnly_${plantId}">
|
||||
<div class="plantsensorkey">Flow ml</div>
|
||||
<span class="plantsensorvalue" id="plant_${plantId}_pump_test_flow_ml">not_tested</span>
|
||||
</div>
|
||||
<div class="flexcontainer plantPumpEnabledOnly_${plantId}">
|
||||
<div class="plantsensorkey">Flow raw</div>
|
||||
<span class="plantsensorvalue" id="plant_${plantId}_pump_test_flow_raw">not_tested</span>
|
||||
</div>
|
||||
|
||||
|
||||
|
@@ -68,12 +68,18 @@ export class PlantView {
|
||||
private readonly mode: HTMLSelectElement;
|
||||
private readonly moistureA: HTMLElement;
|
||||
private readonly moistureB: HTMLElement;
|
||||
private readonly pump_current_result: HTMLElement
|
||||
private readonly maxConsecutivePumpCount: HTMLInputElement;
|
||||
private readonly minPumpCurrentMa: HTMLInputElement;
|
||||
private readonly maxPumpCurrentMa: HTMLInputElement;
|
||||
private readonly ignoreCurrentError: HTMLInputElement;
|
||||
|
||||
private readonly pump_test_current_max: HTMLElement;
|
||||
private readonly pump_test_current_min: HTMLElement;
|
||||
private readonly pump_test_current_average: HTMLElement;
|
||||
private readonly pump_test_pump_time: HTMLElement;
|
||||
private readonly pump_test_flow_ml: HTMLElement;
|
||||
private readonly pump_test_flow_raw: HTMLElement;
|
||||
|
||||
|
||||
constructor(plantId: number, parent: HTMLDivElement, controller: Controller) {
|
||||
this.plantId = plantId;
|
||||
@@ -89,8 +95,13 @@ export class PlantView {
|
||||
|
||||
this.moistureA = document.getElementById("plant_" + plantId + "_moisture_a")! as HTMLElement;
|
||||
this.moistureB = document.getElementById("plant_" + plantId + "_moisture_b")! as HTMLElement;
|
||||
this.pump_current_result = document.getElementById("plant_" + plantId + "_pump_current_result")! as HTMLElement;
|
||||
|
||||
this.pump_test_current_max = document.getElementById("plant_" + plantId + "_pump_test_current_max")! as HTMLElement;
|
||||
this.pump_test_current_min = document.getElementById("plant_" + plantId + "_pump_test_current_min")! as HTMLElement;
|
||||
this.pump_test_current_average = document.getElementById("plant_" + plantId + "_pump_test_current_average")! as HTMLElement;
|
||||
this.pump_test_pump_time = document.getElementById("plant_" + plantId + "_pump_test_pump_time")! as HTMLElement;
|
||||
this.pump_test_flow_ml = document.getElementById("plant_" + plantId + "_pump_test_flow_ml")! as HTMLElement;
|
||||
this.pump_test_flow_raw = document.getElementById("plant_" + plantId + "_pump_test_flow_raw")! as HTMLElement;
|
||||
|
||||
this.testButton = document.getElementById("plant_" + plantId + "_test")! as HTMLButtonElement;
|
||||
this.testButton.onclick = function () {
|
||||
@@ -226,7 +237,14 @@ export class PlantView {
|
||||
}
|
||||
|
||||
setTestResult(result: PumpTestResult) {
|
||||
this.pump_current_result.innerText = "Did abort " + result.error + " median current " + result.median_current_ma + " max current " + result.max_current_ma + " min current " + result.min_current_ma
|
||||
this.pump_test_current_max.innerText = result.max_current_ma.toString()
|
||||
this.pump_test_current_min.innerText = result.min_current_ma.toString()
|
||||
this.pump_test_current_average.innerText = result.median_current_ma.toString()
|
||||
|
||||
this.pump_test_flow_raw.innerText = result.flow_value_count.toString()
|
||||
this.pump_test_flow_ml.innerText = result.flow_value_ml.toString()
|
||||
|
||||
this.pump_test_pump_time.innerText = result.pump_time_s.toString()
|
||||
}
|
||||
|
||||
setMeasurementResult(a: string, b: string) {
|
||||
|
@@ -48,6 +48,10 @@
|
||||
<div class="tankkey">Full at %</div>
|
||||
<input class="tankvalue" type="number" min="0" max="100" id="tank_full_percent">
|
||||
</div>
|
||||
<div class="flexcontainer">
|
||||
<div class="tankkey">Flow Sensor ml per pulse</div>
|
||||
<input class="tankvalue" type="number" min="0" max="1000" step="0.01" id="ml_per_pulse">
|
||||
</div>
|
||||
<button id="tank_update">Update Tank</button>
|
||||
|
||||
|
||||
@@ -82,4 +86,4 @@
|
||||
<div class="flexcontainer">
|
||||
<div class="tankkey">Warn Level</div>
|
||||
<label class="tankvalue" id="tank_measure_warnlevel"></label>
|
||||
</div>
|
||||
</div>
|
@@ -8,6 +8,7 @@ export class TankConfigView {
|
||||
private readonly tank_warn_percent: HTMLInputElement;
|
||||
private readonly tank_sensor_enabled: HTMLInputElement;
|
||||
private readonly tank_allow_pumping_if_sensor_error: HTMLInputElement;
|
||||
private readonly ml_per_pulse: HTMLInputElement;
|
||||
private readonly tank_measure_error: HTMLLabelElement;
|
||||
private readonly tank_measure_ml: HTMLLabelElement;
|
||||
private readonly tank_measure_percent: HTMLLabelElement;
|
||||
@@ -54,6 +55,8 @@ export class TankConfigView {
|
||||
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
|
||||
this.ml_per_pulse = document.getElementById("ml_per_pulse") as HTMLInputElement;
|
||||
this.ml_per_pulse.onchange = controller.configChanged
|
||||
|
||||
let tank_update = document.getElementById("tank_update") as HTMLInputElement;
|
||||
tank_update.onclick = () => {
|
||||
@@ -141,6 +144,7 @@ export class TankConfigView {
|
||||
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)
|
||||
this.ml_per_pulse.value = String(tank.ml_per_pulse)
|
||||
}
|
||||
getConfig(): TankConfig {
|
||||
return {
|
||||
@@ -149,7 +153,8 @@ export class TankConfigView {
|
||||
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
|
||||
tank_warn_percent: this.tank_warn_percent.valueAsNumber,
|
||||
ml_per_pulse: this.ml_per_pulse.valueAsNumber
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user