Skip to content

Commit

Permalink
Update WeatherSensor.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
matthias-bs committed Jul 10, 2023
1 parent 5601310 commit a4fc746
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/WeatherSensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,7 @@ DecodeStatus WeatherSensor::decodeBresser7In1Payload(uint8_t *msg, uint8_t msgSi
log_d("Data sanity check failed");
}

// data whitening
// data de-whitening
uint8_t msgw[MSG_BUF_SIZE];
for (unsigned i = 0; i < msgSize; ++i) {
msgw[i] = msg[i] ^ 0xaa;
Expand All @@ -859,7 +859,7 @@ DecodeStatus WeatherSensor::decodeBresser7In1Payload(uint8_t *msg, uint8_t msgSi
#if CORE_DEBUG_LEVEL == ARDUHAL_LOG_LEVEL_VERBOSE
char buf[128];
*buf = '\0';
for(size_t i = 0 ; i < sizeof(msgSize) ; i++) {
for (size_t i = 0 ; i < msgSize; i++) {
sprintf(&buf[strlen(buf)], "%02X ", msgw[i]);
}
log_v("De-whitened Data: %s", buf);
Expand Down Expand Up @@ -1007,7 +1007,14 @@ DecodeStatus WeatherSensor::decodeBresserLightningPayload(uint8_t *msg, uint8_t
#if CORE_DEBUG_LEVEL == ARDUHAL_LOG_LEVEL_VERBOSE
char buf[128];
*buf = '\0';
for(size_t i = 0 ; i < sizeof(msgSize) ; i++) {
// Print byte index; skip last byte of preamble (D4)
for (size_t i = 1 ; i <= msgSize; i++) {
sprintf(&buf[strlen(buf)], "%02d ", i);
}
log_v("De-whitened Data: %s", buf);

*buf = '\0';
for (size_t i = 0 ; i < msgSize; i++) {
sprintf(&buf[strlen(buf)], "%02X ", msgw[i]);
}
log_v("De-whitened Data: %s", buf);
Expand Down

0 comments on commit a4fc746

Please sign in to comment.