fix all compiler warnings

This commit is contained in:
2025-06-20 20:36:29 +02:00
parent c1d0ce542c
commit 7115809f2b
9 changed files with 84 additions and 88 deletions

View File

@@ -1,8 +1,11 @@
use crate::webserver::webserver::httpd;
use crate::{
config::BoardVersion::INITIAL,
hal::{PlantHal, HAL, PLANT_COUNT},
webserver::webserver::httpd,
};
use anyhow::bail;
use chrono::{DateTime, Datelike, Timelike, Utc};
use chrono_tz::Tz;
use chrono_tz::Tz::UTC;
use chrono_tz::Tz::{self, UTC};
use esp_idf_hal::delay::Delay;
use esp_idf_sys::{
esp_ota_get_app_partition_count, esp_ota_get_running_partition, esp_ota_get_state_partition,
@@ -15,23 +18,21 @@ use esp_ota::{mark_app_valid, rollback_and_reboot};
use hal::battery::BatteryState;
use log::{log, LogMessage};
use once_cell::sync::Lazy;
use plant_state::PlantState;
use serde::{Deserialize, Serialize};
use std::sync::MutexGuard;
use std::{
fmt::Display,
sync::{atomic::AtomicBool, Arc, Mutex},
};
use tank::*;
mod config;
mod hal;
mod log;
mod plant_state;
mod tank;
use crate::config::BoardVersion::INITIAL;
use crate::hal::battery::BatteryInteraction;
use crate::hal::{BoardInteraction, PlantHal, HAL, PLANT_COUNT};
use plant_state::PlantState;
use tank::*;
pub static BOARD_ACCESS: Lazy<Mutex<HAL>> = Lazy::new(|| PlantHal::create().unwrap());
pub static STAY_ALIVE: Lazy<AtomicBool> = Lazy::new(|| AtomicBool::new(false));
@@ -424,7 +425,7 @@ fn safe_main() -> anyhow::Result<()> {
.state_charge_percent()
.unwrap_or(0.);
/// try to load full battery state if failed the battery state is unknown
// try to load full battery state if failed the battery state is unknown
let battery_state = board
.board_hal
.get_battery_monitor()
@@ -739,7 +740,8 @@ fn pump_info(
fn publish_battery_state(board: &mut MutexGuard<'_, HAL<'_>>) {
let state = board.board_hal.get_battery_monitor().get_battery_state();
if let Ok(serialized_battery_state_bytes) = serde_json::to_string(&state).map(|s| s.into_bytes())
if let Ok(serialized_battery_state_bytes) =
serde_json::to_string(&state).map(|s| s.into_bytes())
{
let _ = board
.board_hal