mirror of
https://github.com/esphome/esphome.git
synced 2024-11-27 09:18:00 +01:00
refactor(mr60fda2): get the string from the select itself
This commit is contained in:
parent
09cb47d427
commit
31d27cb8db
1 changed files with 3 additions and 3 deletions
|
@ -285,17 +285,17 @@ void MR60FDA2Component::process_frame_() {
|
|||
float install_height_float;
|
||||
memcpy(&install_height_float, ¤t_install_height_int_, sizeof(float));
|
||||
select_index_ = find_nearest_index_(install_height_float, INSTALL_HEIGHT, 7);
|
||||
this->install_height_select_->publish_state(INSTALL_HEIGHT_STR[select_index_]);
|
||||
this->install_height_select_->publish_state(this->install_height_select_.at(select_index_));
|
||||
this->current_height_threshold_int_ =
|
||||
encode_uint32(current_data_buf_[7], current_data_buf_[6], current_data_buf_[5], current_data_buf_[4]);
|
||||
float height_threshold_float;
|
||||
memcpy(&height_threshold_float, ¤t_height_threshold_int_, sizeof(float));
|
||||
select_index_ = find_nearest_index_(height_threshold_float, HEIGHT_THRESHOLD, 7);
|
||||
this->height_threshold_select_->publish_state(HEIGHT_THRESHOLD_STR[select_index_]);
|
||||
this->height_threshold_select_->publish_state(this->height_threshold_select_.at(select_index_));
|
||||
this->current_sensitivity_ =
|
||||
encode_uint32(current_data_buf_[11], current_data_buf_[10], current_data_buf_[9], current_data_buf_[8]);
|
||||
select_index_ = find_nearest_index_(this->current_sensitivity_, SENSITIVITY, 3);
|
||||
this->sensitivity_select_->publish_state(SENSITIVITY_STR[select_index_]);
|
||||
this->sensitivity_select_->publish_state(this->sensitivity_select_.at(select_index_));
|
||||
ESP_LOGD(TAG, "Mounting height: %.2f, Height threshold: %.2f, Sensitivity: %u", install_height_float,
|
||||
height_threshold_float, this->current_sensitivity_);
|
||||
this->current_frame_locate_ = LOCATE_FRAME_HEADER;
|
||||
|
|
Loading…
Reference in a new issue