jasoncoon / esp8266-fastled-webserver

GNU General Public License v3.0
712 stars 360 forks source link

Running in AP mode? #253

Open smartcontracts opened 1 year ago

smartcontracts commented 1 year ago

Heyo, I'm interested in running the webserver in AP mode instead of connecting to a wifi network. I'm planning to use my device on the go so I won't have a stable wifi to connect to. Happy to modify source if necessary to get this working!

smartcontracts commented 1 year ago

Gonna try replacing these lines with WiFi.softAP and see what happens:

https://github.com/jasoncoon/esp8266-fastled-webserver/blob/bc5d8d09b79d89cf69347f4d5029c4b4b4ac21db/esp8266-fastled-webserver/esp8266-fastled-webserver.ino#L401

smartcontracts commented 1 year ago

Removing the WiFi manager and including WiFi.softAP did work. Now just having issues connecting on iOS and webserver seems to randomly stall after a while. Gonna debug and see where I get.

fercervantesx commented 1 year ago

DId you remove anything more for it to work in AP Mode? I replaced the line you shared above with WiFi.softAP('mySSID') - and I don't see an AP with the SSID I specified

kevinl7778 commented 9 months ago

This is from an older version, the version I use

const bool apMode = true;

if (apMode) { WiFi.mode(WIFI_AP); // Do a little work to get a unique-ish name. Append the // last two bytes of the MAC (HEX'd) to "Thing-": uint8_t mac[WL_MAC_ADDR_LENGTH]; WiFi.softAPmacAddress(mac); String macID = String(mac[WL_MAC_ADDR_LENGTH - 2], HEX) + String(mac[WL_MAC_ADDR_LENGTH - 1], HEX); macID.toUpperCase(); String AP_NameString = "Elvira"; char AP_NameChar[AP_NameString.length() + 1]; memset(AP_NameChar, 0, AP_NameString.length() + 1); for (int i = 0; i < AP_NameString.length(); i++) AP_NameChar[i] = AP_NameString.charAt(i); WiFi.softAP(AP_NameChar, WiFiAPPSK); Serial.printf("Connect to Wi-Fi access point: %s\n", AP_NameChar); Serial.println("and open http://192.168.4.1 in your browser"); } else { WiFi.mode(WIFI_STA); Serial.printf("Connecting to %s\n", ssid); if (String(WiFi.SSID()) != String(ssid)) { WiFi.begin(ssid, password); } }