Skip to content

Commit

Permalink
Merge pull request #11 from SinisterRj/devel
Browse files Browse the repository at this point in the history
2.6.0
  • Loading branch information
SinisterRj committed Sep 27, 2022
2 parents 2fddd9f + a830d4b commit 5a088c4
Show file tree
Hide file tree
Showing 21 changed files with 121,075 additions and 365 deletions.
213 changes: 123 additions & 90 deletions ArduinoFirmware/Configuration.h
@@ -1,7 +1,7 @@
/*
************************ Configurations module *************************
*
* Copyright (c) 2021 Rodrigo C. C. Silva [https://github.com/SinisterRj/SafetyPrinter]
* Copyright (c) 2021~22 Rodrigo C. C. Silva [https://github.com/SinisterRj/SafetyPrinter]
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -21,33 +21,60 @@
// ****************************************************************************
// General Configurations:

#define INTERLOCK_RELAY_PIN 6 // Arduino's Digital pin connected to the Printer's power supply relay.
#define INTERLOCK_POLARITY HIGH // Change if you need to toggle the behavior of the interlock pin (if its HIGH it means that the [INTERLOCK_RELAY_PIN] output will be LOW under normal conditions and HIGH when an interlock occurs)
#define MINIMUM_INTERLOCK_DELAY 5 // Minimum amount of time (in s) that an interlock will be active (to avoid fast switch printer on and off and possible damage it)
// ######################## Interlock Relay ########################

#define INTERLOCK_RELAY_PIN 10 // Arduino's Digital pin connected to the Printer's power supply relay.
#define INTERLOCK_POLARITY HIGH // Change if you need to toggle the behavior of the interlock pin (if its HIGH it means that the [INTERLOCK_RELAY_PIN] output will be LOW under normal conditions and HIGH when an interlock occurs)
#define MINIMUM_INTERLOCK_DELAY 5 // Minimum amount of time (in s) that an interlock will be active (to avoid fast switch printer on and off and possible damage it)

#define RESET_BUTTON_PIN 11 // Arduino's Digital pin connected to the trip reset switch (OPTIONAL).
#define RESET_DELAY 2500 // Delay for reseting the trip condition in [ms]

#define ALARM_LED_PIN 10 // Arduino's Digital pin connected to the alarm indication LED (OPTIONAL).
#define TRIP_LED_PIN 12 // Arduino's Digital pin connected to the trip indication LED (OPTIONAL).
#define LED_DELAY 5000 // Led heart beat interval in [ms]
// ######################## Reset button ########################

#define HAS_SERIAL_COMM // Uncomment to Enable serial communications. Needed to interface with Octoprint plugin (OPTIONAL)
#ifdef HAS_SERIAL_COMM
#define BAUD_RATE 38400 // :[2400, 9600, 19200, 38400, 57600, 115200]
#endif
#define RESET_BUTTON_PIN 11 // Arduino's Digital pin connected to the trip reset switch (OPTIONAL).
#define RESET_DELAY 2500 // Delay for reseting the trip condition in [ms]. The user must press the reset button for this amount of time to reset a trip.

#define HAS_LCD // Uncomment to Enable the use of a 2x16 I2C LCD. (OPTIONAL)

#ifdef HAS_LCD
#define LCD_DELAY 2000 // LCD refresh rate in ms
#define LCD_ADDRESS 0x27 // LCD I2C address
#define LCD_SDA_PIN A4 // I2C data PIN (always use this pin for Arduino Uno or Nano)
#define LCD_SCL_PIN A5 // I2C clock PIN (always use this pin for Arduino Uno or Nano)
#endif
// ######################## Auto-Reset ########################

#define ARDUINO_RESET_PIN 2 // Arduino's Digital pin connected to RST pin (resets Arduino via serial C9 command to allow firware update from octoprint's plugin).

// ######################## Alarm & trip LED indication ########################

#define HAS_NEOPIXEL // Use a neopixel led or strip to indicate the Safety Printer MCU status (OPTIONAL).
#ifdef HAS_NEOPIXEL
#define NEOPIXEL_PIN 13 // Arduino's Digital pin connected to the neopixels strip data line.
#define NEOPIXEL_COUNT 1 // Number of neopixels (LEDs) on the strip.
#define NEOPIXEL_TYPE NEO_GRB // Neopixel color order: NEO_RGB, NEO_GRB or NEO_RGBW.
#define NEOPIXEL_BRIGHTNESS 125 // Neopixel leds brightness. Any value from 0 to 255.
#define NORMAL_RGB 60,255,10 // Normal status neopixel color in [Red,Green,Blue,White].
#define ALARM_RGB 255,255,0 // Alarm status neopixel color in [Red,Green,Blue,White].
#define TRIP_RGB 255,0,0 // Trip status neopixel color in [Red,Green,Blue,White].
#define ALARM_BLINK 500 // Alarm color blink interval in [ms]
#else
#define ALARM_LED_PIN 13 // Arduino's Digital pin connected to the alarm indication LED (OPTIONAL).
#define TRIP_LED_PIN 12 // Arduino's Digital pin connected to the trip indication LED (OPTIONAL).
#define LED_DELAY 5000 // Led heart beat interval in [ms]
#endif

// ######################## Serial Communication ########################

#define HAS_SERIAL_COMM // Uncomment to Enable serial communications. Needed to interface with Octoprint plugin (OPTIONAL)
#ifdef HAS_SERIAL_COMM
#define BAUD_RATE 115200 // :[2400, 9600, 19200, 38400, 57600, 115200]
#endif

// ######################## LCD ########################

//#define HAS_LCD // Uncomment to Enable the use of a 2x16 I2C LCD. (OPTIONAL)
#ifdef HAS_LCD
#define LCD_DELAY 2000 // LCD refresh rate in ms
#define LCD_ADDRESS 0x27 // LCD I2C address
#define LCD_SDA_PIN A4 // I2C data PIN (always use A4 for Arduino Uno or Nano)
#define LCD_SCL_PIN A5 // I2C clock PIN (always use A5 for Arduino Uno or Nano)
#endif

// ######################## Sensors ########################

/*
****************************************************************************
Sensor configuration:
Max: 8 sensors
Expand All @@ -56,11 +83,11 @@ All sensors have the same structure:
SENSOR_X_LABEL : Mandatory : A string with the sensor's NAME - MAX 16 characters. Don't use ",", "#", "$", ":", "<" or ">";
SENSOR_X_PIN : Mandatory : Arduino's pin (Analog or digital) connected to the sensor signal;
SENSOR_X_AUX_PIN : *Optional : Arduino's digital pin to power the temperature sensor;
SENSOR_X_AUX_PIN : *Optional : Arduino's digital pin to power the temperature sensor (mandatory for NTC_SENSOR);
SENSOR_X_TYPE : Mandatory : [DIGIGTAL_SENSOR] for On/OFF sensors or [NTC_SENSOR] for temperature sensors (NTC thermistor type)
SENSOR_X_TIMER : Mandatory : Delay between the sensor signal and raising the alarm. The alarm will be raised IF the sensor signal stays in alarm condition more time than this value. Good to avoid spurious alarms. Expressed in [ms].
SENSOR_X_ALARM_SP : Mandatory : Alarm set point. Defines the signal condition to raise the alarm. [HIGH] or [LOW] to define alarm positions on digital sensors, and a [integer] to define a high temperature on temperature sensors.
SENSOR_5_TEMP_TYPE : *Optional : An integer number with one of temperature table calibration bellow:
SENSOR_X_TEMP_TYPE : *Optional : An integer number with one of temperature table calibration bellow (mandatory for NTC_SENSOR):
****************************************************************************
* NTC thermistor temperature equivalence (calibration) table:
Expand Down Expand Up @@ -119,68 +146,74 @@ SENSOR_5_TEMP_TYPE : *Optional : An integer number with one of temperature tabl
*
*/

#define SENSOR_1_LABEL "Flame 1"
#define SENSOR_1_PIN 9
//#define SENSOR_1_AUX_PIN 0
#define SENSOR_1_TYPE DIGIGTAL_SENSOR
#define SENSOR_1_TIMER 250
#define SENSOR_1_ALARM_SP LOW
//#define SENSOR_1_TEMP_TYPE 1

#define SENSOR_2_LABEL "Flame 2"
#define SENSOR_2_PIN 8
//#define SENSOR_2_AUX_PIN 0
#define SENSOR_2_TYPE DIGIGTAL_SENSOR
#define SENSOR_2_TIMER 250
#define SENSOR_2_ALARM_SP LOW
//#define SENSOR_2_TEMP_TYPE 1

#define SENSOR_3_LABEL "Emergency Button"
#define SENSOR_3_PIN 5
//#define SENSOR_3_AUX_PIN 0
#define SENSOR_3_TYPE DIGIGTAL_SENSOR
#define SENSOR_3_TIMER 250
#define SENSOR_3_ALARM_SP LOW
//#define SENSOR_3_TEMP_TYPE 1

#define SENSOR_4_LABEL "Smoke"
#define SENSOR_4_PIN 7
//#define SENSOR_4_AUX_PIN 0
#define SENSOR_4_TYPE DIGIGTAL_SENSOR
#define SENSOR_4_TIMER 250
#define SENSOR_4_ALARM_SP LOW
//#define SENSOR_4_TEMP_TYPE 1

