From 32a40497bf549e5a09491dfc610e215d5eb98eb0 Mon Sep 17 00:00:00 2001 From: Luca Date: Tue, 23 Jan 2024 00:29:01 +0100 Subject: [PATCH] Fix temperature display --- src/main.rs | 4 ++-- src/max6675.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index d6e5c6f..733cbdc 100644 --- a/src/main.rs +++ b/src/main.rs @@ -307,12 +307,12 @@ fn main() -> ! { state = State::Off; } - let mut text: String<9> = String::new(); + let mut text: String<12> = String::new(); let text_str; match thermocouple_result { Ok(temperature) => { - if let Err(_) = write!(&mut text, "{}", temperature) { + if let Err(_) = write!(&mut text, "{} °C", temperature) { text_str = "format error"; } else { text_str = text.as_str(); diff --git a/src/max6675.rs b/src/max6675.rs index 6094d66..e9a7fc0 100644 --- a/src/max6675.rs +++ b/src/max6675.rs @@ -65,7 +65,7 @@ where if d & 0x4 == 0x4 { Err(Error::OpenThermocouple) } else { - Ok(FixedU16::from_num(d >> 3)) + Ok(FixedU16::from_bits(d >> 3)) } } }