mirror of
https://github.com/alexhopeoconnor/WiFiManager.git
synced 2026-10-15 07:31:21 +10:00
some testing
This commit is contained in:
@@ -11,17 +11,50 @@ WiFiManager wm;
|
||||
char ssid[] = "*************"; // your network SSID (name)
|
||||
char pass[] = "********"; // your network password
|
||||
|
||||
void debugchipid(){
|
||||
// WiFi.mode(WIFI_STA);
|
||||
// WiFi.printDiag(Serial);
|
||||
// Serial.println(modes[WiFi.getMode()]);
|
||||
|
||||
// ESP.eraseConfig();
|
||||
// wm.resetSettings();
|
||||
// wm.erase(true);
|
||||
WiFi.mode(WIFI_AP);
|
||||
// WiFi.softAP();
|
||||
WiFi.enableAP(true);
|
||||
delay(500);
|
||||
// esp_wifi_start();
|
||||
delay(1000);
|
||||
WiFi.printDiag(Serial);
|
||||
delay(60000);
|
||||
ESP.restart();
|
||||
|
||||
// AP esp_267751
|
||||
// 507726A4AE30
|
||||
// ESP32 Chip ID = 507726A4AE30
|
||||
}
|
||||
|
||||
void saveCallback(){
|
||||
Serial.println("saveCallback fired");
|
||||
}
|
||||
|
||||
|
||||
//gets called when WiFiManager enters configuration mode
|
||||
void configModeCallback (WiFiManager *myWiFiManager) {
|
||||
Serial.println("configModeCallback fired");
|
||||
// myWiFiManager->setAPStaticIPConfig(IPAddress(10,0,1,1), IPAddress(10,0,1,1), IPAddress(255,255,255,0));
|
||||
// Serial.println(WiFi.softAPIP());
|
||||
//if you used auto generated SSID, print it
|
||||
// Serial.println(myWiFiManager->getConfigPortalSSID());
|
||||
}
|
||||
|
||||
void setup() {
|
||||
// put your setup code here, to run once:
|
||||
Serial.begin(115200);
|
||||
Serial.setDebugOutput(true);
|
||||
delay(3000);
|
||||
// delay(3000);
|
||||
Serial.println("\n Starting");
|
||||
|
||||
// WiFi.mode(WIFI_STA);
|
||||
// WiFi.printDiag(Serial);
|
||||
// Serial.println(modes[WiFi.getMode()]);
|
||||
//WiFiManager
|
||||
//Local intialization. Once its business is done, there is no need to keep it around
|
||||
// WiFiManager wm;
|
||||
@@ -31,14 +64,16 @@ void setup() {
|
||||
//Local intialization. Once its business is done, there is no need to keep it around
|
||||
//reset settings - for testing
|
||||
// wm.resetSettings();
|
||||
//
|
||||
// wm.erase();
|
||||
|
||||
wm.setClass("invert");
|
||||
wm.setAPCallback(configModeCallback);
|
||||
|
||||
//sets timeout until configuration portal gets turned off
|
||||
//useful to make it all retry or go to sleep
|
||||
//in seconds
|
||||
// wm.setConfigPortalTimeout(600);
|
||||
wm.setConnectTimeout(10);
|
||||
// wm.setConnectTimeout(5);
|
||||
// wm.setShowStaticFields(true);
|
||||
|
||||
// uint8_t menu[] = {wm.MENU_WIFI,wm.MENU_INFO,wm.MENU_PARAM,wm.MENU_CLOSE};
|
||||
@@ -57,6 +92,9 @@ void setup() {
|
||||
WiFiManagerParameter custom_token("api_token", "api token", "", 16);
|
||||
WiFiManagerParameter custom_tokenb("invalid token", "invalid token", "", 0);
|
||||
|
||||
// callbacks
|
||||
wm.setSaveConfigCallback(saveCallback);
|
||||
|
||||
//add all your parameters here
|
||||
wm.addParameter(&custom_html);
|
||||
wm.addParameter(&custom_mqtt_server);
|
||||
@@ -83,11 +121,15 @@ void setup() {
|
||||
std::vector<const char *> menu = {"wifi","wifinoscan","info","param","close","sep","erase","restart","exit"};
|
||||
wm.setMenu(menu);
|
||||
|
||||
//set static ip
|
||||
// set static sta ip
|
||||
// wm.setSTAStaticIPConfig(IPAddress(10,0,1,99), IPAddress(10,0,1,1), IPAddress(255,255,255,0));
|
||||
// wm.setShowStaticFields(false);
|
||||
// wm.setShowDnsFields(false);
|
||||
|
||||
// set static ip
|
||||
// wm.setAPStaticIPConfig(IPAddress(10,0,1,1), IPAddress(10,0,1,1), IPAddress(255,255,255,0));
|
||||
// wm.setAPStaticIPConfig(IPAddress(10,0,1,99), IPAddress(10,0,1,1), IPAddress(255,255,255,0));
|
||||
|
||||
// WiFi.mode(WIFI_STA);
|
||||
// const wifi_country_t COUNTRY_US{"US",1,11,WIFI_COUNTRY_POLICY_AUTO};
|
||||
// const wifi_country_t COUNTRY_CN{"CN",1,13,WIFI_COUNTRY_POLICY_AUTO};
|
||||
@@ -116,18 +158,17 @@ void setup() {
|
||||
pinMode(TRIGGER_PIN, INPUT);
|
||||
}
|
||||
|
||||
|
||||
void loop() {
|
||||
// is configuration portal requested?
|
||||
if ( digitalRead(TRIGGER_PIN) == LOW ) {
|
||||
Serial.println("BUTTON PRESSED");
|
||||
//WiFiManager
|
||||
//Local intialization. Once its business is done, there is no need to keep it around
|
||||
//reset settings - for testing
|
||||
//wm.resetSettings();
|
||||
|
||||
//sets timeout until configuration portal gets turned off
|
||||
//useful to make it all retry or go to sleep
|
||||
//in seconds
|
||||
//useful to make it all retry or go to sleep, in seconds
|
||||
wm.setConfigPortalTimeout(120);
|
||||
|
||||
//it starts an access point with the specified name
|
||||
@@ -150,5 +191,5 @@ void loop() {
|
||||
}
|
||||
|
||||
// put your main code here, to run repeatedly:
|
||||
delay(10000);
|
||||
delay(5000);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user