mirror of
https://github.com/ElVit/esphome_components.git
synced 2026-10-18 13:07:28 +02:00
Made member 'response_message_' public for use in lambda. Converted variable 'chunkSize' to #define.
This commit is contained in:
@@ -107,6 +107,7 @@ namespace esphome
|
||||
{
|
||||
// Probably not necessary but CZ-TAW1 sends this query on boot
|
||||
this->log_uart_hex(UART_LOG_TX, PanasonicCommand::InitialRequest, INIT_REQUEST_SIZE, ',');
|
||||
|
||||
this->write_array(PanasonicCommand::InitialRequest, INIT_REQUEST_SIZE);
|
||||
this->flush();
|
||||
}
|
||||
@@ -202,10 +203,9 @@ namespace esphome
|
||||
logStr += buffer;
|
||||
}
|
||||
|
||||
size_t chunkSize = 150;
|
||||
for (size_t i = 0; i < logStr.length(); i += chunkSize)
|
||||
for (size_t i = 0; i < logStr.length(); i += UART_LOG_CHUNK_SIZE)
|
||||
{
|
||||
ESP_LOGI(TAG, "%s %s", msgDir.c_str(), logStr.substr(i, chunkSize).c_str());
|
||||
ESP_LOGI(TAG, "%s %s", msgDir.c_str(), logStr.substr(i, UART_LOG_CHUNK_SIZE).c_str());
|
||||
delay(10);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,8 @@
|
||||
#include <tuple>
|
||||
#include <string>
|
||||
|
||||
#define UART_LOG_CHUNK_SIZE 153
|
||||
|
||||
|
||||
namespace esphome
|
||||
{
|
||||
@@ -264,13 +266,14 @@ namespace esphome
|
||||
// option functions
|
||||
void set_uart_client(uart::UARTComponent* uart) { this->uart_client_ = uart; }
|
||||
void set_log_uart_msg(bool enable) { this->log_uart_msg_ = enable; }
|
||||
// uart message variables to use in lambda functions
|
||||
std::vector<uint8_t> response_message_;
|
||||
|
||||
protected:
|
||||
// options variables
|
||||
uart::UARTComponent* uart_client_ { nullptr };
|
||||
bool log_uart_msg_ { false };
|
||||
// uart message variables
|
||||
std::vector<uint8_t> response_message_;
|
||||
std::vector<uint8_t> request_message_;
|
||||
std::vector<uint8_t> command_message_;
|
||||
uint8_t response_payload_length_;
|
||||
|
||||
Reference in New Issue
Block a user