diff options
| author | Michael Turner <[email protected]> | 2025-11-02 14:10:02 -0800 |
|---|---|---|
| committer | Michael Turner <[email protected]> | 2025-11-02 14:10:02 -0800 |
| commit | 719c2bbbb89c0121bbd2b62f9aeb98327e583d2b (patch) | |
| tree | d3f70ac37639688cef0ea2546886ca4c4f396457 /examples/stm32g0 | |
| parent | 3ff0b2c5971e72a93bd37d7f8fecbc8e64421360 (diff) | |
Correct the temperature reading to preserve the sign bits
Diffstat (limited to 'examples/stm32g0')
| -rw-r--r-- | examples/stm32g0/src/bin/onewire_ds18b20.rs | 2 |
1 files changed, 1 insertions, 1 deletions
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 | |||
| 267 | } | 267 | } |
| 268 | 268 | ||
| 269 | match Self::crc8(&data) == 0 { | 269 | match Self::crc8(&data) == 0 { |
| 270 | true => Ok(((data[1] as u16) << 8 | data[0] as u16) as f32 / 16.), | 270 | true => Ok(((data[1] as i16) << 8 | data[0] as i16) as f32 / 16.), |
| 271 | false => Err(()), | 271 | false => Err(()), |
| 272 | } | 272 | } |
| 273 | } | 273 | } |
