Bladeren bron

Don't test raw temp for MAX6675

- Remove test of raw temp for thermistor 0 when using MAX6675
- Longer `raw_temp_value` array for `TEMP_SENSOR_1_AS_REDUNDANT`
Scott Lahteine 10 jaren geleden
bovenliggende
commit
fc53e43de6
1 gewijzigde bestanden met toevoegingen van 22 en 16 verwijderingen
  1. 22
    16
      Marlin/temperature.cpp

+ 22
- 16
Marlin/temperature.cpp Bestand weergeven

177
 // Init min and max temp with extreme values to prevent false errors during startup
177
 // Init min and max temp with extreme values to prevent false errors during startup
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);
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
 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);
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
 static int maxttemp[EXTRUDERS] = ARRAY_BY_EXTRUDERS( 16383, 16383, 16383, 16383 );
181
 static int maxttemp[EXTRUDERS] = ARRAY_BY_EXTRUDERS( 16383, 16383, 16383, 16383 );
182
 //static int bed_minttemp_raw = HEATER_BED_RAW_LO_TEMP; /* No bed mintemp error implemented?!? */
182
 //static int bed_minttemp_raw = HEATER_BED_RAW_LO_TEMP; /* No bed mintemp error implemented?!? */
183
 #ifdef BED_MAXTEMP
183
 #ifdef BED_MAXTEMP
197
 static void updateTemperaturesFromRawValues();
197
 static void updateTemperaturesFromRawValues();
198
 
198
 
199
 #ifdef WATCH_TEMP_PERIOD
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
 #endif //WATCH_TEMP_PERIOD
202
 #endif //WATCH_TEMP_PERIOD
203
 
203
 
204
 #ifndef SOFT_PWM_SCALE
204
 #ifndef SOFT_PWM_SCALE
661
 
661
 
662
   updateTemperaturesFromRawValues();
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
   unsigned long ms = millis();
664
   unsigned long ms = millis();
671
 
665
 
672
   // Loop through all extruders
666
   // Loop through all extruders
1257
 // Timer 0 is shared with millies
1251
 // Timer 0 is shared with millies
1258
 //
1252
 //
1259
 ISR(TIMER0_COMPB_vect) {
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
   //these variables are only accesible from the ISR, but static, so they don't lose their value
1260
   //these variables are only accesible from the ISR, but static, so they don't lose their value
1261
   static unsigned char temp_count = 0;
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
   static unsigned long raw_temp_bed_value = 0;
1263
   static unsigned long raw_temp_bed_value = 0;
1264
   static TempState temp_state = StartupDelay;
1264
   static TempState temp_state = StartupDelay;
1265
   static unsigned char pwm_count = BIT(SOFT_PWM_SCALE);
1265
   static unsigned char pwm_count = BIT(SOFT_PWM_SCALE);
1588
 
1588
 
1589
     temp_meas_ready = true;
1589
     temp_meas_ready = true;
1590
     temp_count = 0;
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
     raw_temp_bed_value = 0;
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
     #else
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
     #endif
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
     #if EXTRUDERS > 1
1608
     #if EXTRUDERS > 1
1603
       #if HEATER_1_RAW_LO_TEMP > HEATER_1_RAW_HI_TEMP
1609
       #if HEATER_1_RAW_LO_TEMP > HEATER_1_RAW_HI_TEMP

Laden…
Annuleren
Opslaan