From 719c2bbbb89c0121bbd2b62f9aeb98327e583d2b Mon Sep 17 00:00:00 2001 From: Michael Turner Date: Sun, 2 Nov 2025 14:10:02 -0800 Subject: Correct the temperature reading to preserve the sign bits --- examples/stm32g0/src/bin/onewire_ds18b20.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/stm32g0') diff --git a/examples/stm32g0/src/bin/onewire_ds18b20.rs b/examples/stm32g0/src/bin/onewire_ds18b20.rs index 62f8711a6..43ecca8c4 100644 --- a/examples/stm32g0/src/bin/onewire_ds18b20.rs +++ b/examples/stm32g0/src/bin/onewire_ds18b20.rs @@ -267,7 +267,7 @@ where } match Self::crc8(&data) == 0 { - true => Ok(((data[1] as u16) << 8 | data[0] as u16) as f32 / 16.), + true => Ok(((data[1] as i16) << 8 | data[0] as i16) as f32 / 16.), false => Err(()), } } -- cgit