]> vcs.slashdirt.org Git - sw/tic2json.git/commitdiff

vcs.slashdirt.org Git - sw/tic2json.git/commitdiff

git git / sw / tic2json.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c88d2e3)
embedded: esptic: move TIC parsing to separate task
2021年9月27日 10:01:25 +0000 (12:01 +0200)
2021年9月28日 13:53:00 +0000 (15:53 +0200)
app_main() runs from uiT with prio 14: way too high


diff --git a/embedded/ESP-RTOS/esptic/main/main.c b/embedded/ESP-RTOS/esptic/main/main.c
index 6e78e073f90f5e1c3048ea48a308bef7a936a43b..e0cfe8318603ec4f22087b5f7bb836ed5cbd9e08 100644 (file)
--- a/embedded/ESP-RTOS/esptic/main/main.c
+++ b/embedded/ESP-RTOS/esptic/main/main.c
@@ -8,8 +8,9 @@
/**
* @file
- * @note: Memory usage detailed below has been tested on ESP8266 in "Release" (-Os) build:
* Receives TIC on RX, outputs JSON via UDP.
+ * @note: The following memory usage was observed while running tic2json_main() as part of app_main(),
+ * tested on ESP8266 in "Release" (-Os) build:
* - TICV01: max stack 5400, max heap: 3764+80
* - TICV02: max stack 5816, max heap: 3764+80
*/
@@ -89,11 +90,25 @@ static void ticframecb(char * buf, size_t size)
sendto(Gsockfd, buf, size, 0, &Gai_addr, Gai_addrlen);
}
-void app_main(void)
+static void tic_task(void *pvParameter)
{
FILE *yyin;
static char buf[UDPBUFSIZE];
+ yyin = fopen("/dev/uart/" XSTR(CONFIG_ESPTIC_UART_NUM), "r");
+ if (!yyin) {
+ ESP_LOGE(TAG, "Cannot open UART");
+ abort();
+ }
+
+ while (1)
+ tic2json_main(yyin, buf, UDPBUFSIZE, ticframecb);
+}
+
+void app_main(void)
+{
+ BaseType_t ret;
+
uart_config_t uart_config = {
.baud_rate = CONFIG_ESPTIC_BAUDRATE,
.data_bits = UART_DATA_7_BITS,
@@ -115,14 +130,11 @@ void app_main(void)
/* setup UDP client */
ESP_ERROR_CHECK(udp_setup());
- yyin = fopen("/dev/uart/" XSTR(CONFIG_ESPTIC_UART_NUM), "r");
- if (!yyin) {
- ESP_LOGE(TAG, "Cannot open UART");
+ ret = xTaskCreate(&tic_task, "tic", 8192, NULL, 5, NULL);
+ if (ret != pdPASS) {
+ ESP_LOGE(TAG, "Failed to create tic task");
abort();
}
ESP_LOGI(TAG, "Rock'n'roll");
-
- while (1)
- tic2json_main(yyin, buf, UDPBUFSIZE, ticframecb);
}
diff --git a/embedded/ESP-RTOS/esptic/sdkconfig.defaults b/embedded/ESP-RTOS/esptic/sdkconfig.defaults
index a3a0e21a26354df0f4fac3cc9d94dcbea00df31c..47c0b886dcfa87d24ffada4c768921aa62e198c2 100644 (file)
--- a/embedded/ESP-RTOS/esptic/sdkconfig.defaults
+++ b/embedded/ESP-RTOS/esptic/sdkconfig.defaults
@@ -1,2 +1 @@
CONFIG_COMPILER_OPTIMIZATION_LEVEL_RELEASE=y
-CONFIG_ESP_MAIN_TASK_STACK_SIZE=8192
tic2json TIC parser/converter
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /