Merge branch 'dev' into fan-store-preset-modes-on-entity

This commit is contained in:
J. Nick Koston
2026-03-26 17:40:28 -10:00
committed by GitHub
2 changed files with 9 additions and 6 deletions
+9 -4
View File
@@ -10,6 +10,10 @@ namespace nextion {
static const char *const TAG = "nextion";
// Nextion command terminator: three consecutive 0xFF bytes (per Nextion Instruction Set v1.1).
static constexpr uint8_t COMMAND_DELIMITER[3] = {0xFF, 0xFF, 0xFF};
static constexpr size_t DELIMITER_SIZE = sizeof(COMMAND_DELIMITER);
void Nextion::setup() {
this->is_setup_ = false;
this->connection_state_.ignore_is_setup_ = true;
@@ -415,7 +419,8 @@ void Nextion::process_nextion_commands_() {
#ifdef NEXTION_PROTOCOL_LOG
this->print_queue_members_();
#endif
while ((to_process_length = this->command_data_.find(COMMAND_DELIMITER)) != std::string::npos) {
while ((to_process_length = this->command_data_.find(reinterpret_cast<const char *>(COMMAND_DELIMITER), 0,
DELIMITER_SIZE)) != std::string::npos) {
#ifdef USE_NEXTION_MAX_COMMANDS_PER_LOOP
if (++commands_processed > this->max_commands_per_loop_) {
ESP_LOGW(TAG, "Command processing limit exceeded");
@@ -423,8 +428,8 @@ void Nextion::process_nextion_commands_() {
}
#endif // USE_NEXTION_MAX_COMMANDS_PER_LOOP
ESP_LOGN(TAG, "queue size: %zu", this->nextion_queue_.size());
while (to_process_length + COMMAND_DELIMITER.length() < this->command_data_.length() &&
static_cast<uint8_t>(this->command_data_[to_process_length + COMMAND_DELIMITER.length()]) == 0xFF) {
while (to_process_length + DELIMITER_SIZE < this->command_data_.length() &&
static_cast<uint8_t>(this->command_data_[to_process_length + DELIMITER_SIZE]) == 0xFF) {
++to_process_length;
ESP_LOGN(TAG, "Add 0xFF");
}
@@ -829,7 +834,7 @@ void Nextion::process_nextion_commands_() {
break;
}
this->command_data_.erase(0, to_process_length + COMMAND_DELIMITER.length() + 1);
this->command_data_.erase(0, to_process_length + DELIMITER_SIZE + 1);
}
const uint32_t ms = App.get_loop_component_start_time();
-2
View File
@@ -29,8 +29,6 @@ class NextionComponentBase;
using nextion_writer_t = display::DisplayWriter<Nextion>;
static const std::string COMMAND_DELIMITER{static_cast<char>(255), static_cast<char>(255), static_cast<char>(255)};
#ifdef USE_NEXTION_COMMAND_SPACING
class NextionCommandPacer {
public: