fix boot loop caused by competing wifi_manager and cmd_wifi

It is now possible to set a default autoexec command to automatically
join wifi when wifi_manager is disabled. To test wifi stability without
wifi_manager, use the following commands:

nvs_set bypass_wm str -v "1"
nvs_set autoexec str -v "1"
nvs_set autoexec1 str -v "squeezelite -o I2S -b 500:2000 -d all=info -m
nvs_set autoexec2 str -v "join <ssid> <password>"
ESP32"
restart

Note that squeezelite occupies the "autoexec1" slot to avoid conflicts
with the wifi manager web configuration page when it is re-enabled. To
re-enable the wifi-manager, use the following commands:

nvs_set bypass_wm str -v "0"
restart

--
Additional change:  Credits page now has a button to enable the nvs
editor even in ota mode
This commit is contained in:
Sebastien
2019-11-01 09:49:51 -04:00
parent 2ed8b50fbe
commit 9c9fe3e0bf
6 changed files with 58 additions and 21 deletions

View File

@@ -32,7 +32,7 @@ pthread_t thread_console;
static void * console_thread();
void console_start();
static const char * TAG = "console";
extern bool bypass_wifi_manager;
/* Prompt to be printed before each line.
@@ -56,6 +56,12 @@ void process_autoexec(){
uint8_t autoexec_flag=0;
char * str_flag = get_nvs_value_alloc(NVS_TYPE_STR, "autoexec");
if(!bypass_wifi_manager){
ESP_LOGW(TAG, "Procesing autoexec commands while wifi_manager active. Wifi related commands will be ignored.");
}
#if RECOVERY_APPLICATION
ESP_LOGD(TAG, "Processing autoexec commands in recovery mode. Squeezelite commands will be ignored.")
#endif
if(str_flag !=NULL ){
autoexec_flag=atoi(str_flag);
@@ -66,8 +72,18 @@ void process_autoexec(){
ESP_LOGD(TAG,"Getting command name %s", autoexec_name);
autoexec_value= get_nvs_value_alloc(NVS_TYPE_STR, autoexec_name);
if(autoexec_value!=NULL ){
ESP_LOGI(TAG,"Running command %s = %s", autoexec_name, autoexec_value);
run_command(autoexec_value);
if(!bypass_wifi_manager && strstr(autoexec_value, "join ")!=NULL ){
ESP_LOGW(TAG,"Ignoring wifi join command.");
}
#if RECOVERY_APPLICATION
else if(!strstr(autoexec_value, "squeezelite " ) ){
ESP_LOGW(TAG,"Ignoring command. ");
}
#endif
else {
ESP_LOGI(TAG,"Running command %s = %s", autoexec_name, autoexec_value);
run_command(autoexec_value);
}
ESP_LOGD(TAG,"Freeing memory for command %s name", autoexec_name);
free(autoexec_value);
}