Преглед на файлове

Simplified temp sensor conditionals

Scott Lahteine преди 4 години
родител
ревизия
59eca253e1
променени са 5 файла, в които са добавени 170 реда и са изтрити 178 реда
  1. 48
    52
      Marlin/src/inc/Conditionals_post.h
  2. 20
    22
      Marlin/src/inc/SanityCheck.h
  3. 69
    68
      Marlin/src/module/temperature.cpp
  4. 11
    14
      Marlin/src/module/temperature.h
  5. 22
    22
      Marlin/src/module/thermistor/thermistors.h

+ 48
- 52
Marlin/src/inc/Conditionals_post.h Целия файл

@@ -436,7 +436,7 @@
436 436
 #endif
437 437
 
438 438
 #if TEMP_SENSOR_0 == -5 || TEMP_SENSOR_0 == -3 || TEMP_SENSOR_0 == -2
439
-  #define HEATER_0_USES_MAX6675
439
+  #define HEATER_0_USES_MAX6675 1
440 440
   #if TEMP_SENSOR_0 == -3
441 441
     #define HEATER_0_MAX6675_TMIN -270
442 442
     #define HEATER_0_MAX6675_TMAX 1800
@@ -445,19 +445,19 @@
445 445
     #define HEATER_0_MAX6675_TMAX 1024
446 446
   #endif
447 447
   #if TEMP_SENSOR_0 == -5
448
-    #define MAX6675_IS_MAX31865
448
+    #define MAX6675_IS_MAX31865 1
449 449
   #elif TEMP_SENSOR_0 == -3
450
-    #define MAX6675_IS_MAX31855
450
+    #define MAX6675_IS_MAX31855 1
451 451
   #endif
452 452
 #elif TEMP_SENSOR_0 == -4
453
-  #define HEATER_0_USES_AD8495
453
+  #define HEATER_0_USES_AD8495 1
454 454
 #elif TEMP_SENSOR_0 == -1
455
-  #define HEATER_0_USES_AD595
455
+  #define HEATER_0_USES_AD595 1
456 456
 #elif TEMP_SENSOR_0 > 0
457 457
   #define THERMISTOR_HEATER_0 TEMP_SENSOR_0
458
-  #define HEATER_0_USES_THERMISTOR
458
+  #define HEATER_0_USES_THERMISTOR 1
459 459
   #if TEMP_SENSOR_0 == 1000
460
-    #define HEATER_0_USER_THERMISTOR
460
+    #define HEATER_0_USER_THERMISTOR 1
461 461
   #endif
462 462
 #else
463 463
   #undef HEATER_0_MINTEMP
@@ -465,7 +465,7 @@
465 465
 #endif
466 466
 
467 467
 #if TEMP_SENSOR_1 == -5 || TEMP_SENSOR_1 == -3 || TEMP_SENSOR_1 == -2
468
-  #define HEATER_1_USES_MAX6675
468
+  #define HEATER_1_USES_MAX6675 1
469 469
   #if TEMP_SENSOR_1 == -3
470 470
     #define HEATER_1_MAX6675_TMIN -270
471 471
     #define HEATER_1_MAX6675_TMAX 1800
@@ -483,14 +483,14 @@
483 483
     #endif
484 484
   #endif
485 485
 #elif TEMP_SENSOR_1 == -4
486
-  #define HEATER_1_USES_AD8495
486
+  #define HEATER_1_USES_AD8495 1
487 487
 #elif TEMP_SENSOR_1 == -1
488
-  #define HEATER_1_USES_AD595
488
+  #define HEATER_1_USES_AD595 1
489 489
 #elif TEMP_SENSOR_1 > 0
490 490
   #define THERMISTOR_HEATER_1 TEMP_SENSOR_1
491
-  #define HEATER_1_USES_THERMISTOR
491
+  #define HEATER_1_USES_THERMISTOR 1
492 492
   #if TEMP_SENSOR_1 == 1000
493
-    #define HEATER_1_USER_THERMISTOR
493
+    #define HEATER_1_USER_THERMISTOR 1
494 494
   #endif
495 495
 #else
496 496
   #undef HEATER_1_MINTEMP
@@ -498,18 +498,18 @@
498 498
 #endif
499 499
 
500 500
 #if TEMP_SENSOR_2 == -4
501
-  #define HEATER_2_USES_AD8495
501
+  #define HEATER_2_USES_AD8495 1
502 502
 #elif TEMP_SENSOR_2 == -3
503 503
   #error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_2."
504 504
 #elif TEMP_SENSOR_2 == -2
505 505
   #error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_2."
506 506
 #elif TEMP_SENSOR_2 == -1
507
-  #define HEATER_2_USES_AD595
507
+  #define HEATER_2_USES_AD595 1
508 508
 #elif TEMP_SENSOR_2 > 0
509 509
   #define THERMISTOR_HEATER_2 TEMP_SENSOR_2
510
-  #define HEATER_2_USES_THERMISTOR
510
+  #define HEATER_2_USES_THERMISTOR 1
511 511
   #if TEMP_SENSOR_2 == 1000
512
-    #define HEATER_2_USER_THERMISTOR
512
+    #define HEATER_2_USER_THERMISTOR 1
513 513
   #endif
514 514
 #else
515 515
   #undef HEATER_2_MINTEMP
@@ -517,18 +517,18 @@
517 517
 #endif
518 518
 
519 519
 #if TEMP_SENSOR_3 == -4
520
-  #define HEATER_3_USES_AD8495
520
+  #define HEATER_3_USES_AD8495 1
521 521
 #elif TEMP_SENSOR_3 == -3
522 522
   #error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_3."
523 523
 #elif TEMP_SENSOR_3 == -2
524 524
   #error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_3."
525 525
 #elif TEMP_SENSOR_3 == -1
526
-  #define HEATER_3_USES_AD595
526
+  #define HEATER_3_USES_AD595 1
527 527
 #elif TEMP_SENSOR_3 > 0
528 528
   #define THERMISTOR_HEATER_3 TEMP_SENSOR_3
529
-  #define HEATER_3_USES_THERMISTOR
529
+  #define HEATER_3_USES_THERMISTOR 1
530 530
   #if TEMP_SENSOR_3 == 1000
531
-    #define HEATER_3_USER_THERMISTOR
531
+    #define HEATER_3_USER_THERMISTOR 1
532 532
   #endif
533 533
 #else
534 534
   #undef HEATER_3_MINTEMP
@@ -536,18 +536,18 @@
536 536
 #endif
537 537
 
538 538
 #if TEMP_SENSOR_4 == -4
539
-  #define HEATER_4_USES_AD8495
539
+  #define HEATER_4_USES_AD8495 1
540 540
 #elif TEMP_SENSOR_4 == -3
541 541
   #error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_4."
542 542
 #elif TEMP_SENSOR_4 == -2
543 543
   #error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_4."
544 544
 #elif TEMP_SENSOR_4 == -1
545
-  #define HEATER_4_USES_AD595
545
+  #define HEATER_4_USES_AD595 1
546 546
 #elif TEMP_SENSOR_4 > 0
547 547
   #define THERMISTOR_HEATER_4 TEMP_SENSOR_4
548
-  #define HEATER_4_USES_THERMISTOR
548
+  #define HEATER_4_USES_THERMISTOR 1
549 549
   #if TEMP_SENSOR_4 == 1000
550
-    #define HEATER_4_USER_THERMISTOR
550
+    #define HEATER_4_USER_THERMISTOR 1
551 551
   #endif
552 552
 #else
553 553
   #undef HEATER_4_MINTEMP
@@ -555,18 +555,18 @@
555 555
 #endif
556 556
 
557 557
 #if TEMP_SENSOR_5 == -4
558
-  #define HEATER_5_USES_AD8495
558
+  #define HEATER_5_USES_AD8495 1
559 559
 #elif TEMP_SENSOR_5 == -3
560 560
   #error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_5."
561 561
 #elif TEMP_SENSOR_5 == -2
562 562
   #error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_5."
563 563
 #elif TEMP_SENSOR_5 == -1
564
-  #define HEATER_5_USES_AD595
564
+  #define HEATER_5_USES_AD595 1
565 565
 #elif TEMP_SENSOR_5 > 0
566 566
   #define THERMISTOR_HEATER_5 TEMP_SENSOR_5
