commit
08335269d7
|
|
@ -43,6 +43,7 @@ SOFTWARE.
|
||||||
#include "TimeClient.h"
|
#include "TimeClient.h"
|
||||||
#include "OctoPrintClient.h"
|
#include "OctoPrintClient.h"
|
||||||
#include "FS.h"
|
#include "FS.h"
|
||||||
|
#include "SH1106Wire.h"
|
||||||
#include "SSD1306Wire.h"
|
#include "SSD1306Wire.h"
|
||||||
#include "OLEDDisplayUi.h"
|
#include "OLEDDisplayUi.h"
|
||||||
|
|
||||||
|
|
@ -68,6 +69,7 @@ boolean DISPLAYCLOCK = true; // true = Show Clock when not printing / false = tu
|
||||||
const int I2C_DISPLAY_ADDRESS = 0x3c; // I2C Address of your Display (usually 0x3c or 0x3d)
|
const int I2C_DISPLAY_ADDRESS = 0x3c; // I2C Address of your Display (usually 0x3c or 0x3d)
|
||||||
const int SDA_PIN = D2;
|
const int SDA_PIN = D2;
|
||||||
const int SCL_PIN = D5;
|
const int SCL_PIN = D5;
|
||||||
|
//#define DISPLAY_SH1106 // Uncomment this line to use the SH1106 display -- SSD1306 is used by default and is most common
|
||||||
|
|
||||||
boolean ENABLE_OTA = true; // this will allow you to load firmware to the device over WiFi (see OTA for ESP8266)
|
boolean ENABLE_OTA = true; // this will allow you to load firmware to the device over WiFi (see OTA for ESP8266)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,9 +27,9 @@ SOFTWARE.
|
||||||
|
|
||||||
#include "Settings.h"
|
#include "Settings.h"
|
||||||
|
|
||||||
#define VERSION "1.3"
|
#define VERSION "1.4"
|
||||||
|
|
||||||
#define HOSTNAME "ESP8266-"
|
#define HOSTNAME "OctMon-"
|
||||||
#define CONFIG "/conf.txt"
|
#define CONFIG "/conf.txt"
|
||||||
|
|
||||||
/* Useful Constants */
|
/* Useful Constants */
|
||||||
|
|
@ -45,7 +45,12 @@ SOFTWARE.
|
||||||
|
|
||||||
// Initialize the oled display for I2C_DISPLAY_ADDRESS
|
// Initialize the oled display for I2C_DISPLAY_ADDRESS
|
||||||
// SDA_PIN and SCL_PIN
|
// SDA_PIN and SCL_PIN
|
||||||
SSD1306Wire display(I2C_DISPLAY_ADDRESS, SDA_PIN, SCL_PIN);
|
#if defined(DISPLAY_SH1106)
|
||||||
|
SH1106Wire display(I2C_DISPLAY_ADDRESS, SDA_PIN, SCL_PIN);
|
||||||
|
#else
|
||||||
|
SSD1306Wire display(I2C_DISPLAY_ADDRESS, SDA_PIN, SCL_PIN); // this is the default
|
||||||
|
#endif
|
||||||
|
|
||||||
OLEDDisplayUi ui( &display );
|
OLEDDisplayUi ui( &display );
|
||||||
|
|
||||||
void drawProgress(OLEDDisplay *display, int percentage, String label);
|
void drawProgress(OLEDDisplay *display, int percentage, String label);
|
||||||
|
|
@ -167,21 +172,13 @@ void setup() {
|
||||||
//wifiManager.resetSettings();
|
//wifiManager.resetSettings();
|
||||||
wifiManager.setAPCallback(configModeCallback);
|
wifiManager.setAPCallback(configModeCallback);
|
||||||
|
|
||||||
//or use this for auto generated name ESP + ChipID
|
|
||||||
wifiManager.autoConnect();
|
|
||||||
|
|
||||||
//Manual Wifi
|
|
||||||
String hostname(HOSTNAME);
|
String hostname(HOSTNAME);
|
||||||
hostname += String(ESP.getChipId(), HEX);
|
hostname += String(ESP.getChipId(), HEX);
|
||||||
WiFi.hostname(hostname);
|
if (!wifiManager.autoConnect((const char *)hostname.c_str())) {// new addition
|
||||||
|
delay(3000);
|
||||||
int cnt = 0;
|
WiFi.disconnect(true);
|
||||||
while (WiFi.status() != WL_CONNECTED) {
|
ESP.reset();
|
||||||
digitalWrite(externalLight, LOW);
|
delay(5000);
|
||||||
delay(500);
|
|
||||||
Serial.print(".");
|
|
||||||
cnt++;
|
|
||||||
digitalWrite(externalLight, HIGH);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// You can change the transition that is used
|
// You can change the transition that is used
|
||||||
|
|
@ -222,6 +219,7 @@ void setup() {
|
||||||
else if (error == OTA_RECEIVE_ERROR) Serial.println("Receive Failed");
|
else if (error == OTA_RECEIVE_ERROR) Serial.println("Receive Failed");
|
||||||
else if (error == OTA_END_ERROR) Serial.println("End Failed");
|
else if (error == OTA_END_ERROR) Serial.println("End Failed");
|
||||||
});
|
});
|
||||||
|
ArduinoOTA.setHostname((const char *)hostname.c_str());
|
||||||
ArduinoOTA.begin();
|
ArduinoOTA.begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -553,6 +551,18 @@ void displayPrinterStatus() {
|
||||||
void configModeCallback (WiFiManager *myWiFiManager) {
|
void configModeCallback (WiFiManager *myWiFiManager) {
|
||||||
Serial.println("Entered config mode");
|
Serial.println("Entered config mode");
|
||||||
Serial.println(WiFi.softAPIP());
|
Serial.println(WiFi.softAPIP());
|
||||||
|
|
||||||
|
display.clear();
|
||||||
|
display.setTextAlignment(TEXT_ALIGN_CENTER);
|
||||||
|
display.setFont(ArialMT_Plain_10);
|
||||||
|
display.drawString(64, 0, "Wifi Manager");
|
||||||
|
display.drawString(64, 10, "Please connect to AP");
|
||||||
|
display.setFont(ArialMT_Plain_16);
|
||||||
|
display.drawString(64, 23, myWiFiManager->getConfigPortalSSID());
|
||||||
|
display.setFont(ArialMT_Plain_10);
|
||||||
|
display.drawString(64, 42, "To setup Wifi connection");
|
||||||
|
display.display();
|
||||||
|
|
||||||
Serial.println("Wifi Manager");
|
Serial.println("Wifi Manager");
|
||||||
Serial.println("Please connect to AP");
|
Serial.println("Please connect to AP");
|
||||||
Serial.println(myWiFiManager->getConfigPortalSSID());
|
Serial.println(myWiFiManager->getConfigPortalSSID());
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue