main: prettify the sensor status line
This commit is contained in:
@@ -351,8 +351,6 @@ async fn print_sensor_readings(mut events: DynSubscriber<'static, Measurement>)
|
|||||||
|
|
||||||
#[embassy_executor::task]
|
#[embassy_executor::task]
|
||||||
async fn print_sensor_status(mut events: DynSubscriber<'static, Prediction>) {
|
async fn print_sensor_status(mut events: DynSubscriber<'static, Prediction>) {
|
||||||
|
|
||||||
info!("telemetry ready");
|
|
||||||
let mut sensor_states: EnumMap<SensorSource, SensorState> = EnumMap::default();
|
let mut sensor_states: EnumMap<SensorSource, SensorState> = EnumMap::default();
|
||||||
loop {
|
loop {
|
||||||
let next = events.next_message_pure().with_timeout(Duration::from_secs(5)).await;
|
let next = events.next_message_pure().with_timeout(Duration::from_secs(5)).await;
|
||||||
@@ -362,10 +360,10 @@ async fn print_sensor_status(mut events: DynSubscriber<'static, Prediction>) {
|
|||||||
let mut report_str = String::new();
|
let mut report_str = String::new();
|
||||||
for (sensor, state) in &sensor_states {
|
for (sensor, state) in &sensor_states {
|
||||||
let state_icon = match state {
|
let state_icon = match state {
|
||||||
SensorState::AcquiringFix => "?",
|
SensorState::AcquiringFix => "⏱",
|
||||||
SensorState::Degraded => "-",
|
SensorState::Degraded => "!",
|
||||||
SensorState::Offline => "X",
|
SensorState::Offline => "✗",
|
||||||
SensorState::Online => "O"
|
SensorState::Online => "✔"
|
||||||
};
|
};
|
||||||
report_str += alloc::format!("{sensor:?}={state_icon} ").as_str();
|
report_str += alloc::format!("{sensor:?}={state_icon} ").as_str();
|
||||||
}
|
}
|
||||||
@@ -375,10 +373,10 @@ async fn print_sensor_status(mut events: DynSubscriber<'static, Prediction>) {
|
|||||||
let mut report_str = String::new();
|
let mut report_str = String::new();
|
||||||
for (sensor, state) in &sensor_states {
|
for (sensor, state) in &sensor_states {
|
||||||
let state_icon = match state {
|
let state_icon = match state {
|
||||||
SensorState::AcquiringFix => "?",
|
SensorState::AcquiringFix => "⏱",
|
||||||
SensorState::Degraded => "-",
|
SensorState::Degraded => "!",
|
||||||
SensorState::Offline => "X",
|
SensorState::Offline => "✗",
|
||||||
SensorState::Online => "O"
|
SensorState::Online => "✔"
|
||||||
};
|
};
|
||||||
report_str += alloc::format!("{sensor:?}={state_icon} ").as_str();
|
report_str += alloc::format!("{sensor:?}={state_icon} ").as_str();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user