prelimary lcd shield support
This commit is contained in:
parent
85126113e8
commit
97572dbe10
|
@ -12,7 +12,7 @@ cmake_minimum_required(VERSION 2.8.5)
|
|||
project(ReflowCtl C CXX)
|
||||
|
||||
|
||||
set(ARDUINO_DEFAULT_BOARD diecimila) # Default Board ID, when not specified
|
||||
set(ARDUINO_DEFAULT_BOARD atmega328) # Default Board ID, when not specified
|
||||
set(ARDUINO_DEFAULT_PORT /dev/ttyUSB0) # Default Port, when not specified
|
||||
|
||||
link_directories(/usr/share/arduino/libraries)
|
||||
|
@ -20,4 +20,4 @@ link_directories(/usr/share/arduino/libraries)
|
|||
generate_arduino_firmware(reflowctl
|
||||
SKETCH reflowctl
|
||||
PORT /dev/ttyUSB0
|
||||
BOARD diecimila)
|
||||
BOARD atmega328)
|
||||
|
|
|
@ -30,7 +30,6 @@ unsigned int temperature = 25; // actual oven temp
|
|||
unsigned int last_temperature = 25; // last oven temp
|
||||
int actual_dt = 0; // actual difference from last to actual temperatur
|
||||
|
||||
|
||||
// profile temperatures
|
||||
unsigned int Ts_min = 150; // °C
|
||||
unsigned int Ts_max = 200; // °C
|
||||
|
@ -38,14 +37,12 @@ unsigned int Tl = 217; // 217°C
|
|||
unsigned int Tp = 260; // 245-260°C
|
||||
unsigned int time_max = 480; // 8*60s max
|
||||
|
||||
|
||||
// profile temp per second rates
|
||||
unsigned int ramp_up_rate_min = 0; // not used yet
|
||||
unsigned int ramp_up_rate_max = 50; // 3°C/s
|
||||
unsigned int ramp_down_max = 6; // 6°C/s max
|
||||
unsigned int ramp_down_min = 2; // 2°C/s max
|
||||
|
||||
|
||||
// profile temp durations
|
||||
unsigned int Ts_duration_min = 60; // s
|
||||
unsigned int Ts_duration_max = 180; // s
|
||||
|
@ -54,7 +51,6 @@ unsigned int Tl_duration_max = 150; // 60-150s
|
|||
unsigned int Tp_duration_min = 20; // 20-40s
|
||||
unsigned int Tp_duration_max = 40; // 20-40s
|
||||
|
||||
|
||||
// timestamps of event beginnings/ends
|
||||
unsigned int Ts_time_start = 0;
|
||||
unsigned int Ts_time_end = 0;
|
||||
|
@ -63,7 +59,6 @@ unsigned int Tl_time_end = 0;
|
|||
unsigned int Tp_time_start = 0;
|
||||
unsigned int Tp_time_end = 0;
|
||||
|
||||
|
||||
// thermostat
|
||||
unsigned int set_min = 0;
|
||||
unsigned int set_max = 0;
|
||||
|
@ -86,18 +81,46 @@ DFR_Key keypad;
|
|||
|
||||
void setup() {
|
||||
Serial.begin(9600);
|
||||
delay(300);
|
||||
pinMode(13, OUTPUT);
|
||||
pinMode(2, INPUT);
|
||||
set_start_state();
|
||||
|
||||
lcd.begin(16, 2);
|
||||
lcd.clear();
|
||||
lcd.setCursor(0, 0);
|
||||
lcd.print("hello, world!");
|
||||
keypad.setRate(10);
|
||||
Serial.println("init done");
|
||||
}
|
||||
|
||||
|
||||
void print_profile_state() {
|
||||
String tmp("P: ");
|
||||
tmp += state;
|
||||
tmp += "/";
|
||||
tmp += error_condition;
|
||||
lcd.setCursor(0, 1);
|
||||
lcd.print(tmp);
|
||||
}
|
||||
|
||||
void print_status() {
|
||||
String tmp("s: ");
|
||||
tmp += time;
|
||||
tmp += " C: ";
|
||||
tmp += temperature;
|
||||
lcd.setCursor(0, 0);
|
||||
lcd.print(tmp);
|
||||
}
|
||||
|
||||
/* led edit mode procedures
|
||||
* global menu (up/down) -> select
|
||||
* start
|
||||
* edit profile
|
||||
* select value (up/down) -> select | left
|
||||
* value (up/down) -> select | left
|
||||
*
|
||||
*/
|
||||
void print_edit() {
|
||||
}
|
||||
|
||||
void control_oven() {
|
||||
if (temperature < set_min && !is_oven_heating) {
|
||||
is_oven_heating = true;
|
||||
|
@ -381,50 +404,51 @@ void loop() {
|
|||
get_temp();
|
||||
check_dt();
|
||||
|
||||
if (!error_condition) {
|
||||
print_debug();
|
||||
}
|
||||
else {
|
||||
set_error_state();
|
||||
}
|
||||
|
||||
switch (state) {
|
||||
case START_STATE:
|
||||
handle_start_state();
|
||||
break;
|
||||
case PREHEAT_STATE:
|
||||
handle_preheat_state();
|
||||
break;
|
||||
case RAMP_UP_STATE:
|
||||
handle_ramp_up_state();
|
||||
break;
|
||||
case TAL_FIRST_STATE:
|
||||
handle_tal_first_state();
|
||||
break;
|
||||
case PEAK_STATE:
|
||||
handle_peak_state();
|
||||
break;
|
||||
case TAL_SECOND_STATE:
|
||||
Tl_time_end = time;
|
||||
handle_tal_second_state();
|
||||
break;
|
||||
case RAMP_DOWN_STATE:
|
||||
handle_ramp_down_state();
|
||||
break;
|
||||
case END_STATE:
|
||||
handle_end_state();
|
||||
break;
|
||||
case ERROR_STATE:
|
||||
handle_error_state();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
control_oven();
|
||||
// if (!error_condition) {
|
||||
// print_debug();
|
||||
// }
|
||||
// else {
|
||||
// set_error_state();
|
||||
// }
|
||||
//
|
||||
// switch (state) {
|
||||
// case START_STATE:
|
||||
// handle_start_state();
|
||||
// break;
|
||||
// case PREHEAT_STATE:
|
||||
// handle_preheat_state();
|
||||
// break;
|
||||
// case RAMP_UP_STATE:
|
||||
// handle_ramp_up_state();
|
||||
// break;
|
||||
// case TAL_FIRST_STATE:
|
||||
// handle_tal_first_state();
|
||||
// break;
|
||||
// case PEAK_STATE:
|
||||
// handle_peak_state();
|
||||
// break;
|
||||
// case TAL_SECOND_STATE:
|
||||
// Tl_time_end = time;
|
||||
// handle_tal_second_state();
|
||||
// break;
|
||||
// case RAMP_DOWN_STATE:
|
||||
// handle_ramp_down_state();
|
||||
// break;
|
||||
// case END_STATE:
|
||||
// handle_end_state();
|
||||
// break;
|
||||
// case ERROR_STATE:
|
||||
// handle_error_state();
|
||||
// break;
|
||||
// default:
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// control_oven();
|
||||
lcd.clear();
|
||||
lcd.setCursor(0, 0);
|
||||
lcd.print(time);
|
||||
print_debug();
|
||||
print_status();
|
||||
print_profile_state();
|
||||
delay(1000);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue