mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-10 05:27:01 +03:00
Network manager WIP
This commit is contained in:
@@ -51,7 +51,8 @@ QueueHandle_t network_queue;
|
||||
BaseType_t network_task_handle;
|
||||
static const char TAG[] = "network";
|
||||
static TaskHandle_t task_network_manager = NULL;
|
||||
RTC_NOINIT_ATTR static bool s_wifi_prioritized = false;
|
||||
RTC_NOINIT_ATTR static bool s_wifi_prioritized;
|
||||
|
||||
extern esp_reset_reason_t xReason;
|
||||
typedef struct network_callback {
|
||||
network_status_reached_cb cb;
|
||||
@@ -282,8 +283,8 @@ static const max_sub_states_t state_max[] = {
|
||||
|
||||
void network_start() {
|
||||
|
||||
if(xReason == ESP_RST_POWERON ){
|
||||
ESP_LOGD(TAG, "Power on reset, initializing wifi priotitized to false");
|
||||
if(cold_boot){
|
||||
ESP_LOGI(TAG, "Setting wifi priotitized flag to false");
|
||||
s_wifi_prioritized = false;
|
||||
}
|
||||
ESP_LOGD(TAG, " Creating message queue");
|
||||
|
||||
@@ -821,6 +821,15 @@ static state_machine_result_t WIFI_CONNECTING_STATE_handler(state_machine_t* con
|
||||
ESP_LOGI(TAG, "Timer: %s ",STR_OR_ALT(nm->timer_tag,"Ethernet link not detected"));
|
||||
network_connect_active_ssid(State_Machine);
|
||||
break;
|
||||
case EN_LOST_CONNECTION:
|
||||
if(nm->event_parameters->disconnected_event->reason == WIFI_REASON_ASSOC_LEAVE) {
|
||||
ESP_LOGI(TAG,"Wifi was disconnected from previous access point. Waiting to connect.");
|
||||
}
|
||||
else if(nm->event_parameters->disconnected_event->reason != WIFI_REASON_4WAY_HANDSHAKE_TIMEOUT) {
|
||||
network_status_update_ip_info(UPDATE_FAILED_ATTEMPT);
|
||||
result = local_traverse_state(State_Machine, &Wifi_Configuring_State[WIFI_CONFIGURING_STATE],__FUNCTION__);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
result = EVENT_UN_HANDLED;
|
||||
}
|
||||
@@ -1032,7 +1041,7 @@ static state_machine_result_t WIFI_LOST_CONNECTION_STATE_entry_handler(state_mac
|
||||
if (nm->retries < WIFI_MANAGER_MAX_RETRY) {
|
||||
nm->retries++;
|
||||
ESP_LOGD(TAG, " Retrying connection connection, %d/%d.", nm->retries, WIFI_MANAGER_MAX_RETRY);
|
||||
network_connect_active_ssid( State_Machine);
|
||||
network_async(EN_CONNECT);
|
||||
} else {
|
||||
/* In this scenario the connection was lost beyond repair */
|
||||
nm->retries = 0;
|
||||
@@ -1088,6 +1097,7 @@ static state_machine_result_t WIFI_LOST_CONNECTION_STATE_handler(state_machine_t
|
||||
}
|
||||
static state_machine_result_t WIFI_LOST_CONNECTION_STATE_exit_handler(state_machine_t* const State_Machine) {
|
||||
network_exit_handler_print(State_Machine,true);
|
||||
FREE_AND_NULL(((network_t *)State_Machine)->event_parameters->disconnected_event);
|
||||
network_exit_handler_print(State_Machine,false);
|
||||
return EVENT_HANDLED;
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
BIN
components/wifi-manager/webapp/dist/index.html.gz
vendored
BIN
components/wifi-manager/webapp/dist/index.html.gz
vendored
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
@@ -344,10 +344,27 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body if_wifi" style="display: none" >
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Joined</th>
|
||||
<th scope="col">Name</th>
|
||||
<th scope="col">Signal</th>
|
||||
<th scope="col">Security</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="wifiTable"></tbody>
|
||||
</table>
|
||||
<button type="button" id="updateAP" class="btn btn-info btn-sm">Scan</button>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade " id="tab-commands">
|
||||
<fieldset id="commands-list"></fieldset>
|
||||
</div>
|
||||
|
||||
@@ -1039,7 +1039,18 @@ $(document).ready(function () {
|
||||
saveAutoexec1(true);
|
||||
});
|
||||
$('#btn_disconnect').on('click', function () {
|
||||
handleDisconnect();
|
||||
ConnectedTo={};
|
||||
refreshAPHTML2();
|
||||
$.ajax({
|
||||
url: '/connect.json',
|
||||
dataType: 'text',
|
||||
method: 'DELETE',
|
||||
cache: false,
|
||||
contentType: 'application/json; charset=utf-8',
|
||||
data: JSON.stringify({
|
||||
timestamp: Date.now(),
|
||||
}),
|
||||
});
|
||||
});
|
||||
$('#btnJoin').on('click', function () {
|
||||
handleConnect();
|
||||
@@ -1296,7 +1307,7 @@ function rssiToIcon(rssi) {
|
||||
}
|
||||
|
||||
function refreshAP() {
|
||||
if (ConnectedTo.urc === connectReturnCode.ETH) return;
|
||||
if (ConnectedTo?.urc === connectReturnCode.ETH) return;
|
||||
$.getJSON('/scan.json', async function () {
|
||||
await sleep(2000);
|
||||
$.getJSON('/ap.json', function (data) {
|
||||
@@ -1346,7 +1357,7 @@ function refreshAPHTML2(data) {
|
||||
$('#wifiStsIcon').html(rssiToIcon(ConnectedTo.rssi));
|
||||
|
||||
}
|
||||
else if (ConnectedTo.urc !== connectReturnCode.ETH) {
|
||||
else if (ConnectedTo?.urc !== connectReturnCode.ETH) {
|
||||
$('span#foot-if').html('');
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
target_add_binary_data( __idf_wifi-manager webapp/dist/css/index.f2de74635f23b31fbdce.css.gz BINARY)
|
||||
target_add_binary_data( __idf_wifi-manager webapp/dist/favicon-32x32.png BINARY)
|
||||
target_add_binary_data( __idf_wifi-manager webapp/dist/index.html.gz BINARY)
|
||||
target_add_binary_data( __idf_wifi-manager webapp/dist/js/index.ad2bb1.bundle.js.gz BINARY)
|
||||
target_add_binary_data( __idf_wifi-manager webapp/dist/js/node_vendors.ad2bb1.bundle.js.gz BINARY)
|
||||
target_add_binary_data( __idf_wifi-manager webapp/dist/js/index.0ee146.bundle.js.gz BINARY)
|
||||
target_add_binary_data( __idf_wifi-manager webapp/dist/js/node_vendors.0ee146.bundle.js.gz BINARY)
|
||||
|
||||
@@ -6,29 +6,29 @@ extern const uint8_t _favicon_32x32_png_start[] asm("_binary_favicon_32x32_png_s
|
||||
extern const uint8_t _favicon_32x32_png_end[] asm("_binary_favicon_32x32_png_end");
|
||||
extern const uint8_t _index_html_gz_start[] asm("_binary_index_html_gz_start");
|
||||
extern const uint8_t _index_html_gz_end[] asm("_binary_index_html_gz_end");
|
||||
extern const uint8_t _index_ad2bb1_bundle_js_gz_start[] asm("_binary_index_ad2bb1_bundle_js_gz_start");
|
||||
extern const uint8_t _index_ad2bb1_bundle_js_gz_end[] asm("_binary_index_ad2bb1_bundle_js_gz_end");
|
||||
extern const uint8_t _node_vendors_ad2bb1_bundle_js_gz_start[] asm("_binary_node_vendors_ad2bb1_bundle_js_gz_start");
|
||||
extern const uint8_t _node_vendors_ad2bb1_bundle_js_gz_end[] asm("_binary_node_vendors_ad2bb1_bundle_js_gz_end");
|
||||
extern const uint8_t _index_0ee146_bundle_js_gz_start[] asm("_binary_index_0ee146_bundle_js_gz_start");
|
||||
extern const uint8_t _index_0ee146_bundle_js_gz_end[] asm("_binary_index_0ee146_bundle_js_gz_end");
|
||||
extern const uint8_t _node_vendors_0ee146_bundle_js_gz_start[] asm("_binary_node_vendors_0ee146_bundle_js_gz_start");
|
||||
extern const uint8_t _node_vendors_0ee146_bundle_js_gz_end[] asm("_binary_node_vendors_0ee146_bundle_js_gz_end");
|
||||
const char * resource_lookups[] = {
|
||||
"/css/index.f2de74635f23b31fbdce.css.gz",
|
||||
"/favicon-32x32.png",
|
||||
"/index.html.gz",
|
||||
"/js/index.ad2bb1.bundle.js.gz",
|
||||
"/js/node_vendors.ad2bb1.bundle.js.gz",
|
||||
"/js/index.0ee146.bundle.js.gz",
|
||||
"/js/node_vendors.0ee146.bundle.js.gz",
|
||||
""
|
||||
};
|
||||
const uint8_t * resource_map_start[] = {
|
||||
_index_f2de74635f23b31fbdce_css_gz_start,
|
||||
_favicon_32x32_png_start,
|
||||
_index_html_gz_start,
|
||||
_index_ad2bb1_bundle_js_gz_start,
|
||||
_node_vendors_ad2bb1_bundle_js_gz_start
|
||||
_index_0ee146_bundle_js_gz_start,
|
||||
_node_vendors_0ee146_bundle_js_gz_start
|
||||
};
|
||||
const uint8_t * resource_map_end[] = {
|
||||
_index_f2de74635f23b31fbdce_css_gz_end,
|
||||
_favicon_32x32_png_end,
|
||||
_index_html_gz_end,
|
||||
_index_ad2bb1_bundle_js_gz_end,
|
||||
_node_vendors_ad2bb1_bundle_js_gz_end
|
||||
_index_0ee146_bundle_js_gz_end,
|
||||
_node_vendors_0ee146_bundle_js_gz_end
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/***********************************
|
||||
webpack_headers
|
||||
dist/css/index.f2de74635f23b31fbdce.css.gz,dist/favicon-32x32.png,dist/index.html.gz,dist/js/index.ad2bb1.bundle.js.gz,dist/js/node_vendors.ad2bb1.bundle.js.gz
|
||||
dist/css/index.f2de74635f23b31fbdce.css.gz,dist/favicon-32x32.png,dist/index.html.gz,dist/js/index.0ee146.bundle.js.gz,dist/js/node_vendors.0ee146.bundle.js.gz
|
||||
***********************************/
|
||||
#pragma once
|
||||
#include <inttypes.h>
|
||||
|
||||
Reference in New Issue
Block a user