🐛 Add USE_TEMP_EXT_COMPENSATION options (#23007)

This commit is contained in:
tombrazier 2021-10-25 06:33:40 +01:00 committed by Scott Lahteine
parent a0da7e8a1f
commit 8d21ea55a2
4 changed files with 41 additions and 5 deletions

View File

@ -2006,7 +2006,7 @@
#define PTC_PROBE_POS { 90, 100 } #define PTC_PROBE_POS { 90, 100 }
// Enable additional compensation using hotend temperature // Enable additional compensation using hotend temperature
// Note: this values cannot be calibrated automatically but have to be set manually // Note: this values cannot be calibrated automatically but have to be set manually via M871.
//#define USE_TEMP_EXT_COMPENSATION //#define USE_TEMP_EXT_COMPENSATION
// Probe temperature calibration generates a table of values starting at PTC_SAMPLE_START // Probe temperature calibration generates a table of values starting at PTC_SAMPLE_START
@ -2022,6 +2022,12 @@
//#define BTC_SAMPLE_RES 5 // (°C) //#define BTC_SAMPLE_RES 5 // (°C)
//#define BTC_SAMPLE_COUNT 10 //#define BTC_SAMPLE_COUNT 10
#if ENABLED(USE_TEMP_EXT_COMPENSATION)
//#define ETC_SAMPLE_START 180 // (°C)
//#define ETC_SAMPLE_RES 5 // (°C)
//#define ETC_SAMPLE_COUNT 20
#endif
// The temperature the probe should be at while taking measurements during bed temperature // The temperature the probe should be at while taking measurements during bed temperature
// calibration. // calibration.
//#define BTC_PROBE_TEMP 30 // (°C) //#define BTC_PROBE_TEMP 30 // (°C)

View File

@ -72,6 +72,20 @@ typedef struct {
#endif #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)
// Extruder temperature calibration constants
#if ENABLED(USE_TEMP_EXT_COMPENSATION)
#ifndef ETC_SAMPLE_COUNT
#define ETC_SAMPLE_COUNT 20
#endif
#ifndef ETC_SAMPLE_RES
#define ETC_SAMPLE_RES 5
#endif
#ifndef ETC_SAMPLE_START
#define ETC_SAMPLE_START 180
#endif
#define ETC_SAMPLE_END (ETC_SAMPLE_START + (ETC_SAMPLE_COUNT) * ETC_SAMPLE_RES)
#endif
#ifndef PTC_PROBE_HEATING_OFFSET #ifndef PTC_PROBE_HEATING_OFFSET
#define PTC_PROBE_HEATING_OFFSET 0.5f #define PTC_PROBE_HEATING_OFFSET 0.5f
#endif #endif
@ -81,10 +95,10 @@ typedef struct {
#endif #endif
static constexpr temp_calib_t cali_info_init[TSI_COUNT] = { static constexpr temp_calib_t cali_info_init[TSI_COUNT] = {
{ PTC_SAMPLE_COUNT, PTC_SAMPLE_RES, PTC_SAMPLE_START, PTC_SAMPLE_END }, // Probe { PTC_SAMPLE_COUNT, PTC_SAMPLE_RES, PTC_SAMPLE_START, PTC_SAMPLE_END }, // Probe
{ BTC_SAMPLE_COUNT, BTC_SAMPLE_RES, BTC_SAMPLE_START, BTC_SAMPLE_END }, // Bed { BTC_SAMPLE_COUNT, BTC_SAMPLE_RES, BTC_SAMPLE_START, BTC_SAMPLE_END }, // Bed
#if ENABLED(USE_TEMP_EXT_COMPENSATION) #if ENABLED(USE_TEMP_EXT_COMPENSATION)
{ 20, 5, 180, 180 + 5 * 20 } // Extruder { ETC_SAMPLE_COUNT, ETC_SAMPLE_RES, ETC_SAMPLE_START, ETC_SAMPLE_END }, // Extruder
#endif #endif
}; };

View File

@ -648,7 +648,7 @@ G29_TYPE GcodeSuite::G29() {
#if ENABLED(PROBE_TEMP_COMPENSATION) #if ENABLED(PROBE_TEMP_COMPENSATION)
temp_comp.compensate_measurement(TSI_BED, thermalManager.degBed(), abl.measured_z); temp_comp.compensate_measurement(TSI_BED, thermalManager.degBed(), abl.measured_z);
temp_comp.compensate_measurement(TSI_PROBE, thermalManager.degProbe(), abl.measured_z); temp_comp.compensate_measurement(TSI_PROBE, thermalManager.degProbe(), abl.measured_z);
TERN_(USE_TEMP_EXT_COMPENSATION, temp_comp.compensate_measurement(TSI_EXT, thermalManager.degHotend(), abl.measured_z)); TERN_(USE_TEMP_EXT_COMPENSATION, temp_comp.compensate_measurement(TSI_EXT, thermalManager.degHotend(0), abl.measured_z));
#endif #endif
#if ENABLED(AUTO_BED_LEVELING_LINEAR) #if ENABLED(AUTO_BED_LEVELING_LINEAR)

View File

@ -648,6 +648,22 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L
constexpr decltype(_btc_probe_temp) _test_btc_probe_temp = 12.3f; constexpr decltype(_btc_probe_temp) _test_btc_probe_temp = 12.3f;
static_assert(_test_btc_probe_temp != 12.3f, "BTC_PROBE_TEMP must be a whole number."); static_assert(_test_btc_probe_temp != 12.3f, "BTC_PROBE_TEMP must be a whole number.");
#endif #endif
#if ENABLED(USE_TEMP_EXT_COMPENSATION)
#ifdef ETC_SAMPLE_START
constexpr auto _etc_sample_start = ETC_SAMPLE_START;
constexpr decltype(_etc_sample_start) _test_etc_sample_start = 12.3f;
static_assert(_test_etc_sample_start != 12.3f, "ETC_SAMPLE_START must be a whole number.");
#endif
#ifdef ETC_SAMPLE_RES
constexpr auto _etc_sample_res = ETC_SAMPLE_RES;
constexpr decltype(_etc_sample_res) _test_etc_sample_res = 12.3f;
static_assert(_test_etc_sample_res != 12.3f, "ETC_SAMPLE_RES must be a whole number.");
#endif
#endif
#if ENABLED(USE_TEMP_EXT_COMPENSATION) && EXTRUDERS != 1
#error "USE_TEMP_EXT_COMPENSATION only works with a single extruder."
#endif
#endif #endif
/** /**