mirror of
https://github.com/esphome/esphome.git
synced 2024-11-14 02:58:11 +01:00
Fix ESP8266 preference loading (#2367)
This commit is contained in:
parent
bbac1534a3
commit
c8a8acd46e
1 changed files with 6 additions and 1 deletions
|
@ -149,7 +149,12 @@ class ESP8266PreferenceBackend : public ESPPreferenceBackend {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
uint32_t crc = calculate_crc(buffer.begin(), buffer.end() - 1, type);
|
uint32_t crc = calculate_crc(buffer.begin(), buffer.end() - 1, type);
|
||||||
return buffer[buffer.size() - 1] == crc;
|
if (buffer[buffer.size() - 1] != crc) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
memcpy(data, buffer.data(), len);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue