Skip to content

Commit

Permalink
simplyprint: unknown temperature fix
Browse files Browse the repository at this point in the history
Omit temperature data for SBCs that Moonraker
cannot report.

Signed-off-by:  Eric Callahan <[email protected]>
  • Loading branch information
Arksine committed Nov 15, 2023
1 parent 5a3ed83 commit 1df4213
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion moonraker/components/simplyprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -813,10 +813,12 @@ def _on_proc_update(self, proc_stats: Dict[str, Any]) -> None:
mem_pct = sys_mem["used"] / sys_mem["total"] * 100
cpu_data = {
"usage": int(cpu["cpu"] + .5),
"temp": int(proc_stats["cpu_temp"] + .5),
"memory": int(mem_pct + .5),
"flags": self.cache.throttled_state.get("bits", 0)
}
temp: Optional[float] = proc_stats["cpu_temp"]
if temp is not None:
cpu_data["temp"] = int(temp + .5)
diff = self._get_object_diff(cpu_data, self.cache.cpu_info)
if diff:
self.cache.cpu_info.update(cpu_data)
Expand Down

0 comments on commit 1df4213

Please sign in to comment.