truma_inetbox(stream): stream slave responses too (enqueue in ISR, format/send in background); tag MASTER/SLAVE
This commit is contained in:
parent
7248f611df
commit
451c184dda
@ -336,13 +336,14 @@ void LinBusListener::read_lin_frame_() {
|
||||
TRUMA_LOGV_ISR(log_msg);
|
||||
#endif // ESPHOME_LOG_HAS_VERBOSE
|
||||
|
||||
if (this->current_data_valid && message_from_master) {
|
||||
if (this->current_data_valid) {
|
||||
QUEUE_LIN_MSG lin_msg;
|
||||
lin_msg.current_PID = this->current_PID_;
|
||||
lin_msg.len = this->current_data_count_ - 1;
|
||||
lin_msg.len = this->current_data_count_ - 1; // exclude CRC
|
||||
for (u_int8_t i = 0; i < lin_msg.len; i++) {
|
||||
lin_msg.data[i] = this->current_data_[i];
|
||||
}
|
||||
lin_msg.from_master = message_from_master ? 1 : 0;
|
||||
xQueueSendFromISR(this->lin_msg_queue_, (void *) &lin_msg, QUEUE_WAIT_DONT_BLOCK);
|
||||
}
|
||||
this->current_state_ = READ_STATE_BREAK;
|
||||
@ -464,9 +465,7 @@ void LinBusListener::maybe_send_stream_from_lin_msg_(const QUEUE_LIN_MSG &lin_ms
|
||||
line += b;
|
||||
}
|
||||
}
|
||||
#ifdef ESPHOME_LOG_HAS_VERBOSE
|
||||
line += " MASTER"; // lin_msg comes from master orders
|
||||
#endif
|
||||
line += (lin_msg.from_master ? " MASTER" : " SLAVE");
|
||||
line.push_back('\n');
|
||||
this->stream_enqueue_line_(line);
|
||||
}
|
||||
|
||||
@ -33,6 +33,7 @@ struct QUEUE_LIN_MSG {
|
||||
u_int8_t current_PID;
|
||||
u_int8_t data[8];
|
||||
u_int8_t len;
|
||||
u_int8_t from_master; // 1 = master order, 0 = slave response
|
||||
};
|
||||
|
||||
class LinBusListener : public PollingComponent, public uart::UARTDevice {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user