Skip to content

Commit d695033

Browse files
authored
Merge pull request #7 from distante/saninn/refactor-ventilation-controller-to-not-track-single-tasks
fix(sec_touch): do not keep waiting for bytes if UART Buffer just send one STX byte and ETX never comes
2 parents 0b4521d + 335e008 commit d695033

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

components/sec_touch/sec_touch.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ void SECTouchComponent::loop() {
7272
return;
7373
}
7474

75-
ESP_LOGD(TAG, "[loop] Data available");
75+
ESP_LOGD(TAG, "[loop] Data available (Current buffer size: %d, Task queue size: %d)",
76+
this->incoming_message.buffer_index + 1, this->data_task_queue.size());
7677
// We have send some data and now we are waiting for the response
7778
uint8_t peakedData;
7879
this->peek_byte(&peakedData);
@@ -98,14 +99,16 @@ void SECTouchComponent::loop() {
9899
uint8_t data;
99100
this->read_byte(&data);
100101
this->store_data_to_incoming_message(data);
101-
// we need to exist if we reach ETX
102+
103+
// if a ETX appears, then exit to process the message
102104
if (data == ETX) {
103105
ESP_LOGD(TAG, " Received ETX %d, processing message", data);
104-
105-
this->process_data_of_current_incoming_message();
106-
return;
106+
break;
107107
}
108108
}
109+
110+
// Process the incoming message will also verify that the message format is correct
111+
this->process_data_of_current_incoming_message();
109112
return;
110113
}
111114

0 commit comments

Comments
 (0)