mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-06-01 18:48:28 +02:00
Activate some clang-tidy checks (#1884)
This commit is contained in:
@@ -114,7 +114,7 @@ bool RFBridgeComponent::parse_bridge_byte_(uint8_t byte) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void RFBridgeComponent::write_byte_str_(std::string codes) {
|
||||
void RFBridgeComponent::write_byte_str_(const std::string &codes) {
|
||||
uint8_t code;
|
||||
int size = codes.length();
|
||||
for (int i = 0; i < size; i += 2) {
|
||||
@@ -160,7 +160,7 @@ void RFBridgeComponent::send_code(RFBridgeData data) {
|
||||
this->flush();
|
||||
}
|
||||
|
||||
void RFBridgeComponent::send_advanced_code(RFBridgeAdvancedData data) {
|
||||
void RFBridgeComponent::send_advanced_code(const RFBridgeAdvancedData &data) {
|
||||
ESP_LOGD(TAG, "Sending advanced code: length=0x%02X protocol=0x%02X code=0x%s", data.length, data.protocol,
|
||||
data.code.c_str());
|
||||
this->write(RF_CODE_START);
|
||||
@@ -209,7 +209,7 @@ void RFBridgeComponent::start_bucket_sniffing() {
|
||||
this->flush();
|
||||
}
|
||||
|
||||
void RFBridgeComponent::send_raw(std::string raw_code) {
|
||||
void RFBridgeComponent::send_raw(const std::string &raw_code) {
|
||||
ESP_LOGD(TAG, "Sending Raw Code: %s", raw_code.c_str());
|
||||
|
||||
this->write_byte_str_(raw_code);
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "esphome/core/component.h"
|
||||
#include "esphome/components/uart/uart.h"
|
||||
#include "esphome/core/automation.h"
|
||||
@@ -52,19 +54,19 @@ class RFBridgeComponent : public uart::UARTDevice, public Component {
|
||||
this->advanced_data_callback_.add(std::move(callback));
|
||||
}
|
||||
void send_code(RFBridgeData data);
|
||||
void send_advanced_code(RFBridgeAdvancedData data);
|
||||
void send_advanced_code(const RFBridgeAdvancedData &data);
|
||||
void learn();
|
||||
void start_advanced_sniffing();
|
||||
void stop_advanced_sniffing();
|
||||
void start_bucket_sniffing();
|
||||
void send_raw(std::string code);
|
||||
void send_raw(const std::string &code);
|
||||
void beep(uint16_t ms);
|
||||
|
||||
protected:
|
||||
void ack_();
|
||||
void decode_();
|
||||
bool parse_bridge_byte_(uint8_t byte);
|
||||
void write_byte_str_(std::string codes);
|
||||
void write_byte_str_(const std::string &codes);
|
||||
|
||||
std::vector<uint8_t> rx_buffer_;
|
||||
uint32_t last_bridge_byte_{0};
|
||||
@@ -83,7 +85,8 @@ class RFBridgeReceivedCodeTrigger : public Trigger<RFBridgeData> {
|
||||
class RFBridgeReceivedAdvancedCodeTrigger : public Trigger<RFBridgeAdvancedData> {
|
||||
public:
|
||||
explicit RFBridgeReceivedAdvancedCodeTrigger(RFBridgeComponent *parent) {
|
||||
parent->add_on_advanced_code_received_callback([this](RFBridgeAdvancedData data) { this->trigger(data); });
|
||||
parent->add_on_advanced_code_received_callback(
|
||||
[this](RFBridgeAdvancedData data) { this->trigger(std::move(data)); });
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user