diff --git a/modbus_uart.txt b/modbus_uart.txt deleted file mode 100644 index c87e8a2..0000000 --- a/modbus_uart.txt +++ /dev/null @@ -1,32 +0,0 @@ -if (cfg->rtu.de_pin >= 0) - { - ret = uart_set_mode(uart_num, UART_MODE_RS485_HALF_DUPLEX); - if (ret != ESP_OK) - { - ESP_LOGE(TAG, "uart_set_mode(RS485_HALF_DUPLEX) failed: %s", esp_err_to_name(ret)); - return ret; - } - - ESP_LOGI(TAG, "UART RS485 half-duplex mode enabled (DE pin=%d)", cfg->rtu.de_pin); - } - else - { - ESP_LOGI(TAG, "UART normal mode enabled (shield auto-direction assumed)"); - } - - if (resp_len > 0U) - { - int written = uart_write_bytes(g_rtu_ctx.uart_num, - (const char *)tx_buf, - (uint32_t)resp_len); - - ESP_LOGI(TAG, "UART wrote %d bytes", written); - - if (written < 0) - { - ESP_LOGW(TAG, "uart_write_bytes failed"); - continue; - } - - ESP_ERROR_CHECK(uart_wait_tx_done(g_rtu_ctx.uart_num, pdMS_TO_TICKS(100))); - } \ No newline at end of file