Qrome - Added custom hostname and display screen
parent
ba566776b4
commit
b7d9ad32dd
|
|
@ -43,6 +43,8 @@ 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 "OLEDDisplayUi.h"
|
#include "OLEDDisplayUi.h"
|
||||||
|
|
||||||
//******************************
|
//******************************
|
||||||
|
|
@ -76,10 +78,3 @@ boolean ENABLE_OTA = true; // this will allow you to load firmware to the de
|
||||||
//******************************
|
//******************************
|
||||||
|
|
||||||
String themeColor = "light-green"; // this can be changed later in the web interface.
|
String themeColor = "light-green"; // this can be changed later in the web interface.
|
||||||
|
|
||||||
// SSD1306 is default - if DISPLAY_SH1106 is defined then it will use SH1106
|
|
||||||
#if defined(DISPLAY_SH1106)
|
|
||||||
#include "SH1106Wire.h"
|
|
||||||
#else
|
|
||||||
#include "SSD1306Wire.h"
|
|
||||||
#endif
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ SOFTWARE.
|
||||||
|
|
||||||
#define VERSION "1.4"
|
#define VERSION "1.4"
|
||||||
|
|
||||||
#define HOSTNAME "OctoMon-"
|
#define HOSTNAME "OctMon-"
|
||||||
#define CONFIG "/conf.txt"
|
#define CONFIG "/conf.txt"
|
||||||
|
|
||||||
/* Useful Constants */
|
/* Useful Constants */
|
||||||
|
|
@ -172,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
|
||||||
|
|
@ -559,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