From 0af2b7aaf0ec9e942b73a480d77bf63569844ac5 Mon Sep 17 00:00:00 2001 From: matthias-bs <83612361+matthias-bs@users.noreply.github.com> Date: Sun, 28 Apr 2024 10:54:31 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20matthias?= =?UTF-8?q?-bs/BresserWeatherSensorReceiver@ce62e3a816d3ecde1495d1d344556e?= =?UTF-8?q?5211242f25=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _weather_sensor_8h_source.html | 223 +++++++++++++++++---------------- 1 file changed, 113 insertions(+), 110 deletions(-) diff --git a/_weather_sensor_8h_source.html b/_weather_sensor_8h_source.html index 90f67710..cd06d451 100644 --- a/_weather_sensor_8h_source.html +++ b/_weather_sensor_8h_source.html @@ -349,118 +349,121 @@
318 
319  Sensor ()
320  {
-
321  memset(this, 0, sizeof(*this));
-
322  };
-
323  };
-
324 
-
325  typedef struct Sensor sensor_t;
-
326  sensor_t sensor[NUM_SENSORS];
-
327  float rssi = 0.0;
-
328 
-
329 
-
335  bool genMessage(int i, uint32_t id = 0xff, uint8_t s_type = 1, uint8_t channel = 0, uint8_t startup = 0);
-
336 
-
337 
-
346  void clearSlots(uint8_t type = 0xFF)
-
347  {
-
348  for (int i=0; i< NUM_SENSORS; i++) {
-
349  if ((type == 0xFF) || (sensor[i].s_type == type)) {
-
350  sensor[i].valid = false;
-
351  sensor[i].complete = false;
-
352  }
-
353  if (sensor[i].s_type == SENSOR_TYPE_WEATHER1) {
-
354  sensor[i].w.temp_ok = false;
-
355  sensor[i].w.humidity_ok = false;
-
356  sensor[i].w.light_ok = false;
-
357  sensor[i].w.uv_ok = false;
-
358  sensor[i].w.wind_ok = false;
-
359  sensor[i].w.rain_ok = false;
-
360  }
-
361  }
-
362  };
-
363 
-
371  int findId(uint32_t id);
-
372 
-
373 
-
382  int findType(uint8_t type, uint8_t channel = 0xFF);
-
383 
-
390  void setSensorsInc(uint8_t *bytes, uint8_t size);
-
391 
-
398  void setSensorsExc(uint8_t *bytes, uint8_t size);
-
399 
-
400 
-
408  uint8_t getSensorsInc(uint8_t *payload);
-
409 
-
417  uint8_t getSensorsExc(uint8_t *payload);
-
418 
-
419  private:
-
420  struct Sensor *pData;
+
321  #pragma GCC diagnostic push
+
322  #pragma GCC diagnostic ignore "-Wclass-memaccess"
+
323  memset(this, 0, sizeof(*this));
+
324  #pragma GCC diagnostic pop
+
325  };
+
326  };
+
327 
+
328  typedef struct Sensor sensor_t;
+
329  sensor_t sensor[NUM_SENSORS];
+
330  float rssi = 0.0;
+
331 
+
332 
+
338  bool genMessage(int i, uint32_t id = 0xff, uint8_t s_type = 1, uint8_t channel = 0, uint8_t startup = 0);
+
339 
+
340 
+
349  void clearSlots(uint8_t type = 0xFF)
+
350  {
+
351  for (int i=0; i< NUM_SENSORS; i++) {
+
352  if ((type == 0xFF) || (sensor[i].s_type == type)) {
+
353  sensor[i].valid = false;
+
354  sensor[i].complete = false;
+
355  }
+
356  if (sensor[i].s_type == SENSOR_TYPE_WEATHER1) {
+
357  sensor[i].w.temp_ok = false;
+
358  sensor[i].w.humidity_ok = false;
+
359  sensor[i].w.light_ok = false;
+
360  sensor[i].w.uv_ok = false;
+
361  sensor[i].w.wind_ok = false;
+
362  sensor[i].w.rain_ok = false;
+
363  }
+
364  }
+
365  };
+
366 
+
374  int findId(uint32_t id);
+
375 
+
376 
+
385  int findType(uint8_t type, uint8_t channel = 0xFF);
+
386 
+
393  void setSensorsInc(uint8_t *bytes, uint8_t size);
+
394 
+
401  void setSensorsExc(uint8_t *bytes, uint8_t size);
+
402 
+
403 
+
411  uint8_t getSensorsInc(uint8_t *payload);
+
412 
+
420  uint8_t getSensorsExc(uint8_t *payload);
421 
-
431  void initList(std::vector<uint32_t> &list, const std::vector<uint32_t> list_def, const char *key);
-
432 
-
450  int findSlot(uint32_t id, DecodeStatus * status);
-
451 
-
452 
-
453  #ifdef BRESSER_5_IN_1
-
463  DecodeStatus decodeBresser5In1Payload(const uint8_t *msg, uint8_t msgSize);
-
464  #endif
-
465  #ifdef BRESSER_6_IN_1
-
477  DecodeStatus decodeBresser6In1Payload(const uint8_t *msg, uint8_t msgSize);
-
478  #endif
-
479  #ifdef BRESSER_7_IN_1
-
489  DecodeStatus decodeBresser7In1Payload(const uint8_t *msg, uint8_t msgSize);
-
490  #endif
-
491  #ifdef BRESSER_LIGHTNING
-
501  DecodeStatus decodeBresserLightningPayload(const uint8_t *msg, uint8_t msgSize);
-
502  #endif
-
503  #ifdef BRESSER_LEAKAGE
-
513  DecodeStatus decodeBresserLeakagePayload(const uint8_t *msg, uint8_t msgSize);
-
514  #endif
-
515 
-
516  protected:
-
520  uint16_t lfsr_digest16(uint8_t const message[], unsigned bytes, uint16_t gen, uint16_t key);
-
521 
-
530  int add_bytes(uint8_t const message[], unsigned num_bytes);
-
531 
-
542  uint16_t crc16(uint8_t const message[], unsigned nBytes, uint16_t polynomial, uint16_t init);
-
543 
-
544  #if CORE_DEBUG_LEVEL >= ARDUHAL_LOG_LEVEL_DEBUG
-
556  void log_message(const char *descr, const uint8_t *msg, uint8_t msgSize) {
-
557  char buf[128];
-
558  const char txt[] = "Byte #: ";
-
559  int offs;
-
560  int len1 = strlen(txt);
-
561  int len2 = strlen(descr) + 2; // add colon and space
-
562  int prefix_len = max(len1, len2);
-
563 
-
564  memset(buf, ' ', prefix_len);
-
565  buf[prefix_len] = '\0';
-
566  offs = (len1 < len2) ? (len2 - len1) : 0;
-
567  strcpy(&buf[offs], txt);
-
568 
-
569  // Print byte index
-
570  for (size_t i = 0 ; i < msgSize; i++) {
-
571  sprintf(&buf[strlen(buf)], "%02d ", i);
-
572  }
-
573  log_d("%s", buf);
-
574 
-
575  memset(buf, ' ', prefix_len);
-
576  buf[prefix_len] ='\0';
-
577  offs = (len1 > len2) ? (len1 - len2) : 0;
-
578  sprintf(&buf[offs], "%s: ", descr);
-
579 
-
580  for (size_t i = 0 ; i < msgSize; i++) {
-
581  sprintf(&buf[strlen(buf)], "%02X ", msg[i]);
-
582  }
-
583  log_d("%s", buf);
-
584  }
-
585  #endif
-
586 
-
587 };
-
588 
-
589 #endif
+
422  private:
+
423  struct Sensor *pData;
+
424 
+
434  void initList(std::vector<uint32_t> &list, const std::vector<uint32_t> list_def, const char *key);
+
435 
+
453  int findSlot(uint32_t id, DecodeStatus * status);
+
454 
+
455 
+
456  #ifdef BRESSER_5_IN_1
+
466  DecodeStatus decodeBresser5In1Payload(const uint8_t *msg, uint8_t msgSize);
+
467  #endif
+
468  #ifdef BRESSER_6_IN_1
+
480  DecodeStatus decodeBresser6In1Payload(const uint8_t *msg, uint8_t msgSize);
+
481  #endif
+
482  #ifdef BRESSER_7_IN_1
+
492  DecodeStatus decodeBresser7In1Payload(const uint8_t *msg, uint8_t msgSize);
+
493  #endif
+
494  #ifdef BRESSER_LIGHTNING
+
504  DecodeStatus decodeBresserLightningPayload(const uint8_t *msg, uint8_t msgSize);
+
505  #endif
+
506  #ifdef BRESSER_LEAKAGE
+
516  DecodeStatus decodeBresserLeakagePayload(const uint8_t *msg, uint8_t msgSize);
+
517  #endif
+
518 
+
519  protected:
+
523  uint16_t lfsr_digest16(uint8_t const message[], unsigned bytes, uint16_t gen, uint16_t key);
+
524 
+
533  int add_bytes(uint8_t const message[], unsigned num_bytes);
+
534 
+
545  uint16_t crc16(uint8_t const message[], unsigned nBytes, uint16_t polynomial, uint16_t init);
+
546 
+
547  #if CORE_DEBUG_LEVEL >= ARDUHAL_LOG_LEVEL_DEBUG
+
559  void log_message(const char *descr, const uint8_t *msg, uint8_t msgSize) {
+
560  char buf[128];
+
561  const char txt[] = "Byte #: ";
+
562  int offs;
+
563  int len1 = strlen(txt);
+
564  int len2 = strlen(descr) + 2; // add colon and space
+
565  int prefix_len = max(len1, len2);
+
566 
+
567  memset(buf, ' ', prefix_len);
+
568  buf[prefix_len] = '\0';
+
569  offs = (len1 < len2) ? (len2 - len1) : 0;
+
570  strcpy(&buf[offs], txt);
+
571 
+
572  // Print byte index
+
573  for (size_t i = 0 ; i < msgSize; i++) {
+
574  sprintf(&buf[strlen(buf)], "%02d ", i);
+
575  }
+
576  log_d("%s", buf);
+
577 
+
578  memset(buf, ' ', prefix_len);
+
579  buf[prefix_len] ='\0';
+
580  offs = (len1 > len2) ? (len1 - len2) : 0;
+
581  sprintf(&buf[offs], "%s: ", descr);
+
582 
+
583  for (size_t i = 0 ; i < msgSize; i++) {
+
584  sprintf(&buf[strlen(buf)], "%02X ", msg[i]);
+
585  }
+
586  log_d("%s", buf);
+
587  }
+
588  #endif
+
589 
+
590 };
+
591 
+
592 #endif
WeatherSensor
Receive, decode and store Bresser Weather Sensor Data Uses CC1101 or SX1276 radio module for receivin...
Definition: WeatherSensor.h:170
-
WeatherSensor::clearSlots
void clearSlots(uint8_t type=0xFF)
Clear sensor data.
Definition: WeatherSensor.h:346
+
WeatherSensor::clearSlots
void clearSlots(uint8_t type=0xFF)
Clear sensor data.
Definition: WeatherSensor.h:349
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