make powered on assume public (#1240)

This commit is contained in:
Guillermo Ruffino 2020-08-06 12:13:19 -03:00
parent dc4a88029c
commit 86df4c1d8d
2 changed files with 9 additions and 9 deletions

View file

@ -41,11 +41,11 @@ void WhirlpoolClimate::transmit_state() {
remote_state[18] = 0x08; remote_state[18] = 0x08;
auto powered_on = this->mode != climate::CLIMATE_MODE_OFF; auto powered_on = this->mode != climate::CLIMATE_MODE_OFF;
if (powered_on != this->powered_on_assumed_) { if (powered_on != this->powered_on_assumed) {
// Set power toggle command // Set power toggle command
remote_state[2] = 4; remote_state[2] = 4;
remote_state[15] = 1; remote_state[15] = 1;
this->powered_on_assumed_ = powered_on; this->powered_on_assumed = powered_on;
} }
switch (this->mode) { switch (this->mode) {
case climate::CLIMATE_MODE_AUTO: case climate::CLIMATE_MODE_AUTO:
@ -215,14 +215,14 @@ bool WhirlpoolClimate::on_receive(remote_base::RemoteReceiveData data) {
if (powered_on) { if (powered_on) {
this->mode = climate::CLIMATE_MODE_OFF; this->mode = climate::CLIMATE_MODE_OFF;
this->powered_on_assumed_ = false; this->powered_on_assumed = false;
} else { } else {
this->powered_on_assumed_ = true; this->powered_on_assumed = true;
} }
} }
// Set received mode // Set received mode
if (powered_on_assumed_) { if (powered_on_assumed) {
auto mode = remote_state[3] & 0x7; auto mode = remote_state[3] & 0x7;
ESP_LOGV(TAG, "Mode: %02X", mode); ESP_LOGV(TAG, "Mode: %02X", mode);
switch (mode) { switch (mode) {

View file

@ -28,7 +28,7 @@ class WhirlpoolClimate : public climate_ir::ClimateIR {
void setup() override { void setup() override {
climate_ir::ClimateIR::setup(); climate_ir::ClimateIR::setup();
this->powered_on_assumed_ = this->mode != climate::CLIMATE_MODE_OFF; this->powered_on_assumed = this->mode != climate::CLIMATE_MODE_OFF;
} }
/// Override control to change settings of the climate device. /// Override control to change settings of the climate device.
@ -39,15 +39,15 @@ class WhirlpoolClimate : public climate_ir::ClimateIR {
void set_model(Model model) { this->model_ = model; } void set_model(Model model) { this->model_ = model; }
// used to track when to send the power toggle command
bool powered_on_assumed;
protected: protected:
/// Transmit via IR the state of this climate controller. /// Transmit via IR the state of this climate controller.
void transmit_state() override; void transmit_state() override;
/// Handle received IR Buffer /// Handle received IR Buffer
bool on_receive(remote_base::RemoteReceiveData data) override; bool on_receive(remote_base::RemoteReceiveData data) override;
// used to track when to send the power toggle command
bool powered_on_assumed_;
bool send_swing_cmd_{false}; bool send_swing_cmd_{false};
Model model_; Model model_;