wifi config file handling added

This commit is contained in:
2023-12-12 03:46:53 +01:00
parent e43538ec8a
commit 5d6871250e
4 changed files with 316 additions and 176 deletions

View File

@@ -1,10 +1,12 @@
use std::fmt;
use serde::{Serialize, Deserialize};
use crate::PLANT_COUNT;
pub struct Config {
ssid: heapless::String<32>,
password: Option<heapless::String<64>>,
#[derive(Serialize, Deserialize)]
pub struct Config {
tank_sensor_enabled: bool,
tank_full_ml: u32,
tank_warn_percent: u8,
@@ -19,6 +21,16 @@ pub struct Config {
night_lamp_hour_start: u8,
night_lamp_hour_end: u8,
night_lamp_only_when_dark: u8
}
#[derive(Serialize, Deserialize)]
#[derive(Debug)]
pub struct WifiConfig {
pub ssid: heapless::String<32>,
pub password: Option<heapless::String<64>>,
}
impl fmt::Display for WifiConfig {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "({}, ****)", self.ssid)
}
}