Explorar el Código

Merge pull request #3339 from thinkyhead/rc_has_temp_hotend

Add HAS_TEMP_HOTEND, account for MAX31855 in conditionals
Scott Lahteine hace 9 años
padre
commit
22a43980e8
Se han modificado 4 ficheros con 27 adiciones y 17 borrados
  1. 19
    9
      Marlin/Conditionals.h
  2. 1
    1
      Marlin/Marlin.h
  3. 5
    5
      Marlin/Marlin_main.cpp
  4. 2
    2
      Marlin/temperature.cpp

+ 19
- 9
Marlin/Conditionals.h Ver fichero

@@ -440,7 +440,9 @@
440 440
     #define HEATER_0_USES_THERMISTOR
441 441
   #endif
442 442
 
443
-  #if TEMP_SENSOR_1 == -1
443
+  #if TEMP_SENSOR_1 <= -2
444
+    #error MAX6675 / MAX31855 Thermocouples not supported for TEMP_SENSOR_1
445
+  #elif TEMP_SENSOR_1 == -1
444 446
     #define HEATER_1_USES_AD595
445 447
   #elif TEMP_SENSOR_1 == 0
446 448
     #undef HEATER_1_MINTEMP
@@ -450,7 +452,9 @@
450 452
     #define HEATER_1_USES_THERMISTOR
451 453
   #endif
452 454
 
453
-  #if TEMP_SENSOR_2 == -1
455
+  #if TEMP_SENSOR_2 <= -2
456
+    #error MAX6675 / MAX31855 Thermocouples not supported for TEMP_SENSOR_2
457
+  #elif TEMP_SENSOR_2 == -1
454 458
     #define HEATER_2_USES_AD595
455 459
   #elif TEMP_SENSOR_2 == 0
456 460
     #undef HEATER_2_MINTEMP
@@ -460,7 +464,9 @@
460 464
     #define HEATER_2_USES_THERMISTOR
461 465
   #endif
462 466
 
463
-  #if TEMP_SENSOR_3 == -1
467
+  #if TEMP_SENSOR_3 <= -2
468
+    #error MAX6675 / MAX31855 Thermocouples not supported for TEMP_SENSOR_3
469
+  #elif TEMP_SENSOR_3 == -1
464 470
     #define HEATER_3_USES_AD595
465 471
   #elif TEMP_SENSOR_3 == 0
466 472
     #undef HEATER_3_MINTEMP
@@ -470,7 +476,9 @@
470 476
     #define HEATER_3_USES_THERMISTOR
471 477
   #endif
472 478
 
473
-  #if TEMP_SENSOR_BED == -1
479
+  #if TEMP_SENSOR_BED <= -2
480
+    #error MAX6675 / MAX31855 Thermocouples not supported for TEMP_SENSOR_BED
481
+  #elif TEMP_SENSOR_BED == -1
474 482
     #define BED_USES_AD595
475 483
   #elif TEMP_SENSOR_BED == 0
476 484
     #undef BED_MINTEMP
@@ -498,11 +506,11 @@
498 506
   /**
499 507
    * Shorthand for pin tests, used wherever needed
500 508
    */
501
-  #define HAS_TEMP_0 (PIN_EXISTS(TEMP_0) && TEMP_SENSOR_0 != 0 && TEMP_SENSOR_0 != -2)
502
-  #define HAS_TEMP_1 (PIN_EXISTS(TEMP_1) && TEMP_SENSOR_1 != 0)
503
-  #define HAS_TEMP_2 (PIN_EXISTS(TEMP_2) && TEMP_SENSOR_2 != 0)
504
-  #define HAS_TEMP_3 (PIN_EXISTS(TEMP_3) && TEMP_SENSOR_3 != 0)
505
-  #define HAS_TEMP_BED (PIN_EXISTS(TEMP_BED) && TEMP_SENSOR_BED != 0)
509
+  #define HAS_TEMP_0 (PIN_EXISTS(TEMP_0) && TEMP_SENSOR_0 != 0 && TEMP_SENSOR_0 > -2)
510
+  #define HAS_TEMP_1 (PIN_EXISTS(TEMP_1) && TEMP_SENSOR_1 != 0 && TEMP_SENSOR_1 > -2)
511
+  #define HAS_TEMP_2 (PIN_EXISTS(TEMP_2) && TEMP_SENSOR_2 != 0 && TEMP_SENSOR_2 > -2)
512
+  #define HAS_TEMP_3 (PIN_EXISTS(TEMP_3) && TEMP_SENSOR_3 != 0 && TEMP_SENSOR_3 > -2)
513
+  #define HAS_TEMP_BED (PIN_EXISTS(TEMP_BED) && TEMP_SENSOR_BED != 0 && TEMP_SENSOR_BED > -2)
506 514
   #define HAS_HEATER_0 (PIN_EXISTS(HEATER_0))
507 515
   #define HAS_HEATER_1 (PIN_EXISTS(HEATER_1))
508 516
   #define HAS_HEATER_2 (PIN_EXISTS(HEATER_2))
@@ -581,6 +589,8 @@
581 589
 
582 590
   #define HAS_MOTOR_CURRENT_PWM (PIN_EXISTS(MOTOR_CURRENT_PWM_XY) || PIN_EXISTS(MOTOR_CURRENT_PWM_Z) || PIN_EXISTS(MOTOR_CURRENT_PWM_E))
583 591
 
592
+  #define HAS_TEMP_HOTEND (HAS_TEMP_0 || ENABLED(HEATER_0_USES_MAX6675))
593
+
584 594
   /**
585 595
    * Helper Macros for heaters and extruder fan
586 596
    */

+ 1
- 1
Marlin/Marlin.h Ver fichero

@@ -368,7 +368,7 @@ extern uint8_t active_extruder;
368 368
   extern void digipot_i2c_init();
369 369
 #endif
370 370
 
371
-#if HAS_TEMP_0 || HAS_TEMP_BED || ENABLED(HEATER_0_USES_MAX6675)
371
+#if HAS_TEMP_HOTEND || HAS_TEMP_BED
372 372
   void print_heaterstates();
373 373
 #endif
374 374
 

+ 5
- 5
Marlin/Marlin_main.cpp Ver fichero

@@ -4100,10 +4100,10 @@ inline void gcode_M104() {
4100 4100
   if (print_job_stop()) LCD_MESSAGEPGM(WELCOME_MSG);
4101 4101
 }
4102 4102
 
4103
-#if HAS_TEMP_0 || HAS_TEMP_BED || ENABLED(HEATER_0_USES_MAX6675)
4103
+#if HAS_TEMP_HOTEND || HAS_TEMP_BED
4104 4104
 
4105 4105
   void print_heaterstates() {
4106
-    #if HAS_TEMP_0 || ENABLED(HEATER_0_USES_MAX6675)
4106
+    #if HAS_TEMP_HOTEND
4107 4107
       SERIAL_PROTOCOLPGM(" T:");
4108 4108
       SERIAL_PROTOCOL_F(degHotend(target_extruder), 1);
4109 4109
       SERIAL_PROTOCOLPGM(" /");
@@ -4179,10 +4179,10 @@ inline void gcode_M104() {
4179 4179
 inline void gcode_M105() {
4180 4180
   if (setTargetedHotend(105)) return;
4181 4181
 
4182
-  #if HAS_TEMP_0 || HAS_TEMP_BED || ENABLED(HEATER_0_USES_MAX6675)
4182
+  #if HAS_TEMP_HOTEND || HAS_TEMP_BED
4183 4183
     SERIAL_PROTOCOLPGM(MSG_OK);
4184 4184
     print_heaterstates();
4185
-  #else // !HAS_TEMP_0 && !HAS_TEMP_BED
4185
+  #else // !HAS_TEMP_HOTEND && !HAS_TEMP_BED
4186 4186
     SERIAL_ERROR_START;
4187 4187
     SERIAL_ERRORLNPGM(MSG_ERR_NO_THERMISTORS);
4188 4188
   #endif
@@ -4271,7 +4271,7 @@ inline void gcode_M109() {
4271 4271
     now = millis();
4272 4272
     if (now > next_temp_ms) { //Print temp & remaining time every 1s while waiting
4273 4273
       next_temp_ms = now + 1000UL;
4274
-      #if HAS_TEMP_0 || HAS_TEMP_BED || ENABLED(HEATER_0_USES_MAX6675)
4274
+      #if HAS_TEMP_HOTEND || HAS_TEMP_BED
4275 4275
         print_heaterstates();
4276 4276
       #endif
4277 4277
       #ifdef TEMP_RESIDENCY_TIME

+ 2
- 2
Marlin/temperature.cpp Ver fichero

@@ -350,7 +350,7 @@ void PID_autotune(float temp, int extruder, int ncycles, bool set_result/*=false
350 350
     }
351 351
     // Every 2 seconds...
352 352
     if (ms > temp_ms + 2000) {
353
-      #if HAS_TEMP_0 || HAS_TEMP_BED || ENABLED(HEATER_0_USES_MAX6675)
353
+      #if HAS_TEMP_HOTEND || HAS_TEMP_BED
354 354
         print_heaterstates();
355 355
         SERIAL_EOL;
356 356
       #endif
@@ -1183,7 +1183,7 @@ void disable_all_heaters() {
1183 1183
     WRITE_HEATER_ ## NR (LOW); \
1184 1184
   }
1185 1185
 
1186
-  #if HAS_TEMP_0 || ENABLED(HEATER_0_USES_MAX6675)
1186
+  #if HAS_TEMP_HOTEND
1187 1187
     setTargetHotend(0, 0);
1188 1188
     soft_pwm[0] = 0;
1189 1189
     WRITE_HEATER_0P(LOW); // Should HEATERS_PARALLEL apply here? Then change to DISABLE_HEATER(0)

Loading…
Cancelar
Guardar