ReflowController/Software/reflowController/reflowController.ino

70 lines
1.2 KiB
C++

#include <Arduino.h>
#include <U8g2lib.h>
#include <Encoder.h>
//#include "Adafruit_MAX31855.h"
#include "max6675.h"
struct reflow_profile
{
float preheat_rate;
float preheat_temp;
int preheat_time;
float reflow_rate;
float reflow_temp;
float reflow_time;
} profile[4];
struct reflow_process
{
reflow_profile profile;
int phase; // 0 = standby, 1 = heizen, 2 = preheat, 3 = heizen, 4 = reflow, 5 = cooldown
int countdown; // timer
int timer;
char title[20];
float temp; // zieltemperatur
} process;
float oven_temp = 0.0;
long EncPos = 0;
unsigned long timer100 = 0;
unsigned long timer500 = 0;
unsigned long timer1000 = 0;
void setup() {
Serial.begin(9600);
Serial.println("Reflow Controller v00.01");
Encoder_Init();
Buzzer_Init();
Display_Init();
Thermo_Init();
Reflow_Init();
}
void loop() {
Encoder_Task();
if (millis() > 100 + timer100) { // alle 100ms
timer100 = millis();
Buzzer_Task();
}
if (millis() > 500 + timer500) { // alle 500ms
timer500 = millis();
Thermo_Task();
}
if (millis() > 1000 + timer1000) { // alle 1s
timer1000 = millis();
Reflow_Task();
}
Display_Task(); // so oft wie möglich
}