fix selftest button, allow selftest to run without prior config
This commit is contained in:
parent
3fe9aaeb6f
commit
93b37d0991
@ -115,7 +115,7 @@ fn get_live_moisture(
|
||||
_request: &mut Request<&mut EspHttpConnection>,
|
||||
) -> Result<Option<std::string::String>, anyhow::Error> {
|
||||
let mut board = BOARD_ACCESS.lock().unwrap();
|
||||
let config = board.get_config().unwrap();
|
||||
let config = board.get_config().unwrap_or(PlantControllerConfig::default());
|
||||
|
||||
let plant_state = Vec::from_iter(
|
||||
(0..PLANT_COUNT).map(|i| PlantState::read_hardware_state(i, &mut board, &config.plants[i])),
|
||||
|
@ -279,6 +279,21 @@ export class Controller {
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
selfTest() {
|
||||
controller.progressview.addIndeterminate("boardtest", "Self test running");
|
||||
|
||||
fetch(PUBLIC_URL + "/boardtest", {
|
||||
method: "POST"
|
||||
})
|
||||
.then(response => response.text())
|
||||
.then(
|
||||
_ => {
|
||||
controller.progressview.removeProgress("boardtest");
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
testPlant(plantId: number) {
|
||||
let counter = 0
|
||||
let limit = 30
|
||||
@ -466,6 +481,7 @@ export class Controller {
|
||||
controller.exit();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
const controller = new Controller();
|
||||
controller.progressview.removeProgress("rebooting");
|
||||
|
@ -5,6 +5,7 @@ export class OTAView {
|
||||
readonly firmware_buildtime: HTMLDivElement;
|
||||
readonly firmware_githash: HTMLDivElement;
|
||||
readonly firmware_partition: HTMLDivElement;
|
||||
readonly test: HTMLButtonElement;
|
||||
|
||||
constructor(controller: Controller) {
|
||||
(document.getElementById("firmwareview") as HTMLElement).innerHTML = require("./ota.html")
|
||||
@ -12,7 +13,7 @@ export class OTAView {
|
||||
this.firmware_buildtime = document.getElementById("firmware_buildtime") as HTMLDivElement;
|
||||
this.firmware_githash = document.getElementById("firmware_githash") as HTMLDivElement;
|
||||
this.firmware_partition = document.getElementById("firmware_partition") as HTMLDivElement;
|
||||
|
||||
this.test = document.getElementById("test") as HTMLButtonElement;
|
||||
|
||||
const file = document.getElementById("firmware_file") as HTMLInputElement;
|
||||
this.file1Upload = file
|
||||
@ -24,6 +25,10 @@ export class OTAView {
|
||||
}
|
||||
controller.uploadNewFirmware(selectedFile);
|
||||
};
|
||||
|
||||
this.test.onclick = () => {
|
||||
controller.selfTest()
|
||||
}
|
||||
}
|
||||
|
||||
setVersion(versionInfo: VersionInfo) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user