Initialize Checksum with 0

This commit is contained in:
seiichiro 2021-05-02 12:53:14 +02:00
parent 4b8111316d
commit 6c67032ef2

View file

@ -80,7 +80,7 @@ bool HM330x::sendCmd(uint8_t cmd) {
// Calculate CRC8 // Calculate CRC8
uint8_t HM330x::calcSum(uint8_t bytes[]) { uint8_t HM330x::calcSum(uint8_t bytes[]) {
uint8_t crc8; uint8_t crc8 = 0;
for (int i = 0; i < HM330x_DATA_LEN - 1; i++) { for (int i = 0; i < HM330x_DATA_LEN - 1; i++) {
crc8 += bytes[i]; crc8 += bytes[i];
} }