The device functions as a webserver that based on a request or timed events(RTC on SPI) controls an RGB light strip.
Because it is just setup for personal use I have hard coded the SSID & password information into the device and set it as a WiFi client.
The device ran fine for a few days then stopped responding to http requests. When I restarted my router and went to refresh my laptops WiFi I noticed the ESP8266 was running as a hotspot. I could connect to it and it would protests my HTTP requests as normal.
I have never setup this device to function as a hotspot, nowhere in my code is this configured. All the other device information and settings that were stored in RAM (not flash, set over http requests) were still remembered. It was not like it had browned out and reset or over written some part of its configuration. Does anyone have any idea why it would have dropped into hotspot mode!?
void setup(void) {
pinMode(buttonPin, INPUT);
Serial.begin(115200);
Wire.begin(ds1307SDA, ds1307SCL);
if (! rtc.begin()) {
Serial.println("Couldn't find RTC");
while (1);
}
strip.begin();
strip.show();
WiFi.begin(ssid, password);
WiFi.config(ip, gateway, subnet);
// Wait for connection
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.print("Connected to ");
Serial.println(ssid);
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
if (MDNS.begin("esp8266")) {
Serial.println("MDNS responder started");
}
server.on("/", handleRoot);
server.on("/json", handleJSON);
server.on("/AlarmOn", setAlarm);
server.on("/AlarmOff", clearAlarm);
server.on("/setAlarm", updateAlarm);
server.on("/lampOn", lampOn);
server.on("/lampOff", lampOff);
server.on("/partyOn", partyOn);
server.onNotFound(handleNotFound);
server.begin();
Serial.println("HTTP server started");
updateTimeTime = millis() + updateTimeDelay;
updateStripTime = millis() + updateStripTime;
}