Merge branch 'feature/v4_modular' into develop
# Conflicts: # rust/src/config.rs # rust/src/main.rs # rust/src/tank.rs
This commit is contained in:
@@ -31,6 +31,15 @@ use crate::plant_hal::{BatteryInteraction, BoardHal, BoardInteraction, HAL};
|
||||
use plant_state::PlantState;
|
||||
use tank::*;
|
||||
|
||||
const MOIST_SENSOR_MAX_FREQUENCY: u32 = 6500; // 60kHz (500Hz margin)
|
||||
const MOIST_SENSOR_MIN_FREQUENCY: u32 = 150; // this is really really dry, think like cactus levels
|
||||
|
||||
const FROM: (f32, f32) = (
|
||||
MOIST_SENSOR_MIN_FREQUENCY as f32,
|
||||
MOIST_SENSOR_MAX_FREQUENCY as f32,
|
||||
);
|
||||
const TO: (f32, f32) = (0_f32, 100_f32);
|
||||
|
||||
pub static BOARD_ACCESS: Lazy<Mutex<HAL>> = Lazy::new(|| PlantHal::create().unwrap());
|
||||
pub static STAY_ALIVE: Lazy<AtomicBool> = Lazy::new(|| AtomicBool::new(false));
|
||||
|
||||
@@ -386,6 +395,7 @@ fn safe_main() -> anyhow::Result<()> {
|
||||
board.any_pump(false)?; // disable main power output, eg for a central pump with valve setup or a main water valve for the risk affine
|
||||
}
|
||||
}
|
||||
update_plant_state(&mut plantstate, &mut board, &config, &timezone_time.timezone());
|
||||
|
||||
let is_day = board.is_day();
|
||||
let state_of_charge = board.battery_monitor.state_charge_percent().unwrap_or(0);
|
||||
@@ -454,6 +464,10 @@ fn safe_main() -> anyhow::Result<()> {
|
||||
};
|
||||
let _ = board.mqtt_publish( "/state", "sleep".as_bytes());
|
||||
|
||||
//determine next event
|
||||
//is light out of work trigger soon?
|
||||
//is battery low ??
|
||||
//is deep sleep
|
||||
mark_app_valid();
|
||||
|
||||
let stay_alive_mqtt = STAY_ALIVE.load(std::sync::atomic::Ordering::Relaxed);
|
||||
@@ -734,4 +748,4 @@ struct VersionInfo {
|
||||
git_hash: String,
|
||||
build_time: String,
|
||||
partition: String,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user