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

@@ -28,7 +28,7 @@ var checkStatusInterval = null;
var StatusIntervalActive = false;
var RefreshAPIIntervalActive = false;
var LastRecoveryState=null;
var output = '';
function stopCheckStatusInterval(){
@@ -176,6 +176,16 @@ $(document).ready(function(){
$( "#wifi" ).slideDown( "fast", function() {})
});
$("input#show-nvs").on("click", function() {
this.checked=this.checked?1:0;
if(this.checked){
$('a[href^="#tab-nvs"]').show();
} else {
$('a[href^="#tab-nvs"]').hide();
}
});
$("input#autoexec-cb").on("click", function() {
var data = { 'timestamp': Date.now() };
autoexec = (this.checked)?1:0;
@@ -628,12 +638,21 @@ function checkStatus(){
enableStatusTimer = true;
}
if (data.hasOwnProperty('recovery')) {
if(LastRecoveryState != data["recovery"]){
LastRecoveryState = data["recovery"];
$("input#show-nvs")[0].checked=LastRecoveryState==1?true:false;
}
if($("input#show-nvs")[0].checked){
$('a[href^="#tab-nvs"]').show();
} else{
$('a[href^="#tab-nvs"]').hide();
}
if (data["recovery"] === 1) {
recovery = true;
$("#otadiv").show();
$('a[href^="#tab-audio"]').hide();
$('a[href^="#tab-gpio"]').show();
$('a[href^="#tab-nvs"]').show();
$("footer.footer").removeClass('sl');
$("footer.footer").addClass('recovery');
$("#boot-button").html('Reboot');
@@ -644,7 +663,6 @@ function checkStatus(){
$("#otadiv").hide();
$('a[href^="#tab-audio"]').show();
$('a[href^="#tab-gpio"]').hide();
$('a[href^="#tab-nvs"]').hide();
$("footer.footer").removeClass('recovery');
$("footer.footer").addClass('sl');
$("#boot-button").html('Recovery');

View File

@@ -300,7 +300,7 @@
<h2>Firmware URL:</h2>
<textarea id="fwurl" maxlength="350"></textarea>
<div class="buttons">
<input type="button" id="flash" class="btn btn-danger" value="Flash!" /><span id="flash-status"></span>
<input type="button" id="flash" class="btn btn-danger" value="Flash!" /><span id="flash-status"></span>
</div>
<div id="otadiv">
<div class="progress" id="progress">
@@ -325,8 +325,12 @@
<li>cJSON, &copy; 2009-2017, Dave Gamble and cJSON contributors. Licensed under the MIT License.</li>
</ul>
</div>
<h2>Show NVS Editor</h2>
<div class="custom-control custom-switch">
<input type="checkbox" class="custom-control-input" id="show-nvs" checked="checked">
<label class="custom-control-label" for="show-nvs"></label>
</div>
</div>
</div>
<footer class="footer"><span id="foot-fw"></span><span id="foot-wifi"></span></footer>
<iframe width="0" height="0" border="0" name="dummyframe" id="dummyframe"></iframe>

View File

@@ -543,14 +543,6 @@ char* wifi_manager_get_ap_list_json(){
static void event_handler(void* arg, esp_event_base_t event_base, int32_t event_id, void* event_data){
// if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_DISCONNECTED) {
// led_blink_pushed(LED_GREEN, 250, 250);
// esp_wifi_connect();
// xEventGroupClearBits(wifi_event_group, CONNECTED_BIT);
// } else if (event_base == IP_EVENT && event_id == IP_EVENT_STA_GOT_IP) {
// led_unpush(LED_GREEN);
// xEventGroupSetBits(wifi_event_group, CONNECTED_BIT);
// }
if(event_base== WIFI_EVENT){
switch(event_id) {