diff --git a/esphome/components/seeed_mr60bha2/seeed_mr60bha2.cpp b/esphome/components/seeed_mr60bha2/seeed_mr60bha2.cpp index 5a8a1e4656..da2cb26ee4 100644 --- a/esphome/components/seeed_mr60bha2/seeed_mr60bha2.cpp +++ b/esphome/components/seeed_mr60bha2/seeed_mr60bha2.cpp @@ -60,7 +60,7 @@ void MR60BHA2Component::loop() { * @param len The length of the byte array. * @return The calculated checksum. */ -uint8_t MR60BHA2Component::calculate_checksum_(const uint8_t *data, size_t len) { +static uint8_t calculate_checksum(const uint8_t *data, size_t len) { uint8_t checksum = 0; for (size_t i = 0; i < len; i++) { checksum ^= data[i]; @@ -80,8 +80,8 @@ uint8_t MR60BHA2Component::calculate_checksum_(const uint8_t *data, size_t len) * @param expected_checksum The expected checksum. * @return True if the checksum is valid, false otherwise. */ -bool MR60BHA2Component::validate_checksum_(const uint8_t *data, size_t len, uint8_t expected_checksum) { - return calculate_checksum_(data, len) == expected_checksum; +static bool validate_checksum(const uint8_t *data, size_t len, uint8_t expected_checksum) { + return calculate_checksum(data, len) == expected_checksum; } void MR60BHA2Component::split_frame_(uint8_t buffer) { @@ -156,7 +156,7 @@ void MR60BHA2Component::split_frame_(uint8_t buffer) { } break; case LOCATE_HEAD_CKSUM_FRAME: - if (this->validate_checksum_(this->current_frame_buf_, this->current_frame_len_, buffer)) { + if (validate_checksum(this->current_frame_buf_, this->current_frame_len_, buffer)) { this->current_frame_len_++; this->current_frame_buf_[this->current_frame_len_ - 1] = buffer; this->current_frame_locate_++; @@ -182,7 +182,7 @@ void MR60BHA2Component::split_frame_(uint8_t buffer) { } break; case LOCATE_DATA_CKSUM_FRAME: - if (this->validate_checksum_(this->current_data_buf_, this->current_data_frame_len_, buffer)) { + if (validate_checksum(this->current_data_buf_, this->current_data_frame_len_, buffer)) { this->current_frame_len_++; this->current_frame_buf_[this->current_frame_len_ - 1] = buffer; this->current_frame_locate_++; diff --git a/esphome/components/seeed_mr60bha2/seeed_mr60bha2.h b/esphome/components/seeed_mr60bha2/seeed_mr60bha2.h index 416fd2f9de..6e7c52bf10 100644 --- a/esphome/components/seeed_mr60bha2/seeed_mr60bha2.h +++ b/esphome/components/seeed_mr60bha2/seeed_mr60bha2.h @@ -57,8 +57,6 @@ class MR60BHA2Component : public Component, uint32_t current_heart_rate_int_; uint32_t current_distance_int_; - bool validate_checksum_(const uint8_t *data, size_t len, uint8_t expected_checksum); - uint8_t calculate_checksum_(const uint8_t *data, size_t len); void split_frame_(uint8_t buffer); void process_frame_();