Skip to content

Commit

Permalink
Merge branch 'bugfix-2.0.x' into pr/23373
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Dec 31, 2021
2 parents b85d202 + b078876 commit 0356f64
Show file tree
Hide file tree
Showing 119 changed files with 937 additions and 921 deletions.
2 changes: 1 addition & 1 deletion Marlin/Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
* here we define this default string as the date where the latest release
* version was tagged.
*/
//#define STRING_DISTRIBUTION_DATE "2021-12-28"
//#define STRING_DISTRIBUTION_DATE "2021-12-31"

/**
* Defines a generic printer name to be output to the LCD after booting Marlin.
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/AVR/MarlinSerial.h
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/DUE/MarlinSerial.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class MarlinSerial {
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; }
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/DUE/MarlinSerialUSB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ extern "C" {
int udi_cdc_getc();
bool udi_cdc_is_tx_ready();
int udi_cdc_putc(int value);
};
}

// Pending character
static int pending_char = -1;
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/DUE/usb/sd_mmc_spi_mem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include "../../../sd/cardreader.h"
extern "C" {
#include "sd_mmc_spi_mem.h"
#include "sd_mmc_spi_mem.h"
}

#define SD_MMC_BLOCK_SIZE 512
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/LPC1768/include/SPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class SPISettings {

//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
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/HAL/LPC1768/tft/xpt2046.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ class XPT2046 {
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
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/HAL/NATIVE_SIM/tft/xpt2046.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ class XPT2046 {
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
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/HAL/STM32/tft/xpt2046.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ class XPT2046 {
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); }
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/STM32F1/SPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ class SPIClass {
/**
* @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
}
Expand Down
14 changes: 7 additions & 7 deletions Marlin/src/HAL/STM32F1/pinsDebug.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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;
Expand All @@ -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];
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/HAL/STM32F1/tft/xpt2046.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ class XPT2046 {
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
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/HAL/shared/eeprom_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,19 @@ class PersistentStore {

// 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);
}

// 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);
Expand Down
16 changes: 8 additions & 8 deletions Marlin/src/core/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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...)); }

}

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/core/serial_hook.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class SerialMask {
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
}
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/feature/babystep.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class Babystep {

#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;
}
Expand All @@ -63,15 +63,15 @@ class Babystep {
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)];
}

//
// 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));
}

Expand Down
10 changes: 5 additions & 5 deletions Marlin/src/feature/backlash.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ class Backlash {
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;
Expand All @@ -53,7 +53,7 @@ class Backlash {
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
Expand All @@ -62,12 +62,12 @@ class Backlash {
);
}

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);
}

Expand Down
10 changes: 5 additions & 5 deletions Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class mesh_bed_leveling {

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
Expand All @@ -78,10 +78,10 @@ class mesh_bed_leveling {
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);
Expand All @@ -91,10 +91,10 @@ class mesh_bed_leveling {
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),
Expand Down
Loading

0 comments on commit 0356f64

Please sign in to comment.