diff --git a/_weather_sensor_8h_source.html b/_weather_sensor_8h_source.html index 6a109c0..1b9647d 100644 --- a/_weather_sensor_8h_source.html +++ b/_weather_sensor_8h_source.html @@ -167,87 +167,87 @@
80 // 20240506 Changed sensor from array to std::vector, added getSensorCfg() / setSensorCfg()
81 // 20240507 Added configuration of enabled decoders at run time
82 // 20240608 Modified implementation of maximum number of sensors
-
83 //
-
84 // ToDo:
-
85 // -
-
86 //
-
88 
-
89 #ifndef WeatherSensor_h
-
90 #define WeatherSensor_h
-
91 
-
92 #include <Arduino.h>
-
93 #include <vector>
-
94 #include <string>
-
95 #include <Preferences.h>
-
96 #include <RadioLib.h>
-
97 
+
83 // 20240609 Fixed implementation of maximum number of sensors
+
84 //
+
85 // ToDo:
+
86 // -
+
87 //
+
89 
+
90 #ifndef WeatherSensor_h
+
91 #define WeatherSensor_h
+
92 
+
93 #include <Arduino.h>
+
94 #include <vector>
+
95 #include <string>
+
96 #include <Preferences.h>
+
97 #include <RadioLib.h>
98 
-
99 // Sensor Types
-
100 // 0 - Weather Station 5-in-1; PN 7002510..12/7902510..12
-
101 // 1 - Weather Station 6-in-1; PN 7002585
-
102 // - Professional Wind Gauge 6-in-1; PN 7002531
-
103 // - Weather Station 7-in-1; PN 7003300
-
104 // 2 - Thermo-/Hygro-Sensor 6-in-1; PN 7009999
-
105 // 3 - Pool / Spa Thermometer 6-in-1; PN 7000073
-
106 // 4 - Soil Moisture Sensor 6-in-1; PN 7009972
-
107 // 5 - Water Leakage Sensor 6-in-1; PN 7009975
-
108 // 8 - Air Quality Sensor PM2.5/PM10 7-in-1; P/N 7009970
-
109 // 9 - Professional Rain Gauge (5-in-1 decoder)
-
110 // 9 - Lightning Sensor PN 7009976
-
111 // 10 - CO2 Sensor 7-in-1; PN 7009977
-
112 // 11 - HCHO/VCO Sensor 7-in-1; PN 7009978
-
113 #define SENSOR_TYPE_WEATHER0 0 // Weather Station
-
114 #define SENSOR_TYPE_WEATHER1 1 // Weather Station
-
115 #define SENSOR_TYPE_THERMO_HYGRO 2 // Thermo-/Hygro-Sensor
-
116 #define SENSOR_TYPE_POOL_THERMO 3 // Pool / Spa Thermometer
-
117 #define SENSOR_TYPE_SOIL 4 // Soil Temperature and Moisture (from 6-in-1 decoder)
-
118 #define SENSOR_TYPE_LEAKAGE 5 // Water Leakage
-
119 #define SENSOR_TYPE_AIR_PM 8 // Air Quality Sensor (Particle Matter)
-
120 #define SENSOR_TYPE_RAIN 9 // Professional Rain Gauge (from 5-in-1 decoder)
-
121 #define SENSOR_TYPE_LIGHTNING 9 // Lightning Sensor
-
122 #define SENSOR_TYPE_CO2 10 // CO2 Sensor
-
123 #define SENSOR_TYPE_HCHO_VOC 11 // Air Quality Sensor (HCHO and VOC)
-
124 
+
99 
+
100 // Sensor Types
+
101 // 0 - Weather Station 5-in-1; PN 7002510..12/7902510..12
+
102 // 1 - Weather Station 6-in-1; PN 7002585
+
103 // - Professional Wind Gauge 6-in-1; PN 7002531
+
104 // - Weather Station 7-in-1; PN 7003300
+
105 // 2 - Thermo-/Hygro-Sensor 6-in-1; PN 7009999
+
106 // 3 - Pool / Spa Thermometer 6-in-1; PN 7000073
+
107 // 4 - Soil Moisture Sensor 6-in-1; PN 7009972
+
108 // 5 - Water Leakage Sensor 6-in-1; PN 7009975
+
109 // 8 - Air Quality Sensor PM2.5/PM10 7-in-1; P/N 7009970
+
110 // 9 - Professional Rain Gauge (5-in-1 decoder)
+
111 // 9 - Lightning Sensor PN 7009976
+
112 // 10 - CO2 Sensor 7-in-1; PN 7009977
+
113 // 11 - HCHO/VCO Sensor 7-in-1; PN 7009978
+
114 #define SENSOR_TYPE_WEATHER0 0 // Weather Station
+
115 #define SENSOR_TYPE_WEATHER1 1 // Weather Station
+
116 #define SENSOR_TYPE_THERMO_HYGRO 2 // Thermo-/Hygro-Sensor
+
117 #define SENSOR_TYPE_POOL_THERMO 3 // Pool / Spa Thermometer
+
118 #define SENSOR_TYPE_SOIL 4 // Soil Temperature and Moisture (from 6-in-1 decoder)
+
119 #define SENSOR_TYPE_LEAKAGE 5 // Water Leakage
+
120 #define SENSOR_TYPE_AIR_PM 8 // Air Quality Sensor (Particle Matter)
+
121 #define SENSOR_TYPE_RAIN 9 // Professional Rain Gauge (from 5-in-1 decoder)
+
122 #define SENSOR_TYPE_LIGHTNING 9 // Lightning Sensor
+
123 #define SENSOR_TYPE_CO2 10 // CO2 Sensor
+
124 #define SENSOR_TYPE_HCHO_VOC 11 // Air Quality Sensor (HCHO and VOC)
125 
-
126 // Sensor specific rain gauge overflow threshold (mm)
-
127 #define WEATHER0_RAIN_OV 1000
-
128 #define WEATHER1_RAIN_OV 100000
-
129 
+
126 
+
127 // Sensor specific rain gauge overflow threshold (mm)
+
128 #define WEATHER0_RAIN_OV 1000
+
129 #define WEATHER1_RAIN_OV 100000
130 
-
131 // Flags for controlling completion of reception in getData()
-
132 #define DATA_COMPLETE 0x1 // only completed slots (as opposed to partially filled)
-
133 #define DATA_TYPE 0x2 // at least one slot with specific sensor type
-
134 #define DATA_ALL_SLOTS 0x8 // all slots completed
-
135 
-
136 // Flags for checking enabled decoders
-
137 #define DECODER_5IN1 0x01
-
138 #define DECODER_6IN1 0x02
-
139 #define DECODER_7IN1 0x04
-
140 #define DECODER_LIGHTNING 0x08
-
141 #define DECODER_LEAKAGE 0x10
-
142 
-
143 // Message buffer size
-
144 #define MSG_BUF_SIZE 27
-
145 
-
146 // Radio message decoding status
-
147 typedef enum DecodeStatus {
-
148  DECODE_INVALID, DECODE_OK, DECODE_PAR_ERR, DECODE_CHK_ERR, DECODE_DIG_ERR, DECODE_SKIP, DECODE_FULL
-
149 } DecodeStatus;
-
150 
+
131 
+
132 // Flags for controlling completion of reception in getData()
+
133 #define DATA_COMPLETE 0x1 // only completed slots (as opposed to partially filled)
+
134 #define DATA_TYPE 0x2 // at least one slot with specific sensor type
+
135 #define DATA_ALL_SLOTS 0x8 // all slots completed
+
136 
+
137 // Flags for checking enabled decoders
+
138 #define DECODER_5IN1 0x01
+
139 #define DECODER_6IN1 0x02
+
140 #define DECODER_7IN1 0x04
+
141 #define DECODER_LIGHTNING 0x08
+
142 #define DECODER_LEAKAGE 0x10
+
143 
+
144 // Message buffer size
+
145 #define MSG_BUF_SIZE 27
+
146 
+
147 // Radio message decoding status
+
148 typedef enum DecodeStatus {
+
149  DECODE_INVALID, DECODE_OK, DECODE_PAR_ERR, DECODE_CHK_ERR, DECODE_DIG_ERR, DECODE_SKIP, DECODE_FULL
+
150 } DecodeStatus;
151 
-
157 typedef struct SensorMap {
-
158  uint32_t id;
-
159  std::string name;
-
160 } SensorMap;
-
161 
+
152 
+
158 typedef struct SensorMap {
+
159  uint32_t id;
+
160  std::string name;
+
161 } SensorMap;
162 
163 
-
170 class WeatherSensor {
-
171  private:
-
172  Preferences cfgPrefs;
-
173  std::vector<uint32_t> sensor_ids_inc;
-
174  std::vector<uint32_t> sensor_ids_exc;
-
175  uint8_t maxSensorsDefault;
+
164 
+
171 class WeatherSensor {
+
172  private:
+
173  Preferences cfgPrefs;
+
174  std::vector<uint32_t> sensor_ids_inc;
+
175  std::vector<uint32_t> sensor_ids_exc;
176 
177  public:
183  int16_t begin(uint8_t max_sensors_default = MAX_SENSORS_DEFAULT);
@@ -467,31 +467,31 @@
609 };
610 
611 #endif
-
WeatherSensor
Receive, decode and store Bresser Weather Sensor Data Uses CC1101 or SX1276 radio module for receivin...
Definition: WeatherSensor.h:170
+
WeatherSensor
Receive, decode and store Bresser Weather Sensor Data Uses CC1101 or SX1276 radio module for receivin...
Definition: WeatherSensor.h:171
WeatherSensor::getMessage
DecodeStatus getMessage(void)
Tries to receive radio message (non-blocking) and to decode it. Timeout occurs after a multitude of e...
Definition: WeatherSensor.cpp:319
-
WeatherSensor::findId
int findId(uint32_t id)
Definition: WeatherSensor.cpp:429
+
WeatherSensor::findId
int findId(uint32_t id)
Definition: WeatherSensor.cpp:426
WeatherSensor::radioReset
void radioReset(void)
Reset radio transceiver.
Definition: WeatherSensor.cpp:235
WeatherSensor::rxFlags
uint8_t rxFlags
receive flags (see getData())
Definition: WeatherSensor.h:332
WeatherSensor::rssi
float rssi
received signal strength indicator in dBm
Definition: WeatherSensor.h:331
-
WeatherSensor::getSensorsCfg
void getSensorsCfg(uint8_t &max_sensors, uint8_t &rx_flags, uint8_t &en_decoders)
Definition: WeatherSensorConfig.cpp:180
+
WeatherSensor::getSensorsCfg
void getSensorsCfg(uint8_t &max_sensors, uint8_t &rx_flags, uint8_t &en_decoders)
Definition: WeatherSensorConfig.cpp:181
WeatherSensor::getData
bool getData(uint32_t timeout, uint8_t flags=0, uint8_t type=0, void(*func)()=NULL)
Wait for reception of data or occurrance of timeout. With BRESSER_6_IN_1, data is distributed across ...
Definition: WeatherSensor.cpp:245
-
WeatherSensor::setSensorsCfg
void setSensorsCfg(uint8_t max_sensors, uint8_t rx_flags, uint8_t en_decoders=0xFF)
Definition: WeatherSensorConfig.cpp:164
+
WeatherSensor::setSensorsCfg
void setSensorsCfg(uint8_t max_sensors, uint8_t rx_flags, uint8_t en_decoders=0xFF)
Definition: WeatherSensorConfig.cpp:165
WeatherSensor::enDecoders
uint8_t enDecoders
enabled Decoders
Definition: WeatherSensor.h:333
-
WeatherSensor::begin
int16_t begin(uint8_t max_sensors_default=MAX_SENSORS_DEFAULT)
Presence check and initialization of radio module.
Definition: WeatherSensor.cpp:137
+
WeatherSensor::begin
int16_t begin(uint8_t max_sensors_default=MAX_SENSORS_DEFAULT)
Presence check and initialization of radio module.
Definition: WeatherSensor.cpp:138
WeatherSensor::sleep
void sleep(void)
Set transceiver into sleep mode.
Definition: WeatherSensor.cpp:240
-
WeatherSensor::findType
int findType(uint8_t type, uint8_t channel=0xFF)
Definition: WeatherSensor.cpp:442
-
WeatherSensor::getSensorsInc
uint8_t getSensorsInc(uint8_t *payload)
Definition: WeatherSensorConfig.cpp:117
-
WeatherSensor::genMessage
bool genMessage(int i, uint32_t id=0xff, uint8_t s_type=1, uint8_t channel=0, uint8_t startup=0)
Generates data otherwise received and decoded from a radio message.
Definition: WeatherSensor.cpp:371
+
WeatherSensor::findType
int findType(uint8_t type, uint8_t channel=0xFF)
Definition: WeatherSensor.cpp:439
+
WeatherSensor::getSensorsInc
uint8_t getSensorsInc(uint8_t *payload)
Definition: WeatherSensorConfig.cpp:118
+
WeatherSensor::genMessage
bool genMessage(int i, uint32_t id=0xff, uint8_t s_type=1, uint8_t channel=0, uint8_t startup=0)
Generates data otherwise received and decoded from a radio message.
Definition: WeatherSensor.cpp:369
WeatherSensor::sensor_t
struct Sensor sensor_t
Shortcut for struct Sensor.
Definition: WeatherSensor.h:329
WeatherSensor::sensor
std::vector< sensor_t > sensor
sensor data array
Definition: WeatherSensor.h:330
-
WeatherSensor::setSensorsInc
void setSensorsInc(uint8_t *bytes, uint8_t size)
Definition: WeatherSensorConfig.cpp:94
-
WeatherSensor::getSensorsExc
uint8_t getSensorsExc(uint8_t *payload)
Definition: WeatherSensorConfig.cpp:152
+
WeatherSensor::setSensorsInc
void setSensorsInc(uint8_t *bytes, uint8_t size)
Definition: WeatherSensorConfig.cpp:95
+
WeatherSensor::getSensorsExc
uint8_t getSensorsExc(uint8_t *payload)
Definition: WeatherSensorConfig.cpp:153
WeatherSensor::clearSlots
void clearSlots(uint8_t type=0xFF)
Clear sensor data.
Definition: WeatherSensor.h:351
WeatherSensor::decodeMessage
DecodeStatus decodeMessage(const uint8_t *msg, uint8_t msgSize)
Decode message Tries the available decoders until a decoding was successful.
Definition: WeatherSensorDecoders.cpp:143
-
WeatherSensor::setSensorsExc
void setSensorsExc(uint8_t *bytes, uint8_t size)
Definition: WeatherSensorConfig.cpp:129
-
SensorMap
Mapping of sensor IDs to names.
Definition: WeatherSensor.h:157
-
SensorMap::name
std::string name
Name of sensor (e.g. for MQTT topic)
Definition: WeatherSensor.h:159
-
SensorMap::id
uint32_t id
ID if sensor (as transmitted in radio message)
Definition: WeatherSensor.h:158
+
WeatherSensor::setSensorsExc
void setSensorsExc(uint8_t *bytes, uint8_t size)
Definition: WeatherSensorConfig.cpp:130
+
SensorMap
Mapping of sensor IDs to names.
Definition: WeatherSensor.h:158
+
SensorMap::name
std::string name
Name of sensor (e.g. for MQTT topic)
Definition: WeatherSensor.h:160
+
SensorMap::id
uint32_t id
ID if sensor (as transmitted in radio message)
Definition: WeatherSensor.h:159
WeatherSensor::AirCO2
Definition: WeatherSensor.h:284
WeatherSensor::AirCO2::co2_init
bool co2_init
measurement value invalid due to initialization
Definition: WeatherSensor.h:286
WeatherSensor::AirCO2::co2_ppm
uint16_t co2_ppm
CO2 concentration in ppm.
Definition: WeatherSensor.h:285