Remove esp8266 and delayed closure cases
This commit is contained in:
@@ -142,12 +142,6 @@ async def to_code(config):
|
||||
repository="https://github.com/ratgdo/secplus#f98c3220356c27717a25102c0b35815ebbd26ccc",
|
||||
version=None,
|
||||
)
|
||||
if CORE.is_esp8266:
|
||||
cg.add_library(
|
||||
name="espsoftwareserial",
|
||||
repository="https://github.com/ratgdo/espsoftwareserial#autobaud",
|
||||
version=None,
|
||||
)
|
||||
|
||||
cg.add_define("PROTOCOL_SECPLUSV2")
|
||||
cg.add(var.init_protocol())
|
||||
|
||||
@@ -28,15 +28,9 @@
|
||||
|
||||
#define LPAREN (
|
||||
|
||||
#ifdef USE_ESP8266
|
||||
#define TO_STRING_IF0(type, name, val) \
|
||||
if (_e == type::name) \
|
||||
return LOG_STR(#name);
|
||||
#else
|
||||
#define TO_STRING_IF0(type, name, val) \
|
||||
if (_e == type::name) \
|
||||
return #name;
|
||||
#endif
|
||||
#define TO_STRING_IF(type, tuple) TO_STRING_IF0 LPAREN type, TUPLE tuple)
|
||||
|
||||
#define FROM_INT_CASE0(type, name, val) \
|
||||
@@ -77,17 +71,10 @@ namespace detail {
|
||||
} // namespace esphome::ratgdo
|
||||
|
||||
// Platform-specific helpers for enum string return types
|
||||
#ifdef USE_ESP8266
|
||||
#define ENUM_STR_RET const esphome::LogString*
|
||||
#define ENUM_STR_UNKNOWN LOG_STR("UNKNOWN")
|
||||
#define ENUM_BLOB_ATTR PROGMEM
|
||||
#define ENUM_BLOB_RETURN(blob, offset) reinterpret_cast<const esphome::LogString*>(&(blob)[offset])
|
||||
#else
|
||||
#define ENUM_STR_RET const char*
|
||||
#define ENUM_STR_UNKNOWN "UNKNOWN"
|
||||
#define ENUM_BLOB_ATTR
|
||||
#define ENUM_BLOB_RETURN(blob, offset) (&(blob)[offset])
|
||||
#endif
|
||||
|
||||
// ENUM: packed string blob with O(1) offset lookup (for contiguous 0-based enums with uint8_t type)
|
||||
#define ENUM(name, type, ...) \
|
||||
|
||||
@@ -19,7 +19,6 @@ TYPES = {
|
||||
"rolling_code_counter": NumberType.RATGDO_ROLLING_CODE_COUNTER,
|
||||
"opening_duration": NumberType.RATGDO_OPENING_DURATION,
|
||||
"closing_duration": NumberType.RATGDO_CLOSING_DURATION,
|
||||
"closing_delay": NumberType.RATGDO_CLOSING_DELAY,
|
||||
"target_distance_measurement": NumberType.RATGDO_TARGET_DISTANCE_MEASUREMENT,
|
||||
}
|
||||
|
||||
@@ -51,8 +50,3 @@ async def to_code(config):
|
||||
await cg.register_component(var, config)
|
||||
cg.add(var.set_number_type(config[CONF_TYPE]))
|
||||
await register_ratgdo_child(var, config)
|
||||
|
||||
# Add defines for enabled features
|
||||
# sensor will add the define for the distance sensor
|
||||
if config[CONF_TYPE] == "closing_delay":
|
||||
cg.add_define("RATGDO_USE_CLOSING_DELAY")
|
||||
|
||||
@@ -34,11 +34,6 @@ void RATGDONumber::dump_config()
|
||||
case RATGDO_CLOSING_DURATION:
|
||||
ESP_LOGCONFIG(TAG, " Type: Closing Duration");
|
||||
break;
|
||||
#ifdef RATGDO_USE_CLOSING_DELAY
|
||||
case RATGDO_CLOSING_DELAY:
|
||||
ESP_LOGCONFIG(TAG, " Type: Closing Delay");
|
||||
break;
|
||||
#endif
|
||||
#ifdef RATGDO_USE_DISTANCE_SENSOR
|
||||
case RATGDO_TARGET_DISTANCE_MEASUREMENT:
|
||||
ESP_LOGCONFIG(TAG, " Type: Target Distance Measurement");
|
||||
@@ -86,13 +81,6 @@ void RATGDONumber::setup()
|
||||
this->update_state(value);
|
||||
});
|
||||
break;
|
||||
#ifdef RATGDO_USE_CLOSING_DELAY
|
||||
case RATGDO_CLOSING_DELAY:
|
||||
this->parent_->subscribe_closing_delay([this](uint32_t value) {
|
||||
this->update_state(value);
|
||||
});
|
||||
break;
|
||||
#endif
|
||||
#ifdef RATGDO_USE_DISTANCE_SENSOR
|
||||
case RATGDO_TARGET_DISTANCE_MEASUREMENT:
|
||||
// this->parent_->subscribe_target_distance_measurement([=](float value) {
|
||||
@@ -115,13 +103,6 @@ void RATGDONumber::set_number_type(NumberType number_type_)
|
||||
this->traits.set_min_value(0.0);
|
||||
this->traits.set_max_value(180.0);
|
||||
break;
|
||||
#ifdef RATGDO_USE_CLOSING_DELAY
|
||||
case RATGDO_CLOSING_DELAY:
|
||||
this->traits.set_step(1);
|
||||
this->traits.set_min_value(0.0);
|
||||
this->traits.set_max_value(60.0);
|
||||
break;
|
||||
#endif
|
||||
case RATGDO_ROLLING_CODE_COUNTER:
|
||||
this->traits.set_max_value(0xfffffff);
|
||||
break;
|
||||
@@ -163,11 +144,6 @@ void RATGDONumber::control(float value)
|
||||
case RATGDO_CLOSING_DURATION:
|
||||
this->parent_->set_closing_duration(value);
|
||||
break;
|
||||
#ifdef RATGDO_USE_CLOSING_DELAY
|
||||
case RATGDO_CLOSING_DELAY:
|
||||
this->parent_->set_closing_delay(value);
|
||||
break;
|
||||
#endif
|
||||
case RATGDO_CLIENT_ID:
|
||||
value = normalize_client_id(value);
|
||||
this->parent_->call_protocol(SetClientID { static_cast<uint32_t>(value) });
|
||||
|
||||
@@ -13,9 +13,6 @@ enum NumberType {
|
||||
RATGDO_ROLLING_CODE_COUNTER,
|
||||
RATGDO_OPENING_DURATION,
|
||||
RATGDO_CLOSING_DURATION,
|
||||
#ifdef RATGDO_USE_CLOSING_DELAY
|
||||
RATGDO_CLOSING_DELAY,
|
||||
#endif
|
||||
#ifdef RATGDO_USE_DISTANCE_SENSOR
|
||||
RATGDO_TARGET_DISTANCE_MEASUREMENT,
|
||||
#endif
|
||||
|
||||
@@ -379,19 +379,7 @@ void RATGDOComponent::door_toggle() { this->door_action(DoorAction::TOGGLE); }
|
||||
|
||||
void RATGDOComponent::door_action(DoorAction action)
|
||||
{
|
||||
#ifdef RATGDO_USE_CLOSING_DELAY
|
||||
if (*this->closing_delay > 0 && (action == DoorAction::CLOSE || (action == DoorAction::TOGGLE && *this->door_state != DoorState::CLOSED))) {
|
||||
this->door_action_delayed = DoorActionDelayed::YES;
|
||||
this->set_timeout(TIMEOUT_DOOR_ACTION, *this->closing_delay * 1000, [this] {
|
||||
this->door_action_delayed = DoorActionDelayed::NO;
|
||||
this->protocol_->door_action(DoorAction::CLOSE);
|
||||
});
|
||||
} else {
|
||||
this->protocol_->door_action(action);
|
||||
}
|
||||
#else
|
||||
this->protocol_->door_action(action);
|
||||
#endif
|
||||
}
|
||||
|
||||
void RATGDOComponent::door_move_to_position(float position)
|
||||
|
||||
@@ -72,9 +72,6 @@ public:
|
||||
single_observable<float> opening_duration { 0 };
|
||||
float start_closing { -1 };
|
||||
single_observable<float> closing_duration { 0 };
|
||||
#ifdef RATGDO_USE_CLOSING_DELAY
|
||||
single_observable<uint32_t> closing_delay { 0 };
|
||||
#endif
|
||||
|
||||
#ifdef RATGDO_USE_DISTANCE_SENSOR
|
||||
single_observable<int16_t> target_distance_measurement { -1 };
|
||||
@@ -122,9 +119,6 @@ public:
|
||||
void set_door_position(float door_position) { this->door_position = door_position; }
|
||||
void set_opening_duration(float duration);
|
||||
void set_closing_duration(float duration);
|
||||
#ifdef RATGDO_USE_CLOSING_DELAY
|
||||
void set_closing_delay(uint32_t delay) { this->closing_delay = delay; }
|
||||
#endif
|
||||
void schedule_door_position_sync(float update_period = 500);
|
||||
void door_position_update();
|
||||
void cancel_position_sync_callbacks();
|
||||
@@ -198,10 +192,6 @@ public:
|
||||
void subscribe_opening_duration(F&& f);
|
||||
template <typename F>
|
||||
void subscribe_closing_duration(F&& f);
|
||||
#ifdef RATGDO_USE_CLOSING_DELAY
|
||||
template <typename F>
|
||||
void subscribe_closing_delay(F&& f);
|
||||
#endif
|
||||
template <typename F>
|
||||
void subscribe_openings(F&& f);
|
||||
template <typename F>
|
||||
@@ -278,7 +268,6 @@ namespace scheduler_ids {
|
||||
DEFER_ROLLING_CODE = DEFER_DISTANCE_END,
|
||||
DEFER_OPENING_DURATION,
|
||||
DEFER_CLOSING_DURATION,
|
||||
DEFER_CLOSING_DELAY,
|
||||
DEFER_OPENINGS,
|
||||
DEFER_LIGHT_STATE,
|
||||
DEFER_LOCK_STATE,
|
||||
@@ -326,16 +315,6 @@ void RATGDOComponent::subscribe_closing_duration(F&& f)
|
||||
});
|
||||
}
|
||||
|
||||
#ifdef RATGDO_USE_CLOSING_DELAY
|
||||
template <typename F>
|
||||
void RATGDOComponent::subscribe_closing_delay(F&& f)
|
||||
{
|
||||
this->closing_delay.subscribe([this, f](uint32_t state) {
|
||||
defer(scheduler_ids::DEFER_CLOSING_DELAY, [f, state] { f(state); });
|
||||
});
|
||||
}
|
||||
#endif
|
||||
|
||||
template <typename F>
|
||||
void RATGDOComponent::subscribe_openings(F&& f)
|
||||
{
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
#pragma once
|
||||
|
||||
#include "esphome/core/defines.h"
|
||||
|
||||
#ifdef USE_ESP32
|
||||
#include "ratgdo_uart_esp32.h"
|
||||
#elif defined(USE_ESP8266)
|
||||
#include "ratgdo_uart_esp8266.h"
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user