kaxori
12/28/2024, 6:21 PMparse_temperature_ data/ByteArray -> float:
return (BIG_ENDIAN.uint16 data driver.Driver.TEMPERATURE_INTEGRAL_PART_) / 10.0
=> it works, but I think could be done nicer:
parse_temperature_ data/ByteArray -> float:
return not (driver.Driver.TEMPERATURE_INTEGRAL_PART_ & 0x8000) ?
(BIG_ENDIAN.uint16 data driver.Driver.TEMPERATURE_INTEGRAL_PART_) / 10.0 :
-((BIG_ENDIAN.uint16 data driver.Driver.TEMPERATURE_INTEGRAL_PART_) & 0x7ff) / 10.0floitsch
12/28/2024, 7:33 PMkaxori
12/28/2024, 7:34 PMfloitsch
12/28/2024, 7:35 PMkaxori
12/28/2024, 8:15 PMkaxori
12/28/2024, 8:17 PMkaxori
01/02/2025, 7:45 PMimport io show BIG_ENDIAN`
🤔 I do not understand why this change removes the error. Could you please help me .floitsch
01/02/2025, 7:46 PMkaxori
01/02/2025, 7:47 PMfloitsch
01/06/2025, 11:15 AM