mirror of
https://github.com/esphome/esphome.git
synced 2024-11-27 09:18:00 +01:00
fix(mr60fda2): variable is used uninitialized whenever 'if' condition is false
This commit is contained in:
parent
83a0c7b4db
commit
ac8eccd7ca
1 changed files with 2 additions and 4 deletions
|
@ -251,14 +251,12 @@ void MR60FDA2Component::process_frame_() {
|
||||||
this->current_frame_locate_ = LOCATE_FRAME_HEADER;
|
this->current_frame_locate_ = LOCATE_FRAME_HEADER;
|
||||||
break;
|
break;
|
||||||
case RESULT_PARAMETERS:
|
case RESULT_PARAMETERS:
|
||||||
float install_height_float;
|
|
||||||
float height_threshold_float;
|
|
||||||
|
|
||||||
if (this->install_height_select_ != nullptr) {
|
if (this->install_height_select_ != nullptr) {
|
||||||
this->current_install_height_int_ =
|
this->current_install_height_int_ =
|
||||||
encode_uint32(current_data_buf_[3], current_data_buf_[2], current_data_buf_[1], current_data_buf_[0]);
|
encode_uint32(current_data_buf_[3], current_data_buf_[2], current_data_buf_[1], current_data_buf_[0]);
|
||||||
|
|
||||||
install_height_float = bit_cast<float>(current_install_height_int_);
|
float install_height_float = bit_cast<float>(current_install_height_int_);
|
||||||
select_index_ = find_nearest_index(install_height_float, INSTALL_HEIGHT, 7);
|
select_index_ = find_nearest_index(install_height_float, INSTALL_HEIGHT, 7);
|
||||||
this->install_height_select_->publish_state(this->install_height_select_->at(select_index_).value());
|
this->install_height_select_->publish_state(this->install_height_select_->at(select_index_).value());
|
||||||
}
|
}
|
||||||
|
@ -267,7 +265,7 @@ void MR60FDA2Component::process_frame_() {
|
||||||
this->current_height_threshold_int_ =
|
this->current_height_threshold_int_ =
|
||||||
encode_uint32(current_data_buf_[7], current_data_buf_[6], current_data_buf_[5], current_data_buf_[4]);
|
encode_uint32(current_data_buf_[7], current_data_buf_[6], current_data_buf_[5], current_data_buf_[4]);
|
||||||
|
|
||||||
height_threshold_float = bit_cast<float>(current_height_threshold_int_);
|
float height_threshold_float = bit_cast<float>(current_height_threshold_int_);
|
||||||
select_index_ = find_nearest_index(height_threshold_float, HEIGHT_THRESHOLD, 7);
|
select_index_ = find_nearest_index(height_threshold_float, HEIGHT_THRESHOLD, 7);
|
||||||
this->height_threshold_select_->publish_state(this->height_threshold_select_->at(select_index_).value());
|
this->height_threshold_select_->publish_state(this->height_threshold_select_->at(select_index_).value());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue