|
@@ -105,12 +105,6 @@ static volatile bool temp_meas_ready = false;
|
105
|
105
|
static unsigned char soft_pwm[EXTRUDERS];
|
106
|
106
|
static unsigned char soft_pwm_bed;
|
107
|
107
|
|
108
|
|
-#ifdef WATCHPERIOD
|
109
|
|
- int watch_raw[EXTRUDERS] = { -1000 }; // the first value used for all
|
110
|
|
- int watch_oldtemp[3] = {0,0,0};
|
111
|
|
- unsigned long watchmillis = 0;
|
112
|
|
-#endif //WATCHPERIOD
|
113
|
|
-
|
114
|
108
|
#if EXTRUDERS > 3
|
115
|
109
|
# error Unsupported number of extruders
|
116
|
110
|
#elif EXTRUDERS > 2
|
|
@@ -129,6 +123,10 @@ static int bed_maxttemp = 16383;
|
129
|
123
|
static void *heater_ttbl_map[EXTRUDERS] = ARRAY_BY_EXTRUDERS((void *)heater_0_temptable, (void *)heater_1_temptable, (void *)heater_2_temptable);
|
130
|
124
|
static int heater_ttbllen_map[EXTRUDERS] = ARRAY_BY_EXTRUDERS(heater_0_temptable_len, heater_1_temptable_len, heater_2_temptable_len);
|
131
|
125
|
|
|
126
|
+#ifdef WATCH_TEMP_PERIOD
|
|
127
|
+int watch_start_temp[EXTRUDERS] = ARRAY_BY_EXTRUDERS(0,0,0);
|
|
128
|
+unsigned long watchmillis[EXTRUDERS] = ARRAY_BY_EXTRUDERS(0,0,0);
|
|
129
|
+#endif //WATCH_TEMP_PERIOD
|
132
|
130
|
|
133
|
131
|
//===========================================================================
|
134
|
132
|
//============================= functions ============================
|
|
@@ -376,20 +374,23 @@ void manage_heater()
|
376
|
374
|
else {
|
377
|
375
|
soft_pwm[e] = 0;
|
378
|
376
|
}
|
379
|
|
- } // End extruder for loop
|
380
|
|
-
|
381
|
|
- #ifdef WATCHPERIOD
|
382
|
|
- if(watchmillis && millis() - watchmillis > WATCHPERIOD){
|
383
|
|
- if(watch_oldtemp[0] >= degHotend(active_extruder)){
|
384
|
|
- setTargetHotend(0,active_extruder);
|
|
377
|
+
|
|
378
|
+ #ifdef WATCH_TEMP_PERIOD
|
|
379
|
+ if(watchmillis[e] && millis() - watchmillis[e] > WATCH_TEMP_PERIOD)
|
|
380
|
+ {
|
|
381
|
+ if(degHotend(e) < watch_start_temp[e] + WATCH_TEMP_INCREASE)
|
|
382
|
+ {
|
|
383
|
+ setTargetHotend(0, e);
|
385
|
384
|
LCD_MESSAGEPGM("Heating failed");
|
386
|
385
|
SERIAL_ECHO_START;
|
387
|
386
|
SERIAL_ECHOLN("Heating failed");
|
388
|
387
|
}else{
|
389
|
|
- watchmillis = 0;
|
|
388
|
+ watchmillis[e] = 0;
|
390
|
389
|
}
|
391
|
390
|
}
|
392
|
|
- #endif
|
|
391
|
+ #endif
|
|
392
|
+
|
|
393
|
+ } // End extruder for loop
|
393
|
394
|
|
394
|
395
|
|
395
|
396
|
#ifndef PIDTEMPBED
|
|
@@ -625,9 +626,6 @@ void tp_init()
|
625
|
626
|
// Finish init of mult extruder arrays
|
626
|
627
|
for(int e = 0; e < EXTRUDERS; e++) {
|
627
|
628
|
// populate with the first value
|
628
|
|
-#ifdef WATCHPERIOD
|
629
|
|
- watch_raw[e] = watch_raw[0];
|
630
|
|
-#endif
|
631
|
629
|
maxttemp[e] = maxttemp[0];
|
632
|
630
|
#ifdef PIDTEMP
|
633
|
631
|
temp_iState_min[e] = 0.0;
|
|
@@ -746,22 +744,17 @@ void tp_init()
|
746
|
744
|
#endif //BED_MAXTEMP
|
747
|
745
|
}
|
748
|
746
|
|
749
|
|
-
|
750
|
|
-
|
751
|
747
|
void setWatch()
|
752
|
748
|
{
|
753
|
|
-#ifdef WATCHPERIOD
|
754
|
|
- int t = 0;
|
|
749
|
+#ifdef WATCH_TEMP_PERIOD
|
755
|
750
|
for (int e = 0; e < EXTRUDERS; e++)
|
756
|
751
|
{
|
757
|
|
- if(isHeatingHotend(e))
|
758
|
|
- watch_oldtemp[0] = degHotend(0);
|
|
752
|
+ if(degHotend(e) < degTargetHotend(e) - (WATCH_TEMP_INCREASE * 2))
|
759
|
753
|
{
|
760
|
|
- t = max(t,millis());
|
761
|
|
- watch_raw[e] = current_raw[e];
|
|
754
|
+ watch_start_temp[e] = degHotend(e);
|
|
755
|
+ watchmillis[e] = millis();
|
762
|
756
|
}
|
763
|
757
|
}
|
764
|
|
- watchmillis = t;
|
765
|
758
|
#endif
|
766
|
759
|
}
|
767
|
760
|
|