@@ 137,7 137,7 @@ unsigned long calibration_cool_lag_time = -1;
unsigned long calibration_heat_lag_time = -1;
int calibration_lag_degrees = -1;
-// Baking
+// Baking state machine
enum ReflowState {
PREHEAT,
SOAK,
@@ 146,6 146,7 @@ enum ReflowState {
};
ReflowState reflow_state = PREHEAT;
+// Reflow profile
int preheat_temp = 150;
int preheat_duration = 35'000;
int soak_temp = 175;
@@ 154,10 155,12 @@ int reflow_temp = 249;
int reflow_duration = 60'000;
int cool_duration = 35'000;
+// Reflow meta
int holding_at_temp = 0;
int holding_at_time = 0;
int holding_at_reheat_time = 0;
int desired_temp = 0;
+int reflow_rise_time = 0;
unsigned long reflow_state_start_time = 0;
// Menus
@@ 711,11 714,26 @@ void reflow_loop() {
}
break;
case REFLOW:
- if (current_time - reflow_state_start_time > reflow_duration
- && current_temp >= reflow_temp - calibration_lag_degrees) {
- reflow_state = COOL;
- reflow_state_start_time = current_time;
- return;
+ if (reflow_rise_time == 0) {
+ if (current_temp >= reflow_temp - calibration_lag_degrees) {
+ reflow_rise_time = current_time - reflow_state_start_time;
+ }
+ } else {
+ // The reflow stage is defined as a duration above the soak
+ // temp, with a peak of the reflow temp. Therefore, once we've
+ // hit our peak and are at least the rise time through our
+ // desired temp, we transition to COOL.
+ // This ensures that we hit our peak, whilst also keeping things
+ // hot for the amount of time we're after.
+ if (reflow_duration - (current_time - reflow_state_start_time) <= reflow_rise_time
+ // Alternatively, if we've completely blown through our
+ // duration without ever hitting the peak, then just
+ // kill the elements so that we don't risk damaging
+ // anything.
+ || current_time - reflow_state_start_time > reflow_duration) {
+ reflow_state = COOL;
+ reflow_state_start_time = current_time;
+ }
}
break;
case COOL: