From fe0fd813a5cfbe04a5f1bb9601200e7ea9455cd0 Mon Sep 17 00:00:00 2001 From: Philip Gladstone Date: Sun, 14 Aug 2022 18:04:47 -0400 Subject: [PATCH] Now works when having an init.lua --- components/platform/platform.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/components/platform/platform.c b/components/platform/platform.c index 61783db9..179e2369 100644 --- a/components/platform/platform.c +++ b/components/platform/platform.c @@ -434,18 +434,19 @@ int platform_uart_start( unsigned id ) /* Tell vfs to use usb-serial-jtag driver */ esp_vfs_usb_serial_jtag_use_driver(); - } - usbcdc_status.line_buffer = malloc(LUA_MAXINPUT); - usbcdc_status.line_position = 0; - if(usbcdc_status.line_buffer == NULL) { - return -1; - } - const char *pcName = "usbcdc"; - if(xTaskCreate(task_usbcdc, pcName, 4096, (void*)id, ESP_TASK_MAIN_PRIO + 1, &usbcdc_status.taskHandle) != pdPASS) { - free(usbcdc_status.line_buffer); - usbcdc_status.line_buffer = NULL; - return -1; + usbcdc_status.line_buffer = malloc(LUA_MAXINPUT); + usbcdc_status.line_position = 0; + if(usbcdc_status.line_buffer == NULL) { + return -1; + } + + const char *pcName = "usbcdc"; + if(xTaskCreate(task_usbcdc, pcName, 4096, (void*)id, ESP_TASK_MAIN_PRIO + 1, &usbcdc_status.taskHandle) != pdPASS) { + free(usbcdc_status.line_buffer); + usbcdc_status.line_buffer = NULL; + return -1; + } } return 0; }