#define SENSOR_5_LABEL "HotEnd Temp."
#define SENSOR_5_PIN A6
#define SENSOR_5_AUX_PIN 2
#define SENSOR_5_TYPE NTC_SENSOR
#define SENSOR_5_TIMER 250
#define SENSOR_5_ALARM_SP 290
#define SENSOR_5_TEMP_TYPE 1

#define SENSOR_6_LABEL "Bed Temp."
#define SENSOR_6_PIN A7
#define SENSOR_6_AUX_PIN 3
#define SENSOR_6_TYPE NTC_SENSOR
#define SENSOR_6_TIMER 250
#define SENSOR_6_ALARM_SP 150
#define SENSOR_6_TEMP_TYPE 1
/*
#define SENSOR_7_LABEL "Spare"
#define SENSOR_7_PIN 1
#define SENSOR_7_AUX_PIN 0
#define SENSOR_7_TYPE DIGIGTAL_SENSOR
#define SENSOR_7_TIMER 250
#define SENSOR_7_ALARM_SP LOW
#define SENSOR_7_TEMP_TYPE 1
*/
/*
#define SENSOR_8_LABEL "Spare"
#define SENSOR_8_PIN 1
#define SENSOR_8_AUX_PIN 0
#define SENSOR_8_TYPE DIGIGTAL_SENSOR
#define SENSOR_8_TIMER 250
#define SENSOR_8_ALARM_SP LOW
#define SENSOR_8_TEMP_TYPE 1
*/
// Digital Sensor 1:
#define SENSOR_1_LABEL "Smoke"
#define SENSOR_1_PIN 9
//#define SENSOR_1_AUX_PIN 0
#define SENSOR_1_TYPE DIGIGTAL_SENSOR
#define SENSOR_1_TIMER 250
#define SENSOR_1_ALARM_SP LOW
//#define SENSOR_1_TEMP_TYPE 1

// Digital Sensor 2
#define SENSOR_2_LABEL "Flame 1"
#define SENSOR_2_PIN 8
//#define SENSOR_2_AUX_PIN 0
#define SENSOR_2_TYPE DIGIGTAL_SENSOR
#define SENSOR_2_TIMER 250
#define SENSOR_2_ALARM_SP LOW
//#define SENSOR_2_TEMP_TYPE 1

// Digital Sensor 3
#define SENSOR_3_LABEL "Flame 2"
#define SENSOR_3_PIN 7
//#define SENSOR_3_AUX_PIN 0
#define SENSOR_3_TYPE DIGIGTAL_SENSOR
#define SENSOR_3_TIMER 250
#define SENSOR_3_ALARM_SP LOW
//#define SENSOR_3_TEMP_TYPE 1

