mirror of
https://github.com/esphome/esphome.git
synced 2025-04-23 09:00:48 +02:00
Fix: suggested changes
This commit is contained in:
parent
e0018288e1
commit
b741a04659
1 changed files with 6 additions and 4 deletions
|
@ -145,7 +145,8 @@ void MR60BHA2Component::split_frame_(uint8_t buffer) {
|
|||
this->current_frame_len_++;
|
||||
this->current_frame_buf_[this->current_frame_len_ - 1] = buffer;
|
||||
this->current_frame_locate_++;
|
||||
// ESP_LOGD(TAG, "GET CURRENT_FRAME_TYPE: 0x%02x 0x%02x", this->current_frame_buf_[this->current_frame_len_ - 2],
|
||||
// ESP_LOGD(TAG, "GET CURRENT_FRAME_TYPE: 0x%02x 0x%02x", this->current_frame_buf_[this->current_frame_len_ -
|
||||
// 2],
|
||||
// this->current_frame_buf_[this->current_frame_len_ - 1]);
|
||||
} else {
|
||||
// ESP_LOGD(TAG, "CURRENT_FRAME_TYPE NOT FOUND: 0x%02x 0x%02x",
|
||||
|
@ -228,9 +229,10 @@ void MR60BHA2Component::process_frame_() {
|
|||
if (!current_data_buf_[0]) {
|
||||
// ESP_LOGD(TAG, "Successfully set the mounting height");
|
||||
if (this->distance_sensor_ != nullptr) {
|
||||
this->current_distance_int_ =
|
||||
(static_cast<uint32_t>(current_data_buf_[7]) << 24) | (static_cast<uint32_t>(current_data_buf_[6]) << 16) |
|
||||
(static_cast<uint32_t>(current_data_buf_[5]) << 8) | static_cast<uint32_t>(current_data_buf_[4]);
|
||||
this->current_distance_int_ = (static_cast<uint32_t>(current_data_buf_[7]) << 24) |
|
||||
(static_cast<uint32_t>(current_data_buf_[6]) << 16) |
|
||||
(static_cast<uint32_t>(current_data_buf_[5]) << 8) |
|
||||
static_cast<uint32_t>(current_data_buf_[4]);
|
||||
float distance_float;
|
||||
memcpy(&distance_float, ¤t_distance_int_, sizeof(float));
|
||||
this->distance_sensor_->publish_state(distance_float);
|
||||
|
|
Loading…
Add table
Reference in a new issue