get most stuff working again, by upgrading to newer esp-hal version
this involved adding a lot of code from the develop branch step by step there are still some bugs, but at least i can get into the web interface and configure stuff again \o/ … measuring and pumping is working as well
This commit is contained in:
@@ -8,7 +8,7 @@ use embassy_executor::SpawnError;
|
||||
use embassy_sync::mutex::TryLockError;
|
||||
use esp_hal::i2c::master::ConfigError;
|
||||
use esp_hal::pcnt::unit::{InvalidHighLimit, InvalidLowLimit};
|
||||
use esp_wifi::wifi::WifiError;
|
||||
use esp_radio::wifi::WifiError;
|
||||
use ina219::errors::{BusVoltageReadError, ShuntVoltageReadError};
|
||||
use littlefs2_core::PathError;
|
||||
use onewire::Error;
|
||||
@@ -45,6 +45,7 @@ pub enum FatError {
|
||||
SpawnError {
|
||||
error: SpawnError,
|
||||
},
|
||||
OTAError,
|
||||
PartitionError {
|
||||
error: esp_bootloader_esp_idf::partitions::Error,
|
||||
},
|
||||
@@ -60,6 +61,9 @@ pub enum FatError {
|
||||
ExpanderError {
|
||||
error: String,
|
||||
},
|
||||
SNTPError {
|
||||
error: sntpc::Error,
|
||||
},
|
||||
}
|
||||
|
||||
pub type FatResult<T> = Result<T, FatError>;
|
||||
@@ -88,6 +92,10 @@ impl fmt::Display for FatError {
|
||||
FatError::DS323 { error } => write!(f, "DS323 {:?}", error),
|
||||
FatError::Eeprom24x { error } => write!(f, "Eeprom24x {:?}", error),
|
||||
FatError::ExpanderError { error } => write!(f, "ExpanderError {:?}", error),
|
||||
FatError::SNTPError { error } => write!(f, "SNTPError {error:?}"),
|
||||
FatError::OTAError => {
|
||||
write!(f, "OTA missing partition")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -127,6 +135,24 @@ impl<T> ContextExt<T> for Option<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T, E> ContextExt<T> for Result<T, E>
|
||||
where
|
||||
E: fmt::Debug,
|
||||
{
|
||||
fn context<C>(self, context: C) -> Result<T, FatError>
|
||||
where
|
||||
C: AsRef<str>,
|
||||
{
|
||||
match self {
|
||||
Ok(value) => Ok(value),
|
||||
Err(err) => Err(FatError::String {
|
||||
error: format!("{}: {:?}", context.as_ref(), err),
|
||||
}),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
impl From<Error<Infallible>> for FatError {
|
||||
fn from(error: Error<Infallible>) -> Self {
|
||||
FatError::OneWireError { error }
|
||||
@@ -168,6 +194,12 @@ impl From<SpawnError> for FatError {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<sntpc::Error> for FatError {
|
||||
fn from(value: sntpc::Error) -> Self {
|
||||
FatError::SNTPError { error: value }
|
||||
}
|
||||
}
|
||||
|
||||
impl From<esp_bootloader_esp_idf::partitions::Error> for FatError {
|
||||
fn from(value: esp_bootloader_esp_idf::partitions::Error) -> Self {
|
||||
FatError::PartitionError { error: value }
|
||||
@@ -279,3 +311,11 @@ impl From<InvalidHighLimit> for FatError {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<chrono::format::ParseError> for FatError {
|
||||
fn from(value: chrono::format::ParseError) -> Self {
|
||||
FatError::String {
|
||||
error: format!("Parsing error: {value:?}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user