some name changes

This commit is contained in:
Daniël Koek 2024-04-28 17:54:17 +01:00
parent 08d57c1266
commit 13bf7cdc0b
3 changed files with 11 additions and 10 deletions

View file

@ -90,11 +90,11 @@ CONFIG_SCHEMA = (
{ {
cv.GenerateID(): cv.declare_id(EbyteLoraComponent), cv.GenerateID(): cv.declare_id(EbyteLoraComponent),
# for communication to let us know that we can receive data # for communication to let us know that we can receive data
cv.Required(CONF_PIN_AUX): pins.gpio_input_pin_schema, cv.Required(CONF_PIN_AUX): pins.internal_gpio_input_pin_schema,
# for communication set the mode # for communication set the mode
cv.Required(CONF_PIN_M0): pins.gpio_output_pin_schema, cv.Required(CONF_PIN_M0): pins.internal_gpio_output_pin_schema,
# for communication set the mode # for communication set the mode
cv.Required(CONF_PIN_M1): pins.gpio_output_pin_schema, cv.Required(CONF_PIN_M1): pins.internal_gpio_output_pin_schema,
# if you want to see the rssi # if you want to see the rssi
cv.Optional(CONF_LORA_RSSI): sensor.sensor_schema( cv.Optional(CONF_LORA_RSSI): sensor.sensor_schema(
device_class=DEVICE_CLASS_SIGNAL_STRENGTH, device_class=DEVICE_CLASS_SIGNAL_STRENGTH,

View file

@ -122,8 +122,9 @@ void EbyteLoraComponent::set_mode_(ModeType mode) {
if (!this->can_send_message_()) { if (!this->can_send_message_()) {
return; return;
} }
if (this->pin_m0_ == nullptr && this->pin_m1_ == nullptr) { if (this->pin_m0_ == nullptr || this->pin_m1_ == nullptr) {
ESP_LOGD(TAG, "The M0 and M1 pins is not set, this mean that you are connect directly the pins as you need!"); ESP_LOGD(TAG, "The M0 and M1 pins is not set, this mean that you are connect directly the pins as you need!");
return;
} else { } else {
switch (mode) { switch (mode) {
case NORMAL: case NORMAL:

View file

@ -31,10 +31,10 @@ class EbyteLoraComponent : public PollingComponent, public uart::UARTDevice {
/// Helper function to write the value of a pin. /// Helper function to write the value of a pin.
void digital_write(uint8_t pin, bool value); void digital_write(uint8_t pin, bool value);
void set_rssi_sensor(sensor::Sensor *rssi_sensor) { rssi_sensor_ = rssi_sensor; } void set_rssi_sensor(sensor::Sensor *rssi_sensor) { rssi_sensor_ = rssi_sensor; }
void set_pin_aux(GPIOPin *pin_aux) { pin_aux_ = pin_aux; } void set_pin_aux(InternalGPIOPin *pin_aux) { pin_aux_ = pin_aux; }
void register_sensor(EbyteLoraSwitch *obj) { this->sensors_.push_back(obj); } void register_sensor(EbyteLoraSwitch *obj) { this->sensors_.push_back(obj); }
void set_pin_m0(GPIOPin *pin_m0) { pin_m0_ = pin_m0; } void set_pin_m0(InternalGPIOPin *pin_m0) { pin_m0_ = pin_m0; }
void set_pin_m1(GPIOPin *pin_m1) { pin_m1_ = pin_m1; } void set_pin_m1(InternalGPIOPin *pin_m1) { pin_m1_ = pin_m1; }
void set_uart_bps(UartBpsSpeed bps_speed) { expected_config_.uart_baud = bps_speed; } void set_uart_bps(UartBpsSpeed bps_speed) { expected_config_.uart_baud = bps_speed; }
void set_transmission_mode(TransmissionMode mode) { expected_config_.transmission_mode = mode; } void set_transmission_mode(TransmissionMode mode) { expected_config_.transmission_mode = mode; }
void set_transmission_power(TransmissionPower power) { expected_config_.transmission_power = power; } void set_transmission_power(TransmissionPower power) { expected_config_.transmission_power = power; }
@ -69,9 +69,9 @@ class EbyteLoraComponent : public PollingComponent, public uart::UARTDevice {
RegisterConfig current_config_; RegisterConfig current_config_;
RegisterConfig expected_config_; RegisterConfig expected_config_;
sensor::Sensor *rssi_sensor_{nullptr}; sensor::Sensor *rssi_sensor_{nullptr};
GPIOPin *pin_aux_{nullptr}; InternalGPIOPin *pin_aux_{nullptr};
GPIOPin *pin_m0_{nullptr}; InternalGPIOPin *pin_m0_{nullptr};
GPIOPin *pin_m1_{nullptr}; InternalGPIOPin *pin_m1_{nullptr};
}; };
class EbyteLoraSwitch : public switch_::Switch, public Component { class EbyteLoraSwitch : public switch_::Switch, public Component {
public: public: