Fix LoadProhibited crash for logger baud_rate 0 (#2498)

Co-authored-by: Maurice Makaay <mmakaay1@xs4all.net>
This commit is contained in:
Maurice Makaay 2021-10-12 13:51:41 +02:00 committed by GitHub
parent b4f57972fb
commit d13134135b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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