Added console with one command (so far): log (#11)

Co-authored-by: Joe Kearney <joe@clubk.club>
Reviewed-on: #11
This commit is contained in:
Joe Kearney 2026-01-10 22:49:51 +00:00
parent c8f6bf24fc
commit 376acd4815
11 changed files with 494 additions and 19 deletions

View file

@ -0,0 +1,48 @@
/*
* This program source code file is part of the KTag project, a DIY laser tag
* game with customizable features and wide interoperability.
*
* 🛡 <https://ktag.clubk.club> 🃞
*
* Copyright © 2026 Joseph P. Kearney and the KTag developers.
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* There should be a copy of the GNU Affero General Public License in the LICENSE
* file in the root of this repository. If not, see <http://www.gnu.org/licenses/>.
*/
#include "esp_console.h"
#include <Log_Command.h>
static void register_commands()
{
Register_Log_Command();
esp_console_register_help_command();
}
void Initialize_Console(void)
{
esp_console_repl_t *repl = NULL;
esp_console_repl_config_t repl_cfg = ESP_CONSOLE_REPL_CONFIG_DEFAULT();
repl_cfg.prompt = "KTag>";
repl_cfg.max_cmdline_length = 1024;
repl_cfg.max_history_len = 16;
register_commands();
esp_console_dev_uart_config_t hw_cfg =
ESP_CONSOLE_DEV_UART_CONFIG_DEFAULT();
ESP_ERROR_CHECK(
esp_console_new_repl_uart(&hw_cfg, &repl_cfg, &repl));
ESP_ERROR_CHECK(esp_console_start_repl(repl));
}