Add PRINTER define for 3d printer cooldown wait function (work in progress)
This commit is contained in:
parent
99cc4163da
commit
d599ebb4d7
|
@ -0,0 +1,16 @@
|
|||
## Kabelbelegung 3D Drucker RFID: ##
|
||||
|
||||
Steckerpin Farbe Beschreibung (Pin am LCD/Adrino)
|
||||
1,2 Rot, Orange: +5V (5V)
|
||||
3 Grau (unused)
|
||||
4 Weiss (pin A0)
|
||||
5 Rosa (pin 10)
|
||||
6 Braunweiss (oder Baby Blau bei Display seite) (pin 8)
|
||||
7 Braun (pin 7)
|
||||
8 Lila (pin 5)
|
||||
9 Blau (pin 4)
|
||||
10 Gruen (pin 6)
|
||||
11 Gelb (pin 9)
|
||||
12 Türkis (unused)
|
||||
13,14 Schwarz, Schwarzweiss: GND (GND)
|
||||
|
|
@ -1,8 +1,15 @@
|
|||
//#define PRINTER //uncomment for 3d-Printer (cooldown functions)
|
||||
|
||||
#include <SPI.h>
|
||||
#include <LiquidCrystal.h>
|
||||
#include <EEPROM.h>
|
||||
#include <MFRC522.h>
|
||||
|
||||
#ifdef PRINTER
|
||||
#define BTN_FANPROBE A3
|
||||
#define FANOFFVALUE 50 //adc value for fan
|
||||
boolean flag_switchOff = false; //set true-> loop switches output off if possible
|
||||
#endif
|
||||
|
||||
#define BTN_PIN A0 // lcd buttons are Voltage-Divider analog
|
||||
#define LCD_BACKLIGHT 10
|
||||
|
@ -40,6 +47,7 @@ int displayCardsIndex = -1;
|
|||
int displayCardsIndexLast = -1;
|
||||
boolean cardsshow=false;
|
||||
|
||||
|
||||
void setup() {
|
||||
pinMode(10, OUTPUT); // LCD backlight
|
||||
pinMode(A4, OUTPUT); // relais 1
|
||||
|
@ -159,8 +167,20 @@ void handleCards(long currentMillis) {
|
|||
} else {
|
||||
// if we are locked, we switch out Output
|
||||
|
||||
if(outputOn) {
|
||||
set_output(false);
|
||||
if(outputOn) {
|
||||
#ifdef PRINTER
|
||||
if (!flag_switchOff){
|
||||
flag_switchOff=true;
|
||||
lcd.clear();
|
||||
lcd.print("Wartet auf");
|
||||
lcd.setCursor(0, 1);
|
||||
lcd.print("Luefter");
|
||||
}else{
|
||||
flag_switchOff=false; //cancel switchoff
|
||||
}
|
||||
#else
|
||||
set_output(false);
|
||||
#endif
|
||||
} else {
|
||||
add_log(&(mfrc522.uid));
|
||||
set_output(true);
|
||||
|
@ -214,6 +234,7 @@ void loop() {
|
|||
|
||||
handleCards(currentMillis);
|
||||
|
||||
|
||||
if(readButtons() == 1 && !cardsshow) { //select button shows log, if not showing cards atm
|
||||
displayLogIndex++;
|
||||
displayLogIndex %= 10;
|
||||
|
@ -295,6 +316,40 @@ void loop() {
|
|||
lcd_print_home();
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef PRINTER
|
||||
int fanvalue=analogRead(BTN_FANPROBE);
|
||||
Serial.println(fanvalue);
|
||||
if (flag_switchOff){
|
||||
if (readButtons()!=0){ //any buttons pressed
|
||||
abortSwitchoff();
|
||||
}
|
||||
if (!fanActive()){
|
||||
set_output(false);
|
||||
flag_switchOff=false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef PRINTER
|
||||
bool fanActive()
|
||||
{
|
||||
int fanvalue=analogRead(BTN_FANPROBE);
|
||||
Serial.println(fanvalue);
|
||||
if (fanvalue<FANOFFVALUE){
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
void abortSwitchoff(){
|
||||
flag_switchOff=false;
|
||||
lcd.clear();
|
||||
lcd.print("Ausschalten");
|
||||
lcd.setCursor(0, 1);
|
||||
lcd.print("Abgebrochen");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue