lockin-external: Miniconf changes

This commit is contained in:
Robert Jördens 2021-03-02 17:29:20 +01:00
parent ca66894d51
commit 1e411c1548
1 changed files with 8 additions and 14 deletions

View File

@ -6,7 +6,7 @@ use generic_array::typenum::U4;
use miniconf::{ use miniconf::{
embedded_nal::{IpAddr, Ipv4Addr}, embedded_nal::{IpAddr, Ipv4Addr},
minimq, MqttInterface, StringSet, minimq, Miniconf, MqttInterface,
}; };
use serde::Deserialize; use serde::Deserialize;
@ -17,14 +17,14 @@ use stabilizer::hardware::{
Dac0Output, Dac1Output, InputStamper, NetworkStack, AFE0, AFE1, Dac0Output, Dac1Output, InputStamper, NetworkStack, AFE0, AFE1,
}; };
#[derive(Copy, Clone, Debug, Deserialize, StringSet)] #[derive(Copy, Clone, Debug, Deserialize, Miniconf)]
enum Conf { enum Conf {
PowerPhase, PowerPhase,
FrequencyDiscriminator, FrequencyDiscriminator,
Quadrature, Quadrature,
} }
#[derive(Copy, Clone, Debug, Deserialize, StringSet)] #[derive(Copy, Clone, Debug, Deserialize, Miniconf)]
pub struct Settings { pub struct Settings {
afe: [AfeGain; 2], afe: [AfeGain; 2],
@ -79,7 +79,7 @@ const APP: () = {
let mqtt_interface = { let mqtt_interface = {
let mqtt_client = { let mqtt_client = {
let broker = IpAddr::V4(Ipv4Addr::new(10, 34, 16, 10)); let broker = IpAddr::V4(Ipv4Addr::new(10, 34, 16, 10));
minimq::MqttClient::new(broker, "lockin", stabilizer.net.stack) minimq::MqttClient::new(broker, "", stabilizer.net.stack)
.unwrap() .unwrap()
}; };
@ -209,19 +209,13 @@ const APP: () = {
!interface.network_stack().poll(clock.current_ms()) !interface.network_stack().poll(clock.current_ms())
}); });
match c if c.resources
.resources
.mqtt_interface .mqtt_interface
.lock(|interface| interface.update().unwrap()) .lock(|interface| interface.update().unwrap())
{ {
miniconf::Action::Continue => { c.spawn.settings_update().unwrap()
if sleep { } else if sleep {
cortex_m::asm::wfi(); cortex_m::asm::wfi();
}
}
miniconf::Action::CommitSettings => {
c.spawn.settings_update().unwrap()
}
} }
} }
} }