Browse Source

🐛 Use whole PROBE_TEMP_COMPENSATION values (#22130)

Katelyn Schiesser 3 years ago
parent
commit
31d84bac4c
No account linked to committer's email address

+ 11
- 11
Marlin/Configuration_adv.h View File

202
   #define COOLER_MAXTEMP          26  // (°C)
202
   #define COOLER_MAXTEMP          26  // (°C)
203
   #define COOLER_DEFAULT_TEMP     16  // (°C)
203
   #define COOLER_DEFAULT_TEMP     16  // (°C)
204
   #define TEMP_COOLER_HYSTERESIS   1  // (°C) Temperature proximity considered "close enough" to the target
204
   #define TEMP_COOLER_HYSTERESIS   1  // (°C) Temperature proximity considered "close enough" to the target
205
-  #define COOLER_PIN               8  // Laser cooler on/off pin used to control power to the cooling element e.g. TEC, External chiller via relay
205
+  #define COOLER_PIN               8  // Laser cooler on/off pin used to control power to the cooling element (e.g., TEC, External chiller via relay)
206
   #define COOLER_INVERTING     false
206
   #define COOLER_INVERTING     false
207
   #define TEMP_COOLER_PIN         15  // Laser/Cooler temperature sensor pin. ADC is required.
207
   #define TEMP_COOLER_PIN         15  // Laser/Cooler temperature sensor pin. ADC is required.
208
   #define COOLER_FAN                  // Enable a fan on the cooler, Fan# 0,1,2,3 etc.
208
   #define COOLER_FAN                  // Enable a fan on the cooler, Fan# 0,1,2,3 etc.
1961
     //#define USE_TEMP_EXT_COMPENSATION
1961
     //#define USE_TEMP_EXT_COMPENSATION
1962
 
1962
 
1963
     // Probe temperature calibration generates a table of values starting at PTC_SAMPLE_START
1963
     // Probe temperature calibration generates a table of values starting at PTC_SAMPLE_START
1964
-    // (e.g. 30), in steps of PTC_SAMPLE_RES (e.g. 5) with PTC_SAMPLE_COUNT (e.g. 10) samples.
1964
+    // (e.g., 30), in steps of PTC_SAMPLE_RES (e.g., 5) with PTC_SAMPLE_COUNT (e.g., 10) samples.
1965
 
1965
 
1966
-    //#define PTC_SAMPLE_START  30.0f
1967
-    //#define PTC_SAMPLE_RES    5.0f
1968
-    //#define PTC_SAMPLE_COUNT  10U
1966
+    //#define PTC_SAMPLE_START  30  // (°C)
1967
+    //#define PTC_SAMPLE_RES     5  // (°C)
1968
+    //#define PTC_SAMPLE_COUNT  10
1969
 
1969
 
1970
     // Bed temperature calibration builds a similar table.
1970
     // Bed temperature calibration builds a similar table.
1971
 
1971
 
1972
-    //#define BTC_SAMPLE_START  60.0f
1973
-    //#define BTC_SAMPLE_RES    5.0f
1974
-    //#define BTC_SAMPLE_COUNT  10U
1972
+    //#define BTC_SAMPLE_START  60  // (°C)
1973
+    //#define BTC_SAMPLE_RES     5  // (°C)
1974
+    //#define BTC_SAMPLE_COUNT  10
1975
 
1975
 
1976
     // The temperature the probe should be at while taking measurements during bed temperature
1976
     // The temperature the probe should be at while taking measurements during bed temperature
1977
     // calibration.
1977
     // calibration.
1978
-    //#define BTC_PROBE_TEMP 30.0f
1978
+    //#define BTC_PROBE_TEMP    30  // (°C)
1979
 
1979
 
1980
     // Height above Z=0.0f to raise the nozzle. Lowering this can help the probe to heat faster.
1980
     // Height above Z=0.0f to raise the nozzle. Lowering this can help the probe to heat faster.
1981
     // Note: the Z=0.0f offset is determined by the probe offset which can be set using M851.
1981
     // Note: the Z=0.0f offset is determined by the probe offset which can be set using M851.
1984
     // Height to raise the Z-probe between heating and taking the next measurement. Some probes
1984
     // Height to raise the Z-probe between heating and taking the next measurement. Some probes
1985
     // may fail to untrigger if they have been triggered for a long time, which can be solved by
1985
     // may fail to untrigger if they have been triggered for a long time, which can be solved by
1986
     // increasing the height the probe is raised to.
1986
     // increasing the height the probe is raised to.
1987
-    //#define PTC_PROBE_RAISE 15U
1987
+    //#define PTC_PROBE_RAISE 15
1988
 
1988
 
1989
     // If the probe is outside of the defined range, use linear extrapolation using the closest
1989
     // If the probe is outside of the defined range, use linear extrapolation using the closest
1990
     // point and the PTC_LINEAR_EXTRAPOLATION'th next point. E.g. if set to 4 it will use data[0]
1990
     // point and the PTC_LINEAR_EXTRAPOLATION'th next point. E.g. if set to 4 it will use data[0]
2099
 // @section motion
2099
 // @section motion
2100
 
2100
 
2101
 // The number of linear moves that can be in the planner at once.
2101
 // The number of linear moves that can be in the planner at once.
2102
-// The value of BLOCK_BUFFER_SIZE must be a power of 2 (e.g. 8, 16, 32)
2102
+// The value of BLOCK_BUFFER_SIZE must be a power of 2 (e.g., 8, 16, 32)
2103
 #if BOTH(SDSUPPORT, DIRECT_STEPPING)
2103
 #if BOTH(SDSUPPORT, DIRECT_STEPPING)
2104
   #define BLOCK_BUFFER_SIZE  8
2104
   #define BLOCK_BUFFER_SIZE  8
2105
 #elif ENABLED(SDSUPPORT)
2105
 #elif ENABLED(SDSUPPORT)

+ 4
- 4
Marlin/src/feature/probe_temp_comp.h View File

47
 
47
 
48
 // Probe temperature calibration constants
48
 // Probe temperature calibration constants
49
 #ifndef PTC_SAMPLE_COUNT
49
 #ifndef PTC_SAMPLE_COUNT
50
-  #define PTC_SAMPLE_COUNT 10U
50
+  #define PTC_SAMPLE_COUNT 10
51
 #endif
51
 #endif
52
 #ifndef PTC_SAMPLE_RES
52
 #ifndef PTC_SAMPLE_RES
53
   #define PTC_SAMPLE_RES 5
53
   #define PTC_SAMPLE_RES 5
55
 #ifndef PTC_SAMPLE_START
55
 #ifndef PTC_SAMPLE_START
56
   #define PTC_SAMPLE_START 30
56
   #define PTC_SAMPLE_START 30
57
 #endif
57
 #endif
58
-#define PTC_SAMPLE_END ((PTC_SAMPLE_START) + (PTC_SAMPLE_COUNT) * (PTC_SAMPLE_RES))
58
+#define PTC_SAMPLE_END (PTC_SAMPLE_START + (PTC_SAMPLE_COUNT) * PTC_SAMPLE_RES)
59
 
59
 
60
 // Bed temperature calibration constants
60
 // Bed temperature calibration constants
61
 #ifndef BTC_PROBE_TEMP
61
 #ifndef BTC_PROBE_TEMP
62
   #define BTC_PROBE_TEMP 30
62
   #define BTC_PROBE_TEMP 30
63
 #endif
63
 #endif
64
 #ifndef BTC_SAMPLE_COUNT
64
 #ifndef BTC_SAMPLE_COUNT
65
-  #define BTC_SAMPLE_COUNT 10U
65
+  #define BTC_SAMPLE_COUNT 10
66
 #endif
66
 #endif
67
 #ifndef BTC_SAMPLE_RES
67
 #ifndef BTC_SAMPLE_RES
68
   #define BTC_SAMPLE_RES 5
68
   #define BTC_SAMPLE_RES 5
70
 #ifndef BTC_SAMPLE_START
70
 #ifndef BTC_SAMPLE_START
71
   #define BTC_SAMPLE_START 60
71
   #define BTC_SAMPLE_START 60
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
 #ifndef PTC_PROBE_HEATING_OFFSET
75
 #ifndef PTC_PROBE_HEATING_OFFSET
76
   #define PTC_PROBE_HEATING_OFFSET 0.5f
76
   #define PTC_PROBE_HEATING_OFFSET 0.5f

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

580
 /**
580
 /**
581
  * Probe temp compensation requirements
581
  * Probe temp compensation requirements
582
  */
582
  */
583
+
583
 #if ENABLED(PROBE_TEMP_COMPENSATION)
584
 #if ENABLED(PROBE_TEMP_COMPENSATION)
584
   #if defined(PTC_PARK_POS_X) || defined(PTC_PARK_POS_Y) || defined(PTC_PARK_POS_Z)
585
   #if defined(PTC_PARK_POS_X) || defined(PTC_PARK_POS_Y) || defined(PTC_PARK_POS_Z)
585
     #error "PTC_PARK_POS_[XYZ] is now PTC_PARK_POS (array)."
586
     #error "PTC_PARK_POS_[XYZ] is now PTC_PARK_POS (array)."
590
   #elif !defined(PTC_PROBE_POS)
591
   #elif !defined(PTC_PROBE_POS)
591
     #error "PROBE_TEMP_COMPENSATION requires PTC_PROBE_POS."
592
     #error "PROBE_TEMP_COMPENSATION requires PTC_PROBE_POS."
592
   #endif
593
   #endif
594
+
595
+  #ifdef PTC_SAMPLE_START
596
+    constexpr int _ptc_sample_start = PTC_SAMPLE_START;
597
+    static_assert(_test_ptc_sample_start != PTC_SAMPLE_START, "PTC_SAMPLE_START must be a whole number.");
598
+  #endif
599
+  #ifdef PTC_SAMPLE_RES
600
+    constexpr int _ptc_sample_res = PTC_SAMPLE_END;
601
+    static_assert(_test_ptc_sample_res != PTC_SAMPLE_END, "PTC_SAMPLE_RES must be a whole number.");
602
+  #endif
603
+  #ifdef BTC_SAMPLE_START
604
+    constexpr int _btc_sample_start = BTC_SAMPLE_START;
605
+    static_assert(_test_btc_sample_start != BTC_SAMPLE_START, "BTC_SAMPLE_START must be a whole number.");
606
+  #endif
607
+  #ifdef BTC_SAMPLE_RES
608
+    constexpr int _btc_sample_res = BTC_SAMPLE_END;
609
+    static_assert(_test_btc_sample_res != BTC_SAMPLE_END, "BTC_SAMPLE_RES must be a whole number.");
610
+  #endif
611
+  #ifdef BTC_PROBE_TEMP
612
+    constexpr int _btc_probe_temp = BTC_PROBE_TEMP;
613
+    static_assert(_test_btc_probe_temp != BTC_PROBE_TEMP, "BTC_PROBE_TEMP must be a whole number.");
614
+  #endif
593
 #endif
615
 #endif
594
 
616
 
595
 /**
617
 /**

+ 6
- 0
buildroot/tests/BIGTREE_BTT002 View File

16
         Y_DRIVER_TYPE TMC2130
16
         Y_DRIVER_TYPE TMC2130
17
 exec_test $1 $2 "BigTreeTech BTT002 Default Configuration plus TMC steppers" "$3"
17
 exec_test $1 $2 "BigTreeTech BTT002 Default Configuration plus TMC steppers" "$3"
18
 
18
 
19
+#
20
+# A test with Probe Temperature Compensation enabled
21
+#
22
+use_example_configs Prusa/MK3S-BigTreeTech-BTT002
23
+exec_test $1 $2 "BigTreeTech BTT002 with Prusa MK3S and related options" "$3"
24
+
19
 # clean up
25
 # clean up
20
 restore_configs
26
 restore_configs

Loading…
Cancel
Save