format with clang-formatter
This commit is contained in:
parent
ab7a8f2cd0
commit
d1717adcbc
|
|
@ -5,12 +5,12 @@ namespace panasonic_heatpump {
|
|||
static const char* const TAG = "panasonic_heatpump";
|
||||
|
||||
void PanasonicHelpers::write_uart_log(UartLogDirection direction, const std::vector<uint8_t>& data,
|
||||
const char separator, bool logBytes) {
|
||||
const char separator, bool logBytes) {
|
||||
PanasonicHelpers::write_uart_log(direction, &data[0], data.size(), separator, logBytes);
|
||||
}
|
||||
|
||||
void PanasonicHelpers::write_uart_log(UartLogDirection direction, const uint8_t* data, const size_t length,
|
||||
const char separator, bool logBytes) {
|
||||
const char separator, bool logBytes) {
|
||||
std::string logStr = "";
|
||||
std::string msgDir = direction == UART_LOG_TX ? ">>>" : "<<<";
|
||||
std::string msgType = direction == UART_LOG_TX ? "request" : "response";
|
||||
|
|
|
|||
|
|
@ -18,8 +18,10 @@ enum UartLogDirection : uint8_t {
|
|||
|
||||
class PanasonicHelpers {
|
||||
public:
|
||||
static void write_uart_log(UartLogDirection direction, const std::vector<uint8_t>& data, const char separator, bool logBytes);
|
||||
static void write_uart_log(UartLogDirection direction, const uint8_t* data, const size_t length, const char separator, bool logBytes);
|
||||
static void write_uart_log(UartLogDirection direction, const std::vector<uint8_t>& data, const char separator,
|
||||
bool logBytes);
|
||||
static void write_uart_log(UartLogDirection direction, const uint8_t* data, const size_t length, const char separator,
|
||||
bool logBytes);
|
||||
static std::string byte_array_to_hex_string(const std::vector<uint8_t>& data, const char separator);
|
||||
static std::string byte_array_to_hex_string(const uint8_t* data, const size_t length, const char separator);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -195,17 +195,20 @@ void PanasonicHeatpumpComponent::send_request(RequestType requestType) {
|
|||
break;
|
||||
case RequestType::INITIAL:
|
||||
// Probably not necessary but CZ-TAW1 sends this query on boot
|
||||
PanasonicHelpers::write_uart_log(UART_LOG_TX, PanasonicCommand::InitialRequest, INIT_REQUEST_SIZE, ',', this->log_uart_msg_);
|
||||
PanasonicHelpers::write_uart_log(UART_LOG_TX, PanasonicCommand::InitialRequest, INIT_REQUEST_SIZE, ',',
|
||||
this->log_uart_msg_);
|
||||
this->write_array(PanasonicCommand::InitialRequest, INIT_REQUEST_SIZE);
|
||||
this->flush();
|
||||
break;
|
||||
case RequestType::POLLING:
|
||||
PanasonicHelpers::write_uart_log(UART_LOG_TX, PanasonicCommand::PollingMessage, DATA_MESSAGE_SIZE, ',', this->log_uart_msg_);
|
||||
PanasonicHelpers::write_uart_log(UART_LOG_TX, PanasonicCommand::PollingMessage, DATA_MESSAGE_SIZE, ',',
|
||||
this->log_uart_msg_);
|
||||
this->write_array(PanasonicCommand::PollingMessage, DATA_MESSAGE_SIZE);
|
||||
this->flush();
|
||||
break;
|
||||
case RequestType::POLLING_EXTRA:
|
||||
PanasonicHelpers::write_uart_log(UART_LOG_TX, PanasonicCommand::PollingExtraMessage, DATA_MESSAGE_SIZE, ',', this->log_uart_msg_);
|
||||
PanasonicHelpers::write_uart_log(UART_LOG_TX, PanasonicCommand::PollingExtraMessage, DATA_MESSAGE_SIZE, ',',
|
||||
this->log_uart_msg_);
|
||||
this->write_array(PanasonicCommand::PollingExtraMessage, DATA_MESSAGE_SIZE);
|
||||
this->flush();
|
||||
break;
|
||||
|
|
@ -315,7 +318,8 @@ ResponseType PanasonicHeatpumpComponent::check_response(const std::vector<uint8_
|
|||
return ResponseType::UNKNOWN;
|
||||
}
|
||||
|
||||
this->send_extra_request_ = message[3] == 0x10 && message[199] > 0x02 && this->send_extra_request_ == false ? true : false;
|
||||
this->send_extra_request_ =
|
||||
message[3] == 0x10 && message[199] > 0x02 && this->send_extra_request_ == false ? true : false;
|
||||
|
||||
// Get response type and save the response
|
||||
auto responseType = ResponseType::UNKNOWN;
|
||||
|
|
|
|||
Loading…
Reference in New Issue