{"action":"created","issue":{"url":"https://api.github.com/repos/tzapu/WiFiManager/issues/755","repository_url":"https://api.github.com/repos/tzapu/WiFiManager","labels_url":"https://api.github.com/repos/tzapu/WiFiManager/issues/755/labels{/name}","comments_url":"https://api.github.com/repos/tzapu/WiFiManager/issues/755/comments","events_url":"https://api.github.com/repos/tzapu/WiFiManager/issues/755/events","html_url":"https://github.com/tzapu/WiFiManager/issues/755","id":370272894,"node_id":"MDU6SXNzdWUzNzAyNzI4OTQ=","number":755,"title":"default AP mode after restart AutoConnectWithFSParameters","user":{"login":"scropion86","id":5569470,"node_id":"MDQ6VXNlcjU1Njk0NzA=","avatar_url":"https://avatars3.githubusercontent.com/u/5569470?v=4","gravatar_id":"","url":"https://api.github.com/users/scropion86","html_url":"https://github.com/scropion86","followers_url":"https://api.github.com/users/scropion86/followers","following_url":"https://api.github.com/users/scropion86/following{/other_user}","gists_url":"https://api.github.com/users/scropion86/gists{/gist_id}","starred_url":"https://api.github.com/users/scropion86/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scropion86/subscriptions","organizations_url":"https://api.github.com/users/scropion86/orgs","repos_url":"https://api.github.com/users/scropion86/repos","events_url":"https://api.github.com/users/scropion86/events{/privacy}","received_events_url":"https://api.github.com/users/scropion86/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-10-15T17:48:39Z","updated_at":"2018-10-16T05:18:44Z","closed_at":"2018-10-16T05:18:44Z","author_association":"NONE","body":"## PLEASE TRY DEVELOPMENT BRANCH before submitting bugs on release or master, in case they were already fixed. ##\r\n\r\n## POST SERIAL OUTPUT !\r\n\r\nIssues without basic info will be ignored or closed!\r\n\r\nPlease fill the info fields, it helps to get you faster support ;)\r\n\r\nif you have a stack dump decode it:\r\nhttps://github.com/esp8266/Arduino/blob/master/doc/Troubleshooting/stack_dump.rst\r\n\r\nfor better debug messages:\r\nhttps://github.com/esp8266/Arduino/blob/master/doc/Troubleshooting/debugging.rst\r\n\r\n----------------------------- Remove above -----------------------------\r\n\r\n### Basic Infos\r\n\r\n#### Hardware\r\n**WiFimanager Branch/Release:**\r\n- [ ] Master\r\n- [x] Development   commit 2d021bb\r\n\r\n**Esp8266/Esp32:**\r\n- [x] ESP8266\r\n- [ ] ESP32\r\n\r\n**Hardware:\t\t\tESP-12e, esp01, esp25**\r\n- [ ] ESP01\r\n- [x] ESP12 E/F/S (nodemcu, wemos, feather)\r\n- [ ] Other\r\n\r\n\r\n**ESP Core Version:\t2.4.0, staging**\r\n- [ ] 2.3.0\r\n- [ ] 2.4.0\r\n- [ ] staging (master/dev)\r\n- [x] 2.4.2\r\n\r\n### Description\r\n\r\nafter filling the wifi details and add the additional parameters and save , the device restarts in AP mode\r\nwith SSID ESP_[chip_ID] which is not desired behavior \r\nnote i have cleared loop and re flashed same result\r\n\r\n### Settings in IDE\r\n\r\n[env:esp12e]\r\nplatform = espressif8266\r\nboard = esp12e\r\nframework = arduino\r\nupload_speed  = 115200\r\nmonitor_speed = 115200\r\nbuild_flags = -eagle.flash.4m.ld\r\n\r\n\r\n\r\nModule:  \t\t\tcustomized PCB with esp12F\r\n\r\nAdditional libraries: \r\n\r\n### Sketch\r\n\r\n```cpp\r\n#include <FS.h>          // this needs to be first, or it all crashes and burns...\r\n#include <WiFiManager.h> // https://github.com/tzapu/WiFiManager\r\n#include <ArduinoJson.h> // https://github.com/bblanchon/ArduinoJson\r\n\r\n#ifdef ESP32\r\n  #include <SPIFFS.h>\r\n#endif\r\n\r\n\r\n\r\n//define your default values here, if there are different values in config.json, they are overwritten.\r\nchar Blynk_Server[40]= \"10.0.1.56\";\r\nchar Blynk_port[6]  = \"8080\";\r\nchar Main_Auth_token[32] = \"YOUR_Main_Auth_token\";\r\nchar Auth_Token_1[32] = \"Auth_Token_1\";\r\nchar Auth_Token_2[32] = \"Auth_Token_2\";\r\nchar Auth_Token_3[32] = \"Auth_Token_3\";\r\nchar Auth_Token_4[32] = \"Auth_Token_4\";\r\nchar Auth_Token_5[32] = \"Auth_Token_5\";\r\nchar Auth_Token_6[32] = \"Auth_Token_6\";\r\n\r\n\r\n\r\n//default custom static IP\r\nchar static_ip[16] = \"10.0.1.56\";\r\nchar static_gw[16] = \"10.0.1.1\";\r\nchar static_sn[16] = \"255.255.255.0\";\r\n\r\n//flag for saving data\r\nbool shouldSaveConfig = false;\r\n\r\n//callback notifying us of the need to save config\r\nvoid saveConfigCallback () {\r\n  Serial.println(\"Should save config\");\r\n  shouldSaveConfig = true;\r\n}\r\n\r\nvoid setupSpiffs(){\r\n  \r\n  //clean FS, for testing\r\n  //SPIFFS.format();\r\n  //Serial.println(\"Spiff Formatted\");\r\n\r\n\r\n  //read configuration from FS json\r\n  Serial.println(\"mounting FS...\");\r\n\r\n  if (SPIFFS.begin()) {\r\n    Serial.println(\"mounted file system\");\r\n    if (SPIFFS.exists(\"/config.json\")) {\r\n      //file exists, reading and loading\r\n      Serial.println(\"reading config file\");\r\n      File configFile = SPIFFS.open(\"/config.json\", \"r\");\r\n      if (configFile) {\r\n        Serial.println(\"opened config file\");\r\n        size_t size = configFile.size();\r\n        // Allocate a buffer to store contents of the file.\r\n        std::unique_ptr<char[]> buf(new char[size]);\r\n\r\n        configFile.readBytes(buf.get(), size);\r\n        DynamicJsonBuffer jsonBuffer;\r\n        JsonObject& json = jsonBuffer.parseObject(buf.get());\r\n        json.printTo(Serial);\r\n        if (json.success()) {\r\n          Serial.println(\"\\nparsed json\");\r\n\r\n          strcpy(Blynk_Server, json[\"Blynk_Server\"]);\r\n          strcpy(Blynk_port, json[\"Blynk_port\"]);\r\n          strcpy(Main_Auth_token, json[\"Main_Auth_token\"]);\r\n          strcpy(Auth_Token_1, json[\"Auth_Token_1\"]);\r\n          strcpy(Auth_Token_2, json[\"Auth_Token_2\"]);\r\n          strcpy(Auth_Token_3, json[\"Auth_Token_3\"]);\r\n          strcpy(Auth_Token_4, json[\"Auth_Token_4\"]);\r\n          strcpy(Auth_Token_5, json[\"Auth_Token_5\"]);\r\n          strcpy(Auth_Token_6, json[\"Auth_Token_6\"]);\r\n\r\n\r\n\r\n          // if(json[\"ip\"]) {\r\n          //   Serial.println(\"setting custom ip from config\");\r\n          //   strcpy(static_ip, json[\"ip\"]);\r\n          //   strcpy(static_gw, json[\"gateway\"]);\r\n          //   strcpy(static_sn, json[\"subnet\"]);\r\n          //   Serial.println(static_ip);\r\n          // } else {\r\n          //   Serial.println(\"no custom ip in config\");\r\n          // }\r\n\r\n        } else {\r\n          Serial.println(\"failed to load json config\");\r\n        }\r\n      }\r\n    }\r\n  } else {\r\n    Serial.println(\"failed to mount FS\");\r\n  }\r\n  //end read\r\n}\r\n\r\nvoid setup() {\r\n  // put your setup code here, to run once:\r\n  Serial.begin(115200);\r\n  Serial.println();\r\n\r\n  setupSpiffs();\r\n    \r\n\r\n  // WiFiManager, Local intialization. Once its business is done, there is no need to keep it around (disabled and moved to start for non blocking)\r\n    WiFiManager wm;\r\n    // invert colors black theme\r\n    wm.setClass(\"invert\");\r\n\r\n  //set config save notify callback\r\n  wm.setSaveConfigCallback(saveConfigCallback);\r\n\r\n  // setup custom parameters\r\n  // \r\n  // The extra parameters to be configured (can be either global or just in the setup)\r\n  // After connecting, parameter.getValue() will get you the configured value\r\n  // id/name placeholder/prompt default length\r\n  WiFiManagerParameter custom_Blynk_Server(\"server\", \"Blynk server\", Blynk_Server, 40);\r\n  WiFiManagerParameter custom_Blynk_port(\"port\", \"Blynk port\", Blynk_port, 6);\r\n  WiFiManagerParameter custom_Main_Auth_token(\"Token\", \"Main Auth token\", \"\", 32);\r\n  WiFiManagerParameter custom_Auth_Token_1(\"Token1\", \"Auth token 1\", \"\", 32);\r\n  WiFiManagerParameter custom_Auth_Token_2(\"Token2\", \"Auth token 2\", \"\", 32);\r\n  WiFiManagerParameter custom_Auth_Token_3(\"Token3\", \"Auth token 3\", \"\", 32);\r\n  WiFiManagerParameter custom_Auth_Token_4(\"Token4\", \"Auth token 4\", \"\", 32);\r\n  WiFiManagerParameter custom_Auth_Token_5(\"Token5\", \"Auth token 5\", \"\", 32);\r\n  WiFiManagerParameter custom_Auth_Token_6(\"Token6\", \"Auth token 6\", \"\", 32);\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n  //add all your parameters here\r\n  wm.addParameter(&custom_Blynk_Server);\r\n  wm.addParameter(&custom_Blynk_port);\r\n  wm.addParameter(&custom_Main_Auth_token);\r\n  wm.addParameter(&custom_Auth_Token_1);\r\n  wm.addParameter(&custom_Auth_Token_2);\r\n  wm.addParameter(&custom_Auth_Token_3);\r\n  wm.addParameter(&custom_Auth_Token_4);\r\n  wm.addParameter(&custom_Auth_Token_5);\r\n  wm.addParameter(&custom_Auth_Token_6);\r\n\r\n\r\n\r\n  // set static ip\r\n  // IPAddress _ip,_gw,_sn;\r\n  // _ip.fromString(static_ip);\r\n  // _gw.fromString(static_gw);\r\n  // _sn.fromString(static_sn);\r\n  // wm.setSTAStaticIPConfig(_ip, _gw, _sn);\r\n\r\n  //reset settings - wipe credentials for testing\r\n  //wm.resetSettings();\r\n\r\n  //automatically connect using saved credentials if they exist\r\n  //If connection fails it starts an access point with the specified name\r\n  //here  \"AutoConnectAP\" if empty will auto generate basedcon chipid, if password is blank it will be anonymous\r\n  //and goes into a blocking loop awaiting configuration\r\n  if (!wm.autoConnect(\"AutoConnectAP\", \"password\")) {\r\n    Serial.println(\"failed to connect and hit timeout\");\r\n    delay(3000);\r\n    // if we still have not connected restart and try all over again\r\n    ESP.restart();\r\n    delay(5000);\r\n  }\r\n\r\n\r\n\r\n  // always start configportal for a little while\r\n  // wm.setConfigPortalTimeout(60);\r\n  // wm.startConfigPortal(\"AutoConnectAP\",\"password\");\r\n\r\n  //if you get here you have connected to the WiFi\r\n  Serial.println(\"connected...yeey :)\");\r\n\r\n  //read updated parameters\r\n  strcpy(Blynk_Server, custom_Blynk_Server.getValue());\r\n  strcpy(Blynk_port, custom_Blynk_port.getValue());\r\n  strcpy(Main_Auth_token, custom_Main_Auth_token.getValue());\r\n  strcpy(Auth_Token_1, custom_Auth_Token_1.getValue());\r\n  strcpy(Auth_Token_2, custom_Auth_Token_2.getValue());\r\n  strcpy(Auth_Token_3, custom_Auth_Token_3.getValue());\r\n  strcpy(Auth_Token_4, custom_Auth_Token_4.getValue());\r\n  strcpy(Auth_Token_5, custom_Auth_Token_5.getValue());\r\n  strcpy(Auth_Token_6, custom_Auth_Token_6.getValue());\r\n\r\n\r\n\r\n\r\n\r\n  //save the custom parameters to FS\r\n  if (shouldSaveConfig) {\r\n    Serial.println(\"saving config\");\r\n    DynamicJsonBuffer jsonBuffer;\r\n    JsonObject& json = jsonBuffer.createObject();\r\n    json[\"Blynk_Server\"] = Blynk_Server;\r\n    json[\"Blynk_port\"]   = Blynk_port;\r\n    json[\"Main_Auth_token\"]   = Main_Auth_token;\r\n    json[\"Auth_Token_1\"]   = Auth_Token_1;\r\n    json[\"Auth_Token_2\"]   = Auth_Token_2;\r\n    json[\"Auth_Token_3\"]   = Auth_Token_3;\r\n    json[\"Auth_Token_4\"]   = Auth_Token_4;\r\n    json[\"Auth_Token_5\"]   = Auth_Token_5;\r\n    json[\"Auth_Token_6\"]   = Auth_Token_6;\r\n\r\n\r\n    // json[\"ip\"]          = WiFi.localIP().toString();\r\n    // json[\"gateway\"]     = WiFi.gatewayIP().toString();\r\n    // json[\"subnet\"]      = WiFi.subnetMask().toString();\r\n\r\n    File configFile = SPIFFS.open(\"/config.json\", \"w\");\r\n    if (!configFile) {\r\n      Serial.println(\"failed to open config file for writing\");\r\n    }\r\n\r\n    json.prettyPrintTo(Serial);\r\n    json.printTo(configFile);\r\n    configFile.close();\r\n    //end save\r\n    shouldSaveConfig = false;\r\n  }\r\n\r\n  Serial.println(\"local ip\");\r\n  Serial.println(WiFi.localIP());\r\n  Serial.println(WiFi.gatewayIP());\r\n  Serial.println(WiFi.subnetMask());\r\n}\r\n\r\nvoid loop() {\r\n\r\n  // put your main code here, to run repeatedly:\r\n\r\n\r\n}\r\n\r\n\r\n```\r\n\r\n### Debug Messages\r\n\r\n```\r\nrl␀l��|␀�l�|␂␌␌␌�␌l�␌b|��␂�␒�r�b�␌b��nn�lnn���␌b␜p��lrlrlp�n�␐␂␌␌�␌l␌��␌␌␌b␌n�|␂l�␌␌�b��nn�␀l��l`␂�␒␒nn␌l`␂␎␂nr���n␌␌b␌�␎l␎r��n␌␌b␌�␎l�bbb␌␌���l`␂��n�␂\r\nmounting FS...\r\nmounted file system\r\nreading config file\r\nopened config file\r\n{\"Blynk_Server\":\"10.0.1.56\",\"Blynk_port\":\"8080\",\"Main_Auth_token\":\" 8080 Main Auth token\",\"Auth_Token_1\":\" Auth token 1\",\"Auth_Token_2\":\" Auth token 2\",\"Auth_Token_3\":\" Auth token 3\",\"Auth_Token_4\":\" Auth token 4\",\"Auth_Token_5\":\" Auth token 5\",\"Auth_Token_6\":\" Auth token 6\"}\r\nparsed json\r\n*WM: [3] allocating params bytes: 20\r\n*WM: [2] Added Parameter: server\r\n*WM: [2] Added Parameter: port\r\n*WM: [2] Added Parameter: Token\r\n*WM: [2] Added Parameter: Token1\r\n*WM: [2] Added Parameter: Token2\r\n*WM: [3] Updated _max_params: 10\r\n*WM: [3] re-allocating params bytes: 40\r\n*WM: [2] Added Parameter: Token3\r\n*WM: [2] Added Parameter: Token4\r\n*WM: [2] Added Parameter: Token5\r\n*WM: [2] Added Parameter: Token6\r\n*WM: [1] AutoConnect\r\n*WM: [2] Connecting as wifi client...\r\n*WM: [2] setSTAConfig static ip not set\r\n*WM: [3] WIFI station disconnect\r\n*WM: [1] Connecting to saved AP: MoHaMeD\r\n*WM: [3] WiFi station enable\r\n*WM: [3] enableSTA PERSISTENT ON\r\n*WM: [1] connectTimeout not set, ESP waitForConnectResult...\r\n*WM: [2] Connection result: WL_CONNECTED\r\n*WM: [3] lastconxresult: WL_CONNECTED\r\n*WM: [1] AutoConnect: SUCCESS\r\n*WM: [1] STA IP Address: 192.168.1.43\r\nconnected...yeey :)\r\nlocal ip\r\n192.168.1.43\r\n192.168.1.254\r\n255.255.255.0\r\n*WM: [3] freeing allocated params!\r\n*WM: [3] unloading\r\n\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/tzapu/WiFiManager/issues/comments/430104046","html_url":"https://github.com/tzapu/WiFiManager/issues/755#issuecomment-430104046","issue_url":"https://api.github.com/repos/tzapu/WiFiManager/issues/755","id":430104046,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMDEwNDA0Ng==","user":{"login":"scropion86","id":5569470,"node_id":"MDQ6VXNlcjU1Njk0NzA=","avatar_url":"https://avatars3.githubusercontent.com/u/5569470?v=4","gravatar_id":"","url":"https://api.github.com/users/scropion86","html_url":"https://github.com/scropion86","followers_url":"https://api.github.com/users/scropion86/followers","following_url":"https://api.github.com/users/scropion86/following{/other_user}","gists_url":"https://api.github.com/users/scropion86/gists{/gist_id}","starred_url":"https://api.github.com/users/scropion86/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scropion86/subscriptions","organizations_url":"https://api.github.com/users/scropion86/orgs","repos_url":"https://api.github.com/users/scropion86/repos","events_url":"https://api.github.com/users/scropion86/events{/privacy}","received_events_url":"https://api.github.com/users/scropion86/received_events","type":"User","site_admin":false},"created_at":"2018-10-16T05:18:44Z","updated_at":"2018-10-16T05:18:44Z","author_association":"NONE","body":"Thank's , i will re-try with your suggestion ."}}
{"actor":{"display_login":"scropion86"}}