Skip to content

Commit d5e1929

Browse files
authored
Remove obsolete variable f_3in1 and related code in decodeBresser6In1Payload() (#292)
1 parent 1b65b17 commit d5e1929

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

examples/BresserWeatherSensorMQTTCustom/src/WeatherSensorDecoders.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
// 20240716 Added assignment of sensor[slot].decoder
5353
// 20250127 Added SENSOR_TYPE_WEATHER8 (8-in-1 Weather Sensor)
5454
// 20250129 Minor change in SENSOR_TYPE_WEATHER8 handling
55+
// 20260224 Removed obsolete variable f_3in1 and related code in decodeBresser6In1Payload()
5556
//
5657
// ToDo:
5758
// -
@@ -329,8 +330,8 @@ DecodeStatus WeatherSensor::decodeBresser5In1Payload(const uint8_t *msg, uint8_t
329330
}
330331
else
331332
{
332-
sensor[slot].w.humidity_ok = true;
333-
sensor[slot].w.wind_ok = (msg[22] & 0x0f) <= 9; // BCD, 0x0f on error
333+
sensor[slot].w.wind_ok = true;
334+
sensor[slot].w.humidity_ok = (msg[22] & 0x0f) <= 9; // BCD, 0x0f on error
334335
}
335336

336337
sensor[slot].s_type = type_tmp;
@@ -441,7 +442,6 @@ DecodeStatus WeatherSensor::decodeBresser6In1Payload(const uint8_t *msg, uint8_t
441442
bool uv_ok = false;
442443
bool wind_ok = false;
443444
bool rain_ok = false;
444-
bool f_3in1 = false;
445445

446446
// LFSR-16 digest, generator 0x8810 init 0x5412
447447
int chkdgst = (msg[0] << 8) | msg[1];
@@ -508,7 +508,7 @@ DecodeStatus WeatherSensor::decodeBresser6In1Payload(const uint8_t *msg, uint8_t
508508
sensor[slot].w.humidity = (msg[14] >> 4) * 10 + (msg[14] & 0x0f);
509509

510510
// apparently ff01 or 0000 if not available, ???0 if valid, inverted BCD
511-
uv_ok = ((~msg[15] & 0xff) <= 0x99) && ((~msg[16] & 0xf0) <= 0x90) && !f_3in1;
511+
uv_ok = ((~msg[15] & 0xff) <= 0x99) && ((~msg[16] & 0xf0) <= 0x90);
512512
if (uv_ok)
513513
{
514514
int uv_raw = ((~msg[15] & 0xf0) >> 4) * 100 + (~msg[15] & 0x0f) * 10 + ((~msg[16] & 0xf0) >> 4);
@@ -588,7 +588,7 @@ DecodeStatus WeatherSensor::decodeBresser6In1Payload(const uint8_t *msg, uint8_t
588588
// Weather station data is split into two separate messages (except for Professional Wind Gauge)
589589
if (sensor[slot].s_type == SENSOR_TYPE_WEATHER1)
590590
{
591-
if (f_3in1 || (sensor[slot].w.temp_ok && sensor[slot].w.rain_ok))
591+
if (sensor[slot].w.temp_ok && sensor[slot].w.rain_ok)
592592
{
593593
sensor[slot].complete = true;
594594
}

src/WeatherSensorDecoders.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
// 20240716 Added assignment of sensor[slot].decoder
5353
// 20250127 Added SENSOR_TYPE_WEATHER8 (8-in-1 Weather Sensor)
5454
// 20250129 Minor change in SENSOR_TYPE_WEATHER8 handling
55+
// 20260224 Removed obsolete variable f_3in1 and related code in decodeBresser6In1Payload()
5556
//
5657
// ToDo:
5758
// -
@@ -441,7 +442,6 @@ DecodeStatus WeatherSensor::decodeBresser6In1Payload(const uint8_t *msg, uint8_t
441442
bool uv_ok = false;
442443
bool wind_ok = false;
443444
bool rain_ok = false;
444-
bool f_3in1 = false;
445445

446446
// LFSR-16 digest, generator 0x8810 init 0x5412
447447
int chkdgst = (msg[0] << 8) | msg[1];
@@ -508,7 +508,7 @@ DecodeStatus WeatherSensor::decodeBresser6In1Payload(const uint8_t *msg, uint8_t
508508
sensor[slot].w.humidity = (msg[14] >> 4) * 10 + (msg[14] & 0x0f);
509509

510510
// apparently ff01 or 0000 if not available, ???0 if valid, inverted BCD
511-
uv_ok = ((~msg[15] & 0xff) <= 0x99) && ((~msg[16] & 0xf0) <= 0x90) && !f_3in1;
511+
uv_ok = ((~msg[15] & 0xff) <= 0x99) && ((~msg[16] & 0xf0) <= 0x90);
512512
if (uv_ok)
513513
{
514514
int uv_raw = ((~msg[15] & 0xf0) >> 4) * 100 + (~msg[15] & 0x0f) * 10 + ((~msg[16] & 0xf0) >> 4);
@@ -588,7 +588,7 @@ DecodeStatus WeatherSensor::decodeBresser6In1Payload(const uint8_t *msg, uint8_t
588588
// Weather station data is split into two separate messages (except for Professional Wind Gauge)
589589
if (sensor[slot].s_type == SENSOR_TYPE_WEATHER1)
590590
{
591-
if (f_3in1 || (sensor[slot].w.temp_ok && sensor[slot].w.rain_ok))
591+
if (sensor[slot].w.temp_ok && sensor[slot].w.rain_ok)
592592
{
593593
sensor[slot].complete = true;
594594
}

0 commit comments

Comments
 (0)