diff --git a/components/esp_peripherals/periph_console.c b/components/esp_peripherals/periph_console.c index cc51444a8..c6955a4c4 100644 --- a/components/esp_peripherals/periph_console.c +++ b/components/esp_peripherals/periph_console.c @@ -52,7 +52,7 @@ typedef struct periph_console { char *buffer; int total_bytes; bool run; - const periph_console_cmd_t *commands; + periph_console_cmd_t *commands; int command_num; EventGroupHandle_t state_event_bits; int task_stack; @@ -202,6 +202,7 @@ static esp_err_t _console_destroy(esp_periph_handle_t self) if (console->prompt_string) { free(console->prompt_string); } + free(console->commands); free(console->buffer); free(console); return ESP_OK; @@ -304,7 +305,9 @@ esp_periph_handle_t periph_console_init(periph_console_cfg_t *config) AUDIO_MEM_CHECK(TAG, periph, return NULL); periph_console_t *console = calloc(1, sizeof(periph_console_t)); AUDIO_MEM_CHECK(TAG, console, return NULL); - console->commands = config->commands; + periph_console_cmd_t* commands = malloc(sizeof(periph_console_cmd_t)*config->command_num); + memcpy(commands, config->commands, sizeof(periph_console_cmd_t)*config->command_num); + console->commands = commands; console->command_num = config->command_num; console->task_stack = CONSOLE_DEFAULT_TASK_STACK; console->task_prio = CONSOLE_DEFAULT_TASK_PRIO; diff --git a/components/esp_peripherals/periph_wifi.c b/components/esp_peripherals/periph_wifi.c index 93a0805e6..7038a3368 100644 --- a/components/esp_peripherals/periph_wifi.c +++ b/components/esp_peripherals/periph_wifi.c @@ -421,6 +421,7 @@ static esp_err_t _wifi_init(esp_periph_handle_t self) ESP_ERROR_CHECK(esp_wifi_init(&cfg)); memset(&wifi_config, 0x00, sizeof(wifi_config_t)); + wifi_config.sta.scan_method = WIFI_ALL_CHANNEL_SCAN; if (periph_wifi->ssid) { strcpy((char *)wifi_config.sta.ssid, periph_wifi->ssid); ESP_LOGD(TAG, "WIFI_SSID=%s", wifi_config.sta.ssid);