|
@@ -177,7 +177,7 @@ static volatile bool temp_meas_ready = false;
|
177
|
177
|
// Init min and max temp with extreme values to prevent false errors during startup
|
178
|
178
|
static int minttemp_raw[EXTRUDERS] = ARRAY_BY_EXTRUDERS( HEATER_0_RAW_LO_TEMP , HEATER_1_RAW_LO_TEMP , HEATER_2_RAW_LO_TEMP, HEATER_3_RAW_LO_TEMP);
|
179
|
179
|
static int maxttemp_raw[EXTRUDERS] = ARRAY_BY_EXTRUDERS( HEATER_0_RAW_HI_TEMP , HEATER_1_RAW_HI_TEMP , HEATER_2_RAW_HI_TEMP, HEATER_3_RAW_HI_TEMP);
|
180
|
|
-static int minttemp[EXTRUDERS] = ARRAY_BY_EXTRUDERS( 0, 0, 0, 0 );
|
|
180
|
+static int minttemp[EXTRUDERS] = { 0 };
|
181
|
181
|
static int maxttemp[EXTRUDERS] = ARRAY_BY_EXTRUDERS( 16383, 16383, 16383, 16383 );
|
182
|
182
|
//static int bed_minttemp_raw = HEATER_BED_RAW_LO_TEMP; /* No bed mintemp error implemented?!? */
|
183
|
183
|
#ifdef BED_MAXTEMP
|
|
@@ -197,8 +197,8 @@ static float analog2tempBed(int raw);
|
197
|
197
|
static void updateTemperaturesFromRawValues();
|
198
|
198
|
|
199
|
199
|
#ifdef WATCH_TEMP_PERIOD
|
200
|
|
- int watch_start_temp[EXTRUDERS] = ARRAY_BY_EXTRUDERS(0,0,0,0);
|
201
|
|
- unsigned long watchmillis[EXTRUDERS] = ARRAY_BY_EXTRUDERS(0,0,0,0);
|
|
200
|
+ int watch_start_temp[EXTRUDERS] = { 0 };
|
|
201
|
+ unsigned long watchmillis[EXTRUDERS] = { 0 };
|
202
|
202
|
#endif //WATCH_TEMP_PERIOD
|
203
|
203
|
|
204
|
204
|
#ifndef SOFT_PWM_SCALE
|
|
@@ -661,12 +661,6 @@ void manage_heater() {
|
661
|
661
|
|
662
|
662
|
updateTemperaturesFromRawValues();
|
663
|
663
|
|
664
|
|
- #ifdef HEATER_0_USES_MAX6675
|
665
|
|
- float ct = current_temperature[0];
|
666
|
|
- if (ct > min(HEATER_0_MAXTEMP, 1023)) max_temp_error(0);
|
667
|
|
- if (ct < max(HEATER_0_MINTEMP, 0.01)) min_temp_error(0);
|
668
|
|
- #endif //HEATER_0_USES_MAX6675
|
669
|
|
-
|
670
|
664
|
unsigned long ms = millis();
|
671
|
665
|
|
672
|
666
|
// Loop through all extruders
|
|
@@ -1257,9 +1251,15 @@ enum TempState {
|
1257
|
1251
|
// Timer 0 is shared with millies
|
1258
|
1252
|
//
|
1259
|
1253
|
ISR(TIMER0_COMPB_vect) {
|
|
1254
|
+ #ifdef TEMP_SENSOR_1_AS_REDUNDANT
|
|
1255
|
+ #define TEMP_SENSOR_COUNT 2
|
|
1256
|
+ #else
|
|
1257
|
+ #define TEMP_SENSOR_COUNT EXTRUDERS
|
|
1258
|
+ #endif
|
|
1259
|
+
|
1260
|
1260
|
//these variables are only accesible from the ISR, but static, so they don't lose their value
|
1261
|
1261
|
static unsigned char temp_count = 0;
|
1262
|
|
- static unsigned long raw_temp_value[EXTRUDERS] = { 0 };
|
|
1262
|
+ static unsigned long raw_temp_value[TEMP_SENSOR_COUNT] = { 0 };
|
1263
|
1263
|
static unsigned long raw_temp_bed_value = 0;
|
1264
|
1264
|
static TempState temp_state = StartupDelay;
|
1265
|
1265
|
static unsigned char pwm_count = BIT(SOFT_PWM_SCALE);
|
|
@@ -1588,16 +1588,22 @@ ISR(TIMER0_COMPB_vect) {
|
1588
|
1588
|
|
1589
|
1589
|
temp_meas_ready = true;
|
1590
|
1590
|
temp_count = 0;
|
1591
|
|
- for (int i = 0; i < EXTRUDERS; i++) raw_temp_value[i] = 0;
|
|
1591
|
+ for (int i = 0; i < TEMP_SENSOR_COUNT; i++) raw_temp_value[i] = 0;
|
1592
|
1592
|
raw_temp_bed_value = 0;
|
1593
|
1593
|
|
1594
|
|
- #if HEATER_0_RAW_LO_TEMP > HEATER_0_RAW_HI_TEMP
|
1595
|
|
- #define GE0 <=
|
|
1594
|
+ #ifdef HEATER_0_USES_MAX6675
|
|
1595
|
+ float ct = current_temperature[0];
|
|
1596
|
+ if (ct > min(HEATER_0_MAXTEMP, 1023)) max_temp_error(0);
|
|
1597
|
+ if (ct < max(HEATER_0_MINTEMP, 0.01)) min_temp_error(0);
|
1596
|
1598
|
#else
|
1597
|
|
- #define GE0 >=
|
|
1599
|
+ #if HEATER_0_RAW_LO_TEMP > HEATER_0_RAW_HI_TEMP
|
|
1600
|
+ #define GE0 <=
|
|
1601
|
+ #else
|
|
1602
|
+ #define GE0 >=
|
|
1603
|
+ #endif
|
|
1604
|
+ if (current_temperature_raw[0] GE0 maxttemp_raw[0]) max_temp_error(0);
|
|
1605
|
+ if (minttemp_raw[0] GE0 current_temperature_raw[0]) min_temp_error(0);
|
1598
|
1606
|
#endif
|
1599
|
|
- if (current_temperature_raw[0] GE0 maxttemp_raw[0]) max_temp_error(0);
|
1600
|
|
- if (minttemp_raw[0] GE0 current_temperature_raw[0]) min_temp_error(0);
|
1601
|
1607
|
|
1602
|
1608
|
#if EXTRUDERS > 1
|
1603
|
1609
|
#if HEATER_1_RAW_LO_TEMP > HEATER_1_RAW_HI_TEMP
|