Remove switch actions during config; bump setup priority (#4563)

This commit is contained in:
Keith Burzinski 2023-03-15 00:21:23 -05:00 committed by Jesse Hills
parent 11eb5cb0fa
commit 83f8e84247
No known key found for this signature in database
GPG key ID: BEAAE804EFD8E83A
2 changed files with 1 additions and 7 deletions

View file

@ -477,7 +477,6 @@ void Sprinkler::configure_valve_switch(size_t valve_number, switch_::Switch *val
if (this->is_a_valid_valve(valve_number)) { if (this->is_a_valid_valve(valve_number)) {
this->valve_[valve_number].valve_switch.set_on_switch(valve_switch); this->valve_[valve_number].valve_switch.set_on_switch(valve_switch);
this->valve_[valve_number].run_duration = run_duration; this->valve_[valve_number].run_duration = run_duration;
valve_switch->turn_off();
} }
} }
@ -489,8 +488,6 @@ void Sprinkler::configure_valve_switch_pulsed(size_t valve_number, switch_::Swit
this->valve_[valve_number].valve_switch.set_on_switch(valve_switch_on); this->valve_[valve_number].valve_switch.set_on_switch(valve_switch_on);
this->valve_[valve_number].valve_switch.set_pulse_duration(pulse_duration); this->valve_[valve_number].valve_switch.set_pulse_duration(pulse_duration);
this->valve_[valve_number].run_duration = run_duration; this->valve_[valve_number].run_duration = run_duration;
valve_switch_off->turn_off();
valve_switch_on->turn_off();
} }
} }
@ -505,7 +502,6 @@ void Sprinkler::configure_valve_pump_switch(size_t valve_number, switch_::Switch
this->pump_.resize(this->pump_.size() + 1); this->pump_.resize(this->pump_.size() + 1);
this->pump_.back().set_on_switch(pump_switch); this->pump_.back().set_on_switch(pump_switch);
this->valve_[valve_number].pump_switch_index = this->pump_.size() - 1; // save the index to the new pump this->valve_[valve_number].pump_switch_index = this->pump_.size() - 1; // save the index to the new pump
pump_switch->turn_off();
} }
} }
@ -524,8 +520,6 @@ void Sprinkler::configure_valve_pump_switch_pulsed(size_t valve_number, switch_:
this->pump_.back().set_on_switch(pump_switch_on); this->pump_.back().set_on_switch(pump_switch_on);
this->pump_.back().set_pulse_duration(pulse_duration); this->pump_.back().set_pulse_duration(pulse_duration);
this->valve_[valve_number].pump_switch_index = this->pump_.size() - 1; // save the index to the new pump this->valve_[valve_number].pump_switch_index = this->pump_.size() - 1; // save the index to the new pump
pump_switch_off->turn_off();
pump_switch_on->turn_off();
} }
} }

View file

@ -103,7 +103,7 @@ class SprinklerControllerNumber : public number::Number, public Component {
public: public:
void setup() override; void setup() override;
void dump_config() override; void dump_config() override;
float get_setup_priority() const override { return setup_priority::HARDWARE; } float get_setup_priority() const override { return setup_priority::PROCESSOR; }
Trigger<float> *get_set_trigger() const { return set_trigger_; } Trigger<float> *get_set_trigger() const { return set_trigger_; }
void set_initial_value(float initial_value) { initial_value_ = initial_value; } void set_initial_value(float initial_value) { initial_value_ = initial_value; }