Merge 719f144103 into bd8422b228
commit
1b19232a70
Binary file not shown.
|
After Width: | Height: | Size: 112 KiB |
|
|
@ -92,7 +92,7 @@ boolean DISPLAYCLOCK = true; // true = Show Clock when not printing / false =
|
|||
// Display Settings
|
||||
const int I2C_DISPLAY_ADDRESS = 0x3c; // I2C Address of your Display (usually 0x3c or 0x3d)
|
||||
const int SDA_PIN = D2;
|
||||
const int SCL_PIN = D5; // original code D5 -- Monitor Easy Board use D1
|
||||
const int SCL_PIN = D3; // original code D5 -- Monitor Easy Board use D1
|
||||
boolean INVERT_DISPLAY = false; // true = pins at top | false = pins at the bottom
|
||||
//#define DISPLAY_SH1106 // Uncomment this line to use the SH1106 display -- SSD1306 is used by default and is most common
|
||||
|
||||
|
|
@ -100,6 +100,9 @@ boolean INVERT_DISPLAY = false; // true = pins at top | false = pins at the bott
|
|||
const int externalLight = LED_BUILTIN; // LED will always flash on bootup or Wifi Errors
|
||||
boolean USE_FLASH = true; // true = System LED will Flash on Service Calls; false = disabled LED flashing
|
||||
|
||||
//Light Dependant Resistor (LDR) Port
|
||||
const int ldrPin = A0;
|
||||
|
||||
// PSU Control
|
||||
boolean HAS_PSU = false; // Set to true if https://github.com/kantlivelong/OctoPrint-PSUControl/ in use
|
||||
|
||||
|
|
|
|||
|
|
@ -84,6 +84,9 @@ String lastSecond = "xx";
|
|||
String lastReportStatus = "";
|
||||
boolean displayOn = true;
|
||||
|
||||
//LDR Status
|
||||
int ldrStatus =0;
|
||||
|
||||
// Printer Client
|
||||
#if defined(USE_REPETIER_CLIENT)
|
||||
RepetierClient printerClient(PrinterApiKey, PrinterServer, PrinterPort, PrinterAuthUser, PrinterAuthPass, HAS_PSU);
|
||||
|
|
@ -394,7 +397,7 @@ void loop() {
|
|||
}
|
||||
|
||||
checkDisplay(); // Check to see if the printer is on or offline and change display.
|
||||
|
||||
lightOn(); //Check if the lights are on
|
||||
ui.update();
|
||||
|
||||
if (WEBSERVER_ENABLED) {
|
||||
|
|
@ -405,6 +408,20 @@ void loop() {
|
|||
}
|
||||
}
|
||||
|
||||
void lightOn() { //Check LDR status
|
||||
ldrStatus = analogRead(ldrPin);
|
||||
if(ldrStatus>=250){ //Change this value to change the sensitivity of the LDR
|
||||
Serial.print("LDR value will turn on screen");
|
||||
DISPLAYCLOCK = true;
|
||||
//enableDisplay(true);
|
||||
}
|
||||
else{
|
||||
Serial.print("LDR will NOT turn on screen");
|
||||
DISPLAYCLOCK = false;
|
||||
// enableDisplay(false);
|
||||
}
|
||||
}
|
||||
|
||||
void getUpdateTime() {
|
||||
ledOnOff(true); // turn on the LED
|
||||
Serial.println();
|
||||
|
|
|
|||
Loading…
Reference in New Issue