refactor: move Solar struct to mqtt module
This commit is contained in:
@@ -84,12 +84,6 @@ enum WaitType {
|
|||||||
MqttConfig,
|
MqttConfig,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
|
||||||
struct Solar {
|
|
||||||
current_ma: u32,
|
|
||||||
voltage_ma: u32,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl WaitType {
|
impl WaitType {
|
||||||
fn blink_pattern(&self) -> u64 {
|
fn blink_pattern(&self) -> u64 {
|
||||||
match self {
|
match self {
|
||||||
@@ -870,7 +864,7 @@ async fn publish_mppt_state(
|
|||||||
) -> FatResult<()> {
|
) -> FatResult<()> {
|
||||||
let current = board.board_hal.get_mptt_current().await?;
|
let current = board.board_hal.get_mptt_current().await?;
|
||||||
let voltage = board.board_hal.get_mptt_voltage().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,
|
current_ma: current.as_milliamperes() as u32,
|
||||||
voltage_ma: voltage.as_millivolts() as u32,
|
voltage_ma: voltage.as_millivolts() as u32,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -35,6 +35,12 @@ pub struct PumpInfo {
|
|||||||
pub min_current_ma: u16,
|
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_CONNECTED_EVENT_RECEIVED: AtomicBool = AtomicBool::new(false);
|
||||||
static MQTT_ROUND_TRIP_RECEIVED: AtomicBool = AtomicBool::new(false);
|
static MQTT_ROUND_TRIP_RECEIVED: AtomicBool = AtomicBool::new(false);
|
||||||
pub static MQTT_STAY_ALIVE: AtomicBool = AtomicBool::new(false);
|
pub static MQTT_STAY_ALIVE: AtomicBool = AtomicBool::new(false);
|
||||||
|
|||||||
Reference in New Issue
Block a user