// Digital Sensor 4
#define SENSOR_4_LABEL "Emergency Button"
#define SENSOR_4_PIN 6
//#define SENSOR_4_AUX_PIN 0
#define SENSOR_4_TYPE DIGIGTAL_SENSOR
#define SENSOR_4_TIMER 250
#define SENSOR_4_ALARM_SP LOW
//#define SENSOR_4_TEMP_TYPE 1

// Temp. Sensor 1
#define SENSOR_5_LABEL "HotEnd Temp."
#define SENSOR_5_PIN A0 //A6
#define SENSOR_5_AUX_PIN 5 //2
#define SENSOR_5_TYPE NTC_SENSOR
#define SENSOR_5_TIMER 250
#define SENSOR_5_ALARM_SP 290
#define SENSOR_5_TEMP_TYPE 13

// Temp. Sensor 2
#define SENSOR_6_LABEL "Bed Temp."
#define SENSOR_6_PIN A1 //A7
#define SENSOR_6_AUX_PIN 4 //3
#define SENSOR_6_TYPE NTC_SENSOR
#define SENSOR_6_TIMER 250
#define SENSOR_6_ALARM_SP 150
#define SENSOR_6_TEMP_TYPE 1
/*
#define SENSOR_7_LABEL "Spare"
#define SENSOR_7_PIN 1
#define SENSOR_7_AUX_PIN 0
#define SENSOR_7_TYPE DIGIGTAL_SENSOR
#define SENSOR_7_TIMER 250
#define SENSOR_7_ALARM_SP LOW
#define SENSOR_7_TEMP_TYPE 1
*/
/*
#define SENSOR_8_LABEL "Spare"
#define SENSOR_8_PIN 1
#define SENSOR_8_AUX_PIN 0
#define SENSOR_8_TYPE DIGIGTAL_SENSOR
#define SENSOR_8_TIMER 250
#define SENSOR_8_ALARM_SP LOW
#define SENSOR_8_TEMP_TYPE 1
*/
12 changes: 6 additions & 6 deletions ArduinoFirmware/EEPROM.ino
@@ -1,6 +1,6 @@
//************************* EEPROM module *************************
/*
* Copyright (c) 2021 Rodrigo C. C. Silva [https://github.com/SinisterRj/SafetyPrinter]
* Copyright (c) 2021~22 Rodrigo C. C. Silva [https://github.com/SinisterRj/SafetyPrinter]
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -75,9 +75,9 @@ void readEEPROMData() {
if (firstLoop) {
firstLoop = false;
#ifdef HAS_SERIAL_COMM
Serial.print(F("Waiting "));
Serial.print(MINIMUM_INTERLOCK_DELAY);
Serial.println(F("s to turn on printer."));
SERIAL.print(F("Waiting "));
SERIAL.print(MINIMUM_INTERLOCK_DELAY);
SERIAL.println(F("s to turn on printer."));
#endif
}
delay(250);
Expand All @@ -87,15 +87,15 @@ void readEEPROMData() {
} else {
//Write EEPROM for the first time
#ifdef HAS_SERIAL_COMM
Serial.println(F("Wrong EEPROM version. Overwriting EEPROM with standard values."));
SERIAL.println(F("Wrong EEPROM version. Overwriting EEPROM with standard values."));
#endif
writeEEPROMData();
}
}
else {
//EEPROM corrupted. Write standard values
#ifdef HAS_SERIAL_COMM
Serial.println(F("EEPROM corrupted. Overwriting EEPROM with standard values."));
SERIAL.println(F("EEPROM corrupted. Overwriting EEPROM with standard values."));
#endif
writeEEPROMData();
}
Expand Down
2 changes: 1 addition & 1 deletion ArduinoFirmware/LCD.ino
@@ -1,6 +1,6 @@
//************************* LCD module *************************
/*
* Copyright (c) 2021 Rodrigo C. C. Silva [https://github.com/SinisterRj/SafetyPrinter]
* Copyright (c) 2021~22 Rodrigo C. C. Silva [https://github.com/SinisterRj/SafetyPrinter]
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down

0 comments on commit 5a088c4

Please sign in to comment.