From 3b351b7c66db4d6b9c17d4951c6b62d70ae63c14 Mon Sep 17 00:00:00 2001 From: sle118 Date: Wed, 11 Sep 2019 22:38:02 -0400 Subject: [PATCH 1/6] Update README.md --- README.md | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index c2785f9b..b81737f5 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,15 @@ +# Getting pre-compiled binaries +An automated build was configured to produce binaries on a regular basis, from common templates that are the most typical. They can be downloaded from : + +https://1drv.ms/u/s!Ajb4bKPgIRMXmwzKLS2o_GxCHRv_?e=V7Nebj + +Archive names contain the branch name as well as the template that was used to produce the output. For example : + +WiFi-Manager-squeezelite-esp32-I2S-4MFlash-128.zip + +Is the name of the 128th build for the "WiFi-Manager" branch from the I2S-4MFlash template. + +# Building yourself MOST IMPORTANT: create the right default config file - make defconfig Then adapt the config file to your wifi/BT/I2C device (can alos be done on the command line) @@ -6,22 +18,28 @@ Then - make -j4 - make flash monitor -Once the application is running, under monitor, add autoexec to launch squeezelite at boot +Once the application is running, under monitor, you can monitor the system activity. 1/ setup WiFi - -nvs_set autoexec1 str -v "join \ \" +- Boot the esp, look for a new wifi access point showing up and connect to it. Default build ssid and passwords are "squeezelite"/"squeezelite". +- Once connected, navigate to 192.168.4.1 +- Wait for the list of access points visible from the device to populate in the web page. +- Choose an access point and enter any credential as needed +- Once connection is established, note down the address the device received; this is the address you will use to configure it going forward 2/ setup squeezelite command line (optional) +At this point, the device should have disabled its built-in access point and should be connected to a known WiFi network. +- navigate to the address that was noted in step #1 +- Using the list of predefined options, hoose the mode in which you want squeezelite to start +- Generate the command +- Add or change any additional command line option (for example player name, etc) +- Activate squeezelite execution: this tells the device to automatiaclly run the command at start +- Update the configuration +- Reboot -nvs_set autoexec2 str -v "squeezelite -o I2S -b 500:2000 -d all=info -m ESP32" - -3/ enable autoexec - -nvs_set autoexec u8 -v 1 - -The "join" and "squeezelite" commands can also be typed at the prompt to start manually. Use "help" to see the list. +3/ Enjoy playback +# Additional command line notes The squeezelite options are very similar to the regular Linux ones. Differences are : - the output is -o [\"BT -n \"] | [I2S] From 9d173166fc71e67064841b3266cac38dcae6ee5c Mon Sep 17 00:00:00 2001 From: sle118 Date: Wed, 11 Sep 2019 22:39:22 -0400 Subject: [PATCH 2/6] Update README.md --- README.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index b81737f5..bab99b87 100644 --- a/README.md +++ b/README.md @@ -9,17 +9,7 @@ WiFi-Manager-squeezelite-esp32-I2S-4MFlash-128.zip Is the name of the 128th build for the "WiFi-Manager" branch from the I2S-4MFlash template. -# Building yourself -MOST IMPORTANT: create the right default config file -- make defconfig -Then adapt the config file to your wifi/BT/I2C device (can alos be done on the command line) -- make menuconfig -Then -- make -j4 -- make flash monitor - -Once the application is running, under monitor, you can monitor the system activity. - +# Configuration 1/ setup WiFi - Boot the esp, look for a new wifi access point showing up and connect to it. Default build ssid and passwords are "squeezelite"/"squeezelite". - Once connected, navigate to 192.168.4.1 @@ -52,7 +42,17 @@ To add options that require quotes ("), escape them with \". For example, so use nvs_set autoexec2 str -v "squeezelite -o \"BT -n 'MySpeaker'\" -b 500:2000 -R -u m -Z 192000 -r \"44100-44100\"" -# Additional misc notes to do you build +# Additional misc notes to do your owm build +MOST IMPORTANT: create the right default config file +- make defconfig +Then adapt the config file to your wifi/BT/I2C device (can alos be done on the command line) +- make menuconfig +Then +- make -j4 +- make flash monitor + +Once the application is running, under monitor, you can monitor the system activity. + - for all libraries, add -mlongcalls. - audio libraries are complicated to rebuild, open an issue if you really want to - libmad, libflac (no esp's version), libvorbis (tremor - not esp's version), alac work From 7c8aa35a7497a674ccc78a9e595d87ce6e16ac5e Mon Sep 17 00:00:00 2001 From: sle118 Date: Wed, 11 Sep 2019 22:45:44 -0400 Subject: [PATCH 3/6] Update README.md --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index bab99b87..1eb2e420 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,12 @@ At this point, the device should have disabled its built-in access point and sho - Update the configuration - Reboot -3/ Enjoy playback +3/ set bluetooth & airplaysink name (if you want something other than default) +*this will eventually be moved to the web configuration* +you need to be connected to the device using a usb to serial adapter, with a terminal program (for example putty) opened on that serial port. +- To setup the bluetooth sink name, enter the following command +nvs_set bt_sink_name str -v "your_bt_name_here" +nvs_set airplay_sink_name str -v "your_airplay_name_here" # Additional command line notes The squeezelite options are very similar to the regular Linux ones. Differences are : From 8268aeb0bb49c9f45d8ac8f5d61f60256decc001 Mon Sep 17 00:00:00 2001 From: sle118 Date: Wed, 11 Sep 2019 22:48:03 -0400 Subject: [PATCH 4/6] Update README.md --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 1eb2e420..b21081d3 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ Is the name of the 128th build for the "WiFi-Manager" branch from the I2S-4MFlas - Once connection is established, note down the address the device received; this is the address you will use to configure it going forward 2/ setup squeezelite command line (optional) + At this point, the device should have disabled its built-in access point and should be connected to a known WiFi network. - navigate to the address that was noted in step #1 - Using the list of predefined options, hoose the mode in which you want squeezelite to start @@ -28,10 +29,16 @@ At this point, the device should have disabled its built-in access point and sho - Reboot 3/ set bluetooth & airplaysink name (if you want something other than default) + *this will eventually be moved to the web configuration* + you need to be connected to the device using a usb to serial adapter, with a terminal program (for example putty) opened on that serial port. - To setup the bluetooth sink name, enter the following command + nvs_set bt_sink_name str -v "your_bt_name_here" + +- To setup the airplay sink name, enter the following command + nvs_set airplay_sink_name str -v "your_airplay_name_here" # Additional command line notes From 80ef10e95f9bb5e60cd3cfab919a4793b6260d38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien?= Date: Sat, 14 Sep 2019 22:29:05 -0400 Subject: [PATCH 5/6] Triggering build test --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index b21081d3..81970e96 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ An automated build was configured to produce binaries on a regular basis, from c https://1drv.ms/u/s!Ajb4bKPgIRMXmwzKLS2o_GxCHRv_?e=V7Nebj + Archive names contain the branch name as well as the template that was used to produce the output. For example : WiFi-Manager-squeezelite-esp32-I2S-4MFlash-128.zip From 618b82b49786008cf842bb50f834c8e0d3e3309d Mon Sep 17 00:00:00 2001 From: Christian Herzog Date: Tue, 17 Sep 2019 21:20:57 +0200 Subject: [PATCH 6/6] Wi fi manager (#21) * resampling defaults * UI cleanup * turn of JSON timers when wifi is connected --- components/wifi-manager/code.js | 20 ++++++-------- components/wifi-manager/index.html | 11 +++++--- components/wifi-manager/wifi_manager.c | 36 +++++--------------------- 3 files changed, 21 insertions(+), 46 deletions(-) diff --git a/components/wifi-manager/code.js b/components/wifi-manager/code.js index 6c903dbf..5e637fa1 100644 --- a/components/wifi-manager/code.js +++ b/components/wifi-manager/code.js @@ -33,7 +33,6 @@ function stopCheckStatusInterval(){ } function stopRefreshAPInterval(){ - if(refreshAPInterval != null){ clearTimeout(refreshAPInterval); refreshAPInterval = null; @@ -41,7 +40,6 @@ function stopRefreshAPInterval(){ RefreshAPIIntervalActive = false; } - function startCheckStatusInterval(){ StatusIntervalActive = true; checkStatusInterval = setTimeout(checkStatus, 950); @@ -52,7 +50,6 @@ function startRefreshAPInterval(){ refreshAPInterval = setTimeout(refreshAP, 2800); } - function RepeatCheckStatusInterval(){ if(StatusIntervalActive) startCheckStatusInterval(); @@ -155,7 +152,6 @@ $(document).ready(function(){ }); $("#yes-disconnect").on("click", function() { - stopCheckStatusInterval(); selectedSSID = ""; @@ -206,7 +202,6 @@ $(document).ready(function(){ }); function performConnect(conntype){ - //stop the status refresh. This prevents a race condition where a status //request would be refreshed with wrong ip info from a previous connection //and the request would automatically shows as succesful. @@ -277,10 +272,10 @@ function refreshAP(){ }); apList = data; refreshAPHTML(apList); - } }); - RepeatRefreshAPInterval(); + //TODO daduke +// RepeatRefreshAPInterval(); } function refreshAPHTML(data){ @@ -295,9 +290,6 @@ function refreshAPHTML(data){ function checkStatus(){ $.getJSON( "/status.json", function( data ) { - if(data.hasOwnProperty('autoexec1') && data['autoexec1'] != ""){ - $("#autoexec1_current").text(data["autoexec1"]); - } if(data.hasOwnProperty('ssid') && data['ssid'] != ""){ if(data["ssid"] === selectedSSID){ //that's a connection attempt @@ -349,6 +341,10 @@ function checkStatus(){ $("#gw").text(data["gw"]); $("#wifi-status").slideDown( "fast", function() {}); } +//TODO daduke +console.log("stopping timers.."); +stopCheckStatusInterval(); +stopRefreshAPInterval } } else if(data.hasOwnProperty('urc') && data['urc'] === 2){ @@ -443,9 +439,9 @@ function generateCommand() { var commandLine = commandHeader + '-n ' + $("#player").val(); if (output == 'bt') { - commandLine += ' -o "BT -n \'' + $("#btsink").val() + '\'" -R -u m -Z 192000 -r "44100-44100"'; + commandLine += ' -o "BT -n \'' + $("#btsink").val() + '\'" -R -Z 192000'; } else if (output == 'spdif') { - commandLine += ' -o SPDIF'; + commandLine += ' -o SPDIF -R -Z 192000'; } else { commandLine += ' -o I2S'; } diff --git a/components/wifi-manager/index.html b/components/wifi-manager/index.html index 0aa9f092..469ab708 100644 --- a/components/wifi-manager/index.html +++ b/components/wifi-manager/index.html @@ -237,11 +237,14 @@ function handleClick(cb) {

Firmware upgrade

Upload Progress - - - - + + +
+

Reboot system with new firmware

+
+ +
diff --git a/components/wifi-manager/wifi_manager.c b/components/wifi-manager/wifi_manager.c index 5c3348db..24b95b16 100644 --- a/components/wifi-manager/wifi_manager.c +++ b/components/wifi-manager/wifi_manager.c @@ -170,6 +170,7 @@ void wifi_manager_start(){ /* start wifi manager task */ xTaskCreate(&wifi_manager, "wifi_manager", 4096, NULL, WIFI_MANAGER_TASK_PRIORITY, &task_wifi_manager); } + uint8_t wifi_manager_get_flag(){ uint8_t value=0; nvs_handle handle; @@ -244,6 +245,7 @@ esp_err_t wifi_manager_save_autoexec_flag(uint8_t flag){ return ESP_OK; } + esp_err_t wifi_manager_save_autoexec_config(char * value, char * name, int len){ nvs_handle handle; char val[len+1]; @@ -276,8 +278,8 @@ esp_err_t wifi_manager_save_autoexec_config(char * value, char * name, int len){ return ESP_OK; } -esp_err_t wifi_manager_save_sta_config(){ +esp_err_t wifi_manager_save_sta_config(){ nvs_handle handle; esp_err_t esp_err; ESP_LOGI(TAG, "About to save config to flash"); @@ -320,7 +322,6 @@ esp_err_t wifi_manager_save_sta_config(){ } bool wifi_manager_fetch_wifi_sta_config(){ - nvs_handle handle; esp_err_t esp_err; @@ -403,7 +404,6 @@ void wifi_manager_clear_ip_info_json(){ void wifi_manager_generate_ip_info_json(update_reason_code_t update_reason_code){ - wifi_config_t *config = wifi_manager_get_wifi_sta_config(); if(config){ @@ -445,16 +445,14 @@ void wifi_manager_generate_ip_info_json(update_reason_code_t update_reason_code) else{ wifi_manager_clear_ip_info_json(); } - - } void wifi_manager_clear_access_points_json(){ strcpy(accessp_json, "[]\n"); } -void wifi_manager_generate_acess_points_json(){ +void wifi_manager_generate_acess_points_json(){ strcpy(accessp_json, "["); @@ -483,8 +481,6 @@ void wifi_manager_generate_acess_points_json(){ } - - bool wifi_manager_lock_sta_ip_string(TickType_t xTicksToWait){ if(wifi_manager_sta_ip_mutex){ if( xSemaphoreTake( wifi_manager_sta_ip_mutex, xTicksToWait ) == pdTRUE ) { @@ -499,12 +495,12 @@ bool wifi_manager_lock_sta_ip_string(TickType_t xTicksToWait){ } } + void wifi_manager_unlock_sta_ip_string(){ xSemaphoreGive( wifi_manager_sta_ip_mutex ); } void wifi_manager_safe_update_sta_ip_string(uint32_t ip){ - if(wifi_manager_lock_sta_ip_string(portMAX_DELAY)){ struct ip4_addr ip4; @@ -524,7 +520,6 @@ char* wifi_manager_get_sta_ip_string(){ return wifi_manager_sta_ip; } - bool wifi_manager_lock_json_buffer(TickType_t xTicksToWait){ if(wifi_manager_json_mutex){ if( xSemaphoreTake( wifi_manager_json_mutex, xTicksToWait ) == pdTRUE ) { @@ -539,6 +534,7 @@ bool wifi_manager_lock_json_buffer(TickType_t xTicksToWait){ } } + void wifi_manager_unlock_json_buffer(){ xSemaphoreGive( wifi_manager_json_mutex ); } @@ -547,12 +543,8 @@ char* wifi_manager_get_ap_list_json(){ return accessp_json; } - esp_err_t wifi_manager_event_handler(void *ctx, system_event_t *event) { - - - switch(event->event_id) { case SYSTEM_EVENT_WIFI_READY: @@ -629,7 +621,6 @@ wifi_config_t* wifi_manager_get_wifi_sta_config(){ return wifi_manager_config_sta; } - void wifi_manager_connect_async(){ /* in order to avoid a false positive on the front end app we need to quickly flush the ip json * There'se a risk the front end sees an IP or a password error when in fact @@ -648,7 +639,6 @@ char* wifi_manager_get_ip_info_json(){ } void wifi_manager_destroy(){ - vTaskDelete(task_wifi_manager); task_wifi_manager = NULL; @@ -675,11 +665,8 @@ void wifi_manager_destroy(){ wifi_manager_event_group = NULL; vQueueDelete(wifi_manager_queue); wifi_manager_queue = NULL; - - } - void wifi_manager_filter_unique( wifi_ap_record_t * aplist, uint16_t * aps) { int total_unique; wifi_ap_record_t * first_free; @@ -731,7 +718,6 @@ void wifi_manager_filter_unique( wifi_ap_record_t * aplist, uint16_t * aps) { *aps = total_unique; } - BaseType_t wifi_manager_send_message_to_front(message_code_t code, void *param){ queue_message msg; msg.code = code; @@ -746,26 +732,19 @@ BaseType_t wifi_manager_send_message(message_code_t code, void *param){ return xQueueSend( wifi_manager_queue, &msg, portMAX_DELAY); } - void wifi_manager_set_callback(message_code_t message_code, void (*func_ptr)(void*) ){ - if(cb_ptr_arr && message_code < MESSAGE_CODE_COUNT){ cb_ptr_arr[message_code] = func_ptr; } } void wifi_manager( void * pvParameters ){ - - queue_message msg; BaseType_t xStatus; EventBits_t uxBits; uint8_t retries = 0; - - - /* initialize the tcp stack */ tcpip_adapter_init(); @@ -1138,7 +1117,4 @@ void wifi_manager( void * pvParameters ){ } /* end of for loop */ vTaskDelete( NULL ); - } - -