567
-  #define HEATER_5_USES_THERMISTOR
567
+  #define HEATER_5_USES_THERMISTOR 1
568 568
   #if TEMP_SENSOR_5 == 1000
569
-    #define HEATER_5_USER_THERMISTOR
569
+    #define HEATER_5_USER_THERMISTOR 1
570 570
   #endif
571 571
 #else
572 572
   #undef HEATER_5_MINTEMP
@@ -574,18 +574,18 @@
574 574
 #endif
575 575
 
576 576
 #if TEMP_SENSOR_6 == -4
577
-  #define HEATER_6_USES_AD8495
577
+  #define HEATER_6_USES_AD8495 1
578 578
 #elif TEMP_SENSOR_6 == -3
579 579
   #error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_6."
580 580
 #elif TEMP_SENSOR_6 == -2
581 581
   #error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_6."
582 582
 #elif TEMP_SENSOR_6 == -1
583
-  #define HEATER_6_USES_AD595
583
+  #define HEATER_6_USES_AD595 1
584 584
 #elif TEMP_SENSOR_6 > 0
585 585
   #define THERMISTOR_HEATER_6 TEMP_SENSOR_6
586
-  #define HEATER_6_USES_THERMISTOR
586
+  #define HEATER_6_USES_THERMISTOR 1
587 587
   #if TEMP_SENSOR_6 == 1000
588
-    #define HEATER_6_USER_THERMISTOR
588
+    #define HEATER_6_USER_THERMISTOR 1
589 589
   #endif
590 590
 #else
591 591
   #undef HEATER_6_MINTEMP
@@ -593,18 +593,18 @@
593 593
 #endif
594 594
 
595 595
 #if TEMP_SENSOR_7 == -4
596
-  #define HEATER_7_USES_AD8495
596
+  #define HEATER_7_USES_AD8495 1
597 597
 #elif TEMP_SENSOR_7 == -3
598 598
   #error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_7."
599 599
 #elif TEMP_SENSOR_7 == -2
600 600
   #error "MAX7775 Thermocouples (-2) not supported for TEMP_SENSOR_7."
601 601
 #elif TEMP_SENSOR_7 == -1
602
-  #define HEATER_7_USES_AD595
602
+  #define HEATER_7_USES_AD595 1
603 603
 #elif TEMP_SENSOR_7 > 0
604 604
   #define THERMISTOR_HEATER_7 TEMP_SENSOR_7
605
-  #define HEATER_7_USES_THERMISTOR
605
+  #define HEATER_7_USES_THERMISTOR 1
606 606
   #if TEMP_SENSOR_7 == 1000
607
-    #define HEATER_7_USER_THERMISTOR
607
+    #define HEATER_7_USER_THERMISTOR 1
608 608
   #endif
609 609
 #else
610 610
   #undef HEATER_7_MINTEMP
@@ -612,18 +612,18 @@
612 612
 #endif
613 613
 
614 614
 #if TEMP_SENSOR_BED == -4
615
-  #define HEATER_BED_USES_AD8495
615
+  #define HEATER_BED_USES_AD8495 1
616 616
 #elif TEMP_SENSOR_BED == -3
617 617
   #error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_BED."
618 618
 #elif TEMP_SENSOR_BED == -2
619 619
   #error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_BED."
620 620
 #elif TEMP_SENSOR_BED == -1
621
-  #define HEATER_BED_USES_AD595
621
+  #define HEATER_BED_USES_AD595 1
622 622
 #elif TEMP_SENSOR_BED > 0
623 623
   #define THERMISTORBED TEMP_SENSOR_BED
624
-  #define HEATER_BED_USES_THERMISTOR
624
+  #define HEATER_BED_USES_THERMISTOR 1
625 625
   #if TEMP_SENSOR_BED == 1000
626
-    #define HEATER_BED_USER_THERMISTOR
626
+    #define HEATER_BED_USER_THERMISTOR 1
627 627
   #endif
628 628
 #else
629 629
   #undef BED_MINTEMP
@@ -631,18 +631,18 @@
631 631
 #endif
632 632
 
633 633
 #if TEMP_SENSOR_CHAMBER == -4
634
-  #define HEATER_CHAMBER_USES_AD8495
634
+  #define HEATER_CHAMBER_USES_AD8495 1
635 635
 #elif TEMP_SENSOR_CHAMBER == -3
636 636
   #error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_CHAMBER."
637 637
 #elif TEMP_SENSOR_CHAMBER == -2
638 638
   #error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_CHAMBER."
639 639
 #elif TEMP_SENSOR_CHAMBER == -1
640
-  #define HEATER_CHAMBER_USES_AD595
640
+  #define HEATER_CHAMBER_USES_AD595 1
641 641
 #elif TEMP_SENSOR_CHAMBER > 0
642 642
   #define THERMISTORCHAMBER TEMP_SENSOR_CHAMBER
643
-  #define HEATER_CHAMBER_USES_THERMISTOR
643
+  #define HEATER_CHAMBER_USES_THERMISTOR 1
644 644
   #if TEMP_SENSOR_CHAMBER == 1000
645
-    #define HEATER_CHAMBER_USER_THERMISTOR
645
+    #define HEATER_CHAMBER_USER_THERMISTOR 1
646 646
   #endif
647 647
 #else
648 648
   #undef CHAMBER_MINTEMP
@@ -650,25 +650,21 @@
650 650
 #endif
651 651
 
652 652
 #if TEMP_SENSOR_PROBE == -4
653
-  #define HEATER_PROBE_USES_AD8495
653
+  #define HEATER_PROBE_USES_AD8495 1
654 654
 #elif TEMP_SENSOR_PROBE == -3
655 655
   #error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_PROBE."
656 656
 #elif TEMP_SENSOR_PROBE == -2
657 657
   #error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_PROBE."
658 658
 #elif TEMP_SENSOR_PROBE == -1
659
-  #define HEATER_PROBE_USES_AD595
659
+  #define HEATER_PROBE_USES_AD595 1
660 660
 #elif TEMP_SENSOR_PROBE > 0
661 661
   #define THERMISTORPROBE TEMP_SENSOR_PROBE
662
-  #define PROBE_USES_THERMISTOR
662
+  #define HEATER_PROBE_USES_THERMISTOR 1
663 663
   #if TEMP_SENSOR_PROBE == 1000
664
-    #define PROBE_USER_THERMISTOR
664
+    #define HEATER_PROBE_USER_THERMISTOR 1
665 665
   #endif
666 666
 #endif
667 667
 
668
-#define HOTEND_USES_THERMISTOR ANY( \
669
-  HEATER_0_USES_THERMISTOR, HEATER_1_USES_THERMISTOR, HEATER_2_USES_THERMISTOR, HEATER_3_USES_THERMISTOR, \
670
-  HEATER_4_USES_THERMISTOR, HEATER_5_USES_THERMISTOR, HEATER_6_USES_THERMISTOR, HEATER_7_USES_THERMISTOR )
671
-
672 668
 /**
673 669
  * X_DUAL_ENDSTOPS endstop reassignment
674 670
  */

+ 20
- 22
Marlin/src/inc/SanityCheck.h Целия файл

@@ -1618,34 +1618,41 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal
1618 1618
 /**
1619 1619
  * Required custom thermistor settings
1620 1620
  */
1621
-#if   ENABLED(HEATER_0_USER_THERMISTOR) && !(defined(HOTEND0_PULLUP_RESISTOR_OHMS) && defined(HOTEND0_RESISTANCE_25C_OHMS) && defined(HOTEND0_BETA))
1621
+#if   HEATER_0_USER_THERMISTOR && !(defined(HOTEND0_PULLUP_RESISTOR_OHMS) && defined(HOTEND0_RESISTANCE_25C_OHMS) && defined(HOTEND0_BETA))
1622 1622
   #error "TEMP_SENSOR_0 1000 requires HOTEND0_PULLUP_RESISTOR_OHMS, HOTEND0_RESISTANCE_25C_OHMS and HOTEND0_BETA in Configuration_adv.h."
