clippy: fix clippy warnings
This commit is contained in:
@@ -15,23 +15,23 @@ esp_bootloader_esp_idf::esp_app_desc!();
|
||||
use esp_backtrace as _;
|
||||
|
||||
use crate::hal::PROGRESS_ACTIVE;
|
||||
use crate::config::{NetworkConfig, PlantConfig, PlantControllerConfig};
|
||||
use crate::config::{PlantConfig, PlantControllerConfig};
|
||||
use crate::fat_error::{ContextExt, FatResult};
|
||||
|
||||
use crate::log::log;
|
||||
use crate::tank::{determine_tank_state, TankError, TankState, WATER_FROZEN_THRESH};
|
||||
use crate::tank::{determine_tank_state, TankError, WATER_FROZEN_THRESH};
|
||||
use crate::webserver::http_server;
|
||||
use crate::{
|
||||
config::BoardVersion::Initial,
|
||||
hal::{PlantHal, HAL, PLANT_COUNT},
|
||||
};
|
||||
use ::log::{error, info, warn};
|
||||
use ::log::{error, info};
|
||||
use alloc::borrow::ToOwned;
|
||||
use alloc::string::{String, ToString};
|
||||
use alloc::sync::Arc;
|
||||
use alloc::vec::Vec;
|
||||
use alloc::{format, vec};
|
||||
use chrono::{DateTime, Datelike, Timelike, Utc};
|
||||
use chrono::{DateTime, Datelike, Timelike};
|
||||
use chrono_tz::Tz::{self, UTC};
|
||||
use core::sync::atomic::{AtomicBool, Ordering};
|
||||
use embassy_executor::Spawner;
|
||||
@@ -42,8 +42,8 @@ use embassy_sync::once_lock::OnceLock;
|
||||
use embassy_time::{Duration, Instant, Timer};
|
||||
use esp_hal::rom::ets_delay_us;
|
||||
use esp_hal::system::software_reset;
|
||||
use esp_println::{logger, println};
|
||||
use hal::battery::{BatteryError, BatteryInfo, BatteryState};
|
||||
use esp_println::{println};
|
||||
use hal::battery::{BatteryState};
|
||||
use log::LogMessage;
|
||||
use option_lock::OptionLock;
|
||||
use plant_state::PlantState;
|
||||
@@ -275,7 +275,7 @@ async fn safe_main(spawner: Spawner) -> FatResult<()> {
|
||||
);
|
||||
|
||||
if let network::NetworkMode::WIFI { ref ip_address, .. } = network_mode {
|
||||
mqtt::publish_firmware_info(&mut board, version, ip_address, &timezone_time.to_rfc3339()).await;
|
||||
mqtt::publish_firmware_info(version, ip_address, &timezone_time.to_rfc3339()).await;
|
||||
mqtt::publish_battery_state(&mut board).await.unwrap_or_else(|e| {
|
||||
error!("Error publishing battery state {e}");
|
||||
});
|
||||
@@ -354,10 +354,7 @@ async fn safe_main(spawner: Spawner) -> FatResult<()> {
|
||||
}
|
||||
|
||||
let mut water_frozen = false;
|
||||
let water_temp: FatResult<f32> = match board.board_hal.get_tank_sensor() {
|
||||
Ok(sensor) => sensor.water_temperature_c().await,
|
||||
Err(e) => Err(e),
|
||||
};
|
||||
let water_temp: FatResult<f32> = board.board_hal.get_tank_sensor().water_temperature_c().await;
|
||||
|
||||
if let Ok(res) = water_temp {
|
||||
if res < WATER_FROZEN_THRESH {
|
||||
@@ -437,7 +434,6 @@ async fn safe_main(spawner: Spawner) -> FatResult<()> {
|
||||
//state.active = true;
|
||||
|
||||
mqtt::pump_info(
|
||||
&mut board,
|
||||
plant_id,
|
||||
true,
|
||||
pump_ineffective,
|
||||
@@ -455,7 +451,6 @@ async fn safe_main(spawner: Spawner) -> FatResult<()> {
|
||||
Ok(state) => {
|
||||
overcurrent_results[plant_id] = state.overcurrent_ma;
|
||||
mqtt::pump_info(
|
||||
&mut board,
|
||||
plant_id,
|
||||
false,
|
||||
pump_ineffective,
|
||||
@@ -470,7 +465,6 @@ async fn safe_main(spawner: Spawner) -> FatResult<()> {
|
||||
}
|
||||
Err(err) => {
|
||||
mqtt::pump_info(
|
||||
&mut board,
|
||||
plant_id,
|
||||
false,
|
||||
pump_ineffective,
|
||||
@@ -743,13 +737,13 @@ pub async fn do_secure_pump(
|
||||
}
|
||||
}
|
||||
|
||||
board.board_hal.get_tank_sensor()?.reset_flow_meter();
|
||||
board.board_hal.get_tank_sensor()?.start_flow_meter();
|
||||
board.board_hal.get_tank_sensor().reset_flow_meter();
|
||||
board.board_hal.get_tank_sensor().start_flow_meter();
|
||||
board.board_hal.pump(plant_id, true).await?;
|
||||
|
||||
for step in 0..steps_in_50ms {
|
||||
let step_start = Instant::now();
|
||||
let flow_value = board.board_hal.get_tank_sensor()?.get_full_flow_count();
|
||||
let flow_value = board.board_hal.get_tank_sensor().get_full_flow_count();
|
||||
flow_collector[step] = flow_value;
|
||||
let flow_value_ml = flow_value as f32 * board.board_hal.get_config().tank.ml_per_pulse;
|
||||
|
||||
@@ -860,8 +854,8 @@ pub async fn do_secure_pump(
|
||||
//noticable dummy value
|
||||
pump_time_ms = 1337;
|
||||
}
|
||||
board.board_hal.get_tank_sensor()?.stop_flow_meter();
|
||||
let final_flow_value = board.board_hal.get_tank_sensor()?.get_full_flow_count();
|
||||
board.board_hal.get_tank_sensor().stop_flow_meter();
|
||||
let final_flow_value = board.board_hal.get_tank_sensor().get_full_flow_count();
|
||||
let flow_value_ml = final_flow_value as f32 * board.board_hal.get_config().tank.ml_per_pulse;
|
||||
info!("Final flow value is {final_flow_value} with {flow_value_ml} ml");
|
||||
current_collector.sort();
|
||||
|
||||
Reference in New Issue
Block a user