Skip to content

Commit f9e685c

Browse files
authored
set 0 when there's an error (#124)
1 parent bb55940 commit f9e685c

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/bin/machine-api/cmd_serve.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,26 @@ async fn spawn_metrics_moonraker(registry: &mut Registry, key: &str, machine: &m
6666
loop {
6767
let Ok(readings) = machine.get_client().temperatures().await else {
6868
tracing::warn!("failed to collect temperatures from {}", key);
69+
70+
/* This mega-sucks. I really really *REALLY* hate this. I
71+
* can't possibly explain just how much this pisses me off.
72+
*
73+
* We can't dynamically remove the key from the prob export(s)
74+
* (which would be my preference here tbh, missing values is
75+
* handled fine), and keeping the last value is a lie (yes
76+
* its absolutely still pumping out 500c, doesn't matter the
77+
* box is offline) -- but 0 is a REALLY bad value since it's
78+
* a valid number we can (and should!) return, so translating 0
79+
* into NULL isn't going to work either.
80+
*
81+
* I have no idea what the real fix is, but this ain't it. This
82+
* just stops graphs from lying when the box goes offline. */
83+
84+
extruder_temperature.set(0.0);
85+
extruder_temperature_target.set(0.0);
86+
bed_temperature.set(0.0);
87+
bed_temperature_target.set(0.0);
88+
6989
continue;
7090
};
7191
tracing::trace!("metrics collected from {}", key);

0 commit comments

Comments
 (0)