sync to home
This commit is contained in:
parent
338a8de119
commit
02e91af826
|
@ -14,6 +14,7 @@
|
||||||
#define E_RAMPDOWN_TOO_FAST 2 // oven cools down too fast
|
#define E_RAMPDOWN_TOO_FAST 2 // oven cools down too fast
|
||||||
#define E_RAMPDOWN_TOO_SLOW 3 // oven cools down too slow
|
#define E_RAMPDOWN_TOO_SLOW 3 // oven cools down too slow
|
||||||
#define E_TIME_MAX 4 // reflow process does take too long
|
#define E_TIME_MAX 4 // reflow process does take too long
|
||||||
|
#define E_PEAK_TOO_LONG 5 // package was roasted
|
||||||
|
|
||||||
unsigned int time = 0; // profile seconds
|
unsigned int time = 0; // profile seconds
|
||||||
unsigned int temperatur = 25; // actual oven temp
|
unsigned int temperatur = 25; // actual oven temp
|
||||||
|
@ -36,13 +37,15 @@ unsigned int Ts_max_time = 0;
|
||||||
unsigned int Tl_time = 0;
|
unsigned int Tl_time = 0;
|
||||||
unsigned int Tl_time_end = 0;
|
unsigned int Tl_time_end = 0;
|
||||||
unsigned int Tp_time = 0;
|
unsigned int Tp_time = 0;
|
||||||
|
unsigned int Tp_time_end = 0;
|
||||||
unsigned int Tl_end_time = 0;
|
unsigned int Tl_end_time = 0;
|
||||||
unsigned int error_condition = 0;
|
unsigned int error_condition = 0;
|
||||||
|
|
||||||
byte state = START_STATE;
|
byte state = START_STATE;
|
||||||
|
|
||||||
|
int analogPin = 2;
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
pinMode(13, OUTPUT);
|
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,50 +90,61 @@ boolean check_tal_duration() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
|
||||||
time = millis() / 1000;
|
|
||||||
get_temp();
|
|
||||||
Serial.print(time);
|
|
||||||
Serial.print(" ");
|
|
||||||
Serial.print(temperatur);
|
|
||||||
Serial.print(" ");
|
|
||||||
Serial.println(last_temperatur);
|
|
||||||
|
|
||||||
switch (state) {
|
boolean check_peak_duration() {
|
||||||
case START_STATE:
|
if (Tp_time_end - Tp_time > peak_duration) {
|
||||||
// going from room temp to preheat, nothing to check here
|
error_condition = E_PEAK_TOO_LONG;
|
||||||
if (!check_rampup_rate())
|
return false;
|
||||||
goto error;
|
|
||||||
if (temperatur > Ts_min) {
|
|
||||||
Serial.println("Changed state to PREHEAT_STATE");
|
|
||||||
Ts_min_time = time;
|
|
||||||
state++;
|
|
||||||
}
|
}
|
||||||
case PREHEAT_STATE:
|
}
|
||||||
if (temperatur > Ts_max) {
|
|
||||||
Serial.println("Changed state to PREHEAT_STATE");
|
|
||||||
Ts_max_time = time;
|
void loop() {
|
||||||
state++;
|
// time = millis() / 1000;
|
||||||
}
|
// get_temp();
|
||||||
break;
|
// Serial.print(time);
|
||||||
case TAL_FIRST_STATE:
|
// Serial.print(" ");
|
||||||
break;
|
// Serial.print(temperatur);
|
||||||
case PEAK_STATE:
|
// Serial.print(" ");
|
||||||
break;
|
// Serial.println(last_temperatur);
|
||||||
case TAL_SECOND_STATE:
|
|
||||||
break;
|
Serial.println(analogRead(analogPin));
|
||||||
case RAMPDOWN_STATE:
|
|
||||||
break;
|
// switch (state) {
|
||||||
case END_STATE:
|
// case START_STATE:
|
||||||
default:
|
// // going from room temp to preheat, nothing to check here
|
||||||
break;
|
// if (!check_rampup_rate())
|
||||||
}
|
// goto error;
|
||||||
|
// if (temperatur > Ts_min) {
|
||||||
delay(1000);
|
// Serial.println("Changed state to PREHEAT_STATE");
|
||||||
|
// Ts_min_time = time;
|
||||||
return;
|
// state++;
|
||||||
|
// }
|
||||||
error:
|
// case PREHEAT_STATE:
|
||||||
state = END_STATE;
|
// if (temperatur > Ts_max) {
|
||||||
Serial.println(error_condition);
|
// Serial.println("Changed state to PREHEAT_STATE");
|
||||||
|
// Ts_max_time = time;
|
||||||
|
// state++;
|
||||||
|
// }
|
||||||
|
// break;
|
||||||
|
// case TAL_FIRST_STATE:
|
||||||
|
// break;
|
||||||
|
// case PEAK_STATE:
|
||||||
|
// break;
|
||||||
|
// case TAL_SECOND_STATE:
|
||||||
|
// break;
|
||||||
|
// case RAMPDOWN_STATE:
|
||||||
|
// break;
|
||||||
|
// case END_STATE:
|
||||||
|
// default:
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
delay(1000);
|
||||||
|
//
|
||||||
|
// return;
|
||||||
|
//
|
||||||
|
// error:
|
||||||
|
// state = END_STATE;
|
||||||
|
// Serial.println(error_condition);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
import serial
|
import serial
|
||||||
ser = serial.Serial('/dev/ttyUSB0', 9600)
|
|
||||||
while 1:
|
while 1:
|
||||||
|
try:
|
||||||
|
ser = serial.Serial('/dev/ttyUSB0', 9600)
|
||||||
|
while 1:
|
||||||
print ser.readline()
|
print ser.readline()
|
||||||
|
except Exception, e:
|
||||||
|
pass
|
||||||
|
|
Loading…
Reference in New Issue