Merge branch 'lint1' into nrf52_core

This commit is contained in:
Tomasz Duda 2024-08-12 16:32:20 +02:00
commit c7858fb578
6 changed files with 15 additions and 15 deletions

View file

@ -310,13 +310,13 @@ bool HaierClimateBase::prepare_pending_action() {
case ActionRequest::SEND_CUSTOM_COMMAND: case ActionRequest::SEND_CUSTOM_COMMAND:
return true; return true;
case ActionRequest::TURN_POWER_ON: case ActionRequest::TURN_POWER_ON:
this->action_request_.value().message = this->get_power_message(true); this->action_request_.value().message = this->get_power_message_(true);
return true; return true;
case ActionRequest::TURN_POWER_OFF: case ActionRequest::TURN_POWER_OFF:
this->action_request_.value().message = this->get_power_message(false); this->action_request_.value().message = this->get_power_message_(false);
return true; return true;
case ActionRequest::TOGGLE_POWER: case ActionRequest::TOGGLE_POWER:
this->action_request_.value().message = this->get_power_message(this->mode == ClimateMode::CLIMATE_MODE_OFF); this->action_request_.value().message = this->get_power_message_(this->mode == ClimateMode::CLIMATE_MODE_OFF);
return true; return true;
default: default:
ESP_LOGW(TAG, "Unsupported action: %d", (uint8_t) this->action_request_.value().action); ESP_LOGW(TAG, "Unsupported action: %d", (uint8_t) this->action_request_.value().action);

View file

@ -80,8 +80,8 @@ class HaierClimateBase : public esphome::Component,
const char *phase_to_string_(ProtocolPhases phase); const char *phase_to_string_(ProtocolPhases phase);
virtual void set_handlers() = 0; virtual void set_handlers() = 0;
virtual void process_phase(std::chrono::steady_clock::time_point now) = 0; virtual void process_phase(std::chrono::steady_clock::time_point now) = 0;
virtual haier_protocol::HaierMessage get_control_message() = 0; // NOLINT(readability-identifier-naming) virtual haier_protocol::HaierMessage get_control_message_() = 0;
virtual haier_protocol::HaierMessage get_power_message(bool state) = 0; // NOLINT(readability-identifier-naming) virtual haier_protocol::HaierMessage get_power_message_(bool state) = 0;
virtual void initialization(){}; virtual void initialization(){};
virtual bool prepare_pending_action(); virtual bool prepare_pending_action();
virtual void process_protocol_reset(); virtual void process_protocol_reset();

View file

@ -394,7 +394,7 @@ void HonClimate::process_phase(std::chrono::steady_clock::time_point now) {
if (this->control_messages_queue_.empty()) { if (this->control_messages_queue_.empty()) {
switch (this->control_method_) { switch (this->control_method_) {
case HonControlMethod::SET_GROUP_PARAMETERS: { case HonControlMethod::SET_GROUP_PARAMETERS: {
haier_protocol::HaierMessage control_message = this->get_control_message(); haier_protocol::HaierMessage control_message = this->get_control_message_();
this->control_messages_queue_.push(control_message); this->control_messages_queue_.push(control_message);
} break; } break;
case HonControlMethod::SET_SINGLE_PARAMETER: case HonControlMethod::SET_SINGLE_PARAMETER:
@ -459,7 +459,7 @@ void HonClimate::process_phase(std::chrono::steady_clock::time_point now) {
} }
} }
haier_protocol::HaierMessage HonClimate::get_power_message(bool state) { haier_protocol::HaierMessage HonClimate::get_power_message_(bool state) {
if (state) { if (state) {
static haier_protocol::HaierMessage power_on_message( static haier_protocol::HaierMessage power_on_message(
haier_protocol::FrameType::CONTROL, ((uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER) + 1, haier_protocol::FrameType::CONTROL, ((uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER) + 1,
@ -486,7 +486,7 @@ void HonClimate::initialization() {
this->current_horizontal_swing_ = this->settings_.last_horizontal_swing; this->current_horizontal_swing_ = this->settings_.last_horizontal_swing;
} }
haier_protocol::HaierMessage HonClimate::get_control_message() { haier_protocol::HaierMessage HonClimate::get_control_message_() {
uint8_t control_out_buffer[haier_protocol::MAX_FRAME_SIZE]; uint8_t control_out_buffer[haier_protocol::MAX_FRAME_SIZE];
memcpy(control_out_buffer, this->last_status_message_.get(), this->real_control_packet_size_); memcpy(control_out_buffer, this->last_status_message_.get(), this->real_control_packet_size_);
hon_protocol::HaierPacketControl *out_data = (hon_protocol::HaierPacketControl *) control_out_buffer; hon_protocol::HaierPacketControl *out_data = (hon_protocol::HaierPacketControl *) control_out_buffer;

View file

@ -114,8 +114,8 @@ class HonClimate : public HaierClimateBase {
protected: protected:
void set_handlers() override; void set_handlers() override;
void process_phase(std::chrono::steady_clock::time_point now) override; void process_phase(std::chrono::steady_clock::time_point now) override;
haier_protocol::HaierMessage get_control_message() override; haier_protocol::HaierMessage get_control_message_() override;
haier_protocol::HaierMessage get_power_message(bool state) override; haier_protocol::HaierMessage get_power_message_(bool state) override;
void initialization() override; void initialization() override;
bool prepare_pending_action() override; bool prepare_pending_action() override;
void process_protocol_reset() override; void process_protocol_reset() override;

View file

@ -180,7 +180,7 @@ void Smartair2Climate::process_phase(std::chrono::steady_clock::time_point now)
case ProtocolPhases::SENDING_CONTROL: case ProtocolPhases::SENDING_CONTROL:
if (this->can_send_message() && this->is_control_message_interval_exceeded_(now)) { if (this->can_send_message() && this->is_control_message_interval_exceeded_(now)) {
ESP_LOGI(TAG, "Sending control packet"); ESP_LOGI(TAG, "Sending control packet");
this->send_message_(get_control_message(), this->use_crc_, CONTROL_MESSAGE_RETRIES, this->send_message_(get_control_message_(), this->use_crc_, CONTROL_MESSAGE_RETRIES,
CONTROL_MESSAGE_RETRIES_INTERVAL); CONTROL_MESSAGE_RETRIES_INTERVAL);
} }
break; break;
@ -220,7 +220,7 @@ void Smartair2Climate::process_phase(std::chrono::steady_clock::time_point now)
} }
} }
haier_protocol::HaierMessage Smartair2Climate::get_power_message(bool state) { haier_protocol::HaierMessage Smartair2Climate::get_power_message_(bool state) {
if (state) { if (state) {
static haier_protocol::HaierMessage power_on_message(haier_protocol::FrameType::CONTROL, 0x4D02); static haier_protocol::HaierMessage power_on_message(haier_protocol::FrameType::CONTROL, 0x4D02);
return power_on_message; return power_on_message;
@ -230,7 +230,7 @@ haier_protocol::HaierMessage Smartair2Climate::get_power_message(bool state) {
} }
} }
haier_protocol::HaierMessage Smartair2Climate::get_control_message() { haier_protocol::HaierMessage Smartair2Climate::get_control_message_() {
uint8_t control_out_buffer[sizeof(smartair2_protocol::HaierPacketControl)]; uint8_t control_out_buffer[sizeof(smartair2_protocol::HaierPacketControl)];
memcpy(control_out_buffer, this->last_status_message_.get(), sizeof(smartair2_protocol::HaierPacketControl)); memcpy(control_out_buffer, this->last_status_message_.get(), sizeof(smartair2_protocol::HaierPacketControl));
smartair2_protocol::HaierPacketControl *out_data = (smartair2_protocol::HaierPacketControl *) control_out_buffer; smartair2_protocol::HaierPacketControl *out_data = (smartair2_protocol::HaierPacketControl *) control_out_buffer;

View file

@ -18,8 +18,8 @@ class Smartair2Climate : public HaierClimateBase {
protected: protected:
void set_handlers() override; void set_handlers() override;
void process_phase(std::chrono::steady_clock::time_point now) override; void process_phase(std::chrono::steady_clock::time_point now) override;
haier_protocol::HaierMessage get_power_message(bool state) override; haier_protocol::HaierMessage get_power_message_(bool state) override;
haier_protocol::HaierMessage get_control_message() override; haier_protocol::HaierMessage get_control_message_() override;
// Answer handlers // Answer handlers
haier_protocol::HandlerError status_handler_(haier_protocol::FrameType request_type, haier_protocol::HandlerError status_handler_(haier_protocol::FrameType request_type,
haier_protocol::FrameType message_type, const uint8_t *data, haier_protocol::FrameType message_type, const uint8_t *data,