Qrome - Added custom hostname and display screen
parent
ba566776b4
commit
b7d9ad32dd
|
|
@ -43,6 +43,8 @@ SOFTWARE.
|
|||
#include "TimeClient.h"
|
||||
#include "OctoPrintClient.h"
|
||||
#include "FS.h"
|
||||
#include "SH1106Wire.h"
|
||||
#include "SSD1306Wire.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.
|
||||
|
||||
// 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 HOSTNAME "OctoMon-"
|
||||
#define HOSTNAME "OctMon-"
|
||||
#define CONFIG "/conf.txt"
|
||||
|
||||
/* Useful Constants */
|
||||
|
|
@ -172,21 +172,13 @@ void setup() {
|
|||
//wifiManager.resetSettings();
|
||||
wifiManager.setAPCallback(configModeCallback);
|
||||
|
||||
//or use this for auto generated name ESP + ChipID
|
||||
wifiManager.autoConnect();
|
||||
|
||||
//Manual Wifi
|
||||
String hostname(HOSTNAME);
|
||||
hostname += String(ESP.getChipId(), HEX);
|
||||
WiFi.hostname(hostname);
|
||||
|
||||
int cnt = 0;
|
||||
while (WiFi.status() != WL_CONNECTED) {
|
||||
digitalWrite(externalLight, LOW);
|
||||
delay(500);
|
||||
Serial.print(".");
|
||||
cnt++;
|
||||
digitalWrite(externalLight, HIGH);
|
||||
if (!wifiManager.autoConnect((const char *)hostname.c_str())) {// new addition
|
||||
delay(3000);
|
||||
WiFi.disconnect(true);
|
||||
ESP.reset();
|
||||
delay(5000);
|
||||
}
|
||||
|
||||
// You can change the transition that is used
|
||||
|
|
@ -559,6 +551,18 @@ void displayPrinterStatus() {
|
|||
void configModeCallback (WiFiManager *myWiFiManager) {
|
||||
Serial.println("Entered config mode");
|
||||
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("Please connect to AP");
|
||||
Serial.println(myWiFiManager->getConfigPortalSSID());
|
||||
|
|
|
|||
Loading…
Reference in New Issue