1623
-#elif ENABLED(HEATER_1_USER_THERMISTOR) && !(defined(HOTEND1_PULLUP_RESISTOR_OHMS) && defined(HOTEND1_RESISTANCE_25C_OHMS) && defined(HOTEND1_BETA))
1623
+#elif HEATER_1_USER_THERMISTOR && !(defined(HOTEND1_PULLUP_RESISTOR_OHMS) && defined(HOTEND1_RESISTANCE_25C_OHMS) && defined(HOTEND1_BETA))
1624 1624
   #error "TEMP_SENSOR_1 1000 requires HOTEND1_PULLUP_RESISTOR_OHMS, HOTEND1_RESISTANCE_25C_OHMS and HOTEND1_BETA in Configuration_adv.h."
1625
-#elif ENABLED(HEATER_2_USER_THERMISTOR) && !(defined(HOTEND2_PULLUP_RESISTOR_OHMS) && defined(HOTEND2_RESISTANCE_25C_OHMS) && defined(HOTEND2_BETA))
1625
+#elif HEATER_2_USER_THERMISTOR && !(defined(HOTEND2_PULLUP_RESISTOR_OHMS) && defined(HOTEND2_RESISTANCE_25C_OHMS) && defined(HOTEND2_BETA))
1626 1626
   #error "TEMP_SENSOR_2 1000 requires HOTEND2_PULLUP_RESISTOR_OHMS, HOTEND2_RESISTANCE_25C_OHMS and HOTEND2_BETA in Configuration_adv.h."
1627
-#elif ENABLED(HEATER_3_USER_THERMISTOR) && !(defined(HOTEND3_PULLUP_RESISTOR_OHMS) && defined(HOTEND3_RESISTANCE_25C_OHMS) && defined(HOTEND3_BETA))
1627
+#elif HEATER_3_USER_THERMISTOR && !(defined(HOTEND3_PULLUP_RESISTOR_OHMS) && defined(HOTEND3_RESISTANCE_25C_OHMS) && defined(HOTEND3_BETA))
1628 1628
   #error "TEMP_SENSOR_3 1000 requires HOTEND3_PULLUP_RESISTOR_OHMS, HOTEND3_RESISTANCE_25C_OHMS and HOTEND3_BETA in Configuration_adv.h."
1629
-#elif ENABLED(HEATER_4_USER_THERMISTOR) && !(defined(HOTEND4_PULLUP_RESISTOR_OHMS) && defined(HOTEND4_RESISTANCE_25C_OHMS) && defined(HOTEND4_BETA))
1629
+#elif HEATER_4_USER_THERMISTOR && !(defined(HOTEND4_PULLUP_RESISTOR_OHMS) && defined(HOTEND4_RESISTANCE_25C_OHMS) && defined(HOTEND4_BETA))
1630 1630
   #error "TEMP_SENSOR_4 1000 requires HOTEND4_PULLUP_RESISTOR_OHMS, HOTEND4_RESISTANCE_25C_OHMS and HOTEND4_BETA in Configuration_adv.h."
1631
-#elif ENABLED(HEATER_5_USER_THERMISTOR) && !(defined(HOTEND5_PULLUP_RESISTOR_OHMS) && defined(HOTEND5_RESISTANCE_25C_OHMS) && defined(HOTEND5_BETA))
1631
+#elif HEATER_5_USER_THERMISTOR && !(defined(HOTEND5_PULLUP_RESISTOR_OHMS) && defined(HOTEND5_RESISTANCE_25C_OHMS) && defined(HOTEND5_BETA))
1632 1632
   #error "TEMP_SENSOR_5 1000 requires HOTEND5_PULLUP_RESISTOR_OHMS, HOTEND5_RESISTANCE_25C_OHMS and HOTEND5_BETA in Configuration_adv.h."
1633
-#elif ENABLED(HEATER_6_USER_THERMISTOR) && !(defined(HOTEND6_PULLUP_RESISTOR_OHMS) && defined(HOTEND6_RESISTANCE_25C_OHMS) && defined(HOTEND6_BETA))
1633
+#elif HEATER_6_USER_THERMISTOR && !(defined(HOTEND6_PULLUP_RESISTOR_OHMS) && defined(HOTEND6_RESISTANCE_25C_OHMS) && defined(HOTEND6_BETA))
1634 1634
   #error "TEMP_SENSOR_6 1000 requires HOTEND6_PULLUP_RESISTOR_OHMS, HOTEND6_RESISTANCE_25C_OHMS and HOTEND6_BETA in Configuration_adv.h."
1635
-#elif ENABLED(HEATER_7_USER_THERMISTOR) && !(defined(HOTEND7_PULLUP_RESISTOR_OHMS) && defined(HOTEND7_RESISTANCE_25C_OHMS) && defined(HOTEND7_BETA))
1635
+#elif HEATER_7_USER_THERMISTOR && !(defined(HOTEND7_PULLUP_RESISTOR_OHMS) && defined(HOTEND7_RESISTANCE_25C_OHMS) && defined(HOTEND7_BETA))
1636 1636
   #error "TEMP_SENSOR_7 1000 requires HOTEND7_PULLUP_RESISTOR_OHMS, HOTEND7_RESISTANCE_25C_OHMS and HOTEND7_BETA in Configuration_adv.h."
1637
-#elif ENABLED(HEATER_BED_USER_THERMISTOR) && !(defined(BED_PULLUP_RESISTOR_OHMS) && defined(BED_RESISTANCE_25C_OHMS) && defined(BED_BETA))
1637
+#elif HEATER_BED_USER_THERMISTOR && !(defined(BED_PULLUP_RESISTOR_OHMS) && defined(BED_RESISTANCE_25C_OHMS) && defined(BED_BETA))
1638 1638
   #error "TEMP_SENSOR_BED 1000 requires BED_PULLUP_RESISTOR_OHMS, BED_RESISTANCE_25C_OHMS and BED_BETA in Configuration_adv.h."
1639
-#elif ENABLED(HEATER_CHAMBER_USER_THERMISTOR) && !(defined(CHAMBER_PULLUP_RESISTOR_OHMS) && defined(CHAMBER_RESISTANCE_25C_OHMS) && defined(CHAMBER_BETA))
1639
+#elif HEATER_CHAMBER_USER_THERMISTOR && !(defined(CHAMBER_PULLUP_RESISTOR_OHMS) && defined(CHAMBER_RESISTANCE_25C_OHMS) && defined(CHAMBER_BETA))
1640 1640
   #error "TEMP_SENSOR_CHAMBER 1000 requires CHAMBER_PULLUP_RESISTOR_OHMS, CHAMBER_RESISTANCE_25C_OHMS and CHAMBER_BETA in Configuration_adv.h."
1641 1641
 #endif
1642 1642
 
1643 1643
 /**
1644
- * A Sensor ID has to be set for each heater
1644
+ * Pins and Sensor IDs must be set for each heater
1645 1645
  */
1646
+#if HEATER_0_USES_MAX6675 && !PIN_EXISTS(MAX6675_SS)
1647
+  #error "MAX6675_SS_PIN (required for TEMP_SENSOR_0) not defined for this board."
1648
+#elif HAS_HOTEND && !HAS_TEMP_HOTEND
1649
+  #error "TEMP_0_PIN (required for TEMP_SENSOR_0) not defined for this board."
1650
+#elif EITHER(HAS_MULTI_HOTEND, HEATERS_PARALLEL) && !HAS_HEATER_1
1651
+  #error "HEATER_1_PIN is not defined. TEMP_SENSOR_1 might not be set, or the board (not EEB / EEF?) doesn't define a pin."
1652
+#endif
1646 1653
 
1647 1654
 #if HAS_MULTI_HOTEND
1648
-  #if ENABLED(HEATER_1_USES_MAX6675) && !PIN_EXISTS(MAX6675_SS2)
1655
+  #if HEATER_1_USES_MAX6675 && !PIN_EXISTS(MAX6675_SS2)
1649 1656
     #error "MAX6675_SS2_PIN (required for TEMP_SENSOR_1) not defined for this board."
1650 1657
   #elif TEMP_SENSOR_1 == 0
1651 1658
     #error "TEMP_SENSOR_1 is required with 2 or more HOTENDS."
@@ -1808,7 +1815,7 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal
1808 1815
   #error "TEMP_SENSOR_1 is required with TEMP_SENSOR_1_AS_REDUNDANT."
1809 1816
 #endif
1810 1817
 
1811
-#if ENABLED(MAX6675_IS_MAX31865) && (!defined(MAX31865_SENSOR_OHMS) || !defined(MAX31865_CALIBRATION_OHMS))
1818
+#if MAX6675_IS_MAX31865 && !(defined(MAX31865_SENSOR_OHMS) && defined(MAX31865_CALIBRATION_OHMS))
1812 1819
   #error "MAX31865_SENSOR_OHMS and MAX31865_CALIBRATION_OHMS must be set in Configuration.h when using a MAX31865 temperature sensor."
1813 1820
 #endif
1814 1821
 
@@ -1827,15 +1834,6 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal
1827 1834
   #error "TEMP_SENSOR_0 is required if there are any extruders."
1828 1835
 #endif
1829 1836
 
1830
-// Pins are required for heaters
1831
-#if ENABLED(HEATER_0_USES_MAX6675) && !PIN_EXISTS(MAX6675_SS)
1832
-  #error "MAX6675_SS_PIN (required for TEMP_SENSOR_0) not defined for this board."
1833
-#elif HAS_HOTEND && !HAS_TEMP_HOTEND
1834
-  #error "TEMP_0_PIN (required for TEMP_SENSOR_0) not defined for this board."
1835
-#elif EITHER(HAS_MULTI_HOTEND, HEATERS_PARALLEL) && !HAS_HEATER_1
1836
-  #error "HEATER_1_PIN is not defined. TEMP_SENSOR_1 might not be set, or the board (not EEB / EEF?) doesn't define a pin."
1837
-#endif
1838
-
1839 1837
 /**
1840 1838
  * Temperature status LEDs
1841 1839
  */

+ 69
- 68
Marlin/src/module/temperature.cpp Целия файл

@@ -44,7 +44,7 @@
44 44
   #include "../lcd/extui/ui_api.h"
45 45
 #endif
46 46
 
47
-#if ENABLED(MAX6675_IS_MAX31865)
47
+#if MAX6675_IS_MAX31865
48 48
   #include <Adafruit_MAX31865.h>
49 49
   #ifndef MAX31865_CS_PIN
50 50
     #define MAX31865_CS_PIN     MAX6675_SS_PIN  // HW:49   SW:65    for example
@@ -114,7 +114,13 @@
114 114
 #if HAS_SERVOS
115 115
   #include "./servo.h"
116 116
 #endif
117
-#if HOTEND_USES_THERMISTOR
117
+
118
+#if ANY(HEATER_0_USES_THERMISTOR, HEATER_1_USES_THERMISTOR, HEATER_2_USES_THERMISTOR, HEATER_3_USES_THERMISTOR, \
119
+        HEATER_4_USES_THERMISTOR, HEATER_5_USES_THERMISTOR, HEATER_6_USES_THERMISTOR, HEATER_7_USES_THERMISTOR )
120
+  #define HAS_HOTEND_THERMISTOR 1
121
+#endif
122
+
123
+#if HAS_HOTEND_THERMISTOR
118 124
   #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
119 125
     static const temp_entry_t* heater_ttbl_map[2] = { HEATER_0_TEMPTABLE, HEATER_1_TEMPTABLE };
120 126
     static constexpr uint8_t heater_ttbllen_map[2] = { HEATER_0_TEMPTABLE_LEN, HEATER_1_TEMPTABLE_LEN };
@@ -1046,11 +1052,11 @@ void Temperature::manage_heater() {
1046 1052
   updateTemperaturesFromRawValues(); // also resets the watchdog
1047 1053
 
1048 1054
   #if DISABLED(IGNORE_THERMOCOUPLE_ERRORS)
1049
-    #if ENABLED(HEATER_0_USES_MAX6675)
1055
+    #if HEATER_0_USES_MAX6675
1050 1056
       if (temp_hotend[0].celsius > _MIN(HEATER_0_MAXTEMP, HEATER_0_MAX6675_TMAX - 1.0)) max_temp_error(H_E0);
1051 1057
       if (temp_hotend[0].celsius < _MAX(HEATER_0_MINTEMP, HEATER_0_MAX6675_TMIN + .01)) min_temp_error(H_E0);
1052 1058
     #endif
1053
-    #if ENABLED(HEATER_1_USES_MAX6675)
1059
+    #if HEATER_1_USES_MAX6675
1054 1060
       if (temp_hotend[1].celsius > _MIN(HEATER_1_MAXTEMP, HEATER_1_MAX6675_TMAX - 1.0)) max_temp_error(H_E1);
1055 1061
       if (temp_hotend[1].celsius < _MAX(HEATER_1_MINTEMP, HEATER_1_MAX6675_TMIN + .01)) min_temp_error(H_E1);
1056 1062
     #endif
@@ -1336,34 +1342,34 @@ void Temperature::manage_heater() {
1336 1342
 
1337 1343
   void Temperature::reset_user_thermistors() {
1338 1344
     user_thermistor_t user_thermistor[USER_THERMISTORS] = {
1339
-      #if ENABLED(HEATER_0_USER_THERMISTOR)
1345
+      #if HEATER_0_USER_THERMISTOR
1340 1346
         { true, 0, 0, HOTEND0_PULLUP_RESISTOR_OHMS, HOTEND0_RESISTANCE_25C_OHMS, 0, 0, HOTEND0_BETA, 0 },
1341 1347
       #endif
1342
-      #if ENABLED(HEATER_1_USER_THERMISTOR)
1348
+      #if HEATER_1_USER_THERMISTOR
1343 1349
         { true, 0, 0, HOTEND1_PULLUP_RESISTOR_OHMS, HOTEND1_RESISTANCE_25C_OHMS, 0, 0, HOTEND1_BETA, 0 },
1344 1350
       #endif
1345
-      #if ENABLED(HEATER_2_USER_THERMISTOR)
1351
+      #if HEATER_2_USER_THERMISTOR
1346 1352
         { true, 0, 0, HOTEND2_PULLUP_RESISTOR_OHMS, HOTEND2_RESISTANCE_25C_OHMS, 0, 0, HOTEND2_BETA, 0 },
1347 1353
       #endif
1348
-      #if ENABLED(HEATER_3_USER_THERMISTOR)
1354
+      #if HEATER_3_USER_THERMISTOR
1349 1355
         { true, 0, 0, HOTEND3_PULLUP_RESISTOR_OHMS, HOTEND3_RESISTANCE_25C_OHMS, 0, 0, HOTEND3_BETA, 0 },
1350 1356
       #endif
1351
-      #if ENABLED(HEATER_4_USER_THERMISTOR)
1357
+      #if HEATER_4_USER_THERMISTOR
1352 1358
         { true, 0, 0, HOTEND4_PULLUP_RESISTOR_OHMS, HOTEND4_RESISTANCE_25C_OHMS, 0, 0, HOTEND4_BETA, 0 },
1353 1359
       #endif
1354
-      #if ENABLED(HEATER_5_USER_THERMISTOR)
1360
+      #if HEATER_5_USER_THERMISTOR
1355 1361
         { true, 0, 0, HOTEND5_PULLUP_RESISTOR_OHMS, HOTEND5_RESISTANCE_25C_OHMS, 0, 0, HOTEND5_BETA, 0 },
1356 1362
       #endif
1357
-      #if ENABLED(HEATER_6_USER_THERMISTOR)
1363
+      #if HEATER_6_USER_THERMISTOR
1358 1364
         { true, 0, 0, HOTEND6_PULLUP_RESISTOR_OHMS, HOTEND6_RESISTANCE_25C_OHMS, 0, 0, HOTEND6_BETA, 0 },
1359 1365
       #endif
1360
-      #if ENABLED(HEATER_7_USER_THERMISTOR)
1366
+      #if HEATER_7_USER_THERMISTOR
1361 1367
         { true, 0, 0, HOTEND7_PULLUP_RESISTOR_OHMS, HOTEND7_RESISTANCE_25C_OHMS, 0, 0, HOTEND7_BETA, 0 },
1362 1368
       #endif
1363
-      #if ENABLED(HEATER_BED_USER_THERMISTOR)
1369
+      #if HEATER_BED_USER_THERMISTOR
1364 1370
         { true, 0, 0, BED_PULLUP_RESISTOR_OHMS, BED_RESISTANCE_25C_OHMS, 0, 0, BED_BETA, 0 },
1365 1371
       #endif
1366
-      #if ENABLED(HEATER_CHAMBER_USER_THERMISTOR)
1372
+      #if HEATER_CHAMBER_USER_THERMISTOR
1367 1373
         { true, 0, 0, CHAMBER_PULLUP_RESISTOR_OHMS, CHAMBER_RESISTANCE_25C_OHMS, 0, 0, CHAMBER_BETA, 0 }
1368 1374
       #endif
1369 1375
     };
@@ -1462,91 +1468,91 @@ void Temperature::manage_heater() {
1462 1468
 
1463 1469
     switch (e) {
1464 1470
       case 0:
1465
-        #if ENABLED(HEATER_0_USER_THERMISTOR)
1471
+        #if HEATER_0_USER_THERMISTOR
1466 1472
           return user_thermistor_to_deg_c(CTI_HOTEND_0, raw);
1467
-        #elif ENABLED(HEATER_0_USES_MAX6675)
1473
+        #elif HEATER_0_USES_MAX6675
1468 1474
           return (
1469
-            #if ENABLED(MAX6675_IS_MAX31865)
1475
+            #if MAX6675_IS_MAX31865
1470 1476
               max31865.temperature(MAX31865_SENSOR_OHMS, MAX31865_CALIBRATION_OHMS)
1471 1477
             #else
1472 1478
               raw * 0.25
1473 1479
             #endif
1474 1480
           );
1475
-        #elif ENABLED(HEATER_0_USES_AD595)
1481
+        #elif HEATER_0_USES_AD595
1476 1482
           return TEMP_AD595(raw);
1477
-        #elif ENABLED(HEATER_0_USES_AD8495)
1483
+        #elif HEATER_0_USES_AD8495
1478 1484
           return TEMP_AD8495(raw);
1479 1485
         #else
1480 1486
           break;
1481 1487
         #endif
1482 1488
       case 1:
1483
-        #if ENABLED(HEATER_1_USER_THERMISTOR)
1489
+        #if HEATER_1_USER_THERMISTOR
1484 1490
           return user_thermistor_to_deg_c(CTI_HOTEND_1, raw);
1485
-        #elif ENABLED(HEATER_1_USES_MAX6675)
1491
+        #elif HEATER_1_USES_MAX6675
1486 1492
           return raw * 0.25;
1487
-        #elif ENABLED(HEATER_1_USES_AD595)
1493
+        #elif HEATER_1_USES_AD595
1488 1494
           return TEMP_AD595(raw);
1489
-        #elif ENABLED(HEATER_1_USES_AD8495)
1495
+        #elif HEATER_1_USES_AD8495
1490 1496
           return TEMP_AD8495(raw);
1491 1497
         #else
1492 1498
           break;
1493 1499
         #endif
1494 1500
       case 2:
1495
-        #if ENABLED(HEATER_2_USER_THERMISTOR)
1501
+        #if HEATER_2_USER_THERMISTOR
1496 1502
           return user_thermistor_to_deg_c(CTI_HOTEND_2, raw);
1497
-        #elif ENABLED(HEATER_2_USES_AD595)
1503
+        #elif HEATER_2_USES_AD595
1498 1504
           return TEMP_AD595(raw);
1499
-        #elif ENABLED(HEATER_2_USES_AD8495)
1505
+        #elif HEATER_2_USES_AD8495
1500 1506
           return TEMP_AD8495(raw);
1501 1507
         #else
1502 1508
           break;
1503 1509
         #endif
1504 1510
       case 3:
1505
-        #if ENABLED(HEATER_3_USER_THERMISTOR)
1511
+        #if HEATER_3_USER_THERMISTOR
1506 1512
           return user_thermistor_to_deg_c(CTI_HOTEND_3, raw);
1507
-        #elif ENABLED(HEATER_3_USES_AD595)
1513
+        #elif HEATER_3_USES_AD595
1508 1514
           return TEMP_AD595(raw);
1509
-        #elif ENABLED(HEATER_3_USES_AD8495)
1515
+        #elif HEATER_3_USES_AD8495
1510 1516
           return TEMP_AD8495(raw);
1511 1517
         #else
1512 1518
           break;
1513 1519
         #endif
1514 1520
       case 4:
1515
-        #if ENABLED(HEATER_4_USER_THERMISTOR)
1521
+        #if HEATER_4_USER_THERMISTOR
1516 1522
           return user_thermistor_to_deg_c(CTI_HOTEND_4, raw);
1517
-        #elif ENABLED(HEATER_4_USES_AD595)
1523
+        #elif HEATER_4_USES_AD595
1518 1524
           return TEMP_AD595(raw);
1519
-        #elif ENABLED(HEATER_4_USES_AD8495)
1525
+        #elif HEATER_4_USES_AD8495
1520 1526
           return TEMP_AD8495(raw);
1521 1527
         #else
1522 1528
           break;
1523 1529
         #endif
1524 1530
       case 5:
1525
-        #if ENABLED(HEATER_5_USER_THERMISTOR)
1531
+        #if HEATER_5_USER_THERMISTOR
1526 1532
           return user_thermistor_to_deg_c(CTI_HOTEND_5, raw);
1527
-        #elif ENABLED(HEATER_5_USES_AD595)
1533
+        #elif HEATER_5_USES_AD595
1528 1534
           return TEMP_AD595(raw);
1529
-        #elif ENABLED(HEATER_5_USES_AD8495)
1535
+        #elif HEATER_5_USES_AD8495
1530 1536
           return TEMP_AD8495(raw);
1531 1537
         #else
1532 1538
           break;
1533 1539
         #endif
1534 1540
       case 6:
1535
-        #if ENABLED(HEATER_6_USER_THERMISTOR)
1541
+        #if HEATER_6_USER_THERMISTOR
1536 1542
           return user_thermistor_to_deg_c(CTI_HOTEND_6, raw);
1537
-        #elif ENABLED(HEATER_6_USES_AD595)
1543
+        #elif HEATER_6_USES_AD595
1538 1544
           return TEMP_AD595(raw);
1539
-        #elif ENABLED(HEATER_6_USES_AD8495)
1545
+        #elif HEATER_6_USES_AD8495
1540 1546
           return TEMP_AD8495(raw);
1541 1547
         #else
1542 1548
           break;
1543 1549
         #endif
1544 1550
       case 7:
1545
-        #if ENABLED(HEATER_7_USER_THERMISTOR)
1551
+        #if HEATER_7_USER_THERMISTOR
1546 1552
           return user_thermistor_to_deg_c(CTI_HOTEND_7, raw);
1547
-        #elif ENABLED(HEATER_7_USES_AD595)
1553
+        #elif HEATER_7_USES_AD595
1548 1554
           return TEMP_AD595(raw);
1549
-        #elif ENABLED(HEATER_7_USES_AD8495)
1555
+        #elif HEATER_7_USES_AD8495
1550 1556
           return TEMP_AD8495(raw);
1551 1557
         #else
1552 1558
           break;
@@ -1554,7 +1560,7 @@ void Temperature::manage_heater() {
1554 1560
       default: break;
1555 1561
     }
1556 1562
 
1557
-    #if HOTEND_USES_THERMISTOR
1563
+    #if HAS_HOTEND_THERMISTOR
1558 1564
       // Thermistor with conversion table?
1559 1565
       const temp_entry_t(*tt)[] = (temp_entry_t(*)[])(heater_ttbl_map[e]);
1560 1566
       SCAN_THERMISTOR_TABLE((*tt), heater_ttbllen_map[e]);
@@ -1568,13 +1574,13 @@ void Temperature::manage_heater() {
1568 1574
   // Derived from RepRap FiveD extruder::getTemperature()
1569 1575
   // For bed temperature measurement.
1570 1576
   float Temperature::analog_to_celsius_bed(const int raw) {
1571
-    #if ENABLED(HEATER_BED_USER_THERMISTOR)
1577
+    #if HEATER_BED_USER_THERMISTOR
1572 1578
       return user_thermistor_to_deg_c(CTI_BED, raw);
1573
-    #elif ENABLED(HEATER_BED_USES_THERMISTOR)
1579
+    #elif HEATER_BED_USES_THERMISTOR
1574 1580
       SCAN_THERMISTOR_TABLE(BED_TEMPTABLE, BED_TEMPTABLE_LEN);
1575
-    #elif ENABLED(HEATER_BED_USES_AD595)
1581
+    #elif HEATER_BED_USES_AD595
1576 1582
       return TEMP_AD595(raw);
1577
-    #elif ENABLED(HEATER_BED_USES_AD8495)
1583
+    #elif HEATER_BED_USES_AD8495
1578 1584
       return TEMP_AD8495(raw);
1579 1585
     #else
1580 1586
       UNUSED(raw);
@@ -1587,13 +1593,13 @@ void Temperature::manage_heater() {
1587 1593
   // Derived from RepRap FiveD extruder::getTemperature()
1588 1594
   // For chamber temperature measurement.
1589 1595
   float Temperature::analog_to_celsius_chamber(const int raw) {
1590
-    #if ENABLED(HEATER_CHAMBER_USER_THERMISTOR)
1596
+    #if HEATER_CHAMBER_USER_THERMISTOR
1591 1597
       return user_thermistor_to_deg_c(CTI_CHAMBER, raw);
1592
-    #elif ENABLED(HEATER_CHAMBER_USES_THERMISTOR)
1598
+    #elif HEATER_CHAMBER_USES_THERMISTOR
1593 1599
       SCAN_THERMISTOR_TABLE(CHAMBER_TEMPTABLE, CHAMBER_TEMPTABLE_LEN);
1594
-    #elif ENABLED(HEATER_CHAMBER_USES_AD595)
1600
+    #elif HEATER_CHAMBER_USES_AD595
1595 1601
       return TEMP_AD595(raw);
1596
-    #elif ENABLED(HEATER_CHAMBER_USES_AD8495)
1602
+    #elif HEATER_CHAMBER_USES_AD8495
1597 1603
       return TEMP_AD8495(raw);
1598 1604
     #else
1599 1605
       UNUSED(raw);
@@ -1606,13 +1612,13 @@ void Temperature::manage_heater() {
1606 1612
   // Derived from RepRap FiveD extruder::getTemperature()
1607 1613
   // For probe temperature measurement.
1608 1614
   float Temperature::analog_to_celsius_probe(const int raw) {
1609
-    #if ENABLED(PROBE_USER_THERMISTOR)
1615
+    #if HEATER_PROBE_USER_THERMISTOR
1610 1616
       return user_thermistor_to_deg_c(CTI_PROBE, raw);
1611
-    #elif ENABLED(PROBE_USES_THERMISTOR)
1617
+    #elif HEATER_PROBE_USES_THERMISTOR
1612 1618
       SCAN_THERMISTOR_TABLE(PROBE_TEMPTABLE, PROBE_TEMPTABLE_LEN);
1613
-    #elif ENABLED(PROBE_USES_AD595)
1619
+    #elif HEATER_PROBE_USES_AD595
1614 1620
       return TEMP_AD595(raw);
1615
-    #elif ENABLED(PROBE_USES_AD8495)
1621
+    #elif HEATER_PROBE_USES_AD8495
1616 1622
       return TEMP_AD8495(raw);
1617 1623
     #else
1618 1624
       UNUSED(raw);
@@ -1628,16 +1634,11 @@ void Temperature::manage_heater() {
1628 1634
  * as it would block the stepper routine.
1629 1635
  */
1630 1636
 void Temperature::updateTemperaturesFromRawValues() {
1631
-  #if ENABLED(HEATER_0_USES_MAX6675)
1632
-    temp_hotend[0].raw = READ_MAX6675(0);
1633
-  #endif
1634
-  #if ENABLED(HEATER_1_USES_MAX6675)
1635
-    temp_hotend[1].raw = READ_MAX6675(1);
1636
-  #endif
1637
+  TERN_(HEATER_0_USES_MAX6675, temp_hotend[0].raw = READ_MAX6675(0));
1638
+  TERN_(HEATER_1_USES_MAX6675, temp_hotend[1].raw = READ_MAX6675(1));
1637 1639
   #if HAS_HOTEND
1638 1640
     HOTEND_LOOP() temp_hotend[e].celsius = analog_to_celsius_hotend(temp_hotend[e].raw, e);
1639 1641
   #endif
1640
-
1641 1642
   TERN_(HAS_HEATED_BED, temp_bed.celsius = analog_to_celsius_bed(temp_bed.raw));
1642 1643
   TERN_(HAS_TEMP_CHAMBER, temp_chamber.celsius = analog_to_celsius_chamber(temp_chamber.raw));
1643 1644
   TERN_(HAS_TEMP_PROBE, temp_probe.celsius = analog_to_celsius_probe(temp_probe.raw));
@@ -1700,7 +1701,7 @@ void Temperature::init() {
1700 1701
 
1701 1702
   #if MB(RUMBA)
1702 1703
     // Disable RUMBA JTAG in case the thermocouple extension is plugged on top of JTAG connector
1703
-    #define _AD(N) ANY(HEATER_##N##_USES_AD595, HEATER_##N##_USES_AD8495)
1704
+    #define _AD(N) (HEATER_##N##_USES_AD595 || HEATER_##N##_USES_AD8495)
1704 1705
     #if _AD(0) || _AD(1) || _AD(2) || _AD(BED) || _AD(CHAMBER)
1705 1706
       MCUCR = _BV(JTD);
1706 1707
       MCUCR = _BV(JTD);
@@ -1802,7 +1803,7 @@ void Temperature::init() {
1802 1803
 
1803 1804
   #endif
1804 1805
 
1805
-  #if ENABLED(HEATER_1_USES_MAX6675)
1806
+  #if HEATER_1_USES_MAX6675
1806 1807
     OUT_WRITE(MAX6675_SS2_PIN, HIGH);
1807 1808
   #endif
1808 1809
 
@@ -2215,7 +2216,7 @@ void Temperature::disable_all_heaters() {
2215 2216
 
2216 2217
     #define MAX6675_HEAT_INTERVAL 250UL
2217 2218
 
2218
-    #if ENABLED(MAX6675_IS_MAX31855)
2219
+    #if MAX6675_IS_MAX31855
2219 2220
       static uint32_t max6675_temp = 2000;
2220 2221
       #define MAX6675_ERROR_MASK    7
2221 2222
       #define MAX6675_DISCARD_BITS 18
@@ -2241,7 +2242,7 @@ void Temperature::disable_all_heaters() {
2241 2242
 
2242 2243
     next_max6675_ms[hindex] = ms + MAX6675_HEAT_INTERVAL;
2243 2244
 
2244
-    #if ENABLED(MAX6675_IS_MAX31865)
2245
+    #if MAX6675_IS_MAX31865
2245 2246
       max6675_temp = int(max31865.temperature(MAX31865_SENSOR_OHMS, MAX31865_CALIBRATION_OHMS));
2246 2247
     #endif
2247 2248
 
@@ -2256,7 +2257,7 @@ void Temperature::disable_all_heaters() {
2256 2257
     #if COUNT_6675 > 1
2257 2258
       #define WRITE_MAX6675(V) do{ switch (hindex) { case 1: WRITE(MAX6675_SS2_PIN, V); break; default: WRITE(MAX6675_SS_PIN, V); } }while(0)
2258 2259
       #define SET_OUTPUT_MAX6675() do{ switch (hindex) { case 1: SET_OUTPUT(MAX6675_SS2_PIN); break; default: SET_OUTPUT(MAX6675_SS_PIN); } }while(0)
2259
-    #elif ENABLED(HEATER_1_USES_MAX6675)
2260
+    #elif HEATER_1_USES_MAX6675
2260 2261
       #define WRITE_MAX6675(V) WRITE(MAX6675_SS2_PIN, V)
2261 2262
       #define SET_OUTPUT_MAX6675() SET_OUTPUT(MAX6675_SS2_PIN)
2262 2263
     #else
@@ -2336,14 +2337,14 @@ void Temperature::disable_all_heaters() {
2336 2337
  */
2337 2338
 void Temperature::update_raw_temperatures() {
2338 2339
 
2339
-  #if HAS_TEMP_ADC_0 && DISABLED(HEATER_0_USES_MAX6675)
2340
+  #if HAS_TEMP_ADC_0 && !HEATER_0_USES_MAX6675
2340 2341
     temp_hotend[0].update();
2341 2342
   #endif
2342 2343
 
2343 2344
   #if HAS_TEMP_ADC_1
2344 2345
     #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
2345 2346
       redundant_temperature_raw = temp_hotend[1].acc;
2346
-    #elif DISABLED(HEATER_1_USES_MAX6675)
2347
+    #elif !HEATER_1_USES_MAX6675
2347 2348
       temp_hotend[1].update();
2348 2349
     #endif
2349 2350
   #endif

+ 11
- 14
Marlin/src/module/temperature.h Целия файл

@@ -253,31 +253,31 @@ typedef struct { int16_t raw_min, raw_max, mintemp, maxtemp; } temp_range_t;
253 253
 #if HAS_USER_THERMISTORS
254 254
 
255 255
   enum CustomThermistorIndex : uint8_t {
256
-    #if ENABLED(HEATER_0_USER_THERMISTOR)
256
+    #if HEATER_0_USER_THERMISTOR
257 257
       CTI_HOTEND_0,
258 258
     #endif
259
-    #if ENABLED(HEATER_1_USER_THERMISTOR)
259
+    #if HEATER_1_USER_THERMISTOR
260 260
       CTI_HOTEND_1,
261 261
     #endif
262
-    #if ENABLED(HEATER_2_USER_THERMISTOR)
262
+    #if HEATER_2_USER_THERMISTOR
263 263
       CTI_HOTEND_2,
264 264
     #endif
265
-    #if ENABLED(HEATER_3_USER_THERMISTOR)
265
+    #if HEATER_3_USER_THERMISTOR
266 266
       CTI_HOTEND_3,
267 267
     #endif
268
-    #if ENABLED(HEATER_4_USER_THERMISTOR)
268
+    #if HEATER_4_USER_THERMISTOR
269 269
       CTI_HOTEND_4,
270 270
     #endif
271
-    #if ENABLED(HEATER_5_USER_THERMISTOR)
271
+    #if HEATER_5_USER_THERMISTOR
272 272
       CTI_HOTEND_5,
273 273
     #endif
274
-    #if ENABLED(HEATER_BED_USER_THERMISTOR)
274
+    #if HEATER_BED_USER_THERMISTOR
275 275
       CTI_BED,
276 276
     #endif
277
-    #if ENABLED(HEATER_PROBE_USER_THERMISTOR)
277
+    #if HEATER_PROBE_USER_THERMISTOR
278 278
       CTI_PROBE,
279 279
     #endif
280
-    #if ENABLED(HEATER_CHAMBER_USER_THERMISTOR)
280
+    #if HEATER_CHAMBER_USER_THERMISTOR
281 281
       CTI_CHAMBER,
282 282
     #endif
283 283
     USER_THERMISTORS
@@ -811,15 +811,12 @@ class Temperature {
811 811
     #if HAS_MAX6675
812 812
       #define COUNT_6675 1 + BOTH(HEATER_0_USES_MAX6675, HEATER_1_USES_MAX6675)
813 813
       #if COUNT_6675 > 1
814
+        #define HAS_MULTI_6675
814 815
         #define READ_MAX6675(N) read_max6675(N)
815 816
       #else
816 817
         #define READ_MAX6675(N) read_max6675()
817 818
       #endif
818
-      static int read_max6675(
819
-        #if COUNT_6675 > 1
820
-          const uint8_t hindex=0
821
-        #endif
822
-      );
819
+      static int read_max6675(TERN_(HAS_MULTI_6675, const uint8_t hindex=0));
823 820
     #endif
824 821
 
825 822
     static void checkExtruderAutoFans();

+ 22
- 22
Marlin/src/module/thermistor/thermistors.h Целия файл

@@ -206,7 +206,7 @@ typedef struct { int16_t value, celsius; } temp_entry_t;
206 206
 #if THERMISTOR_HEATER_0
207 207
   #define HEATER_0_TEMPTABLE TT_NAME(THERMISTOR_HEATER_0)
208 208
   #define HEATER_0_TEMPTABLE_LEN COUNT(HEATER_0_TEMPTABLE)
209
-#elif defined(HEATER_0_USES_THERMISTOR)
209
+#elif HEATER_0_USES_THERMISTOR
210 210
   #error "No heater 0 thermistor table specified"
211 211
 #else
212 212
   #define HEATER_0_TEMPTABLE nullptr
@@ -216,7 +216,7 @@ typedef struct { int16_t value, celsius; } temp_entry_t;
216 216
 #if THERMISTOR_HEATER_1
217 217
   #define HEATER_1_TEMPTABLE TT_NAME(THERMISTOR_HEATER_1)
218 218
   #define HEATER_1_TEMPTABLE_LEN COUNT(HEATER_1_TEMPTABLE)
219
-#elif defined(HEATER_1_USES_THERMISTOR)
219
+#elif HEATER_1_USES_THERMISTOR
220 220
   #error "No heater 1 thermistor table specified"
221 221
 #else
222 222
   #define HEATER_1_TEMPTABLE nullptr
@@ -226,7 +226,7 @@ typedef struct { int16_t value, celsius; } temp_entry_t;
226 226
 #if THERMISTOR_HEATER_2
227 227
   #define HEATER_2_TEMPTABLE TT_NAME(THERMISTOR_HEATER_2)
228 228
   #define HEATER_2_TEMPTABLE_LEN COUNT(HEATER_2_TEMPTABLE)
229
-#elif defined(HEATER_2_USES_THERMISTOR)
229
+#elif HEATER_2_USES_THERMISTOR
230 230
   #error "No heater 2 thermistor table specified"
231 231
 #else
232 232
   #define HEATER_2_TEMPTABLE nullptr
@@ -236,7 +236,7 @@ typedef struct { int16_t value, celsius; } temp_entry_t;
236 236
 #if THERMISTOR_HEATER_3
237 237
   #define HEATER_3_TEMPTABLE TT_NAME(THERMISTOR_HEATER_3)
238 238
   #define HEATER_3_TEMPTABLE_LEN COUNT(HEATER_3_TEMPTABLE)
239
-#elif defined(HEATER_3_USES_THERMISTOR)
239
+#elif HEATER_3_USES_THERMISTOR
240 240
   #error "No heater 3 thermistor table specified"
241 241
 #else
242 242
   #define HEATER_3_TEMPTABLE nullptr
@@ -246,7 +246,7 @@ typedef struct { int16_t value, celsius; } temp_entry_t;
246 246
 #if THERMISTOR_HEATER_4
247 247
   #define HEATER_4_TEMPTABLE TT_NAME(THERMISTOR_HEATER_4)
248 248
   #define HEATER_4_TEMPTABLE_LEN COUNT(HEATER_4_TEMPTABLE)
249
-#elif defined(HEATER_4_USES_THERMISTOR)
249
+#elif HEATER_4_USES_THERMISTOR
250 250
   #error "No heater 4 thermistor table specified"
251 251
 #else
252 252
   #define HEATER_4_TEMPTABLE nullptr
@@ -256,7 +256,7 @@ typedef struct { int16_t value, celsius; } temp_entry_t;
256 256
 #if THERMISTOR_HEATER_5
257 257
   #define HEATER_5_TEMPTABLE TT_NAME(THERMISTOR_HEATER_5)
258 258
   #define HEATER_5_TEMPTABLE_LEN COUNT(HEATER_5_TEMPTABLE)
259
-#elif defined(HEATER_5_USES_THERMISTOR)
259
+#elif HEATER_5_USES_THERMISTOR
260 260
   #error "No heater 5 thermistor table specified"
261 261
 #else
262 262
   #define HEATER_5_TEMPTABLE nullptr
@@ -266,7 +266,7 @@ typedef struct { int16_t value, celsius; } temp_entry_t;
266 266
 #if THERMISTOR_HEATER_6
267 267
   #define HEATER_6_TEMPTABLE TT_NAME(THERMISTOR_HEATER_6)
268 268
   #define HEATER_6_TEMPTABLE_LEN COUNT(HEATER_6_TEMPTABLE)
269
-#elif defined(HEATER_6_USES_THERMISTOR)
269
+#elif HEATER_6_USES_THERMISTOR
270 270
   #error "No heater 6 thermistor table specified"
271 271
 #else
272 272
   #define HEATER_6_TEMPTABLE nullptr
@@ -276,7 +276,7 @@ typedef struct { int16_t value, celsius; } temp_entry_t;
276 276
 #if THERMISTOR_HEATER_7
277 277
   #define HEATER_7_TEMPTABLE TT_NAME(THERMISTOR_HEATER_7)
278 278
   #define HEATER_7_TEMPTABLE_LEN COUNT(HEATER_7_TEMPTABLE)
279
-#elif defined(HEATER_7_USES_THERMISTOR)
279
+#elif HEATER_7_USES_THERMISTOR
280 280
   #error "No heater 7 thermistor table specified"
281 281
 #else
282 282
   #define HEATER_7_TEMPTABLE nullptr
@@ -286,7 +286,7 @@ typedef struct { int16_t value, celsius; } temp_entry_t;
286 286
 #ifdef THERMISTORBED
287 287
   #define BED_TEMPTABLE TT_NAME(THERMISTORBED)
288 288
   #define BED_TEMPTABLE_LEN COUNT(BED_TEMPTABLE)
289
-#elif defined(HEATER_BED_USES_THERMISTOR)
289
+#elif HEATER_BED_USES_THERMISTOR
290 290
   #error "No bed thermistor table specified"
291 291
 #else
292 292
   #define BED_TEMPTABLE_LEN 0
@@ -295,7 +295,7 @@ typedef struct { int16_t value, celsius; } temp_entry_t;
295 295
 #ifdef THERMISTORCHAMBER
296 296
   #define CHAMBER_TEMPTABLE TT_NAME(THERMISTORCHAMBER)
297 297
   #define CHAMBER_TEMPTABLE_LEN COUNT(CHAMBER_TEMPTABLE)
298
-#elif defined(HEATER_CHAMBER_USES_THERMISTOR)
298
+#elif HEATER_CHAMBER_USES_THERMISTOR
299 299
   #error "No chamber thermistor table specified"
300 300
 #else
301 301
   #define CHAMBER_TEMPTABLE_LEN 0
@@ -304,7 +304,7 @@ typedef struct { int16_t value, celsius; } temp_entry_t;
304 304
 #ifdef THERMISTORPROBE
305 305
   #define PROBE_TEMPTABLE TT_NAME(THERMISTORPROBE)
306 306
   #define PROBE_TEMPTABLE_LEN COUNT(PROBE_TEMPTABLE)
307
-#elif defined(HEATER_PROBE_USES_THERMISTOR)
307
+#elif HEATER_PROBE_USES_THERMISTOR
308 308
   #error "No probe thermistor table specified"
309 309
 #else
310 310
   #define PROBE_TEMPTABLE_LEN 0
@@ -402,7 +402,7 @@ static_assert(
402 402
 #endif
403 403
 
404 404
 #ifndef HEATER_0_RAW_HI_TEMP
405
-  #if TT_REV(THERMISTOR_HEATER_0) || !defined(HEATER_0_USES_THERMISTOR)
405
+  #if TT_REV(THERMISTOR_HEATER_0) || !HEATER_0_USES_THERMISTOR
406 406
     #define HEATER_0_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
407 407
     #define HEATER_0_RAW_LO_TEMP 0
408 408
   #else
@@ -411,7 +411,7 @@ static_assert(
411 411
   #endif
412 412
 #endif
413 413
 #ifndef HEATER_1_RAW_HI_TEMP
414
-  #if TT_REV(THERMISTOR_HEATER_1) || !defined(HEATER_1_USES_THERMISTOR)
414
+  #if TT_REV(THERMISTOR_HEATER_1) || !HEATER_1_USES_THERMISTOR
415 415
     #define HEATER_1_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
416 416
     #define HEATER_1_RAW_LO_TEMP 0
417 417
   #else
@@ -420,7 +420,7 @@ static_assert(
420 420
   #endif
421 421
 #endif
422 422
 #ifndef HEATER_2_RAW_HI_TEMP
423
-  #if TT_REV(THERMISTOR_HEATER_2) || !defined(HEATER_2_USES_THERMISTOR)
423
+  #if TT_REV(THERMISTOR_HEATER_2) || !HEATER_2_USES_THERMISTOR
424 424
     #define HEATER_2_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
425 425
     #define HEATER_2_RAW_LO_TEMP 0
426 426
   #else
@@ -429,7 +429,7 @@ static_assert(
429 429
   #endif
430 430
 #endif
431 431
 #ifndef HEATER_3_RAW_HI_TEMP
432
-  #if TT_REV(THERMISTOR_HEATER_3) || !defined(HEATER_3_USES_THERMISTOR)
432
+  #if TT_REV(THERMISTOR_HEATER_3) || !HEATER_3_USES_THERMISTOR
433 433
     #define HEATER_3_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
434 434
     #define HEATER_3_RAW_LO_TEMP 0
435 435
   #else
@@ -438,7 +438,7 @@ static_assert(
438 438
   #endif
439 439
 #endif
440 440
 #ifndef HEATER_4_RAW_HI_TEMP
441
-  #if TT_REV(THERMISTOR_HEATER_4) || !defined(HEATER_4_USES_THERMISTOR)
441
+  #if TT_REV(THERMISTOR_HEATER_4) || !HEATER_4_USES_THERMISTOR
442 442
     #define HEATER_4_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
443 443
     #define HEATER_4_RAW_LO_TEMP 0
444 444
   #else
@@ -447,7 +447,7 @@ static_assert(
447 447
   #endif
448 448
 #endif
449 449
 #ifndef HEATER_5_RAW_HI_TEMP
450
-  #if TT_REV(THERMISTOR_HEATER_5) || !defined(HEATER_5_USES_THERMISTOR)
450
+  #if TT_REV(THERMISTOR_HEATER_5) || !HEATER_5_USES_THERMISTOR
451 451
     #define HEATER_5_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
452 452
     #define HEATER_5_RAW_LO_TEMP 0
453 453
   #else
@@ -456,7 +456,7 @@ static_assert(
456 456
   #endif
457 457
 #endif
458 458
 #ifndef HEATER_6_RAW_HI_TEMP
459
-  #if TT_REV(THERMISTOR_HEATER_6) || !defined(HEATER_6_USES_THERMISTOR)
459
+  #if TT_REV(THERMISTOR_HEATER_6) || !HEATER_6_USES_THERMISTOR
460 460
     #define HEATER_6_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
461 461
     #define HEATER_6_RAW_LO_TEMP 0
462 462
   #else
@@ -465,7 +465,7 @@ static_assert(
465 465
   #endif
466 466
 #endif
467 467
 #ifndef HEATER_7_RAW_HI_TEMP
468
-  #if TT_REV(THERMISTOR_HEATER_7) || !defined(HEATER_7_USES_THERMISTOR)
468
+  #if TT_REV(THERMISTOR_HEATER_7) || !HEATER_7_USES_THERMISTOR
469 469
     #define HEATER_7_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
470 470
     #define HEATER_7_RAW_LO_TEMP 0
471 471
   #else
@@ -474,7 +474,7 @@ static_assert(
474 474
   #endif
475 475
 #endif
476 476
 #ifndef HEATER_BED_RAW_HI_TEMP
477
-  #if TT_REV(THERMISTORBED) || !defined(HEATER_BED_USES_THERMISTOR)
477
+  #if TT_REV(THERMISTORBED) || !HEATER_BED_USES_THERMISTOR
478 478
     #define HEATER_BED_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
479 479
     #define HEATER_BED_RAW_LO_TEMP 0
480 480
   #else
@@ -483,7 +483,7 @@ static_assert(
483 483
   #endif
484 484
 #endif
485 485
 #ifndef HEATER_CHAMBER_RAW_HI_TEMP
486
-  #if TT_REV(THERMISTORCHAMBER) || !defined(HEATER_CHAMBER_USES_THERMISTOR)
486
+  #if TT_REV(THERMISTORCHAMBER) || !HEATER_CHAMBER_USES_THERMISTOR
487 487
     #define HEATER_CHAMBER_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
488 488
     #define HEATER_CHAMBER_RAW_LO_TEMP 0
489 489
   #else
@@ -492,7 +492,7 @@ static_assert(
492 492
   #endif
493 493
 #endif
494 494
 #ifndef HEATER_PROBE_RAW_HI_TEMP
495
-  #if TT_REV(THERMISTORPROBE) || !defined(HEATER_PROBE_USES_THERMISTOR)
495
+  #if TT_REV(THERMISTORPROBE) || !HEATER_PROBE_USES_THERMISTOR
496 496
     #define HEATER_PROBE_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
497 497
     #define HEATER_PROBE_RAW_LO_TEMP 0
498 498
   #else

Loading…
Отказ
Запис