Merge branch 'develop' into housekeeping and clippy and spellcheck

This commit is contained in:
2025-06-20 23:59:14 +02:00
parent e7b6bda747
commit d059b7b1db
9 changed files with 135 additions and 141 deletions

View File

@@ -8,7 +8,7 @@ use crate::{
config::{BatteryBoardVersion, BoardVersion, PlantControllerConfig},
hal::{
battery::{print_battery_bq34z100, BatteryInteraction, NoBatteryMonitor},
esp::ESP,
esp::Esp,
},
log::{log, LogMessage},
};
@@ -37,12 +37,12 @@ use esp_idf_sys::{
esp_sleep_ext1_wakeup_mode_t_ESP_EXT1_WAKEUP_ANY_LOW,
};
use esp_ota::mark_app_valid;
use measurements::{Current, Voltage};
use once_cell::sync::Lazy;
use serde::{Deserialize, Serialize};
use std::result::Result::Ok as OkStd;
use std::sync::Mutex;
use std::time::Duration;
use measurements::{Current, Voltage};
//Only support for 8 right now!
pub const PLANT_COUNT: usize = 8;
@@ -84,25 +84,15 @@ pub struct HAL<'a> {
pub board_hal: Box<dyn BoardInteraction<'a> + Send>,
}
#[derive(Serialize, Deserialize, PartialEq, Debug)]
#[derive(Serialize, Deserialize, PartialEq, Debug, Default)]
pub struct BackupHeader {
pub timestamp: i64,
crc16: u16,
pub size: usize,
}
impl Default for BackupHeader {
fn default() -> Self {
Self {
timestamp: Default::default(),
crc16: Default::default(),
size: Default::default(),
}
}
}
pub trait BoardInteraction<'a> {
fn get_esp(&mut self) -> &mut ESP<'a>;
fn get_esp(&mut self) -> &mut Esp<'a>;
fn get_config(&mut self) -> &PlantControllerConfig;
fn get_battery_monitor(&mut self) -> &mut Box<dyn BatteryInteraction + Send>;
fn set_charge_indicator(&mut self, charging: bool) -> Result<()>;
@@ -225,7 +215,7 @@ impl PlantHal {
gpio30: peripherals.pins.gpio30,
};
let mut esp = ESP {
let mut esp = Esp {
mqtt_client: None,
wifi_driver,
boot_button,