clippy fixed
This commit is contained in:
@@ -112,19 +112,14 @@ pub struct PlantControllerConfig {
|
|||||||
pub timezone: Option<String>,
|
pub timezone: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Default)]
|
||||||
pub enum SensorCombineMode {
|
pub enum SensorCombineMode {
|
||||||
Min,
|
Min,
|
||||||
Max,
|
Max,
|
||||||
|
#[default]
|
||||||
Avg,
|
Avg,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for SensorCombineMode {
|
|
||||||
fn default() -> Self {
|
|
||||||
SensorCombineMode::Avg
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct PlantConfig {
|
pub struct PlantConfig {
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
use crate::fat_error::{FatError, FatResult};
|
use crate::fat_error::{FatError, FatResult};
|
||||||
use crate::hal::Box;
|
|
||||||
use alloc::string::String;
|
use alloc::string::String;
|
||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
use embassy_embedded_hal::shared_bus::blocking::i2c::I2cDevice;
|
use embassy_embedded_hal::shared_bus::blocking::i2c::I2cDevice;
|
||||||
|
|||||||
@@ -226,7 +226,7 @@ impl Esp<'_> {
|
|||||||
ssid: ap.ssid.as_str().to_string(),
|
ssid: ap.ssid.as_str().to_string(),
|
||||||
bssid: format_bssid(&ap.bssid),
|
bssid: format_bssid(&ap.bssid),
|
||||||
rssi: ap.signal_strength as i32,
|
rssi: ap.signal_strength as i32,
|
||||||
channel: ap.channel as u8,
|
channel: ap.channel,
|
||||||
auth_method: format!("{:?}", ap.auth_method),
|
auth_method: format!("{:?}", ap.auth_method),
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|||||||
@@ -287,7 +287,7 @@ impl PlantState {
|
|||||||
/// - Tuple of errors from sensor A and B
|
/// - Tuple of errors from sensor A and B
|
||||||
/// - Sensor warning indicating if warning LED should be lit (MissingSecondSensor)
|
/// - Sensor warning indicating if warning LED should be lit (MissingSecondSensor)
|
||||||
pub fn plant_moisture_with_warning(&self, plant_conf: &PlantConfig) -> Option<f32> {
|
pub fn plant_moisture_with_warning(&self, plant_conf: &PlantConfig) -> Option<f32> {
|
||||||
let moisture = match (
|
match (
|
||||||
self.sensor_a.moisture_percent(),
|
self.sensor_a.moisture_percent(),
|
||||||
self.sensor_b.moisture_percent(),
|
self.sensor_b.moisture_percent(),
|
||||||
) {
|
) {
|
||||||
@@ -299,9 +299,7 @@ impl PlantState {
|
|||||||
(Some(moisture), _) => Some(moisture),
|
(Some(moisture), _) => Some(moisture),
|
||||||
(_, Some(moisture)) => Some(moisture),
|
(_, Some(moisture)) => Some(moisture),
|
||||||
_ => None,
|
_ => None,
|
||||||
};
|
}
|
||||||
|
|
||||||
moisture
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn needs_to_be_watered(
|
pub fn needs_to_be_watered(
|
||||||
|
|||||||
Reference in New Issue
Block a user