adjustments
This commit is contained in:
parent
4a8fffb3cc
commit
f0f0e9f27e
@ -1,3 +1,5 @@
|
||||
use std::{fs::File, io::Write};
|
||||
|
||||
use chrono::{Datelike, Timelike, NaiveDateTime};
|
||||
|
||||
use chrono_tz::Europe::Berlin;
|
||||
@ -50,6 +52,9 @@ fn main() -> Result<()>{
|
||||
|
||||
println!("cur is {}", cur);
|
||||
|
||||
|
||||
|
||||
|
||||
//continous/interrupt?
|
||||
//check if boot button is pressed, if longer than 5s delete config and reboot into config mode
|
||||
|
||||
@ -57,12 +62,14 @@ fn main() -> Result<()>{
|
||||
let config = board.get_config();
|
||||
match config {
|
||||
Ok(conf) => {
|
||||
|
||||
|
||||
},
|
||||
Err(err) => {
|
||||
|
||||
},
|
||||
Err(err) => todo!(),
|
||||
}
|
||||
|
||||
let proceed = config.unwrap();
|
||||
// let proceed = config.unwrap();
|
||||
|
||||
//check if we have a config file
|
||||
// if not found or parsing error -> error very fast blink general fault
|
||||
@ -72,9 +79,9 @@ fn main() -> Result<()>{
|
||||
//blink general fault error_no_config_after_upgrade
|
||||
//once config is set store it and reboot
|
||||
|
||||
if proceed.tank_sensor_enabled() {
|
||||
//if proceed.tank_sensor_enabled() {
|
||||
|
||||
}
|
||||
//}
|
||||
//is tank sensor enabled in config?
|
||||
//measure tank level (without wifi due to interference)
|
||||
//TODO this should be a result// detect invalid measurement value
|
||||
|
@ -1,12 +1,14 @@
|
||||
mod config;
|
||||
//mod config;
|
||||
|
||||
use embedded_svc::wifi::{Configuration, ClientConfiguration, AuthMethod};
|
||||
use esp_idf_svc::eventloop::EspSystemEventLoop;
|
||||
use esp_idf_svc::nvs::EspDefaultNvsPartition;
|
||||
use esp_idf_svc::wifi::EspWifi;
|
||||
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use std::sync::Mutex;
|
||||
use anyhow::{Context, Result, bail};
|
||||
use anyhow::{Context, Result, bail, Ok};
|
||||
use anyhow::anyhow;
|
||||
|
||||
use chrono::{Utc, NaiveDateTime, DateTime};
|
||||
@ -26,6 +28,8 @@ use shift_register_driver::sipo::ShiftRegister40;
|
||||
use esp_idf_hal::gpio::{PinDriver, Gpio39, Gpio4, AnyInputPin};
|
||||
use esp_idf_hal::prelude::Peripherals;
|
||||
|
||||
use crate::config;
|
||||
|
||||
pub const PLANT_COUNT:usize = 8;
|
||||
const PINS_PER_PLANT:usize = 5;
|
||||
const PLANT_PUMP_OFFSET:usize = 0;
|
||||
@ -97,7 +101,7 @@ pub trait PlantCtrlBoardInteraction{
|
||||
//keep state during deepsleep
|
||||
fn fault(&self,plant:usize, enable:bool);
|
||||
|
||||
fn get_config(&mut self) -> Result<Config>;
|
||||
fn get_config(&mut self) -> Result<config::Config>;
|
||||
}
|
||||
|
||||
pub trait CreatePlantHal<'a> {
|
||||
@ -442,7 +446,10 @@ impl PlantCtrlBoardInteraction for PlantCtrlBoard<'_> {
|
||||
}
|
||||
|
||||
fn get_config(&mut self) -> Result<config::Config> {
|
||||
todo!()
|
||||
let config_file = File::open("config.cfg")?;
|
||||
//serde_json::from_str(&data);
|
||||
bail!("Not implemented");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user