tzapu / WiFiManager

ESP8266 WiFi Connection manager with web captive portal
http://tzapu.com/esp8266-wifi-connection-manager-library-arduino-ide/
MIT License
6.45k stars 1.94k forks source link

Compilation Error - 'esp_wifi_set_country_code' was not declared in this scope #1628

Open wagenbm opened 1 year ago

wagenbm commented 1 year ago

Basic Infos

WiFimanager Branch/Release: Master

IDE

Arduino IDE v2.1.0

Board Selection in IDE: FireBeetle ESP32-E Installed library for FireBeetle: DFRobot ESP32 Boards

Hardware

Hardware: ESP32-E Firebeetle

Description

Problem description

I am not able to compile my program when using the Wifimanager. I am always getting the following error:

c:\ESP32\libraries\WiFiManager\WiFiManager.cpp: In member function 'bool WiFiManager::WiFiSetCountry()': c:\ESP32\libraries\WiFiManager\WiFiManager.cpp:3552:11: error: 'esp_wifi_set_country_code' was not declared in this scope err = esp_wifi_set_country_code(_wificountry.c_str(), true); ^~~~~~~~~ c:\ESP32\libraries\WiFiManager\WiFiManager.cpp:3552:11: note: suggested alternative: 'esp_wifi_set_country' err = esp_wifi_set_country_code(_wificountry.c_str(), true); ^~~~~~~~~ esp_wifi_set_country

exit status 1

I tried with downgrading the version and found out, that the problem happens as of version 2.0.12beta.

I figured out, that the problem disappears, when changing the board selection in Arduino IDE. As I wanted to try it out with a different Board, I changed in the IDE the Board selection to 'ESP32 Dev Module'. With this selection, there is no compilation error, also the latest version works fine. Is the FireBeetle probably not supported?

Sketch

#include <WiFiManager.h> // https://github.com/tzapu/WiFiManager

void setup() {
    WiFi.mode(WIFI_STA); // explicitly set mode, esp defaults to STA+AP
    // it is a good practice to make sure your code sets wifi mode how you want it.

    // put your setup code here, to run once:
    Serial.begin(115200);

    //WiFiManager, Local intialization. Once its business is done, there is no need to keep it around
    WiFiManager wm;

    bool res;

    res = wm.autoConnect("AutoConnectAP","password"); // password protected ap

    if(!res) {
        Serial.println("Failed to connect");
        // ESP.restart();
    } 

}

void loop() {

}