make powered on assume public (#1240)

This commit is contained in:
Guillermo Ruffino 2020-08-06 12:13:19 -03:00 committed by GitHub
parent fd6ac529fb
commit aad9a539c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 9 deletions

View File

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

View File

@ -28,7 +28,7 @@ class WhirlpoolClimate : public climate_ir::ClimateIR {
void setup() override {
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.
@ -39,15 +39,15 @@ class WhirlpoolClimate : public climate_ir::ClimateIR {
void set_model(Model model) { this->model_ = model; }
// used to track when to send the power toggle command
bool powered_on_assumed;
protected:
/// Transmit via IR the state of this climate controller.
void transmit_state() override;
/// Handle received IR Buffer
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};
Model model_;