diff --git a/README.md b/README.md index d0a3871..813ea23 100644 --- a/README.md +++ b/README.md @@ -11,19 +11,17 @@ `3.2:` arduinoWebSockets: https://github.com/Links2004/arduinoWebSockets -`4.` Replace the provided WifiManager.h file from the WifiManager library, with the new template from https://github.com/openhardwarecoza/LaserWeb3/blob/master/ESP8266%20Wifi%20Bridge/WiFiManager.h (For Emblaser/Darklylabs theme) +`4.` Configure your ESP8266 for sketch upload (GIPOs pulled up and down accordingly, USB to serial connected, reset and ready for upload) -`5.` Configure your ESP8266 for sketch upload (GIPOs pulled up and down accordingly, USB to serial connected, reset and ready for upload) +`5.` Upload the Sketch https://github.com/openhardwarecoza/LaserWeb3/blob/master/ESP8266%20Wifi%20Bridge/websocketserver.ino/websocketserver.ino.ino -`6.` Upload the Sketch https://github.com/openhardwarecoza/LaserWeb3/blob/master/ESP8266%20Wifi%20Bridge/websocketserver.ino/websocketserver.ino.ino +`6.` Connect the TX of the ESP8266 to RX of the Smoothie, and RX of the ESP8266 to TX of the Smoothie. Power up the ESP and Smoothie -`7.` Connect the TX of the ESP8266 to RX of the Smoothie, and RX of the ESP8266 to TX of the Smoothie. Power up the ESP and Smoothie +`7.` Connect to the Emblaser2 AP to connect the ESP to your local Wifi, then switch back to your local wifi (Animation below shows the details) -`8.` Connect to the Emblaser2 AP to connect the ESP to your local Wifi, then switch back to your local wifi (Animation below shows the details) +`8.` Update LaserWeb to the version released on 12 October 2016 or newer -`9.` Update LaserWeb to the version released on 12 October 2016 or newer - -`10.` In LaserWeb, set it to ESP8266, and connect to the IP of the ESP (Note, I will add an IP scanner soon. For now, check on your DHCP server which IP was dished out) +`9.` In LaserWeb, set it to ESP8266, and connect to the IP of the ESP (Note, I will add an IP scanner soon. For now, check on your DHCP server which IP was dished out) ![Setting Up Wifi](wifibridge.gif) diff --git a/WiFiManager.h b/WiFiManagerStrings.h similarity index 62% rename from WiFiManager.h rename to WiFiManagerStrings.h index 1593754..9c1b2b1 100644 --- a/WiFiManager.h +++ b/WiFiManagerStrings.h @@ -1,28 +1,9 @@ -/************************************************************** - WiFiManager is a library for the ESP8266/Arduino platform - (https://github.com/esp8266/Arduino) to enable easy - configuration and reconfiguration of WiFi credentials using a Captive Portal - inspired by: - http://www.esp8266.com/viewtopic.php?f=29&t=2520 - https://github.com/chriscook8/esp-arduino-apboot - https://github.com/esp8266/Arduino/tree/esp8266/hardware/esp8266com/esp8266/libraries/DNSServer/examples/CaptivePortalAdvanced - Built by AlexT https://github.com/tzapu - Licensed under MIT license - **************************************************************/ +#ifndef WiFiManagerStrings +#define WiFiManagerStrings -#ifndef WiFiManager_h -#define WiFiManager_h +#define WIFI_MANAGER_OVERRIDE_STRINGS -#include -#include -#include -#include - -extern "C" { - #include "user_interface.h" -} - -const char HTTP_HEAD[] PROGMEM = "{v}"; +const char HTTP_HEAD[] PROGMEM = "{v}"; const char HTTP_STYLE[] PROGMEM = ""; const char HTTP_SCRIPT[] PROGMEM = ""; const char HTTP_HEAD_END[] PROGMEM = "
"; @@ -35,160 +16,4 @@ const char HTTP_SCAN_LINK[] PROGMEM = "
dnsServer; - std::unique_ptr server; - - //const int WM_DONE = 0; - //const int WM_WAIT = 10; - - //const String HTTP_HEAD = "{v}"; - - void setupConfigPortal(); - void startWPS(); - - const char* _apName = "no-net"; - const char* _apPassword = NULL; - String _ssid = ""; - String _pass = ""; - unsigned long _configPortalTimeout = 0; - unsigned long _connectTimeout = 0; - unsigned long _configPortalStart = 0; - - IPAddress _ap_static_ip; - IPAddress _ap_static_gw; - IPAddress _ap_static_sn; - IPAddress _sta_static_ip; - IPAddress _sta_static_gw; - IPAddress _sta_static_sn; - - int _paramsCount = 0; - int _minimumQuality = -1; - boolean _removeDuplicateAPs = true; - boolean _shouldBreakAfterConfig = false; - boolean _tryWPS = false; - - const char* _customHeadElement = ""; - - //String getEEPROMString(int start, int len); - //void setEEPROMString(int start, int len, String string); - - int status = WL_IDLE_STATUS; - int connectWifi(String ssid, String pass); - uint8_t waitForConnectResult(); - - void handleRoot(); - void handleWifi(boolean scan); - void handleWifiSave(); - void handleInfo(); - void handleReset(); - void handleNotFound(); - void handle204(); - boolean captivePortal(); - - // DNS server - const byte DNS_PORT = 53; - - //helpers - int getRSSIasQuality(int RSSI); - boolean isIp(String str); - String toStringIp(IPAddress ip); - - boolean connect; - boolean _debug = true; - - void (*_apcallback)(WiFiManager*) = NULL; - void (*_savecallback)(void) = NULL; - - WiFiManagerParameter* _params[WIFI_MANAGER_MAX_PARAMS]; - - template - void DEBUG_WM(Generic text); - - template - auto optionalIPFromString(T *obj, const char *s) -> decltype( obj->fromString(s) ) { - return obj->fromString(s); - } - auto optionalIPFromString(...) -> bool { - DEBUG_WM("NO fromString METHOD ON IPAddress, you need ESP8266 core 2.1.0 or newer for Custom IP configuration to work."); - return false; - } -}; - #endif