mirror of
https://github.com/esphome/esphome.git
synced 2024-12-22 05:24:53 +01:00
Fix LoadProhibited crash for logger baud_rate 0 (#2498)
Co-authored-by: Maurice Makaay <mmakaay1@xs4all.net>
This commit is contained in:
parent
b4f57972fb
commit
d13134135b
1 changed files with 4 additions and 3 deletions
|
@ -111,14 +111,15 @@ void HOT Logger::log_message_(int level, const char *tag, int offset) {
|
|||
this->set_null_terminator_();
|
||||
|
||||
const char *msg = this->tx_buffer_ + offset;
|
||||
if (this->baud_rate_ > 0) {
|
||||
#ifdef USE_ARDUINO
|
||||
if (this->baud_rate_ > 0)
|
||||
this->hw_serial_->println(msg);
|
||||
#endif // USE_ARDUINO
|
||||
#ifdef USE_ESP_IDF
|
||||
uart_write_bytes(uart_num_, msg, strlen(msg));
|
||||
uart_write_bytes(uart_num_, "\n", 1);
|
||||
uart_write_bytes(uart_num_, msg, strlen(msg));
|
||||
uart_write_bytes(uart_num_, "\n", 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef USE_ESP32
|
||||
// Suppress network-logging if memory constrained, but still log to serial
|
||||
|
|
Loading…
Reference in a new issue