diff --git a/esphome/core/helpers.cpp b/esphome/core/helpers.cpp index dee771d4e9..7f040f855f 100644 --- a/esphome/core/helpers.cpp +++ b/esphome/core/helpers.cpp @@ -93,7 +93,7 @@ std::string to_string(long double value) { return str_snprintf("%Lf", 32, value) // Mathematics float lerp(float completion, float start, float end) { return start + (end - start) * completion; } -uint8_t crc8(uint8_t *data, uint8_t len) { +uint8_t crc8(const uint8_t *data, uint8_t len) { uint8_t crc = 0; while ((len--) != 0u) { diff --git a/esphome/core/helpers.h b/esphome/core/helpers.h index 4af840f77b..b4ad22b083 100644 --- a/esphome/core/helpers.h +++ b/esphome/core/helpers.h @@ -155,7 +155,7 @@ template T remap(U value, U min, U max, T min_out, T max } /// Calculate a CRC-8 checksum of \p data with size \p len. -uint8_t crc8(uint8_t *data, uint8_t len); +uint8_t crc8(const uint8_t *data, uint8_t len); /// Calculate a CRC-16 checksum of \p data with size \p len. uint16_t crc16(const uint8_t *data, uint16_t len, uint16_t crc = 0xffff, uint16_t reverse_poly = 0xa001,