@@ -16,6 +16,7 @@ Also: SwitchDoc Labs Weather FT020T.
16
16
Also: Sainlogic Weather Station WS019T
17
17
Also: Sainlogic Weather Station FT0300
18
18
Also: Ragova WiFi Weather Station FT-0310
19
+ Also: NicetyMeter Weather Station 0366 (without Lux or UV index)
19
20
20
21
OOK modulated with Manchester encoding, halfbit-width 500 us.
21
22
Message length is 112 bit, every second time it will transmit two identical messages, packet gap 5400 us.
@@ -46,6 +47,7 @@ Message layout
46
47
- X : 8 bit: CRC, poly 0x31, init 0xc0
47
48
*/
48
49
50
+ #include <stdbool.h>
49
51
#include "decoder.h"
50
52
51
53
static int cotech_36_7959_decode (r_device * decoder , bitbuffer_t * bitbuffer )
@@ -106,6 +108,9 @@ static int cotech_36_7959_decode(r_device *decoder, bitbuffer_t *bitbuffer)
106
108
107
109
float temp_c = (temp_raw - 400 ) * 0.1f ;
108
110
111
+ // On models without a light sensor, the value read for UV index is out of bounds with its top bits set
112
+ bool light_is_valid = ((uv & 0xf0 ) == 0 );
113
+
109
114
/* clang-format off */
110
115
data = data_make (
111
116
"model" , "" , DATA_STRING , "Cotech-367959" ,
@@ -118,8 +123,8 @@ static int cotech_36_7959_decode(r_device *decoder, bitbuffer_t *bitbuffer)
118
123
"wind_dir_deg" , "Wind direction" , DATA_INT , wind_dir ,
119
124
"wind_avg_m_s" , "Wind" , DATA_FORMAT , "%.1f m/s" , DATA_DOUBLE , wind * 0.1f ,
120
125
"wind_max_m_s" , "Gust" , DATA_FORMAT , "%.1f m/s" , DATA_DOUBLE , gust * 0.1f ,
121
- "light_lux" , "Light Intensity" , DATA_FORMAT , "%u lux" , DATA_INT , light_lux ,
122
- "uv" , "UV Index" , DATA_FORMAT , "%u" , DATA_INT , uv ,
126
+ "light_lux" , "Light Intensity" , DATA_COND , light_is_valid , DATA_FORMAT , "%u lux" , DATA_INT , light_lux ,
127
+ "uv" , "UV Index" , DATA_COND , light_is_valid , DATA_FORMAT , "%u" , DATA_INT , uv ,
123
128
"mic" , "Integrity" , DATA_STRING , "CRC" ,
124
129
NULL );
125
130
/* clang-format on */
0 commit comments