From 0439ddca8e216c4439ba46ff2ce58a659797abba Mon Sep 17 00:00:00 2001 From: Matthias Prinke <83612361+matthias-bs@users.noreply.github.com> Date: Sat, 8 Jul 2023 21:19:30 +0200 Subject: [PATCH] Added startup flag in 6-in-1 and 7-in-1 decoder; added sensor type in 7-in-1 decoder --- .../src/WeatherSensor.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/examples/BresserWeatherSensorMQTTCustom/src/WeatherSensor.cpp b/examples/BresserWeatherSensorMQTTCustom/src/WeatherSensor.cpp index b5ce5aa3..ff4b4d99 100644 --- a/examples/BresserWeatherSensorMQTTCustom/src/WeatherSensor.cpp +++ b/examples/BresserWeatherSensorMQTTCustom/src/WeatherSensor.cpp @@ -59,6 +59,7 @@ // 20230412 Added workaround for Professional Wind Gauge / Anemometer, P/N 7002531 // 20230412 Fixed 7 in 1 decoder (valid/complete flags were not set) // 20230613 Fixed rain value in 7 in 1 decoder +// 20230708 Added startup flag in 6-in-1 and 7-in-1 decoder; added sensor type in 7-in-1 decoder // // ToDo: // - @@ -597,7 +598,7 @@ DecodeStatus WeatherSensor::decodeBresser5In1Payload(uint8_t *msg, uint8_t msgSi // Moisture: // // f16e 187000e34 7 ffffff0000 252 2 16 fff 004 000 [25,2, 99%, CH 7] -// DIGEST:8h8h ID?8h8h8h8h STYPE:4h STARTUP:1b CH:3d 8h 8h8h 8h8h TEMP:12h ?2b BATT:1b ?1b MOIST:8h UV?~12h ?4h CHKSUM:8h +// DIGEST:8h8h ID?8h8h8h8h :4h STARTUP:1b CH:3d 8h 8h8h 8h8h TEMP:12h ?2b BATT:1b ?1b MOIST:8h UV?~12h ?4h CHKSUM:8h // // Moisture is transmitted in the humidity field as index 1-16: 0, 7, 13, 20, 27, 33, 40, 47, 53, 60, 67, 73, 80, 87, 93, 99. // The Wind speed and direction fields decode to valid zero but we exclude them from the output. @@ -635,8 +636,8 @@ DecodeStatus WeatherSensor::decodeBresser5In1Payload(uint8_t *msg, uint8_t msgSi // // Wind and Temperature/Humidity or Rain: // -// DIGEST:8h8h ID:8h8h8h8h STYPE:4h STARTUP:1b CH:3d WSPEED:~8h~4h ~4h~8h WDIR:12h ?4h TEMP:8h.4h ?2b BATT:1b ?1b HUM:8h UV?~12h ?4h CHKSUM:8h -// DIGEST:8h8h ID:8h8h8h8h STYPE:4h STARTUP:1b CH:3d WSPEED:~8h~4h ~4h~8h WDIR:12h ?4h RAINFLAG:8h RAIN:8h8h UV:8h8h CHKSUM:8h +// DIGEST:8h8h ID:8h8h8h8h :4h STARTUP:1b CH:3d WSPEED:~8h~4h ~4h~8h WDIR:12h ?4h TEMP:8h.4h ?2b BATT:1b ?1b HUM:8h UV?~12h ?4h CHKSUM:8h +// DIGEST:8h8h ID:8h8h8h8h :4h STARTUP:1b CH:3d WSPEED:~8h~4h ~4h~8h WDIR:12h ?4h RAINFLAG:8h RAIN:8h8h UV:8h8h CHKSUM:8h // // Digest is LFSR-16 gen 0x8810 key 0x5412, excluding the add-checksum and trailer. // Checksum is 8-bit add (with carry) to 0xff. @@ -702,12 +703,10 @@ DecodeStatus WeatherSensor::decodeBresser6In1Payload(uint8_t *msg, uint8_t msgSi if (status != DECODE_OK) return status; - // unused... - //int startup = (msg[6] >> 3) & 1; // s.a. #1214 - sensor[slot].sensor_id = id_tmp; sensor[slot].s_type = type_tmp; sensor[slot].chan = chan_tmp; + sensor[slot].startup = (msg[6] >> 3) & 1; // s.a. #1214 f_3in1 = is_decode3in1(id_tmp); @@ -893,6 +892,8 @@ DecodeStatus WeatherSensor::decodeBresser7In1Payload(uint8_t *msg, uint8_t msgSi sensor[slot].uv_ok = true; sensor[slot].sensor_id = id_tmp; + sensor[slot].s_type = msgw[6] >> 4; + sensor[slot].startup = (msgw[6] & 0x08) == 0x08; sensor[slot].temp_c = temp_c; sensor[slot].humidity = humidity; #ifdef WIND_DATA_FLOATINGPOINT