Clean up repository and improve console initialization

- Remove Emacs backup files (cmd_ip.c~, cmd_wifi.c~)
- Add new_rules.part to .gitignore (temp file used by gen_udev_rules.py)
- Update version to 2.1.0-CONSOLE-DEBUG for debugging
- Add debug logging around console REPL initialization
- Improve error handling for console initialization failures
- Remove unreachable code after esp_console_start_repl()
This commit is contained in:
Robert McMahon 2025-12-27 17:56:46 -08:00
parent d4cd861b80
commit 128596bd67
3 changed files with 25 additions and 6 deletions

3
.gitignore vendored
View File

@ -12,6 +12,9 @@ sdkconfig.old
firmware/
flash_args_*
# Temporary files
new_rules.part
# IDE
.vscode/
.idea/

View File

@ -17,5 +17,5 @@ direct_dependencies:
- espressif/led_strip
- idf
manifest_hash: cfead66889b7175cc6aa9a766fd00dc94649d6800986f3fcc4645dc58723ed39
target: esp32c5
target: esp32s3
version: 2.0.0

View File

@ -39,6 +39,7 @@
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_system.h"
#include "esp_err.h"
#include "esp_log.h"
#include "esp_console.h"
#include "esp_vfs_dev.h"
@ -62,7 +63,7 @@
#include "csi_manager.h"
#endif
#define APP_VERSION "2.0.0-SHELL"
#define APP_VERSION "2.1.0-CONSOLE-DEBUG"
static const char *TAG = "MAIN";
@ -173,7 +174,7 @@ void app_main(void) {
ESP_LOGW(TAG, "GPS initialization skipped (Disabled in NVS)");
}
// 4. Hardware Init
// Hardware Init
status_led_init(RGB_LED_GPIO, HAS_RGB_LED);
status_led_set_state(LED_STATE_FAILED); // Force Red Blink
#ifdef CONFIG_ESP_WIFI_CSI_ENABLED
@ -186,27 +187,42 @@ void app_main(void) {
iperf_param_init();
// 6. Initialize Console (REPL)
ESP_LOGI(TAG, "Initializing console REPL...");
esp_console_repl_t *repl = NULL;
esp_console_repl_config_t repl_config = ESP_CONSOLE_REPL_CONFIG_DEFAULT();
repl_config.prompt = s_cli_prompt;
repl_config.max_cmdline_length = 1024;
esp_console_dev_uart_config_t hw_config = ESP_CONSOLE_DEV_UART_CONFIG_DEFAULT();
ESP_ERROR_CHECK(esp_console_new_repl_uart(&hw_config, &repl_config, &repl));
esp_err_t repl_init_err = esp_console_new_repl_uart(&hw_config, &repl_config, &repl);
if (repl_init_err != ESP_OK) {
ESP_LOGE(TAG, "Failed to create console REPL: %s", esp_err_to_name(repl_init_err));
esp_restart();
}
ESP_LOGI(TAG, "Console REPL object created successfully");
// 7. Register Commands
ESP_LOGI(TAG, "Registering console commands...");
register_system_common();
app_console_register_commands();
ESP_LOGI(TAG, "Console commands registered");
// 8. Initial Prompt State Check
app_console_update_prompt();
// 9. Start Shell
ESP_LOGI(TAG, "Starting console REPL...");
printf("\n ==================================================\n");
printf(" | ESP32 iPerf Shell - Ready |\n");
printf(" | Type 'help' for commands |\n");
printf(" ==================================================\n");
fflush(stdout);
ESP_ERROR_CHECK(esp_console_start_repl(repl));
esp_err_t repl_err = esp_console_start_repl(repl);
if (repl_err != ESP_OK) {
ESP_LOGE(TAG, "Failed to start console REPL: %s", esp_err_to_name(repl_err));
esp_restart();
}
// Note: esp_console_start_repl() blocks and never returns on success
// so code below would never execute
}