mirror of
https://github.com/esphome/esphome.git
synced 2024-12-22 05:24:53 +01:00
sm300d2: Accept (undocumented) 0x80 checksum offset. (#2263)
Co-authored-by: Matt Hallacy <github@poptix.net>
This commit is contained in:
parent
affaaf7d2c
commit
3d71e2e189
1 changed files with 2 additions and 1 deletions
|
@ -27,7 +27,8 @@ void SM300D2Sensor::update() {
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t calculated_checksum = this->sm300d2_checksum_(response);
|
uint16_t calculated_checksum = this->sm300d2_checksum_(response);
|
||||||
if (calculated_checksum != response[SM300D2_RESPONSE_LENGTH - 1]) {
|
if ((calculated_checksum != response[SM300D2_RESPONSE_LENGTH - 1]) &&
|
||||||
|
(calculated_checksum - 0x80 != response[SM300D2_RESPONSE_LENGTH - 1])) {
|
||||||
ESP_LOGW(TAG, "SM300D2 Checksum doesn't match: 0x%02X!=0x%02X", response[SM300D2_RESPONSE_LENGTH - 1],
|
ESP_LOGW(TAG, "SM300D2 Checksum doesn't match: 0x%02X!=0x%02X", response[SM300D2_RESPONSE_LENGTH - 1],
|
||||||
calculated_checksum);
|
calculated_checksum);
|
||||||
this->status_set_warning();
|
this->status_set_warning();
|
||||||
|
|
Loading…
Reference in a new issue