Closed ryan-summers closed 4 months ago
That has a different behavior than the previous code. The loop count should be increased or better be infinitely draining as before with the watchdog inside the loop.
It's a different behavior, but intentionally different. With the code as-is, running python -m miniconf -b 10.35.20.1 -d dt/sinara/booster/+ ?
successfully lists all topics and their values while stabilizer is streaming multicast UDP traffic.
I attempted the following diff:
diff --git a/src/main.rs b/src/main.rs
index cfbc4b1..65f8d00 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -266,11 +266,6 @@ mod app {
#[idle(shared=[main_bus, net_devices, watchdog, settings, usb_terminal])]
fn idle(mut c: idle::Context) -> ! {
loop {
- // Check in with the watchdog.
- c.shared
- .watchdog
- .lock(|watchdog| watchdog.check_in(WatchdogClient::Idle));
-
// Handle the Miniconf settings interface.
match (&mut c.shared.net_devices, &mut c.shared.settings)
.lock(|net, settings| net.settings_client.update(&mut settings.booster))
@@ -318,7 +313,11 @@ mod app {
.unwrap();
// Handle the network stack processing if needed.
- c.shared.net_devices.lock(|net| net.process());
+ while c.shared.net_devices.lock(|net| net.process()) {
+ c.shared
+ .watchdog
+ .lock(|watchdog| watchdog.check_in(WatchdogClient::Idle));
+ }
}
}
}
However, attempting a list with this code results in a hanging miniconf command.
This makes sense, as the single poll behavior ensures that we periodically process the MQTT TCP socket. With the while interface.poll() {}
, the poll loop becomes infinite and we never process the TCP socket.
Ack!
That has a different behavior than the previous code. The loop count should be increased or better be infinitely draining as before with the watchdog inside the loop.