Skip to content

Commit

Permalink
Add lower temp bounds to Acurite-5n1, Acurite-Atlas (#2571)
Browse files Browse the repository at this point in the history
Adds a lower temperature bound (-40C) for two sensors during data sanity checking.
  • Loading branch information
emorchy authored Jul 18, 2023
1 parent d20beca commit 406918d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/devices/acurite.c
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ static int acurite_5n1_decode(r_device *decoder, bitbuffer_t *bitbuffer, uint8_t
int temp_raw = (bb[4] & 0x0F) << 7 | (bb[5] & 0x7F);
float tempf = (temp_raw - 400) * 0.1f;

if (tempf > 158.0) {
if (tempf < -40.0 || tempf > 158.0) {
decoder_logf(decoder, 1, __func__, "5n1 0x%04X Ch %s, invalid temperature: %0.1f F",
sensor_id, channel_str, tempf);
return DECODE_FAIL_SANITY;
Expand Down Expand Up @@ -862,7 +862,7 @@ static int acurite_atlas_decode(r_device *decoder, bitbuffer_t *bitbuffer, unsig
exception++;

tempf = (temp_raw - 400) * 0.1;
if (tempf > 158.0) {
if (tempf < -40.0 || tempf > 158.0) {
decoder_logf(decoder, 1, __func__, "Atlas 0x%04X Ch %s, invalid temperature: %0.1f F",
sensor_id, channel_str, tempf);
return DECODE_FAIL_SANITY;
Expand Down

0 comments on commit 406918d

Please sign in to comment.