mirror of
https://github.com/esphome/esphome.git
synced 2024-11-27 17:27:59 +01:00
Merge branch 'lint1' into nrf52_core
This commit is contained in:
commit
c7858fb578
6 changed files with 15 additions and 15 deletions
|
@ -310,13 +310,13 @@ bool HaierClimateBase::prepare_pending_action() {
|
|||
case ActionRequest::SEND_CUSTOM_COMMAND:
|
||||
return true;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
default:
|
||||
ESP_LOGW(TAG, "Unsupported action: %d", (uint8_t) this->action_request_.value().action);
|
||||
|
|
|
@ -80,8 +80,8 @@ class HaierClimateBase : public esphome::Component,
|
|||
const char *phase_to_string_(ProtocolPhases phase);
|
||||
virtual void set_handlers() = 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_power_message(bool state) = 0; // NOLINT(readability-identifier-naming)
|
||||
virtual haier_protocol::HaierMessage get_control_message_() = 0;
|
||||
virtual haier_protocol::HaierMessage get_power_message_(bool state) = 0;
|
||||
virtual void initialization(){};
|
||||
virtual bool prepare_pending_action();
|
||||
virtual void process_protocol_reset();
|
||||
|
|
|
@ -394,7 +394,7 @@ void HonClimate::process_phase(std::chrono::steady_clock::time_point now) {
|
|||
if (this->control_messages_queue_.empty()) {
|
||||
switch (this->control_method_) {
|
||||
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);
|
||||
} break;
|
||||
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) {
|
||||
static haier_protocol::HaierMessage power_on_message(
|
||||
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;
|
||||
}
|
||||
|
||||
haier_protocol::HaierMessage HonClimate::get_control_message() {
|
||||
haier_protocol::HaierMessage HonClimate::get_control_message_() {
|
||||
uint8_t control_out_buffer[haier_protocol::MAX_FRAME_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;
|
||||
|
|
|
@ -114,8 +114,8 @@ class HonClimate : public HaierClimateBase {
|
|||
protected:
|
||||
void set_handlers() override;
|
||||
void process_phase(std::chrono::steady_clock::time_point now) override;
|
||||
haier_protocol::HaierMessage get_control_message() override;
|
||||
haier_protocol::HaierMessage get_power_message(bool state) override;
|
||||
haier_protocol::HaierMessage get_control_message_() override;
|
||||
haier_protocol::HaierMessage get_power_message_(bool state) override;
|
||||
void initialization() override;
|
||||
bool prepare_pending_action() override;
|
||||
void process_protocol_reset() override;
|
||||
|
|
|
@ -180,7 +180,7 @@ void Smartair2Climate::process_phase(std::chrono::steady_clock::time_point now)
|
|||
case ProtocolPhases::SENDING_CONTROL:
|
||||
if (this->can_send_message() && this->is_control_message_interval_exceeded_(now)) {
|
||||
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);
|
||||
}
|
||||
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) {
|
||||
static haier_protocol::HaierMessage power_on_message(haier_protocol::FrameType::CONTROL, 0x4D02);
|
||||
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)];
|
||||
memcpy(control_out_buffer, this->last_status_message_.get(), sizeof(smartair2_protocol::HaierPacketControl));
|
||||
smartair2_protocol::HaierPacketControl *out_data = (smartair2_protocol::HaierPacketControl *) control_out_buffer;
|
||||
|
|
|
@ -18,8 +18,8 @@ class Smartair2Climate : public HaierClimateBase {
|
|||
protected:
|
||||
void set_handlers() 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_control_message() override;
|
||||
haier_protocol::HaierMessage get_power_message_(bool state) override;
|
||||
haier_protocol::HaierMessage get_control_message_() override;
|
||||
// Answer handlers
|
||||
haier_protocol::HandlerError status_handler_(haier_protocol::FrameType request_type,
|
||||
haier_protocol::FrameType message_type, const uint8_t *data,
|
||||
|
|
Loading…
Reference in a new issue