Skip to content

Commit

Permalink
Revert ifdefs added in #265
Browse files Browse the repository at this point in the history
All boards support dry contacts, the ifdefs are incorrect
  • Loading branch information
bdraco committed Jul 3, 2024
1 parent 38d2508 commit 3922764
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 19 deletions.
7 changes: 1 addition & 6 deletions components/ratgdo/dry_contact.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@

#include "ratgdo.h"

#ifdef PROTOCOL_DRYCONTACT

#include "dry_contact.h"
#include "esphome/core/gpio.h"
#include "esphome/core/log.h"
#include "esphome/core/scheduler.h"
#include "ratgdo.h"

namespace esphome {
namespace ratgdo {
Expand Down Expand Up @@ -132,5 +129,3 @@ namespace ratgdo {
} // namespace dry_contact
} // namespace ratgdo
} // namespace esphome

#endif
4 changes: 0 additions & 4 deletions components/ratgdo/dry_contact.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

#include "esphome/core/defines.h"

#ifdef PROTOCOL_DRYCONTACT

#include "SoftwareSerial.h" // Using espsoftwareserial https://github.com/plerup/espsoftwareserial
#include "esphome/core/gpio.h"
#include "esphome/core/optional.h"
Expand Down Expand Up @@ -78,5 +76,3 @@ namespace ratgdo {
} // namespace dry_contact
} // namespace ratgdo
} // namespace esphome

#endif
2 changes: 0 additions & 2 deletions components/ratgdo/ratgdo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,6 @@ namespace ratgdo {
this->learn_state.subscribe([=](LearnState state) { defer("learn_state", [=] { f(state); }); });
}

#ifdef PROTOCOL_DRYCONTACT
// dry contact methods
void RATGDOComponent::set_dry_contact_open_sensor(esphome::binary_sensor::BinarySensor* dry_contact_open_sensor)
{
Expand All @@ -697,7 +696,6 @@ namespace ratgdo {
this->protocol_->set_close_limit(sensor_value);
});
}
#endif

} // namespace ratgdo
} // namespace esphome
8 changes: 1 addition & 7 deletions components/ratgdo/ratgdo.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@

#pragma once

#include "esphome/components/binary_sensor/binary_sensor.h"
#include "esphome/core/component.h"
#include "esphome/core/defines.h"
#include "esphome/core/hal.h"
#include "esphome/core/preferences.h"
#ifdef PROTOCOL_DRYCONTACT
#include "esphome/components/binary_sensor/binary_sensor.h"
#endif

#include "callbacks.h"
#include "macros.h"
Expand Down Expand Up @@ -95,13 +93,11 @@ namespace ratgdo {
void set_input_gdo_pin(InternalGPIOPin* pin) { this->input_gdo_pin_ = pin; }
void set_input_obst_pin(InternalGPIOPin* pin) { this->input_obst_pin_ = pin; }

#ifdef PROTOCOL_DRYCONTACT
// dry contact methods
void set_dry_contact_open_sensor(esphome::binary_sensor::BinarySensor* dry_contact_open_sensor_);
void set_dry_contact_close_sensor(esphome::binary_sensor::BinarySensor* dry_contact_close_sensor_);
void set_discrete_open_pin(InternalGPIOPin* pin) { this->protocol_->set_discrete_open_pin(pin); }
void set_discrete_close_pin(InternalGPIOPin* pin) { this->protocol_->set_discrete_close_pin(pin); }
#endif

Result call_protocol(Args args);

Expand Down Expand Up @@ -186,10 +182,8 @@ namespace ratgdo {
InternalGPIOPin* output_gdo_pin_;
InternalGPIOPin* input_gdo_pin_;
InternalGPIOPin* input_obst_pin_;
#ifdef PROTOCOL_DRYCONTACT
esphome::binary_sensor::BinarySensor* dry_contact_open_sensor_;
esphome::binary_sensor::BinarySensor* dry_contact_close_sensor_;
#endif
}; // RATGDOComponent

} // namespace ratgdo
Expand Down

0 comments on commit 3922764

Please sign in to comment.