diff --git a/rust/src/main.rs b/rust/src/main.rs index df3220c..5c8bc7e 100644 --- a/rust/src/main.rs +++ b/rust/src/main.rs @@ -956,6 +956,8 @@ fn wait_infinity(wait_type: WaitType, reboot_now: Arc) -> ! { } } if reboot_now.load(std::sync::atomic::Ordering::Relaxed) { + //ensure clean http answer + Delay::new_default().delay_ms(500); BOARD_ACCESS.lock().unwrap().deep_sleep( 1); } } @@ -1067,9 +1069,17 @@ fn get_version() -> VersionInfo { let branch = env!("VERGEN_GIT_BRANCH").to_owned(); let hash = &env!("VERGEN_GIT_SHA")[0..8]; + let running_partition = unsafe { esp_ota_get_running_partition() }; + let address = unsafe { (*running_partition).address }; + let partition = if address > 20000 { + "ota_1" + } else { + "ota_0" + }; return VersionInfo { git_hash: (branch + "@" + hash), build_time: env!("VERGEN_BUILD_TIMESTAMP").to_owned(), + partition: partition.to_owned() }; } @@ -1077,4 +1087,5 @@ fn get_version() -> VersionInfo { struct VersionInfo { git_hash: String, build_time: String, + partition: String, } diff --git a/rust/src/plant_hal.rs b/rust/src/plant_hal.rs index d8168ae..fee7f41 100644 --- a/rust/src/plant_hal.rs +++ b/rust/src/plant_hal.rs @@ -24,7 +24,7 @@ use esp_idf_svc::wifi::EspWifi; use measurements::Temperature; use once_cell::sync::Lazy; use plant_ctrl2::sipo::ShiftRegister40; -use esp_idf_sys::{esp_deep_sleep, esp_sleep_enable_ext1_wakeup, esp_sleep_ext1_wakeup_mode_t_ESP_EXT1_WAKEUP_ANY_LOW}; +use esp_idf_sys::{esp_deep_sleep, esp_sleep_enable_ext1_wakeup, esp_sleep_ext1_wakeup_mode_t_ESP_EXT1_WAKEUP_ANY_LOW, esp_spiffs_info}; use esp_idf_sys::esp_restart; use anyhow::{anyhow, Context}; @@ -182,6 +182,8 @@ pub struct FileInfo { #[derive(Serialize, Debug)] pub struct FileList { + total: usize, + used: usize, files: Vec, file_system_corrupt: Option, iter_error: Option, @@ -232,19 +234,8 @@ impl PlantCtrlBoard<'_> { pub fn list_files(&self, filename: &str) -> FileList { let storage = CString::new(SPIFFS_PARTITION_NAME).unwrap(); - let error = unsafe { - esp! { - esp_spiffs_check(storage.as_ptr()) - } - }; - let mut file_system_corrupt = match error { - OkStd(_) => None, - Err(err) => { - println!("Corrupt spiffs {err:?}"); - Some(format!("{err:?}")) - } - }; + let mut file_system_corrupt = Option::None; let mut iter_error = None; let mut result = Vec::new(); @@ -280,8 +271,15 @@ impl PlantCtrlBoard<'_> { file_system_corrupt = Some(format!("{err:?}")); } } + let mut total:usize = 0; + let mut used:usize = 0; + unsafe { + esp_spiffs_info(storage.as_ptr(), &mut total, &mut used); + } return FileList { + total, + used, file_system_corrupt, files: result, iter_error, diff --git a/rust/src/webserver/webserver.rs b/rust/src/webserver/webserver.rs index 109a628..e2e8f06 100644 --- a/rust/src/webserver/webserver.rs +++ b/rust/src/webserver/webserver.rs @@ -5,7 +5,7 @@ use std::{ sync::{atomic::AtomicBool, Arc}, }; use crate::{ - espota::OtaUpdate, get_version, map_range_moisture, plant_hal::FileInfo, BOARD_ACCESS, + espota::OtaUpdate, get_version, map_range_moisture, plant_hal::{FileInfo, PLANT_COUNT}, BOARD_ACCESS, }; use anyhow::bail; use chrono::DateTime; @@ -159,6 +159,7 @@ fn get_battery_state( fn get_version_web( _request: &mut Request<&mut EspHttpConnection>, ) -> Result, anyhow::Error> { + anyhow::Ok(Some(serde_json::to_string(&get_version())?)) } @@ -197,19 +198,30 @@ fn list_files( fn ota( request: &mut Request<&mut EspHttpConnection>, ) -> Result, anyhow::Error> { + let mut board = BOARD_ACCESS.lock().unwrap(); let mut ota = OtaUpdate::begin()?; println!("start ota"); - + //having a larger buffer is not really faster, requires more stack and prevents the progress bar from working ;) const BUFFER_SIZE: usize = 512; let mut buffer: [u8; BUFFER_SIZE] = [0; BUFFER_SIZE]; let mut total_read: usize = 0; + let mut lastiter = 0; loop { let read = request.read(&mut buffer)?; total_read += read; println!("received {read} bytes ota {total_read}"); let to_write = &buffer[0..read]; + let iter = (total_read/1024)%8; + if iter != lastiter { + for i in 0..PLANT_COUNT { + board.fault(i, iter==i); + + } + lastiter = iter; + } + ota.write(to_write)?; println!("wrote {read} bytes ota {total_read}"); if read == 0 { @@ -222,6 +234,8 @@ fn ota( let mut finalizer = ota.finalize()?; println!("changing boot partition"); + board.set_restart_to_conf(true); + drop(board); finalizer.set_as_boot_partition()?; finalizer.restart(); } @@ -413,10 +427,11 @@ pub fn httpd(reboot_now: Arc) -> Box> { server .fn_handler("/file", Method::Post, move |mut request| { let filename = query_param(request.uri(), "filename").unwrap(); - let file_handle = BOARD_ACCESS - .lock() - .unwrap() - .get_file_handle(&filename, true); + let lock = BOARD_ACCESS + .lock() + .unwrap(); + let file_handle = + lock.get_file_handle(&filename, true); match file_handle { //TODO get free filesystem size, check against during write if not to large @@ -424,13 +439,21 @@ pub fn httpd(reboot_now: Arc) -> Box> { const BUFFER_SIZE: usize = 512; let mut buffer: [u8; BUFFER_SIZE] = [0; BUFFER_SIZE]; let mut total_read: usize = 0; + let mut lastiter = 0; loop { + + let iter = (total_read/1024)%8; + if iter != lastiter { + for i in 0..PLANT_COUNT { + lock.fault(i, iter==i); + } + lastiter = iter; + } + let read = request.read(&mut buffer)?; total_read += read; - println!("sending {read} bytes of {total_read} for upload {filename}"); let to_write = &buffer[0..read]; std::io::Write::write(&mut file_handle, to_write)?; - println!("wrote {read} bytes of {total_read} for upload {filename}"); if read == 0 { break; } @@ -444,6 +467,7 @@ pub fn httpd(reboot_now: Arc) -> Box> { cors_response(request, 500, &error_text)?; } } + drop(lock); anyhow::Ok(()) }) .unwrap(); @@ -466,6 +490,11 @@ pub fn httpd(reboot_now: Arc) -> Box> { anyhow::Ok(()) }) .unwrap(); + server + .fn_handler("/file", Method::Options, |request| { + cors_response(request, 200, "") + }) + .unwrap(); server .fn_handler("/flashbattery", Method::Post, move |request| { @@ -529,6 +558,7 @@ fn cors_response( let headers = [ ("Access-Control-Allow-Origin", "*"), ("Access-Control-Allow-Headers", "*"), + ("Access-Control-Allow-Methods", "*"), ]; let mut response = request.into_response(status, None, &headers)?; response.write(body.as_bytes())?; diff --git a/rust/src_webpack/package-lock.json b/rust/src_webpack/package-lock.json index a09b618..4ff941a 100644 --- a/rust/src_webpack/package-lock.json +++ b/rust/src_webpack/package-lock.json @@ -6,6 +6,7 @@ "": { "dependencies": { "copy-webpack-plugin": "^12.0.2", + "fast-equals": "^5.2.2", "source-map-loader": "^4.0.1" }, "devDependencies": { @@ -1765,6 +1766,15 @@ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" }, + "node_modules/fast-equals": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/fast-equals/-/fast-equals-5.2.2.tgz", + "integrity": "sha512-V7/RktU11J3I36Nwq2JnZEM7tNm17eBJz+u25qdxBZeCKiX6BkVSZQjwWIr+IobgnZy+ag73tTZgZi7tr0LrBw==", + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/fast-glob": { "version": "3.3.2", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz", diff --git a/rust/src_webpack/package.json b/rust/src_webpack/package.json index fe41dba..9deae38 100644 --- a/rust/src_webpack/package.json +++ b/rust/src_webpack/package.json @@ -11,6 +11,7 @@ }, "dependencies": { "copy-webpack-plugin": "^12.0.2", + "fast-equals": "^5.2.2", "source-map-loader": "^4.0.1" } } diff --git a/rust/src_webpack/src/api.ts b/rust/src_webpack/src/api.ts index 37995f5..4403458 100644 --- a/rust/src_webpack/src/api.ts +++ b/rust/src_webpack/src/api.ts @@ -6,6 +6,19 @@ interface NetworkConfig { base_topic: string } +interface FileList { + total: number, + used: number, + files: FileInfo[], + file_system_corrupt: string, + iter_error: string, +} + +interface FileInfo{ + filename: string, + size: number, +} + interface NightLampConfig { night_lamp_hour_start: number, night_lamp_hour_end: number, @@ -64,7 +77,8 @@ interface Moistures { interface VersionInfo { git_hash: string, - build_time: string + build_time: string, + partition: string } interface BatteryState { diff --git a/rust/src_webpack/src/batteryview.html b/rust/src_webpack/src/batteryview.html index 687afd4..b605242 100644 --- a/rust/src_webpack/src/batteryview.html +++ b/rust/src_webpack/src/batteryview.html @@ -1,3 +1,13 @@ + +
Battery: diff --git a/rust/src_webpack/src/fileview.html b/rust/src_webpack/src/fileview.html new file mode 100644 index 0000000..3c7f49a --- /dev/null +++ b/rust/src_webpack/src/fileview.html @@ -0,0 +1,72 @@ + + +
Files:
+
+
Total Size
+
+
+
+
Used Size
+
+
+
+
Free Size
+
+
+
+ +
+
Upload:
+
+
+
+
+ File: +
+ +
+
+
+ Name: +
+ +
+
+
+ +
+
+
+
List:
+
+
+
\ No newline at end of file diff --git a/rust/src_webpack/src/fileview.ts b/rust/src_webpack/src/fileview.ts new file mode 100644 index 0000000..69645e2 --- /dev/null +++ b/rust/src_webpack/src/fileview.ts @@ -0,0 +1,97 @@ +import { Controller } from "./main"; + +const regex = /[^a-zA-Z0-9_.]/g; + +function sanitize(str:string){ + return str.replaceAll(regex, '_') +} + +export class FileView { + readonly fileListView: HTMLElement; + readonly controller: Controller; + readonly filefreesize: HTMLElement; + readonly filetotalsize: HTMLElement; + readonly fileusedsize: HTMLElement; + + constructor(controller: Controller) { + (document.getElementById("fileview") as HTMLElement).innerHTML = require('./fileview.html') as string; + this.fileListView = document.getElementById("fileList") as HTMLElement + this.filefreesize = document.getElementById("filefreesize") as HTMLElement + this.filetotalsize = document.getElementById("filetotalsize") as HTMLElement + this.fileusedsize = document.getElementById("fileusedsize") as HTMLElement + + let fileuploadfile = document.getElementById("fileuploadfile") as HTMLInputElement + let fileuploadname = document.getElementById("fileuploadname") as HTMLInputElement + let fileuploadbtn = document.getElementById("fileuploadbtn") as HTMLInputElement + fileuploadfile.onchange = () => { + var selectedFile = fileuploadfile.files?.[0]; + if (selectedFile == null) { + //TODO error dialog here + return + } + + fileuploadname.value = sanitize(selectedFile.name) + }; + + fileuploadname.onchange = () => { + let input = fileuploadname.value + let clean = sanitize(fileuploadname.value) + if (input != clean){ + fileuploadname.value = clean + } + } + + fileuploadbtn.onclick = () => { + var selectedFile = fileuploadfile.files?.[0]; + if (selectedFile == null) { + //TODO error dialog here + return + } + controller.uploadFile(selectedFile, selectedFile.name) + } + + + + this.controller = controller; + } + + setFileList(fileList: FileList, public_url: string) { + this.filetotalsize.innerText = Math.floor(fileList.total / 1024) + "kB" + this.fileusedsize.innerText = Math.ceil(fileList.used / 1024) + "kB" + this.filefreesize.innerText = Math.ceil((fileList.total - fileList.used) / 1024) + "kB" + + //fast clear + this.fileListView.textContent = "" + for (let i = 0; i < fileList.files.length; i++) { + let file = fileList.files[i] + new FileEntry(this.controller, i, file, this.fileListView, public_url); + } + } +} + +class FileEntry { + view: HTMLElement; + constructor(controller: Controller, fileid: number, fileinfo: FileInfo, parent: HTMLElement, public_url: string) { + this.view = document.createElement("div") as HTMLElement + parent.appendChild(this.view) + this.view.classList.add("fileentryouter") + + const template = require('./fileviewentry.html') as string; + const fileRaw = template.replaceAll("${fileid}", String(fileid)); + this.view.innerHTML = fileRaw + + let name = document.getElementById("file_" + fileid + "_name") as HTMLElement; + let size = document.getElementById("file_" + fileid + "_size") as HTMLElement; + let deleteBtn = document.getElementById("file_" + fileid + "_delete") as HTMLButtonElement; + deleteBtn.onclick = () => { + controller.deleteFile(fileinfo.filename); + } + + let downloadBtn = document.getElementById("file_" + fileid + "_download") as HTMLAnchorElement; + downloadBtn.href = public_url + "/file?filename=" + fileinfo.filename + downloadBtn.download = fileinfo.filename + + name.innerText = fileinfo.filename; + size.innerText = fileinfo.size.toString() + } +} \ No newline at end of file diff --git a/rust/src_webpack/src/fileviewentry.html b/rust/src_webpack/src/fileviewentry.html new file mode 100644 index 0000000..b602480 --- /dev/null +++ b/rust/src_webpack/src/fileviewentry.html @@ -0,0 +1,11 @@ +
+
Name
+
+ +
+
Size
+
+ Download + +
+ diff --git a/rust/src_webpack/src/main.html b/rust/src_webpack/src/main.html index 0b6f260..1413ea6 100644 --- a/rust/src_webpack/src/main.html +++ b/rust/src_webpack/src/main.html @@ -1,6 +1,7 @@ @@ -208,11 +139,11 @@
-
+
-
+
-
+
@@ -224,31 +155,32 @@
- - - - - - -

config

Plants:

- -
-
- - +
+
+ + +
+
+
+
+
+ + + +
-
-
- -
+
> +
+
+
>
\ No newline at end of file diff --git a/rust/src_webpack/src/main.ts b/rust/src_webpack/src/main.ts index 25728d3..ca10441 100644 --- a/rust/src_webpack/src/main.ts +++ b/rust/src_webpack/src/main.ts @@ -1,4 +1,6 @@ +import { deepEqual } from 'fast-equals'; + declare var PUBLIC_URL: string; console.log("Url is " + PUBLIC_URL); @@ -14,8 +16,69 @@ import { SubmitView } from "./submitView"; import { ProgressView } from "./progress"; import { OTAView } from "./ota"; import { BatteryView } from "./batteryview"; +import { FileView } from './fileview'; export class Controller { + updateFileList() { + fetch(PUBLIC_URL + "/files") + .then(response => response.json()) + .then(json => json as FileList) + .then(filelist => { + controller.fileview.setFileList(filelist, PUBLIC_URL) + }) + .catch(error => { + console.log(error); + }); + } + uploadFile(file: File, name:string) { + var current = 0; + var max = 100; + controller.progressview.addProgress("file_upload", (current / max) * 100, "Uploading File " + name + "(" + current + "/" + max + ")") + var ajax = new XMLHttpRequest(); + ajax.upload.addEventListener("progress", event => { + current = event.loaded / 1000; + max = event.total / 1000; + controller.progressview.addProgress("file_upload", (current / max) * 100, "Uploading File " + name + "(" + current + "/" + max + ")") + }, false); + ajax.addEventListener("load", () => { + controller.progressview.removeProgress("file_upload") + controller.updateFileList() + }, false); + ajax.addEventListener("error", () => { + alert("Error upload") + controller.progressview.removeProgress("file_upload") + controller.updateFileList() + }, false); + ajax.addEventListener("abort", () => { + alert("abort upload") + controller.progressview.removeProgress("file_upload") + controller.updateFileList() + }, false); + ajax.open("POST", PUBLIC_URL + "/file?filename="+name); + ajax.send(file); + } + deleteFile(name:string) { + controller.progressview.addIndeterminate("file_delete", "Deleting " + name); + var ajax = new XMLHttpRequest(); + ajax.open("DELETE", PUBLIC_URL + "/file?filename="+name); + ajax.send(); + ajax.addEventListener("error", () => { + controller.progressview.removeProgress("file_delete") + alert("Error delete") + controller.updateFileList() + }, false); + ajax.addEventListener("abort", () => { + controller.progressview.removeProgress("file_delete") + alert("Error upload") + controller.updateFileList() + }, false); + ajax.addEventListener("load", () => { + controller.progressview.removeProgress("file_delete") + controller.updateFileList() + }, false); + controller.updateFileList() + } + updateRTCData() { fetch(PUBLIC_URL + "/time") .then(response => response.json()) @@ -81,12 +144,16 @@ export class Controller { .then(response => response.json()) .then(loaded => { var currentConfig = loaded as PlantControllerConfig; - this.setConfig(currentConfig); + controller.setInitialConfig(currentConfig); + controller.setConfig(currentConfig); //sync json view initially this.configChanged(); controller.progressview.removeProgress("get_config") }) } + setInitialConfig(currentConfig: PlantControllerConfig) { + this.initialConfig = currentConfig + } uploadConfig(json: string, statusCallback: (status: string) => void) { controller.progressview.addIndeterminate("set_config", "Uploading Config") fetch(PUBLIC_URL + "/set_config", { @@ -96,6 +163,8 @@ export class Controller { .then(response => response.text()) .then(text => statusCallback(text)) controller.progressview.removeProgress("set_config") + //load from remote to be clean + controller.downloadConfig() } syncRTCFromBrowser() { controller.progressview.addIndeterminate("write_rtc", "Writing RTC") @@ -113,12 +182,19 @@ export class Controller { configChanged() { const current = controller.getConfig(); - var pretty = JSON.stringify(current, undefined, 1); - console.log(pretty) + var pretty = JSON.stringify(current, undefined, 0); + var initial = JSON.stringify(this.initialConfig, undefined, 0); controller.submitView.setJson(pretty); + + if (deepEqual(current, controller.initialConfig)) { + document.title = "PlantCtrl" + } else { + document.title = "*PlantCtrl" + } } + testPlant(plantId: number) { let counter = 0 let limit = 30 @@ -261,8 +337,7 @@ export class Controller { setTimeout(this.waitForReboot, 1000) } - - + initialConfig: PlantControllerConfig | null = null readonly rebootBtn: HTMLButtonElement readonly exitBtn: HTMLButtonElement readonly timeView: TimeView; @@ -274,6 +349,7 @@ export class Controller { readonly firmWareView: OTAView; readonly progressview: ProgressView; readonly batteryView: BatteryView; + readonly fileview: FileView; constructor() { this.timeView = new TimeView(this) this.plantViews = new PlantViews(this) @@ -284,6 +360,7 @@ export class Controller { this.submitView = new SubmitView(this) this.firmWareView = new OTAView(this) this.progressview = new ProgressView(this) + this.fileview = new FileView(this) this.rebootBtn = document.getElementById("reboot") as HTMLButtonElement this.rebootBtn.onclick = () => { controller.reboot(); @@ -300,5 +377,6 @@ controller.updateBatteryData(); controller.downloadConfig(); //controller.measure_moisture(); controller.version(); +controller.updateFileList(); controller.progressview.removeProgress("rebooting"); diff --git a/rust/src_webpack/src/network.html b/rust/src_webpack/src/network.html index 666d1b1..521155f 100644 --- a/rust/src_webpack/src/network.html +++ b/rust/src_webpack/src/network.html @@ -1,3 +1,25 @@ +
@@ -14,7 +36,7 @@
- + diff --git a/rust/src_webpack/src/nightlightview.html b/rust/src_webpack/src/nightlightview.html index 613e85b..b761089 100644 --- a/rust/src_webpack/src/nightlightview.html +++ b/rust/src_webpack/src/nightlightview.html @@ -1,5 +1,22 @@ + +
Light:
-
+
Enable Nightlight
diff --git a/rust/src_webpack/src/ota.html b/rust/src_webpack/src/ota.html index 098696d..32522b9 100644 --- a/rust/src_webpack/src/ota.html +++ b/rust/src_webpack/src/ota.html @@ -1,3 +1,19 @@ +
Current Firmware @@ -11,6 +27,10 @@ Buildhash:
+
+ Partition: + +

diff --git a/rust/src_webpack/src/ota.ts b/rust/src_webpack/src/ota.ts index ef008fc..a533e02 100644 --- a/rust/src_webpack/src/ota.ts +++ b/rust/src_webpack/src/ota.ts @@ -1,16 +1,19 @@ import { Controller } from "./main"; export class OTAView { - file1Upload: HTMLInputElement; - firmware_buildtime: HTMLDivElement; - firmware_githash: HTMLDivElement; + readonly file1Upload: HTMLInputElement; + readonly firmware_buildtime: HTMLDivElement; + readonly firmware_githash: HTMLDivElement; + readonly firmware_partition: HTMLDivElement; constructor(controller: Controller) { (document.getElementById("firmwareview") as HTMLElement).innerHTML = require("./ota.html") 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; + const file = document.getElementById("firmware_file") as HTMLInputElement; this.file1Upload = file this.file1Upload.onchange = () => { @@ -26,5 +29,6 @@ export class OTAView { setVersion(versionInfo: VersionInfo) { this.firmware_buildtime.innerText = versionInfo.build_time; this.firmware_githash.innerText = versionInfo.git_hash; + this.firmware_partition.innerText = versionInfo.partition; } } \ No newline at end of file diff --git a/rust/src_webpack/src/plant.html b/rust/src_webpack/src/plant.html index 4108a46..5151c27 100644 --- a/rust/src_webpack/src/plant.html +++ b/rust/src_webpack/src/plant.html @@ -1,65 +1,88 @@ + +
-
Plant ${plantId}
+
+ Plant ${plantId} +
- -
-
-
- -
-
-
-
Live:
-
-
-
Sensor A:
- loading -
Sensor B:
- loading -
-
-
+
+
Mode:
-
-
-
Target Moisture:
- +
+
Target Moisture:
+
-
-
Pump Time (s):
- +
+
Pump Time (s):
+
-
-
Pump Cooldown (m):
- +
+
Pump Cooldown (m):
+
-
-
"Pump Hour Start":
- +
+
"Pump Hour Start":
+
-
-
"Pump Hour End":
- +
+
"Pump Hour End":
+
-
-
Sensor B installed:
- -
-
-
Warn Pump Count:
- +
Warn Pump Count:
+
-
+ +
+
Sensor B installed:
+ +
+ +
+ +
+ +
+
Live:
+
+
+ Sensor A: + loading +
+
+
Sensor B:
+ loading +
+
\ No newline at end of file diff --git a/rust/src_webpack/src/plant.ts b/rust/src_webpack/src/plant.ts index ab9047a..052ed6c 100644 --- a/rust/src_webpack/src/plant.ts +++ b/rust/src_webpack/src/plant.ts @@ -144,7 +144,6 @@ export class PlantView { } setConfig(plantConfig: PlantConfig) { - console.log("apply config to ui plant " + this.plantId + " config: " + JSON.stringify(plantConfig)) this.mode.value = plantConfig.mode; this.targetMoisture.value = plantConfig.target_moisture.toString(); this.pumpTimeS.value = plantConfig.pump_time_s.toString(); diff --git a/rust/src_webpack/src/progress.ts b/rust/src_webpack/src/progress.ts index 6336dcc..2f00b1a 100644 --- a/rust/src_webpack/src/progress.ts +++ b/rust/src_webpack/src/progress.ts @@ -44,14 +44,14 @@ export class ProgressView{ addIndeterminate(id:string, displayText:string){ this.progresses.set(id, new ProgressInfo(displayText,0,true)) - this.progressPane.style.display = "block" + this.progressPane.style.display = "flex" this.updateView(); } addProgress(id:string, value:number, displayText:string) { this.progresses.set(id, new ProgressInfo(displayText,value, false)) - this.progressPane.style.display = "block" + this.progressPane.style.display = "flex" this.updateView(); } removeProgress(id:string){ diff --git a/rust/src_webpack/src/tankview.html b/rust/src_webpack/src/tankview.html index 50bccb6..0e23ec3 100644 --- a/rust/src_webpack/src/tankview.html +++ b/rust/src_webpack/src/tankview.html @@ -1,7 +1,21 @@ + +
Tank:
-
+
Enable Tank Sensor
diff --git a/rust/src_webpack/webpack.config.js b/rust/src_webpack/webpack.config.js index bcf0f88..135d1e3 100644 --- a/rust/src_webpack/webpack.config.js +++ b/rust/src_webpack/webpack.config.js @@ -8,7 +8,8 @@ const isDevServer = process.env.WEBPACK_SERVE; console.log("Dev server is " + isDevServer); var host; if (isDevServer){ - host = 'http://10.23.43.24'; + //ensure no trailing / + host = 'http://192.168.1.172'; } else { host = ''; }