Browse Source

🐛 Add USE_TEMP_EXT_COMPENSATION options (#23007)

tombrazier 3 years ago
parent
commit
444f27dfa0
No account linked to committer's email address

+ 7
- 1
Marlin/Configuration_adv.h View File

2006
     #define PTC_PROBE_POS  { 90, 100 }
2006
     #define PTC_PROBE_POS  { 90, 100 }
2007
 
2007
 
2008
     // Enable additional compensation using hotend temperature
2008
     // Enable additional compensation using hotend temperature
2009
-    // Note: this values cannot be calibrated automatically but have to be set manually
2009
+    // Note: this values cannot be calibrated automatically but have to be set manually via M871.
2010
     //#define USE_TEMP_EXT_COMPENSATION
2010
     //#define USE_TEMP_EXT_COMPENSATION
2011
 
2011
 
2012
     // Probe temperature calibration generates a table of values starting at PTC_SAMPLE_START
2012
     // Probe temperature calibration generates a table of values starting at PTC_SAMPLE_START
2022
     //#define BTC_SAMPLE_RES     5  // (°C)
2022
     //#define BTC_SAMPLE_RES     5  // (°C)
2023
     //#define BTC_SAMPLE_COUNT  10
2023
     //#define BTC_SAMPLE_COUNT  10
2024
 
2024
 
2025
+    #if ENABLED(USE_TEMP_EXT_COMPENSATION)
2026
+      //#define ETC_SAMPLE_START 180  // (°C)
2027
+      //#define ETC_SAMPLE_RES     5  // (°C)
2028
+      //#define ETC_SAMPLE_COUNT  20
2029
+    #endif
2030
+
2025
     // The temperature the probe should be at while taking measurements during bed temperature
2031
     // The temperature the probe should be at while taking measurements during bed temperature
2026
     // calibration.
2032
     // calibration.
2027
     //#define BTC_PROBE_TEMP    30  // (°C)
2033
     //#define BTC_PROBE_TEMP    30  // (°C)

+ 17
- 3
Marlin/src/feature/probe_temp_comp.h View File

72
 #endif
72
 #endif
73
 #define BTC_SAMPLE_END (BTC_SAMPLE_START + (BTC_SAMPLE_COUNT) * BTC_SAMPLE_RES)
73
 #define BTC_SAMPLE_END (BTC_SAMPLE_START + (BTC_SAMPLE_COUNT) * BTC_SAMPLE_RES)
74
 
74
 
75
+// Extruder temperature calibration constants
76
+#if ENABLED(USE_TEMP_EXT_COMPENSATION)
77
+  #ifndef ETC_SAMPLE_COUNT
78
+    #define ETC_SAMPLE_COUNT 20
79
+  #endif
80
+  #ifndef ETC_SAMPLE_RES
81
+    #define ETC_SAMPLE_RES 5
82
+  #endif
83
+  #ifndef ETC_SAMPLE_START
84
+    #define ETC_SAMPLE_START 180
85
+  #endif
86
+  #define ETC_SAMPLE_END (ETC_SAMPLE_START + (ETC_SAMPLE_COUNT) * ETC_SAMPLE_RES)
87
+#endif
88
+
75
 #ifndef PTC_PROBE_HEATING_OFFSET
89
 #ifndef PTC_PROBE_HEATING_OFFSET
76
   #define PTC_PROBE_HEATING_OFFSET 0.5f
90
   #define PTC_PROBE_HEATING_OFFSET 0.5f
77
 #endif
91
 #endif
81
 #endif
95
 #endif
82
 
96
 
83
 static constexpr temp_calib_t cali_info_init[TSI_COUNT] = {
97
 static constexpr temp_calib_t cali_info_init[TSI_COUNT] = {
84
-  { PTC_SAMPLE_COUNT, PTC_SAMPLE_RES, PTC_SAMPLE_START, PTC_SAMPLE_END }, // Probe
85
-  { BTC_SAMPLE_COUNT, BTC_SAMPLE_RES, BTC_SAMPLE_START, BTC_SAMPLE_END }, // Bed
98
+  { PTC_SAMPLE_COUNT, PTC_SAMPLE_RES, PTC_SAMPLE_START, PTC_SAMPLE_END },   // Probe
99
+  { BTC_SAMPLE_COUNT, BTC_SAMPLE_RES, BTC_SAMPLE_START, BTC_SAMPLE_END },   // Bed
86
   #if ENABLED(USE_TEMP_EXT_COMPENSATION)
100
   #if ENABLED(USE_TEMP_EXT_COMPENSATION)
87
-    { 20,  5, 180, 180 +  5 * 20 }                                        // Extruder
101
+    { ETC_SAMPLE_COUNT, ETC_SAMPLE_RES, ETC_SAMPLE_START, ETC_SAMPLE_END }, // Extruder
88
   #endif
102
   #endif
89
 };
103
 };
90
 
104
 

+ 1
- 1
Marlin/src/gcode/bedlevel/abl/G29.cpp View File

648
           #if ENABLED(PROBE_TEMP_COMPENSATION)
648
           #if ENABLED(PROBE_TEMP_COMPENSATION)
649
             temp_comp.compensate_measurement(TSI_BED, thermalManager.degBed(), abl.measured_z);
649
             temp_comp.compensate_measurement(TSI_BED, thermalManager.degBed(), abl.measured_z);
650
             temp_comp.compensate_measurement(TSI_PROBE, thermalManager.degProbe(), abl.measured_z);
650
             temp_comp.compensate_measurement(TSI_PROBE, thermalManager.degProbe(), abl.measured_z);
651
-            TERN_(USE_TEMP_EXT_COMPENSATION, temp_comp.compensate_measurement(TSI_EXT, thermalManager.degHotend(), abl.measured_z));
651
+            TERN_(USE_TEMP_EXT_COMPENSATION, temp_comp.compensate_measurement(TSI_EXT, thermalManager.degHotend(0), abl.measured_z));
652
           #endif
652
           #endif
653
 
653
 
654
           #if ENABLED(AUTO_BED_LEVELING_LINEAR)
654
           #if ENABLED(AUTO_BED_LEVELING_LINEAR)

+ 16
- 0
Marlin/src/inc/SanityCheck.h View File

648
     constexpr decltype(_btc_probe_temp) _test_btc_probe_temp = 12.3f;
648
     constexpr decltype(_btc_probe_temp) _test_btc_probe_temp = 12.3f;
649
     static_assert(_test_btc_probe_temp != 12.3f, "BTC_PROBE_TEMP must be a whole number.");
649
     static_assert(_test_btc_probe_temp != 12.3f, "BTC_PROBE_TEMP must be a whole number.");
650
   #endif
650
   #endif
651
+  #if ENABLED(USE_TEMP_EXT_COMPENSATION)
652
+    #ifdef ETC_SAMPLE_START
653
+      constexpr auto _etc_sample_start = ETC_SAMPLE_START;
654
+      constexpr decltype(_etc_sample_start) _test_etc_sample_start = 12.3f;
655
+      static_assert(_test_etc_sample_start != 12.3f, "ETC_SAMPLE_START must be a whole number.");
656
+    #endif
657
+    #ifdef ETC_SAMPLE_RES
658
+      constexpr auto _etc_sample_res = ETC_SAMPLE_RES;
659
+      constexpr decltype(_etc_sample_res) _test_etc_sample_res = 12.3f;
660
+      static_assert(_test_etc_sample_res != 12.3f, "ETC_SAMPLE_RES must be a whole number.");
661
+    #endif
662
+  #endif
663
+
664
+  #if ENABLED(USE_TEMP_EXT_COMPENSATION) && EXTRUDERS != 1
665
+    #error "USE_TEMP_EXT_COMPENSATION only works with a single extruder."
666
+  #endif
651
 #endif
667
 #endif
652
 
668
 
653
 /**
669
 /**

Loading…
Cancel
Save