Skip to content

Commit be95f34

Browse files
committed
Prepping for better network control panel
1 parent ee1b684 commit be95f34

File tree

5 files changed

+70
-21
lines changed

5 files changed

+70
-21
lines changed

wled00/data/settings_wifi.htm

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,12 @@ <h3>Configure Access Point</h3>
178178
<option value="3">Never (not recommended)</option></select><br>
179179
AP IP: <span class="sip"> Not active </span><br>
180180
<h3>Experimental</h3>
181-
Force 802.11g mode (ESP8266 only): <input type="checkbox" name="FG"><br>
181+
<span style="display:none;">
182+
Force 802.11g mode (ESP8266 only): <input type="checkbox" name="FG"><br>
182183
Disable Wi-Fi sleep: <input type="checkbox" name="WS"><br>
183184
<i>Can help with connectivity issues.<br>
184185
Do not enable if Wi-Fi is working correctly, increases power consumption.</i>
186+
</span>
185187

186188
<div id="remd">
187189
<h3>Wireless Remote</h3>
@@ -193,23 +195,20 @@ <h3>Wireless Remote</h3>
193195
Last Seen: <span class="rlid">None</span> <br>
194196
</div>
195197

196-
<div id="ethd">
197-
<h3>Ethernet Type</h3>
198-
<select name="ETH">
199-
<option value="0">None</option>
200-
<option value="9">ABC! WLED V43 & compatible</option>
201-
<option value="2">ESP32-POE</option>
202-
<option value="6">ESP32Deux</option>
203-
<option value="7">KIT-VE</option>
204-
<option value="11">Olimex-ESP32-Gateway</option> <!-- WLEDMM -->
205-
<option value="8">QuinLED-Dig-Octa & T-ETH-POE</option>
206-
<option value="4">QuinLED-ESP32</option>
207-
<option value="10">Serg74-ETH32</option>
208-
<option value="5">TwilightLord-ESP32</option>
209-
<option value="3">WESP32</option>
210-
<option value="1">WT32-ETH01</option>
211-
</select><br><br>
212-
</div>
198+
<div id="ethd">
199+
<h3>Ethernet Type</h3>
200+
<select name="ETH">
201+
<option value="0">None</option>
202+
<option value="1">Almost every ESP32 P4 Board</option>
203+
</select><br><br>
204+
</div>
205+
<div id="etho">
206+
<h3>Ethernet Only</h3>
207+
<p>For performance reasons, the ESP32-P4 WiFi can be a strain on the system with lage displays.<br />
208+
This forces disabling of WiFi and all the high priority tasks associated with it.</p>
209+
<label>Disable WiFI entirely: <input type="checkbox" name="ETHO"></label>
210+
<br><br><br>
211+
</div>
213212
<hr>
214213
<button type="button" onclick="B()">Back</button><button type="submit">Save &amp; Connect</button>
215214
</form>

wled00/json.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1202,7 +1202,11 @@ void serializeInfo(JsonObject root)
12021202
"%s (wifi=%u, eth=%u)",
12031203
route, wifi_metric, eth_metric);
12041204

1205+
#ifndef WLED_USE_ETHERNET_ONLY
12051206
network_info["default_route"] = buf;
1207+
#else
1208+
network_info["default_route"] = "Ethernet Only Mode";
1209+
#endif
12061210

12071211

12081212
JsonObject fs_info = root.createNestedObject("fs");

wled00/set.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
5959

6060
#ifdef WLED_USE_ETHERNET
6161
ethernetType = request->arg(F("ETH")).toInt();
62+
ethernetOnly = request->hasArg(F("ETHO"));
6263
// WLED::instance().initEthernet();
6364
#endif
6465

