From 7a9a8e3eb62ecf684af1a28d967a28af4a4ac989 Mon Sep 17 00:00:00 2001 From: KoenBreeman <121864590+KoenBreeman@users.noreply.github.com> Date: Fri, 16 Aug 2024 11:58:58 +0200 Subject: [PATCH] Changed names back to name without underscore --- .../components/m5stack_4relay/m5stack_4relay.cpp | 14 +++++++------- esphome/components/m5stack_4relay/m5stack_4relay.h | 2 +- .../switch/m5stack_4relay_switch.cpp | 10 +++++----- .../m5stack_4relay/switch/m5stack_4relay_switch.h | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/esphome/components/m5stack_4relay/m5stack_4relay.cpp b/esphome/components/m5stack_4relay/m5stack_4relay.cpp index 82fe39223e..fd350fa1b4 100644 --- a/esphome/components/m5stack_4relay/m5stack_4relay.cpp +++ b/esphome/components/m5stack_4relay/m5stack_4relay.cpp @@ -6,20 +6,20 @@ namespace m5stack_4relay { static const char *const TAG = "m5stack_4_relay"; -void M5Stack_4Relay::dump_config() { +void M5Stack4Relay::dump_config() { ESP_LOGCONFIG(TAG, "M5Stack 4 Relays:"); LOG_I2C_DEVICE(this); } /*! @brief Setting the mode of the device, and turn off all relays, restore the switches with restore mode. * @param mode Async = 0, Sync = 1. */ -void M5Stack_4Relay::init_(bool mode) { +void M5Stack4Relay::init_(bool mode) { this->write1_byte_(UNIT_4RELAY_REG, mode); this->write1_byte_(UNIT_4RELAY_RELAY_REG, 0); } /*! @brief Read a certain length of data to the specified register address. */ -uint8_t M5Stack_4Relay::read1_byte_(uint8_t register_address) { +uint8_t M5Stack4Relay::read1_byte_(uint8_t register_address) { uint8_t data; if (!this->read_byte(register_address, &data)) { ESP_LOGW(TAG, "Read from relay failed!"); @@ -32,7 +32,7 @@ uint8_t M5Stack_4Relay::read1_byte_(uint8_t register_address) { /*! @brief Control the on/off of the specified relay. * @param number Bit number of relay (0~3). @param state OFF = 0, ON = 1 . */ -void M5Stack_4Relay::relay_write(uint8_t number, bool state) { +void M5Stack4Relay::relay_write(uint8_t number, bool state) { uint8_t state_from_device = this->read1_byte_(UNIT_4RELAY_RELAY_REG); if (state == 0) { state_from_device &= ~(0x01 << number); @@ -42,7 +42,7 @@ void M5Stack_4Relay::relay_write(uint8_t number, bool state) { this->write1_byte_(UNIT_4RELAY_RELAY_REG, state_from_device); } -void M5Stack_4Relay::setup() { +void M5Stack4Relay::setup() { ESP_LOGCONFIG(TAG, "Setting up M5Stack_4_Relays..."); uint8_t setupmode = 1; this->init_(setupmode); @@ -50,10 +50,10 @@ void M5Stack_4Relay::setup() { /*! @brief Setting the mode of the device. * @param mode Async = 0, Sync = 1. */ -void M5Stack_4Relay::set_switch_mode(bool mode) { this->write1_byte_(UNIT_4RELAY_REG, mode); } +void M5Stack4Relay::set_switch_mode(bool mode) { this->write1_byte_(UNIT_4RELAY_REG, mode); } /*! @brief Write a certain length of data to the specified register address. */ -void M5Stack_4Relay::write1_byte_(uint8_t register_address, uint8_t data) { +void M5Stack4Relay::write1_byte_(uint8_t register_address, uint8_t data) { if (!this->write_byte(register_address, data)) { ESP_LOGW(TAG, "Write to relay failed!"); this->status_set_warning(); diff --git a/esphome/components/m5stack_4relay/m5stack_4relay.h b/esphome/components/m5stack_4relay/m5stack_4relay.h index b074d8bf78..aa891adb3c 100644 --- a/esphome/components/m5stack_4relay/m5stack_4relay.h +++ b/esphome/components/m5stack_4relay/m5stack_4relay.h @@ -9,7 +9,7 @@ namespace m5stack_4relay { static constexpr uint8_t UNIT_4RELAY_REG = 0X10; static constexpr uint8_t UNIT_4RELAY_RELAY_REG = 0X11; -class M5Stack_4Relay : public Component, public i2c::I2CDevice { +class M5Stack4Relay : public Component, public i2c::I2CDevice { public: void set_switch_mode(bool mode); diff --git a/esphome/components/m5stack_4relay/switch/m5stack_4relay_switch.cpp b/esphome/components/m5stack_4relay/switch/m5stack_4relay_switch.cpp index 8bfe1c0ecb..1c237f0d07 100644 --- a/esphome/components/m5stack_4relay/switch/m5stack_4relay_switch.cpp +++ b/esphome/components/m5stack_4relay/switch/m5stack_4relay_switch.cpp @@ -6,9 +6,9 @@ namespace m5stack_4relay { static const char *const TAG = "switch.M5Stack_4_Relay"; -float M5Stack_4RelaySwitch::get_setup_priority() const { return setup_priority::HARDWARE; } +float M5Stack4RelaySwitch::get_setup_priority() const { return setup_priority::HARDWARE; } -void M5Stack_4RelaySwitch::setup() { +void M5Stack4RelaySwitch::setup() { ESP_LOGCONFIG(TAG, "Setting up M5Stack_4_relay Switch '%s'...", this->name_.c_str()); bool initial_state = this->get_initial_state_with_restore_mode().value_or(false); @@ -21,7 +21,7 @@ void M5Stack_4RelaySwitch::setup() { } } -void M5Stack_4RelaySwitch::dump_config() { +void M5Stack4RelaySwitch::dump_config() { LOG_SWITCH("", "M5Stack_4Relay Switch", this); ESP_LOGCONFIG(TAG, " Channel: %u", this->channel_); @@ -35,7 +35,7 @@ void M5Stack_4RelaySwitch::dump_config() { } } -void M5Stack_4RelaySwitch::write_state(bool state) { +void M5Stack4RelaySwitch::write_state(bool state) { if (state != this->inverted_) { // Turning ON, check interlocking @@ -70,7 +70,7 @@ void M5Stack_4RelaySwitch::write_state(bool state) { this->publish_state(state); } -void M5Stack_4RelaySwitch::set_interlock(const std::vector &interlock) { this->interlock_ = interlock; } +void M5Stack4RelaySwitch::set_interlock(const std::vector &interlock) { this->interlock_ = interlock; } } // namespace m5stack_4relay } // namespace esphome diff --git a/esphome/components/m5stack_4relay/switch/m5stack_4relay_switch.h b/esphome/components/m5stack_4relay/switch/m5stack_4relay_switch.h index 6b284d5f7f..0973c70e1d 100644 --- a/esphome/components/m5stack_4relay/switch/m5stack_4relay_switch.h +++ b/esphome/components/m5stack_4relay/switch/m5stack_4relay_switch.h @@ -8,7 +8,7 @@ namespace esphome { namespace m5stack_4relay { -class M5Stack_4RelaySwitch : public Component, public switch_::Switch, public Parented { +class M5Stack4RelaySwitch : public Component, public switch_::Switch, public Parented { public: float get_setup_priority() const override;