@@ -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 ));
0 commit comments