|
|
@@ -1,38 +1,3 @@
|
|
|
-/*
|
|
|
-
|
|
|
- GraphicsTest.ino
|
|
|
-
|
|
|
- Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/)
|
|
|
-
|
|
|
- Copyright (c) 2016, olikraus@gmail.com
|
|
|
- All rights reserved.
|
|
|
-
|
|
|
- Redistribution and use in source and binary forms, with or without modification,
|
|
|
- are permitted provided that the following conditions are met:
|
|
|
-
|
|
|
- * Redistributions of source code must retain the above copyright notice, this list
|
|
|
- of conditions and the following disclaimer.
|
|
|
-
|
|
|
- * Redistributions in binary form must reproduce the above copyright notice, this
|
|
|
- list of conditions and the following disclaimer in the documentation and/or other
|
|
|
- materials provided with the distribution.
|
|
|
-
|
|
|
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
|
|
- CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
|
|
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
|
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
|
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
|
|
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
|
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
|
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
|
|
- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
|
- ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
-
|
|
|
-*/
|
|
|
-
|
|
|
#include <Arduino.h>
|
|
|
#include <U8g2lib.h>
|
|
|
#include <PID_v1.h>
|
|
|
@@ -142,6 +107,7 @@ MAX6675 tcouple(THERMOCOUPLE_CS_PIN);
|
|
|
U8G2_SSD1305_128X64_ADAFRUIT_F_4W_HW_SPI u8g2(U8G2_R0, DISPLAY_CS_PIN, DISPLAY_DC_PIN, DISPLAY_RESET_PIN);
|
|
|
PID reflowOvenPID(&inputTemp, &output, &setpoint, kp, ki, kd, DIRECT);
|
|
|
|
|
|
+// Called once in setup, sets global display attributes.
|
|
|
void u8g2_prepare(void) {
|
|
|
u8g2.setFont(u8g2_font_8x13_tf);
|
|
|
u8g2.setFontRefHeightExtendedText();
|
|
|
@@ -171,28 +137,7 @@ void readTemp(void) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-void setup(void) {
|
|
|
- // Turn off SSR.
|
|
|
- digitalWrite(SSR_PIN, LOW);
|
|
|
- pinMode(SSR_PIN, OUTPUT);
|
|
|
-
|
|
|
- pinMode(BUTTON_PIN, INPUT_PULLUP);
|
|
|
-
|
|
|
- digitalWrite(DONE_LED_PIN, LOW);
|
|
|
- pinMode(DONE_LED_PIN, OUTPUT);
|
|
|
-
|
|
|
- u8g2.begin();
|
|
|
- u8g2.clearBuffer();
|
|
|
- u8g2_prepare();
|
|
|
-
|
|
|
- // Set window size
|
|
|
- windowSize = 2000;
|
|
|
- // Initialize thermocouple reading variable
|
|
|
- nextRead = millis();
|
|
|
-}
|
|
|
-
|
|
|
void handleSwitch(void) {
|
|
|
-
|
|
|
// If switch 1 is pressed
|
|
|
if (switchStatus == SWITCH_1)
|
|
|
{
|
|
|
@@ -421,6 +366,26 @@ void drawScreen(void) {
|
|
|
u8g2.sendBuffer();
|
|
|
}
|
|
|
|
|
|
+void setup(void) {
|
|
|
+ // Turn off SSR.
|
|
|
+ digitalWrite(SSR_PIN, LOW);
|
|
|
+ pinMode(SSR_PIN, OUTPUT);
|
|
|
+
|
|
|
+ pinMode(BUTTON_PIN, INPUT_PULLUP);
|
|
|
+
|
|
|
+ digitalWrite(DONE_LED_PIN, LOW);
|
|
|
+ pinMode(DONE_LED_PIN, OUTPUT);
|
|
|
+
|
|
|
+ u8g2.begin();
|
|
|
+ u8g2.clearBuffer();
|
|
|
+ u8g2_prepare();
|
|
|
+
|
|
|
+ // Set window size
|
|
|
+ windowSize = 2000;
|
|
|
+ // Initialize thermocouple reading variable
|
|
|
+ nextRead = millis();
|
|
|
+}
|
|
|
+
|
|
|
void loop(void) {
|
|
|
if (millis() > nextRead) {
|
|
|
readTemp();
|