Skip to content

Commit

Permalink
Disallow floats for PTC_* vars that used to allow them, and update …
Browse files Browse the repository at this point in the history
…default configuration to remove float vals. (MarlinFirmware#22044)
  • Loading branch information
slowbro committed Jun 13, 2021
1 parent a9faf9e commit 458fc54
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 12 deletions.
16 changes: 8 additions & 8 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -1963,19 +1963,19 @@
// 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.

//#define PTC_SAMPLE_START 30.0f
//#define PTC_SAMPLE_RES 5.0f
//#define PTC_SAMPLE_COUNT 10U
//#define PTC_SAMPLE_START 30
//#define PTC_SAMPLE_RES 5
//#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
//#define BTC_SAMPLE_RES 5
//#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

// 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.
Expand All @@ -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]
Expand Down
8 changes: 4 additions & 4 deletions Marlin/src/feature/probe_temp_comp.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,30 +47,30 @@ 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
#endif
#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
#endif
#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
Expand Down
30 changes: 30 additions & 0 deletions Marlin/src/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,36 @@
constexpr float arm[] = AXIS_RELATIVE_MODES;
static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _LOGICAL_AXES_STR "elements.");

#ifdef PTC_SAMPLE_START
auto _ptc_sample_start = PTC_SAMPLE_START;
constexpr decltype(_ptc_sample_start) _test_ptc_sample_start = 12.3f;
static_assert( _test_ptc_sample_start != 12.3f , "PTC_SAMPLE_START should not be a float; use whole numbers only.");
#endif

#ifdef PTC_SAMPLE_RES
auto _ptc_sample_res = PTC_SAMPLE_END;
constexpr decltype(_ptc_sample_res) _test_ptc_sample_res = 12.3f;
static_assert( _test_ptc_sample_res != 12.3f , "PTC_SAMPLE_RES should not be a float; use whole numbers only.");
#endif

#ifdef BTC_SAMPLE_START
auto _btc_sample_start = BTC_SAMPLE_START;
constexpr decltype(_btc_sample_start) _test_btc_sample_start = 12.3f;
static_assert( _test_btc_sample_start != 12.3f , "BTC_SAMPLE_START should not be a float; use whole numbers only.");
#endif

#ifdef BTC_SAMPLE_RES
auto _btc_sample_res = BTC_SAMPLE_END;
constexpr decltype(_btc_sample_res) _test_btc_sample_res = 12.3f;
static_assert( _test_btc_sample_res != 12.3f , "BTC_SAMPLE_RES should not be a float; use whole numbers only.");
#endif

#ifdef BTC_PROBE_TEMP
auto _btc_probe_temp = BTC_PROBE_TEMP;
constexpr decltype(_btc_probe_temp) _test_btc_probe_temp = 12.3f;
static_assert( _test_btc_probe_temp != 12.3f , "BTC_SAMPLE_RES should not be a float; use whole numbers only.");
#endif

/**
* Probe temp compensation requirements
*/
Expand Down

0 comments on commit 458fc54

Please sign in to comment.