adust pcb to new 3.3 software improvements
This commit is contained in:
@@ -9,10 +9,11 @@ import { TimeView } from "./timeview";
|
||||
import { PlantView, PlantViews } from "./plant";
|
||||
import { NetworkConfigView } from "./network";
|
||||
import { NightLampView } from "./nightmode";
|
||||
import { TankConfigView } from "./tanks";
|
||||
import { TankConfigView } from "./tankview";
|
||||
import { SubmitView } from "./submitView";
|
||||
import { ProgressView } from "./progress";
|
||||
import { OTAView } from "./ota";
|
||||
import { BatteryView } from "./batteryview";
|
||||
|
||||
export class Controller {
|
||||
updateRTCData() {
|
||||
@@ -27,6 +28,18 @@ export class Controller {
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
updateBatteryData() {
|
||||
fetch(PUBLIC_URL + "/battery")
|
||||
.then(response => response.json())
|
||||
.then(json => json as BatteryState)
|
||||
.then(battery => {
|
||||
controller.batteryView.update(battery)
|
||||
})
|
||||
.catch(error => {
|
||||
controller.batteryView.update(null)
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
uploadNewFirmware(file: File) {
|
||||
var current = 0;
|
||||
var max = 100;
|
||||
@@ -226,11 +239,13 @@ export class Controller {
|
||||
readonly submitView: SubmitView;
|
||||
readonly firmWareView : OTAView;
|
||||
readonly progressview: ProgressView;
|
||||
readonly batteryView: BatteryView;
|
||||
constructor() {
|
||||
this.timeView = new TimeView(this)
|
||||
this.plantViews = new PlantViews(this)
|
||||
this.networkView = new NetworkConfigView(this, PUBLIC_URL)
|
||||
this.tankView = new TankConfigView(this)
|
||||
this.batteryView = new BatteryView(this)
|
||||
this.nightLampView = new NightLampView(this)
|
||||
this.submitView = new SubmitView(this)
|
||||
this.firmWareView = new OTAView(this)
|
||||
@@ -239,6 +254,8 @@ export class Controller {
|
||||
}
|
||||
const controller = new Controller();
|
||||
controller.updateRTCData();
|
||||
controller.updateBatteryData();
|
||||
controller.downloadConfig();
|
||||
controller.measure_moisture();
|
||||
n controller.measure_moisture();
|
||||
controller.version();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user