cargo fmt

This commit is contained in:
2025-05-07 00:01:23 +02:00
parent 26da6b39cc
commit bfc3fbc6e1
7 changed files with 63 additions and 94 deletions

View File

@@ -5,8 +5,8 @@ use std::{
use anyhow::{bail, Result};
use chrono::{DateTime, Datelike, Timelike};
use chrono_tz::Tz::UTC;
use chrono_tz::Tz;
use chrono_tz::Tz::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,
@@ -196,9 +196,7 @@ fn safe_main() -> Result<()> {
}
let config: PlantControllerConfig = match board.get_config() {
Ok(valid) => {
valid
}
Ok(valid) => valid,
Err(err) => {
log(
LogMessage::ConfigModeMissingConfig,
@@ -270,14 +268,11 @@ fn safe_main() -> Result<()> {
Ok(_) => {
println!("Started ap, continuing")
}
Err(err) => println!(
"Could not start config override ap mode due to {}",
err
),
Err(err) => println!("Could not start config override ap mode due to {}", err),
}
}
let timezone = match &config.timezone {
let timezone = match &config.timezone {
Some(tz_str) => tz_str.parse::<Tz>().unwrap_or_else(|_| {
println!("Invalid timezone '{}', falling back to UTC", tz_str);
UTC
@@ -285,7 +280,6 @@ fn safe_main() -> Result<()> {
None => UTC, // Fallback to UTC if no timezone is set
};
let timezone_time = cur.with_timezone(&timezone);
println!(
"Running logic at utc {} and {} {}",
@@ -361,13 +355,9 @@ fn safe_main() -> Result<()> {
&format!("{}", value),
"",
),
TankError::BoardError(err) => log(
LogMessage::TankSensorBoardError,
0,
0,
"",
&err.to_string()
),
TankError::BoardError(err) => {
log(LogMessage::TankSensorBoardError, 0, 0, "", &err.to_string())
}
}
// disabled cannot trigger this because of wrapping if is_enabled
board.general_fault(true);
@@ -459,7 +449,7 @@ fn safe_main() -> Result<()> {
(plant_id + 1) as u32,
plant_config.pump_time_s as u32,
&dry_run.to_string(),
"",
"",
);
board.store_last_pump_time(plant_id, cur);
board.last_pump_time(plant_id);
@@ -624,7 +614,9 @@ fn wait_infinity(wait_type: WaitType, reboot_now: Arc<AtomicBool>) -> ! {
drop(lock);
vTaskDelay(delay);
if wait_type == WaitType::MqttConfig && !STAY_ALIVE.load(std::sync::atomic::Ordering::Relaxed) {
if wait_type == WaitType::MqttConfig
&& !STAY_ALIVE.load(std::sync::atomic::Ordering::Relaxed)
{
reboot_now.store(true, std::sync::atomic::Ordering::Relaxed);
}
if reboot_now.load(std::sync::atomic::Ordering::Relaxed) {