startup and ota state detection working, now wifi_ap next
This commit is contained in:
@@ -1,23 +1,20 @@
|
||||
use alloc::string::String;
|
||||
use crate::hal::Box;
|
||||
use anyhow::anyhow;
|
||||
use alloc::string::String;
|
||||
use async_trait::async_trait;
|
||||
use bq34z100::{Bq34Z100Error, Bq34z100g1Driver};
|
||||
use measurements::Temperature;
|
||||
use serde::Serialize;
|
||||
|
||||
#[async_trait]
|
||||
pub trait BatteryInteraction {
|
||||
async fn state_charge_percent(& mut self) -> Result<f32, BatteryError>;
|
||||
async fn remaining_milli_ampere_hour(& mut self) -> Result<u16, BatteryError>;
|
||||
async fn max_milli_ampere_hour(& mut self) -> Result<u16, BatteryError>;
|
||||
async fn design_milli_ampere_hour(& mut self) -> Result<u16, BatteryError>;
|
||||
async fn voltage_milli_volt(& mut self) -> Result<u16, BatteryError>;
|
||||
async fn average_current_milli_ampere(& mut self) -> Result<i16, BatteryError>;
|
||||
async fn cycle_count(& mut self) -> Result<u16, BatteryError>;
|
||||
async fn state_health_percent(& mut self) -> Result<u16, BatteryError>;
|
||||
async fn bat_temperature(& mut self) -> Result<u16, BatteryError>;
|
||||
async fn get_battery_state(& mut self) -> Result<BatteryState, BatteryError>;
|
||||
async fn state_charge_percent(&mut self) -> Result<f32, BatteryError>;
|
||||
async fn remaining_milli_ampere_hour(&mut self) -> Result<u16, BatteryError>;
|
||||
async fn max_milli_ampere_hour(&mut self) -> Result<u16, BatteryError>;
|
||||
async fn design_milli_ampere_hour(&mut self) -> Result<u16, BatteryError>;
|
||||
async fn voltage_milli_volt(&mut self) -> Result<u16, BatteryError>;
|
||||
async fn average_current_milli_ampere(&mut self) -> Result<i16, BatteryError>;
|
||||
async fn cycle_count(&mut self) -> Result<u16, BatteryError>;
|
||||
async fn state_health_percent(&mut self) -> Result<u16, BatteryError>;
|
||||
async fn bat_temperature(&mut self) -> Result<u16, BatteryError>;
|
||||
async fn get_battery_state(&mut self) -> Result<BatteryState, BatteryError>;
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
@@ -56,31 +53,31 @@ pub enum BatteryState {
|
||||
pub struct NoBatteryMonitor {}
|
||||
#[async_trait]
|
||||
impl BatteryInteraction for NoBatteryMonitor {
|
||||
async fn state_charge_percent(& mut self) -> Result<f32, BatteryError> {
|
||||
async fn state_charge_percent(&mut self) -> Result<f32, BatteryError> {
|
||||
Err(BatteryError::NoBatteryMonitor)
|
||||
}
|
||||
|
||||
async fn remaining_milli_ampere_hour(& mut self) -> Result<u16, BatteryError> {
|
||||
async fn remaining_milli_ampere_hour(&mut self) -> Result<u16, BatteryError> {
|
||||
Err(BatteryError::NoBatteryMonitor)
|
||||
}
|
||||
|
||||
async fn max_milli_ampere_hour(& mut self) -> Result<u16, BatteryError> {
|
||||
async fn max_milli_ampere_hour(&mut self) -> Result<u16, BatteryError> {
|
||||
Err(BatteryError::NoBatteryMonitor)
|
||||
}
|
||||
|
||||
async fn design_milli_ampere_hour(& mut self) -> Result<u16, BatteryError> {
|
||||
async fn design_milli_ampere_hour(&mut self) -> Result<u16, BatteryError> {
|
||||
Err(BatteryError::NoBatteryMonitor)
|
||||
}
|
||||
|
||||
async fn voltage_milli_volt(& mut self) -> Result<u16, BatteryError> {
|
||||
async fn voltage_milli_volt(&mut self) -> Result<u16, BatteryError> {
|
||||
Err(BatteryError::NoBatteryMonitor)
|
||||
}
|
||||
|
||||
async fn average_current_milli_ampere(& mut self) -> Result<i16, BatteryError> {
|
||||
async fn average_current_milli_ampere(&mut self) -> Result<i16, BatteryError> {
|
||||
Err(BatteryError::NoBatteryMonitor)
|
||||
}
|
||||
|
||||
async fn cycle_count(& mut self) -> Result<u16, BatteryError> {
|
||||
async fn cycle_count(&mut self) -> Result<u16, BatteryError> {
|
||||
Err(BatteryError::NoBatteryMonitor)
|
||||
}
|
||||
|
||||
@@ -92,7 +89,7 @@ impl BatteryInteraction for NoBatteryMonitor {
|
||||
Err(BatteryError::NoBatteryMonitor)
|
||||
}
|
||||
|
||||
async fn get_battery_state(& mut self) -> Result<BatteryState, BatteryError> {
|
||||
async fn get_battery_state(&mut self) -> Result<BatteryState, BatteryError> {
|
||||
Ok(BatteryState::Unknown)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user