mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-11-28 14:24:34 +00:00
🧑💻 Remove extraneous 'inline' hints
This commit is contained in:
parent
33fa3aba10
commit
6fb2d8a25f
@ -217,7 +217,7 @@
|
||||
#endif
|
||||
|
||||
enum { HasEmergencyParser = Cfg::EMERGENCYPARSER };
|
||||
static inline bool emergency_parser_enabled() { return Cfg::EMERGENCYPARSER; }
|
||||
static bool emergency_parser_enabled() { return Cfg::EMERGENCYPARSER; }
|
||||
|
||||
FORCE_INLINE static uint8_t dropped() { return Cfg::DROPPED_RX ? rx_dropped_bytes : 0; }
|
||||
FORCE_INLINE static uint8_t buffer_overruns() { return Cfg::RX_OVERRUNS ? rx_buffer_overruns : 0; }
|
||||
|
@ -118,7 +118,7 @@ public:
|
||||
static size_t write(const uint8_t c);
|
||||
static void flushTX();
|
||||
|
||||
static inline bool emergency_parser_enabled() { return Cfg::EMERGENCYPARSER; }
|
||||
static bool emergency_parser_enabled() { return Cfg::EMERGENCYPARSER; }
|
||||
|
||||
FORCE_INLINE static uint8_t dropped() { return Cfg::DROPPED_RX ? rx_dropped_bytes : 0; }
|
||||
FORCE_INLINE static uint8_t buffer_overruns() { return Cfg::RX_OVERRUNS ? rx_buffer_overruns : 0; }
|
||||
|
@ -77,7 +77,7 @@ public:
|
||||
|
||||
//uint32_t spiRate() const { return spi_speed; }
|
||||
|
||||
static inline uint32_t spiRate2Clock(uint32_t spiRate) {
|
||||
static uint32_t spiRate2Clock(uint32_t spiRate) {
|
||||
uint32_t Marlin_speed[7]; // CPSR is always 2
|
||||
Marlin_speed[0] = 8333333; //(SCR: 2) desired: 8,000,000 actual: 8,333,333 +4.2% SPI_FULL_SPEED
|
||||
Marlin_speed[1] = 4166667; //(SCR: 5) desired: 4,000,000 actual: 4,166,667 +4.2% SPI_HALF_SPEED
|
||||
|
@ -65,8 +65,8 @@ private:
|
||||
static uint16_t getRawData(const XPTCoordinate coordinate);
|
||||
static bool isTouched();
|
||||
|
||||
static inline void DataTransferBegin() { WRITE(TOUCH_CS_PIN, LOW); };
|
||||
static inline void DataTransferEnd() { WRITE(TOUCH_CS_PIN, HIGH); };
|
||||
static void DataTransferBegin() { WRITE(TOUCH_CS_PIN, LOW); };
|
||||
static void DataTransferEnd() { WRITE(TOUCH_CS_PIN, HIGH); };
|
||||
#if ENABLED(TOUCH_BUTTONS_HW_SPI)
|
||||
static uint16_t HardwareIO(uint16_t data);
|
||||
#endif
|
||||
|
@ -62,8 +62,8 @@ private:
|
||||
static uint16_t getRawData(const XPTCoordinate coordinate);
|
||||
static bool isTouched();
|
||||
|
||||
static inline void DataTransferBegin();
|
||||
static inline void DataTransferEnd();
|
||||
static void DataTransferBegin();
|
||||
static void DataTransferEnd();
|
||||
#if ENABLED(TOUCH_BUTTONS_HW_SPI)
|
||||
static uint16_t HardwareIO(uint16_t data);
|
||||
#endif
|
||||
|
@ -69,8 +69,8 @@ private:
|
||||
static uint16_t getRawData(const XPTCoordinate coordinate);
|
||||
static bool isTouched();
|
||||
|
||||
static inline void DataTransferBegin() { if (SPIx.Instance) { HAL_SPI_Init(&SPIx); } WRITE(TOUCH_CS_PIN, LOW); };
|
||||
static inline void DataTransferEnd() { WRITE(TOUCH_CS_PIN, HIGH); };
|
||||
static void DataTransferBegin() { if (SPIx.Instance) { HAL_SPI_Init(&SPIx); } WRITE(TOUCH_CS_PIN, LOW); };
|
||||
static void DataTransferEnd() { WRITE(TOUCH_CS_PIN, HIGH); };
|
||||
static uint16_t HardwareIO(uint16_t data);
|
||||
static uint16_t SoftwareIO(uint16_t data);
|
||||
static uint16_t IO(uint16_t data = 0) { return SPIx.Instance ? HardwareIO(data) : SoftwareIO(data); }
|
||||
|
@ -417,7 +417,7 @@ private:
|
||||
/**
|
||||
* @brief Wait until TXE (tx empty) flag is set and BSY (busy) flag unset.
|
||||
*/
|
||||
static inline void waitSpiTxEnd(spi_dev *spi_d) {
|
||||
static void waitSpiTxEnd(spi_dev *spi_d) {
|
||||
while (spi_is_tx_empty(spi_d) == 0) { /* nada */ } // wait until TXE=1
|
||||
while (spi_is_busy(spi_d) != 0) { /* nada */ } // wait until BSY=0
|
||||
}
|
||||
|
@ -54,11 +54,11 @@ extern const stm32_pin_info PIN_MAP[BOARD_NR_GPIO_PINS];
|
||||
#define M43_NEVER_TOUCH(Q) (Q >= 9 && Q <= 12) // SERIAL/USB pins PA9(TX) PA10(RX)
|
||||
#endif
|
||||
|
||||
static inline int8_t get_pin_mode(pin_t pin) {
|
||||
static int8_t get_pin_mode(pin_t pin) {
|
||||
return VALID_PIN(pin) ? _GET_MODE(pin) : -1;
|
||||
}
|
||||
|
||||
static inline pin_t DIGITAL_PIN_TO_ANALOG_PIN(pin_t pin) {
|
||||
static pin_t DIGITAL_PIN_TO_ANALOG_PIN(pin_t pin) {
|
||||
if (!VALID_PIN(pin)) return -1;
|
||||
int8_t adc_channel = int8_t(PIN_MAP[pin].adc_channel);
|
||||
#ifdef NUM_ANALOG_INPUTS
|
||||
@ -67,7 +67,7 @@ static inline pin_t DIGITAL_PIN_TO_ANALOG_PIN(pin_t pin) {
|
||||
return pin_t(adc_channel);
|
||||
}
|
||||
|
||||
static inline bool IS_ANALOG(pin_t pin) {
|
||||
static bool IS_ANALOG(pin_t pin) {
|
||||
if (!VALID_PIN(pin)) return false;
|
||||
if (PIN_MAP[pin].adc_channel != ADCx) {
|
||||
#ifdef NUM_ANALOG_INPUTS
|
||||
@ -78,11 +78,11 @@ static inline bool IS_ANALOG(pin_t pin) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool GET_PINMODE(const pin_t pin) {
|
||||
static bool GET_PINMODE(const pin_t pin) {
|
||||
return VALID_PIN(pin) && !IS_INPUT(pin);
|
||||
}
|
||||
|
||||
static inline bool GET_ARRAY_IS_DIGITAL(const int16_t array_pin) {
|
||||
static bool GET_ARRAY_IS_DIGITAL(const int16_t array_pin) {
|
||||
const pin_t pin = GET_ARRAY_PIN(array_pin);
|
||||
return (!IS_ANALOG(pin)
|
||||
#ifdef NUM_ANALOG_INPUTS
|
||||
@ -93,7 +93,7 @@ static inline bool GET_ARRAY_IS_DIGITAL(const int16_t array_pin) {
|
||||
|
||||
#include "../../inc/MarlinConfig.h" // Allow pins/pins.h to set density
|
||||
|
||||
static inline void pwm_details(const pin_t pin) {
|
||||
static void pwm_details(const pin_t pin) {
|
||||
if (PWM_PIN(pin)) {
|
||||
timer_dev * const tdev = PIN_MAP[pin].timer_device;
|
||||
const uint8_t channel = PIN_MAP[pin].timer_channel;
|
||||
@ -113,7 +113,7 @@ static inline void pwm_details(const pin_t pin) {
|
||||
}
|
||||
}
|
||||
|
||||
static inline void print_port(pin_t pin) {
|
||||
static void print_port(pin_t pin) {
|
||||
const char port = 'A' + char(pin >> 4); // pin div 16
|
||||
const int16_t gbit = PIN_MAP[pin].gpio_bit;
|
||||
char buffer[8];
|
||||
|
@ -65,8 +65,8 @@ private:
|
||||
static uint16_t getRawData(const XPTCoordinate coordinate);
|
||||
static bool isTouched();
|
||||
|
||||
static inline void DataTransferBegin() { WRITE(TOUCH_CS_PIN, LOW); };
|
||||
static inline void DataTransferEnd() { WRITE(TOUCH_CS_PIN, HIGH); };
|
||||
static void DataTransferBegin() { WRITE(TOUCH_CS_PIN, LOW); };
|
||||
static void DataTransferEnd() { WRITE(TOUCH_CS_PIN, HIGH); };
|
||||
#if ENABLED(TOUCH_BUTTONS_HW_SPI)
|
||||
static uint16_t HardwareIO(uint16_t data);
|
||||
#endif
|
||||
|
@ -49,7 +49,7 @@ public:
|
||||
|
||||
// Write one or more bytes of data
|
||||
// Return 'true' on write error
|
||||
static inline bool write_data(const int pos, const uint8_t *value, const size_t size=sizeof(uint8_t)) {
|
||||
static bool write_data(const int pos, const uint8_t *value, const size_t size=sizeof(uint8_t)) {
|
||||
int data_pos = pos;
|
||||
uint16_t crc = 0;
|
||||
return write_data(data_pos, value, size, &crc);
|
||||
@ -57,11 +57,11 @@ public:
|
||||
|
||||
// Write a single byte of data
|
||||
// Return 'true' on write error
|
||||
static inline bool write_data(const int pos, const uint8_t value) { return write_data(pos, &value); }
|
||||
static bool write_data(const int pos, const uint8_t value) { return write_data(pos, &value); }
|
||||
|
||||
// Read one or more bytes of data
|
||||
// Return 'true' on read error
|
||||
static inline bool read_data(const int pos, uint8_t *value, const size_t size=1) {
|
||||
static bool read_data(const int pos, uint8_t *value, const size_t size=1) {
|
||||
int data_pos = pos;
|
||||
uint16_t crc = 0;
|
||||
return read_data(data_pos, value, size, &crc);
|
||||
|
@ -131,13 +131,13 @@
|
||||
#ifdef __cplusplus
|
||||
|
||||
// C++11 solution that is standards compliant.
|
||||
template <class V, class N> static inline constexpr void NOLESS(V& v, const N n) {
|
||||
template <class V, class N> static constexpr void NOLESS(V& v, const N n) {
|
||||
if (n > v) v = n;
|
||||
}
|
||||
template <class V, class N> static inline constexpr void NOMORE(V& v, const N n) {
|
||||
template <class V, class N> static constexpr void NOMORE(V& v, const N n) {
|
||||
if (n < v) v = n;
|
||||
}
|
||||
template <class V, class N1, class N2> static inline constexpr void LIMIT(V& v, const N1 n1, const N2 n2) {
|
||||
template <class V, class N1, class N2> static constexpr void LIMIT(V& v, const N1 n1, const N2 n2) {
|
||||
if (n1 > v) v = n1;
|
||||
else if (n2 < v) v = n2;
|
||||
}
|
||||
@ -366,7 +366,7 @@
|
||||
|
||||
#undef ABS
|
||||
#ifdef __cplusplus
|
||||
template <class T> static inline constexpr const T ABS(const T v) { return v >= 0 ? v : -v; }
|
||||
template <class T> static constexpr const T ABS(const T v) { return v >= 0 ? v : -v; }
|
||||
#else
|
||||
#define ABS(a) ({__typeof__(a) _a = (a); _a >= 0 ? _a : -_a;})
|
||||
#endif
|
||||
@ -409,14 +409,14 @@
|
||||
extern "C++" {
|
||||
|
||||
// C++11 solution that is standards compliant. Return type is deduced automatically
|
||||
template <class L, class R> static inline constexpr auto _MIN(const L lhs, const R rhs) -> decltype(lhs + rhs) {
|
||||
template <class L, class R> static constexpr auto _MIN(const L lhs, const R rhs) -> decltype(lhs + rhs) {
|
||||
return lhs < rhs ? lhs : rhs;
|
||||
}
|
||||
template <class L, class R> static inline constexpr auto _MAX(const L lhs, const R rhs) -> decltype(lhs + rhs) {
|
||||
template <class L, class R> static constexpr auto _MAX(const L lhs, const R rhs) -> decltype(lhs + rhs) {
|
||||
return lhs > rhs ? lhs : rhs;
|
||||
}
|
||||
template<class T, class ... Ts> static inline constexpr const T _MIN(T V, Ts... Vs) { return _MIN(V, _MIN(Vs...)); }
|
||||
template<class T, class ... Ts> static inline constexpr const T _MAX(T V, Ts... Vs) { return _MAX(V, _MAX(Vs...)); }
|
||||
template<class T, class ... Ts> static constexpr const T _MIN(T V, Ts... Vs) { return _MIN(V, _MIN(Vs...)); }
|
||||
template<class T, class ... Ts> static constexpr const T _MAX(T V, Ts... Vs) { return _MAX(V, _MAX(Vs...)); }
|
||||
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ public:
|
||||
inline constexpr bool enabled(const SerialMask PortMask) const { return mask & PortMask.mask; }
|
||||
inline constexpr SerialMask combine(const SerialMask other) const { return SerialMask(mask | other.mask); }
|
||||
inline constexpr SerialMask operator<< (const int offset) const { return SerialMask(mask << offset); }
|
||||
static inline SerialMask from(const serial_index_t index) {
|
||||
static SerialMask from(const serial_index_t index) {
|
||||
if (index.valid()) return SerialMask(_BV(index.index));
|
||||
return SerialMask(0); // A invalid index mean no output
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ public:
|
||||
|
||||
#if ENABLED(BABYSTEP_DISPLAY_TOTAL)
|
||||
static int16_t axis_total[BS_TOTAL_IND(Z_AXIS) + 1]; // Total babysteps since G28
|
||||
static inline void reset_total(const AxisEnum axis) {
|
||||
static void reset_total(const AxisEnum axis) {
|
||||
if (TERN1(BABYSTEP_XY, axis == Z_AXIS))
|
||||
axis_total[BS_TOTAL_IND(axis)] = 0;
|
||||
}
|
||||
@ -63,7 +63,7 @@ public:
|
||||
static void add_steps(const AxisEnum axis, const int16_t distance);
|
||||
static void add_mm(const AxisEnum axis, const_float_t mm);
|
||||
|
||||
static inline bool has_steps() {
|
||||
static bool has_steps() {
|
||||
return steps[BS_AXIS_IND(X_AXIS)] || steps[BS_AXIS_IND(Y_AXIS)] || steps[BS_AXIS_IND(Z_AXIS)];
|
||||
}
|
||||
|
||||
@ -71,7 +71,7 @@ public:
|
||||
// Called by the Temperature or Stepper ISR to
|
||||
// apply accumulated babysteps to the axes.
|
||||
//
|
||||
static inline void task() {
|
||||
static void task() {
|
||||
LOOP_LE_N(i, BS_AXIS_IND(Z_AXIS)) step_axis(BS_AXIS(i));
|
||||
}
|
||||
|
||||
|
@ -35,8 +35,8 @@ public:
|
||||
static float smoothing_mm;
|
||||
#endif
|
||||
|
||||
static inline void set_correction(const_float_t v) { correction = _MAX(0, _MIN(1.0, v)) * all_on; }
|
||||
static inline float get_correction() { return float(ui8_to_percent(correction)) / 100.0f; }
|
||||
static void set_correction(const_float_t v) { correction = _MAX(0, _MIN(1.0, v)) * all_on; }
|
||||
static float get_correction() { return float(ui8_to_percent(correction)) / 100.0f; }
|
||||
#else
|
||||
static constexpr uint8_t correction = (BACKLASH_CORRECTION) * 0xFF;
|
||||
static const xyz_float_t distance_mm;
|
||||
@ -53,7 +53,7 @@ public:
|
||||
static void measure_with_probe();
|
||||
#endif
|
||||
|
||||
static inline float get_measurement(const AxisEnum a) {
|
||||
static float get_measurement(const AxisEnum a) {
|
||||
UNUSED(a);
|
||||
// Return the measurement averaged over all readings
|
||||
return TERN(MEASURE_BACKLASH_WHEN_PROBING
|
||||
@ -62,12 +62,12 @@ public:
|
||||
);
|
||||
}
|
||||
|
||||
static inline bool has_measurement(const AxisEnum a) {
|
||||
static bool has_measurement(const AxisEnum a) {
|
||||
UNUSED(a);
|
||||
return TERN0(MEASURE_BACKLASH_WHEN_PROBING, measured_count[a] > 0);
|
||||
}
|
||||
|
||||
static inline bool has_any_measurement() {
|
||||
static bool has_any_measurement() {
|
||||
return has_measurement(X_AXIS) || has_measurement(Y_AXIS) || has_measurement(Z_AXIS);
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ public:
|
||||
|
||||
static void set_z(const int8_t px, const int8_t py, const_float_t z) { z_values[px][py] = z; }
|
||||
|
||||
static inline void zigzag(const int8_t index, int8_t &px, int8_t &py) {
|
||||
static void zigzag(const int8_t index, int8_t &px, int8_t &py) {
|
||||
px = index % (GRID_MAX_POINTS_X);
|
||||
py = index / (GRID_MAX_POINTS_X);
|
||||
if (py & 1) px = (GRID_MAX_POINTS_X) - 1 - px; // Zig zag
|
||||
@ -78,10 +78,10 @@ public:
|
||||
int8_t cy = (y - (MESH_MIN_Y)) * RECIPROCAL(MESH_Y_DIST);
|
||||
return constrain(cy, 0, GRID_MAX_CELLS_Y - 1);
|
||||
}
|
||||
static inline xy_int8_t cell_indexes(const_float_t x, const_float_t y) {
|
||||
static xy_int8_t cell_indexes(const_float_t x, const_float_t y) {
|
||||
return { cell_index_x(x), cell_index_y(y) };
|
||||
}
|
||||
static inline xy_int8_t cell_indexes(const xy_pos_t &xy) { return cell_indexes(xy.x, xy.y); }
|
||||
static xy_int8_t cell_indexes(const xy_pos_t &xy) { return cell_indexes(xy.x, xy.y); }
|
||||
|
||||
static int8_t probe_index_x(const_float_t x) {
|
||||
int8_t px = (x - (MESH_MIN_X) + 0.5f * (MESH_X_DIST)) * RECIPROCAL(MESH_X_DIST);
|
||||
@ -91,10 +91,10 @@ public:
|
||||
int8_t py = (y - (MESH_MIN_Y) + 0.5f * (MESH_Y_DIST)) * RECIPROCAL(MESH_Y_DIST);
|
||||
return WITHIN(py, 0, (GRID_MAX_POINTS_Y) - 1) ? py : -1;
|
||||
}
|
||||
static inline xy_int8_t probe_indexes(const_float_t x, const_float_t y) {
|
||||
static xy_int8_t probe_indexes(const_float_t x, const_float_t y) {
|
||||
return { probe_index_x(x), probe_index_y(y) };
|
||||
}
|
||||
static inline xy_int8_t probe_indexes(const xy_pos_t &xy) { return probe_indexes(xy.x, xy.y); }
|
||||
static xy_int8_t probe_indexes(const xy_pos_t &xy) { return probe_indexes(xy.x, xy.y); }
|
||||
|
||||
static float calc_z0(const_float_t a0, const_float_t a1, const_float_t z1, const_float_t a2, const_float_t z2) {
|
||||
const float delta_z = (z2 - z1) / (a2 - a1),
|
||||
|
@ -80,7 +80,7 @@ private:
|
||||
static void tilt_mesh_based_on_3pts(const_float_t z1, const_float_t z2, const_float_t z3);
|
||||
static void tilt_mesh_based_on_probed_grid(const bool do_ubl_mesh_map);
|
||||
static bool smart_fill_one(const uint8_t x, const uint8_t y, const int8_t xdir, const int8_t ydir);
|
||||
static inline bool smart_fill_one(const xy_uint8_t &pos, const xy_uint8_t &dir) {
|
||||
static bool smart_fill_one(const xy_uint8_t &pos, const xy_uint8_t &dir) {
|
||||
return smart_fill_one(pos.x, pos.y, dir.x, dir.y);
|
||||
}
|
||||
static void smart_fill_mesh();
|
||||
@ -124,7 +124,7 @@ public:
|
||||
static bool lcd_map_control;
|
||||
static void steppers_were_disabled();
|
||||
#else
|
||||
static inline void steppers_were_disabled() {}
|
||||
static void steppers_were_disabled() {}
|
||||
#endif
|
||||
|
||||
static volatile int16_t encoder_diff; // Volatile because buttons may change it at interrupt time
|
||||
@ -157,10 +157,10 @@ public:
|
||||
return constrain(cell_index_y_raw(y), 0, GRID_MAX_CELLS_Y - 1);
|
||||
}
|
||||
|
||||
static inline xy_int8_t cell_indexes(const_float_t x, const_float_t y) {
|
||||
static xy_int8_t cell_indexes(const_float_t x, const_float_t y) {
|
||||
return { cell_index_x(x), cell_index_y(y) };
|
||||
}
|
||||
static inline xy_int8_t cell_indexes(const xy_pos_t &xy) { return cell_indexes(xy.x, xy.y); }
|
||||
static xy_int8_t cell_indexes(const xy_pos_t &xy) { return cell_indexes(xy.x, xy.y); }
|
||||
|
||||
static int8_t closest_x_index(const_float_t x) {
|
||||
const int8_t px = (x - (MESH_MIN_X) + (MESH_X_DIST) * 0.5) * RECIPROCAL(MESH_X_DIST);
|
||||
@ -170,7 +170,7 @@ public:
|
||||
const int8_t py = (y - (MESH_MIN_Y) + (MESH_Y_DIST) * 0.5) * RECIPROCAL(MESH_Y_DIST);
|
||||
return WITHIN(py, 0, (GRID_MAX_POINTS_Y) - 1) ? py : -1;
|
||||
}
|
||||
static inline xy_int8_t closest_indexes(const xy_pos_t &xy) {
|
||||
static xy_int8_t closest_indexes(const xy_pos_t &xy) {
|
||||
return { closest_x_index(xy.x), closest_y_index(xy.y) };
|
||||
}
|
||||
|
||||
@ -203,7 +203,7 @@ public:
|
||||
* z_correction_for_x_on_horizontal_mesh_line is an optimization for
|
||||
* the case where the printer is making a vertical line that only crosses horizontal mesh lines.
|
||||
*/
|
||||
static inline float z_correction_for_x_on_horizontal_mesh_line(const_float_t rx0, const int x1_i, const int yi) {
|
||||
static float z_correction_for_x_on_horizontal_mesh_line(const_float_t rx0, const int x1_i, const int yi) {
|
||||
if (!WITHIN(x1_i, 0, (GRID_MAX_POINTS_X) - 1) || !WITHIN(yi, 0, (GRID_MAX_POINTS_Y) - 1)) {
|
||||
|
||||
if (DEBUGGING(LEVELING)) {
|
||||
@ -226,7 +226,7 @@ public:
|
||||
//
|
||||
// See comments above for z_correction_for_x_on_horizontal_mesh_line
|
||||
//
|
||||
static inline float z_correction_for_y_on_vertical_mesh_line(const_float_t ry0, const int xi, const int y1_i) {
|
||||
static float z_correction_for_y_on_vertical_mesh_line(const_float_t ry0, const int xi, const int y1_i) {
|
||||
if (!WITHIN(xi, 0, (GRID_MAX_POINTS_X) - 1) || !WITHIN(y1_i, 0, (GRID_MAX_POINTS_Y) - 1)) {
|
||||
|
||||
if (DEBUGGING(LEVELING)) {
|
||||
@ -285,12 +285,12 @@ public:
|
||||
|
||||
return z0;
|
||||
}
|
||||
static inline float get_z_correction(const xy_pos_t &pos) { return get_z_correction(pos.x, pos.y); }
|
||||
static float get_z_correction(const xy_pos_t &pos) { return get_z_correction(pos.x, pos.y); }
|
||||
|
||||
static inline float mesh_index_to_xpos(const uint8_t i) {
|
||||
static float mesh_index_to_xpos(const uint8_t i) {
|
||||
return i < (GRID_MAX_POINTS_X) ? pgm_read_float(&_mesh_index_to_xpos[i]) : MESH_MIN_X + i * (MESH_X_DIST);
|
||||
}
|
||||
static inline float mesh_index_to_ypos(const uint8_t i) {
|
||||
static float mesh_index_to_ypos(const uint8_t i) {
|
||||
return i < (GRID_MAX_POINTS_Y) ? pgm_read_float(&_mesh_index_to_ypos[i]) : MESH_MIN_Y + i * (MESH_Y_DIST);
|
||||
}
|
||||
|
||||
@ -300,7 +300,7 @@ public:
|
||||
static void line_to_destination_cartesian(const_feedRate_t scaled_fr_mm_s, const uint8_t e);
|
||||
#endif
|
||||
|
||||
static inline bool mesh_is_valid() {
|
||||
static bool mesh_is_valid() {
|
||||
GRID_LOOP(x, y) if (isnan(z_values[x][y])) return false;
|
||||
return true;
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ public:
|
||||
static constexpr bool high_speed_mode = false;
|
||||
#endif
|
||||
|
||||
static inline float z_extra_clearance() { return high_speed_mode ? 7 : 0; }
|
||||
static float z_extra_clearance() { return high_speed_mode ? 7 : 0; }
|
||||
|
||||
// DEPLOY and STOW are wrapped for error handling - these are used by homing and by probing
|
||||
static bool deploy() { return deploy_proc(); }
|
||||
|
@ -32,10 +32,10 @@ public:
|
||||
static void cancel_object(const int8_t obj);
|
||||
static void uncancel_object(const int8_t obj);
|
||||
static void report();
|
||||
static inline bool is_canceled(const int8_t obj) { return TEST(canceled, obj); }
|
||||
static inline void clear_active_object() { set_active_object(-1); }
|
||||
static inline void cancel_active_object() { cancel_object(active_object); }
|
||||
static inline void reset() { canceled = 0x0000; object_count = 0; clear_active_object(); }
|
||||
static bool is_canceled(const int8_t obj) { return TEST(canceled, obj); }
|
||||
static void clear_active_object() { set_active_object(-1); }
|
||||
static void cancel_active_object() { cancel_object(active_object); }
|
||||
static void reset() { canceled = 0x0000; object_count = 0; clear_active_object(); }
|
||||
};
|
||||
|
||||
extern CancelObject cancelable;
|
||||
|
@ -49,8 +49,8 @@ public:
|
||||
}
|
||||
|
||||
static void update(const bool sflag);
|
||||
static inline void update_brightness() { update(false); }
|
||||
static inline void update_enabled() { update(true); }
|
||||
static void update_brightness() { update(false); }
|
||||
static void update_enabled() { update(true); }
|
||||
|
||||
#if ENABLED(CASE_LIGHT_IS_COLOR_LED)
|
||||
private:
|
||||
|
@ -60,9 +60,9 @@ class ControllerFan {
|
||||
#else
|
||||
static const controllerFan_settings_t &settings;
|
||||
#endif
|
||||
static inline bool state() { return speed > 0; }
|
||||
static inline void init() { reset(); }
|
||||
static inline void reset() { TERN_(CONTROLLER_FAN_EDITABLE, settings = controllerFan_defaults); }
|
||||
static bool state() { return speed > 0; }
|
||||
static void init() { reset(); }
|
||||
static void reset() { TERN_(CONTROLLER_FAN_EDITABLE, settings = controllerFan_defaults); }
|
||||
static void setup();
|
||||
static void update();
|
||||
};
|
||||
|
@ -56,7 +56,7 @@ class FanCheck {
|
||||
static uint8_t rps[TACHO_COUNT];
|
||||
static TachoError error;
|
||||
|
||||
static inline void report_speed_error(uint8_t fan);
|
||||
static void report_speed_error(uint8_t fan);
|
||||
|
||||
public:
|
||||
|
||||
@ -67,11 +67,11 @@ class FanCheck {
|
||||
static void compute_speed(uint16_t elapsedTime);
|
||||
static void print_fan_states();
|
||||
#if HAS_PWMFANCHECK
|
||||
static inline void toggle_measuring() { measuring = !measuring; }
|
||||
static inline bool is_measuring() { return measuring; }
|
||||
static void toggle_measuring() { measuring = !measuring; }
|
||||
static bool is_measuring() { return measuring; }
|
||||
#endif
|
||||
|
||||
static inline void check_deferred_error() {
|
||||
static void check_deferred_error() {
|
||||
if (error == TachoError::DETECTED) {
|
||||
error = TachoError::REPORTED;
|
||||
TERN(PARK_HEAD_ON_PAUSE, queue.inject(F("M125")), kill(GET_TEXT_F(MSG_FAN_SPEED_FAULT)));
|
||||
|
@ -41,9 +41,9 @@ public:
|
||||
FilamentWidthSensor() { init(); }
|
||||
static void init();
|
||||
|
||||
static inline void enable(const bool ena) { enabled = ena; }
|
||||
static void enable(const bool ena) { enabled = ena; }
|
||||
|
||||
static inline void set_delay_cm(const uint8_t cm) {
|
||||
static void set_delay_cm(const uint8_t cm) {
|
||||
meas_delay_cm = _MIN(cm, MAX_MEASUREMENT_DELAY);
|
||||
}
|
||||
|
||||
@ -67,18 +67,18 @@ public:
|
||||
}
|
||||
|
||||
// Convert raw measurement to mm
|
||||
static inline float raw_to_mm(const uint16_t v) { return v * 5.0f * RECIPROCAL(float(MAX_RAW_THERMISTOR_VALUE)); }
|
||||
static inline float raw_to_mm() { return raw_to_mm(raw); }
|
||||
static float raw_to_mm(const uint16_t v) { return v * 5.0f * RECIPROCAL(float(MAX_RAW_THERMISTOR_VALUE)); }
|
||||
static float raw_to_mm() { return raw_to_mm(raw); }
|
||||
|
||||
// A scaled reading is ready
|
||||
// Divide to get to 0-16384 range since we used 1/128 IIR filter approach
|
||||
static inline void reading_ready() { raw = accum >> 10; }
|
||||
static void reading_ready() { raw = accum >> 10; }
|
||||
|
||||
// Update mm from the raw measurement
|
||||
static inline void update_measured_mm() { measured_mm = raw_to_mm(); }
|
||||
static void update_measured_mm() { measured_mm = raw_to_mm(); }
|
||||
|
||||
// Update ring buffer used to delay filament measurements
|
||||
static inline void advance_e(const_float_t e_move) {
|
||||
static void advance_e(const_float_t e_move) {
|
||||
|
||||
// Increment counters with the E distance
|
||||
e_count += e_move;
|
||||
@ -106,7 +106,7 @@ public:
|
||||
}
|
||||
|
||||
// Dynamically set the volumetric multiplier based on the delayed width measurement.
|
||||
static inline void update_volumetric() {
|
||||
static void update_volumetric() {
|
||||
if (enabled) {
|
||||
int8_t read_index = index_r - meas_delay_cm;
|
||||
if (read_index < 0) read_index += MMD_CM; // Loop around buffer if needed
|
||||
|
@ -97,7 +97,7 @@ class HostUI {
|
||||
static void handle_response(const uint8_t response);
|
||||
|
||||
static void notify_P(PGM_P const message);
|
||||
static inline void notify(FSTR_P const fmsg) { notify_P(FTOP(fmsg)); }
|
||||
static void notify(FSTR_P const fmsg) { notify_P(FTOP(fmsg)); }
|
||||
static void notify(const char * const message);
|
||||
|
||||
static void prompt_begin(const PromptReason reason, FSTR_P const fstr, const char extra_char='\0');
|
||||
@ -105,7 +105,7 @@ class HostUI {
|
||||
static void prompt_end();
|
||||
static void prompt_do(const PromptReason reason, FSTR_P const pstr, FSTR_P const btn1=nullptr, FSTR_P const btn2=nullptr);
|
||||
static void prompt_do(const PromptReason reason, FSTR_P const pstr, const char extra_char, FSTR_P const btn1=nullptr, FSTR_P const btn2=nullptr);
|
||||
static inline void prompt_open(const PromptReason reason, FSTR_P const pstr, FSTR_P const btn1=nullptr, FSTR_P const btn2=nullptr) {
|
||||
static void prompt_open(const PromptReason reason, FSTR_P const pstr, FSTR_P const btn1=nullptr, FSTR_P const btn2=nullptr) {
|
||||
if (host_prompt_reason == PROMPT_NOT_DEFINED) prompt_do(reason, pstr, btn1, btn2);
|
||||
}
|
||||
|
||||
|
@ -118,7 +118,7 @@ public:
|
||||
OPTARG(NEOPIXEL_IS_SEQUENTIAL, bool isSequence=false)
|
||||
);
|
||||
|
||||
static inline void set_color(uint8_t r, uint8_t g, uint8_t b
|
||||
static void set_color(uint8_t r, uint8_t g, uint8_t b
|
||||
OPTARG(HAS_WHITE_LED, uint8_t w=0)
|
||||
OPTARG(NEOPIXEL_LED, uint8_t i=NEOPIXEL_BRIGHTNESS)
|
||||
OPTARG(NEOPIXEL_IS_SEQUENTIAL, bool isSequence=false)
|
||||
@ -126,23 +126,23 @@ public:
|
||||
set_color(LEDColor(r, g, b OPTARG(HAS_WHITE_LED, w) OPTARG(NEOPIXEL_LED, i)) OPTARG(NEOPIXEL_IS_SEQUENTIAL, isSequence));
|
||||
}
|
||||
|
||||
static inline void set_off() { set_color(LEDColorOff()); }
|
||||
static inline void set_green() { set_color(LEDColorGreen()); }
|
||||
static inline void set_white() { set_color(LEDColorWhite()); }
|
||||
static void set_off() { set_color(LEDColorOff()); }
|
||||
static void set_green() { set_color(LEDColorGreen()); }
|
||||
static void set_white() { set_color(LEDColorWhite()); }
|
||||
|
||||
#if ENABLED(LED_COLOR_PRESETS)
|
||||
static const LEDColor defaultLEDColor;
|
||||
static inline void set_default() { set_color(defaultLEDColor); }
|
||||
static inline void set_red() { set_color(LEDColorRed()); }
|
||||
static inline void set_orange() { set_color(LEDColorOrange()); }
|
||||
static inline void set_yellow() { set_color(LEDColorYellow()); }
|
||||
static inline void set_blue() { set_color(LEDColorBlue()); }
|
||||
static inline void set_indigo() { set_color(LEDColorIndigo()); }
|
||||
static inline void set_violet() { set_color(LEDColorViolet()); }
|
||||
static void set_default() { set_color(defaultLEDColor); }
|
||||
static void set_red() { set_color(LEDColorRed()); }
|
||||
static void set_orange() { set_color(LEDColorOrange()); }
|
||||
static void set_yellow() { set_color(LEDColorYellow()); }
|
||||
static void set_blue() { set_color(LEDColorBlue()); }
|
||||
static void set_indigo() { set_color(LEDColorIndigo()); }
|
||||
static void set_violet() { set_color(LEDColorViolet()); }
|
||||
#endif
|
||||
|
||||
#if ENABLED(PRINTER_EVENT_LEDS)
|
||||
static inline LEDColor get_color() { return lights_on ? color : LEDColorOff(); }
|
||||
static LEDColor get_color() { return lights_on ? color : LEDColorOff(); }
|
||||
#endif
|
||||
|
||||
#if ANY(LED_CONTROL_MENU, PRINTER_EVENT_LEDS, CASE_LIGHT_IS_COLOR_LED)
|
||||
@ -154,14 +154,14 @@ public:
|
||||
static void toggle(); // swap "off" with color
|
||||
#endif
|
||||
#if EITHER(LED_CONTROL_MENU, CASE_LIGHT_USE_RGB_LED)
|
||||
static inline void update() { set_color(color); }
|
||||
static void update() { set_color(color); }
|
||||
#endif
|
||||
|
||||
#ifdef LED_BACKLIGHT_TIMEOUT
|
||||
private:
|
||||
static millis_t led_off_time;
|
||||
public:
|
||||
static inline void reset_timeout(const millis_t &ms) {
|
||||
static void reset_timeout(const millis_t &ms) {
|
||||
led_off_time = ms + LED_BACKLIGHT_TIMEOUT;
|
||||
if (!lights_on) update();
|
||||
}
|
||||
@ -181,7 +181,7 @@ extern LEDLights leds;
|
||||
|
||||
static void set_color(const LEDColor &color);
|
||||
|
||||
static inline void set_color(uint8_t r, uint8_t g, uint8_t b
|
||||
static void set_color(uint8_t r, uint8_t g, uint8_t b
|
||||
OPTARG(HAS_WHITE_LED, uint8_t w=0)
|
||||
OPTARG(NEOPIXEL_LED, uint8_t i=NEOPIXEL_BRIGHTNESS)
|
||||
) {
|
||||
@ -191,26 +191,26 @@ extern LEDLights leds;
|
||||
));
|
||||
}
|
||||
|
||||
static inline void set_off() { set_color(LEDColorOff()); }
|
||||
static inline void set_green() { set_color(LEDColorGreen()); }
|
||||
static inline void set_white() { set_color(LEDColorWhite()); }
|
||||
static void set_off() { set_color(LEDColorOff()); }
|
||||
static void set_green() { set_color(LEDColorGreen()); }
|
||||
static void set_white() { set_color(LEDColorWhite()); }
|
||||
|
||||
#if ENABLED(NEO2_COLOR_PRESETS)
|
||||
static const LEDColor defaultLEDColor;
|
||||
static inline void set_default() { set_color(defaultLEDColor); }
|
||||
static inline void set_red() { set_color(LEDColorRed()); }
|
||||
static inline void set_orange() { set_color(LEDColorOrange()); }
|
||||
static inline void set_yellow() { set_color(LEDColorYellow()); }
|
||||
static inline void set_blue() { set_color(LEDColorBlue()); }
|
||||
static inline void set_indigo() { set_color(LEDColorIndigo()); }
|
||||
static inline void set_violet() { set_color(LEDColorViolet()); }
|
||||
static void set_default() { set_color(defaultLEDColor); }
|
||||
static void set_red() { set_color(LEDColorRed()); }
|
||||
static void set_orange() { set_color(LEDColorOrange()); }
|
||||
static void set_yellow() { set_color(LEDColorYellow()); }
|
||||
static void set_blue() { set_color(LEDColorBlue()); }
|
||||
static void set_indigo() { set_color(LEDColorIndigo()); }
|
||||
static void set_violet() { set_color(LEDColorViolet()); }
|
||||
#endif
|
||||
|
||||
#if ENABLED(NEOPIXEL2_SEPARATE)
|
||||
static LEDColor color; // last non-off color
|
||||
static bool lights_on; // the last set color was "on"
|
||||
static void toggle(); // swap "off" with color
|
||||
static inline void update() { set_color(color); }
|
||||
static void update() { set_color(color); }
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -94,12 +94,12 @@ public:
|
||||
static void reset_background_color();
|
||||
#endif
|
||||
|
||||
static inline void begin() {
|
||||
static void begin() {
|
||||
adaneo1.begin();
|
||||
TERN_(CONJOINED_NEOPIXEL, adaneo2.begin());
|
||||
}
|
||||
|
||||
static inline void set_pixel_color(const uint16_t n, const uint32_t c) {
|
||||
static void set_pixel_color(const uint16_t n, const uint32_t c) {
|
||||
#if ENABLED(NEOPIXEL2_INSERIES)
|
||||
if (n >= NEOPIXEL_PIXELS) adaneo2.setPixelColor(n - (NEOPIXEL_PIXELS), c);
|
||||
else adaneo1.setPixelColor(n, c);
|
||||
@ -109,12 +109,12 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void set_brightness(const uint8_t b) {
|
||||
static void set_brightness(const uint8_t b) {
|
||||
adaneo1.setBrightness(b);
|
||||
TERN_(CONJOINED_NEOPIXEL, adaneo2.setBrightness(b));
|
||||
}
|
||||
|
||||
static inline void show() {
|
||||
static void show() {
|
||||
// Some platforms cannot maintain PWM output when NeoPixel disables interrupts for long durations.
|
||||
TERN_(HAS_PAUSE_SERVO_OUTPUT, PAUSE_SERVO_OUTPUT());
|
||||
adaneo1.show();
|
||||
@ -130,11 +130,11 @@ public:
|
||||
}
|
||||
|
||||
// Accessors
|
||||
static inline uint16_t pixels() { return adaneo1.numPixels() * TERN1(NEOPIXEL2_INSERIES, 2); }
|
||||
static uint16_t pixels() { return adaneo1.numPixels() * TERN1(NEOPIXEL2_INSERIES, 2); }
|
||||
|
||||
static inline uint8_t brightness() { return adaneo1.getBrightness(); }
|
||||
static uint8_t brightness() { return adaneo1.getBrightness(); }
|
||||
|
||||
static inline uint32_t Color(uint8_t r, uint8_t g, uint8_t b OPTARG(HAS_WHITE_LED, uint8_t w)) {
|
||||
static uint32_t Color(uint8_t r, uint8_t g, uint8_t b OPTARG(HAS_WHITE_LED, uint8_t w)) {
|
||||
return adaneo1.Color(r, g, b OPTARG(HAS_WHITE_LED, w));
|
||||
}
|
||||
};
|
||||
@ -165,18 +165,18 @@ extern Marlin_NeoPixel neo;
|
||||
|
||||
static void set_color(const uint32_t c);
|
||||
|
||||
static inline void begin() { adaneo.begin(); }
|
||||
static inline void set_pixel_color(const uint16_t n, const uint32_t c) { adaneo.setPixelColor(n, c); }
|
||||
static inline void set_brightness(const uint8_t b) { adaneo.setBrightness(b); }
|
||||
static inline void show() {
|
||||
static void begin() { adaneo.begin(); }
|
||||
static void set_pixel_color(const uint16_t n, const uint32_t c) { adaneo.setPixelColor(n, c); }
|
||||
static void set_brightness(const uint8_t b) { adaneo.setBrightness(b); }
|
||||
static void show() {
|
||||
adaneo.show();
|
||||
adaneo.setPin(NEOPIXEL2_PIN);
|
||||
}
|
||||
|
||||
// Accessors
|
||||
static inline uint16_t pixels() { return adaneo.numPixels();}
|
||||
static inline uint8_t brightness() { return adaneo.getBrightness(); }
|
||||
static inline uint32_t Color(uint8_t r, uint8_t g, uint8_t b OPTARG(HAS_WHITE_LED2, uint8_t w)) {
|
||||
static uint16_t pixels() { return adaneo.numPixels();}
|
||||
static uint8_t brightness() { return adaneo.getBrightness(); }
|
||||
static uint32_t Color(uint8_t r, uint8_t g, uint8_t b OPTARG(HAS_WHITE_LED2, uint8_t w)) {
|
||||
return adaneo.Color(r, g, b OPTARG(HAS_WHITE_LED2, w));
|
||||
}
|
||||
};
|
||||
|
@ -36,32 +36,32 @@ private:
|
||||
static bool leds_off_after_print;
|
||||
#endif
|
||||
|
||||
static inline void set_done() { TERN(LED_COLOR_PRESETS, leds.set_default(), leds.set_off()); }
|
||||
static void set_done() { TERN(LED_COLOR_PRESETS, leds.set_default(), leds.set_off()); }
|
||||
|
||||
public:
|
||||
#if HAS_TEMP_HOTEND
|
||||
static inline LEDColor onHotendHeatingStart() { old_intensity = 0; return leds.get_color(); }
|
||||
static LEDColor onHotendHeatingStart() { old_intensity = 0; return leds.get_color(); }
|
||||
static void onHotendHeating(const celsius_t start, const celsius_t current, const celsius_t target);
|
||||
#endif
|
||||
|
||||
#if HAS_HEATED_BED
|
||||
static inline LEDColor onBedHeatingStart() { old_intensity = 127; return leds.get_color(); }
|
||||
static LEDColor onBedHeatingStart() { old_intensity = 127; return leds.get_color(); }
|
||||
static void onBedHeating(const celsius_t start, const celsius_t current, const celsius_t target);
|
||||
#endif
|
||||
|
||||
#if HAS_HEATED_CHAMBER
|
||||
static inline LEDColor onChamberHeatingStart() { old_intensity = 127; return leds.get_color(); }
|
||||
static LEDColor onChamberHeatingStart() { old_intensity = 127; return leds.get_color(); }
|
||||
static void onChamberHeating(const celsius_t start, const celsius_t current, const celsius_t target);
|
||||
#endif
|
||||
|
||||
#if HAS_TEMP_HOTEND || HAS_HEATED_BED || HAS_HEATED_CHAMBER
|
||||
static inline void onHeatingDone() { leds.set_white(); }
|
||||
static inline void onPidTuningDone(LEDColor c) { leds.set_color(c); }
|
||||
static void onHeatingDone() { leds.set_white(); }
|
||||
static void onPidTuningDone(LEDColor c) { leds.set_color(c); }
|
||||
#endif
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
|
||||
static inline void onPrintCompleted() {
|
||||
static void onPrintCompleted() {
|
||||
leds.set_green();
|
||||
#if HAS_LEDS_OFF_FLAG
|
||||
leds_off_after_print = true;
|
||||
@ -71,7 +71,7 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void onResumeAfterWait() {
|
||||
static void onResumeAfterWait() {
|
||||
#if HAS_LEDS_OFF_FLAG
|
||||
if (leds_off_after_print) {
|
||||
set_done();
|
||||
|
@ -88,13 +88,13 @@ public:
|
||||
static void send(const uint8_t reg, const uint8_t data);
|
||||
|
||||
// Refresh all units
|
||||
static inline void refresh() { for (uint8_t i = 0; i < 8; i++) refresh_line(i); }
|
||||
static void refresh() { for (uint8_t i = 0; i < 8; i++) refresh_line(i); }
|
||||
|
||||
// Suspend / resume updates to the LED unit
|
||||
// Use these methods to speed up multiple changes
|
||||
// or to apply updates from interrupt context.
|
||||
static inline void suspend() { suspended++; }
|
||||
static inline void resume() { suspended--; suspended |= 0x80; }
|
||||
static void suspend() { suspended++; }
|
||||
static void resume() { suspended--; suspended |= 0x80; }
|
||||
|
||||
// Update a single native line on all units
|
||||
static void refresh_line(const uint8_t line);
|
||||
|
@ -126,7 +126,7 @@ class Mixer {
|
||||
|
||||
static mixer_perc_t mix[MIXING_STEPPERS]; // Scratch array for the Mix in proportion to 100
|
||||
|
||||
static inline void copy_mix_to_color(mixer_comp_t (&tcolor)[MIXING_STEPPERS]) {
|
||||
static void copy_mix_to_color(mixer_comp_t (&tcolor)[MIXING_STEPPERS]) {
|
||||
// Scale each component to the largest one in terms of COLOR_A_MASK
|
||||
// So the largest component will be COLOR_A_MASK and the other will be in proportion to it
|
||||
const float scale = (COLOR_A_MASK) * RECIPROCAL(_MAX(
|
||||
@ -145,7 +145,7 @@ class Mixer {
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void update_mix_from_vtool(const uint8_t j=selected_vtool) {
|
||||
static void update_mix_from_vtool(const uint8_t j=selected_vtool) {
|
||||
float ctot = 0;
|
||||
MIXER_STEPPER_LOOP(i) ctot += color[j][i];
|
||||
//MIXER_STEPPER_LOOP(i) mix[i] = 100.0f * color[j][i] / ctot;
|
||||
@ -165,7 +165,7 @@ class Mixer {
|
||||
#if HAS_DUAL_MIXING
|
||||
|
||||
// Update the virtual tool from an edited mix
|
||||
static inline void update_vtool_from_mix() {
|
||||
static void update_vtool_from_mix() {
|
||||
copy_mix_to_color(color[selected_vtool]);
|
||||
TERN_(GRADIENT_MIX, refresh_gradient());
|
||||
// MIXER_STEPPER_LOOP(i) collector[i] = mix[i];
|
||||
@ -182,7 +182,7 @@ class Mixer {
|
||||
// Update the current mix from the gradient for a given Z
|
||||
static void update_gradient_for_z(const_float_t z);
|
||||
static void update_gradient_for_planner_z();
|
||||
static inline void gradient_control(const_float_t z) {
|
||||
static void gradient_control(const_float_t z) {
|
||||
if (gradient.enabled) {
|
||||
if (z >= gradient.end_z)
|
||||
T(gradient.end_vtool);
|
||||
@ -191,7 +191,7 @@ class Mixer {
|
||||
}
|
||||
}
|
||||
|
||||
static inline void update_mix_from_gradient() {
|
||||
static void update_mix_from_gradient() {
|
||||
float ctot = 0;
|
||||
MIXER_STEPPER_LOOP(i) ctot += gradient.color[i];
|
||||
MIXER_STEPPER_LOOP(i) mix[i] = (mixer_perc_t)CEIL(100.0f * gradient.color[i] / ctot);
|
||||
|
@ -43,7 +43,7 @@ public:
|
||||
|
||||
static void init();
|
||||
static void reset();
|
||||
static inline bool enabled() { return _enabled; }
|
||||
static bool enabled() { return _enabled; }
|
||||
static void mmu_loop();
|
||||
static void tool_change(const uint8_t index);
|
||||
static void tool_change(const char *special);
|
||||
@ -57,10 +57,10 @@ public:
|
||||
static bool eject_filament(const uint8_t index, const bool recover);
|
||||
|
||||
private:
|
||||
static inline bool rx_str(FSTR_P fstr);
|
||||
static inline void tx_str(FSTR_P fstr);
|
||||
static inline void tx_printf(FSTR_P ffmt, const int argument);
|
||||
static inline void tx_printf(FSTR_P ffmt, const int argument1, const int argument2);
|
||||
static bool rx_str(FSTR_P fstr);
|
||||
static void tx_str(FSTR_P fstr);
|
||||
static void tx_printf(FSTR_P ffmt, const int argument);
|
||||
static void tx_printf(FSTR_P ffmt, const int argument1, const int argument2);
|
||||
static void clear_rx_buffer();
|
||||
|
||||
static bool rx_ok();
|
||||
@ -99,7 +99,7 @@ private:
|
||||
static millis_t prev_request, prev_P0_request;
|
||||
static char rx_buffer[MMU_RX_SIZE], tx_buffer[MMU_TX_SIZE];
|
||||
|
||||
static inline void set_runout_valid(const bool valid) {
|
||||
static void set_runout_valid(const bool valid) {
|
||||
finda_runout_valid = valid;
|
||||
#if HAS_FILAMENT_SENSOR
|
||||
if (valid) runout.reset();
|
||||
|
@ -40,7 +40,7 @@ class Power {
|
||||
#if ENABLED(AUTO_POWER_CONTROL) && POWER_OFF_DELAY > 0
|
||||
static void power_off_soon();
|
||||
#else
|
||||
static inline void power_off_soon() { power_off(); }
|
||||
static void power_off_soon() { power_off(); }
|
||||
#endif
|
||||
|
||||
#if ENABLED(AUTO_POWER_CONTROL)
|
||||
|
@ -152,7 +152,7 @@ class PrintJobRecovery {
|
||||
static void init();
|
||||
static void prepare();
|
||||
|
||||
static inline void setup() {
|
||||
static void setup() {
|
||||
#if PIN_EXISTS(POWER_LOSS)
|
||||
#if ENABLED(POWER_LOSS_PULLUP)
|
||||
SET_INPUT_PULLUP(POWER_LOSS_PIN);
|
||||
@ -165,28 +165,28 @@ class PrintJobRecovery {
|
||||
}
|
||||
|
||||
// Track each command's file offsets
|
||||
static inline uint32_t command_sdpos() { return sdpos[queue_index_r]; }
|
||||
static inline void commit_sdpos(const uint8_t index_w) { sdpos[index_w] = cmd_sdpos; }
|
||||
static uint32_t command_sdpos() { return sdpos[queue_index_r]; }
|
||||
static void commit_sdpos(const uint8_t index_w) { sdpos[index_w] = cmd_sdpos; }
|
||||
|
||||
static bool enabled;
|
||||
static void enable(const bool onoff);
|
||||
static void changed();
|
||||
|
||||
static inline bool exists() { return card.jobRecoverFileExists(); }
|
||||
static inline void open(const bool read) { card.openJobRecoveryFile(read); }
|
||||
static inline void close() { file.close(); }
|
||||
static bool exists() { return card.jobRecoverFileExists(); }
|
||||
static void open(const bool read) { card.openJobRecoveryFile(read); }
|
||||
static void close() { file.close(); }
|
||||
|
||||
static void check();
|
||||
static void resume();
|
||||
static void purge();
|
||||
|
||||
static inline void cancel() { purge(); IF_DISABLED(NO_SD_AUTOSTART, card.autofile_begin()); }
|
||||
static void cancel() { purge(); IF_DISABLED(NO_SD_AUTOSTART, card.autofile_begin()); }
|
||||
|
||||
static void load();
|
||||
static void save(const bool force=ENABLED(SAVE_EACH_CMD_MODE), const float zraise=POWER_LOSS_ZRAISE, const bool raised=false);
|
||||
|
||||
#if PIN_EXISTS(POWER_LOSS)
|
||||
static inline void outage() {
|
||||
static void outage() {
|
||||
static constexpr uint8_t OUTAGE_THRESHOLD = 3;
|
||||
static uint8_t outage_counter = 0;
|
||||
if (enabled && READ(POWER_LOSS_PIN) == POWER_LOSS_STATE) {
|
||||
@ -199,14 +199,14 @@ class PrintJobRecovery {
|
||||
#endif
|
||||
|
||||
// The referenced file exists
|
||||
static inline bool interrupted_file_exists() { return card.fileExists(info.sd_filename); }
|
||||
static bool interrupted_file_exists() { return card.fileExists(info.sd_filename); }
|
||||
|
||||
static inline bool valid() { return info.valid() && interrupted_file_exists(); }
|
||||
static bool valid() { return info.valid() && interrupted_file_exists(); }
|
||||
|
||||
#if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
|
||||
static void debug(FSTR_P const prefix);
|
||||
#else
|
||||
static inline void debug(FSTR_P const) {}
|
||||
static void debug(FSTR_P const) {}
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
@ -74,11 +74,11 @@ class ProbeTempComp {
|
||||
static int16_t z_offsets_hotend[PTC_HOTEND_COUNT]; // (µm)
|
||||
#endif
|
||||
|
||||
static inline void reset_index() { calib_idx = 0; };
|
||||
static inline uint8_t get_index() { return calib_idx; }
|
||||
static void reset_index() { calib_idx = 0; };
|
||||
static uint8_t get_index() { return calib_idx; }
|
||||
static void reset();
|
||||
static void clear_offsets(const TempSensorID tsi);
|
||||
static inline void clear_all_offsets() {
|
||||
static void clear_all_offsets() {
|
||||
TERN_(PTC_PROBE, clear_offsets(TSI_PROBE));
|
||||
TERN_(PTC_BED, clear_offsets(TSI_BED));
|
||||
TERN_(PTC_HOTEND, clear_offsets(TSI_EXT));
|
||||
|
@ -38,8 +38,8 @@ private:
|
||||
static repeat_marker_t marker[MAX_REPEAT_NESTING];
|
||||
static uint8_t index;
|
||||
public:
|
||||
static inline void reset() { index = 0; }
|
||||
static inline bool is_active() {
|
||||
static void reset() { index = 0; }
|
||||
static bool is_active() {
|
||||
LOOP_L_N(i, index) if (marker[i].counter) return true;
|
||||
return false;
|
||||
}
|
||||
|
@ -83,30 +83,30 @@ class TFilamentMonitor : public FilamentMonitorBase {
|
||||
static sensor_t sensor;
|
||||
|
||||
public:
|
||||
static inline void setup() {
|
||||
static void setup() {
|
||||
sensor.setup();
|
||||
reset();
|
||||
}
|
||||
|
||||
static inline void reset() {
|
||||
static void reset() {
|
||||
filament_ran_out = false;
|
||||
response.reset();
|
||||
}
|
||||
|
||||
// Call this method when filament is present,
|
||||
// so the response can reset its counter.
|
||||
static inline void filament_present(const uint8_t extruder) {
|
||||
static void filament_present(const uint8_t extruder) {
|
||||
response.filament_present(extruder);
|
||||
}
|
||||
|
||||
#if HAS_FILAMENT_RUNOUT_DISTANCE
|
||||
static inline float& runout_distance() { return response.runout_distance_mm; }
|
||||
static inline void set_runout_distance(const_float_t mm) { response.runout_distance_mm = mm; }
|
||||
static float& runout_distance() { return response.runout_distance_mm; }
|
||||
static void set_runout_distance(const_float_t mm) { response.runout_distance_mm = mm; }
|
||||
#endif
|
||||
|
||||
// Handle a block completion. RunoutResponseDelayed uses this to
|
||||
// add up the length of filament moved while the filament is out.
|
||||
static inline void block_completed(const block_t * const b) {
|
||||
static void block_completed(const block_t * const b) {
|
||||
if (enabled) {
|
||||
response.block_completed(b);
|
||||
sensor.block_completed(b);
|
||||
@ -114,7 +114,7 @@ class TFilamentMonitor : public FilamentMonitorBase {
|
||||
}
|
||||
|
||||
// Give the response a chance to update its counter.
|
||||
static inline void run() {
|
||||
static void run() {
|
||||
if (enabled && !filament_ran_out && (printingIsActive() || did_pause_print)) {
|
||||
TERN_(HAS_FILAMENT_RUNOUT_DISTANCE, cli()); // Prevent RunoutResponseDelayed::block_completed from accumulating here
|
||||
response.run();
|
||||
@ -168,12 +168,12 @@ class FilamentSensorBase {
|
||||
* Called by FilamentSensorSwitch::run when filament is detected.
|
||||
* Called by FilamentSensorEncoder::block_completed when motion is detected.
|
||||
*/
|
||||
static inline void filament_present(const uint8_t extruder) {
|
||||
static void filament_present(const uint8_t extruder) {
|
||||
runout.filament_present(extruder); // ...which calls response.filament_present(extruder)
|
||||
}
|
||||
|
||||
public:
|
||||
static inline void setup() {
|
||||
static void setup() {
|
||||
#define _INIT_RUNOUT_PIN(P,S,U,D) do{ if (ENABLED(U)) SET_INPUT_PULLUP(P); else if (ENABLED(D)) SET_INPUT_PULLDOWN(P); else SET_INPUT(P); }while(0)
|
||||
#define INIT_RUNOUT_PIN(N) _INIT_RUNOUT_PIN(FIL_RUNOUT##N##_PIN, FIL_RUNOUT##N##_STATE, FIL_RUNOUT##N##_PULLUP, FIL_RUNOUT##N##_PULLDOWN)
|
||||
#if NUM_RUNOUT_SENSORS >= 1
|
||||
@ -205,14 +205,14 @@ class FilamentSensorBase {
|
||||
}
|
||||
|
||||
// Return a bitmask of runout pin states
|
||||
static inline uint8_t poll_runout_pins() {
|
||||
static uint8_t poll_runout_pins() {
|
||||
#define _OR_RUNOUT(N) | (READ(FIL_RUNOUT##N##_PIN) ? _BV((N) - 1) : 0)
|
||||
return (0 REPEAT_1(NUM_RUNOUT_SENSORS, _OR_RUNOUT));
|
||||
#undef _OR_RUNOUT
|
||||
}
|
||||
|
||||
// Return a bitmask of runout flag states (1 bits always indicates runout)
|
||||
static inline uint8_t poll_runout_states() {
|
||||
static uint8_t poll_runout_states() {
|
||||
return poll_runout_pins() ^ uint8_t(0
|
||||
#if NUM_RUNOUT_SENSORS >= 1
|
||||
| (FIL_RUNOUT1_STATE ? 0 : _BV(1 - 1))
|
||||
@ -254,7 +254,7 @@ class FilamentSensorBase {
|
||||
private:
|
||||
static uint8_t motion_detected;
|
||||
|
||||
static inline void poll_motion_sensor() {
|
||||
static void poll_motion_sensor() {
|
||||
static uint8_t old_state;
|
||||
const uint8_t new_state = poll_runout_pins(),
|
||||
change = old_state ^ new_state;
|
||||
@ -273,7 +273,7 @@ class FilamentSensorBase {
|
||||
}
|
||||
|
||||
public:
|
||||
static inline void block_completed(const block_t * const b) {
|
||||
static void block_completed(const block_t * const b) {
|
||||
// If the sensor wheel has moved since the last call to
|
||||
// this method reset the runout counter for the extruder.
|
||||
if (TEST(motion_detected, b->extruder))
|
||||
@ -283,7 +283,7 @@ class FilamentSensorBase {
|
||||
motion_detected = 0;
|
||||
}
|
||||
|
||||
static inline void run() { poll_motion_sensor(); }
|
||||
static void run() { poll_motion_sensor(); }
|
||||
};
|
||||
|
||||
#else
|
||||
@ -294,7 +294,7 @@ class FilamentSensorBase {
|
||||
*/
|
||||
class FilamentSensorSwitch : public FilamentSensorBase {
|
||||
private:
|
||||
static inline bool poll_runout_state(const uint8_t extruder) {
|
||||
static bool poll_runout_state(const uint8_t extruder) {
|
||||
const uint8_t runout_states = poll_runout_states();
|
||||
#if MULTI_FILAMENT_SENSOR
|
||||
if ( !TERN0(DUAL_X_CARRIAGE, idex_is_duplicating())
|
||||
@ -307,9 +307,9 @@ class FilamentSensorBase {
|
||||
}
|
||||
|
||||
public:
|
||||
static inline void block_completed(const block_t * const) {}
|
||||
static void block_completed(const block_t * const) {}
|
||||
|
||||
static inline void run() {
|
||||
static void run() {
|
||||
LOOP_L_N(s, NUM_RUNOUT_SENSORS) {
|
||||
const bool out = poll_runout_state(s);
|
||||
if (!out) filament_present(s);
|
||||
@ -341,11 +341,11 @@ class FilamentSensorBase {
|
||||
public:
|
||||
static float runout_distance_mm;
|
||||
|
||||
static inline void reset() {
|
||||
static void reset() {
|
||||
LOOP_L_N(i, NUM_RUNOUT_SENSORS) filament_present(i);
|
||||
}
|
||||
|
||||
static inline void run() {
|
||||
static void run() {
|
||||
#if ENABLED(FILAMENT_RUNOUT_SENSOR_DEBUG)
|
||||
static millis_t t = 0;
|
||||
const millis_t ms = millis();
|
||||
@ -358,17 +358,17 @@ class FilamentSensorBase {
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline uint8_t has_run_out() {
|
||||
static uint8_t has_run_out() {
|
||||
uint8_t runout_flags = 0;
|
||||
LOOP_L_N(i, NUM_RUNOUT_SENSORS) if (runout_mm_countdown[i] < 0) SBI(runout_flags, i);
|
||||
return runout_flags;
|
||||
}
|
||||
|
||||
static inline void filament_present(const uint8_t extruder) {
|
||||
static void filament_present(const uint8_t extruder) {
|
||||
runout_mm_countdown[extruder] = runout_distance_mm;
|
||||
}
|
||||
|
||||
static inline void block_completed(const block_t * const b) {
|
||||
static void block_completed(const block_t * const b) {
|
||||
if (b->steps.x || b->steps.y || b->steps.z || did_pause_print) { // Allow pause purge move to re-trigger runout state
|
||||
// Only trigger on extrusion with XYZ movement to allow filament change and retract/recover.
|
||||
const uint8_t e = b->extruder;
|
||||
@ -389,23 +389,23 @@ class FilamentSensorBase {
|
||||
static int8_t runout_count[NUM_RUNOUT_SENSORS];
|
||||
|
||||
public:
|
||||
static inline void reset() {
|
||||
static void reset() {
|
||||
LOOP_L_N(i, NUM_RUNOUT_SENSORS) filament_present(i);
|
||||
}
|
||||
|
||||
static inline void run() {
|
||||
static void run() {
|
||||
LOOP_L_N(i, NUM_RUNOUT_SENSORS) if (runout_count[i] >= 0) runout_count[i]--;
|
||||
}
|
||||
|
||||
static inline uint8_t has_run_out() {
|
||||
static uint8_t has_run_out() {
|
||||
uint8_t runout_flags = 0;
|
||||
LOOP_L_N(i, NUM_RUNOUT_SENSORS) if (runout_count[i] < 0) SBI(runout_flags, i);
|
||||
return runout_flags;
|
||||
}
|
||||
|
||||
static inline void block_completed(const block_t * const) { }
|
||||
static void block_completed(const block_t * const) { }
|
||||
|
||||
static inline void filament_present(const uint8_t extruder) {
|
||||
static void filament_present(const uint8_t extruder) {
|
||||
runout_count[extruder] = runout_threshold;
|
||||
}
|
||||
};
|
||||
|
@ -103,12 +103,12 @@ public:
|
||||
static void init();
|
||||
|
||||
#if ENABLED(MARLIN_DEV_MODE)
|
||||
static inline void refresh_frequency() { set_pwm_frequency(pin_t(SPINDLE_LASER_PWM_PIN), frequency); }
|
||||
static void refresh_frequency() { set_pwm_frequency(pin_t(SPINDLE_LASER_PWM_PIN), frequency); }
|
||||
#endif
|
||||
|
||||
// Modifying this function should update everywhere
|
||||
static inline bool enabled(const cutter_power_t opwr) { return opwr > 0; }
|
||||
static inline bool enabled() { return enabled(power); }
|
||||
static bool enabled(const cutter_power_t opwr) { return opwr > 0; }
|
||||
static bool enabled() { return enabled(power); }
|
||||
|
||||
static void apply_power(const uint8_t inpow);
|
||||
|
||||
@ -124,13 +124,13 @@ public:
|
||||
public:
|
||||
|
||||
static void set_ocr(const uint8_t ocr);
|
||||
static inline void ocr_set_power(const uint8_t ocr) { power = ocr; set_ocr(ocr); }
|
||||
static void ocr_set_power(const uint8_t ocr) { power = ocr; set_ocr(ocr); }
|
||||
static void ocr_off();
|
||||
|
||||
/**
|
||||
* Update output for power->OCR translation
|
||||
*/
|
||||
static inline uint8_t upower_to_ocr(const cutter_power_t upwr) {
|
||||
static uint8_t upower_to_ocr(const cutter_power_t upwr) {
|
||||
return uint8_t(
|
||||
#if CUTTER_UNIT_IS(PWM255)
|
||||
upwr
|
||||
@ -145,11 +145,11 @@ public:
|
||||
/**
|
||||
* Correct power to configured range
|
||||
*/
|
||||
static inline cutter_power_t power_to_range(const cutter_power_t pwr) {
|
||||
static cutter_power_t power_to_range(const cutter_power_t pwr) {
|
||||
return power_to_range(pwr, _CUTTER_POWER(CUTTER_POWER_UNIT));
|
||||
}
|
||||
|
||||
static inline cutter_power_t power_to_range(const cutter_power_t pwr, const uint8_t pwrUnit) {
|
||||
static cutter_power_t power_to_range(const cutter_power_t pwr, const uint8_t pwrUnit) {
|
||||
static constexpr float
|
||||
min_pct = TERN(CUTTER_POWER_RELATIVE, 0, TERN(SPINDLE_FEATURE, round(100.0f * (SPEED_POWER_MIN) / (SPEED_POWER_MAX)), SPEED_POWER_MIN)),
|
||||
max_pct = TERN(SPINDLE_FEATURE, 100, SPEED_POWER_MAX);
|
||||
@ -188,7 +188,7 @@ public:
|
||||
* Enable/Disable spindle/laser
|
||||
* @param enable true = enable; false = disable
|
||||
*/
|
||||
static inline void set_enabled(const bool enable) {
|
||||
static void set_enabled(const bool enable) {
|
||||
uint8_t value = 0;
|
||||
if (enable) {
|
||||
#if ENABLED(SPINDLE_LASER_USE_PWM)
|
||||
@ -203,14 +203,14 @@ public:
|
||||
set_power(value);
|
||||
}
|
||||
|
||||
static inline void disable() { isReady = false; set_enabled(false); }
|
||||
static void disable() { isReady = false; set_enabled(false); }
|
||||
|
||||
/**
|
||||
* Wait for spindle to spin up or spin down
|
||||
*
|
||||
* @param on true = state to on; false = state to off.
|
||||
*/
|
||||
static inline void power_delay(const bool on) {
|
||||
static void power_delay(const bool on) {
|
||||
#if DISABLED(LASER_POWER_INLINE)
|
||||
safe_delay(on ? SPINDLE_LASER_POWERUP_DELAY : SPINDLE_LASER_POWERDOWN_DELAY);
|
||||
#endif
|
||||
@ -220,7 +220,7 @@ public:
|
||||
static void set_reverse(const bool reverse);
|
||||
static bool is_reverse() { return READ(SPINDLE_DIR_PIN) == SPINDLE_INVERT_DIR; }
|
||||
#else
|
||||
static inline void set_reverse(const bool) {}
|
||||
static void set_reverse(const bool) {}
|
||||
static bool is_reverse() { return false; }
|
||||
#endif
|
||||
|
||||
@ -228,7 +228,7 @@ public:
|
||||
static void air_evac_enable(); // Turn On Cutter Vacuum or Laser Blower motor
|
||||
static void air_evac_disable(); // Turn Off Cutter Vacuum or Laser Blower motor
|
||||
static void air_evac_toggle(); // Toggle Cutter Vacuum or Laser Blower motor
|
||||
static inline bool air_evac_state() { // Get current state
|
||||
static bool air_evac_state() { // Get current state
|
||||
return (READ(AIR_EVACUATION_PIN) == AIR_EVACUATION_ACTIVE);
|
||||
}
|
||||
#endif
|
||||
@ -237,13 +237,13 @@ public:
|
||||
static void air_assist_enable(); // Turn on air assist
|
||||
static void air_assist_disable(); // Turn off air assist
|
||||
static void air_assist_toggle(); // Toggle air assist
|
||||
static inline bool air_assist_state() { // Get current state
|
||||
static bool air_assist_state() { // Get current state
|
||||
return (READ(AIR_ASSIST_PIN) == AIR_ASSIST_ACTIVE);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
static inline void enable_with_dir(const bool reverse) {
|
||||
static void enable_with_dir(const bool reverse) {
|
||||
isReady = true;
|
||||
const uint8_t ocr = TERN(SPINDLE_LASER_USE_PWM, upower_to_ocr(menuPower), 255);
|
||||
if (menuPower)
|
||||
@ -259,7 +259,7 @@ public:
|
||||
FORCE_INLINE static void enable_same_dir() { enable_with_dir(is_reverse()); }
|
||||
|
||||
#if ENABLED(SPINDLE_LASER_USE_PWM)
|
||||
static inline void update_from_mpower() {
|
||||
static void update_from_mpower() {
|
||||
if (isReady) power = upower_to_ocr(menuPower);
|
||||
unitPower = menuPower;
|
||||
}
|
||||
@ -271,7 +271,7 @@ public:
|
||||
* Also fires with any PWM power that was previous set
|
||||
* If not set defaults to 80% power
|
||||
*/
|
||||
static inline void test_fire_pulse() {
|
||||
static void test_fire_pulse() {
|
||||
TERN_(USE_BEEPER, buzzer.tone(30, 3000));
|
||||
enable_forward(); // Turn Laser on (Spindle speak but same funct)
|
||||
delay(testPulse); // Delay for time set by user in pulse ms menu screen.
|
||||
@ -288,7 +288,7 @@ public:
|
||||
*/
|
||||
|
||||
// Force disengage planner power control
|
||||
static inline void inline_disable() {
|
||||
static void inline_disable() {
|
||||
isReady = false;
|
||||
unitPower = 0;
|
||||
planner.laser_inline.status.isPlanned = false;
|
||||
@ -297,7 +297,7 @@ public:
|
||||
}
|
||||
|
||||
// Inline modes of all other functions; all enable planner inline power control
|
||||
static inline void set_inline_enabled(const bool enable) {
|
||||
static void set_inline_enabled(const bool enable) {
|
||||
if (enable)
|
||||
inline_power(255);
|
||||
else {
|
||||
@ -326,10 +326,10 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void inline_direction(const bool) { /* never */ }
|
||||
static void inline_direction(const bool) { /* never */ }
|
||||
|
||||
#if ENABLED(SPINDLE_LASER_USE_PWM)
|
||||
static inline void inline_ocr_power(const uint8_t ocrpwr) {
|
||||
static void inline_ocr_power(const uint8_t ocrpwr) {
|
||||
isReady = ocrpwr > 0;
|
||||
planner.laser_inline.status.isEnabled = ocrpwr > 0;
|
||||
planner.laser_inline.power = ocrpwr;
|
||||
@ -337,7 +337,7 @@ public:
|
||||
#endif
|
||||
#endif // LASER_POWER_INLINE
|
||||
|
||||
static inline void kill() {
|
||||
static void kill() {
|
||||
TERN_(LASER_POWER_INLINE, inline_disable());
|
||||
disable();
|
||||
}
|
||||
|
@ -244,11 +244,11 @@ class TWIBus {
|
||||
static void debug(FSTR_P const func, char c);
|
||||
static void debug(FSTR_P const func, char adr[]);
|
||||
#else
|
||||
static inline void debug(FSTR_P const, uint32_t) {}
|
||||
static inline void debug(FSTR_P const, char) {}
|
||||
static inline void debug(FSTR_P const, char[]) {}
|
||||
static void debug(FSTR_P const, uint32_t) {}
|
||||
static void debug(FSTR_P const, char) {}
|
||||
static void debug(FSTR_P const, char[]) {}
|
||||
#endif
|
||||
static inline void debug(FSTR_P const func, uint8_t v) { debug(func, (uint32_t)v); }
|
||||
static void debug(FSTR_P const func, uint8_t v) { debug(func, (uint32_t)v); }
|
||||
};
|
||||
|
||||
extern TWIBus i2c;
|
||||
|
@ -349,7 +349,7 @@ public:
|
||||
|
||||
static axis_bits_t axis_relative;
|
||||
|
||||
static inline bool axis_is_relative(const AxisEnum a) {
|
||||
static bool axis_is_relative(const AxisEnum a) {
|
||||
#if HAS_EXTRUDERS
|
||||
if (a == E_AXIS) {
|
||||
if (TEST(axis_relative, E_MODE_REL)) return true;
|
||||
@ -358,7 +358,7 @@ public:
|
||||
#endif
|
||||
return TEST(axis_relative, a);
|
||||
}
|
||||
static inline void set_relative_mode(const bool rel) {
|
||||
static void set_relative_mode(const bool rel) {
|
||||
axis_relative = rel ? (0 LOGICAL_AXIS_GANG(
|
||||
| _BV(REL_E),
|
||||
| _BV(REL_X), | _BV(REL_Y), | _BV(REL_Z),
|
||||
@ -366,11 +366,11 @@ public:
|
||||
)) : 0;
|
||||
}
|
||||
#if HAS_EXTRUDERS
|
||||
static inline void set_e_relative() {
|
||||
static void set_e_relative() {
|
||||
CBI(axis_relative, E_MODE_ABS);
|
||||
SBI(axis_relative, E_MODE_REL);
|
||||
}
|
||||
static inline void set_e_absolute() {
|
||||
static void set_e_absolute() {
|
||||
CBI(axis_relative, E_MODE_REL);
|
||||
SBI(axis_relative, E_MODE_ABS);
|
||||
}
|
||||
@ -403,7 +403,7 @@ public:
|
||||
|
||||
static void report_echo_start(const bool forReplay);
|
||||
static void report_heading(const bool forReplay, FSTR_P const fstr, const bool eol=true);
|
||||
static inline void report_heading_etc(const bool forReplay, FSTR_P const fstr, const bool eol=true) {
|
||||
static void report_heading_etc(const bool forReplay, FSTR_P const fstr, const bool eol=true) {
|
||||
report_heading(forReplay, fstr, eol);
|
||||
report_echo_start(forReplay);
|
||||
}
|
||||
@ -420,20 +420,20 @@ public:
|
||||
static void process_subcommands_now(FSTR_P fgcode);
|
||||
static void process_subcommands_now(char * gcode);
|
||||
|
||||
static inline void home_all_axes(const bool keep_leveling=false) {
|
||||
static void home_all_axes(const bool keep_leveling=false) {
|
||||
process_subcommands_now(keep_leveling ? FPSTR(G28_STR) : TERN(CAN_SET_LEVELING_AFTER_G28, F("G28L0"), FPSTR(G28_STR)));
|
||||
}
|
||||
|
||||
#if EITHER(HAS_AUTO_REPORTING, HOST_KEEPALIVE_FEATURE)
|
||||
static bool autoreport_paused;
|
||||
static inline bool set_autoreport_paused(const bool p) {
|
||||
static bool set_autoreport_paused(const bool p) {
|
||||
const bool was = autoreport_paused;
|
||||
autoreport_paused = p;
|
||||
return was;
|
||||
}
|
||||
#else
|
||||
static constexpr bool autoreport_paused = false;
|
||||
static inline bool set_autoreport_paused(const bool) { return false; }
|
||||
static bool set_autoreport_paused(const bool) { return false; }
|
||||
#endif
|
||||
|
||||
#if ENABLED(HOST_KEEPALIVE_FEATURE)
|
||||
@ -453,7 +453,7 @@ public:
|
||||
static uint8_t host_keepalive_interval;
|
||||
|
||||
static void host_keepalive();
|
||||
static inline bool host_keepalive_is_paused() { return busy_state >= PAUSED_FOR_USER; }
|
||||
static bool host_keepalive_is_paused() { return busy_state >= PAUSED_FOR_USER; }
|
||||
|
||||
#define KEEPALIVE_STATE(N) REMEMBER(_KA_, gcode.busy_state, gcode.N)
|
||||
#else
|
||||
|
@ -126,7 +126,7 @@ public:
|
||||
}
|
||||
|
||||
// Set the flag and pointer for a parameter
|
||||
static inline void set(const char c, char * const ptr) {
|
||||
static void set(const char c, char * const ptr) {
|
||||
const uint8_t ind = LETTER_BIT(c);
|
||||
if (ind >= COUNT(param)) return; // Only A-Z
|
||||
SBI32(codebits, ind); // parameter exists
|
||||
@ -142,7 +142,7 @@ public:
|
||||
|
||||
// Code seen bit was set. If not found, value_ptr is unchanged.
|
||||
// This allows "if (seen('A')||seen('B'))" to use the last-found value.
|
||||
static inline bool seen(const char c) {
|
||||
static bool seen(const char c) {
|
||||
const uint8_t ind = LETTER_BIT(c);
|
||||
if (ind >= COUNT(param)) return false; // Only A-Z
|
||||
const bool b = TEST32(codebits, ind);
|
||||
@ -183,7 +183,7 @@ public:
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline bool seen_any() { return !!codebits; }
|
||||
static bool seen_any() { return !!codebits; }
|
||||
|
||||
FORCE_INLINE static bool seen_test(const char c) { return TEST32(codebits, LETTER_BIT(c)); }
|
||||
|
||||
@ -204,19 +204,19 @@ public:
|
||||
|
||||
// Code is found in the string. If not found, value_ptr is unchanged.
|
||||
// This allows "if (seen('A')||seen('B'))" to use the last-found value.
|
||||
static inline bool seen(const char c) {
|
||||
static bool seen(const char c) {
|
||||
char *p = strgchr(command_args, c);
|
||||
const bool b = !!p;
|
||||
if (b) value_ptr = valid_number(&p[1]) ? &p[1] : nullptr;
|
||||
return b;
|
||||
}
|
||||
|
||||
static inline bool seen_any() { return *command_args == '\0'; }
|
||||
static bool seen_any() { return *command_args == '\0'; }
|
||||
|
||||
FORCE_INLINE static bool seen_test(const char c) { return (bool)strgchr(command_args, c); }
|
||||
|
||||
// At least one of a list of code letters was seen
|
||||
static inline bool seen(const char * const str) {
|
||||
static bool seen(const char * const str) {
|
||||
for (uint8_t i = 0; const char c = str[i]; i++)
|
||||
if (seen_test(c)) return true;
|
||||
return false;
|
||||
@ -225,7 +225,7 @@ public:
|
||||
#endif // !FASTER_GCODE_PARSER
|
||||
|
||||
// Seen any axis parameter
|
||||
static inline bool seen_axis() { return seen(LOGICAL_AXES_STRING); }
|
||||
static bool seen_axis() { return seen(LOGICAL_AXES_STRING); }
|
||||
|
||||
#if ENABLED(GCODE_QUOTED_STRINGS)
|
||||
static char* unescape_string(char* &src);
|
||||
@ -243,19 +243,19 @@ public:
|
||||
#endif
|
||||
|
||||
// Test whether the parsed command matches the input
|
||||
static inline bool is_command(const char ltr, const uint16_t num) { return command_letter == ltr && codenum == num; }
|
||||
static bool is_command(const char ltr, const uint16_t num) { return command_letter == ltr && codenum == num; }
|
||||
|
||||
// The code value pointer was set
|
||||
FORCE_INLINE static bool has_value() { return !!value_ptr; }
|
||||
|
||||
// Seen a parameter with a value
|
||||
static inline bool seenval(const char c) { return seen(c) && has_value(); }
|
||||
static bool seenval(const char c) { return seen(c) && has_value(); }
|
||||
|
||||
// The value as a string
|
||||
static inline char* value_string() { return value_ptr; }
|
||||
static char* value_string() { return value_ptr; }
|
||||
|
||||
// Float removes 'E' to prevent scientific notation interpretation
|
||||
static inline float value_float() {
|
||||
static float value_float() {
|
||||
if (value_ptr) {
|
||||
char *e = value_ptr;
|
||||
for (;;) {
|
||||
@ -275,31 +275,31 @@ public:
|
||||
}
|
||||
|
||||
// Code value as a long or ulong
|
||||
static inline int32_t value_long() { return value_ptr ? strtol(value_ptr, nullptr, 10) : 0L; }
|
||||
static inline uint32_t value_ulong() { return value_ptr ? strtoul(value_ptr, nullptr, 10) : 0UL; }
|
||||
static int32_t value_long() { return value_ptr ? strtol(value_ptr, nullptr, 10) : 0L; }
|
||||
static uint32_t value_ulong() { return value_ptr ? strtoul(value_ptr, nullptr, 10) : 0UL; }
|
||||
|
||||
// Code value for use as time
|
||||
static inline millis_t value_millis() { return value_ulong(); }
|
||||
static inline millis_t value_millis_from_seconds() { return (millis_t)SEC_TO_MS(value_float()); }
|
||||
static millis_t value_millis() { return value_ulong(); }
|
||||
static millis_t value_millis_from_seconds() { return (millis_t)SEC_TO_MS(value_float()); }
|
||||
|
||||
// Reduce to fewer bits
|
||||
static inline int16_t value_int() { return (int16_t)value_long(); }
|
||||
static inline uint16_t value_ushort() { return (uint16_t)value_long(); }
|
||||
static inline uint8_t value_byte() { return (uint8_t)constrain(value_long(), 0, 255); }
|
||||
static int16_t value_int() { return (int16_t)value_long(); }
|
||||
static uint16_t value_ushort() { return (uint16_t)value_long(); }
|
||||
static uint8_t value_byte() { return (uint8_t)constrain(value_long(), 0, 255); }
|
||||
|
||||
// Bool is true with no value or non-zero
|
||||
static inline bool value_bool() { return !has_value() || !!value_byte(); }
|
||||
static bool value_bool() { return !has_value() || !!value_byte(); }
|
||||
|
||||
// Units modes: Inches, Fahrenheit, Kelvin
|
||||
|
||||
#if ENABLED(INCH_MODE_SUPPORT)
|
||||
static inline float mm_to_linear_unit(const_float_t mm) { return mm / linear_unit_factor; }
|
||||
static inline float mm_to_volumetric_unit(const_float_t mm) { return mm / (volumetric_enabled ? volumetric_unit_factor : linear_unit_factor); }
|
||||
static float mm_to_linear_unit(const_float_t mm) { return mm / linear_unit_factor; }
|
||||
static float mm_to_volumetric_unit(const_float_t mm) { return mm / (volumetric_enabled ? volumetric_unit_factor : linear_unit_factor); }
|
||||
|
||||
// Init linear units by constructor
|
||||
GCodeParser() { set_input_linear_units(LINEARUNIT_MM); }
|
||||
|
||||
static inline void set_input_linear_units(const LinearUnit units) {
|
||||
static void set_input_linear_units(const LinearUnit units) {
|
||||
switch (units) {
|
||||
default:
|
||||
case LINEARUNIT_MM: linear_unit_factor = 1.0f; break;
|
||||
@ -308,7 +308,7 @@ public:
|
||||
volumetric_unit_factor = POW(linear_unit_factor, 3);
|
||||
}
|
||||
|
||||
static inline float axis_unit_factor(const AxisEnum axis) {
|
||||
static float axis_unit_factor(const AxisEnum axis) {
|
||||
return (
|
||||
#if HAS_EXTRUDERS
|
||||
axis >= E_AXIS && volumetric_enabled ? volumetric_unit_factor : linear_unit_factor
|
||||
@ -318,46 +318,46 @@ public:
|
||||
);
|
||||
}
|
||||
|
||||
static inline float linear_value_to_mm(const_float_t v) { return v * linear_unit_factor; }
|
||||
static inline float axis_value_to_mm(const AxisEnum axis, const float v) { return v * axis_unit_factor(axis); }
|
||||
static inline float per_axis_value(const AxisEnum axis, const float v) { return v / axis_unit_factor(axis); }
|
||||
static float linear_value_to_mm(const_float_t v) { return v * linear_unit_factor; }
|
||||
static float axis_value_to_mm(const AxisEnum axis, const float v) { return v * axis_unit_factor(axis); }
|
||||
static float per_axis_value(const AxisEnum axis, const float v) { return v / axis_unit_factor(axis); }
|
||||
|
||||
#else
|
||||
|
||||
static inline float mm_to_linear_unit(const_float_t mm) { return mm; }
|
||||
static inline float mm_to_volumetric_unit(const_float_t mm) { return mm; }
|
||||
static float mm_to_linear_unit(const_float_t mm) { return mm; }
|
||||
static float mm_to_volumetric_unit(const_float_t mm) { return mm; }
|
||||
|
||||
static inline float linear_value_to_mm(const_float_t v) { return v; }
|
||||
static inline float axis_value_to_mm(const AxisEnum, const float v) { return v; }
|
||||
static inline float per_axis_value(const AxisEnum, const float v) { return v; }
|
||||
static float linear_value_to_mm(const_float_t v) { return v; }
|
||||
static float axis_value_to_mm(const AxisEnum, const float v) { return v; }
|
||||
static float per_axis_value(const AxisEnum, const float v) { return v; }
|
||||
|
||||
#endif
|
||||
|
||||
static inline bool using_inch_units() { return mm_to_linear_unit(1.0f) != 1.0f; }
|
||||
static bool using_inch_units() { return mm_to_linear_unit(1.0f) != 1.0f; }
|
||||
|
||||
#define IN_TO_MM(I) ((I) * 25.4f)
|
||||
#define MM_TO_IN(M) ((M) / 25.4f)
|
||||
#define LINEAR_UNIT(V) parser.mm_to_linear_unit(V)
|
||||
#define VOLUMETRIC_UNIT(V) parser.mm_to_volumetric_unit(V)
|
||||
|
||||
static inline float value_linear_units() { return linear_value_to_mm(value_float()); }
|
||||
static inline float value_axis_units(const AxisEnum axis) { return axis_value_to_mm(axis, value_float()); }
|
||||
static inline float value_per_axis_units(const AxisEnum axis) { return per_axis_value(axis, value_float()); }
|
||||
static float value_linear_units() { return linear_value_to_mm(value_float()); }
|
||||
static float value_axis_units(const AxisEnum axis) { return axis_value_to_mm(axis, value_float()); }
|
||||
static float value_per_axis_units(const AxisEnum axis) { return per_axis_value(axis, value_float()); }
|
||||
|
||||
#if ENABLED(TEMPERATURE_UNITS_SUPPORT)
|
||||
|
||||
static inline void set_input_temp_units(const TempUnit units) { input_temp_units = units; }
|
||||
static void set_input_temp_units(const TempUnit units) { input_temp_units = units; }
|
||||
|
||||
static inline char temp_units_code() {
|
||||
static char temp_units_code() {
|
||||
return input_temp_units == TEMPUNIT_K ? 'K' : input_temp_units == TEMPUNIT_F ? 'F' : 'C';
|
||||
}
|
||||
static inline FSTR_P temp_units_name() {
|
||||
static FSTR_P temp_units_name() {
|
||||
return input_temp_units == TEMPUNIT_K ? F("Kelvin") : input_temp_units == TEMPUNIT_F ? F("Fahrenheit") : F("Celsius");
|
||||
}
|
||||
|
||||
#if HAS_LCD_MENU && DISABLED(DISABLE_M503)
|
||||
|
||||
static inline float to_temp_units(celsius_t c) {
|
||||
static float to_temp_units(celsius_t c) {
|
||||
switch (input_temp_units) {
|
||||
default:
|
||||
case TEMPUNIT_C: return c;
|
||||
@ -368,7 +368,7 @@ public:
|
||||
|
||||
#endif // HAS_LCD_MENU && !DISABLE_M503
|
||||
|
||||
static inline celsius_t value_celsius() {
|
||||
static celsius_t value_celsius() {
|
||||
float f = value_float();
|
||||
switch (input_temp_units) {
|
||||
default:
|
||||
@ -379,7 +379,7 @@ public:
|
||||
return LROUND(f);
|
||||
}
|
||||
|
||||
static inline celsius_t value_celsius_diff() {
|
||||
static celsius_t value_celsius_diff() {
|
||||
float f = value_float();
|
||||
switch (input_temp_units) {
|
||||
default:
|
||||
@ -392,35 +392,35 @@ public:
|
||||
|
||||
#else // !TEMPERATURE_UNITS_SUPPORT
|
||||
|
||||
static inline float to_temp_units(int16_t c) { return (float)c; }
|
||||
static float to_temp_units(int16_t c) { return (float)c; }
|
||||
|
||||
static inline celsius_t value_celsius() { return value_int(); }
|
||||
static inline celsius_t value_celsius_diff() { return value_int(); }
|
||||
static celsius_t value_celsius() { return value_int(); }
|
||||
static celsius_t value_celsius_diff() { return value_int(); }
|
||||
|
||||
#endif // !TEMPERATURE_UNITS_SUPPORT
|
||||
|
||||
static inline feedRate_t value_feedrate() { return MMM_TO_MMS(value_linear_units()); }
|
||||
static feedRate_t value_feedrate() { return MMM_TO_MMS(value_linear_units()); }
|
||||
|
||||
void unknown_command_warning();
|
||||
|
||||
// Provide simple value accessors with default option
|
||||
static inline char* stringval(const char c, char * const dval=nullptr) { return seenval(c) ? value_string() : dval; }
|
||||
static inline float floatval(const char c, const float dval=0.0) { return seenval(c) ? value_float() : dval; }
|
||||
static inline bool boolval(const char c, const bool dval=false) { return seenval(c) ? value_bool() : (seen(c) ? true : dval); }
|
||||
static inline uint8_t byteval(const char c, const uint8_t dval=0) { return seenval(c) ? value_byte() : dval; }
|
||||
static inline int16_t intval(const char c, const int16_t dval=0) { return seenval(c) ? value_int() : dval; }
|
||||
static inline uint16_t ushortval(const char c, const uint16_t dval=0) { return seenval(c) ? value_ushort() : dval; }
|
||||
static inline int32_t longval(const char c, const int32_t dval=0) { return seenval(c) ? value_long() : dval; }
|
||||
static inline uint32_t ulongval(const char c, const uint32_t dval=0) { return seenval(c) ? value_ulong() : dval; }
|
||||
static inline float linearval(const char c, const float dval=0) { return seenval(c) ? value_linear_units() : dval; }
|
||||
static inline float axisunitsval(const char c, const AxisEnum a, const float dval=0)
|
||||
static char* stringval(const char c, char * const dval=nullptr) { return seenval(c) ? value_string() : dval; }
|
||||
static float floatval(const char c, const float dval=0.0) { return seenval(c) ? value_float() : dval; }
|
||||
static bool boolval(const char c, const bool dval=false) { return seenval(c) ? value_bool() : (seen(c) ? true : dval); }
|
||||
static uint8_t byteval(const char c, const uint8_t dval=0) { return seenval(c) ? value_byte() : dval; }
|
||||
static int16_t intval(const char c, const int16_t dval=0) { return seenval(c) ? value_int() : dval; }
|
||||
static uint16_t ushortval(const char c, const uint16_t dval=0) { return seenval(c) ? value_ushort() : dval; }
|
||||
static int32_t longval(const char c, const int32_t dval=0) { return seenval(c) ? value_long() : dval; }
|
||||
static uint32_t ulongval(const char c, const uint32_t dval=0) { return seenval(c) ? value_ulong() : dval; }
|
||||
static float linearval(const char c, const float dval=0) { return seenval(c) ? value_linear_units() : dval; }
|
||||
static float axisunitsval(const char c, const AxisEnum a, const float dval=0)
|
||||
{ return seenval(c) ? value_axis_units(a) : dval; }
|
||||
static inline celsius_t celsiusval(const char c, const celsius_t dval=0) { return seenval(c) ? value_celsius() : dval; }
|
||||
static inline feedRate_t feedrateval(const char c, const feedRate_t dval=0) { return seenval(c) ? value_feedrate() : dval; }
|
||||
static celsius_t celsiusval(const char c, const celsius_t dval=0) { return seenval(c) ? value_celsius() : dval; }
|
||||
static feedRate_t feedrateval(const char c, const feedRate_t dval=0) { return seenval(c) ? value_feedrate() : dval; }
|
||||
|
||||
#if ENABLED(MARLIN_DEV_MODE)
|
||||
|
||||
static inline uint8_t* hex_adr_val(const char c, uint8_t * const dval=nullptr) {
|
||||
static uint8_t* hex_adr_val(const char c, uint8_t * const dval=nullptr) {
|
||||
if (!seen(c) || *value_ptr != 'x') return dval;
|
||||
uint8_t *out = nullptr;
|
||||
for (char *vp = value_ptr + 1; HEXCHR(*vp) >= 0; vp++)
|
||||
@ -428,7 +428,7 @@ public:
|
||||
return out;
|
||||
}
|
||||
|
||||
static inline uint16_t hex_val(const char c, uint16_t const dval=0) {
|
||||
static uint16_t hex_val(const char c, uint16_t const dval=0) {
|
||||
if (!seen(c) || *value_ptr != 'x') return dval;
|
||||
uint16_t out = 0;
|
||||
for (char *vp = value_ptr + 1; HEXCHR(*vp) >= 0; vp++)
|
||||
|
@ -126,14 +126,14 @@ public:
|
||||
* Don't inject comments or use leading spaces!
|
||||
* Aborts the current PROGMEM queue so only use for one or two commands.
|
||||
*/
|
||||
static inline void inject_P(PGM_P const pgcode) { injected_commands_P = pgcode; }
|
||||
static inline void inject(FSTR_P const fgcode) { inject_P(FTOP(fgcode)); }
|
||||
static void inject_P(PGM_P const pgcode) { injected_commands_P = pgcode; }
|
||||
static void inject(FSTR_P const fgcode) { inject_P(FTOP(fgcode)); }
|
||||
|
||||
/**
|
||||
* Enqueue command(s) to run from SRAM. Drained by process_injected_command().
|
||||
* Aborts the current SRAM queue so only use for one or two commands.
|
||||
*/
|
||||
static inline void inject(const char * const gcode) {
|
||||
static void inject(const char * const gcode) {
|
||||
strncpy(injected_commands, gcode, sizeof(injected_commands) - 1);
|
||||
}
|
||||
|
||||
@ -158,7 +158,7 @@ public:
|
||||
* Enqueue from program memory and return only when commands are actually enqueued
|
||||
*/
|
||||
static void enqueue_now_P(PGM_P const pcmd);
|
||||
static inline void enqueue_now(FSTR_P const fcmd) { enqueue_now_P(FTOP(fcmd)); }
|
||||
static void enqueue_now(FSTR_P const fcmd) { enqueue_now_P(FTOP(fcmd)); }
|
||||
|
||||
/**
|
||||
* Check whether there are any commands yet to be executed
|
||||
@ -192,7 +192,7 @@ public:
|
||||
* P<int> Planner space remaining
|
||||
* B<int> Block queue space remaining
|
||||
*/
|
||||
static inline void ok_to_send() { ring_buffer.ok_to_send(); }
|
||||
static void ok_to_send() { ring_buffer.ok_to_send(); }
|
||||
|
||||
/**
|
||||
* Clear the serial line and request a resend of
|
||||
@ -203,7 +203,7 @@ public:
|
||||
/**
|
||||
* (Re)Set the current line number for the last received command
|
||||
*/
|
||||
static inline void set_current_line_number(long n) { serial_state[ring_buffer.command_port().index].last_N = n; }
|
||||
static void set_current_line_number(long n) { serial_state[ring_buffer.command_port().index].last_N = n; }
|
||||
|
||||
#if ENABLED(BUFFER_MONITORING)
|
||||
|
||||
@ -237,7 +237,7 @@ public:
|
||||
|
||||
static void auto_report_buffer_statistics();
|
||||
|
||||
static inline void set_auto_report_interval(uint8_t v) {
|
||||
static void set_auto_report_interval(uint8_t v) {
|
||||
NOMORE(v, 60);
|
||||
auto_buffer_report_interval = v;
|
||||
next_buffer_report_ms = millis() + 1000UL * v;
|
||||
|
@ -40,7 +40,7 @@ public:
|
||||
static void init();
|
||||
static void onEncoder(EncoderState encoder_diffState);
|
||||
static void draw();
|
||||
static inline bool isUnlocked() { return unlocked; }
|
||||
static bool isUnlocked() { return unlocked; }
|
||||
};
|
||||
|
||||
extern LockScreenClass lockScreen;
|
||||
|
@ -55,7 +55,7 @@ class DWIN_String {
|
||||
//static font_t *font() { return font_header; };
|
||||
//static uint16_t font_height() { return font_header->FontAscent - font_header->FontDescent; }
|
||||
//static glyph_t *glyph(uint8_t character) { return glyphs[character] ?: glyphs[0x3F]; } /* Use '?' for unknown glyphs */
|
||||
//static inline glyph_t *glyph(uint8_t *character) { return glyph(*character); }
|
||||
//static glyph_t *glyph(uint8_t *character) { return glyph(*character); }
|
||||
|
||||
static void set();
|
||||
//static void add(uint8_t character) { add_character(character); eol(); }
|
||||
@ -65,10 +65,10 @@ class DWIN_String {
|
||||
static void set(uint8_t *string) { set(); add(string); }
|
||||
static void set(wchar_t character) { set(); add(character); }
|
||||
static void set(uint8_t *string, int8_t index, const char *itemString=nullptr) { set(); add(string, index, (uint8_t *)itemString); }
|
||||
static inline void set(FSTR_P fstring) { set((uint8_t *)fstring); }
|
||||
static inline void set(const char *string) { set((uint8_t *)string); }
|
||||
static inline void set(const char *string, int8_t index, const char *itemString=nullptr) { set((uint8_t *)string, index, itemString); }
|
||||
static inline void add(const char *string) { add((uint8_t *)string); }
|
||||
static void set(FSTR_P fstring) { set((uint8_t *)fstring); }
|
||||
static void set(const char *string) { set((uint8_t *)string); }
|
||||
static void set(const char *string, int8_t index, const char *itemString=nullptr) { set((uint8_t *)string, index, itemString); }
|
||||
static void add(const char *string) { add((uint8_t *)string); }
|
||||
|
||||
static void trim(const uint8_t character=0x20);
|
||||
static void rtrim(const uint8_t character=0x20);
|
||||
@ -76,9 +76,9 @@ class DWIN_String {
|
||||
|
||||
static void truncate(uint8_t maxlen) { if (len > maxlen) { len = maxlen; eol(); } }
|
||||
|
||||
static inline uint8_t length() { return len; }
|
||||
static inline uint16_t width() { return span; }
|
||||
static inline uint8_t *string() { return data; }
|
||||
static uint8_t length() { return len; }
|
||||
static uint16_t width() { return span; }
|
||||
static uint8_t *string() { return data; }
|
||||
static uint16_t center(uint16_t width) { return span > width ? 0 : (width - span) / 2; }
|
||||
};
|
||||
|
||||
|
@ -95,14 +95,14 @@ public:
|
||||
|
||||
// Checks two things: Can we confirm the presence of the display and has we initialized it.
|
||||
// (both boils down that the display answered to our chatting)
|
||||
static inline bool isInitialized() { return Initialized; }
|
||||
static bool isInitialized() { return Initialized; }
|
||||
|
||||
private:
|
||||
static void WriteHeader(uint16_t adr, uint8_t cmd, uint8_t payloadlen);
|
||||
static void WritePGM(const char str[], uint8_t len);
|
||||
static void ProcessRx();
|
||||
|
||||
static inline uint16_t swap16(const uint16_t value) { return (value & 0xFFU) << 8U | (value >> 8U); }
|
||||
static uint16_t swap16(const uint16_t value) { return (value & 0xFFU) << 8U | (value >> 8U); }
|
||||
static rx_datagram_state_t rx_datagram_state;
|
||||
static uint8_t rx_datagram_len;
|
||||
static bool Initialized, no_reentrance;
|
||||
|
@ -38,10 +38,10 @@ public:
|
||||
// Send all 4 strings that are displayed on the infoscreen, confirmation screen and kill screen
|
||||
// The bools specifying whether the strings are in RAM or FLASH.
|
||||
static void sendinfoscreen(const char *line1, const char *line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash);
|
||||
static inline void sendinfoscreen(FSTR_P const line1, FSTR_P const line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash) {
|
||||
static void sendinfoscreen(FSTR_P const line1, FSTR_P const line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash) {
|
||||
sendinfoscreen(FTOP(line1), FTOP(line2), line3, line4, l1inflash, l2inflash, l3inflash, liinflash);
|
||||
}
|
||||
static inline void sendinfoscreen(FSTR_P const line1, FSTR_P const line2, FSTR_P const line3, FSTR_P const line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash) {
|
||||
static void sendinfoscreen(FSTR_P const line1, FSTR_P const line2, FSTR_P const line3, FSTR_P const line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash) {
|
||||
sendinfoscreen(FTOP(line1), FTOP(line2), FTOP(line3), FTOP(line4), l1inflash, l2inflash, l3inflash, liinflash);
|
||||
}
|
||||
|
||||
@ -213,13 +213,13 @@ public:
|
||||
}
|
||||
|
||||
// Force an update of all VP on the current screen.
|
||||
static inline void ForceCompleteUpdate() { update_ptr = 0; ScreenComplete = false; }
|
||||
static void ForceCompleteUpdate() { update_ptr = 0; ScreenComplete = false; }
|
||||
// Has all VPs sent to the screen
|
||||
static inline bool IsScreenComplete() { return ScreenComplete; }
|
||||
static bool IsScreenComplete() { return ScreenComplete; }
|
||||
|
||||
static inline DGUSLCD_Screens getCurrentScreen() { return current_screen; }
|
||||
static DGUSLCD_Screens getCurrentScreen() { return current_screen; }
|
||||
|
||||
static inline void SetupConfirmAction( void (*f)()) { confirm_action_cb = f; }
|
||||
static void SetupConfirmAction( void (*f)()) { confirm_action_cb = f; }
|
||||
|
||||
private:
|
||||
static DGUSLCD_Screens current_screen; //< currently on screen
|
||||
|
@ -38,10 +38,10 @@ public:
|
||||
// Send all 4 strings that are displayed on the infoscreen, confirmation screen and kill screen
|
||||
// The bools specifying whether the strings are in RAM or FLASH.
|
||||
static void sendinfoscreen(const char *line1, const char *line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash);
|
||||
static inline void sendinfoscreen(FSTR_P const line1, FSTR_P const line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash) {
|
||||
static void sendinfoscreen(FSTR_P const line1, FSTR_P const line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash) {
|
||||
sendinfoscreen(FTOP(line1), FTOP(line2), line3, line4, l1inflash, l2inflash, l3inflash, liinflash);
|
||||
}
|
||||
static inline void sendinfoscreen(FSTR_P const line1, FSTR_P const line2, FSTR_P const line3, FSTR_P const line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash) {
|
||||
static void sendinfoscreen(FSTR_P const line1, FSTR_P const line2, FSTR_P const line3, FSTR_P const line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash) {
|
||||
sendinfoscreen(FTOP(line1), FTOP(line2), FTOP(line3), FTOP(line4), l1inflash, l2inflash, l3inflash, liinflash);
|
||||
}
|
||||
|
||||
@ -213,13 +213,13 @@ public:
|
||||
}
|
||||
|
||||
// Force an update of all VP on the current screen.
|
||||
static inline void ForceCompleteUpdate() { update_ptr = 0; ScreenComplete = false; }
|
||||
static void ForceCompleteUpdate() { update_ptr = 0; ScreenComplete = false; }
|
||||
// Has all VPs sent to the screen
|
||||
static inline bool IsScreenComplete() { return ScreenComplete; }
|
||||
static bool IsScreenComplete() { return ScreenComplete; }
|
||||
|
||||
static inline DGUSLCD_Screens getCurrentScreen() { return current_screen; }
|
||||
static DGUSLCD_Screens getCurrentScreen() { return current_screen; }
|
||||
|
||||
static inline void SetupConfirmAction( void (*f)()) { confirm_action_cb = f; }
|
||||
static void SetupConfirmAction( void (*f)()) { confirm_action_cb = f; }
|
||||
|
||||
private:
|
||||
static DGUSLCD_Screens current_screen; //< currently on screen
|
||||
|
@ -38,10 +38,10 @@ public:
|
||||
// Send all 4 strings that are displayed on the infoscreen, confirmation screen and kill screen
|
||||
// The bools specifying whether the strings are in RAM or FLASH.
|
||||
static void sendinfoscreen(const char *line1, const char *line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash);
|
||||
static inline void sendinfoscreen(FSTR_P const line1, FSTR_P const line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash) {
|
||||
static void sendinfoscreen(FSTR_P const line1, FSTR_P const line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash) {
|
||||
sendinfoscreen(FTOP(line1), FTOP(line2), line3, line4, l1inflash, l2inflash, l3inflash, liinflash);
|
||||
}
|
||||
static inline void sendinfoscreen(FSTR_P const line1, FSTR_P const line2, FSTR_P const line3, FSTR_P const line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash) {
|
||||
static void sendinfoscreen(FSTR_P const line1, FSTR_P const line2, FSTR_P const line3, FSTR_P const line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash) {
|
||||
sendinfoscreen(FTOP(line1), FTOP(line2), FTOP(line3), FTOP(line4), l1inflash, l2inflash, l3inflash, liinflash);
|
||||
}
|
||||
|
||||
@ -280,13 +280,13 @@ public:
|
||||
}
|
||||
|
||||
// Force an update of all VP on the current screen.
|
||||
static inline void ForceCompleteUpdate() { update_ptr = 0; ScreenComplete = false; }
|
||||
static void ForceCompleteUpdate() { update_ptr = 0; ScreenComplete = false; }
|
||||
// Has all VPs sent to the screen
|
||||
static inline bool IsScreenComplete() { return ScreenComplete; }
|
||||
static bool IsScreenComplete() { return ScreenComplete; }
|
||||
|
||||
static inline DGUSLCD_Screens getCurrentScreen() { return current_screen; }
|
||||
static DGUSLCD_Screens getCurrentScreen() { return current_screen; }
|
||||
|
||||
static inline void SetupConfirmAction( void (*f)()) { confirm_action_cb = f; }
|
||||
static void SetupConfirmAction( void (*f)()) { confirm_action_cb = f; }
|
||||
|
||||
private:
|
||||
static DGUSLCD_Screens current_screen; //< currently on screen
|
||||
|
@ -38,10 +38,10 @@ public:
|
||||
// Send all 4 strings that are displayed on the infoscreen, confirmation screen and kill screen
|
||||
// The bools specifying whether the strings are in RAM or FLASH.
|
||||
static void sendinfoscreen(const char *line1, const char *line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash);
|
||||
static inline void sendinfoscreen(FSTR_P const line1, FSTR_P const line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash) {
|
||||
static void sendinfoscreen(FSTR_P const line1, FSTR_P const line2, const char *line3, const char *line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash) {
|
||||
sendinfoscreen(FTOP(line1), FTOP(line2), line3, line4, l1inflash, l2inflash, l3inflash, liinflash);
|
||||
}
|
||||
static inline void sendinfoscreen(FSTR_P const line1, FSTR_P const line2, FSTR_P const line3, FSTR_P const line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash) {
|
||||
static void sendinfoscreen(FSTR_P const line1, FSTR_P const line2, FSTR_P const line3, FSTR_P const line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash) {
|
||||
sendinfoscreen(FTOP(line1), FTOP(line2), FTOP(line3), FTOP(line4), l1inflash, l2inflash, l3inflash, liinflash);
|
||||
}
|
||||
|
||||
@ -213,13 +213,13 @@ public:
|
||||
}
|
||||
|
||||
// Force an update of all VP on the current screen.
|
||||
static inline void ForceCompleteUpdate() { update_ptr = 0; ScreenComplete = false; }
|
||||
static void ForceCompleteUpdate() { update_ptr = 0; ScreenComplete = false; }
|
||||
// Has all VPs sent to the screen
|
||||
static inline bool IsScreenComplete() { return ScreenComplete; }
|
||||
static bool IsScreenComplete() { return ScreenComplete; }
|
||||
|
||||
static inline DGUSLCD_Screens getCurrentScreen() { return current_screen; }
|
||||
static DGUSLCD_Screens getCurrentScreen() { return current_screen; }
|
||||
|
||||
static inline void SetupConfirmAction( void (*f)()) { confirm_action_cb = f; }
|
||||
static void SetupConfirmAction( void (*f)()) { confirm_action_cb = f; }
|
||||
|
||||
private:
|
||||
static DGUSLCD_Screens current_screen; //< currently on screen
|
||||
|
@ -98,7 +98,7 @@ public:
|
||||
|
||||
// Checks two things: Can we confirm the presence of the display and has we initialized it.
|
||||
// (both boils down that the display answered to our chatting)
|
||||
static inline bool IsInitialized() {
|
||||
static bool IsInitialized() {
|
||||
return initialized;
|
||||
}
|
||||
|
||||
|
@ -43,8 +43,8 @@
|
||||
#define min(a,b) ((a)<(b)?(a):(b))
|
||||
#else
|
||||
namespace UI {
|
||||
static inline uint32_t safe_millis() { return millis(); }
|
||||
static inline void yield() {}
|
||||
static uint32_t safe_millis() { return millis(); }
|
||||
static void yield() {}
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -40,13 +40,13 @@
|
||||
template<typename port_t,uint8_t bits>
|
||||
struct port_pin {
|
||||
typedef port_t port;
|
||||
static inline void set_high() {port::port() = (port::port() | bits);}
|
||||
static inline void set_low() {port::port() = (port::port() & (~bits));}
|
||||
static inline void set_input() {port::ddr() = (port::ddr() & (~bits));}
|
||||
static inline void set_input_pullup() {set_input(); set_high();}
|
||||
static inline void set_output() {port::ddr() = (port::ddr() | bits);}
|
||||
static inline uint8_t read() {return port::pin() & bits;}
|
||||
static inline void write(bool v) {if (v) set_high(); else set_low();}
|
||||
static void set_high() {port::port() = (port::port() | bits);}
|
||||
static void set_low() {port::port() = (port::port() & (~bits));}
|
||||
static void set_input() {port::ddr() = (port::ddr() & (~bits));}
|
||||
static void set_input_pullup() {set_input(); set_high();}
|
||||
static void set_output() {port::ddr() = (port::ddr() | bits);}
|
||||
static uint8_t read() {return port::pin() & bits;}
|
||||
static void write(bool v) {if (v) set_high(); else set_low();}
|
||||
};
|
||||
|
||||
#define MAKE_AVR_PORT_PINS(ID) \
|
||||
@ -109,13 +109,13 @@
|
||||
template<uint8_t p>
|
||||
struct arduino_digital_pin {
|
||||
static constexpr uint8_t pin = p;
|
||||
static inline void set_high() {digitalWrite(p, HIGH);}
|
||||
static inline void set_low() {digitalWrite(p, LOW);}
|
||||
static inline void set_input() {pinMode(p, INPUT);}
|
||||
static inline void set_input_pullup() {pinMode(p, INPUT_PULLUP);}
|
||||
static inline void set_output() {pinMode(p, OUTPUT);}
|
||||
static inline uint8_t read() {return digitalRead(p);}
|
||||
static inline void write(bool v) {digitalWrite(p, v ? HIGH : LOW);}
|
||||
static void set_high() {digitalWrite(p, HIGH);}
|
||||
static void set_low() {digitalWrite(p, LOW);}
|
||||
static void set_input() {pinMode(p, INPUT);}
|
||||
static void set_input_pullup() {pinMode(p, INPUT_PULLUP);}
|
||||
static void set_output() {pinMode(p, OUTPUT);}
|
||||
static uint8_t read() {return digitalRead(p);}
|
||||
static void write(bool v) {digitalWrite(p, v ? HIGH : LOW);}
|
||||
};
|
||||
|
||||
#define MAKE_ARDUINO_PINS(ID) typedef arduino_digital_pin<ID> ARDUINO_DIGITAL_##ID;
|
||||
|
@ -29,10 +29,10 @@ class SoundList {
|
||||
} list[];
|
||||
public:
|
||||
static const uint8_t n;
|
||||
static inline const char* name(uint8_t val) {
|
||||
static const char* name(uint8_t val) {
|
||||
return (const char* ) pgm_read_ptr_far(&list[val].name);
|
||||
}
|
||||
static inline FTDI::SoundPlayer::sound_t* data(uint8_t val) {
|
||||
static FTDI::SoundPlayer::sound_t* data(uint8_t val) {
|
||||
return (FTDI::SoundPlayer::sound_t*) pgm_read_ptr_far(&list[val].data);
|
||||
}
|
||||
};
|
||||
|
@ -96,12 +96,12 @@ private:
|
||||
static uint8_t m_pageData[SPI_FLASH_PageSize];
|
||||
static uint32_t m_currentPage;
|
||||
static uint16_t m_pageDataUsed;
|
||||
static inline uint16_t pageDataFree() { return SPI_FLASH_PageSize - m_pageDataUsed; }
|
||||
static uint16_t pageDataFree() { return SPI_FLASH_PageSize - m_pageDataUsed; }
|
||||
static uint32_t m_startAddress;
|
||||
#if HAS_SPI_FLASH_COMPRESSION
|
||||
static uint8_t m_compressedData[SPI_FLASH_PageSize];
|
||||
static uint16_t m_compressedDataUsed;
|
||||
static inline uint16_t compressedDataFree() { return SPI_FLASH_PageSize - m_compressedDataUsed; }
|
||||
static uint16_t compressedDataFree() { return SPI_FLASH_PageSize - m_compressedDataUsed; }
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -274,8 +274,8 @@ public:
|
||||
static bool detected();
|
||||
static void init_lcd();
|
||||
#else
|
||||
static inline bool detected() { return true; }
|
||||
static inline void init_lcd() {}
|
||||
static bool detected() { return true; }
|
||||
static void init_lcd() {}
|
||||
#endif
|
||||
|
||||
#if HAS_PRINT_PROGRESS
|
||||
@ -294,7 +294,7 @@ public:
|
||||
static void set_progress_done() { progress_override = (PROGRESS_MASK + 1U) + 100U * (PROGRESS_SCALE); }
|
||||
static void progress_reset() { if (progress_override & (PROGRESS_MASK + 1U)) set_progress(0); }
|
||||
#if ENABLED(SHOW_REMAINING_TIME)
|
||||
static inline uint32_t _calculated_remaining_time() {
|
||||
static uint32_t _calculated_remaining_time() {
|
||||
const duration_t elapsed = print_job_timer.duration();
|
||||
const progress_t progress = _get_progress();
|
||||
return progress ? elapsed.value * (100 * (PROGRESS_SCALE) - progress) / progress : 0;
|
||||
@ -342,12 +342,12 @@ public:
|
||||
static bool has_status();
|
||||
static void reset_status(const bool no_welcome=false);
|
||||
static void set_alert_status(FSTR_P const fstr);
|
||||
static inline void reset_alert_level() { alert_level = 0; }
|
||||
static void reset_alert_level() { alert_level = 0; }
|
||||
#else
|
||||
static constexpr bool has_status() { return false; }
|
||||
static inline void reset_status(const bool=false) {}
|
||||
static inline void set_alert_status(FSTR_P const) {}
|
||||
static inline void reset_alert_level() {}
|
||||
static void reset_status(const bool=false) {}
|
||||
static void set_alert_status(FSTR_P const) {}
|
||||
static void reset_alert_level() {}
|
||||
#endif
|
||||
|
||||
static void set_status(const char * const cstr, const bool persist=false);
|
||||
@ -360,7 +360,7 @@ public:
|
||||
static void draw_status_message(const bool blink);
|
||||
#endif
|
||||
#else
|
||||
static inline void kill_screen(FSTR_P const, FSTR_P const) {}
|
||||
static void kill_screen(FSTR_P const, FSTR_P const) {}
|
||||
#endif
|
||||
|
||||
#if HAS_DISPLAY
|
||||
@ -444,7 +444,7 @@ public:
|
||||
#if HAS_BUZZER
|
||||
static void completion_feedback(const bool good=true);
|
||||
#else
|
||||
static inline void completion_feedback(const bool=true) { TERN_(HAS_TOUCH_SLEEP, wakeup_screen()); }
|
||||
static void completion_feedback(const bool=true) { TERN_(HAS_TOUCH_SLEEP, wakeup_screen()); }
|
||||
#endif
|
||||
|
||||
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
||||
@ -479,9 +479,9 @@ public:
|
||||
|
||||
#else // No LCD
|
||||
|
||||
static inline void init() {}
|
||||
static inline void update() {}
|
||||
static inline void return_to_status() {}
|
||||
static void init() {}
|
||||
static void update() {}
|
||||
static void return_to_status() {}
|
||||
|
||||
#endif
|
||||
|
||||
@ -500,17 +500,17 @@ public:
|
||||
static preheat_t material_preset[PREHEAT_COUNT];
|
||||
static PGM_P get_preheat_label(const uint8_t m);
|
||||
static void apply_preheat(const uint8_t m, const uint8_t pmask, const uint8_t e=active_extruder);
|
||||
static inline void preheat_set_fan(const uint8_t m) { TERN_(HAS_FAN, apply_preheat(m, PM_FAN)); }
|
||||
static inline void preheat_hotend(const uint8_t m, const uint8_t e=active_extruder) { TERN_(HAS_HOTEND, apply_preheat(m, PM_HOTEND)); }
|
||||
static inline void preheat_hotend_and_fan(const uint8_t m, const uint8_t e=active_extruder) { preheat_hotend(m, e); preheat_set_fan(m); }
|
||||
static inline void preheat_bed(const uint8_t m) { TERN_(HAS_HEATED_BED, apply_preheat(m, PM_BED)); }
|
||||
static inline void preheat_all(const uint8_t m) { apply_preheat(m, 0xFF); }
|
||||
static void preheat_set_fan(const uint8_t m) { TERN_(HAS_FAN, apply_preheat(m, PM_FAN)); }
|
||||
static void preheat_hotend(const uint8_t m, const uint8_t e=active_extruder) { TERN_(HAS_HOTEND, apply_preheat(m, PM_HOTEND)); }
|
||||
static void preheat_hotend_and_fan(const uint8_t m, const uint8_t e=active_extruder) { preheat_hotend(m, e); preheat_set_fan(m); }
|
||||
static void preheat_bed(const uint8_t m) { TERN_(HAS_HEATED_BED, apply_preheat(m, PM_BED)); }
|
||||
static void preheat_all(const uint8_t m) { apply_preheat(m, 0xFF); }
|
||||
#endif
|
||||
|
||||
#if SCREENS_CAN_TIME_OUT
|
||||
static inline void reset_status_timeout(const millis_t ms) { return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS; }
|
||||
static void reset_status_timeout(const millis_t ms) { return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS; }
|
||||
#else
|
||||
static inline void reset_status_timeout(const millis_t) {}
|
||||
static void reset_status_timeout(const millis_t) {}
|
||||
#endif
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
@ -548,11 +548,11 @@ public:
|
||||
|
||||
// goto_previous_screen and go_back may also be used as menu item callbacks
|
||||
static void _goto_previous_screen(TERN_(TURBO_BACK_MENU_ITEM, const bool is_back));
|
||||
static inline void goto_previous_screen() { _goto_previous_screen(TERN_(TURBO_BACK_MENU_ITEM, false)); }
|
||||
static inline void go_back() { _goto_previous_screen(TERN_(TURBO_BACK_MENU_ITEM, true)); }
|
||||
static void goto_previous_screen() { _goto_previous_screen(TERN_(TURBO_BACK_MENU_ITEM, false)); }
|
||||
static void go_back() { _goto_previous_screen(TERN_(TURBO_BACK_MENU_ITEM, true)); }
|
||||
|
||||
static void return_to_status();
|
||||
static inline bool on_status_screen() { return currentScreen == status_screen; }
|
||||
static bool on_status_screen() { return currentScreen == status_screen; }
|
||||
FORCE_INLINE static void run_current_screen() { (*currentScreen)(); }
|
||||
|
||||
#if ENABLED(LIGHTWEIGHT_UI)
|
||||
@ -567,7 +567,7 @@ public:
|
||||
TERN(SCREENS_CAN_TIME_OUT, defer_return_to_status = defer, UNUSED(defer));
|
||||
}
|
||||
|
||||
static inline void goto_previous_screen_no_defer() {
|
||||
static void goto_previous_screen_no_defer() {
|
||||
defer_status_screen(false);
|
||||
goto_previous_screen();
|
||||
}
|
||||
@ -599,20 +599,20 @@ public:
|
||||
|
||||
#if EITHER(HAS_LCD_MENU, EXTENSIBLE_UI)
|
||||
static bool lcd_clicked;
|
||||
static inline bool use_click() {
|
||||
static bool use_click() {
|
||||
const bool click = lcd_clicked;
|
||||
lcd_clicked = false;
|
||||
return click;
|
||||
}
|
||||
#else
|
||||
static constexpr bool lcd_clicked = false;
|
||||
static inline bool use_click() { return false; }
|
||||
static bool use_click() { return false; }
|
||||
#endif
|
||||
|
||||
#if ENABLED(ADVANCED_PAUSE_FEATURE) && ANY(HAS_LCD_MENU, EXTENSIBLE_UI, DWIN_CREALITY_LCD_ENHANCED, DWIN_CREALITY_LCD_JYERSUI)
|
||||
static void pause_show_message(const PauseMessage message, const PauseMode mode=PAUSE_MODE_SAME, const uint8_t extruder=active_extruder);
|
||||
#else
|
||||
static inline void _pause_show_message() {}
|
||||
static void _pause_show_message() {}
|
||||
#define pause_show_message(...) _pause_show_message()
|
||||
#endif
|
||||
|
||||
@ -631,9 +631,9 @@ public:
|
||||
#endif
|
||||
#if DISABLED(EEPROM_AUTO_INIT)
|
||||
static void eeprom_alert(const uint8_t msgid);
|
||||
static inline void eeprom_alert_crc() { eeprom_alert(0); }
|
||||
static inline void eeprom_alert_index() { eeprom_alert(1); }
|
||||
static inline void eeprom_alert_version() { eeprom_alert(2); }
|
||||
static void eeprom_alert_crc() { eeprom_alert(0); }
|
||||
static void eeprom_alert_index() { eeprom_alert(1); }
|
||||
static void eeprom_alert_version() { eeprom_alert(2); }
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -674,7 +674,7 @@ public:
|
||||
#endif
|
||||
|
||||
static void update_buttons();
|
||||
static inline bool button_pressed() { return BUTTON_CLICK() || TERN(TOUCH_SCREEN, touch_pressed(), false); }
|
||||
static bool button_pressed() { return BUTTON_CLICK() || TERN(TOUCH_SCREEN, touch_pressed(), false); }
|
||||
#if EITHER(AUTO_BED_LEVELING_UBL, G26_MESH_VALIDATION)
|
||||
static void wait_for_release();
|
||||
#endif
|
||||
@ -705,7 +705,7 @@ public:
|
||||
|
||||
#else
|
||||
|
||||
static inline void update_buttons() {}
|
||||
static void update_buttons() {}
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -109,7 +109,7 @@ class MenuItem_confirm : public MenuItemBase {
|
||||
selectFunc_t yesFunc, selectFunc_t noFunc,
|
||||
PGM_P const pref, const char * const string=nullptr, PGM_P const suff=nullptr
|
||||
);
|
||||
static inline void select_screen(
|
||||
static void select_screen(
|
||||
PGM_P const yes, PGM_P const no,
|
||||
selectFunc_t yesFunc, selectFunc_t noFunc,
|
||||
PGM_P const pref, FSTR_P const string, PGM_P const suff=nullptr
|
||||
@ -178,7 +178,7 @@ class MenuEditItemBase : public MenuItemBase {
|
||||
static void draw_edit_screen(PGM_P const pstr, const char * const value);
|
||||
|
||||
// This method is for the current menu item
|
||||
static inline void draw_edit_screen(const char * const value) { draw_edit_screen(editLabel, value); }
|
||||
static void draw_edit_screen(const char * const value) { draw_edit_screen(editLabel, value); }
|
||||
};
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
|
@ -39,14 +39,14 @@ class MenuItem_submenu : public MenuItemBase {
|
||||
FORCE_INLINE static void draw(const bool sel, const uint8_t row, PGM_P const pstr, ...) {
|
||||
_draw(sel, row, pstr, '>', LCD_STR_ARROW_RIGHT[0]);
|
||||
}
|
||||
static inline void action(PGM_P const, const screenFunc_t func) { ui.push_current_screen(); ui.goto_screen(func); }
|
||||
static void action(PGM_P const, const screenFunc_t func) { ui.push_current_screen(); ui.goto_screen(func); }
|
||||
};
|
||||
|
||||
// Any menu item that invokes an immediate action
|
||||
class MenuItem_button : public MenuItemBase {
|
||||
public:
|
||||
// Button-y Items are selectable lines with no other indicator
|
||||
static inline void draw(const bool sel, const uint8_t row, PGM_P const pstr, ...) {
|
||||
static void draw(const bool sel, const uint8_t row, PGM_P const pstr, ...) {
|
||||
_draw(sel, row, pstr, '>', ' ');
|
||||
}
|
||||
};
|
||||
@ -54,8 +54,8 @@ class MenuItem_button : public MenuItemBase {
|
||||
// ACTION_ITEM(LABEL, FUNC)
|
||||
class MenuItem_function : public MenuItem_button {
|
||||
public:
|
||||
//static inline void action(PGM_P const, const uint8_t, const menuAction_t func) { (*func)(); };
|
||||
static inline void action(PGM_P const, const menuAction_t func) { if (func) (*func)(); };
|
||||
//static void action(PGM_P const, const uint8_t, const menuAction_t func) { (*func)(); };
|
||||
static void action(PGM_P const, const menuAction_t func) { if (func) (*func)(); };
|
||||
};
|
||||
|
||||
// GCODES_ITEM(LABEL, GCODES)
|
||||
@ -65,7 +65,7 @@ class MenuItem_gcode : public MenuItem_button {
|
||||
_draw(sel, row, pstr, '>', ' ');
|
||||
}
|
||||
static void action(PGM_P const, PGM_P const pgcode) { queue.inject(FPSTR(pgcode)); }
|
||||
static inline void action(PGM_P const pstr, const uint8_t, PGM_P const pgcode) { action(pstr, pgcode); }
|
||||
static void action(PGM_P const pstr, const uint8_t, PGM_P const pgcode) { action(pstr, pgcode); }
|
||||
};
|
||||
|
||||
////////////////////////////////////////////
|
||||
@ -77,8 +77,8 @@ template<typename NAME>
|
||||
class TMenuEditItem : MenuEditItemBase {
|
||||
private:
|
||||
typedef typename NAME::type_t type_t;
|
||||
static inline float scale(const_float_t value) { return NAME::scale(value); }
|
||||
static inline float unscale(const_float_t value) { return NAME::unscale(value); }
|
||||
static float scale(const_float_t value) { return NAME::scale(value); }
|
||||
static float unscale(const_float_t value) { return NAME::unscale(value); }
|
||||
static const char* to_string(const int32_t value) { return NAME::strfunc(unscale(value)); }
|
||||
static void load(void *ptr, const int32_t value) { *((type_t*)ptr) = unscale(value); }
|
||||
public:
|
||||
@ -117,9 +117,9 @@ class TMenuEditItem : MenuEditItemBase {
|
||||
*
|
||||
* struct MenuEditItemInfo_percent {
|
||||
* typedef uint8_t type_t;
|
||||
* static inline float scale(const_float_t value) { return value * (100.f/255.f) +0.5f; }
|
||||
* static inline float unscale(const_float_t value) { return value / (100.f/255.f) +0.5f; }
|
||||
* static inline const char* strfunc(const_float_t value) { return ui8tostr4pctrj(_DOFIX(uint8_t,value)); }
|
||||
* static float scale(const_float_t value) { return value * (100.f/255.f) +0.5f; }
|
||||
* static float unscale(const_float_t value) { return value / (100.f/255.f) +0.5f; }
|
||||
* static const char* strfunc(const_float_t value) { return ui8tostr4pctrj(_DOFIX(uint8_t,value)); }
|
||||
* };
|
||||
* typedef TMenuEditItem<MenuEditItemInfo_percent> MenuItem_percent
|
||||
*/
|
||||
@ -128,9 +128,9 @@ class TMenuEditItem : MenuEditItemBase {
|
||||
#define DEFINE_MENU_EDIT_ITEM_TYPE(NAME, TYPE, STRFUNC, SCALE, ETC...) \
|
||||
struct MenuEditItemInfo_##NAME { \
|
||||
typedef TYPE type_t; \
|
||||
static inline float scale(const_float_t value) { return value * (SCALE) ETC; } \
|
||||
static inline float unscale(const_float_t value) { return value / (SCALE) ETC; } \
|
||||
static inline const char* strfunc(const_float_t value) { return STRFUNC(_DOFIX(TYPE,value)); } \
|
||||
static float scale(const_float_t value) { return value * (SCALE) ETC; } \
|
||||
static float unscale(const_float_t value) { return value / (SCALE) ETC; } \
|
||||
static const char* strfunc(const_float_t value) { return STRFUNC(_DOFIX(TYPE,value)); } \
|
||||
}; \
|
||||
typedef TMenuEditItem<MenuEditItemInfo_##NAME> MenuItem_##NAME
|
||||
|
||||
|
@ -81,24 +81,24 @@ class TFT {
|
||||
static uint16_t buffer[TFT_BUFFER_SIZE];
|
||||
|
||||
static void init();
|
||||
static inline void set_font(const uint8_t *Font) { string.set_font(Font); }
|
||||
static inline void add_glyphs(const uint8_t *Font) { string.add_glyphs(Font); }
|
||||
static void set_font(const uint8_t *Font) { string.set_font(Font); }
|
||||
static void add_glyphs(const uint8_t *Font) { string.add_glyphs(Font); }
|
||||
|
||||
static inline bool is_busy() { return io.isBusy(); }
|
||||
static inline void abort() { io.Abort(); }
|
||||
static inline void write_multiple(uint16_t Data, uint16_t Count) { io.WriteMultiple(Data, Count); }
|
||||
static inline void write_sequence(uint16_t *Data, uint16_t Count) { io.WriteSequence(Data, Count); }
|
||||
static inline void set_window(uint16_t Xmin, uint16_t Ymin, uint16_t Xmax, uint16_t Ymax) { io.set_window(Xmin, Ymin, Xmax, Ymax); }
|
||||
static bool is_busy() { return io.isBusy(); }
|
||||
static void abort() { io.Abort(); }
|
||||
static void write_multiple(uint16_t Data, uint16_t Count) { io.WriteMultiple(Data, Count); }
|
||||
static void write_sequence(uint16_t *Data, uint16_t Count) { io.WriteSequence(Data, Count); }
|
||||
static void set_window(uint16_t Xmin, uint16_t Ymin, uint16_t Xmax, uint16_t Ymax) { io.set_window(Xmin, Ymin, Xmax, Ymax); }
|
||||
|
||||
static inline void fill(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color) { queue.fill(x, y, width, height, color); }
|
||||
static inline void canvas(uint16_t x, uint16_t y, uint16_t width, uint16_t height) { queue.canvas(x, y, width, height); }
|
||||
static inline void set_background(uint16_t color) { queue.set_background(color); }
|
||||
static inline void add_text(uint16_t x, uint16_t y, uint16_t color, TFT_String tft_string, uint16_t maxWidth = 0) { queue.add_text(x, y, color, tft_string.string(), maxWidth); }
|
||||
static inline void add_text(uint16_t x, uint16_t y, uint16_t color, const char *string, uint16_t maxWidth = 0) { queue.add_text(x, y, color, (uint8_t *)string, maxWidth); }
|
||||
static inline void add_image(int16_t x, int16_t y, MarlinImage image, uint16_t *colors) { queue.add_image(x, y, image, colors); }
|
||||
static inline void add_image(int16_t x, int16_t y, MarlinImage image, uint16_t color_main = COLOR_WHITE, uint16_t color_background = COLOR_BACKGROUND, uint16_t color_shadow = COLOR_BLACK) { queue.add_image(x, y, image, color_main, color_background, color_shadow); }
|
||||
static inline void add_bar(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color) { queue.add_bar(x, y, width, height, color); }
|
||||
static inline void add_rectangle(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color) { queue.add_rectangle(x, y, width, height, color); }
|
||||
static void fill(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color) { queue.fill(x, y, width, height, color); }
|
||||
static void canvas(uint16_t x, uint16_t y, uint16_t width, uint16_t height) { queue.canvas(x, y, width, height); }
|
||||
static void set_background(uint16_t color) { queue.set_background(color); }
|
||||
static void add_text(uint16_t x, uint16_t y, uint16_t color, TFT_String tft_string, uint16_t maxWidth = 0) { queue.add_text(x, y, color, tft_string.string(), maxWidth); }
|
||||
static void add_text(uint16_t x, uint16_t y, uint16_t color, const char *string, uint16_t maxWidth = 0) { queue.add_text(x, y, color, (uint8_t *)string, maxWidth); }
|
||||
static void add_image(int16_t x, int16_t y, MarlinImage image, uint16_t *colors) { queue.add_image(x, y, image, colors); }
|
||||
static void add_image(int16_t x, int16_t y, MarlinImage image, uint16_t color_main = COLOR_WHITE, uint16_t color_background = COLOR_BACKGROUND, uint16_t color_shadow = COLOR_BLACK) { queue.add_image(x, y, image, color_main, color_background, color_shadow); }
|
||||
static void add_bar(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color) { queue.add_bar(x, y, width, height, color); }
|
||||
static void add_rectangle(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color) { queue.add_rectangle(x, y, width, height, color); }
|
||||
static void draw_edit_screen_buttons();
|
||||
};
|
||||
|
||||
|
@ -81,7 +81,7 @@ class TFT_String {
|
||||
static font_t *font() { return font_header; };
|
||||
static uint16_t font_height() { return font_header->FontAscent - font_header->FontDescent; }
|
||||
static glyph_t *glyph(uint8_t character) { return glyphs[character] ?: glyphs[0x3F]; } /* Use '?' for unknown glyphs */
|
||||
static inline glyph_t *glyph(uint8_t *character) { return glyph(*character); }
|
||||
static glyph_t *glyph(uint8_t *character) { return glyph(*character); }
|
||||
|
||||
static void set();
|
||||
static void add(uint8_t character) { add_character(character); eol(); }
|
||||
@ -89,9 +89,9 @@ class TFT_String {
|
||||
static void add(uint8_t *string, int8_t index, uint8_t *itemString=nullptr);
|
||||
static void set(uint8_t *string) { set(); add(string); };
|
||||
static void set(uint8_t *string, int8_t index, const char *itemString=nullptr) { set(); add(string, index, (uint8_t *)itemString); };
|
||||
static inline void set(const char *string) { set((uint8_t *)string); }
|
||||
static inline void set(const char *string, int8_t index, const char *itemString=nullptr) { set((uint8_t *)string, index, itemString); }
|
||||
static inline void add(const char *string) { add((uint8_t *)string); }
|
||||
static void set(const char *string) { set((uint8_t *)string); }
|
||||
static void set(const char *string, int8_t index, const char *itemString=nullptr) { set((uint8_t *)string, index, itemString); }
|
||||
static void add(const char *string) { add((uint8_t *)string); }
|
||||
|
||||
static void trim(uint8_t character=0x20);
|
||||
static void rtrim(uint8_t character=0x20);
|
||||
|
@ -106,7 +106,7 @@ class Touch {
|
||||
static millis_t last_touch_ms, time_to_hold, repeat_delay, touch_time;
|
||||
static TouchControlType touch_control_type;
|
||||
|
||||
static inline bool get_point(int16_t *x, int16_t *y);
|
||||
static bool get_point(int16_t *x, int16_t *y);
|
||||
static void touch(touch_control_t *control);
|
||||
static void hold(touch_control_t *control, millis_t delay = 0);
|
||||
|
||||
@ -126,7 +126,7 @@ class Touch {
|
||||
static void enable() { enabled = true; }
|
||||
#if HAS_TOUCH_SLEEP
|
||||
static millis_t next_sleep_ms;
|
||||
static inline bool isSleeping() { return next_sleep_ms == TSLP_SLEEPING; }
|
||||
static bool isSleeping() { return next_sleep_ms == TSLP_SLEEPING; }
|
||||
static void sleepTimeout();
|
||||
static void wakeUp();
|
||||
#endif
|
||||
|
@ -118,11 +118,11 @@ public:
|
||||
|
||||
#if ENABLED(MONITOR_L6470_DRIVER_STATUS)
|
||||
static bool monitor_paused;
|
||||
static inline void pause_monitor(const bool p) { monitor_paused = p; }
|
||||
static void pause_monitor(const bool p) { monitor_paused = p; }
|
||||
static void monitor_update(L64XX_axis_t stepper_index);
|
||||
static void monitor_driver();
|
||||
#else
|
||||
static inline void pause_monitor(const bool) {}
|
||||
static void pause_monitor(const bool) {}
|
||||
#endif
|
||||
|
||||
//protected:
|
||||
|
@ -77,7 +77,7 @@
|
||||
* @brief Resets the state of the class
|
||||
* @details Brings the class state to a known one.
|
||||
*/
|
||||
static inline void reset() {
|
||||
static void reset() {
|
||||
off();
|
||||
state.endtime = 0;
|
||||
}
|
||||
@ -86,7 +86,7 @@
|
||||
/**
|
||||
* @brief Init Buzzer
|
||||
*/
|
||||
static inline void init() {
|
||||
static void init() {
|
||||
SET_OUTPUT(BEEPER_PIN);
|
||||
reset();
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ class Stopwatch {
|
||||
* @return true on success
|
||||
*/
|
||||
static bool stop();
|
||||
static inline bool abort() { return stop(); } // Alias by default
|
||||
static bool abort() { return stop(); } // Alias by default
|
||||
|
||||
/**
|
||||
* @brief Pause the stopwatch
|
||||
@ -114,7 +114,7 @@ class Stopwatch {
|
||||
|
||||
#else
|
||||
|
||||
static inline void debug(FSTR_P const) {}
|
||||
static void debug(FSTR_P const) {}
|
||||
|
||||
#endif
|
||||
};
|
||||
|
@ -136,7 +136,7 @@ class Endstops {
|
||||
return enabled || TERN0(HAS_BED_PROBE, z_probe_enabled);
|
||||
}
|
||||
|
||||
static inline bool global_enabled() { return enabled_globally; }
|
||||
static bool global_enabled() { return enabled_globally; }
|
||||
|
||||
/**
|
||||
* Periodic call to poll endstops if required. Called from temperature ISR
|
||||
@ -168,7 +168,7 @@ class Endstops {
|
||||
;
|
||||
}
|
||||
|
||||
static inline bool probe_switch_activated() {
|
||||
static bool probe_switch_activated() {
|
||||
return (true
|
||||
#if ENABLED(PROBE_ACTIVATION_SWITCH)
|
||||
&& READ(PROBE_ACTIVATION_SWITCH_PIN) == PROBE_ACTIVATION_SWITCH_STATE
|
||||
|
@ -431,15 +431,15 @@ class Planner {
|
||||
static int8_t xy_freq_limit_hz; // Minimum XY frequency setting
|
||||
static float xy_freq_min_speed_factor; // Minimum speed factor setting
|
||||
static int32_t xy_freq_min_interval_us; // Minimum segment time based on xy_freq_limit_hz
|
||||
static inline void refresh_frequency_limit() {
|
||||
static void refresh_frequency_limit() {
|
||||
//xy_freq_min_interval_us = xy_freq_limit_hz ?: LROUND(1000000.0f / xy_freq_limit_hz);
|
||||
if (xy_freq_limit_hz)
|
||||
xy_freq_min_interval_us = LROUND(1000000.0f / xy_freq_limit_hz);
|
||||
}
|
||||
static inline void set_min_speed_factor_u8(const uint8_t v255) {
|
||||
static void set_min_speed_factor_u8(const uint8_t v255) {
|
||||
xy_freq_min_speed_factor = float(ui8_to_percent(v255)) / 100;
|
||||
}
|
||||
static inline void set_frequency_limit(const uint8_t hz) {
|
||||
static void set_frequency_limit(const uint8_t hz) {
|
||||
xy_freq_limit_hz = constrain(hz, 0, 100);
|
||||
refresh_frequency_limit();
|
||||
}
|
||||
@ -508,7 +508,7 @@ class Planner {
|
||||
#if HAS_CLASSIC_JERK
|
||||
static void set_max_jerk(const AxisEnum axis, float inMaxJerkMMS);
|
||||
#else
|
||||
static inline void set_max_jerk(const AxisEnum, const_float_t) {}
|
||||
static void set_max_jerk(const AxisEnum, const_float_t) {}
|
||||
#endif
|
||||
|
||||
#if HAS_EXTRUDERS
|
||||
@ -516,7 +516,7 @@ class Planner {
|
||||
e_factor[e] = flow_percentage[e] * 0.01f * TERN(NO_VOLUMETRICS, 1.0f, volumetric_multiplier[e]);
|
||||
}
|
||||
|
||||
static inline void set_flow(const uint8_t e, const int16_t flow) {
|
||||
static void set_flow(const uint8_t e, const int16_t flow) {
|
||||
flow_percentage[e] = flow;
|
||||
refresh_e_factor(e);
|
||||
}
|
||||
@ -539,7 +539,7 @@ class Planner {
|
||||
#if ENABLED(FILAMENT_WIDTH_SENSOR)
|
||||
void apply_filament_width_sensor(const int8_t encoded_ratio);
|
||||
|
||||
static inline float volumetric_percent(const bool vol) {
|
||||
static float volumetric_percent(const bool vol) {
|
||||
return 100.0f * (vol
|
||||
? volumetric_area_nominal / volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM]
|
||||
: volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM]
|
||||
@ -588,7 +588,7 @@ class Planner {
|
||||
* Returns 1.0 if planner.z_fade_height is 0.0.
|
||||
* Returns 0.0 if Z is past the specified 'Fade Height'.
|
||||
*/
|
||||
static inline float fade_scaling_factor_for_z(const_float_t rz) {
|
||||
static float fade_scaling_factor_for_z(const_float_t rz) {
|
||||
static float z_fade_factor = 1;
|
||||
if (!z_fade_height) return 1;
|
||||
if (rz >= z_fade_height) return 0;
|
||||
@ -838,7 +838,7 @@ class Planner {
|
||||
*/
|
||||
static float get_axis_position_mm(const AxisEnum axis);
|
||||
|
||||
static inline abce_pos_t get_axis_positions_mm() {
|
||||
static abce_pos_t get_axis_positions_mm() {
|
||||
const abce_pos_t out = LOGICAL_AXIS_ARRAY(
|
||||
get_axis_position_mm(E_AXIS),
|
||||
get_axis_position_mm(A_AXIS), get_axis_position_mm(B_AXIS), get_axis_position_mm(C_AXIS),
|
||||
@ -870,7 +870,7 @@ class Planner {
|
||||
static float triggered_position_mm(const AxisEnum axis);
|
||||
|
||||
// Blocks are queued, or we're running out moves, or the closed loop controller is waiting
|
||||
static inline bool busy() {
|
||||
static bool busy() {
|
||||
return (has_blocks_queued() || cleaning_buffer_counter
|
||||
|| TERN0(EXTERNAL_CLOSED_LOOP_CONTROLLER, CLOSED_LOOP_WAITING())
|
||||
);
|
||||
@ -938,7 +938,7 @@ class Planner {
|
||||
#if ENABLED(AUTOTEMP_PROPORTIONAL)
|
||||
static void _autotemp_update_from_hotend();
|
||||
#else
|
||||
static inline void _autotemp_update_from_hotend() {}
|
||||
static void _autotemp_update_from_hotend() {}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -112,7 +112,7 @@ class PrintCounter: public Stopwatch {
|
||||
/**
|
||||
* @brief Initialize the print counter
|
||||
*/
|
||||
static inline void init() {
|
||||
static void init() {
|
||||
super::init();
|
||||
loadStats();
|
||||
}
|
||||
@ -176,8 +176,8 @@ class PrintCounter: public Stopwatch {
|
||||
*/
|
||||
static bool start();
|
||||
static bool _stop(const bool completed);
|
||||
static inline bool stop() { return _stop(true); }
|
||||
static inline bool abort() { return _stop(false); }
|
||||
static bool stop() { return _stop(true); }
|
||||
static bool abort() { return _stop(false); }
|
||||
|
||||
static void reset();
|
||||
|
||||
|
@ -59,7 +59,7 @@ class MarlinSettings {
|
||||
static bool load(); // Return 'true' if data was loaded ok
|
||||
static bool validate(); // Return 'true' if EEPROM data is ok
|
||||
|
||||
static inline void first_load() {
|
||||
static void first_load() {
|
||||
static bool loaded = false;
|
||||
if (!loaded && load()) loaded = true;
|
||||
}
|
||||
|
@ -457,11 +457,11 @@ class Stepper {
|
||||
|
||||
// The stepper subsystem goes to sleep when it runs out of things to execute.
|
||||
// Call this to notify the subsystem that it is time to go to work.
|
||||
static inline void wake_up() { ENABLE_STEPPER_DRIVER_INTERRUPT(); }
|
||||
static void wake_up() { ENABLE_STEPPER_DRIVER_INTERRUPT(); }
|
||||
|
||||
static inline bool is_awake() { return STEPPER_ISR_ENABLED(); }
|
||||
static bool is_awake() { return STEPPER_ISR_ENABLED(); }
|
||||
|
||||
static inline bool suspend() {
|
||||
static bool suspend() {
|
||||
const bool awake = is_awake();
|
||||
if (awake) DISABLE_STEPPER_DRIVER_INTERRUPT();
|
||||
return awake;
|
||||
@ -564,7 +564,7 @@ class Stepper {
|
||||
FORCE_INLINE static void set_z4_lock(const bool state) { locked_Z4_motor = state; }
|
||||
#endif
|
||||
#endif
|
||||
static inline void set_all_z_lock(const bool lock, const int8_t except=-1) {
|
||||
static void set_all_z_lock(const bool lock, const int8_t except=-1) {
|
||||
set_z1_lock(lock ^ (except == 0));
|
||||
set_z2_lock(lock ^ (except == 1));
|
||||
#if NUM_Z_STEPPER_DRIVERS >= 3
|
||||
@ -586,16 +586,16 @@ class Stepper {
|
||||
|
||||
static axis_flags_t axis_enabled; // Axis stepper(s) ENABLED states
|
||||
|
||||
static inline bool axis_is_enabled(const AxisEnum axis E_OPTARG(const uint8_t eindex=0)) {
|
||||
static bool axis_is_enabled(const AxisEnum axis E_OPTARG(const uint8_t eindex=0)) {
|
||||
return TEST(axis_enabled.bits, INDEX_OF_AXIS(axis, eindex));
|
||||
}
|
||||
static inline void mark_axis_enabled(const AxisEnum axis E_OPTARG(const uint8_t eindex=0)) {
|
||||
static void mark_axis_enabled(const AxisEnum axis E_OPTARG(const uint8_t eindex=0)) {
|
||||
SBI(axis_enabled.bits, INDEX_OF_AXIS(axis, eindex));
|
||||
}
|
||||
static inline void mark_axis_disabled(const AxisEnum axis E_OPTARG(const uint8_t eindex=0)) {
|
||||
static void mark_axis_disabled(const AxisEnum axis E_OPTARG(const uint8_t eindex=0)) {
|
||||
CBI(axis_enabled.bits, INDEX_OF_AXIS(axis, eindex));
|
||||
}
|
||||
static inline bool can_axis_disable(const AxisEnum axis E_OPTARG(const uint8_t eindex=0)) {
|
||||
static bool can_axis_disable(const AxisEnum axis E_OPTARG(const uint8_t eindex=0)) {
|
||||
return !any_enable_overlap() || !(axis_enabled.bits & enable_overlap[INDEX_OF_AXIS(axis, eindex)]);
|
||||
}
|
||||
|
||||
@ -608,10 +608,10 @@ class Stepper {
|
||||
static void enable_e_steppers();
|
||||
static void disable_e_steppers();
|
||||
#else
|
||||
static inline void enable_extruder() {}
|
||||
static inline bool disable_extruder() { return true; }
|
||||
static inline void enable_e_steppers() {}
|
||||
static inline void disable_e_steppers() {}
|
||||
static void enable_extruder() {}
|
||||
static bool disable_extruder() { return true; }
|
||||
static void enable_e_steppers() {}
|
||||
static void disable_e_steppers() {}
|
||||
#endif
|
||||
|
||||
#define ENABLE_EXTRUDER(N) enable_extruder(E_TERN_(N))
|
||||
|
@ -359,7 +359,7 @@ class Temperature {
|
||||
#if HAS_HOTEND
|
||||
static hotend_info_t temp_hotend[HOTENDS];
|
||||
static const celsius_t hotend_maxtemp[HOTENDS];
|
||||
static inline celsius_t hotend_max_target(const uint8_t e) { return hotend_maxtemp[e] - (HOTEND_OVERSHOOT); }
|
||||
static celsius_t hotend_max_target(const uint8_t e) { return hotend_maxtemp[e] - (HOTEND_OVERSHOOT); }
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
static bed_info_t temp_bed;
|
||||
@ -402,16 +402,16 @@ class Temperature {
|
||||
#if ENABLED(PREVENT_COLD_EXTRUSION)
|
||||
static bool allow_cold_extrude;
|
||||
static celsius_t extrude_min_temp;
|
||||
static inline bool tooCold(const celsius_t temp) { return allow_cold_extrude ? false : temp < extrude_min_temp - (TEMP_WINDOW); }
|
||||
static inline bool tooColdToExtrude(const uint8_t E_NAME) { return tooCold(wholeDegHotend(HOTEND_INDEX)); }
|
||||
static inline bool targetTooColdToExtrude(const uint8_t E_NAME) { return tooCold(degTargetHotend(HOTEND_INDEX)); }
|
||||
static bool tooCold(const celsius_t temp) { return allow_cold_extrude ? false : temp < extrude_min_temp - (TEMP_WINDOW); }
|
||||
static bool tooColdToExtrude(const uint8_t E_NAME) { return tooCold(wholeDegHotend(HOTEND_INDEX)); }
|
||||
static bool targetTooColdToExtrude(const uint8_t E_NAME) { return tooCold(degTargetHotend(HOTEND_INDEX)); }
|
||||
#else
|
||||
static inline bool tooColdToExtrude(const uint8_t) { return false; }
|
||||
static inline bool targetTooColdToExtrude(const uint8_t) { return false; }
|
||||
static bool tooColdToExtrude(const uint8_t) { return false; }
|
||||
static bool targetTooColdToExtrude(const uint8_t) { return false; }
|
||||
#endif
|
||||
|
||||
static inline bool hotEnoughToExtrude(const uint8_t e) { return !tooColdToExtrude(e); }
|
||||
static inline bool targetHotEnoughToExtrude(const uint8_t e) { return !targetTooColdToExtrude(e); }
|
||||
static bool hotEnoughToExtrude(const uint8_t e) { return !tooColdToExtrude(e); }
|
||||
static bool targetHotEnoughToExtrude(const uint8_t e) { return !targetTooColdToExtrude(e); }
|
||||
|
||||
#if EITHER(SINGLENOZZLE_STANDBY_TEMP, SINGLENOZZLE_STANDBY_FAN)
|
||||
#if ENABLED(SINGLENOZZLE_STANDBY_TEMP)
|
||||
@ -449,7 +449,7 @@ class Temperature {
|
||||
};
|
||||
|
||||
// Convert the given heater_id_t to idle array index
|
||||
static inline IdleIndex idle_index_for_id(const int8_t heater_id) {
|
||||
static IdleIndex idle_index_for_id(const int8_t heater_id) {
|
||||
TERN_(HAS_HEATED_BED, if (heater_id == H_BED) return IDLE_INDEX_BED);
|
||||
return (IdleIndex)_MAX(heater_id, 0);
|
||||
}
|
||||
@ -525,7 +525,7 @@ class Temperature {
|
||||
#if HAS_FAN_LOGIC
|
||||
static millis_t fan_update_ms;
|
||||
|
||||
static inline void manage_extruder_fans(millis_t ms) {
|
||||
static void manage_extruder_fans(millis_t ms) {
|
||||
if (ELAPSED(ms, fan_update_ms)) { // only need to check fan state very infrequently
|
||||
const millis_t next_ms = ms + fan_update_interval_ms;
|
||||
#if HAS_PWMFANCHECK
|
||||
@ -566,25 +566,25 @@ class Temperature {
|
||||
static void M305_report(const uint8_t t_index, const bool forReplay=true);
|
||||
static void reset_user_thermistors();
|
||||
static celsius_float_t user_thermistor_to_deg_c(const uint8_t t_index, const int16_t raw);
|
||||
static inline bool set_pull_up_res(int8_t t_index, float value) {
|
||||
static bool set_pull_up_res(int8_t t_index, float value) {
|
||||
//if (!WITHIN(t_index, 0, USER_THERMISTORS - 1)) return false;
|
||||
if (!WITHIN(value, 1, 1000000)) return false;
|
||||
user_thermistor[t_index].series_res = value;
|
||||
return true;
|
||||
}
|
||||
static inline bool set_res25(int8_t t_index, float value) {
|
||||
static bool set_res25(int8_t t_index, float value) {
|
||||
if (!WITHIN(value, 1, 10000000)) return false;
|
||||
user_thermistor[t_index].res_25 = value;
|
||||
user_thermistor[t_index].pre_calc = true;
|
||||
return true;
|
||||
}
|
||||
static inline bool set_beta(int8_t t_index, float value) {
|
||||
static bool set_beta(int8_t t_index, float value) {
|
||||
if (!WITHIN(value, 1, 1000000)) return false;
|
||||
user_thermistor[t_index].beta = value;
|
||||
user_thermistor[t_index].pre_calc = true;
|
||||
return true;
|
||||
}
|
||||
static inline bool set_sh_coeff(int8_t t_index, float value) {
|
||||
static bool set_sh_coeff(int8_t t_index, float value) {
|
||||
if (!WITHIN(value, -0.01f, 0.01f)) return false;
|
||||
user_thermistor[t_index].sh_c_coeff = value;
|
||||
user_thermistor[t_index].pre_calc = true;
|
||||
@ -634,18 +634,18 @@ class Temperature {
|
||||
static uint8_t fan_speed_scaler[FAN_COUNT];
|
||||
#endif
|
||||
|
||||
static inline uint8_t scaledFanSpeed(const uint8_t fan, const uint8_t fs) {
|
||||
static uint8_t scaledFanSpeed(const uint8_t fan, const uint8_t fs) {
|
||||
UNUSED(fan); // Potentially unused!
|
||||
return (fs * uint16_t(TERN(ADAPTIVE_FAN_SLOWING, fan_speed_scaler[fan], 128))) >> 7;
|
||||
}
|
||||
|
||||
static inline uint8_t scaledFanSpeed(const uint8_t fan) {
|
||||
static uint8_t scaledFanSpeed(const uint8_t fan) {
|
||||
return scaledFanSpeed(fan, fan_speed[fan]);
|
||||
}
|
||||
|
||||
static constexpr inline uint8_t pwmToPercent(const uint8_t speed) { return ui8_to_percent(speed); }
|
||||
static inline uint8_t fanSpeedPercent(const uint8_t fan) { return ui8_to_percent(fan_speed[fan]); }
|
||||
static inline uint8_t scaledFanSpeedPercent(const uint8_t fan) { return ui8_to_percent(scaledFanSpeed(fan)); }
|
||||
static uint8_t fanSpeedPercent(const uint8_t fan) { return ui8_to_percent(fan_speed[fan]); }
|
||||
static uint8_t scaledFanSpeedPercent(const uint8_t fan) { return ui8_to_percent(scaledFanSpeed(fan)); }
|
||||
|
||||
#if ENABLED(EXTRA_FAN_SPEED)
|
||||
typedef struct { uint8_t saved, speed; } extra_fan_t;
|
||||
@ -659,7 +659,7 @@ class Temperature {
|
||||
|
||||
#endif // HAS_FAN
|
||||
|
||||
static inline void zero_fan_speeds() {
|
||||
static void zero_fan_speeds() {
|
||||
#if HAS_FAN
|
||||
FANS_LOOP(i) set_fan_speed(i, 0);
|
||||
#endif
|
||||
@ -680,13 +680,13 @@ class Temperature {
|
||||
* Preheating hotends
|
||||
*/
|
||||
#if MILLISECONDS_PREHEAT_TIME > 0
|
||||
static inline bool is_preheating(const uint8_t E_NAME) {
|
||||
static bool is_preheating(const uint8_t E_NAME) {
|
||||
return preheat_end_time[HOTEND_INDEX] && PENDING(millis(), preheat_end_time[HOTEND_INDEX]);
|
||||
}
|
||||
static inline void start_preheat_time(const uint8_t E_NAME) {
|
||||
static void start_preheat_time(const uint8_t E_NAME) {
|
||||
preheat_end_time[HOTEND_INDEX] = millis() + MILLISECONDS_PREHEAT_TIME;
|
||||
}
|
||||
static inline void reset_preheat_time(const uint8_t E_NAME) {
|
||||
static void reset_preheat_time(const uint8_t E_NAME) {
|
||||
preheat_end_time[HOTEND_INDEX] = 0;
|
||||
}
|
||||
#else
|
||||
@ -697,21 +697,21 @@ class Temperature {
|
||||
//inline so that there is no performance decrease.
|
||||
//deg=degreeCelsius
|
||||
|
||||
static inline celsius_float_t degHotend(const uint8_t E_NAME) {
|
||||
static celsius_float_t degHotend(const uint8_t E_NAME) {
|
||||
return TERN0(HAS_HOTEND, temp_hotend[HOTEND_INDEX].celsius);
|
||||
}
|
||||
|
||||
static inline celsius_t wholeDegHotend(const uint8_t E_NAME) {
|
||||
static celsius_t wholeDegHotend(const uint8_t E_NAME) {
|
||||
return TERN0(HAS_HOTEND, static_cast<celsius_t>(temp_hotend[HOTEND_INDEX].celsius + 0.5f));
|
||||
}
|
||||
|
||||
#if ENABLED(SHOW_TEMP_ADC_VALUES)
|
||||
static inline int16_t rawHotendTemp(const uint8_t E_NAME) {
|
||||
static int16_t rawHotendTemp(const uint8_t E_NAME) {
|
||||
return TERN0(HAS_HOTEND, temp_hotend[HOTEND_INDEX].raw);
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline celsius_t degTargetHotend(const uint8_t E_NAME) {
|
||||
static celsius_t degTargetHotend(const uint8_t E_NAME) {
|
||||
return TERN0(HAS_HOTEND, temp_hotend[HOTEND_INDEX].target);
|
||||
}
|
||||
|
||||
@ -730,11 +730,11 @@ class Temperature {
|
||||
start_watching_hotend(ee);
|
||||
}
|
||||
|
||||
static inline bool isHeatingHotend(const uint8_t E_NAME) {
|
||||
static bool isHeatingHotend(const uint8_t E_NAME) {
|
||||
return temp_hotend[HOTEND_INDEX].target > temp_hotend[HOTEND_INDEX].celsius;
|
||||
}
|
||||
|
||||
static inline bool isCoolingHotend(const uint8_t E_NAME) {
|
||||
static bool isCoolingHotend(const uint8_t E_NAME) {
|
||||
return temp_hotend[HOTEND_INDEX].target < temp_hotend[HOTEND_INDEX].celsius;
|
||||
}
|
||||
|
||||
@ -748,16 +748,16 @@ class Temperature {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static inline bool still_heating(const uint8_t e) {
|
||||
static bool still_heating(const uint8_t e) {
|
||||
return degTargetHotend(e) > TEMP_HYSTERESIS && ABS(wholeDegHotend(e) - degTargetHotend(e)) > TEMP_HYSTERESIS;
|
||||
}
|
||||
|
||||
static inline bool degHotendNear(const uint8_t e, const celsius_t temp) {
|
||||
static bool degHotendNear(const uint8_t e, const celsius_t temp) {
|
||||
return ABS(wholeDegHotend(e) - temp) < (TEMP_HYSTERESIS);
|
||||
}
|
||||
|
||||
// Start watching a Hotend to make sure it's really heating up
|
||||
static inline void start_watching_hotend(const uint8_t E_NAME) {
|
||||
static void start_watching_hotend(const uint8_t E_NAME) {
|
||||
UNUSED(HOTEND_INDEX);
|
||||
#if WATCH_HOTENDS
|
||||
watch_hotend[HOTEND_INDEX].restart(degHotend(HOTEND_INDEX), degTargetHotend(HOTEND_INDEX));
|
||||
@ -769,16 +769,16 @@ class Temperature {
|
||||
#if HAS_HEATED_BED
|
||||
|
||||
#if ENABLED(SHOW_TEMP_ADC_VALUES)
|
||||
static inline int16_t rawBedTemp() { return temp_bed.raw; }
|
||||
static int16_t rawBedTemp() { return temp_bed.raw; }
|
||||
#endif
|
||||
static inline celsius_float_t degBed() { return temp_bed.celsius; }
|
||||
static inline celsius_t wholeDegBed() { return static_cast<celsius_t>(degBed() + 0.5f); }
|
||||
static inline celsius_t degTargetBed() { return temp_bed.target; }
|
||||
static inline bool isHeatingBed() { return temp_bed.target > temp_bed.celsius; }
|
||||
static inline bool isCoolingBed() { return temp_bed.target < temp_bed.celsius; }
|
||||
static celsius_float_t degBed() { return temp_bed.celsius; }
|
||||
static celsius_t wholeDegBed() { return static_cast<celsius_t>(degBed() + 0.5f); }
|
||||
static celsius_t degTargetBed() { return temp_bed.target; }
|
||||
static bool isHeatingBed() { return temp_bed.target > temp_bed.celsius; }
|
||||
static bool isCoolingBed() { return temp_bed.target < temp_bed.celsius; }
|
||||
|
||||
// Start watching the Bed to make sure it's really heating up
|
||||
static inline void start_watching_bed() { TERN_(WATCH_BED, watch_bed.restart(degBed(), degTargetBed())); }
|
||||
static void start_watching_bed() { TERN_(WATCH_BED, watch_bed.restart(degBed(), degTargetBed())); }
|
||||
|
||||
static void setTargetBed(const celsius_t celsius) {
|
||||
TERN_(AUTO_POWER_CONTROL, if (celsius) powerManager.power_on());
|
||||
@ -792,7 +792,7 @@ class Temperature {
|
||||
|
||||
static void wait_for_bed_heating();
|
||||
|
||||
static inline bool degBedNear(const celsius_t temp) {
|
||||
static bool degBedNear(const celsius_t temp) {
|
||||
return ABS(wholeDegBed() - temp) < (TEMP_BED_HYSTERESIS);
|
||||
}
|
||||
|
||||
@ -800,25 +800,25 @@ class Temperature {
|
||||
|
||||
#if HAS_TEMP_PROBE
|
||||
#if ENABLED(SHOW_TEMP_ADC_VALUES)
|
||||
static inline int16_t rawProbeTemp() { return temp_probe.raw; }
|
||||
static int16_t rawProbeTemp() { return temp_probe.raw; }
|
||||
#endif
|
||||
static inline celsius_float_t degProbe() { return temp_probe.celsius; }
|
||||
static inline celsius_t wholeDegProbe() { return static_cast<celsius_t>(degProbe() + 0.5f); }
|
||||
static inline bool isProbeBelowTemp(const celsius_t target_temp) { return wholeDegProbe() < target_temp; }
|
||||
static inline bool isProbeAboveTemp(const celsius_t target_temp) { return wholeDegProbe() > target_temp; }
|
||||
static celsius_float_t degProbe() { return temp_probe.celsius; }
|
||||
static celsius_t wholeDegProbe() { return static_cast<celsius_t>(degProbe() + 0.5f); }
|
||||
static bool isProbeBelowTemp(const celsius_t target_temp) { return wholeDegProbe() < target_temp; }
|
||||
static bool isProbeAboveTemp(const celsius_t target_temp) { return wholeDegProbe() > target_temp; }
|
||||
static bool wait_for_probe(const celsius_t target_temp, bool no_wait_for_cooling=true);
|
||||
#endif
|
||||
|
||||
#if HAS_TEMP_CHAMBER
|
||||
#if ENABLED(SHOW_TEMP_ADC_VALUES)
|
||||
static inline int16_t rawChamberTemp() { return temp_chamber.raw; }
|
||||
static int16_t rawChamberTemp() { return temp_chamber.raw; }
|
||||
#endif
|
||||
static inline celsius_float_t degChamber() { return temp_chamber.celsius; }
|
||||
static inline celsius_t wholeDegChamber() { return static_cast<celsius_t>(degChamber() + 0.5f); }
|
||||
static celsius_float_t degChamber() { return temp_chamber.celsius; }
|
||||
static celsius_t wholeDegChamber() { return static_cast<celsius_t>(degChamber() + 0.5f); }
|
||||
#if HAS_HEATED_CHAMBER
|
||||
static inline celsius_t degTargetChamber() { return temp_chamber.target; }
|
||||
static inline bool isHeatingChamber() { return temp_chamber.target > temp_chamber.celsius; }
|
||||
static inline bool isCoolingChamber() { return temp_chamber.target < temp_chamber.celsius; }
|
||||
static celsius_t degTargetChamber() { return temp_chamber.target; }
|
||||
static bool isHeatingChamber() { return temp_chamber.target > temp_chamber.celsius; }
|
||||
static bool isCoolingChamber() { return temp_chamber.target < temp_chamber.celsius; }
|
||||
static bool wait_for_chamber(const bool no_wait_for_cooling=true);
|
||||
#endif
|
||||
#endif
|
||||
@ -829,49 +829,49 @@ class Temperature {
|
||||
start_watching_chamber();
|
||||
}
|
||||
// Start watching the Chamber to make sure it's really heating up
|
||||
static inline void start_watching_chamber() { TERN_(WATCH_CHAMBER, watch_chamber.restart(degChamber(), degTargetChamber())); }
|
||||
static void start_watching_chamber() { TERN_(WATCH_CHAMBER, watch_chamber.restart(degChamber(), degTargetChamber())); }
|
||||
#endif
|
||||
|
||||
#if HAS_TEMP_COOLER
|
||||
#if ENABLED(SHOW_TEMP_ADC_VALUES)
|
||||
static inline int16_t rawCoolerTemp() { return temp_cooler.raw; }
|
||||
static int16_t rawCoolerTemp() { return temp_cooler.raw; }
|
||||
#endif
|
||||
static inline celsius_float_t degCooler() { return temp_cooler.celsius; }
|
||||
static inline celsius_t wholeDegCooler() { return static_cast<celsius_t>(temp_cooler.celsius + 0.5f); }
|
||||
static celsius_float_t degCooler() { return temp_cooler.celsius; }
|
||||
static celsius_t wholeDegCooler() { return static_cast<celsius_t>(temp_cooler.celsius + 0.5f); }
|
||||
#if HAS_COOLER
|
||||
static inline celsius_t degTargetCooler() { return temp_cooler.target; }
|
||||
static inline bool isLaserHeating() { return temp_cooler.target > temp_cooler.celsius; }
|
||||
static inline bool isLaserCooling() { return temp_cooler.target < temp_cooler.celsius; }
|
||||
static celsius_t degTargetCooler() { return temp_cooler.target; }
|
||||
static bool isLaserHeating() { return temp_cooler.target > temp_cooler.celsius; }
|
||||
static bool isLaserCooling() { return temp_cooler.target < temp_cooler.celsius; }
|
||||
static bool wait_for_cooler(const bool no_wait_for_cooling=true);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if HAS_TEMP_BOARD
|
||||
#if ENABLED(SHOW_TEMP_ADC_VALUES)
|
||||
static inline int16_t rawBoardTemp() { return temp_board.raw; }
|
||||
static int16_t rawBoardTemp() { return temp_board.raw; }
|
||||
#endif
|
||||
static inline celsius_float_t degBoard() { return temp_board.celsius; }
|
||||
static inline celsius_t wholeDegBoard() { return static_cast<celsius_t>(temp_board.celsius + 0.5f); }
|
||||
static celsius_float_t degBoard() { return temp_board.celsius; }
|
||||
static celsius_t wholeDegBoard() { return static_cast<celsius_t>(temp_board.celsius + 0.5f); }
|
||||
#endif
|
||||
|
||||
#if HAS_TEMP_REDUNDANT
|
||||
#if ENABLED(SHOW_TEMP_ADC_VALUES)
|
||||
static inline int16_t rawRedundantTemp() { return temp_redundant.raw; }
|
||||
static inline int16_t rawRedundanTargetTemp() { return (*temp_redundant.target).raw; }
|
||||
static int16_t rawRedundantTemp() { return temp_redundant.raw; }
|
||||
static int16_t rawRedundanTargetTemp() { return (*temp_redundant.target).raw; }
|
||||
#endif
|
||||
static inline celsius_float_t degRedundant() { return temp_redundant.celsius; }
|
||||
static inline celsius_float_t degRedundantTarget() { return (*temp_redundant.target).celsius; }
|
||||
static inline celsius_t wholeDegRedundant() { return static_cast<celsius_t>(temp_redundant.celsius + 0.5f); }
|
||||
static inline celsius_t wholeDegRedundantTarget() { return static_cast<celsius_t>((*temp_redundant.target).celsius + 0.5f); }
|
||||
static celsius_float_t degRedundant() { return temp_redundant.celsius; }
|
||||
static celsius_float_t degRedundantTarget() { return (*temp_redundant.target).celsius; }
|
||||
static celsius_t wholeDegRedundant() { return static_cast<celsius_t>(temp_redundant.celsius + 0.5f); }
|
||||
static celsius_t wholeDegRedundantTarget() { return static_cast<celsius_t>((*temp_redundant.target).celsius + 0.5f); }
|
||||
#endif
|
||||
|
||||
#if HAS_COOLER
|
||||
static inline void setTargetCooler(const celsius_t celsius) {
|
||||
static void setTargetCooler(const celsius_t celsius) {
|
||||
temp_cooler.target = constrain(celsius, COOLER_MIN_TARGET, COOLER_MAX_TARGET);
|
||||
start_watching_cooler();
|
||||
}
|
||||
// Start watching the Cooler to make sure it's really cooling down
|
||||
static inline void start_watching_cooler() { TERN_(WATCH_COOLER, watch_cooler.restart(degCooler(), degTargetCooler())); }
|
||||
static void start_watching_cooler() { TERN_(WATCH_COOLER, watch_cooler.restart(degCooler(), degTargetCooler())); }
|
||||
#endif
|
||||
|
||||
/**
|
||||
@ -887,7 +887,7 @@ class Temperature {
|
||||
/**
|
||||
* Cooldown, as from the LCD. Disables all heaters and fans.
|
||||
*/
|
||||
static inline void cooldown() {
|
||||
static void cooldown() {
|
||||
zero_fan_speeds();
|
||||
disable_all_heaters();
|
||||
}
|
||||
@ -921,7 +921,7 @@ class Temperature {
|
||||
* Update the temp manager when PID values change
|
||||
*/
|
||||
#if ENABLED(PIDTEMP)
|
||||
static inline void updatePID() {
|
||||
static void updatePID() {
|
||||
TERN_(PID_EXTRUSION_SCALING, last_e_position = 0);
|
||||
}
|
||||
#endif
|
||||
@ -934,13 +934,13 @@ class Temperature {
|
||||
|
||||
#if HEATER_IDLE_HANDLER
|
||||
|
||||
static inline void reset_hotend_idle_timer(const uint8_t E_NAME) {
|
||||
static void reset_hotend_idle_timer(const uint8_t E_NAME) {
|
||||
heater_idle[HOTEND_INDEX].reset();
|
||||
start_watching_hotend(HOTEND_INDEX);
|
||||
}
|
||||
|
||||
#if HAS_HEATED_BED
|
||||
static inline void reset_bed_idle_timer() {
|
||||
static void reset_bed_idle_timer() {
|
||||
heater_idle[IDLE_INDEX_BED].reset();
|
||||
start_watching_bed();
|
||||
}
|
||||
@ -961,7 +961,7 @@ class Temperature {
|
||||
#if HAS_HOTEND && HAS_STATUS_MESSAGE
|
||||
static void set_heating_message(const uint8_t e);
|
||||
#else
|
||||
static inline void set_heating_message(const uint8_t) {}
|
||||
static void set_heating_message(const uint8_t) {}
|
||||
#endif
|
||||
|
||||
#if HAS_LCD_MENU && HAS_TEMPERATURE
|
||||
@ -974,7 +974,7 @@ class Temperature {
|
||||
static volatile bool raw_temps_ready;
|
||||
static void update_raw_temperatures();
|
||||
static void updateTemperaturesFromRawValues();
|
||||
static inline bool updateTemperaturesIfReady() {
|
||||
static bool updateTemperaturesIfReady() {
|
||||
if (!raw_temps_ready) return false;
|
||||
updateTemperaturesFromRawValues();
|
||||
raw_temps_ready = false;
|
||||
@ -1028,7 +1028,7 @@ class Temperature {
|
||||
};
|
||||
|
||||
// Convert the given heater_id_t to runaway state array index
|
||||
static inline RunawayIndex runaway_index_for_id(const int8_t heater_id) {
|
||||
static RunawayIndex runaway_index_for_id(const int8_t heater_id) {
|
||||
TERN_(HAS_THERMALLY_PROTECTED_CHAMBER, if (heater_id == H_CHAMBER) return RUNAWAY_IND_CHAMBER);
|
||||
TERN_(HAS_THERMALLY_PROTECTED_CHAMBER, if (heater_id == H_COOLER) return RUNAWAY_IND_COOLER);
|
||||
TERN_(HAS_THERMALLY_PROTECTED_BED, if (heater_id == H_BED) return RUNAWAY_IND_BED);
|
||||
|
@ -115,7 +115,7 @@ public:
|
||||
|
||||
static void mount();
|
||||
static void release();
|
||||
static inline bool isMounted() { return flag.mounted; }
|
||||
static bool isMounted() { return flag.mounted; }
|
||||
|
||||
// Handle media insert/remove
|
||||
static void manage_media();
|
||||
@ -128,7 +128,7 @@ public:
|
||||
static uint8_t autofile_index; // Next auto#.g index to run, plus one. Ignored by autofile_check when zero.
|
||||
static void autofile_begin(); // Begin check. Called automatically after boot-up.
|
||||
static bool autofile_check(); // Check for the next auto-start file and run it.
|
||||
static inline void autofile_cancel() { autofile_index = 0; }
|
||||
static void autofile_cancel() { autofile_index = 0; }
|
||||
#endif
|
||||
|
||||
// Basic file ops
|
||||
@ -138,7 +138,7 @@ public:
|
||||
static bool fileExists(const char * const name);
|
||||
static void removeFile(const char * const name);
|
||||
|
||||
static inline char* longest_filename() { return longFilename[0] ? longFilename : filename; }
|
||||
static char* longest_filename() { return longFilename[0] ? longFilename : filename; }
|
||||
#if ENABLED(LONG_FILENAME_HOST_SUPPORT)
|
||||
static void printLongPath(char * const path); // Used by M33
|
||||
#endif
|
||||
@ -163,18 +163,18 @@ public:
|
||||
static void endFilePrintNow(TERN_(SD_RESORT, const bool re_sort=false));
|
||||
static void abortFilePrintNow(TERN_(SD_RESORT, const bool re_sort=false));
|
||||
static void fileHasFinished();
|
||||
static inline void abortFilePrintSoon() { flag.abort_sd_printing = isFileOpen(); }
|
||||
static inline void pauseSDPrint() { flag.sdprinting = false; }
|
||||
static inline bool isPrinting() { return flag.sdprinting; }
|
||||
static inline bool isPaused() { return isFileOpen() && !isPrinting(); }
|
||||
static void abortFilePrintSoon() { flag.abort_sd_printing = isFileOpen(); }
|
||||
static void pauseSDPrint() { flag.sdprinting = false; }
|
||||
static bool isPrinting() { return flag.sdprinting; }
|
||||
static bool isPaused() { return isFileOpen() && !isPrinting(); }
|
||||
#if HAS_PRINT_PROGRESS_PERMYRIAD
|
||||
static inline uint16_t permyriadDone() {
|
||||
static uint16_t permyriadDone() {
|
||||
if (flag.sdprintdone) return 10000;
|
||||
if (isFileOpen() && filesize) return sdpos / ((filesize + 9999) / 10000);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
static inline uint8_t percentDone() {
|
||||
static uint8_t percentDone() {
|
||||
if (flag.sdprintdone) return 100;
|
||||
if (isFileOpen() && filesize) return sdpos / ((filesize + 99) / 100);
|
||||
return 0;
|
||||
@ -213,20 +213,20 @@ public:
|
||||
#endif
|
||||
|
||||
// Current Working Dir - Set by cd, cdup, cdroot, and diveToFile(true, ...)
|
||||
static inline char* getWorkDirName() { workDir.getDosName(filename); return filename; }
|
||||
static inline SdFile& getWorkDir() { return workDir.isOpen() ? workDir : root; }
|
||||
static char* getWorkDirName() { workDir.getDosName(filename); return filename; }
|
||||
static SdFile& getWorkDir() { return workDir.isOpen() ? workDir : root; }
|
||||
|
||||
// Print File stats
|
||||
static inline uint32_t getFileSize() { return filesize; }
|
||||
static inline uint32_t getIndex() { return sdpos; }
|
||||
static inline bool isFileOpen() { return isMounted() && file.isOpen(); }
|
||||
static inline bool eof() { return getIndex() >= getFileSize(); }
|
||||
static uint32_t getFileSize() { return filesize; }
|
||||
static uint32_t getIndex() { return sdpos; }
|
||||
static bool isFileOpen() { return isMounted() && file.isOpen(); }
|
||||
static bool eof() { return getIndex() >= getFileSize(); }
|
||||
|
||||
// File data operations
|
||||
static inline int16_t get() { int16_t out = (int16_t)file.read(); sdpos = file.curPosition(); return out; }
|
||||
static inline int16_t read(void *buf, uint16_t nbyte) { return file.isOpen() ? file.read(buf, nbyte) : -1; }
|
||||
static inline int16_t write(void *buf, uint16_t nbyte) { return file.isOpen() ? file.write(buf, nbyte) : -1; }
|
||||
static inline void setIndex(const uint32_t index) { file.seekSet((sdpos = index)); }
|
||||
static int16_t get() { int16_t out = (int16_t)file.read(); sdpos = file.curPosition(); return out; }
|
||||
static int16_t read(void *buf, uint16_t nbyte) { return file.isOpen() ? file.read(buf, nbyte) : -1; }
|
||||
static int16_t write(void *buf, uint16_t nbyte) { return file.isOpen() ? file.write(buf, nbyte) : -1; }
|
||||
static void setIndex(const uint32_t index) { file.seekSet((sdpos = index)); }
|
||||
|
||||
// TODO: rename to diskIODriver()
|
||||
static DiskIODriver* diskIODriver() { return driver; }
|
||||
|
Loading…
Reference in New Issue
Block a user