mirror of
https://github.com/esphome/esphome.git
synced 2025-11-01 07:31:51 +00:00
preen
This commit is contained in:
@@ -13,7 +13,7 @@ SelectCall &SelectCall::set_option(const std::string &option) {
|
||||
|
||||
SelectCall &SelectCall::set_option(const char *option) { return with_operation(SELECT_OP_SET).with_option(option); }
|
||||
|
||||
SelectCall &SelectCall::set_index(size_t index) { return with_operation(SELECT_OP_SET_INDEX).with_index(index); }
|
||||
SelectCall &SelectCall::set_index(size_t index) { return with_operation(SELECT_OP_SET).with_index(index); }
|
||||
|
||||
SelectCall &SelectCall::select_next(bool cycle) { return with_operation(SELECT_OP_NEXT).with_cycle(cycle); }
|
||||
|
||||
@@ -61,7 +61,8 @@ optional<size_t> SelectCall::calculate_target_index_(const char *name) {
|
||||
return options.size() - 1;
|
||||
}
|
||||
|
||||
if (this->operation_ == SELECT_OP_SET || this->operation_ == SELECT_OP_SET_INDEX) {
|
||||
if (this->operation_ == SELECT_OP_SET) {
|
||||
ESP_LOGD(TAG, "'%s' - Setting", name);
|
||||
if (!this->index_.has_value()) {
|
||||
ESP_LOGW(TAG, "'%s' - No option set", name);
|
||||
return {};
|
||||
@@ -71,9 +72,6 @@ optional<size_t> SelectCall::calculate_target_index_(const char *name) {
|
||||
ESP_LOGW(TAG, "'%s' - Index value %zu out of bounds", name, idx);
|
||||
return {};
|
||||
}
|
||||
if (this->operation_ == SELECT_OP_SET) {
|
||||
ESP_LOGD(TAG, "'%s' - Setting", name);
|
||||
}
|
||||
return idx;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ class Select;
|
||||
enum SelectOperation {
|
||||
SELECT_OP_NONE,
|
||||
SELECT_OP_SET,
|
||||
SELECT_OP_SET_INDEX,
|
||||
SELECT_OP_NEXT,
|
||||
SELECT_OP_PREVIOUS,
|
||||
SELECT_OP_FIRST,
|
||||
|
||||
Reference in New Issue
Block a user