Sonic-Amiga / ESP8266-Faikin

Opensource replacement for Daikin BRP module to control Daikin aircon units
GNU General Public License v3.0
9 stars 0 forks source link

Serial port pollution on startup #1

Closed Sonic-Amiga closed 1 year ago

Sonic-Amiga commented 1 year ago

Despite redirection code, some serial log is still produced after serial port init. This causes delayed startup

Sonic-Amiga commented 1 year ago

The pollution comes from two facts:

  1. Serial driver appears to buffer things internally; fflush() does not help
    ESP_LOGI (TAG, "Starting UART%s", s21 ? " S21" : "");
    // Shut off console log if it is using our UART
    #if defined(CONFIG_ESP_CONSOLE_UART_DEFAULT) || defined(CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0)
    if (uart == UART_NUM_0) {
      fflush(stdout);
      esp_log_set_putchar(faikin_log_putc);
    }
    #endif

    "Starting UART" string already comes at 2400

  2. wifi code inside the framework has its own dump, ignoring the putchar callback. https://github.com/espressif/ESP8266_RTOS_SDK/issues/1082
Sonic-Amiga commented 1 year ago

Fixed by https://github.com/Sonic-Amiga/ESP8266-Faikin/commit/6cb627953f8cf8645e6b84aac071e745c7eade86