From 68c52673d6a9cae0e1b9d8e36df1bf31a833a7e5 Mon Sep 17 00:00:00 2001 From: Katelyn Schiesser Date: Sun, 13 Jun 2021 14:56:18 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Use=20whole=20PROBE=5FTEMP=5FCOM?= =?UTF-8?q?PENSATION=20values=20(#22130)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration_adv.h | 22 +++++++++++----------- Marlin/src/feature/probe_temp_comp.h | 8 ++++---- Marlin/src/inc/SanityCheck.h | 22 ++++++++++++++++++++++ buildroot/tests/BIGTREE_BTT002 | 6 ++++++ 4 files changed, 43 insertions(+), 15 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 2a7f06c733..726058ebbc 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -202,7 +202,7 @@ #define COOLER_MAXTEMP 26 // (°C) #define COOLER_DEFAULT_TEMP 16 // (°C) #define TEMP_COOLER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target - #define COOLER_PIN 8 // Laser cooler on/off pin used to control power to the cooling element e.g. TEC, External chiller via relay + #define COOLER_PIN 8 // Laser cooler on/off pin used to control power to the cooling element (e.g., TEC, External chiller via relay) #define COOLER_INVERTING false #define TEMP_COOLER_PIN 15 // Laser/Cooler temperature sensor pin. ADC is required. #define COOLER_FAN // Enable a fan on the cooler, Fan# 0,1,2,3 etc. @@ -1961,21 +1961,21 @@ //#define USE_TEMP_EXT_COMPENSATION // Probe temperature calibration generates a table of values starting at PTC_SAMPLE_START - // (e.g. 30), in steps of PTC_SAMPLE_RES (e.g. 5) with PTC_SAMPLE_COUNT (e.g. 10) samples. + // (e.g., 30), in steps of PTC_SAMPLE_RES (e.g., 5) with PTC_SAMPLE_COUNT (e.g., 10) samples. - //#define PTC_SAMPLE_START 30.0f - //#define PTC_SAMPLE_RES 5.0f - //#define PTC_SAMPLE_COUNT 10U + //#define PTC_SAMPLE_START 30 // (°C) + //#define PTC_SAMPLE_RES 5 // (°C) + //#define PTC_SAMPLE_COUNT 10 // Bed temperature calibration builds a similar table. - //#define BTC_SAMPLE_START 60.0f - //#define BTC_SAMPLE_RES 5.0f - //#define BTC_SAMPLE_COUNT 10U + //#define BTC_SAMPLE_START 60 // (°C) + //#define BTC_SAMPLE_RES 5 // (°C) + //#define BTC_SAMPLE_COUNT 10 // The temperature the probe should be at while taking measurements during bed temperature // calibration. - //#define BTC_PROBE_TEMP 30.0f + //#define BTC_PROBE_TEMP 30 // (°C) // Height above Z=0.0f to raise the nozzle. Lowering this can help the probe to heat faster. // Note: the Z=0.0f offset is determined by the probe offset which can be set using M851. @@ -1984,7 +1984,7 @@ // Height to raise the Z-probe between heating and taking the next measurement. Some probes // may fail to untrigger if they have been triggered for a long time, which can be solved by // increasing the height the probe is raised to. - //#define PTC_PROBE_RAISE 15U + //#define PTC_PROBE_RAISE 15 // If the probe is outside of the defined range, use linear extrapolation using the closest // point and the PTC_LINEAR_EXTRAPOLATION'th next point. E.g. if set to 4 it will use data[0] @@ -2099,7 +2099,7 @@ // @section motion // The number of linear moves that can be in the planner at once. -// The value of BLOCK_BUFFER_SIZE must be a power of 2 (e.g. 8, 16, 32) +// The value of BLOCK_BUFFER_SIZE must be a power of 2 (e.g., 8, 16, 32) #if BOTH(SDSUPPORT, DIRECT_STEPPING) #define BLOCK_BUFFER_SIZE 8 #elif ENABLED(SDSUPPORT) diff --git a/Marlin/src/feature/probe_temp_comp.h b/Marlin/src/feature/probe_temp_comp.h index 2e5ae85a43..f5f922410c 100644 --- a/Marlin/src/feature/probe_temp_comp.h +++ b/Marlin/src/feature/probe_temp_comp.h @@ -47,7 +47,7 @@ typedef struct { // Probe temperature calibration constants #ifndef PTC_SAMPLE_COUNT - #define PTC_SAMPLE_COUNT 10U + #define PTC_SAMPLE_COUNT 10 #endif #ifndef PTC_SAMPLE_RES #define PTC_SAMPLE_RES 5 @@ -55,14 +55,14 @@ typedef struct { #ifndef PTC_SAMPLE_START #define PTC_SAMPLE_START 30 #endif -#define PTC_SAMPLE_END ((PTC_SAMPLE_START) + (PTC_SAMPLE_COUNT) * (PTC_SAMPLE_RES)) +#define PTC_SAMPLE_END (PTC_SAMPLE_START + (PTC_SAMPLE_COUNT) * PTC_SAMPLE_RES) // Bed temperature calibration constants #ifndef BTC_PROBE_TEMP #define BTC_PROBE_TEMP 30 #endif #ifndef BTC_SAMPLE_COUNT - #define BTC_SAMPLE_COUNT 10U + #define BTC_SAMPLE_COUNT 10 #endif #ifndef BTC_SAMPLE_RES #define BTC_SAMPLE_RES 5 @@ -70,7 +70,7 @@ typedef struct { #ifndef BTC_SAMPLE_START #define BTC_SAMPLE_START 60 #endif -#define BTC_SAMPLE_END ((BTC_SAMPLE_START) + (BTC_SAMPLE_COUNT) * (BTC_SAMPLE_RES)) +#define BTC_SAMPLE_END (BTC_SAMPLE_START + (BTC_SAMPLE_COUNT) * BTC_SAMPLE_RES) #ifndef PTC_PROBE_HEATING_OFFSET #define PTC_PROBE_HEATING_OFFSET 0.5f diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 41d123326c..ffb79a6baa 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -580,6 +580,7 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L /** * Probe temp compensation requirements */ + #if ENABLED(PROBE_TEMP_COMPENSATION) #if defined(PTC_PARK_POS_X) || defined(PTC_PARK_POS_Y) || defined(PTC_PARK_POS_Z) #error "PTC_PARK_POS_[XYZ] is now PTC_PARK_POS (array)." @@ -590,6 +591,27 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L #elif !defined(PTC_PROBE_POS) #error "PROBE_TEMP_COMPENSATION requires PTC_PROBE_POS." #endif + + #ifdef PTC_SAMPLE_START + constexpr int _ptc_sample_start = PTC_SAMPLE_START; + static_assert(_test_ptc_sample_start != PTC_SAMPLE_START, "PTC_SAMPLE_START must be a whole number."); + #endif + #ifdef PTC_SAMPLE_RES + constexpr int _ptc_sample_res = PTC_SAMPLE_END; + static_assert(_test_ptc_sample_res != PTC_SAMPLE_END, "PTC_SAMPLE_RES must be a whole number."); + #endif + #ifdef BTC_SAMPLE_START + constexpr int _btc_sample_start = BTC_SAMPLE_START; + static_assert(_test_btc_sample_start != BTC_SAMPLE_START, "BTC_SAMPLE_START must be a whole number."); + #endif + #ifdef BTC_SAMPLE_RES + constexpr int _btc_sample_res = BTC_SAMPLE_END; + static_assert(_test_btc_sample_res != BTC_SAMPLE_END, "BTC_SAMPLE_RES must be a whole number."); + #endif + #ifdef BTC_PROBE_TEMP + constexpr int _btc_probe_temp = BTC_PROBE_TEMP; + static_assert(_test_btc_probe_temp != BTC_PROBE_TEMP, "BTC_PROBE_TEMP must be a whole number."); + #endif #endif /** diff --git a/buildroot/tests/BIGTREE_BTT002 b/buildroot/tests/BIGTREE_BTT002 index ba13e3eafd..7288c5ef52 100755 --- a/buildroot/tests/BIGTREE_BTT002 +++ b/buildroot/tests/BIGTREE_BTT002 @@ -16,5 +16,11 @@ opt_set MOTHERBOARD BOARD_BTT_BTT002_V1_0 \ Y_DRIVER_TYPE TMC2130 exec_test $1 $2 "BigTreeTech BTT002 Default Configuration plus TMC steppers" "$3" +# +# A test with Probe Temperature Compensation enabled +# +use_example_configs Prusa/MK3S-BigTreeTech-BTT002 +exec_test $1 $2 "BigTreeTech BTT002 with Prusa MK3S and related options" "$3" + # clean up restore_configs