wled00/wled.cpp

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,8 +1087,11 @@ void WLED::setup() {
10871087
ESP_ERROR_CHECK_WITHOUT_ABORT(esp_wifi_restore());
10881088
esp_hosted_coprocessor_fwver_t c6_fw_version;
10891089
ESP_ERROR_CHECK_WITHOUT_ABORT(esp_hosted_get_coprocessor_fwversion(&c6_fw_version));
1090-
USER_PRINTF("ESP-Hosted C6 Firmware is version %d.%d.%d\n", c6_fw_version.major1, c6_fw_version.minor1, c6_fw_version.patch1);
1091-
if (c6_fw_version.major1 < 2) USER_PRINTLN("-> ESP-Hosted versions below 2.15.12 don't return a proper version!");
1090+
if (c6_fw_version.major1 >= 2) {
1091+
USER_PRINTF("ESP-Hosted C6 Firmware is version %d.%d.%d\n", c6_fw_version.major1, c6_fw_version.minor1, c6_fw_version.patch1);
1092+
} else {
1093+
USER_PRINTF("ESP-Hosted C6 Firmware is older than verion 2.15.12\n");
1094+
}
10921095
esp_err_t check = ota_littlefs_perform(true);
10931096
if (check == ESP_HOSTED_SLAVE_OTA_COMPLETED) {
10941097
esp_err_t ret = esp_hosted_slave_ota_activate();
@@ -1168,7 +1171,7 @@ void WLED::setup() {
11681171
esp_err_t err = esp_wifi_set_bandwidth(WIFI_IF_STA, WIFI_BW_HT40);
11691172
USER_PRINTF("Set bandwidth result: %d (%s)\n", err, esp_err_to_name(err));
11701173
}
1171-
1174+
11721175
esp_wifi_get_protocols(WIFI_IF_STA, &xprotocols);
11731176

11741177
print_wifi_protocols("2.4GHz protocols after set:", xprotocols.ghz_2g);
@@ -1739,6 +1742,47 @@ void WLED::initAP(bool resetAP) {
17391742
if (hasValidSTA) {
17401743
// APSTA mode - run both AP and try to connect to configured network
17411744
ESP_ERROR_CHECK_WITHOUT_ABORT(esp_wifi_set_mode(WIFI_MODE_APSTA));
1745+
vTaskDelay(pdMS_TO_TICKS(100));
1746+
USER_PRINTLN("Checking WiFi Stuff");
1747+
1748+
wifi_band_mode_t band_mode;
1749+
esp_wifi_get_band_mode(&band_mode);
1750+
USER_PRINTF("Band mode: %s\n", wifi_band_mode_to_string(band_mode));
1751+
1752+
wifi_protocols_t protocols;
1753+
esp_wifi_get_protocols(WIFI_IF_STA, &protocols);
1754+
print_wifi_protocols("2.4GHz protocols before set:", protocols.ghz_2g);
1755+
if (band_mode != WIFI_BAND_MODE_2G_ONLY) print_wifi_protocols("5GHz protocols before set:", protocols.ghz_5g);
1756+
1757+
wifi_country_t country_check;
1758+
esp_wifi_get_country(&country_check);
1759+
USER_PRINTF("Country: %.2s, channels %d-%d\n", country_check.cc, country_check.schan, country_check.schan + country_check.nchan - 1);
1760+
1761+
wifi_protocols_t xprotocols;
1762+
wifi_bandwidths_t bw_config;
1763+
1764+
if (band_mode != WIFI_BAND_MODE_2G_ONLY) {
1765+
xprotocols = {
1766+
.ghz_2g = WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G | WIFI_PROTOCOL_11N,
1767+
.ghz_5g = WIFI_PROTOCOL_11A | WIFI_PROTOCOL_11N
1768+
};
1769+
ESP_ERROR_CHECK_WITHOUT_ABORT(esp_wifi_set_protocols(WIFI_IF_STA, &xprotocols));
1770+
bw_config = {
1771+
.ghz_2g = WIFI_BW_HT40,
1772+
.ghz_5g = WIFI_BW_HT40,
1773+
};
1774+
esp_err_t err = esp_wifi_set_bandwidths(WIFI_IF_STA, &bw_config);
1775+
USER_PRINTF("Set bandwidths result: %d (%s)\n", err, esp_err_to_name(err));
1776+
} else {
1777+
ESP_ERROR_CHECK_WITHOUT_ABORT(esp_wifi_set_protocol(WIFI_IF_STA, WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G | WIFI_PROTOCOL_11N));
1778+
esp_err_t err = esp_wifi_set_bandwidth(WIFI_IF_STA, WIFI_BW_HT40);
1779+
USER_PRINTF("Set bandwidth result: %d (%s)\n", err, esp_err_to_name(err));
1780+
}
1781+
1782+
esp_wifi_get_protocols(WIFI_IF_STA, &xprotocols);
1783+
1784+
print_wifi_protocols("2.4GHz protocols after set:", xprotocols.ghz_2g);
1785+
if (band_mode != WIFI_BAND_MODE_2G_ONLY) print_wifi_protocols("5GHz protocols after set:", xprotocols.ghz_5g);
17421786

17431787
wifi_config_t wifi_sta_config = {};
17441788
strncpy(reinterpret_cast<char*>(wifi_sta_config.sta.ssid), clientSSID, sizeof(wifi_sta_config.sta.ssid));

wled00/wled.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,7 @@ WLED_GLOBAL int s_retry_num _INIT(0);
441441
WLED_GLOBAL int ethernetType _INIT(WLED_ETH_DEFAULT); // ethernet board type
442442
#else
443443
WLED_GLOBAL int ethernetType _INIT(WLED_ETH_NONE); // use none for ethernet board type if default not defined
444+
WLED_GLOBAL bool ethernetOnly _INIT(false); // use none for ethernet board type if default not defined
444445
#endif
445446
#endif
446447
WLED_GLOBAL esp_eth_handle_t eth_handle;

0 commit comments

Comments
 (0)