mirror of
https://github.com/esphome/esphome.git
synced 2024-10-31 08:25: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
@ -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 New Issue
Block a user