From 53d4be5de48d8c0961ed8030bd145afa13eddcc5 Mon Sep 17 00:00:00 2001 From: Manuel Bleichenbacher Date: Mon, 23 Jul 2018 16:14:33 +0200 Subject: [PATCH] AT command for ending provisioning task --- src/provisioning.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/provisioning.c b/src/provisioning.c index 56d61ec..a6b5e82 100644 --- a/src/provisioning.c +++ b/src/provisioning.c @@ -50,6 +50,7 @@ static uint8_t global_dev_eui[8]; static uint8_t global_app_eui[8]; static uint8_t global_app_key[16]; static bool have_keys = false; +static bool quit_task = false; #if defined(CONFIG_TTN_PROVISION_UART_INIT_YES) @@ -106,7 +107,7 @@ void provisioning_task(void* pvParameter) ESP_LOGI(TAG, "Provisioning task started"); - while (true) + while (!quit_task) { if (!xQueueReceive(uart_queue, &event, portMAX_DELAY)) continue; @@ -127,6 +128,10 @@ void provisioning_task(void* pvParameter) break; } } + + free(line_buf); + uart_driver_delete(UART_NUM); + vTaskDelete(NULL); } void provisioning_add_line_data(int numBytes) @@ -227,6 +232,10 @@ void provisioning_process_line() is_ok = false; } } + else if (strcmp(line_buf, "AT+PROVQ") == 0) + { + quit_task = true; + } else if (strcmp(line_buf, "AT") != 0) { is_ok = false;