probalby found most of the import related stuff, now the real refactor begins
This commit is contained in:
@@ -11,7 +11,9 @@ use crate::{
|
||||
hal::{PlantHal, HAL, PLANT_COUNT},
|
||||
//webserver::httpd,
|
||||
};
|
||||
use core::sync::atomic::Ordering;
|
||||
use alloc::borrow::ToOwned;
|
||||
use alloc::sync::Arc;
|
||||
use alloc::fmt::format;
|
||||
use alloc::string::{String, ToString};
|
||||
use anyhow::{bail, Context};
|
||||
@@ -19,10 +21,12 @@ use chrono::{DateTime, Datelike, Timelike, Utc};
|
||||
use chrono_tz::Tz::{self, UTC};
|
||||
use embassy_executor::Spawner;
|
||||
use hal::battery::BatteryState;
|
||||
use esp_hal::{timer::systimer::SystemTimer, clock::CpuClock, delay::Delay};
|
||||
use esp_println::logger;
|
||||
use log::{log, LogMessage};
|
||||
use plant_state::PlantState;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use embassy_sync::{Mutex, LazyLock};
|
||||
use embassy_sync::{Mutex, LazyLock, mutex::MutexGuard};
|
||||
use portable_atomic::AtomicBool;
|
||||
use tank::*;
|
||||
mod config;
|
||||
@@ -549,7 +553,7 @@ fn safe_main() -> anyhow::Result<()> {
|
||||
//TODO
|
||||
//mark_app_valid();
|
||||
|
||||
let stay_alive_mqtt = STAY_ALIVE.load(std::sync::atomic::Ordering::Relaxed);
|
||||
let stay_alive_mqtt = STAY_ALIVE.load(Ordering::Relaxed);
|
||||
|
||||
let stay_alive = stay_alive_mqtt;
|
||||
log::info!("Check stay alive, current state is {}", stay_alive);
|
||||
@@ -961,11 +965,11 @@ fn wait_infinity(wait_type: WaitType, reboot_now: Arc<AtomicBool>) -> ! {
|
||||
delay_handle.delay_ms(delay);
|
||||
|
||||
if wait_type == WaitType::MqttConfig
|
||||
&& !STAY_ALIVE.load(std::sync::atomic::Ordering::Relaxed)
|
||||
&& !STAY_ALIVE.load(Ordering::Relaxed)
|
||||
{
|
||||
reboot_now.store(true, std::sync::atomic::Ordering::Relaxed);
|
||||
reboot_now.store(true, Ordering::Relaxed);
|
||||
}
|
||||
if reboot_now.load(std::sync::atomic::Ordering::Relaxed) {
|
||||
if reboot_now.load(Ordering::Relaxed) {
|
||||
//ensure clean http answer
|
||||
Delay::new_default().delay_ms(500);
|
||||
BOARD_ACCESS.lock().unwrap().board_hal.deep_sleep(1);
|
||||
|
||||
Reference in New Issue
Block a user