From 89f03eb82bb0002d8edef3b75146361bbb9f4af3 Mon Sep 17 00:00:00 2001 From: morgan Date: Mon, 3 Aug 2026 14:28:16 -0700 Subject: [PATCH] remove console --- include/console.h | 5 --- main/console.c | 80 ----------------------------------------------- main/main.c | 2 -- 3 files changed, 87 deletions(-) delete mode 100644 include/console.h delete mode 100644 main/console.c diff --git a/include/console.h b/include/console.h deleted file mode 100644 index a103499..0000000 --- a/include/console.h +++ /dev/null @@ -1,5 +0,0 @@ -#ifndef __CONSOLE_H__ -#define __CONSOLE_H__ -void console_task(void *args); -void console_init(); -#endif diff --git a/main/console.c b/main/console.c deleted file mode 100644 index c183e7e..0000000 --- a/main/console.c +++ /dev/null @@ -1,80 +0,0 @@ -#include -#include - -#include "esp_system.h" -#include "esp_log.h" -#include "esp_console.h" -#include "esp_vfs_dev.h" -#include "driver/uart.h" -#include "linenoise/linenoise.h" -#include "argtable3/argtable3.h" - -#include "main.h" - -// main console setup and task, assume mostly copied from example -void console_task(void *args) { - // disable buffering - setvbuf(stdin, NULL, _IONBF, 0); - - // setup line endings - esp_vfs_dev_uart_set_rx_line_endings(ESP_LINE_ENDINGS_CR); - esp_vfs_dev_uart_set_tx_line_endings(ESP_LINE_ENDINGS_CRLF); - - const uart_config_t uart_config = { - .baud_rate = CONFIG_ESP_CONSOLE_UART_BAUDRATE, - .data_bits = UART_DATA_8_BITS, - .parity = UART_PARITY_DISABLE, - .stop_bits = UART_STOP_BITS_1, - }; - - ESP_ERROR_CHECK(uart_param_config(CONFIG_ESP_CONSOLE_UART_NUM, &uart_config)); - - ESP_ERROR_CHECK(uart_driver_install(CONFIG_ESP_CONSOLE_UART_NUM, 256, 0, 0, NULL, 0)); - - esp_vfs_dev_uart_use_driver(CONFIG_ESP_CONSOLE_UART_NUM); - - esp_console_config_t console_config = { - .max_cmdline_args = 8, - .max_cmdline_length = 256, - .hint_color = atoi(LOG_COLOR_CYAN) - }; - - ESP_ERROR_CHECK(esp_console_init(&console_config)); - - linenoiseSetMultiLine(1); - linenoiseSetCompletionCallback(&esp_console_get_completion); - linenoiseSetHintsCallback((linenoiseHintsCallback*) &esp_console_get_hint); - linenoiseHistorySetMaxLen(100); - - esp_console_register_help_command(); - - char *prompt; - - while(true) { - asprintf(&prompt, LOG_COLOR_I "> " LOG_RESET_COLOR); - - char* line = linenoise(prompt); - - free(prompt); - - if (line == NULL) { /* Ignore empty lines */ - continue; - } - - linenoiseHistoryAdd(line); - - int ret; - esp_err_t err = esp_console_run(line, &ret); - - if (err == ESP_ERR_NOT_FOUND) { - printf("Unrecognized command\n"); - } else if (err == ESP_ERR_INVALID_ARG) { - } else if (err == ESP_OK && ret != ESP_OK) { - printf("Command returned non-zero error code: 0x%x (%s)\n", ret, esp_err_to_name(err)); - } else if (err != ESP_OK) { - printf("Internal error: %s\n", esp_err_to_name(err)); - } - - linenoiseFree(line); - } -} diff --git a/main/main.c b/main/main.c index 26baab7..be6b56f 100644 --- a/main/main.c +++ b/main/main.c @@ -16,7 +16,6 @@ #include "barback.h" // TODO main should be merged into barback #include "main.h" -#include "console.h" #include "ble.h" #include "user_button.h" #include "pumps.h" @@ -123,7 +122,6 @@ void app_main(void) { pumps_init(); ble_init(name); - xTaskCreate(console_task, "console", 4048, NULL, tskIDLE_PRIORITY + 3, NULL); led_init();