[GH-ISSUE #1189] variable or field 'configModeCallback' declared void when ADC_MODE(ADC_VCC) is present in the code #1016

Open
opened 2026-02-28 01:28:08 +03:00 by kerem · 0 comments
Owner

Originally created by @A4EVA on GitHub (Jan 10, 2021).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1189

Basic Infos

Hardware

WiFimanager Branch/Release: 2.0.3

Esp8266/Esp32:

Hardware: ESP-12e

Core Version: 2.7.4

Description

The use of ADC_MODE(ADC_VCC); to read the vcc voltage of the esp8266 module will cause a compilation error, removing the ADC_MODE(ADC_VCC); will resolve the compiler probelm but in my application is necessary to set the adc in this way. The problem is caused by ADC_MODE() because i alredy tried to compile my code commenting on library at a time and the problem never came up until i implemented the ADC_MODE. I need to know when the wifimanager has started the AP for the configuration so i can inform the user via on oled display. If there is a workaround let me know !

Settings in IDE

Module: Generic ESP8266

Additional libraries:

#include <ESP8266WiFi.h>
ADC_MODE(ADC_VCC); //vcc read-mode
#include <WiFiClientSecure.h>
#include <ESP8266mDNS.h>
#include <ESP8266WebServer.h>
#include <ESP8266HTTPUpdateServer.h>
#include <NTPClient.h>
#include <WiFiUdp.h>
#include <TimeLib.h>
#include <ArduinoJson.h>
//#include "secret.h"
//#define TWI_TIMEOUT 3000
#include <TwitterWebAPI.h>
#include <DNSServer.h>
#include <ESP8266WebServer.h>
#include <WiFiManager.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

//gets called when WiFiManager enters configuration mode
void configModeCallback (WiFiManager *myWiFiManager) {
Serial.println("Entered config mode");

}

void setup() {
WiFi.mode(WIFI_STA); // explicitly set mode, esp defaults to STA+AP

Serial.begin(115200);

//WiFiManager
//Local intialization. Once its business is done, there is no need to keep it around
WiFiManager wm;
//reset settings - for testing
// wm.resetSettings();

//set callback that gets called when connecting to previous WiFi fails, and enters Access Point mode
wm.setAPCallback(configModeCallback);

//fetches ssid and pass and tries to connect
//if it does not connect it starts an access point with the specified name
//here "AutoConnectAP"
//and goes into a blocking loop awaiting configuration
if (!wm.autoConnect()) {
Serial.println("failed to connect and hit timeout");
//reset and try again, or maybe put it to deep sleep
ESP.restart();
delay(1000);
}

Serial.println("connected...yeey :)");

}

void loop() {
// put your main code here, to run repeatedly:

}

Debug Messages

AutoConnectWithFeedbackLED:24:25: error: variable or field 'configModeCallback' declared void

 void configModeCallback (WiFiManager *myWiFiManager) {

                         ^

AutoConnectWithFeedbackLED:24:25: error: 'WiFiManager' was not declared in this scope

AutoConnectWithFeedbackLED:24:38: error: 'myWiFiManager' was not declared in this scope

 void configModeCallback (WiFiManager *myWiFiManager) {

                                    ^

exit status 1
variable or field 'configModeCallback' declared void

Originally created by @A4EVA on GitHub (Jan 10, 2021). Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1189 ### Basic Infos #### Hardware WiFimanager Branch/Release: 2.0.3 Esp8266/Esp32: Hardware: ESP-12e Core Version: 2.7.4 ### Description The use of ADC_MODE(ADC_VCC); to read the vcc voltage of the esp8266 module will cause a compilation error, removing the ADC_MODE(ADC_VCC); will resolve the compiler probelm but in my application is necessary to set the adc in this way. The problem is caused by ADC_MODE() because i alredy tried to compile my code commenting on library at a time and the problem never came up until i implemented the ADC_MODE. I need to know when the wifimanager has started the AP for the configuration so i can inform the user via on oled display. If there is a workaround let me know ! ### Settings in IDE Module: Generic ESP8266 Additional libraries: #include <ESP8266WiFi.h> ADC_MODE(ADC_VCC); //vcc read-mode #include <WiFiClientSecure.h> #include <ESP8266mDNS.h> #include <ESP8266WebServer.h> #include <ESP8266HTTPUpdateServer.h> #include <NTPClient.h> #include <WiFiUdp.h> #include <TimeLib.h> #include <ArduinoJson.h> //#include "secret.h" //#define TWI_TIMEOUT 3000 #include <TwitterWebAPI.h> #include <DNSServer.h> #include <ESP8266WebServer.h> #include <WiFiManager.h> #include <Wire.h> #include <Adafruit_GFX.h> #include <Adafruit_SSD1306.h> //gets called when WiFiManager enters configuration mode void configModeCallback (WiFiManager *myWiFiManager) { Serial.println("Entered config mode"); } void setup() { WiFi.mode(WIFI_STA); // explicitly set mode, esp defaults to STA+AP Serial.begin(115200); //WiFiManager //Local intialization. Once its business is done, there is no need to keep it around WiFiManager wm; //reset settings - for testing // wm.resetSettings(); //set callback that gets called when connecting to previous WiFi fails, and enters Access Point mode wm.setAPCallback(configModeCallback); //fetches ssid and pass and tries to connect //if it does not connect it starts an access point with the specified name //here "AutoConnectAP" //and goes into a blocking loop awaiting configuration if (!wm.autoConnect()) { Serial.println("failed to connect and hit timeout"); //reset and try again, or maybe put it to deep sleep ESP.restart(); delay(1000); } Serial.println("connected...yeey :)"); } void loop() { // put your main code here, to run repeatedly: } ### Debug Messages ``` AutoConnectWithFeedbackLED:24:25: error: variable or field 'configModeCallback' declared void void configModeCallback (WiFiManager *myWiFiManager) { ^ AutoConnectWithFeedbackLED:24:25: error: 'WiFiManager' was not declared in this scope AutoConnectWithFeedbackLED:24:38: error: 'myWiFiManager' was not declared in this scope void configModeCallback (WiFiManager *myWiFiManager) { ^ exit status 1 variable or field 'configModeCallback' declared void ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/WiFiManager#1016
No description provided.