refactor: move Solar struct to mqtt module

This commit is contained in:
2026-05-05 20:49:39 +02:00
parent c735d4f1c5
commit 5ac4edd5a0
2 changed files with 7 additions and 7 deletions

View File

@@ -84,12 +84,6 @@ enum WaitType {
MqttConfig,
}
#[derive(Serialize, Deserialize, Debug, PartialEq)]
struct Solar {
current_ma: u32,
voltage_ma: u32,
}
impl WaitType {
fn blink_pattern(&self) -> u64 {
match self {
@@ -870,7 +864,7 @@ async fn publish_mppt_state(
) -> FatResult<()> {
let current = board.board_hal.get_mptt_current().await?;
let voltage = board.board_hal.get_mptt_voltage().await?;
let solar_state = Solar {
let solar_state = mqtt::Solar {
current_ma: current.as_milliamperes() as u32,
voltage_ma: voltage.as_millivolts() as u32,
};

View File

@@ -35,6 +35,12 @@ pub struct PumpInfo {
pub min_current_ma: u16,
}
#[derive(Serialize, Debug, PartialEq)]
pub struct Solar {
pub current_ma: u32,
pub voltage_ma: u32,
}
static MQTT_CONNECTED_EVENT_RECEIVED: AtomicBool = AtomicBool::new(false);
static MQTT_ROUND_TRIP_RECEIVED: AtomicBool = AtomicBool::new(false);
pub static MQTT_STAY_ALIVE: AtomicBool = AtomicBool::new(false);