Skip to content

Commit

Permalink
Bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
matthias-bs committed Jul 6, 2023
1 parent 9b5bc1b commit f372190
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ void loop()
weatherSensor.sensor[i].s_type,
weatherSensor.sensor[i].battery_ok ? "OK " : "Low");
Serial.printf("Lightning Counter: [%3d] ", weatherSensor.sensor[i].lightning_count);
if (weatherSensor.sensor[i].lightning_distance_km == 0) {
if (weatherSensor.sensor[i].lightning_distance_km != 0) {
Serial.printf("Distance: [%2dkm] ", weatherSensor.sensor[i].lightning_distance_km);
} else {
Serial.printf("Distance: [----] ");
Expand Down
6 changes: 6 additions & 0 deletions src/WeatherSensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -974,10 +974,16 @@ DecodeStatus WeatherSensor::decodeBresserLightningPayload(uint8_t *msg, uint8_t
uint8_t const distance_map[] = { 1, 5, 6, 8, 10, 12, 14, 17, 20, 24, 27, 31, 34, 37, 40, 63 };
#endif

#if 0
uint8_t test_data[] = { 0x73, 0x69, 0xB5, 0x08, 0xAA, 0xA2, 0x90, 0xAA, 0xAA, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x15 };
#endif

// data whitening
uint8_t msgw[MSG_BUF_SIZE];
for (unsigned i = 0; i < msgSize; ++i) {
msgw[i] = msg[i] ^ 0xaa;
//msgw[i] = test_data[i] ^ 0xaa;
}

// LFSR-16 digest, generator 0x8810 key 0xabf9 with a final xor 0x899e
Expand Down

0 comments on commit f372190

Please sign in to comment.