From 1e411c15486d3ddaee8652e077ffbee5dc328369 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20J=C3=B6rdens?= Date: Tue, 2 Mar 2021 17:29:20 +0100 Subject: [PATCH] lockin-external: Miniconf changes --- src/bin/lockin-external.rs | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/src/bin/lockin-external.rs b/src/bin/lockin-external.rs index 918effa..5b85489 100644 --- a/src/bin/lockin-external.rs +++ b/src/bin/lockin-external.rs @@ -6,7 +6,7 @@ use generic_array::typenum::U4; use miniconf::{ embedded_nal::{IpAddr, Ipv4Addr}, - minimq, MqttInterface, StringSet, + minimq, Miniconf, MqttInterface, }; use serde::Deserialize; @@ -17,14 +17,14 @@ use stabilizer::hardware::{ Dac0Output, Dac1Output, InputStamper, NetworkStack, AFE0, AFE1, }; -#[derive(Copy, Clone, Debug, Deserialize, StringSet)] +#[derive(Copy, Clone, Debug, Deserialize, Miniconf)] enum Conf { PowerPhase, FrequencyDiscriminator, Quadrature, } -#[derive(Copy, Clone, Debug, Deserialize, StringSet)] +#[derive(Copy, Clone, Debug, Deserialize, Miniconf)] pub struct Settings { afe: [AfeGain; 2], @@ -79,7 +79,7 @@ const APP: () = { let mqtt_interface = { let mqtt_client = { 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() }; @@ -209,19 +209,13 @@ const APP: () = { !interface.network_stack().poll(clock.current_ms()) }); - match c - .resources + if c.resources .mqtt_interface .lock(|interface| interface.update().unwrap()) { - miniconf::Action::Continue => { - if sleep { - cortex_m::asm::wfi(); - } - } - miniconf::Action::CommitSettings => { - c.spawn.settings_update().unwrap() - } + c.spawn.settings_update().unwrap() + } else if sleep { + cortex_m::asm::wfi(); } } }