diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
index 54627d462b..77479946b5 100644
--- a/.devcontainer/devcontainer.json
+++ b/.devcontainer/devcontainer.json
@@ -38,7 +38,7 @@
"platformio.platformio-ide",
"marlinfirmware.auto-build",
"editorconfig.editorconfig"
- ],
+ ]
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
diff --git a/.github/workflows/ci-validate-boards.yml b/.github/workflows/ci-validate-boards.yml
index 36f3a3522a..aa6d284f06 100644
--- a/.github/workflows/ci-validate-boards.yml
+++ b/.github/workflows/ci-validate-boards.yml
@@ -9,14 +9,14 @@ name: CI - Validate boards.h
on:
pull_request:
branches:
- - bugfix-2.1.x
+ - bugfix-2.1.x
paths:
- - 'Marlin/src/core/boards.h'
+ - "Marlin/src/core/boards.h"
push:
branches:
- - bugfix-2.1.x
+ - bugfix-2.1.x
paths:
- - 'Marlin/src/core/boards.h'
+ - "Marlin/src/core/boards.h"
jobs:
validate_pins_files:
@@ -26,23 +26,23 @@ jobs:
runs-on: ubuntu-22.04
steps:
- - name: Check out the PR
- uses: actions/checkout@v4
+ - name: Check out the PR
+ uses: actions/checkout@v4
- - name: Cache pip
- uses: actions/cache@v4
- with:
- path: ~/.cache/pip
- key: ${{ runner.os }}-pip-boards-v1
- restore-keys: |
- ${{ runner.os }}-pip-boards-
+ - name: Cache pip
+ uses: actions/cache@v4
+ with:
+ path: ~/.cache/pip
+ key: ${{ runner.os }}-pip-validation-v1
+ restore-keys: |
+ ${{ runner.os }}-pip-validation-
- - name: Select Python 3.9
- uses: actions/setup-python@v5
- with:
- python-version: '3.9'
- architecture: 'x64'
+ - name: Select Python 3.9
+ uses: actions/setup-python@v5
+ with:
+ python-version: "3.9"
+ architecture: "x64"
- - name: Validate core/boards.h
- run: |
- make validate-boards -j
+ - name: Validate core/boards.h
+ run: |
+ make validate-boards -j
diff --git a/.github/workflows/ci-validate-lines.yml b/.github/workflows/ci-validate-lines.yml
new file mode 100644
index 0000000000..367db12e6c
--- /dev/null
+++ b/.github/workflows/ci-validate-lines.yml
@@ -0,0 +1,40 @@
+#
+# ci-validate-lines.yml
+# Validate that all text files are unchanged by linesformat.py
+#
+
+name: CI - Validate Source Files
+
+on:
+ pull_request:
+ branches:
+ - bugfix-2.1.x
+ - 2.1.x
+ push:
+ branches:
+ - bugfix-2.1.x
+ - 2.1.x
+
+jobs:
+ validate_source_files:
+ name: Validate Source Files
+ if: github.repository == 'MarlinFirmware/Marlin'
+
+ runs-on: ubuntu-22.04
+
+ steps:
+ - name: Check out the PR
+ uses: actions/checkout@v4
+
+ - name: Cache node_modules
+ uses: actions/cache@v4
+ with:
+ path: node_modules
+ key: ${{ runner.os }}-npm-lines-v1
+ restore-keys: |
+ ${{ runner.os }}-npm-lines-
+
+ - name: Validate text file formatting
+ run: |
+ npm install --save-dev prettier
+ make validate-lines -j
diff --git a/.github/workflows/ci-validate-pins.yml b/.github/workflows/ci-validate-pins.yml
index ae777427e7..2086fea37a 100644
--- a/.github/workflows/ci-validate-pins.yml
+++ b/.github/workflows/ci-validate-pins.yml
@@ -8,18 +8,18 @@ name: CI - Validate Pins Files
on:
pull_request:
branches:
- - bugfix-2.1.x
+ - bugfix-2.1.x
# Cannot be enabled on 2.1.x until it contains the unit test framework
#- 2.1.x
paths:
- - 'Marlin/src/pins/*/**'
+ - "Marlin/src/pins/*/**"
push:
branches:
- - bugfix-2.1.x
+ - bugfix-2.1.x
# Cannot be enabled on 2.1.x until it contains the unit test framework
#- 2.1.x
paths:
- - 'Marlin/src/pins/*/**'
+ - "Marlin/src/pins/*/**"
jobs:
validate_pins_files:
@@ -29,23 +29,23 @@ jobs:
runs-on: ubuntu-22.04
steps:
- - name: Check out the PR
- uses: actions/checkout@v4
+ - name: Check out the PR
+ uses: actions/checkout@v4
- - name: Cache pip
- uses: actions/cache@v4
- with:
- path: ~/.cache/pip
- key: ${{ runner.os }}-pip-pins-v1
- restore-keys: |
- ${{ runner.os }}-pip-pins-
+ - name: Cache pip
+ uses: actions/cache@v4
+ with:
+ path: ~/.cache/pip
+ key: ${{ runner.os }}-pip-validation-v1
+ restore-keys: |
+ ${{ runner.os }}-pip-validation-
- - name: Select Python 3.9
- uses: actions/setup-python@v5
- with:
- python-version: '3.9'
- architecture: 'x64'
+ - name: Select Python 3.9
+ uses: actions/setup-python@v5
+ with:
+ python-version: "3.9"
+ architecture: "x64"
- - name: Validate all pins files
- run: |
- make validate-pins -j
+ - name: Validate all pins files
+ run: |
+ make validate-pins -j
diff --git a/.gitignore b/.gitignore
index 0a8668c82c..761661dda9 100755
--- a/.gitignore
+++ b/.gitignore
@@ -31,6 +31,11 @@ out-language/
*.gen
*.sublime-workspace
+# npm
+node_modules/
+package.json
+package-lock.json
+
# OS
applet/
.DS_Store
diff --git a/.prettierignore b/.prettierignore
new file mode 100644
index 0000000000..62761b99e9
--- /dev/null
+++ b/.prettierignore
@@ -0,0 +1,10 @@
+# Prettier Ignore file
+*.min.js
+web-ui/
+buildroot/share/PlatformIO/boards
+buildroot/share/PlatformIO/variants
+*.sublime-project
+*.sublime-syntax
+.github
+.vscode
+launch.json
diff --git a/Makefile b/Makefile
index 23826497b6..f1f64e1342 100644
--- a/Makefile
+++ b/Makefile
@@ -8,6 +8,7 @@ help:
@echo "Tasks for local development:"
@echo "make marlin : Build Marlin for the configured board"
@echo "make format-pins -j : Reformat all pins files (-j for parallel execution)"
+ @echo "make validate-lines -j : Validate line endings, fails on trailing whitespace, etc."
@echo "make validate-pins -j : Validate all pins files, fails if any require reformatting"
@echo "make validate-boards -j : Validate boards.h and pins.h for standards compliance"
@echo "make tests-single-ci : Run a single test from inside the CI"
@@ -95,7 +96,7 @@ PINS := $(shell find Marlin/src/pins -mindepth 2 -name '*.h')
.PHONY: $(PINS) format-pins validate-pins
$(PINS): %:
- @echo "Formatting $@"
+ @echo "Formatting pins $@"
@python $(SCRIPTS_DIR)/pinsformat.py $< $@
format-pins: $(PINS)
@@ -104,6 +105,17 @@ validate-pins: format-pins
@echo "Validating pins files"
@git diff --exit-code || (git status && echo "\nError: Pins files are not formatted correctly. Run \"make format-pins\" to fix.\n" && exit 1)
+.PHONY: format-lines validate-lines
+
+format-lines:
+ @echo "Formatting all sources"
+ @python $(SCRIPTS_DIR)/linesformat.py buildroot
+ @python $(SCRIPTS_DIR)/linesformat.py Marlin
+
+validate-lines:
+ @echo "Validating text formatting"
+ @npx prettier --check . --editorconfig --object-wrap preserve
+
BOARDS_FILE := Marlin/src/core/boards.h
.PHONY: validate-boards
diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h
index 9f1aaf0690..40b8ba5f22 100644
--- a/Marlin/Configuration.h
+++ b/Marlin/Configuration.h
@@ -3514,6 +3514,11 @@
//#define DWIN_MARLINUI_PORTRAIT // MarlinUI (portrait orientation)
//#define DWIN_MARLINUI_LANDSCAPE // MarlinUI (landscape orientation)
+#if ENABLED(DWIN_CREALITY_LCD)
+ //#define USE_STRING_HEADINGS // Use string headings for Creality UI instead of images
+ //#define USE_STRING_TITLES // Use string titles for Creality UI instead of images
+#endif
+
//
// Touch Screen Settings
//
diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h
index bcf9098bc6..215f1f8026 100644
--- a/Marlin/Configuration_adv.h
+++ b/Marlin/Configuration_adv.h
@@ -1150,16 +1150,18 @@
#if ENABLED(FT_MOTION)
//#define FTM_IS_DEFAULT_MOTION // Use FT Motion as the factory default?
#define FTM_DEFAULT_DYNFREQ_MODE dynFreqMode_DISABLED // Default mode of dynamic frequency calculation. (DISABLED, Z_BASED, MASS_BASED)
- #define FTM_DEFAULT_SHAPER_X ftMotionShaper_NONE // Default shaper mode on X axis (NONE, ZV, ZVD, ZVDD, ZVDDD, EI, 2HEI, 3HEI, MZV)
- #define FTM_DEFAULT_SHAPER_Y ftMotionShaper_NONE // Default shaper mode on Y axis
- #define FTM_SHAPING_DEFAULT_FREQ_X 37.0f // (Hz) Default peak frequency used by input shapers
- #define FTM_SHAPING_DEFAULT_FREQ_Y 37.0f // (Hz) Default peak frequency used by input shapers
+
#define FTM_LINEAR_ADV_DEFAULT_ENA false // Default linear advance enable (true) or disable (false)
#define FTM_LINEAR_ADV_DEFAULT_K 0.0f // Default linear advance gain. (Acceleration-based scaling factor.)
- #define FTM_SHAPING_ZETA_X 0.1f // Zeta used by input shapers for X axis
- #define FTM_SHAPING_ZETA_Y 0.1f // Zeta used by input shapers for Y axis
+ #define FTM_DEFAULT_SHAPER_X ftMotionShaper_NONE // Default shaper mode on X axis (NONE, ZV, ZVD, ZVDD, ZVDDD, EI, 2HEI, 3HEI, MZV)
+ #define FTM_SHAPING_DEFAULT_FREQ_X 37.0f // (Hz) Default peak frequency used by input shapers
+ #define FTM_SHAPING_ZETA_X 0.1f // Zeta used by input shapers for X axis
#define FTM_SHAPING_V_TOL_X 0.05f // Vibration tolerance used by EI input shapers for X axis
+
+ #define FTM_DEFAULT_SHAPER_Y ftMotionShaper_NONE // Default shaper mode on Y axis
+ #define FTM_SHAPING_DEFAULT_FREQ_Y 37.0f // (Hz) Default peak frequency used by input shapers
+ #define FTM_SHAPING_ZETA_Y 0.1f // Zeta used by input shapers for Y axis
#define FTM_SHAPING_V_TOL_Y 0.05f // Vibration tolerance used by EI input shapers for Y axis
//#define FT_MOTION_MENU // Provide a MarlinUI menu to set M493 parameters
@@ -1192,7 +1194,6 @@
#endif
#define FTM_STEPS_PER_UNIT_TIME (FTM_STEPPER_FS / FTM_FS) // Interpolated stepper commands per unit time
- #define FTM_CTS_COMPARE_VAL (FTM_STEPS_PER_UNIT_TIME / 2) // Comparison value used in interpolation algorithm
#define FTM_MIN_TICKS ((STEPPER_TIMER_RATE) / (FTM_STEPPER_FS)) // Minimum stepper ticks between steps
#define FTM_MIN_SHAPE_FREQ 10 // Minimum shaping frequency
@@ -3517,6 +3518,7 @@
//#define W_STALL_SENSITIVITY 8
//#define SPI_ENDSTOPS // TMC2130, TMC2240, and TMC5160
//#define IMPROVE_HOMING_RELIABILITY
+ //#define SENSORLESS_STALLGUARD_DELAY 0 // (ms) Delay to allow drivers to settle
#endif
// @section tmc/config
@@ -4004,7 +4006,7 @@
#endif
/**
- * M115 - Report capabilites. Disable to save ~1150 bytes of flash.
+ * M115 - Report capabilities. Disable to save ~1150 bytes of flash.
* Some hosts (and serial TFT displays) rely on this feature.
*/
#define CAPABILITIES_REPORT
diff --git a/Marlin/Version.h b/Marlin/Version.h
index adb6f37817..3ffdf4d71c 100644
--- a/Marlin/Version.h
+++ b/Marlin/Version.h
@@ -41,7 +41,7 @@
* here we define this default string as the date where the latest release
* version was tagged.
*/
-//#define STRING_DISTRIBUTION_DATE "2025-07-30"
+//#define STRING_DISTRIBUTION_DATE "2025-09-26"
/**
* The protocol for communication to the host. Protocol indicates communication
diff --git a/Marlin/src/HAL/AVR/fastio.cpp b/Marlin/src/HAL/AVR/fastio.cpp
index 5c6ef18915..7d46afadcb 100644
--- a/Marlin/src/HAL/AVR/fastio.cpp
+++ b/Marlin/src/HAL/AVR/fastio.cpp
@@ -241,7 +241,7 @@ uint8_t extDigitalRead(const int8_t pin) {
*
* DC values -1.0 to 1.0. Negative duty cycle inverts the pulse.
*/
-uint16_t set_pwm_frequency_hz(const_float_t hz, const float dca, const float dcb, const float dcc) {
+uint16_t set_pwm_frequency_hz(const float hz, const float dca, const float dcb, const float dcc) {
float count = 0;
if (hz > 0 && (dca || dcb || dcc)) {
count = float(F_CPU) / hz; // 1x prescaler, TOP for 16MHz base freq.
diff --git a/Marlin/src/HAL/DUE/usb/uotghs_device_due.c b/Marlin/src/HAL/DUE/usb/uotghs_device_due.c
index 01dda7e7fe..5635f2ba0c 100644
--- a/Marlin/src/HAL/DUE/usb/uotghs_device_due.c
+++ b/Marlin/src/HAL/DUE/usb/uotghs_device_due.c
@@ -523,7 +523,7 @@ static bool udd_ep_interrupt(void);
* \internal
* \brief Function called by UOTGHS interrupt to manage USB Device interrupts
*
- * USB Device interrupt events are splited in three parts:
+ * USB Device interrupt events are split in three parts:
* - USB line events (SOF, reset, suspend, resume, wakeup)
* - control endpoint events (setup reception, end of data transfer, underflow, overflow, stall)
* - bulk/interrupt/isochronous endpoints events (end of data transfer)
@@ -1567,7 +1567,7 @@ static void udd_ctrl_out_received(void)
udd_ctrl_payload_buf_cnt))) {
// End of reception because it is a short packet
// Before send ZLP, call intermediate callback
- // in case of data receiv generate a stall
+ // in case of data receive generate a stall
udd_g_ctrlreq.payload_size = udd_ctrl_payload_buf_cnt;
if (NULL != udd_g_ctrlreq.over_under_run) {
if (!udd_g_ctrlreq.over_under_run()) {
@@ -1808,7 +1808,7 @@ static void udd_ep_trans_done(udd_ep_id_t ep)
}
if (ptr_job->buf_cnt != ptr_job->buf_size) {
- // Need to send or receiv other data
+ // Need to send or receive other data
next_trans = ptr_job->buf_size - ptr_job->buf_cnt;
if (UDD_ENDPOINT_MAX_TRANS < next_trans) {
diff --git a/Marlin/src/HAL/ESP32/HAL.cpp b/Marlin/src/HAL/ESP32/HAL.cpp
index 705b856aaa..c48aee0e21 100644
--- a/Marlin/src/HAL/ESP32/HAL.cpp
+++ b/Marlin/src/HAL/ESP32/HAL.cpp
@@ -242,12 +242,13 @@ void MarlinHAL::adc_init() {
TERN_(HAS_TEMP_ADC_5, adc1_set_attenuation(get_channel(TEMP_5_PIN), ADC_ATTEN_11db));
TERN_(HAS_TEMP_ADC_6, adc2_set_attenuation(get_channel(TEMP_6_PIN), ADC_ATTEN_11db));
TERN_(HAS_TEMP_ADC_7, adc3_set_attenuation(get_channel(TEMP_7_PIN), ADC_ATTEN_11db));
- TERN_(HAS_HEATED_BED, adc1_set_attenuation(get_channel(TEMP_BED_PIN), ADC_ATTEN_11db));
- TERN_(HAS_TEMP_CHAMBER, adc1_set_attenuation(get_channel(TEMP_CHAMBER_PIN), ADC_ATTEN_11db));
- TERN_(HAS_TEMP_PROBE, adc1_set_attenuation(get_channel(TEMP_PROBE_PIN), ADC_ATTEN_11db));
- TERN_(HAS_TEMP_COOLER, adc1_set_attenuation(get_channel(TEMP_COOLER_PIN), ADC_ATTEN_11db));
- TERN_(HAS_TEMP_BOARD, adc1_set_attenuation(get_channel(TEMP_BOARD_PIN), ADC_ATTEN_11db));
- TERN_(FILAMENT_WIDTH_SENSOR, adc1_set_attenuation(get_channel(FILWIDTH_PIN), ADC_ATTEN_11db));
+ TERN_(HAS_TEMP_ADC_BED, adc1_set_attenuation(get_channel(TEMP_BED_PIN), ADC_ATTEN_11db));
+ TERN_(HAS_TEMP_ADC_CHAMBER, adc1_set_attenuation(get_channel(TEMP_CHAMBER_PIN), ADC_ATTEN_11db));
+ TERN_(HAS_TEMP_ADC_PROBE, adc1_set_attenuation(get_channel(TEMP_PROBE_PIN), ADC_ATTEN_11db));
+ TERN_(HAS_TEMP_ADC_COOLER, adc1_set_attenuation(get_channel(TEMP_COOLER_PIN), ADC_ATTEN_11db));
+ TERN_(HAS_TEMP_ADC_BOARD, adc1_set_attenuation(get_channel(TEMP_BOARD_PIN), ADC_ATTEN_11db));
+ TERN_(HAS_FILWIDTH_ADC, adc1_set_attenuation(get_channel(FILWIDTH_PIN), ADC_ATTEN_11db));
+ TERN_(HAS_FILWIDTH2_ADC, adc1_set_attenuation(get_channel(FILWIDTH2_PIN), ADC_ATTEN_11db));
// Note that adc2 is shared with the WiFi module, which has higher priority, so the conversion may fail.
// That's why we're not setting it up here.
diff --git a/Marlin/src/HAL/GD32_MFL/README.md b/Marlin/src/HAL/GD32_MFL/README.md
index af23a37f2f..61800eda1c 100644
--- a/Marlin/src/HAL/GD32_MFL/README.md
+++ b/Marlin/src/HAL/GD32_MFL/README.md
@@ -3,6 +3,7 @@
This HAL is eventually intended to act as the generic HAL for all GD32 chips using the MFL library.
Currently it supports:
- * GD32F303RET6
+
+- GD32F303RET6
Targeting the official [MFL Arduino Core](https://github.com/bnmguy/ArduinoCore_MFL).
diff --git a/Marlin/src/HAL/GD32_MFL/sd/SDCard.h b/Marlin/src/HAL/GD32_MFL/sd/SDCard.h
index b03d128dc8..de28c40809 100644
--- a/Marlin/src/HAL/GD32_MFL/sd/SDCard.h
+++ b/Marlin/src/HAL/GD32_MFL/sd/SDCard.h
@@ -73,7 +73,7 @@ public:
// Interrupt handler
void handle_interrupts();
- // Varaible stored parameters
+ // Variable stored parameters
auto get_scr(uint16_t rca, uint32_t* scr) -> SDIO_Error_Type;
auto store_cid() -> SDIO_Error_Type;
auto store_csd() -> SDIO_Error_Type;
diff --git a/Marlin/src/HAL/HC32/timers.h b/Marlin/src/HAL/HC32/timers.h
index c0014df604..e5ab3f21f5 100644
--- a/Marlin/src/HAL/HC32/timers.h
+++ b/Marlin/src/HAL/HC32/timers.h
@@ -49,7 +49,7 @@ extern Timer0 step_timer;
* See https://github.com/MarlinFirmware/Marlin/pull/27099 for more information.
*
* NOTE: If the 'constexpr' requirement is ever lifted, TIMER0_BASE_FREQUENCY could
- * be used instead. Tho this would probably not make any noticable difference.
+ * be used instead. Tho this would probably not make any noticeable difference.
*/
#define HAL_TIMER_RATE F_PCLK1
diff --git a/Marlin/src/HAL/NATIVE_SIM/u8g/u8g_com_st7920_sw_spi.cpp b/Marlin/src/HAL/NATIVE_SIM/u8g/u8g_com_st7920_sw_spi.cpp
index 46f2798afa..b07bc1644d 100644
--- a/Marlin/src/HAL/NATIVE_SIM/u8g/u8g_com_st7920_sw_spi.cpp
+++ b/Marlin/src/HAL/NATIVE_SIM/u8g/u8g_com_st7920_sw_spi.cpp
@@ -71,13 +71,13 @@ static uint8_t SPI_speed = 0;
static uint8_t swSpiTransfer(uint8_t b, const uint8_t spi_speed, const pin_t sck_pin, const pin_t miso_pin, const pin_t mosi_pin) {
for (uint8_t i = 0; i < 8; i++) {
- WRITE_PIN(mosi_pin, !!(b & 0x80));
+ WRITE_PIN(sck_pin, TERN(U8G_SPI_USE_MODE_3, LOW, HIGH));
DELAY_CYCLES(SPI_SPEED);
- WRITE_PIN(sck_pin, HIGH);
+ WRITE_PIN(mosi_pin, !!(b & 0x80));
DELAY_CYCLES(SPI_SPEED);
b <<= 1;
if (miso_pin >= 0 && READ_PIN(miso_pin)) b |= 1;
- WRITE_PIN(sck_pin, LOW);
+ WRITE_PIN(sck_pin, TERN(U8G_SPI_USE_MODE_3, HIGH, LOW));
DELAY_CYCLES(SPI_SPEED);
}
return b;
@@ -85,7 +85,7 @@ static uint8_t swSpiTransfer(uint8_t b, const uint8_t spi_speed, const pin_t sck
static uint8_t swSpiInit(const uint8_t spiRate, const pin_t sck_pin, const pin_t mosi_pin) {
WRITE_PIN(mosi_pin, HIGH);
- WRITE_PIN(sck_pin, LOW);
+ WRITE_PIN(sck_pin, TERN(U8G_SPI_USE_MODE_3, HIGH, LOW));
return spiRate;
}
@@ -93,11 +93,11 @@ static void u8g_com_st7920_write_byte_sw_spi(uint8_t rs, uint8_t val) {
static uint8_t rs_last_state = 255;
if (rs != rs_last_state) {
// Transfer Data (FA) or Command (F8)
- swSpiTransfer(rs ? 0x0FA : 0x0F8, SPI_speed, SCK_pin_ST7920_HAL, -1, MOSI_pin_ST7920_HAL_HAL);
+ swSpiTransfer(rs ? 0xFA : 0xF8, SPI_speed, SCK_pin_ST7920_HAL, -1, MOSI_pin_ST7920_HAL_HAL);
rs_last_state = rs;
DELAY_US(40); // Give the controller time to process the data: 20 is bad, 30 is OK, 40 is safe
}
- swSpiTransfer(val & 0x0F0, SPI_speed, SCK_pin_ST7920_HAL, -1, MOSI_pin_ST7920_HAL_HAL);
+ swSpiTransfer(val & 0xF0, SPI_speed, SCK_pin_ST7920_HAL, -1, MOSI_pin_ST7920_HAL_HAL);
swSpiTransfer(val << 4, SPI_speed, SCK_pin_ST7920_HAL, -1, MOSI_pin_ST7920_HAL_HAL);
}
@@ -169,5 +169,32 @@ uint8_t u8g_com_ST7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void
}
#endif
+#if ENABLED(LIGHTWEIGHT_UI)
+
+ #define ST7920_CS() { WRITE(LCD_PINS_RS, HIGH); }
+ #define ST7920_NCS() { WRITE(LCD_PINS_RS, LOW); }
+ #define ST7920_SET_CMD() { ST7920_SWSPI_SND_8BIT(0xF8); }
+ #define ST7920_SET_DAT() { ST7920_SWSPI_SND_8BIT(0xFA); }
+ #define ST7920_WRITE_BYTE(a) { ST7920_SWSPI_SND_8BIT((uint8_t)((a)&0xF0u)); ST7920_SWSPI_SND_8BIT((uint8_t)((a)<<4U)); }
+
+ #define ST7920_DAT(V) !!((V) & 0x80)
+
+ #define ST7920_SND_BIT(...) do{ \
+ WRITE(LCD_PINS_D4, LOW); \
+ WRITE(LCD_PINS_EN, ST7920_DAT(val)); \
+ WRITE(LCD_PINS_D4, HIGH); \
+ val <<= 1; }while(0);
+
+ void ST7920_SWSPI_SND_8BIT(uint8_t val) {
+ REPEAT(8, ST7920_SND_BIT);
+ }
+
+ void ST7920_cs() { ST7920_CS(); }
+ void ST7920_ncs() { ST7920_NCS(); }
+ void ST7920_set_cmd() { ST7920_SET_CMD(); }
+ void ST7920_set_dat() { ST7920_SET_DAT(); }
+ void ST7920_write_byte(const uint8_t val) { ST7920_WRITE_BYTE(val); }
+#endif // LIGHTWEIGHT_UI
+
#endif // IS_U8GLIB_ST7920
#endif // __PLAT_NATIVE_SIM__
diff --git a/Marlin/src/HAL/NATIVE_SIM/u8g/u8g_com_sw_spi.cpp b/Marlin/src/HAL/NATIVE_SIM/u8g/u8g_com_sw_spi.cpp
index f984983b40..fd11e5d767 100644
--- a/Marlin/src/HAL/NATIVE_SIM/u8g/u8g_com_sw_spi.cpp
+++ b/Marlin/src/HAL/NATIVE_SIM/u8g/u8g_com_sw_spi.cpp
@@ -127,7 +127,7 @@ uint8_t swSpiTransfer_mode_3(uint8_t b, const uint8_t spi_speed, const pin_t sck
static uint8_t SPI_speed = 0;
static uint8_t swSpiInit(const uint8_t spi_speed, const uint8_t clk_pin, const uint8_t mosi_pin) {
- return spi_speed;
+ return spi_speed;
}
static void u8g_sw_spi_shift_out(uint8_t dataPin, uint8_t clockPin, uint8_t val) {
diff --git a/Marlin/src/HAL/RP2040/HAL.cpp b/Marlin/src/HAL/RP2040/HAL.cpp
index f0d9e4eec6..1b519e4004 100644
--- a/Marlin/src/HAL/RP2040/HAL.cpp
+++ b/Marlin/src/HAL/RP2040/HAL.cpp
@@ -112,7 +112,7 @@ void MarlinHAL::reboot() { watchdog_reboot(0, 0, 1); }
void MarlinHAL::watchdog_init() {
#if DISABLED(DISABLE_WATCHDOG_INIT)
- static_assert(WDT_TIMEOUT_US > 1000, "WDT Timout is too small, aborting");
+ static_assert(WDT_TIMEOUT_US > 1000, "WDT Timeout is too small, aborting");
watchdog_enable(WDT_TIMEOUT_US/1000, true);
#endif
}
diff --git a/Marlin/src/HAL/SAMD21/timers.cpp b/Marlin/src/HAL/SAMD21/timers.cpp
index b5f1d4f7bd..4ec6e5d867 100644
--- a/Marlin/src/HAL/SAMD21/timers.cpp
+++ b/Marlin/src/HAL/SAMD21/timers.cpp
@@ -176,7 +176,7 @@ void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) {
tc->COUNT32.CTRLA.reg |= TC_CTRLA_WAVEGEN_MFRQ;
//set prescaler
//the clock normally counts at the GCLK_TC frequency, but we can set it to divide that frequency to slow it down
- //you can use different prescaler divisons here like TC_CTRLA_PRESCALER_DIV1 to get a different range
+ //you can use different prescaler divisions here like TC_CTRLA_PRESCALER_DIV1 to get a different range
tc->COUNT32.CTRLA.reg |= TC_CTRLA_PRESCALER_DIV1 | TC_CTRLA_ENABLE; //it will divide GCLK_TC frequency by 1024
//set the compare-capture register.
//The counter will count up to this value (it's a 16bit counter so we use uint16_t)
diff --git a/Marlin/src/HAL/SAMD51/HAL.cpp b/Marlin/src/HAL/SAMD51/HAL.cpp
index cfc44e1360..aea908707b 100644
--- a/Marlin/src/HAL/SAMD51/HAL.cpp
+++ b/Marlin/src/HAL/SAMD51/HAL.cpp
@@ -61,7 +61,8 @@
#define GET_COOLER_ADC() TERN(HAS_TEMP_ADC_COOLER, PIN_TO_ADC(TEMP_COOLER_PIN), -1)
#define GET_BOARD_ADC() TERN(HAS_TEMP_ADC_BOARD, PIN_TO_ADC(TEMP_BOARD_PIN), -1)
#define GET_SOC_ADC() TERN(HAS_TEMP_ADC_BOARD, PIN_TO_ADC(TEMP_BOARD_PIN), -1)
-#define GET_FILAMENT_WIDTH_ADC() TERN(FILAMENT_WIDTH_SENSOR, PIN_TO_ADC(FILWIDTH_PIN), -1)
+#define GET_FILAMENT_WIDTH_ADC() TERN(HAS_FILWIDTH_ADC, PIN_TO_ADC(FILWIDTH_PIN), -1)
+#define GET_FILAMENT2_WIDTH_ADC() TERN(HAS_FILWIDTH2_ADC, PIN_TO_ADC(FILWIDTH2_PIN), -1)
#define GET_BUTTONS_ADC() TERN(HAS_ADC_BUTTONS, PIN_TO_ADC(ADC_KEYPAD_PIN), -1)
#define GET_JOY_ADC_X() TERN(HAS_JOY_ADC_X, PIN_TO_ADC(JOY_X_PIN), -1)
#define GET_JOY_ADC_Y() TERN(HAS_JOY_ADC_Y, PIN_TO_ADC(JOY_Y_PIN), -1)
@@ -77,7 +78,7 @@
|| GET_PROBE_ADC() == n \
|| GET_COOLER_ADC() == n \
|| GET_BOARD_ADC() == n || GET_SOC_ADC() == n \
- || GET_FILAMENT_WIDTH_ADC() == n \
+ || GET_FILAMENT_WIDTH_ADC() == n || GET_FILAMENT2_WIDTH_ADC() == n \
|| GET_BUTTONS_ADC() == n \
|| GET_JOY_ADC_X() == n || GET_JOY_ADC_Y() == n || GET_JOY_ADC_Z() == n \
|| GET_POWERMON_ADC_CURRENT() == n || GET_POWERMON_ADC_VOLTS() == n \
@@ -146,6 +147,9 @@ enum ADCIndex {
#if GET_FILAMENT_WIDTH_ADC() == 0
FILWIDTH,
#endif
+ #if GET_FILAMENT2_WIDTH_ADC() == 0
+ FILWIDTH2,
+ #endif
#if GET_BUTTONS_ADC() == 0
ADC_KEY,
#endif
@@ -212,6 +216,9 @@ enum ADCIndex {
#if GET_FILAMENT_WIDTH_ADC() == 1
FILWIDTH,
#endif
+ #if GET_FILAMENT2_WIDTH_ADC() == 1
+ FILWIDTH2,
+ #endif
#if GET_BUTTONS_ADC() == 1
ADC_KEY,
#endif
@@ -334,6 +341,9 @@ enum ADCIndex {
#if GET_FILAMENT_WIDTH_ADC() == 0
FILWIDTH_PIN,
#endif
+ #if GET_FILAMENT2_WIDTH_ADC() == 0
+ FILWIDTH2_PIN,
+ #endif
#if GET_BUTTONS_ADC() == 0
ADC_KEYPAD_PIN,
#endif
@@ -400,6 +410,9 @@ enum ADCIndex {
#if GET_FILAMENT_WIDTH_ADC() == 1
FILWIDTH_PIN,
#endif
+ #if GET_FILAMENT2_WIDTH_ADC() == 1
+ FILWIDTH2_PIN,
+ #endif
#if GET_BUTTONS_ADC() == 1
ADC_KEYPAD_PIN,
#endif
@@ -471,6 +484,9 @@ enum ADCIndex {
#if GET_FILAMENT_WIDTH_ADC() == 0
{ PIN_TO_INPUTCTRL(FILWIDTH_PIN) },
#endif
+ #if GET_FILAMENT2_WIDTH_ADC() == 0
+ { PIN_TO_INPUTCTRL(FILWIDTH2_PIN) },
+ #endif
#if GET_BUTTONS_ADC() == 0
{ PIN_TO_INPUTCTRL(ADC_KEYPAD_PIN) },
#endif
@@ -543,6 +559,9 @@ enum ADCIndex {
#if GET_FILAMENT_WIDTH_ADC() == 1
{ PIN_TO_INPUTCTRL(FILWIDTH_PIN) },
#endif
+ #if GET_FILAMENT2_WIDTH_ADC() == 1
+ { PIN_TO_INPUTCTRL(FILWIDTH2_PIN) },
+ #endif
#if GET_BUTTONS_ADC() == 1
{ PIN_TO_INPUTCTRL(ADC_KEYPAD_PIN) },
#endif
diff --git a/Marlin/src/HAL/STM32/HardwareSerial.cpp b/Marlin/src/HAL/STM32/HardwareSerial.cpp
index d9948d0a34..58360cc31e 100644
--- a/Marlin/src/HAL/STM32/HardwareSerial.cpp
+++ b/Marlin/src/HAL/STM32/HardwareSerial.cpp
@@ -209,7 +209,7 @@ HAL_HardwareSerial::HAL_HardwareSerial(void *peripheral) {
}
#endif
- else { // else get the pins of the first peripheral occurence in PinMap
+ else { // else get the pins of the first peripheral occurrence in PinMap
_serial.pin_rx = pinmap_pin(peripheral, PinMap_UART_RX);
_serial.pin_tx = pinmap_pin(peripheral, PinMap_UART_TX);
}
diff --git a/Marlin/src/HAL/STM32/README.md b/Marlin/src/HAL/STM32/README.md
index 7680df6654..cf8aa50d50 100644
--- a/Marlin/src/HAL/STM32/README.md
+++ b/Marlin/src/HAL/STM32/README.md
@@ -3,9 +3,10 @@
This HAL is intended to act as the generic STM32 HAL for all STM32 chips (The whole F, H and L family).
Currently it supports:
- * STM32F0xx
- * STM32F1xx
- * STM32F4xx
- * STM32F7xx
+
+- STM32F0xx
+- STM32F1xx
+- STM32F4xx
+- STM32F7xx
Targeting the official [Arduino STM32 Core](https://github.com/stm32duino/Arduino_Core_STM32).
diff --git a/Marlin/src/HAL/STM32/pinsDebug.h b/Marlin/src/HAL/STM32/pinsDebug.h
index 21cd2de39f..b14c9c721c 100644
--- a/Marlin/src/HAL/STM32/pinsDebug.h
+++ b/Marlin/src/HAL/STM32/pinsDebug.h
@@ -150,7 +150,7 @@ const XrefInfo pin_xref[] PROGMEM = {
#ifndef M43_NEVER_TOUCH
#define _M43_NEVER_TOUCH(x) WITHIN(x, 9, 12) // SERIAL/USB pins: PA9(TX) PA10(RX) PA11(USB_DM) PA12(USB_DP)
- #ifdef KILL_PIN
+ #if PIN_EXISTS(KILL)
#define M43_NEVER_TOUCH(x) m43_never_touch(x)
bool m43_never_touch(const pin_t index) {
diff --git a/Marlin/src/HAL/STM32F1/HAL.cpp b/Marlin/src/HAL/STM32F1/HAL.cpp
index b0f86ae4ed..fc1680cbf4 100644
--- a/Marlin/src/HAL/STM32F1/HAL.cpp
+++ b/Marlin/src/HAL/STM32F1/HAL.cpp
@@ -131,30 +131,31 @@ uint16_t MarlinHAL::adc_result;
#include
-// Init the AD in continuous capture mode
+// Init the ADC in continuous capture mode
void MarlinHAL::adc_init() {
static const uint8_t adc_pins[] = {
- OPTITEM(HAS_TEMP_ADC_0, TEMP_0_PIN)
- OPTITEM(HAS_TEMP_ADC_1, TEMP_1_PIN)
- OPTITEM(HAS_TEMP_ADC_2, TEMP_2_PIN)
- OPTITEM(HAS_TEMP_ADC_3, TEMP_3_PIN)
- OPTITEM(HAS_TEMP_ADC_4, TEMP_4_PIN)
- OPTITEM(HAS_TEMP_ADC_5, TEMP_5_PIN)
- OPTITEM(HAS_TEMP_ADC_6, TEMP_6_PIN)
- OPTITEM(HAS_TEMP_ADC_7, TEMP_7_PIN)
- OPTITEM(HAS_HEATED_BED, TEMP_BED_PIN)
- OPTITEM(HAS_TEMP_CHAMBER, TEMP_CHAMBER_PIN)
- OPTITEM(HAS_TEMP_ADC_PROBE, TEMP_PROBE_PIN)
- OPTITEM(HAS_TEMP_COOLER, TEMP_COOLER_PIN)
- OPTITEM(HAS_TEMP_BOARD, TEMP_BOARD_PIN)
- OPTITEM(HAS_TEMP_SOC, TEMP_SOC_PIN)
- OPTITEM(FILAMENT_WIDTH_SENSOR, FILWIDTH_PIN)
- OPTITEM(HAS_ADC_BUTTONS, ADC_KEYPAD_PIN)
- OPTITEM(HAS_JOY_ADC_X, JOY_X_PIN)
- OPTITEM(HAS_JOY_ADC_Y, JOY_Y_PIN)
- OPTITEM(HAS_JOY_ADC_Z, JOY_Z_PIN)
- OPTITEM(POWER_MONITOR_CURRENT, POWER_MONITOR_CURRENT_PIN)
- OPTITEM(POWER_MONITOR_VOLTAGE, POWER_MONITOR_VOLTAGE_PIN)
+ OPTITEM(HAS_TEMP_ADC_0, TEMP_0_PIN )
+ OPTITEM(HAS_TEMP_ADC_1, TEMP_1_PIN )
+ OPTITEM(HAS_TEMP_ADC_2, TEMP_2_PIN )
+ OPTITEM(HAS_TEMP_ADC_3, TEMP_3_PIN )
+ OPTITEM(HAS_TEMP_ADC_4, TEMP_4_PIN )
+ OPTITEM(HAS_TEMP_ADC_5, TEMP_5_PIN )
+ OPTITEM(HAS_TEMP_ADC_6, TEMP_6_PIN )
+ OPTITEM(HAS_TEMP_ADC_7, TEMP_7_PIN )
+ OPTITEM(HAS_TEMP_ADC_BED, TEMP_BED_PIN )
+ OPTITEM(HAS_TEMP_ADC_CHAMBER, TEMP_CHAMBER_PIN )
+ OPTITEM(HAS_TEMP_ADC_PROBE, TEMP_PROBE_PIN )
+ OPTITEM(HAS_TEMP_ADC_COOLER, TEMP_COOLER_PIN )
+ OPTITEM(HAS_TEMP_ADC_BOARD, TEMP_BOARD_PIN )
+ OPTITEM(HAS_TEMP_ADC_SOC, TEMP_SOC_PIN )
+ OPTITEM(HAS_FILWIDTH_ADC, FILWIDTH_PIN )
+ OPTITEM(HAS_FILWIDTH2_ADC, FILWIDTH2_PIN )
+ OPTITEM(HAS_ADC_BUTTONS, ADC_KEYPAD_PIN )
+ OPTITEM(HAS_JOY_ADC_X, JOY_X_PIN )
+ OPTITEM(HAS_JOY_ADC_Y, JOY_Y_PIN )
+ OPTITEM(HAS_JOY_ADC_Z, JOY_Z_PIN )
+ OPTITEM(POWER_MONITOR_CURRENT, POWER_MONITOR_CURRENT_PIN)
+ OPTITEM(POWER_MONITOR_VOLTAGE, POWER_MONITOR_VOLTAGE_PIN)
};
static STM32ADC adc(ADC1);
// Configure the ADC
@@ -175,27 +176,28 @@ void MarlinHAL::adc_start(const pin_t pin) {
ADCIndex pin_index;
switch (pin) {
default: return;
- _TCASE(HAS_TEMP_ADC_0, TEMP_0_PIN, TEMP_0)
- _TCASE(HAS_TEMP_ADC_1, TEMP_1_PIN, TEMP_1)
- _TCASE(HAS_TEMP_ADC_2, TEMP_2_PIN, TEMP_2)
- _TCASE(HAS_TEMP_ADC_3, TEMP_3_PIN, TEMP_3)
- _TCASE(HAS_TEMP_ADC_4, TEMP_4_PIN, TEMP_4)
- _TCASE(HAS_TEMP_ADC_5, TEMP_5_PIN, TEMP_5)
- _TCASE(HAS_TEMP_ADC_6, TEMP_6_PIN, TEMP_6)
- _TCASE(HAS_TEMP_ADC_7, TEMP_7_PIN, TEMP_7)
- _TCASE(HAS_HEATED_BED, TEMP_BED_PIN, TEMP_BED)
- _TCASE(HAS_TEMP_CHAMBER, TEMP_CHAMBER_PIN, TEMP_CHAMBER)
- _TCASE(HAS_TEMP_ADC_PROBE, TEMP_PROBE_PIN, TEMP_PROBE)
- _TCASE(HAS_TEMP_COOLER, TEMP_COOLER_PIN, TEMP_COOLER)
- _TCASE(HAS_TEMP_BOARD, TEMP_BOARD_PIN, TEMP_BOARD)
- _TCASE(HAS_TEMP_SOC, TEMP_SOC_PIN, TEMP_SOC)
- _TCASE(HAS_JOY_ADC_X, JOY_X_PIN, JOY_X)
- _TCASE(HAS_JOY_ADC_Y, JOY_Y_PIN, JOY_Y)
- _TCASE(HAS_JOY_ADC_Z, JOY_Z_PIN, JOY_Z)
- _TCASE(FILAMENT_WIDTH_SENSOR, FILWIDTH_PIN, FILWIDTH)
- _TCASE(HAS_ADC_BUTTONS, ADC_KEYPAD_PIN, ADC_KEY)
- _TCASE(POWER_MONITOR_CURRENT, POWER_MONITOR_CURRENT_PIN, POWERMON_CURRENT)
- _TCASE(POWER_MONITOR_VOLTAGE, POWER_MONITOR_VOLTAGE_PIN, POWERMON_VOLTAGE)
+ _TCASE(HAS_TEMP_ADC_0, TEMP_0_PIN, TEMP_0 )
+ _TCASE(HAS_TEMP_ADC_1, TEMP_1_PIN, TEMP_1 )
+ _TCASE(HAS_TEMP_ADC_2, TEMP_2_PIN, TEMP_2 )
+ _TCASE(HAS_TEMP_ADC_3, TEMP_3_PIN, TEMP_3 )
+ _TCASE(HAS_TEMP_ADC_4, TEMP_4_PIN, TEMP_4 )
+ _TCASE(HAS_TEMP_ADC_5, TEMP_5_PIN, TEMP_5 )
+ _TCASE(HAS_TEMP_ADC_6, TEMP_6_PIN, TEMP_6 )
+ _TCASE(HAS_TEMP_ADC_7, TEMP_7_PIN, TEMP_7 )
+ _TCASE(HAS_TEMP_ADC_BED, TEMP_BED_PIN, TEMP_BED )
+ _TCASE(HAS_TEMP_ADC_CHAMBER, TEMP_CHAMBER_PIN, TEMP_CHAMBER )
+ _TCASE(HAS_TEMP_ADC_PROBE, TEMP_PROBE_PIN, TEMP_PROBE )
+ _TCASE(HAS_TEMP_ADC_COOLER, TEMP_COOLER_PIN, TEMP_COOLER )
+ _TCASE(HAS_TEMP_ADC_BOARD, TEMP_BOARD_PIN, TEMP_BOARD )
+ _TCASE(HAS_TEMP_ADC_SOC, TEMP_SOC_PIN, TEMP_SOC )
+ _TCASE(HAS_FILWIDTH_ADC, FILWIDTH_PIN, FILWIDTH )
+ _TCASE(HAS_FILWIDTH2_ADC, FILWIDTH2_PIN, FILWIDTH2 )
+ _TCASE(HAS_ADC_BUTTONS, ADC_KEYPAD_PIN, ADC_KEY )
+ _TCASE(HAS_JOY_ADC_X, JOY_X_PIN, JOY_X )
+ _TCASE(HAS_JOY_ADC_Y, JOY_Y_PIN, JOY_Y )
+ _TCASE(HAS_JOY_ADC_Z, JOY_Z_PIN, JOY_Z )
+ _TCASE(POWER_MONITOR_CURRENT, POWER_MONITOR_CURRENT_PIN, POWERMON_CURRENT)
+ _TCASE(POWER_MONITOR_VOLTAGE, POWER_MONITOR_VOLTAGE_PIN, POWERMON_VOLTAGE)
}
adc_result = (adc_results[(int)pin_index] & 0xFFF) >> (12 - HAL_ADC_RESOLUTION); // shift out unused bits
}
diff --git a/Marlin/src/HAL/STM32F1/README.md b/Marlin/src/HAL/STM32F1/README.md
index b5bd5141fb..e289f35433 100644
--- a/Marlin/src/HAL/STM32F1/README.md
+++ b/Marlin/src/HAL/STM32F1/README.md
@@ -5,6 +5,7 @@ This HAL is for STM32F103 boards used with [Arduino STM32](https://github.com/ro
Currently has been tested in Malyan M200 (103CBT6), SKRmini (103RCT6), Chitu 3d (103ZET6), and various 103VET6 boards.
### Main developers:
+
- Victorpv
- xC000005
- thisiskeithb
diff --git a/Marlin/src/HAL/STM32F1/SPI.h b/Marlin/src/HAL/STM32F1/SPI.h
index 27bf684388..72063df699 100644
--- a/Marlin/src/HAL/STM32F1/SPI.h
+++ b/Marlin/src/HAL/STM32F1/SPI.h
@@ -33,12 +33,14 @@
#include
#include
+#include "../../core/macros.h" // for PIN_EXISTS
+
// Number of SPI ports
-#ifdef BOARD_SPI3_SCK_PIN
+#if PIN_EXISTS(BOARD_SPI3_SCK)
#define BOARD_NR_SPI 3
-#elif defined(BOARD_SPI2_SCK_PIN)
+#elif PIN_EXISTS(BOARD_SPI2_SCK)
#define BOARD_NR_SPI 2
-#elif defined(BOARD_SPI1_SCK_PIN)
+#elif PIN_EXISTS(BOARD_SPI1_SCK)
#define BOARD_NR_SPI 1
#endif
diff --git a/Marlin/src/HAL/STM32F1/adc.h b/Marlin/src/HAL/STM32F1/adc.h
index 25f4a7ce16..a2f5652de0 100644
--- a/Marlin/src/HAL/STM32F1/adc.h
+++ b/Marlin/src/HAL/STM32F1/adc.h
@@ -44,7 +44,8 @@ enum ADCIndex : uint8_t {
OPTITEM(HAS_TEMP_ADC_COOLER, TEMP_COOLER )
OPTITEM(HAS_TEMP_ADC_BOARD, TEMP_BOARD )
OPTITEM(HAS_TEMP_ADC_SOC, TEMP_SOC )
- OPTITEM(FILAMENT_WIDTH_SENSOR, FILWIDTH )
+ OPTITEM(HAS_FILWIDTH_ADC, FILWIDTH )
+ OPTITEM(HAS_FILWIDTH2_ADC, FILWIDTH2 )
OPTITEM(HAS_ADC_BUTTONS, ADC_KEY )
OPTITEM(HAS_JOY_ADC_X, JOY_X )
OPTITEM(HAS_JOY_ADC_Y, JOY_Y )
diff --git a/Marlin/src/HAL/shared/backtrace/unwarm.h b/Marlin/src/HAL/shared/backtrace/unwarm.h
index 72ea0b0627..8e432ebe77 100644
--- a/Marlin/src/HAL/shared/backtrace/unwarm.h
+++ b/Marlin/src/HAL/shared/backtrace/unwarm.h
@@ -15,7 +15,7 @@
#include "unwinder.h"
-/** The maximum number of instructions to interpet in a function.
+/** The maximum number of instructions to interpret in a function.
* Unwinding will be unconditionally stopped and UNWIND_EXHAUSTED returned
* if more than this number of instructions are interpreted in a single
* function without unwinding a stack frame. This prevents infinite loops
diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp
index ae10972f5b..175fd0c315 100644
--- a/Marlin/src/MarlinCore.cpp
+++ b/Marlin/src/MarlinCore.cpp
@@ -483,7 +483,7 @@ inline void manage_inactivity(const bool no_stepper_sleep=false) {
// Check if the kill button was pressed and wait to ensure the signal is not noise
// typically caused by poor insulation and grounding on LCD cables.
// Lower numbers here will increase response time and therefore safety rating.
- // It is recommended to set this as low as possibe without false triggers.
+ // It is recommended to set this as low as possible without false triggers.
// -------------------------------------------------------------------------------
#ifndef KILL_DELAY
#define KILL_DELAY 250
diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h
index 9dfa6038de..48418bd8df 100644
--- a/Marlin/src/core/boards.h
+++ b/Marlin/src/core/boards.h
@@ -105,33 +105,34 @@
#define BOARD_TRIGORILLA_14_11 1138 // ... Rev 1.1 (new servo pin order)
#define BOARD_RAMPS_ENDER_4 1139 // Creality: Ender-4, CR-8
#define BOARD_RAMPS_CREALITY 1140 // Creality: CR10S, CR20, CR-X
-#define BOARD_DAGOMA_F5 1141 // Dagoma F5
-#define BOARD_DAGOMA_D6 1142 // Dagoma D6 (as found in the Dagoma DiscoUltimate V2 TMC)
-#define BOARD_FYSETC_F6_13 1143 // FYSETC F6 1.3
-#define BOARD_FYSETC_F6_14 1144 // FYSETC F6 1.4
-#define BOARD_DUPLICATOR_I3_PLUS 1145 // Wanhao Duplicator i3 Plus
-#define BOARD_VORON 1146 // VORON Design
-#define BOARD_TRONXY_V3_1_0 1147 // Tronxy TRONXY-V3-1.0
-#define BOARD_Z_BOLT_X_SERIES 1148 // Z-Bolt X Series
-#define BOARD_TT_OSCAR 1149 // TT OSCAR
-#define BOARD_TANGO 1150 // BIQU Tango V1
-#define BOARD_MKS_GEN_L_V2 1151 // MKS GEN L V2
-#define BOARD_MKS_GEN_L_V21 1152 // MKS GEN L V2.1
-#define BOARD_COPYMASTER_3D 1153 // Copymaster 3D
-#define BOARD_ORTUR_4 1154 // Ortur 4
-#define BOARD_TENLOG_D3_HERO 1155 // Tenlog D3 Hero IDEX printer
-#define BOARD_TENLOG_MB1_V23 1156 // Tenlog D3, D5, D6 IDEX Printer
-#define BOARD_RAMPS_S_12_EEFB 1157 // Ramps S 1.2 by Sakul.cz (Power outputs: Hotend0, Hotend1, Fan, Bed)
-#define BOARD_RAMPS_S_12_EEEB 1158 // Ramps S 1.2 by Sakul.cz (Power outputs: Hotend0, Hotend1, Hotend2, Bed)
-#define BOARD_RAMPS_S_12_EFFB 1159 // Ramps S 1.2 by Sakul.cz (Power outputs: Hotend, Fan0, Fan1, Bed)
-#define BOARD_LONGER3D_LK1_PRO 1160 // Longer LK1 PRO / Alfawise U20 Pro (PRO version)
-#define BOARD_LONGER3D_LKx_PRO 1161 // Longer LKx PRO / Alfawise Uxx Pro (PRO version)
-#define BOARD_PXMALION_CORE_I3 1162 // Pxmalion Core I3
-#define BOARD_PANOWIN_CUTLASS 1163 // Panowin Cutlass (as found in the Panowin F1)
-#define BOARD_KODAMA_BARDO 1164 // Kodama Bardo V1.x (as found in the Kodama Trinus)
-#define BOARD_XTLW_MFF_V1 1165 // XTLW MFF V1.0
-#define BOARD_XTLW_MFF_V2 1166 // XTLW MFF V2.0
-#define BOARD_RUMBA_E3D 1167 // E3D Rumba BigBox
+#define BOARD_CREALITY_V252 1141 // Creality CR-10 V2, CR-10 V3
+#define BOARD_DAGOMA_F5 1142 // Dagoma F5
+#define BOARD_DAGOMA_D6 1143 // Dagoma D6 (as found in the Dagoma DiscoUltimate V2 TMC)
+#define BOARD_FYSETC_F6_13 1144 // FYSETC F6 1.3
+#define BOARD_FYSETC_F6_14 1145 // FYSETC F6 1.4
+#define BOARD_DUPLICATOR_I3_PLUS 1146 // Wanhao Duplicator i3 Plus
+#define BOARD_VORON 1147 // VORON Design
+#define BOARD_TRONXY_V3_1_0 1148 // Tronxy TRONXY-V3-1.0
+#define BOARD_Z_BOLT_X_SERIES 1149 // Z-Bolt X Series
+#define BOARD_TT_OSCAR 1150 // TT OSCAR
+#define BOARD_TANGO 1151 // BIQU Tango V1
+#define BOARD_MKS_GEN_L_V2 1152 // MKS GEN L V2
+#define BOARD_MKS_GEN_L_V21 1153 // MKS GEN L V2.1
+#define BOARD_COPYMASTER_3D 1154 // Copymaster 3D
+#define BOARD_ORTUR_4 1155 // Ortur 4
+#define BOARD_TENLOG_D3_HERO 1156 // Tenlog D3 Hero IDEX printer
+#define BOARD_TENLOG_MB1_V23 1157 // Tenlog D3, D5, D6 IDEX Printer
+#define BOARD_RAMPS_S_12_EEFB 1158 // Ramps S 1.2 by Sakul.cz (Power outputs: Hotend0, Hotend1, Fan, Bed)
+#define BOARD_RAMPS_S_12_EEEB 1159 // Ramps S 1.2 by Sakul.cz (Power outputs: Hotend0, Hotend1, Hotend2, Bed)
+#define BOARD_RAMPS_S_12_EFFB 1160 // Ramps S 1.2 by Sakul.cz (Power outputs: Hotend, Fan0, Fan1, Bed)
+#define BOARD_LONGER3D_LK1_PRO 1161 // Longer LK1 PRO / Alfawise U20 Pro (PRO version)
+#define BOARD_LONGER3D_LKx_PRO 1162 // Longer LKx PRO / Alfawise Uxx Pro (PRO version)
+#define BOARD_PXMALION_CORE_I3 1163 // Pxmalion Core I3
+#define BOARD_PANOWIN_CUTLASS 1164 // Panowin Cutlass (as found in the Panowin F1)
+#define BOARD_KODAMA_BARDO 1165 // Kodama Bardo V1.x (as found in the Kodama Trinus)
+#define BOARD_XTLW_MFF_V1 1166 // XTLW MFF V1.0
+#define BOARD_XTLW_MFF_V2 1167 // XTLW MFF V2.0
+#define BOARD_RUMBA_E3D 1168 // E3D Rumba BigBox
//
// RAMBo and derivatives
diff --git a/Marlin/src/core/serial.cpp b/Marlin/src/core/serial.cpp
index 3ddfa6d345..852cfc77f6 100644
--- a/Marlin/src/core/serial.cpp
+++ b/Marlin/src/core/serial.cpp
@@ -99,7 +99,7 @@ void SERIAL_WARN_START() { SERIAL_ECHO(F("Warning:")); }
void SERIAL_ECHO_SP(uint8_t count) { count *= (PROPORTIONAL_FONT_RATIO); while (count--) SERIAL_CHAR(' '); }
-void serial_offset(const_float_t v, const uint8_t sp/*=0*/) {
+void serial_offset(const float v, const uint8_t sp/*=0*/) {
if (v == 0 && sp == 1)
SERIAL_CHAR(' ');
else if (v > 0 || (v == 0 && sp == 2))
@@ -121,21 +121,23 @@ void print_bin(uint16_t val) {
}
}
-void _print_xyz(NUM_AXIS_ARGS_(const_float_t) FSTR_P const prefix) {
+void _print_xyz(NUM_AXIS_ARGS_(const float) FSTR_P const prefix) {
if (prefix) SERIAL_ECHO(prefix);
#if NUM_AXES
- SERIAL_ECHOPGM_P(
- LIST_N(DOUBLE(NUM_AXES), SP_X_STR, x, SP_Y_STR, y, SP_Z_STR, z, SP_I_STR, i, SP_J_STR, j, SP_K_STR, k, SP_U_STR, u, SP_V_STR, v, SP_W_STR, w)
- );
+ SERIAL_ECHOPGM_P(NUM_AXIS_PAIRED_LIST(
+ SP_X_STR, x, SP_Y_STR, y, SP_Z_STR, z,
+ SP_I_STR, i, SP_J_STR, j, SP_K_STR, k,
+ SP_U_STR, u, SP_V_STR, v, SP_W_STR, w
+ ));
#endif
}
-void print_xyz(NUM_AXIS_ARGS_(const_float_t) FSTR_P const prefix/*=nullptr*/, FSTR_P const suffix/*=nullptr*/) {
+void print_xyz(NUM_AXIS_ARGS_(const float) FSTR_P const prefix/*=nullptr*/, FSTR_P const suffix/*=nullptr*/) {
_print_xyz(NUM_AXIS_LIST_(x, y, z, i, j, k, u, v, w) prefix);
if (suffix) SERIAL_ECHO(suffix); else SERIAL_EOL();
}
-void print_xyze(LOGICAL_AXIS_ARGS_(const_float_t) FSTR_P const prefix/*=nullptr*/, FSTR_P const suffix/*=nullptr*/) {
+void print_xyze(LOGICAL_AXIS_ARGS_(const float) FSTR_P const prefix/*=nullptr*/, FSTR_P const suffix/*=nullptr*/) {
_print_xyz(NUM_AXIS_LIST_(x, y, z, i, j, k, u, v, w) prefix);
#if HAS_EXTRUDERS
SERIAL_ECHOPGM_P(SP_E_STR, e);
diff --git a/Marlin/src/core/serial.h b/Marlin/src/core/serial.h
index 8ec8b8db2a..6c73d72a22 100644
--- a/Marlin/src/core/serial.h
+++ b/Marlin/src/core/serial.h
@@ -185,7 +185,7 @@ void SERIAL_ECHOLN(T arg1, Args ... args) { SERIAL_ECHO(arg1); SERIAL_ECHO(args
// all the odd loose string elements as PROGMEM strings.
//
-// Print up to 20 pairs of values. Odd elements must be literal strings.
+// Print pairs of values. Odd elements must be literal strings.
#define __SEP_N(N,V...) _SEP_##N(V)
#define _SEP_N(N,V...) __SEP_N(N,V)
#define _SEP_N_REF() _SEP_N
@@ -194,7 +194,7 @@ void SERIAL_ECHOLN(T arg1, Args ... args) { SERIAL_ECHO(arg1); SERIAL_ECHO(args
#define _SEP_3(s,v,V...) _SEP_2(s,v); DEFER2(_SEP_N_REF)()(TWO_ARGS(V),V);
#define SERIAL_ECHOPGM(V...) do{ EVAL(_SEP_N(TWO_ARGS(V),V)); }while(0)
-// Print up to 20 pairs of values followed by newline. Odd elements must be literal strings.
+// Print pairs of values followed by newline. Odd elements must be literal strings.
#define __SELP_N(N,V...) _SELP_##N(V)
#define _SELP_N(N,V...) __SELP_N(N,V)
#define _SELP_N_REF() _SELP_N
@@ -203,7 +203,7 @@ void SERIAL_ECHOLN(T arg1, Args ... args) { SERIAL_ECHO(arg1); SERIAL_ECHO(args
#define _SELP_3(s,v,V...) _SEP_2(s,v); DEFER2(_SELP_N_REF)()(TWO_ARGS(V),V);
#define SERIAL_ECHOLNPGM(V...) do{ EVAL(_SELP_N(TWO_ARGS(V),V)); }while(0)
-// Print up to 20 pairs of values. Odd elements must be PSTR pointers.
+// Print pairs of values. Odd elements must be PSTR pointers.
#define __SEP_N_P(N,V...) _SEP_##N##_P(V)
#define _SEP_N_P(N,V...) __SEP_N_P(N,V)
#define _SEP_N_P_REF() _SEP_N_P
@@ -212,7 +212,7 @@ void SERIAL_ECHOLN(T arg1, Args ... args) { SERIAL_ECHO(arg1); SERIAL_ECHO(args
#define _SEP_3_P(p,v,V...) _SEP_2_P(p,v); DEFER2(_SEP_N_P_REF)()(TWO_ARGS(V),V);
#define SERIAL_ECHOPGM_P(V...) do{ EVAL(_SEP_N_P(TWO_ARGS(V),V)); }while(0)
-// Print up to 20 pairs of values followed by newline. Odd elements must be PSTR pointers.
+// Print pairs of values followed by newline. Odd elements must be PSTR pointers.
#define __SELP_N_P(N,V...) _SELP_##N##_P(V)
#define _SELP_N_P(N,V...) __SELP_N_P(N,V)
#define _SELP_N_P_REF() _SELP_N_P
@@ -236,16 +236,16 @@ void SERIAL_ECHO_SP(uint8_t count);
inline FSTR_P const ON_OFF(const bool onoff) { return onoff ? F("ON") : F("OFF"); }
inline FSTR_P const TRUE_FALSE(const bool tf) { return tf ? F("true") : F("false"); }
-void serial_offset(const_float_t v, const uint8_t sp=0); // For v==0 draw space (sp==1) or plus (sp==2)
+void serial_offset(const float v, const uint8_t sp=0); // For v==0 draw space (sp==1) or plus (sp==2)
void print_bin(const uint16_t val);
-void print_xyz(NUM_AXIS_ARGS_(const_float_t) FSTR_P const prefix=nullptr, FSTR_P const suffix=nullptr);
+void print_xyz(NUM_AXIS_ARGS_(const float) FSTR_P const prefix=nullptr, FSTR_P const suffix=nullptr);
inline void print_xyz(const xyz_pos_t &xyz, FSTR_P const prefix=nullptr, FSTR_P const suffix=nullptr) {
print_xyz(NUM_AXIS_ELEM_(xyz) prefix, suffix);
}
-void print_xyze(LOGICAL_AXIS_ARGS_(const_float_t) FSTR_P const prefix=nullptr, FSTR_P const suffix=nullptr);
+void print_xyze(LOGICAL_AXIS_ARGS_(const float) FSTR_P const prefix=nullptr, FSTR_P const suffix=nullptr);
inline void print_xyze(const xyze_pos_t &xyze, FSTR_P const prefix=nullptr, FSTR_P const suffix=nullptr) {
print_xyze(LOGICAL_AXIS_ELEM_LC_(xyze) prefix, suffix);
}
diff --git a/Marlin/src/core/types.h b/Marlin/src/core/types.h
index fdbb5230c5..920ea16c94 100644
--- a/Marlin/src/core/types.h
+++ b/Marlin/src/core/types.h
@@ -70,6 +70,9 @@ template struct IF { typedef L type; };
#define LOGICAL_AXIS_MAP_LC(F) MAP(F, LOGICAL_AXIS_NAMES_LC)
#define STR_AXES_LOGICAL LOGICAL_AXIS_GANG("E", "X", "Y", "Z", STR_I, STR_J, STR_K, STR_U, STR_V, STR_W)
+#define NUM_AXIS_PAIRED_LIST(V...) LIST_N(DOUBLE(NUM_AXES), V)
+#define LOGICAL_AXIS_PAIRED_LIST(EA,EB,V...) NUM_AXIS_PAIRED_LIST(V) LIST_ITEM_E(EA) LIST_ITEM_E(EB)
+
#if NUM_AXES
#define NUM_AXES_SEP ,
#define MAIN_AXIS_MAP(F) MAP(F, MAIN_AXIS_NAMES)
@@ -360,17 +363,6 @@ typedef uint16_t raw_adc_t;
typedef int16_t celsius_t;
typedef float celsius_float_t;
-//
-// On AVR pointers are only 2 bytes so use 'const float &' for 'const float'
-//
-#ifdef __AVR__
- typedef const float & const_float_t;
-#else
- typedef const float const_float_t;
-#endif
-typedef const_float_t const_feedRate_t;
-typedef const_float_t const_celsius_float_t;
-
// Type large enough to count leveling grid points
typedef IF 255)), uint16_t, uint8_t>::type grid_count_t;
diff --git a/Marlin/src/feature/babystep.cpp b/Marlin/src/feature/babystep.cpp
index 014ccea1af..91b3c7f403 100644
--- a/Marlin/src/feature/babystep.cpp
+++ b/Marlin/src/feature/babystep.cpp
@@ -54,12 +54,12 @@ void Babystep::step_axis(const AxisEnum axis) {
}
}
-void Babystep::add_mm(const AxisEnum axis, const_float_t mm) {
+void Babystep::add_mm(const AxisEnum axis, const float mm) {
add_steps(axis, mm * planner.settings.axis_steps_per_mm[axis]);
}
#if ENABLED(BD_SENSOR)
- void Babystep::set_mm(const AxisEnum axis, const_float_t mm) {
+ void Babystep::set_mm(const AxisEnum axis, const float mm) {
//if (DISABLED(BABYSTEP_WITHOUT_HOMING) && axis_should_home(axis)) return;
const int16_t distance = mm * planner.settings.axis_steps_per_mm[axis];
accum = distance; // Count up babysteps for the UI
diff --git a/Marlin/src/feature/babystep.h b/Marlin/src/feature/babystep.h
index 666a0ee8c5..da330672b2 100644
--- a/Marlin/src/feature/babystep.h
+++ b/Marlin/src/feature/babystep.h
@@ -61,7 +61,7 @@ public:
static bool can_babystep(const AxisEnum axis);
static void add_steps(const AxisEnum axis, const int16_t distance);
- static void add_mm(const AxisEnum axis, const_float_t mm);
+ static void add_mm(const AxisEnum axis, const float mm);
#if ENABLED(EP_BABYSTEPPING)
// Step Z for M293 / M294
@@ -79,7 +79,7 @@ public:
#endif // EP_BABYSTEPPING
#if ENABLED(BD_SENSOR)
- static void set_mm(const AxisEnum axis, const_float_t mm);
+ static void set_mm(const AxisEnum axis, const float mm);
#endif
static bool has_steps() {
diff --git a/Marlin/src/feature/backlash.h b/Marlin/src/feature/backlash.h
index 593e51b9d0..b4790cb161 100644
--- a/Marlin/src/feature/backlash.h
+++ b/Marlin/src/feature/backlash.h
@@ -81,10 +81,10 @@ public:
static void set_correction(const float v) { set_correction_uint8(_MAX(0, _MIN(1.0, v)) * all_on + 0.5f); }
static float get_correction() { return float(get_correction_uint8()) / all_on; }
static void set_distance_mm(const AxisEnum axis, const float v);
- static float get_distance_mm(const AxisEnum axis) {return distance_mm[axis];}
+ static float get_distance_mm(const AxisEnum axis) { return distance_mm[axis]; }
#ifdef BACKLASH_SMOOTHING_MM
static void set_smoothing_mm(const float v);
- static float get_smoothing_mm() {return smoothing_mm;}
+ static float get_smoothing_mm() { return smoothing_mm; }
#endif
#endif
diff --git a/Marlin/src/feature/bedlevel/abl/bbl.cpp b/Marlin/src/feature/bedlevel/abl/bbl.cpp
index 14c4bd24bc..918b06d2b4 100644
--- a/Marlin/src/feature/bedlevel/abl/bbl.cpp
+++ b/Marlin/src/feature/bedlevel/abl/bbl.cpp
@@ -229,7 +229,7 @@ void LevelingBilinear::print_leveling_grid(const bed_mesh_t* _z_values/*=nullptr
) * 0.5f;
}
- float LevelingBilinear::virt_2cmr(const uint8_t x, const uint8_t y, const_float_t tx, const_float_t ty) {
+ float LevelingBilinear::virt_2cmr(const uint8_t x, const uint8_t y, const float tx, const float ty) {
float row[4], column[4];
for (uint8_t i = 0; i < 4; ++i) {
for (uint8_t j = 0; j < 4; ++j) {
@@ -369,7 +369,7 @@ float LevelingBilinear::get_z_correction(const xy_pos_t &raw) {
* Prepare a bilinear-leveled linear move on Cartesian,
* splitting the move where it crosses grid borders.
*/
- void LevelingBilinear::line_to_destination(const_feedRate_t scaled_fr_mm_s, uint16_t x_splits, uint16_t y_splits) {
+ void LevelingBilinear::line_to_destination(const feedRate_t scaled_fr_mm_s, uint16_t x_splits, uint16_t y_splits) {
// Get current and destination cells for this line
xy_int_t c1 { CELL_INDEX(x, current_position.x), CELL_INDEX(y, current_position.y) },
c2 { CELL_INDEX(x, destination.x), CELL_INDEX(y, destination.y) };
diff --git a/Marlin/src/feature/bedlevel/abl/bbl.h b/Marlin/src/feature/bedlevel/abl/bbl.h
index ca2e96593f..fb890333dc 100644
--- a/Marlin/src/feature/bedlevel/abl/bbl.h
+++ b/Marlin/src/feature/bedlevel/abl/bbl.h
@@ -45,7 +45,7 @@ private:
static float virt_coord(const uint8_t x, const uint8_t y);
static float virt_cmr(const float p[4], const uint8_t i, const float t);
- static float virt_2cmr(const uint8_t x, const uint8_t y, const_float_t tx, const_float_t ty);
+ static float virt_2cmr(const uint8_t x, const uint8_t y, const float tx, const float ty);
static void subdivide_mesh();
#endif
@@ -63,7 +63,7 @@ public:
static constexpr float get_z_offset() { return 0.0f; }
#if IS_CARTESIAN && DISABLED(SEGMENT_LEVELED_MOVES)
- static void line_to_destination(const_feedRate_t scaled_fr_mm_s, uint16_t x_splits=0xFFFF, uint16_t y_splits=0xFFFF);
+ static void line_to_destination(const feedRate_t scaled_fr_mm_s, uint16_t x_splits=0xFFFF, uint16_t y_splits=0xFFFF);
#endif
};
diff --git a/Marlin/src/feature/bedlevel/bedlevel.cpp b/Marlin/src/feature/bedlevel/bedlevel.cpp
index 12d620e5af..e479e4c70a 100644
--- a/Marlin/src/feature/bedlevel/bedlevel.cpp
+++ b/Marlin/src/feature/bedlevel/bedlevel.cpp
@@ -91,7 +91,7 @@ TemporaryBedLevelingState::TemporaryBedLevelingState(const bool enable) : saved(
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
- void set_z_fade_height(const_float_t zfh, const bool do_report/*=true*/) {
+ void set_z_fade_height(const float zfh, const bool do_report/*=true*/) {
if (planner.z_fade_height == zfh) return;
diff --git a/Marlin/src/feature/bedlevel/bedlevel.h b/Marlin/src/feature/bedlevel/bedlevel.h
index ccb9543e72..5bfa2b7faf 100644
--- a/Marlin/src/feature/bedlevel/bedlevel.h
+++ b/Marlin/src/feature/bedlevel/bedlevel.h
@@ -38,7 +38,7 @@ void set_bed_leveling_enabled(const bool enable=true);
void reset_bed_level();
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
- void set_z_fade_height(const_float_t zfh, const bool do_report=true);
+ void set_z_fade_height(const float zfh, const bool do_report=true);
#endif
#if ANY(MESH_BED_LEVELING, PROBE_MANUALLY)
diff --git a/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.cpp b/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.cpp
index 14216ac424..155d34c4df 100644
--- a/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.cpp
+++ b/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.cpp
@@ -61,7 +61,7 @@
* Prepare a mesh-leveled linear move in a Cartesian setup,
* splitting the move where it crosses mesh borders.
*/
- void mesh_bed_leveling::line_to_destination(const_feedRate_t scaled_fr_mm_s, uint8_t x_splits, uint8_t y_splits) {
+ void mesh_bed_leveling::line_to_destination(const feedRate_t scaled_fr_mm_s, uint8_t x_splits, uint8_t y_splits) {
// Get current and destination cells for this line
xy_uint8_t scel = cell_indexes(current_position), ecel = cell_indexes(destination);
NOMORE(scel.x, GRID_MAX_CELLS_X - 1);
diff --git a/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.h b/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.h
index cb4f36cd59..43dabd3adb 100644
--- a/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.h
+++ b/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.h
@@ -55,7 +55,7 @@ public:
static bool mesh_is_valid() { return has_mesh(); }
- static void set_z(const int8_t px, const int8_t py, const_float_t z) { z_values[px][py] = z; }
+ static void set_z(const int8_t px, const int8_t py, const float z) { z_values[px][py] = z; }
static void zigzag(const int8_t index, int8_t &px, int8_t &py) {
px = index % (GRID_MAX_POINTS_X);
@@ -63,7 +63,7 @@ public:
if (py & 1) px = (GRID_MAX_POINTS_X) - 1 - px; // Zig zag
}
- static void set_zigzag_z(const int8_t index, const_float_t z) {
+ static void set_zigzag_z(const int8_t index, const float z) {
int8_t px, py;
zigzag(index, px, py);
set_z(px, py, z);
@@ -72,33 +72,33 @@ public:
static float get_mesh_x(const uint8_t i) { return index_to_xpos[i]; }
static float get_mesh_y(const uint8_t i) { return index_to_ypos[i]; }
- static uint8_t cell_index_x(const_float_t x) {
+ static uint8_t cell_index_x(const float x) {
int8_t cx = (x - (MESH_MIN_X)) * RECIPROCAL(MESH_X_DIST);
return constrain(cx, 0, GRID_MAX_CELLS_X - 1);
}
- static uint8_t cell_index_y(const_float_t y) {
+ static uint8_t cell_index_y(const float y) {
int8_t cy = (y - (MESH_MIN_Y)) * RECIPROCAL(MESH_Y_DIST);
return constrain(cy, 0, GRID_MAX_CELLS_Y - 1);
}
- static xy_uint8_t cell_indexes(const_float_t x, const_float_t y) {
+ static xy_uint8_t cell_indexes(const float x, const float y) {
return { cell_index_x(x), cell_index_y(y) };
}
static xy_uint8_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) {
+ static int8_t probe_index_x(const float x) {
int8_t px = (x - (MESH_MIN_X) + 0.5f * (MESH_X_DIST)) * RECIPROCAL(MESH_X_DIST);
return WITHIN(px, 0, (GRID_MAX_POINTS_X) - 1) ? px : -1;
}
- static int8_t probe_index_y(const_float_t y) {
+ static int8_t probe_index_y(const float y) {
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 xy_int8_t probe_indexes(const_float_t x, const_float_t y) {
+ static xy_int8_t probe_indexes(const float x, const float y) {
return { probe_index_x(x), probe_index_y(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) {
+ static float calc_z0(const float a0, const float a1, const float z1, const float a2, const float z2) {
const float delta_z = (z2 - z1) / (a2 - a1),
delta_a = a0 - a1;
return z1 + delta_a * delta_z;
@@ -118,7 +118,7 @@ public:
}
#if IS_CARTESIAN && DISABLED(SEGMENT_LEVELED_MOVES)
- static void line_to_destination(const_feedRate_t scaled_fr_mm_s, uint8_t x_splits=0xFF, uint8_t y_splits=0xFF);
+ static void line_to_destination(const feedRate_t scaled_fr_mm_s, uint8_t x_splits=0xFF, uint8_t y_splits=0xFF);
#endif
};
diff --git a/Marlin/src/feature/bedlevel/ubl/ubl.cpp b/Marlin/src/feature/bedlevel/ubl/ubl.cpp
index 0228bd247e..e1f2ed4c16 100644
--- a/Marlin/src/feature/bedlevel/ubl/ubl.cpp
+++ b/Marlin/src/feature/bedlevel/ubl/ubl.cpp
@@ -102,7 +102,7 @@ void unified_bed_leveling::invalidate() {
set_all_mesh_points_to_value(NAN);
}
-void unified_bed_leveling::set_all_mesh_points_to_value(const_float_t value) {
+void unified_bed_leveling::set_all_mesh_points_to_value(const float value) {
GRID_LOOP(x, y) {
z_values[x][y] = value;
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(x, y, value));
@@ -115,7 +115,7 @@ void unified_bed_leveling::set_all_mesh_points_to_value(const_float_t value) {
constexpr int16_t Z_STEPS_NAN = INT16_MAX;
void unified_bed_leveling::set_store_from_mesh(const bed_mesh_t &in_values, mesh_store_t &stored_values) {
- auto z_to_store = [](const_float_t z) {
+ auto z_to_store = [](const float z) {
if (isnan(z)) return Z_STEPS_NAN;
const int32_t z_scaled = TRUNC(z * mesh_store_scaling);
if (z_scaled == Z_STEPS_NAN || !WITHIN(z_scaled, INT16_MIN, INT16_MAX))
diff --git a/Marlin/src/feature/bedlevel/ubl/ubl.h b/Marlin/src/feature/bedlevel/ubl/ubl.h
index 84ecc3a6c7..f6e9ba0cd9 100644
--- a/Marlin/src/feature/bedlevel/ubl/ubl.h
+++ b/Marlin/src/feature/bedlevel/ubl/ubl.h
@@ -67,15 +67,15 @@ private:
static G29_parameters_t param;
#if IS_NEWPANEL
- static void move_z_with_encoder(const_float_t multiplier);
+ static void move_z_with_encoder(const float multiplier);
static float measure_point_with_encoder();
static float measure_business_card_thickness();
- static void manually_probe_remaining_mesh(const xy_pos_t&, const_float_t, const_float_t, const bool) __O0;
+ static void manually_probe_remaining_mesh(const xy_pos_t&, const float, const float, const bool) __O0;
static void fine_tune_mesh(const xy_pos_t &pos, const bool do_ubl_mesh_map) __O0;
#endif
static bool G29_parse_parameters() __O0;
- static void shift_mesh_height();
+ static void shift_mesh_height(const float zoffs);
static void probe_entire_mesh(const xy_pos_t &near, const bool do_ubl_mesh_map, const bool stow_probe, const bool do_furthest) __O0;
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);
@@ -101,13 +101,13 @@ public:
static mesh_index_pair find_furthest_invalid_mesh_point() __O0;
static void reset();
static void invalidate();
- static void set_all_mesh_points_to_value(const_float_t value);
- static void adjust_mesh_to_mean(const bool cflag, const_float_t value);
+ static void set_all_mesh_points_to_value(const float value);
+ static void adjust_mesh_to_mean(const bool cflag, const float value);
static bool sanity_check();
static void smart_fill_mesh();
static void G29() __O0; // O0 for no optimization
- static void smart_fill_wlsf(const_float_t ) __O2; // O2 gives smaller code than Os on A2560
+ static void smart_fill_wlsf(const float ) __O2; // O2 gives smaller code than Os on A2560
static int8_t storage_slot;
@@ -130,42 +130,42 @@ public:
unified_bed_leveling();
- FORCE_INLINE static void set_z(const int8_t px, const int8_t py, const_float_t z) { z_values[px][py] = z; }
+ FORCE_INLINE static void set_z(const int8_t px, const int8_t py, const float z) { z_values[px][py] = z; }
- static int8_t cell_index_x_raw(const_float_t x) {
+ static int8_t cell_index_x_raw(const float x) {
return FLOOR((x - (MESH_MIN_X)) * RECIPROCAL(MESH_X_DIST));
}
- static int8_t cell_index_y_raw(const_float_t y) {
+ static int8_t cell_index_y_raw(const float y) {
return FLOOR((y - (MESH_MIN_Y)) * RECIPROCAL(MESH_Y_DIST));
}
- static bool cell_index_x_valid(const_float_t x) {
+ static bool cell_index_x_valid(const float x) {
return WITHIN(cell_index_x_raw(x), 0, GRID_MAX_CELLS_X - 1);
}
- static bool cell_index_y_valid(const_float_t y) {
+ static bool cell_index_y_valid(const float y) {
return WITHIN(cell_index_y_raw(y), 0, GRID_MAX_CELLS_Y - 1);
}
- static uint8_t cell_index_x(const_float_t x) {
+ static uint8_t cell_index_x(const float x) {
return constrain(cell_index_x_raw(x), 0, GRID_MAX_CELLS_X - 1);
}
- static uint8_t cell_index_y(const_float_t y) {
+ static uint8_t cell_index_y(const float y) {
return constrain(cell_index_y_raw(y), 0, GRID_MAX_CELLS_Y - 1);
}
- static xy_uint8_t cell_indexes(const_float_t x, const_float_t y) {
+ static xy_uint8_t cell_indexes(const float x, const float y) {
return { cell_index_x(x), cell_index_y(y) };
}
static xy_uint8_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) {
+ static int8_t closest_x_index(const float x) {
const int8_t px = (x - (MESH_MIN_X) + (MESH_X_DIST) * 0.5) * RECIPROCAL(MESH_X_DIST);
return WITHIN(px, 0, (GRID_MAX_POINTS_X) - 1) ? px : -1;
}
- static int8_t closest_y_index(const_float_t y) {
+ static int8_t closest_y_index(const float y) {
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;
}
@@ -188,7 +188,7 @@ public:
* It is fairly expensive with its 4 floating point additions and 2 floating point
* multiplications.
*/
- FORCE_INLINE static float calc_z0(const_float_t a0, const_float_t a1, const_float_t z1, const_float_t a2, const_float_t z2) {
+ FORCE_INLINE static float calc_z0(const float a0, const float a1, const float z1, const float a2, const float z2) {
return z1 + (z2 - z1) * (a0 - a1) / (a2 - a1);
}
@@ -202,7 +202,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 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 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)) {
@@ -225,7 +225,7 @@ public:
//
// See comments above for z_correction_for_x_on_horizontal_mesh_line
//
- static 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 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)) {
@@ -251,7 +251,7 @@ public:
* Z-Height at both ends. Then it does a linear interpolation of these heights based
* on the Y position within the cell.
*/
- static float get_z_correction(const_float_t rx0, const_float_t ry0) {
+ static float get_z_correction(const float rx0, const float ry0) {
const int8_t cx = cell_index_x(rx0), cy = cell_index_y(ry0); // return values are clamped
/**
@@ -295,9 +295,9 @@ public:
}
#if UBL_SEGMENTED
- static bool line_to_destination_segmented(const_feedRate_t scaled_fr_mm_s);
+ static bool line_to_destination_segmented(const feedRate_t scaled_fr_mm_s);
#else
- static void line_to_destination_cartesian(const_feedRate_t scaled_fr_mm_s, const uint8_t e);
+ static void line_to_destination_cartesian(const feedRate_t scaled_fr_mm_s, const uint8_t e);
#endif
static bool mesh_is_valid() {
diff --git a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp
index e6f93a001b..d97f1aa0af 100644
--- a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp
+++ b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp
@@ -612,7 +612,7 @@ void unified_bed_leveling::G29() {
case 5: adjust_mesh_to_mean(param.C_seen, param.C_constant); break;
- case 6: shift_mesh_height(); break;
+ case 6: shift_mesh_height(param.C_constant); break;
}
}
@@ -716,7 +716,7 @@ void unified_bed_leveling::G29() {
* G29 P5 C : Adjust Mesh To Mean (and subtract the given offset).
* Find the mean average and shift the mesh to center on that value.
*/
-void unified_bed_leveling::adjust_mesh_to_mean(const bool cflag, const_float_t offset) {
+void unified_bed_leveling::adjust_mesh_to_mean(const bool cflag, const float offset) {
float sum = 0;
uint8_t n = 0;
GRID_LOOP(x, y)
@@ -752,10 +752,10 @@ void unified_bed_leveling::adjust_mesh_to_mean(const bool cflag, const_float_t o
/**
* G29 P6 C : Shift Mesh Height by a uniform constant.
*/
-void unified_bed_leveling::shift_mesh_height() {
+void unified_bed_leveling::shift_mesh_height(const float zoffs) {
GRID_LOOP(x, y)
if (!isnan(z_values[x][y])) {
- z_values[x][y] += param.C_constant;
+ z_values[x][y] += zoffs;
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(x, y, z_values[x][y]));
}
}
@@ -870,7 +870,7 @@ void set_message_with_feedback(FSTR_P const fstr) {
return false;
}
- void unified_bed_leveling::move_z_with_encoder(const_float_t multiplier) {
+ void unified_bed_leveling::move_z_with_encoder(const float multiplier) {
ui.wait_for_release();
while (!ui.button_pressed()) {
idle();
@@ -953,7 +953,7 @@ void set_message_with_feedback(FSTR_P const fstr) {
* Move to INVALID points and
* NOTE: Blocks the G-code queue and captures Marlin UI during use.
*/
- void unified_bed_leveling::manually_probe_remaining_mesh(const xy_pos_t &pos, const_float_t z_clearance, const_float_t thick, const bool do_ubl_mesh_map) {
+ void unified_bed_leveling::manually_probe_remaining_mesh(const xy_pos_t &pos, const float z_clearance, const float thick, const bool do_ubl_mesh_map) {
ui.capture();
TERN_(EXTENSIBLE_UI, ExtUI::onLevelingStart());
@@ -1661,10 +1661,10 @@ void unified_bed_leveling::smart_fill_mesh() {
*/
#if ENABLED(VALIDATE_MESH_TILT)
auto d_from = []{ DEBUG_ECHOPGM("D from "); };
- auto normed = [&](const xy_pos_t &pos, const_float_t zadd) {
+ auto normed = [&](const xy_pos_t &pos, const float zadd) {
return normal.x * pos.x + normal.y * pos.y + zadd;
};
- auto debug_pt = [](const int num, const xy_pos_t &pos, const_float_t zadd) {
+ auto debug_pt = [](const int num, const xy_pos_t &pos, const float zadd) {
d_from();
DEBUG_ECHOLN(F("Point "), num, C(':'), p_float_t(normed(pos, zadd), 6), F(" Z error = "), p_float_t(zadd - get_z_correction(pos), 6));
};
@@ -1685,7 +1685,7 @@ void unified_bed_leveling::smart_fill_mesh() {
#endif // HAS_BED_PROBE
#if ENABLED(UBL_G29_P31)
- void unified_bed_leveling::smart_fill_wlsf(const_float_t weight_factor) {
+ void unified_bed_leveling::smart_fill_wlsf(const float weight_factor) {
// For each undefined mesh point, compute a distance-weighted least squares fit
// from all the originally populated mesh points, weighted toward the point
diff --git a/Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp b/Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp
index 053a68b77d..be9fb7b947 100644
--- a/Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp
+++ b/Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp
@@ -47,7 +47,7 @@
// corners of cells. To fix the issue, simply check if the start/end of the line
// is very close to a cell boundary in advance and don't split the line there.
- void unified_bed_leveling::line_to_destination_cartesian(const_feedRate_t scaled_fr_mm_s, const uint8_t extruder) {
+ void unified_bed_leveling::line_to_destination_cartesian(const feedRate_t scaled_fr_mm_s, const uint8_t extruder) {
/**
* Much of the nozzle movement will be within the same cell. So we will do as little computation
* as possible to determine if this is the case. If this move is within the same cell, we will
@@ -351,7 +351,7 @@
* Returns true if did NOT move, false if moved (requires current_position update).
*/
- bool __O2 unified_bed_leveling::line_to_destination_segmented(const_feedRate_t scaled_fr_mm_s) {
+ bool __O2 unified_bed_leveling::line_to_destination_segmented(const feedRate_t scaled_fr_mm_s) {
if (!position_is_reachable(destination)) // fail if moving outside reachable boundary
return true; // did not move, so current_position still accurate
diff --git a/Marlin/src/feature/caselight.cpp b/Marlin/src/feature/caselight.cpp
index eb580a6d62..95221111b2 100644
--- a/Marlin/src/feature/caselight.cpp
+++ b/Marlin/src/feature/caselight.cpp
@@ -40,7 +40,7 @@ bool CaseLight::on = CASE_LIGHT_DEFAULT_ON;
#if CASE_LIGHT_IS_COLOR_LED
constexpr uint8_t init_case_light[] = CASE_LIGHT_DEFAULT_COLOR;
- LEDColor CaseLight::color = { init_case_light[0], init_case_light[1], init_case_light[2] OPTARG(HAS_WHITE_LED, init_case_light[3]) };
+ LED1Color_t CaseLight::color = { init_case_light[0], init_case_light[1], init_case_light[2] OPTARG(HAS_WHITE_LED, init_case_light[3]) };
#endif
void CaseLight::update(const bool sflag) {
@@ -67,13 +67,13 @@ void CaseLight::update(const bool sflag) {
#if ENABLED(CASE_LIGHT_USE_NEOPIXEL)
if (on)
// Use current color of (NeoPixel) leds and new brightness level
- leds.set_color(LEDColor(leds.color.r, leds.color.g, leds.color.b OPTARG(HAS_WHITE_LED, leds.color.w) OPTARG(NEOPIXEL_LED, n10ct)));
+ leds.set_color(LED1Color_t(leds.color.r, leds.color.g, leds.color.b OPTARG(HAS_WHITE_LED, leds.color.w) OPTARG(NEOPIXEL_LED, n10ct)));
else
// Switch off leds
leds.set_off();
#else
// Use CaseLight color (CASE_LIGHT_DEFAULT_COLOR) and new brightness level
- leds.set_color(LEDColor(color.r, color.g, color.b OPTARG(HAS_WHITE_LED, color.w) OPTARG(NEOPIXEL_LED, n10ct)));
+ leds.set_color(LED1Color_t(color.r, color.g, color.b OPTARG(HAS_WHITE_LED, color.w) OPTARG(NEOPIXEL_LED, n10ct)));
#endif
#else // !CASE_LIGHT_IS_COLOR_LED
diff --git a/Marlin/src/feature/caselight.h b/Marlin/src/feature/caselight.h
index d88b3d67bf..28466cecaa 100644
--- a/Marlin/src/feature/caselight.h
+++ b/Marlin/src/feature/caselight.h
@@ -24,7 +24,7 @@
#include "../inc/MarlinConfig.h"
#if CASE_LIGHT_IS_COLOR_LED
- #include "leds/leds.h" // for LEDColor
+ #include "leds/leds.h" // for LED1Color_t
#endif
class CaseLight {
@@ -50,7 +50,7 @@ public:
#if ENABLED(CASE_LIGHT_IS_COLOR_LED)
private:
- static LEDColor color;
+ static LED1Color_t color;
#endif
};
diff --git a/Marlin/src/feature/controllerfan.cpp b/Marlin/src/feature/controllerfan.cpp
index 585568b250..243f0606ce 100644
--- a/Marlin/src/feature/controllerfan.cpp
+++ b/Marlin/src/feature/controllerfan.cpp
@@ -44,9 +44,30 @@ uint8_t ControllerFan::speed;
void ControllerFan::setup() {
SET_OUTPUT(CONTROLLER_FAN_PIN);
- #ifdef CONTROLLER_FAN2_PIN
+ #if PIN_EXISTS(CONTROLLER_FAN2)
SET_OUTPUT(CONTROLLER_FAN2_PIN);
#endif
+ #if PIN_EXISTS(CONTROLLER_FAN3)
+ SET_OUTPUT(CONTROLLER_FAN3_PIN);
+ #endif
+ #if PIN_EXISTS(CONTROLLER_FAN4)
+ SET_OUTPUT(CONTROLLER_FAN4_PIN);
+ #endif
+ #if PIN_EXISTS(CONTROLLER_FAN5)
+ SET_OUTPUT(CONTROLLER_FAN5_PIN);
+ #endif
+ #if PIN_EXISTS(CONTROLLER_FAN6)
+ SET_OUTPUT(CONTROLLER_FAN6_PIN);
+ #endif
+ #if PIN_EXISTS(CONTROLLER_FAN7)
+ SET_OUTPUT(CONTROLLER_FAN7_PIN);
+ #endif
+ #if PIN_EXISTS(CONTROLLER_FAN8)
+ SET_OUTPUT(CONTROLLER_FAN8_PIN);
+ #endif
+ #if PIN_EXISTS(CONTROLLER_FAN9)
+ SET_OUTPUT(CONTROLLER_FAN9_PIN);
+ #endif
init();
}
@@ -107,19 +128,38 @@ void ControllerFan::update() {
fan_kick_end = 0;
#endif
+ #define SET_CONTROLLER_FAN(N) do { \
+ if (PWM_PIN(CONTROLLER_FAN##N##_PIN)) hal.set_pwm_duty(pin_t(CONTROLLER_FAN##N##_PIN), speed); \
+ else WRITE(CONTROLLER_FAN##N##_PIN, speed > 0);\
+ } while (0)
+
#if ENABLED(FAN_SOFT_PWM)
soft_pwm_speed = speed;
#else
- if (PWM_PIN(CONTROLLER_FAN_PIN))
- hal.set_pwm_duty(pin_t(CONTROLLER_FAN_PIN), speed);
- else
- WRITE(CONTROLLER_FAN_PIN, speed > 0);
-
- #ifdef CONTROLLER_FAN2_PIN
- if (PWM_PIN(CONTROLLER_FAN2_PIN))
- hal.set_pwm_duty(pin_t(CONTROLLER_FAN2_PIN), speed);
- else
- WRITE(CONTROLLER_FAN2_PIN, speed > 0);
+ SET_CONTROLLER_FAN();
+ #if PIN_EXISTS(CONTROLLER_FAN2)
+ SET_CONTROLLER_FAN(2);
+ #endif
+ #if PIN_EXISTS(CONTROLLER_FAN3)
+ SET_CONTROLLER_FAN(3);
+ #endif
+ #if PIN_EXISTS(CONTROLLER_FAN4)
+ SET_CONTROLLER_FAN(4);
+ #endif
+ #if PIN_EXISTS(CONTROLLER_FAN5)
+ SET_CONTROLLER_FAN(5);
+ #endif
+ #if PIN_EXISTS(CONTROLLER_FAN6)
+ SET_CONTROLLER_FAN(6);
+ #endif
+ #if PIN_EXISTS(CONTROLLER_FAN7)
+ SET_CONTROLLER_FAN(7);
+ #endif
+ #if PIN_EXISTS(CONTROLLER_FAN8)
+ SET_CONTROLLER_FAN(8);
+ #endif
+ #if PIN_EXISTS(CONTROLLER_FAN9)
+ SET_CONTROLLER_FAN(9);
#endif
#endif
}
diff --git a/Marlin/src/feature/easythreed_ui.cpp b/Marlin/src/feature/easythreed_ui.cpp
index 8974c5befd..bfa51096f5 100644
--- a/Marlin/src/feature/easythreed_ui.cpp
+++ b/Marlin/src/feature/easythreed_ui.cpp
@@ -131,7 +131,7 @@ void EasythreedUI::loadButton() {
break;
case FS_PROCEED: {
- // Feed or Retract just once. Hard abort all moves and return to idle on swicth release.
+ // Feed or Retract just once. Hard abort all moves and return to idle on switch release.
static bool flag = false;
if (READ(BTN_RETRACT) && READ(BTN_FEED)) { // Switch in center position (stop)
flag = false; // Restore flag to false
diff --git a/Marlin/src/feature/encoder_i2c.h b/Marlin/src/feature/encoder_i2c.h
index 861a8e52d4..e8485a6b75 100644
--- a/Marlin/src/feature/encoder_i2c.h
+++ b/Marlin/src/feature/encoder_i2c.h
@@ -188,7 +188,7 @@ class I2CPositionEncoder {
FORCE_INLINE void set_ec_method(const byte method) { ecMethod = method; }
FORCE_INLINE float get_ec_threshold() { return ecThreshold; }
- FORCE_INLINE void set_ec_threshold(const_float_t newThreshold) { ecThreshold = newThreshold; }
+ FORCE_INLINE void set_ec_threshold(const float newThreshold) { ecThreshold = newThreshold; }
FORCE_INLINE int get_encoder_ticks_mm() {
switch (type) {
diff --git a/Marlin/src/feature/filwidth.h b/Marlin/src/feature/filwidth.h
index ab50fe0af3..d9e2a00025 100644
--- a/Marlin/src/feature/filwidth.h
+++ b/Marlin/src/feature/filwidth.h
@@ -78,7 +78,7 @@ public:
static void update_measured_mm() { measured_mm = raw_to_mm(); }
// Update ring buffer used to delay filament measurements
- static void advance_e(const_float_t e_move) {
+ static void advance_e(const float e_move) {
// Increment counters with the E distance
e_count += e_move;
diff --git a/Marlin/src/feature/leds/blinkm.cpp b/Marlin/src/feature/leds/blinkm.cpp
index 868eb4b3d9..b040c8e76f 100644
--- a/Marlin/src/feature/leds/blinkm.cpp
+++ b/Marlin/src/feature/leds/blinkm.cpp
@@ -32,7 +32,7 @@
#include "leds.h"
#include
-void blinkm_set_led_color(const LEDColor &color) {
+void blinkm_set_led_color(const LED1Color_t &color) {
Wire.begin();
Wire.beginTransmission(I2C_ADDRESS(0x09));
Wire.write('o'); //to disable ongoing script, only needs to be used once
diff --git a/Marlin/src/feature/leds/blinkm.h b/Marlin/src/feature/leds/blinkm.h
index 29a9e78412..d3c528acbf 100644
--- a/Marlin/src/feature/leds/blinkm.h
+++ b/Marlin/src/feature/leds/blinkm.h
@@ -25,7 +25,6 @@
* blinkm.h - Control a BlinkM over i2c
*/
-struct LEDColor;
-typedef LEDColor LEDColor;
+struct LED1Color_t;
-void blinkm_set_led_color(const LEDColor &color);
+void blinkm_set_led_color(const LED1Color_t &color);
diff --git a/Marlin/src/feature/leds/leds.cpp b/Marlin/src/feature/leds/leds.cpp
index 0c70253dc8..55a10fcbbd 100644
--- a/Marlin/src/feature/leds/leds.cpp
+++ b/Marlin/src/feature/leds/leds.cpp
@@ -35,15 +35,15 @@
#endif
#if ENABLED(LED_COLOR_PRESETS)
- const LEDColor LEDLights::defaultLEDColor = LEDColor(
+ const LED1Color_t LEDLights::defaultLEDColor {
LED_USER_PRESET_RED, LED_USER_PRESET_GREEN, LED_USER_PRESET_BLUE
OPTARG(HAS_WHITE_LED, LED_USER_PRESET_WHITE)
OPTARG(NEOPIXEL_LED, LED_USER_PRESET_BRIGHTNESS)
- );
+ };
#endif
#if ANY(LED_CONTROL_MENU, PRINTER_EVENT_LEDS, CASE_LIGHT_IS_COLOR_LED)
- LEDColor LEDLights::color;
+ LED1Color_t LEDLights::color;
bool LEDLights::lights_on;
#endif
@@ -101,7 +101,7 @@ void LEDLights::setup() {
constexpr int8_t led_pin_count = TERN(HAS_WHITE_LED, 4, 3);
// Startup animation
- LEDColor curColor = LEDColorOff();
+ LED1Color_t curColor = LEDColorOff();
PCA9632_set_led_color(curColor); // blackout
delay(200);
@@ -156,15 +156,15 @@ void LEDLights::setup() {
TERN_(LED_USER_PRESET_STARTUP, set_default());
}
-void LEDLights::set_color(const LEDColor &incol
+void LEDLights::set_color(const LED1Color_t &incol
OPTARG(NEOPIXEL_IS_SEQUENTIAL, bool isSequence/*=false*/)
) {
#if ENABLED(NEOPIXEL_LED)
const uint32_t neocolor = LEDColorWhite() == incol
- ? neo.Color(NEO_WHITE)
- : neo.Color(incol.r, incol.g, incol.b OPTARG(HAS_WHITE_LED, incol.w));
+ ? neo.White()
+ : neo.Color(incol.r, incol.g, incol.b OPTARG(HAS_WHITE_NEOPIXEL_1, incol.w));
#if ENABLED(NEOPIXEL_IS_SEQUENTIAL)
static uint16_t nextLed = 0;
@@ -258,7 +258,7 @@ void LEDLights::set_color(const LEDColor &incol
#if ENABLED(NEOPIXEL2_SEPARATE)
#if ENABLED(NEO2_COLOR_PRESETS)
- const LEDColor LEDLights2::defaultLEDColor = LEDColor(
+ const LED2Color_t LEDLights2::defaultLEDColor2 = LED2Color_t(
NEO2_USER_PRESET_RED, NEO2_USER_PRESET_GREEN, NEO2_USER_PRESET_BLUE
OPTARG(HAS_WHITE_LED2, NEO2_USER_PRESET_WHITE)
OPTARG(NEOPIXEL_LED, NEO2_USER_PRESET_BRIGHTNESS)
@@ -266,7 +266,7 @@ void LEDLights::set_color(const LEDColor &incol
#endif
#if ENABLED(LED_CONTROL_MENU)
- LEDColor LEDLights2::color;
+ LED2Color_t LEDLights2::color;
bool LEDLights2::lights_on;
#endif
@@ -277,10 +277,10 @@ void LEDLights::set_color(const LEDColor &incol
TERN_(NEO2_USER_PRESET_STARTUP, set_default());
}
- void LEDLights2::set_color(const LEDColor &incol) {
- const uint32_t neocolor = LEDColorWhite() == incol
- ? neo2.Color(NEO2_WHITE)
- : neo2.Color(incol.r, incol.g, incol.b OPTARG(HAS_WHITE_LED2, incol.w));
+ void LEDLights2::set_color(const LED2Color_t &incol) {
+ const uint32_t neocolor = LEDColorWhite2() == incol
+ ? neo2.White()
+ : neo2.Color(incol.r, incol.g, incol.b OPTARG(HAS_WHITE_NEOPIXEL_2, incol.w));
neo2.set_brightness(incol.i);
neo2.set_color(neocolor);
diff --git a/Marlin/src/feature/leds/leds.h b/Marlin/src/feature/leds/leds.h
index da8ba42fba..3ba3a31cdb 100644
--- a/Marlin/src/feature/leds/leds.h
+++ b/Marlin/src/feature/leds/leds.h
@@ -29,11 +29,6 @@
#include
-// A white component can be passed
-#if ANY(RGBW_LED, PCA9632_RGBW)
- #define HAS_WHITE_LED 1
-#endif
-
#if ENABLED(NEOPIXEL_LED)
#define _NEOPIXEL_INCLUDE_
#include "neopixel.h"
@@ -52,75 +47,142 @@
#include "pca9632.h"
#endif
+#if ANY(RGBW_LED, PCA9632_RGBW, HAS_WHITE_NEOPIXEL_1)
+ #define HAS_WHITE_LED 1
+#endif
+#if HAS_WHITE_NEOPIXEL_2
+ #define HAS_WHITE_LED2 1
+#endif
+
/**
* LEDcolor type for use with leds.set_color
*/
-typedef struct LEDColor {
- uint8_t r, g, b
- OPTARG(HAS_WHITE_LED, w)
- OPTARG(NEOPIXEL_LED, i)
- ;
+struct LED1Color_t {
+ // Basic RGB color components
+ uint8_t r, g, b OPTARG(HAS_WHITE_LED, w) OPTARG(NEOPIXEL_LED, i);
+ // Default constructor - white color
+ LED1Color_t() : r(255), g(255), b(255) OPTARG(HAS_WHITE_LED, w(255)) OPTARG(NEOPIXEL_LED, i(NEOPIXEL_BRIGHTNESS)){}
- LEDColor() : r(255), g(255), b(255)
- OPTARG(HAS_WHITE_LED, w(255))
- OPTARG(NEOPIXEL_LED, i(NEOPIXEL_BRIGHTNESS))
- {}
+ // Copy constructor
+ LED1Color_t(const LED1Color_t&) = default;
- LEDColor(const LEDColor&) = default;
-
- LEDColor(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))
+ // Constructor with individual components
+ LED1Color_t(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))
: r(r), g(g), b(b) OPTARG(HAS_WHITE_LED, w(w)) OPTARG(NEOPIXEL_LED, i(i)) {}
- LEDColor(const uint8_t (&rgbw)[4]) : r(rgbw[0]), g(rgbw[1]), b(rgbw[2])
- OPTARG(HAS_WHITE_LED, w(rgbw[3]))
- OPTARG(NEOPIXEL_LED, i(NEOPIXEL_BRIGHTNESS))
- {}
+ // Constructor from array
+ LED1Color_t(const uint8_t (&rgbw)[4]) : r(rgbw[0]), g(rgbw[1]), b(rgbw[2])
+ OPTARG(HAS_WHITE_LED, w(rgbw[3])) OPTARG(NEOPIXEL_LED, i(NEOPIXEL_BRIGHTNESS)){}
- LEDColor& operator=(const uint8_t (&rgbw)[4]) {
+ // Array assignment operator
+ LED1Color_t& operator=(const uint8_t (&rgbw)[4]) {
r = rgbw[0]; g = rgbw[1]; b = rgbw[2];
TERN_(HAS_WHITE_LED, w = rgbw[3]);
return *this;
}
- bool operator==(const LEDColor &right) {
- if (this == &right) return true;
- return 0 == memcmp(this, &right, sizeof(LEDColor));
+ // Comparison operators
+ bool operator==(const LED1Color_t &right) {
+ return (this == &right) || (0 == memcmp(this, &right, sizeof(LED1Color_t)));
}
- bool operator!=(const LEDColor &right) { return !operator==(right); }
+ bool operator!=(const LED1Color_t &right) {
+ return !operator==(right);
+ }
+ // Check if LED is effectively off
bool is_off() const {
return 3 > r + g + b + TERN0(HAS_WHITE_LED, w);
}
-} LEDColor;
+};
+
+
+struct LED2Color_t {
+ // Basic RGB color components
+ uint8_t r, g, b OPTARG(HAS_WHITE_LED2, w) OPTARG(NEOPIXEL_LED, i);
+ // Default constructor - white color
+ LED2Color_t() : r(255), g(255), b(255) OPTARG(HAS_WHITE_LED2, w(255)) OPTARG(NEOPIXEL_LED, i(NEOPIXEL_BRIGHTNESS)){}
+
+ // Copy constructor
+ LED2Color_t(const LED2Color_t&) = default;
+
+ // Constructor with individual components
+ LED2Color_t(uint8_t r, uint8_t g, uint8_t b OPTARG(HAS_WHITE_LED2, uint8_t w=0) OPTARG(NEOPIXEL_LED, uint8_t i=NEOPIXEL_BRIGHTNESS))
+ : r(r), g(g), b(b) OPTARG(HAS_WHITE_LED2, w(w)) OPTARG(NEOPIXEL_LED, i(i)) {}
+
+ // Constructor from array
+ LED2Color_t(const uint8_t (&rgbw)[4]) : r(rgbw[0]), g(rgbw[1]), b(rgbw[2])
+ OPTARG(HAS_WHITE_LED2, w(rgbw[3])) OPTARG(NEOPIXEL_LED, i(NEOPIXEL_BRIGHTNESS)){}
+
+ // Array assignment operator
+ LED2Color_t& operator=(const uint8_t (&rgbw)[4]) {
+ r = rgbw[0]; g = rgbw[1]; b = rgbw[2];
+ TERN_(HAS_WHITE_LED2, w = rgbw[3]);
+ return *this;
+ }
+
+ // Comparison operators
+ bool operator==(const LED2Color_t &right) {
+ return (this == &right) || (0 == memcmp(this, &right, sizeof(LED1Color_t)));
+ }
+
+ bool operator!=(const LED2Color_t &right) {
+ return !operator==(right);
+ }
+
+ // Check if LED is effectively off
+ bool is_off() const {
+ return 3 > r + g + b + TERN0(HAS_WHITE_LED2, w);
+ }
+};
/**
* Color presets
*/
-#define LEDColorOff() LEDColor( 0, 0, 0)
-#define LEDColorRed() LEDColor(255, 0, 0)
+#define LEDColorOff() LED1Color_t( 0, 0, 0)
+#define LEDColorRed() LED1Color_t(255, 0, 0)
#if ENABLED(LED_COLORS_REDUCE_GREEN)
- #define LEDColorOrange() LEDColor(255, 25, 0)
- #define LEDColorYellow() LEDColor(255, 75, 0)
+ #define LEDColorOrange() LED1Color_t(255, 25, 0)
+ #define LEDColorYellow() LED1Color_t(255, 75, 0)
#else
- #define LEDColorOrange() LEDColor(255, 80, 0)
- #define LEDColorYellow() LEDColor(255, 255, 0)
+ #define LEDColorOrange() LED1Color_t(255, 80, 0)
+ #define LEDColorYellow() LED1Color_t(255, 255, 0)
#endif
-#define LEDColorGreen() LEDColor( 0, 255, 0)
-#define LEDColorBlue() LEDColor( 0, 0, 255)
-#define LEDColorIndigo() LEDColor( 0, 255, 255)
-#define LEDColorViolet() LEDColor(255, 0, 255)
+#define LEDColorGreen() LED1Color_t( 0, 255, 0)
+#define LEDColorBlue() LED1Color_t( 0, 0, 255)
+#define LEDColorIndigo() LED1Color_t( 0, 255, 255)
+#define LEDColorViolet() LED1Color_t(255, 0, 255)
#if HAS_WHITE_LED && DISABLED(RGB_LED)
- #define LEDColorWhite() LEDColor( 0, 0, 0, 255)
+ #define LEDColorWhite() LED1Color_t( 0, 0, 0, 255)
#else
- #define LEDColorWhite() LEDColor(255, 255, 255)
+ #define LEDColorWhite() LED1Color_t(255, 255, 255)
#endif
+#define LEDColorOff2() LED2Color_t( 0, 0, 0)
+#define LEDColorRed2() LED2Color_t(255, 0, 0)
+#if ENABLED(LED_COLORS_REDUCE_GREEN)
+ #define LEDColorOrange2() LED2Color_t(255, 25, 0)
+ #define LEDColorYellow2() LED2Color_t(255, 75, 0)
+#else
+ #define LEDColorOrange2() LED2Color_t(255, 80, 0)
+ #define LEDColorYellow2() LED2Color_t(255, 255, 0)
+#endif
+#define LEDColorGreen2() LED2Color_t( 0, 255, 0)
+#define LEDColorBlue2() LED2Color_t( 0, 0, 255)
+#define LEDColorIndigo2() LED2Color_t( 0, 255, 255)
+#define LEDColorViolet2() LED2Color_t(255, 0, 255)
+#if HAS_WHITE_LED2 && DISABLED(RGB_LED)
+ #define LEDColorWhite2() LED2Color_t( 0, 0, 0, 255)
+#else
+ #define LEDColorWhite2() LED2Color_t(255, 255, 255)
+#endif
+
+
class LEDLights {
public:
#if ANY(LED_CONTROL_MENU, PRINTER_EVENT_LEDS, CASE_LIGHT_IS_COLOR_LED)
- static LEDColor color; // last non-off color
+ static LED1Color_t color; // last non-off color
static bool lights_on; // the last set color was "on"
#else
static constexpr bool lights_on = true;
@@ -130,7 +192,7 @@ public:
static void setup(); // init()
- static void set_color(const LEDColor &color
+ static void set_color(const LED1Color_t &color
OPTARG(NEOPIXEL_IS_SEQUENTIAL, bool isSequence=false)
);
@@ -139,7 +201,7 @@ public:
OPTARG(NEOPIXEL_LED, uint8_t i=NEOPIXEL_BRIGHTNESS)
OPTARG(NEOPIXEL_IS_SEQUENTIAL, bool isSequence=false)
) {
- set_color(LEDColor(r, g, b OPTARG(HAS_WHITE_LED, w) OPTARG(NEOPIXEL_LED, i)) OPTARG(NEOPIXEL_IS_SEQUENTIAL, isSequence));
+ set_color(LED1Color_t(r, g, b OPTARG(HAS_WHITE_LED, w) OPTARG(NEOPIXEL_LED, i)) OPTARG(NEOPIXEL_IS_SEQUENTIAL, isSequence));
}
static void set_off() { set_color(LEDColorOff()); }
@@ -147,7 +209,7 @@ public:
static void set_white() { set_color(LEDColorWhite()); }
#if ENABLED(LED_COLOR_PRESETS)
- static const LEDColor defaultLEDColor;
+ static const LED1Color_t defaultLEDColor;
static void set_default() { set_color(defaultLEDColor); }
static void set_red() { set_color(LEDColorRed()); }
static void set_orange() { set_color(LEDColorOrange()); }
@@ -158,7 +220,7 @@ public:
#endif
#if ENABLED(PRINTER_EVENT_LEDS)
- static LEDColor get_color() { return lights_on ? color : LEDColorOff(); }
+ static LED1Color_t get_color() { return lights_on ? color : LEDColorOff(); }
#endif
#if ENABLED(LED_CONTROL_MENU)
@@ -190,35 +252,35 @@ extern LEDLights leds;
static void setup(); // init()
- static void set_color(const LEDColor &color);
+ static void set_color(const LED2Color_t &color);
static void set_color(uint8_t r, uint8_t g, uint8_t b
- OPTARG(HAS_WHITE_LED, uint8_t w=0)
+ OPTARG(HAS_WHITE_LED2, uint8_t w=0)
OPTARG(NEOPIXEL_LED, uint8_t i=NEOPIXEL_BRIGHTNESS)
) {
- set_color(LEDColor(r, g, b
- OPTARG(HAS_WHITE_LED, w)
+ set_color(LED2Color_t(r, g, b
+ OPTARG(HAS_WHITE_LED2, w)
OPTARG(NEOPIXEL_LED, i)
));
}
- static void set_off() { set_color(LEDColorOff()); }
- static void set_green() { set_color(LEDColorGreen()); }
- static void set_white() { set_color(LEDColorWhite()); }
+ static void set_off() { set_color(LEDColorOff2()); }
+ static void set_green() { set_color(LEDColorGreen2()); }
+ static void set_white() { set_color(LEDColorWhite2()); }
#if ENABLED(NEO2_COLOR_PRESETS)
- static const LEDColor defaultLEDColor;
- 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()); }
+ static const LED2Color_t defaultLEDColor2;
+ static void set_default() { set_color(defaultLEDColor2); }
+ static void set_red() { set_color(LEDColorRed2()); }
+ static void set_orange() { set_color(LEDColorOrange2()); }
+ static void set_yellow() { set_color(LEDColorYellow2()); }
+ static void set_blue() { set_color(LEDColorBlue2()); }
+ static void set_indigo() { set_color(LEDColorIndigo2()); }
+ static void set_violet() { set_color(LEDColorViolet2()); }
#endif
#if ENABLED(NEOPIXEL2_SEPARATE)
- static LEDColor color; // last non-off color
+ static LED2Color_t color; // last non-off color
static bool lights_on; // the last set color was "on"
static void toggle(); // swap "off" with color
static void update() { set_color(color); }
diff --git a/Marlin/src/feature/leds/neopixel.cpp b/Marlin/src/feature/leds/neopixel.cpp
index 1b0772c2f9..8165c7715c 100644
--- a/Marlin/src/feature/leds/neopixel.cpp
+++ b/Marlin/src/feature/leds/neopixel.cpp
@@ -103,7 +103,7 @@ void Marlin_NeoPixel::init() {
safe_delay(500);
set_color_startup(adaneo1.Color(0, 0, 255, 0)); // blue
safe_delay(500);
- #if HAS_WHITE_LED
+ #if HAS_WHITE_NEOPIXEL_1
set_color_startup(adaneo1.Color(0, 0, 0, 255)); // white
safe_delay(500);
#endif
@@ -158,7 +158,7 @@ void Marlin_NeoPixel::init() {
safe_delay(500);
set_color_startup(adaneo.Color(0, 0, 255, 0)); // blue
safe_delay(500);
- #if HAS_WHITE_LED2
+ #if HAS_WHITE_NEOPIXEL_2
set_color_startup(adaneo.Color(0, 0, 0, 255)); // white
safe_delay(500);
#endif
diff --git a/Marlin/src/feature/leds/neopixel.h b/Marlin/src/feature/leds/neopixel.h
index 26f7a07d58..f420a25b83 100644
--- a/Marlin/src/feature/leds/neopixel.h
+++ b/Marlin/src/feature/leds/neopixel.h
@@ -42,19 +42,17 @@
// Defines
// ------------------------
-#define _NEO_IS_RGB(N) (N == NEO_RGB || N == NEO_RBG || N == NEO_GRB || N == NEO_GBR || N == NEO_BRG || N == NEO_BGR)
+#define _NEO_IS_RGBW(N) ((N) & 0x30) != (((N) >> 2) & 0x30)
-#if !_NEO_IS_RGB(NEOPIXEL_TYPE)
- #define HAS_WHITE_LED 1
+#if _NEO_IS_RGBW(NEOPIXEL_TYPE)
+ #define HAS_WHITE_NEOPIXEL_1 1
#endif
-#if HAS_WHITE_LED
- #define NEO_WHITE 0, 0, 0, 255
-#else
- #define NEO_WHITE 255, 255, 255
-#endif
-
-#if defined(NEOPIXEL2_TYPE) && NEOPIXEL2_TYPE != NEOPIXEL_TYPE && DISABLED(NEOPIXEL2_SEPARATE)
+#if ENABLED(NEOPIXEL2_SEPARATE)
+ #if _NEO_IS_RGBW(NEOPIXEL2_TYPE)
+ #define HAS_WHITE_NEOPIXEL_2 1
+ #endif
+#elif defined(NEOPIXEL2_TYPE) && NEOPIXEL2_TYPE != NEOPIXEL_TYPE
#define MULTIPLE_NEOPIXEL_TYPES 1
#endif
@@ -62,6 +60,8 @@
#define CONJOINED_NEOPIXEL 1
#endif
+#undef _NEO_IS_RGBW
+
// ------------------------
// Types
// ------------------------
@@ -141,8 +141,17 @@ public:
static uint8_t brightness() { return adaneo1.getBrightness(); }
- 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));
+ static uint32_t Color(uint8_t r, uint8_t g, uint8_t b OPTARG(HAS_WHITE_NEOPIXEL_1, uint8_t w=0)) {
+ return adaneo1.Color(r, g, b OPTARG(HAS_WHITE_NEOPIXEL_1, w));
+ }
+ static uint32_t White() {
+ return Color(
+ #if HAS_WHITE_NEOPIXEL_1
+ 0, 0, 0, 255
+ #else
+ 255, 255, 255
+ #endif
+ );
}
};
@@ -151,15 +160,6 @@ extern Marlin_NeoPixel neo;
// Neo pixel channel 2
#if ENABLED(NEOPIXEL2_SEPARATE)
- #if _NEO_IS_RGB(NEOPIXEL2_TYPE)
- #define NEOPIXEL2_IS_RGB 1
- #define NEO2_WHITE 255, 255, 255
- #else
- #define NEOPIXEL2_IS_RGBW 1
- #define HAS_WHITE_LED2 1 // A white component can be passed for NEOPIXEL2
- #define NEO2_WHITE 0, 0, 0, 255
- #endif
-
class Marlin_NeoPixel2 {
private:
static Adafruit_NeoPixel adaneo;
@@ -184,13 +184,20 @@ extern Marlin_NeoPixel neo;
static uint16_t pixels() { return adaneo.numPixels();}
static uint32_t pixel_color(const uint16_t n) { return adaneo.getPixelColor(n); }
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));
+ static uint32_t Color(uint8_t r, uint8_t g, uint8_t b OPTARG(HAS_WHITE_NEOPIXEL_2, uint8_t w=0)) {
+ return adaneo.Color(r, g, b OPTARG(HAS_WHITE_NEOPIXEL_2, w));
+ }
+ static uint32_t White() {
+ return Color(
+ #if HAS_WHITE_NEOPIXEL_2
+ 0, 0, 0, 255
+ #else
+ 255, 255, 255
+ #endif
+ );
}
};
extern Marlin_NeoPixel2 neo2;
#endif // NEOPIXEL2_SEPARATE
-
-#undef _NEO_IS_RGB
diff --git a/Marlin/src/feature/leds/pca9632.cpp b/Marlin/src/feature/leds/pca9632.cpp
index 40c16a9276..d8fba380a4 100644
--- a/Marlin/src/feature/leds/pca9632.cpp
+++ b/Marlin/src/feature/leds/pca9632.cpp
@@ -68,7 +68,7 @@
#ifndef PCA9632_BLU
#define PCA9632_BLU 0x04
#endif
-#if HAS_WHITE_LED && !defined(PCA9632_WHT)
+#if ENABLED(PCA9632_RGBW) && !defined(PCA9632_WHT)
#define PCA9632_WHT 0x06
#endif
@@ -124,7 +124,7 @@ static void PCA9632_WriteAllRegisters(const byte addr, const byte regadd, const
}
#endif
-void PCA9632_set_led_color(const LEDColor &color) {
+void PCA9632_set_led_color(const LED1Color_t &color) {
Wire.begin();
if (!PCA_init) {
PCA_init = 1;
@@ -135,10 +135,7 @@ void PCA9632_set_led_color(const LEDColor &color) {
const byte LEDOUT = (color.r ? LED_PWM << PCA9632_RED : 0)
| (color.g ? LED_PWM << PCA9632_GRN : 0)
| (color.b ? LED_PWM << PCA9632_BLU : 0)
- #if ENABLED(PCA9632_RGBW)
- | (color.w ? LED_PWM << PCA9632_WHT : 0)
- #endif
- ;
+ | (TERN0(PCA9632_RGBW, color.w ? LED_PWM << PCA9632_WHT : 0));
PCA9632_WriteAllRegisters(PCA9632_ADDRESS,PCA9632_PWM0, color.r, color.g, color.b
OPTARG(PCA9632_RGBW, color.w)
diff --git a/Marlin/src/feature/leds/pca9632.h b/Marlin/src/feature/leds/pca9632.h
index adef0200af..442166c245 100644
--- a/Marlin/src/feature/leds/pca9632.h
+++ b/Marlin/src/feature/leds/pca9632.h
@@ -26,10 +26,9 @@
* Written by Robert Mendon Feb 2017.
*/
-struct LEDColor;
-typedef LEDColor LEDColor;
+struct LED1Color_t;
-void PCA9632_set_led_color(const LEDColor &color);
+void PCA9632_set_led_color(const LED1Color_t &color);
#if ENABLED(PCA9632_BUZZER)
#include
diff --git a/Marlin/src/feature/leds/printer_event_leds.cpp b/Marlin/src/feature/leds/printer_event_leds.cpp
index e6407a6320..3cbce3da8c 100644
--- a/Marlin/src/feature/leds/printer_event_leds.cpp
+++ b/Marlin/src/feature/leds/printer_event_leds.cpp
@@ -47,7 +47,7 @@ PrinterEventLEDs printerEventLEDs;
inline void pel_set_rgb(const uint8_t r, const uint8_t g, const uint8_t b OPTARG(HAS_WHITE_LED, const uint8_t w=0)) {
leds.set_color(
- LEDColor(r, g, b OPTARG(HAS_WHITE_LED, w) OPTARG(NEOPIXEL_LED, neo.brightness()))
+ LED1Color_t(r, g, b OPTARG(HAS_WHITE_LED, w) OPTARG(NEOPIXEL_LED, neo.brightness()))
OPTARG(NEOPIXEL_IS_SEQUENTIAL, true)
);
}
diff --git a/Marlin/src/feature/leds/printer_event_leds.h b/Marlin/src/feature/leds/printer_event_leds.h
index 856826b969..5fb08a547e 100644
--- a/Marlin/src/feature/leds/printer_event_leds.h
+++ b/Marlin/src/feature/leds/printer_event_leds.h
@@ -40,23 +40,23 @@ private:
public:
#if HAS_TEMP_HOTEND
- static LEDColor onHotendHeatingStart() { old_intensity = 0; return leds.get_color(); }
+ static LED1Color_t 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 LEDColor onBedHeatingStart() { old_intensity = 127; return leds.get_color(); }
+ static LED1Color_t 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 LEDColor onChamberHeatingStart() { old_intensity = 127; return leds.get_color(); }
+ static LED1Color_t 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 void onHeatingDone() { leds.set_white(); }
- static void onPIDTuningDone(LEDColor c) { leds.set_color(c); }
+ static void onPIDTuningDone(LED1Color_t c) { leds.set_color(c); }
#endif
#if HAS_MEDIA
diff --git a/Marlin/src/feature/max7219.cpp b/Marlin/src/feature/max7219.cpp
index 16c7c4f55b..81f588008d 100644
--- a/Marlin/src/feature/max7219.cpp
+++ b/Marlin/src/feature/max7219.cpp
@@ -283,7 +283,7 @@ void Max7219::set(const uint8_t line, const uint8_t bits) {
}
// Draw a float with a decimal point and optional digits
- void Max7219::print(const uint8_t start, const_float_t value, const uint8_t pre_size, const uint8_t post_size, const bool leadzero=false) {
+ void Max7219::print(const uint8_t start, const float value, const uint8_t pre_size, const uint8_t post_size, const bool leadzero=false) {
if (pre_size) print(start, value, pre_size, leadzero, !!post_size);
if (post_size) {
const int16_t after = ABS(value) * (10 ^ post_size);
diff --git a/Marlin/src/feature/max7219.h b/Marlin/src/feature/max7219.h
index f476f7cde4..799524dc5f 100644
--- a/Marlin/src/feature/max7219.h
+++ b/Marlin/src/feature/max7219.h
@@ -166,7 +166,7 @@ public:
// Draw an integer with optional leading zeros and optional decimal point
void print(const uint8_t start, int16_t value, uint8_t size, const bool leadzero=false, bool dec=false);
// Draw a float with a decimal point and optional digits
- void print(const uint8_t start, const_float_t value, const uint8_t pre_size, const uint8_t post_size, const bool leadzero=false);
+ void print(const uint8_t start, const float value, const uint8_t pre_size, const uint8_t post_size, const bool leadzero=false);
#endif
// Set a single LED by XY coordinate
diff --git a/Marlin/src/feature/mixing.cpp b/Marlin/src/feature/mixing.cpp
index f3fb2d07a3..bc98bf3b26 100644
--- a/Marlin/src/feature/mixing.cpp
+++ b/Marlin/src/feature/mixing.cpp
@@ -166,7 +166,7 @@ void Mixer::refresh_collector(const float proportion/*=1.0*/, const uint8_t t/*=
float Mixer::prev_z; // = 0
- void Mixer::update_gradient_for_z(const_float_t z) {
+ void Mixer::update_gradient_for_z(const float z) {
if (z == prev_z) return;
prev_z = z;
diff --git a/Marlin/src/feature/mixing.h b/Marlin/src/feature/mixing.h
index c0f45e364a..bd7ffb560e 100644
--- a/Marlin/src/feature/mixing.h
+++ b/Marlin/src/feature/mixing.h
@@ -174,9 +174,9 @@ class Mixer {
static float prev_z;
// 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_z(const float z);
static void update_gradient_for_planner_z();
- static void gradient_control(const_float_t z) {
+ static void gradient_control(const float z) {
if (gradient.enabled) {
if (z >= gradient.end_z)
T(gradient.end_vtool);
diff --git a/Marlin/src/feature/mmu/mmu2-serial-protocol.md b/Marlin/src/feature/mmu/mmu2-serial-protocol.md
index 088d41b446..40799d41a9 100644
--- a/Marlin/src/feature/mmu/mmu2-serial-protocol.md
+++ b/Marlin/src/feature/mmu/mmu2-serial-protocol.md
@@ -1,5 +1,4 @@
-Startup sequence
-================
+# Startup sequence
When initialized, MMU sends
@@ -20,18 +19,17 @@ We follow with
#endif
- MMU <= 'P0\n'
-- MMU => '*FINDA status*\n'
+- MMU => '_FINDA status_\n'
Now we are sure MMU is available and ready. If there was a timeout or other communication problem somewhere, printer will be killed.
-- *Firmware version* is an integer value, but we don't care about it
-- *Build number* is an integer value and has to be >=126, or =>132 if 12V mode is enabled
-- *FINDA status* is 1 if the filament is loaded to the extruder, 0 otherwise
+- _Firmware version_ is an integer value, but we don't care about it
+- _Build number_ is an integer value and has to be >=126, or =>132 if 12V mode is enabled
+- _FINDA status_ is 1 if the filament is loaded to the extruder, 0 otherwise
-*Build number* is checked against the required value, if it does not match, printer is halted.
+_Build number_ is checked against the required value, if it does not match, printer is halted.
-Toolchange
-==========
+# Toolchange
- MMU <= 'T*Filament index*\n'
@@ -51,16 +49,14 @@ When done, the MMU sends
We don't wait for a response here but immediately continue with the next G-code which should
be one or more extruder moves to feed the filament into the hotend.
-FINDA status
-============
+# FINDA status
- MMU <= 'P0\n'
-- MMU => '*FINDA status*\n'
+- MMU => '_FINDA status_\n'
-*FINDA status* is 1 if the is filament loaded to the extruder, 0 otherwise. This could be used as filament runout sensor if probed regularly.
+_FINDA status_ is 1 if the is filament loaded to the extruder, 0 otherwise. This could be used as filament runout sensor if probed regularly.
-Load filament
-=============
+# Load filament
- MMU <= 'L*Filament index*\n'
@@ -68,8 +64,7 @@ MMU will feed filament down to the extruder, when done
- MMU => 'ok\n'
-Unload filament
-=============
+# Unload filament
- MMU <= 'U0\n'
@@ -77,8 +72,7 @@ MMU will retract current filament from the extruder, when done
- MMU => 'ok\n'
-Eject filament
-==============
+# Eject filament
- MMU <= 'E*Filament index*\n'
- MMU => 'ok\n'
diff --git a/Marlin/src/feature/mmu/mmu2.cpp b/Marlin/src/feature/mmu/mmu2.cpp
index 96724d0d70..b976150ed9 100644
--- a/Marlin/src/feature/mmu/mmu2.cpp
+++ b/Marlin/src/feature/mmu/mmu2.cpp
@@ -96,7 +96,7 @@ struct E_Step {
feedRate_t feedRate; //!< feed rate in mm/s
};
-inline void unscaled_mmu2_e_move(const float &dist, const feedRate_t fr_mm_s, const bool sync=true) {
+inline void unscaled_mmu2_e_move(const float dist, const feedRate_t fr_mm_s, const bool sync=true) {
current_position.e += dist / planner.e_factor[active_extruder];
line_to_current_position(fr_mm_s);
if (sync) planner.synchronize();
diff --git a/Marlin/src/feature/mmu3/mmu3-serial-protocol.md b/Marlin/src/feature/mmu3/mmu3-serial-protocol.md
index fd0f1fbcba..0d0f7ac6e0 100644
--- a/Marlin/src/feature/mmu3/mmu3-serial-protocol.md
+++ b/Marlin/src/feature/mmu3/mmu3-serial-protocol.md
@@ -28,6 +28,7 @@ This set of responses combines to indicate firmware version 3.0.2.
## Startup sequence
When initialized the MMU waits for requests. Marlin repeatedly sends `S0` commands until it gets an answer:
+
```
MMU3:>S0*c6\n
MMU3:>S0*c6\n
@@ -36,11 +37,13 @@ MMU3:>S0*c6\n
```
Once communication is established the MMU responds with:
+
```
MMU3:S1*ad\n
MMU3:M1*{CRC8};
MMU3:<---nothing---
@@ -61,10 +65,10 @@ MMU3:T0*{CRC8}\n
@@ -96,6 +102,7 @@ MMU3:>C0*{CRC8}\n
```
The MMU will feed a few more millimeters of filament for the extruder gears to grab. When done, the MMU sends:
+
```
MMU3:>Q0*{CRC8}\n
MMU3: FinishingMoves
@@ -103,18 +110,20 @@ MMU3: FinishingMoves
After the `T0*P9` response we immediately continue with the next G-code which should be one or more extruder moves to feed the filament into the hotend.
-
## FINDA status
+
```
MMU3:>P0*{CRC8}\n
```
If the filament is loaded to the extruder, FINDA status is 1 and the MMU responds with:
+
```
MMU3:L{Filament index}*{CRC8}\n
MMU3:Q0*{CRC8}\n
```
The MMU will respond with status messages:
+
```
MMU3:Q0*{CRC8}\n
MMU3:= cali_info[tsi].measurements) return;
sensor_z_offsets[tsi][calib_idx++] = static_cast((meas_z - init_measurement) * 1000.0f);
}
@@ -186,7 +186,7 @@ void ProbeTempComp::compensate_measurement(const TempSensorID tsi, const celsius
};
// Interpolate Z based on a temperature being within a given range
- auto linear_interp = [](const_float_t x, xy_float_t p1, xy_float_t p2) {
+ auto linear_interp = [](const float x, xy_float_t p1, xy_float_t p2) {
// zoffs1 + zoffset_per_toffset * toffset
return p1.y + (p2.y - p1.y) / (p2.x - p1.x) * (x - p1.x);
};
diff --git a/Marlin/src/feature/probe_temp_comp.h b/Marlin/src/feature/probe_temp_comp.h
index 42348db684..e6509a20cf 100644
--- a/Marlin/src/feature/probe_temp_comp.h
+++ b/Marlin/src/feature/probe_temp_comp.h
@@ -84,8 +84,8 @@ class ProbeTempComp {
}
static bool set_offset(const TempSensorID tsi, const uint8_t idx, const int16_t offset);
static void print_offsets();
- static void prepare_new_calibration(const_float_t init_meas_z);
- static void push_back_new_measurement(const TempSensorID tsi, const_float_t meas_z);
+ static void prepare_new_calibration(const float init_meas_z);
+ static void push_back_new_measurement(const TempSensorID tsi, const float meas_z);
static bool finish_calibration(const TempSensorID tsi);
static void set_enabled(const bool ena) { enabled = ena; }
diff --git a/Marlin/src/feature/runout.cpp b/Marlin/src/feature/runout.cpp
index aa64ed9b93..f0b94d0de8 100644
--- a/Marlin/src/feature/runout.cpp
+++ b/Marlin/src/feature/runout.cpp
@@ -51,7 +51,6 @@ bool FilamentMonitorBase::enabled = true,
#if ENABLED(FILAMENT_MOTION_SENSOR)
uint8_t FilamentSensorEncoder::motion_detected;
#endif
-
#if ENABLED(FILAMENT_SWITCH_AND_MOTION)
bool RunoutResponseDelayed::ignore_motion = false;
float RunoutResponseDelayed::motion_distance_mm = FILAMENT_MOTION_DISTANCE_MM;
diff --git a/Marlin/src/feature/runout.h b/Marlin/src/feature/runout.h
index e6b4daaa6d..1cd90b0bb2 100644
--- a/Marlin/src/feature/runout.h
+++ b/Marlin/src/feature/runout.h
@@ -123,12 +123,12 @@ class TFilamentMonitor : public FilamentMonitorBase {
response.filament_motion_present(extruder);
}
static float& motion_distance() { return response.motion_distance_mm; }
- static void set_motion_distance(const_float_t mm) { response.motion_distance_mm = mm; }
+ static void set_motion_distance(const float mm) { response.motion_distance_mm = mm; }
#endif
#if HAS_FILAMENT_RUNOUT_DISTANCE
static float& runout_distance() { return response.runout_distance_mm; }
- static void set_runout_distance(const_float_t mm) { response.runout_distance_mm = mm; }
+ static void set_runout_distance(const float mm) { response.runout_distance_mm = mm; }
#endif
// Handle a block completion. RunoutResponseDelayed uses this to
@@ -143,38 +143,37 @@ class TFilamentMonitor : public FilamentMonitorBase {
// Give the response a chance to update its counter.
static void run() {
- if (enabled && !filament_ran_out && should_monitor_runout()) {
- TERN_(HAS_FILAMENT_RUNOUT_DISTANCE, cli()); // Prevent RunoutResponseDelayed::block_completed from accumulating here
- response.run();
- sensor.run();
- const runout_flags_t runout_flags = response.has_run_out();
- TERN_(HAS_FILAMENT_RUNOUT_DISTANCE, sei());
- #if MULTI_FILAMENT_SENSOR
- #if ENABLED(WATCH_ALL_RUNOUT_SENSORS)
- const bool ran_out = bool(runout_flags); // any sensor triggers
- uint8_t extruder = 0;
- if (ran_out) while (!runout_flags.test(extruder)) extruder++;
- #else
- const bool ran_out = runout_flags[active_extruder]; // suppress non active extruders
- uint8_t extruder = active_extruder;
- #endif
+ if (!enabled || filament_ran_out || !should_monitor_runout()) return;
+ TERN_(HAS_FILAMENT_RUNOUT_DISTANCE, cli()); // Prevent RunoutResponseDelayed::block_completed from accumulating here
+ response.run();
+ sensor.run();
+ const runout_flags_t runout_flags = response.has_run_out();
+ TERN_(HAS_FILAMENT_RUNOUT_DISTANCE, sei());
+ #if MULTI_FILAMENT_SENSOR
+ #if ENABLED(WATCH_ALL_RUNOUT_SENSORS)
+ const bool ran_out = bool(runout_flags); // any sensor triggers
+ uint8_t extruder = 0;
+ if (ran_out) while (!runout_flags.test(extruder)) extruder++;
#else
- const bool ran_out = bool(runout_flags);
+ const bool ran_out = runout_flags[active_extruder]; // suppress non active extruders
uint8_t extruder = active_extruder;
#endif
+ #else
+ const bool ran_out = bool(runout_flags);
+ uint8_t extruder = active_extruder;
+ #endif
- if (ran_out) {
- #if ENABLED(FILAMENT_RUNOUT_SENSOR_DEBUG)
- SERIAL_ECHOPGM("Runout Sensors: ");
- for (uint8_t i = 0; i < 8; ++i) SERIAL_CHAR('0' + char(runout_flags[i]));
- SERIAL_ECHOLNPGM(" -> ", extruder, " RUN OUT");
- #endif
+ if (!ran_out) return;
- filament_ran_out = true;
- event_filament_runout(extruder);
- planner.synchronize();
- }
- }
+ #if ENABLED(FILAMENT_RUNOUT_SENSOR_DEBUG)
+ SERIAL_ECHOPGM("Runout Sensors: ");
+ for (uint8_t i = 0; i < 8; ++i) SERIAL_CHAR('0' + char(runout_flags[i]));
+ SERIAL_ECHOLNPGM(" -> ", extruder, " RUN OUT");
+ #endif
+
+ filament_ran_out = true;
+ event_filament_runout(extruder);
+ planner.synchronize();
}
// Reset after a filament runout or upon resuming a job
@@ -376,7 +375,9 @@ class FilamentSensorBase {
class RunoutResponseDelayed {
private:
static countdown_t mm_countdown;
- static bool ignore_motion; // Flag to ignore the encoder
+ #if ENABLED(FILAMENT_SWITCH_AND_MOTION)
+ static bool ignore_motion; // Flag to ignore the encoder
+ #endif
public:
static float runout_distance_mm;
@@ -385,13 +386,17 @@ class FilamentSensorBase {
static float motion_distance_mm;
#endif
- static void set_ignore_motion(const bool ignore=true) { ignore_motion = ignore; }
+ static void set_ignore_motion(const bool ignore=true) {
+ UNUSED(ignore);
+ TERN_(FILAMENT_SWITCH_AND_MOTION, ignore_motion = ignore);
+ }
static void reset() {
for (uint8_t i = 0; i < NUM_RUNOUT_SENSORS; ++i) filament_present(i);
#if ENABLED(FILAMENT_SWITCH_AND_MOTION)
for (uint8_t i = 0; i < NUM_MOTION_SENSORS; ++i) filament_motion_present(i);
#endif
+ set_ignore_motion(false);
}
static void run() {
@@ -413,13 +418,24 @@ class FilamentSensorBase {
// Get runout status for all presence sensors and motion sensors
static runout_flags_t has_run_out() {
runout_flags_t runout_flags{0};
- // Runout based on filament presence
- for (uint8_t i = 0; i < NUM_RUNOUT_SENSORS; ++i) if (mm_countdown.runout[i] < 0) runout_flags.set(i);
- // Runout based on filament motion
+
#if ENABLED(FILAMENT_SWITCH_AND_MOTION)
- if (!ignore_motion)
- for (uint8_t i = 0; i < NUM_MOTION_SENSORS; ++i) if (mm_countdown.motion[i] < 0) runout_flags.set(i);
+ // Runout based on filament motion
+ if (!ignore_motion) {
+ for (uint8_t i = 0; i < NUM_MOTION_SENSORS; ++i) {
+ if (mm_countdown.motion[i] < 0) {
+ runout_flags.set(i);
+ mm_countdown.runout[i] = -1; // For a filament jam don't wait for runout_distance_mm!
+ }
+ }
+ }
#endif
+
+ // Runout based on filament presence
+ for (uint8_t i = 0; i < NUM_RUNOUT_SENSORS; ++i)
+ if (mm_countdown.runout[i] < 0)
+ runout_flags.set(i);
+
return runout_flags;
}
@@ -471,8 +487,8 @@ class FilamentSensorBase {
if (mm_countdown.runout_reset[e]) filament_present(e); // Reset pending. Try to reset.
}
- // Apply E distance to motion countdown, reset if flagged
#if ENABLED(FILAMENT_SWITCH_AND_MOTION)
+ // Apply E distance to motion countdown, reset if flagged
if (!ignore_motion && e < NUM_MOTION_SENSORS) {
mm_countdown.motion[e] -= mm;
if (mm_countdown.motion_reset[e]) filament_motion_present(e); // Reset pending. Try to reset.
@@ -484,7 +500,7 @@ class FilamentSensorBase {
static void init_for_restart(const bool onoff=true) {
UNUSED(onoff);
#if ENABLED(FILAMENT_SWITCH_AND_MOTION)
- reset();
+ reset(); // also calls set_ignore_motion(false)
set_ignore_motion(!onoff);
#endif
}
diff --git a/Marlin/src/feature/spindle_laser.h b/Marlin/src/feature/spindle_laser.h
index a283f0786d..8702bd289a 100644
--- a/Marlin/src/feature/spindle_laser.h
+++ b/Marlin/src/feature/spindle_laser.h
@@ -54,7 +54,7 @@ class SpindleLaser {
public:
static CutterMode cutter_mode;
- static constexpr uint8_t pct_to_ocr(const_float_t pct) { return uint8_t(PCT_TO_PWM(pct)); }
+ static constexpr uint8_t pct_to_ocr(const float pct) { return uint8_t(PCT_TO_PWM(pct)); }
// cpower = configured values (e.g., SPEED_POWER_MAX)
// Convert configured power range to a percentage
diff --git a/Marlin/src/feature/tmc_util.cpp b/Marlin/src/feature/tmc_util.cpp
index 5a3c1752d3..06ee4c9e93 100644
--- a/Marlin/src/feature/tmc_util.cpp
+++ b/Marlin/src/feature/tmc_util.cpp
@@ -89,7 +89,9 @@
#if HAS_TMCX1X0
- static uint32_t get_pwm_scale(TMC2130Stepper &st) { return st.PWM_SCALE(); }
+ #if ENABLED(TMC_DEBUG)
+ static uint32_t get_pwm_scale(TMC2130Stepper &st) { return st.PWM_SCALE(); }
+ #endif
static TMC_driver_data get_driver_data(TMC2130Stepper &st) {
constexpr uint8_t OT_bp = 25, OTPW_bp = 26;
@@ -148,7 +150,9 @@
#if HAS_DRIVER(TMC2240)
- static uint32_t get_pwm_scale(TMC2240Stepper &st) { return st.PWM_SCALE(); }
+ #if ENABLED(TMC_DEBUG)
+ static uint32_t get_pwm_scale(TMC2240Stepper &st) { return st.PWM_SCALE(); }
+ #endif
static TMC_driver_data get_driver_data(TMC2240Stepper &st) {
constexpr uint8_t OT_bp = 25, OTPW_bp = 26;
@@ -207,7 +211,9 @@
#if HAS_TMC220x
- static uint32_t get_pwm_scale(TMC2208Stepper &st) { return st.pwm_scale_sum(); }
+ #if ENABLED(TMC_DEBUG)
+ static uint32_t get_pwm_scale(TMC2208Stepper &st) { return st.pwm_scale_sum(); }
+ #endif
static TMC_driver_data get_driver_data(TMC2208Stepper &st) {
constexpr uint8_t OTPW_bp = 0, OT_bp = 1;
@@ -242,7 +248,9 @@
#if HAS_DRIVER(TMC2660)
- static uint32_t get_pwm_scale(TMC2660Stepper) { return 0; }
+ #if ENABLED(TMC_DEBUG)
+ static uint32_t get_pwm_scale(TMC2660Stepper) { return 0; }
+ #endif
static TMC_driver_data get_driver_data(TMC2660Stepper &st) {
constexpr uint8_t OT_bp = 1, OTPW_bp = 2;
@@ -1013,7 +1021,7 @@
TMC_REPORT("Supply (v)", TMC_VSUPPLY);
TMC_REPORT("Temp (°C)", TMC_TEMP);
TMC_REPORT("OT pre warn (°C)", TMC_OVERTEMP);
- TMC_REPORT("OV theshold (v)", TMC_OVERVOLT_THD);
+ TMC_REPORT("OV threshold (v)", TMC_OVERVOLT_THD);
#endif
SERIAL_EOL();
}
diff --git a/Marlin/src/feature/x_twist.cpp b/Marlin/src/feature/x_twist.cpp
index 2b7924707e..6b155c49ab 100644
--- a/Marlin/src/feature/x_twist.cpp
+++ b/Marlin/src/feature/x_twist.cpp
@@ -53,7 +53,7 @@ void XATC::print_points() {
SERIAL_EOL();
}
-float lerp(const_float_t t, const_float_t a, const_float_t b) { return a + t * (b - a); }
+float lerp(const float t, const float a, const float b) { return a + t * (b - a); }
float XATC::compensation(const xy_pos_t &raw) {
if (!enabled) return 0;
diff --git a/Marlin/src/gcode/bedlevel/G26.cpp b/Marlin/src/gcode/bedlevel/G26.cpp
index 94e9b82506..b655c3026f 100644
--- a/Marlin/src/gcode/bedlevel/G26.cpp
+++ b/Marlin/src/gcode/bedlevel/G26.cpp
@@ -170,7 +170,7 @@ float g26_random_deviation = 0.0;
#endif
-void move_to(const_float_t rx, const_float_t ry, const_float_t z, const_float_t e_delta) {
+void move_to(const float rx, const float ry, const float z, const float e_delta) {
static float last_z = -999.99;
const xy_pos_t dest = { rx, ry };
@@ -196,7 +196,7 @@ void move_to(const_float_t rx, const_float_t ry, const_float_t z, const_float_t
prepare_internal_move_to_destination(fr_mm_s);
}
-void move_to(const xyz_pos_t &where, const_float_t de) { move_to(where.x, where.y, where.z, de); }
+void move_to(const xyz_pos_t &where, const float de) { move_to(where.x, where.y, where.z, de); }
typedef struct {
float extrusion_multiplier = EXTRUSION_MULTIPLIER,
diff --git a/Marlin/src/gcode/calibrate/G33.cpp b/Marlin/src/gcode/calibrate/G33.cpp
index 409a9c8707..11c3cdca78 100644
--- a/Marlin/src/gcode/calibrate/G33.cpp
+++ b/Marlin/src/gcode/calibrate/G33.cpp
@@ -87,7 +87,7 @@ void ac_cleanup() {
TERN_(HAS_BED_PROBE, probe.use_probing_tool(false));
}
-void print_signed_float(FSTR_P const prefix, const_float_t f) {
+void print_signed_float(FSTR_P const prefix, const float f) {
SERIAL_ECHO(F(" "), prefix, C(':'));
serial_offset(f);
}
diff --git a/Marlin/src/gcode/calibrate/G34_M422.cpp b/Marlin/src/gcode/calibrate/G34_M422.cpp
index fc22b354eb..aba828d6dd 100644
--- a/Marlin/src/gcode/calibrate/G34_M422.cpp
+++ b/Marlin/src/gcode/calibrate/G34_M422.cpp
@@ -323,7 +323,7 @@ void GcodeSuite::G34() {
msg.echoln();
ui.set_status(msg);
- auto decreasing_accuracy = [](const_float_t v1, const_float_t v2) {
+ auto decreasing_accuracy = [](const float v1, const float v2) {
if (v1 < v2 * 0.7f) {
SERIAL_ECHOLNPGM("Decreasing Accuracy Detected.");
LCD_MESSAGE(MSG_DECREASING_ACCURACY);
diff --git a/Marlin/src/gcode/calibrate/G425.cpp b/Marlin/src/gcode/calibrate/G425.cpp
index 6338873ea7..338c776885 100644
--- a/Marlin/src/gcode/calibrate/G425.cpp
+++ b/Marlin/src/gcode/calibrate/G425.cpp
@@ -100,7 +100,9 @@
enum side_t : uint8_t {
TOP, RIGHT, FRONT, LEFT, BACK, NUM_SIDES,
- LIST_N(DOUBLE(SECONDARY_AXES), IMINIMUM, IMAXIMUM, JMINIMUM, JMAXIMUM, KMINIMUM, KMAXIMUM, UMINIMUM, UMAXIMUM, VMINIMUM, VMAXIMUM, WMINIMUM, WMAXIMUM)
+ LIST_N(DOUBLE(SECONDARY_AXES),
+ IMINIMUM, IMAXIMUM, JMINIMUM, JMAXIMUM, KMINIMUM, KMAXIMUM,
+ UMINIMUM, UMAXIMUM, VMINIMUM, VMAXIMUM, WMINIMUM, WMAXIMUM)
};
static constexpr xyz_pos_t true_center CALIBRATION_OBJECT_CENTER;
diff --git a/Marlin/src/gcode/calibrate/M425.cpp b/Marlin/src/gcode/calibrate/M425.cpp
index 22d71aba58..fcf6296697 100644
--- a/Marlin/src/gcode/calibrate/M425.cpp
+++ b/Marlin/src/gcode/calibrate/M425.cpp
@@ -109,25 +109,26 @@ void GcodeSuite::M425_report(const bool forReplay/*=true*/) {
TERN_(MARLIN_SMALL_BUILD, return);
report_heading_etc(forReplay, F(STR_BACKLASH_COMPENSATION));
- SERIAL_ECHOLNPGM_P(
+ SERIAL_ECHOPGM_P(
PSTR(" M425 F"), backlash.get_correction()
#ifdef BACKLASH_SMOOTHING_MM
, PSTR(" S"), LINEAR_UNIT(backlash.get_smoothing_mm())
#endif
- #if NUM_AXES
- , LIST_N(DOUBLE(NUM_AXES),
- SP_X_STR, LINEAR_UNIT(backlash.get_distance_mm(X_AXIS)),
- SP_Y_STR, LINEAR_UNIT(backlash.get_distance_mm(Y_AXIS)),
- SP_Z_STR, LINEAR_UNIT(backlash.get_distance_mm(Z_AXIS)),
- SP_I_STR, I_AXIS_UNIT(backlash.get_distance_mm(I_AXIS)),
- SP_J_STR, J_AXIS_UNIT(backlash.get_distance_mm(J_AXIS)),
- SP_K_STR, K_AXIS_UNIT(backlash.get_distance_mm(K_AXIS)),
- SP_U_STR, U_AXIS_UNIT(backlash.get_distance_mm(U_AXIS)),
- SP_V_STR, V_AXIS_UNIT(backlash.get_distance_mm(V_AXIS)),
- SP_W_STR, W_AXIS_UNIT(backlash.get_distance_mm(W_AXIS))
- )
- #endif
);
+ #if NUM_AXES
+ SERIAL_ECHOPGM_P(NUM_AXIS_PAIRED_LIST(
+ SP_X_STR, LINEAR_UNIT(backlash.get_distance_mm(X_AXIS)),
+ SP_Y_STR, LINEAR_UNIT(backlash.get_distance_mm(Y_AXIS)),
+ SP_Z_STR, LINEAR_UNIT(backlash.get_distance_mm(Z_AXIS)),
+ SP_I_STR, I_AXIS_UNIT(backlash.get_distance_mm(I_AXIS)),
+ SP_J_STR, J_AXIS_UNIT(backlash.get_distance_mm(J_AXIS)),
+ SP_K_STR, K_AXIS_UNIT(backlash.get_distance_mm(K_AXIS)),
+ SP_U_STR, U_AXIS_UNIT(backlash.get_distance_mm(U_AXIS)),
+ SP_V_STR, V_AXIS_UNIT(backlash.get_distance_mm(V_AXIS)),
+ SP_W_STR, W_AXIS_UNIT(backlash.get_distance_mm(W_AXIS))
+ ));
+ #endif
+ SERIAL_EOL();
}
#endif // BACKLASH_GCODE
diff --git a/Marlin/src/gcode/calibrate/M48.cpp b/Marlin/src/gcode/calibrate/M48.cpp
index 981a1d9877..f57bfeb584 100644
--- a/Marlin/src/gcode/calibrate/M48.cpp
+++ b/Marlin/src/gcode/calibrate/M48.cpp
@@ -124,7 +124,7 @@ void GcodeSuite::M48() {
max = -99999.9, // Largest value sampled so far
sample_set[n_samples]; // Storage for sampled values
- auto dev_report = [](const bool verbose, const_float_t mean, const_float_t sigma, const_float_t min, const_float_t max, const bool final=false) {
+ auto dev_report = [](const bool verbose, const float mean, const float sigma, const float min, const float max, const bool final=false) {
if (verbose) {
SERIAL_ECHOPGM("Mean: ", p_float_t(mean, 6));
if (!final) SERIAL_ECHOPGM(" Sigma: ", p_float_t(sigma, 6));
diff --git a/Marlin/src/gcode/config/M200-M205.cpp b/Marlin/src/gcode/config/M200-M205.cpp
index 7ad7de8617..dd4eada06f 100644
--- a/Marlin/src/gcode/config/M200-M205.cpp
+++ b/Marlin/src/gcode/config/M200-M205.cpp
@@ -157,19 +157,17 @@ void GcodeSuite::M201_report(const bool forReplay/*=true*/) {
#if NUM_AXES
eol = true;
- SERIAL_ECHOPGM_P(
- LIST_N(DOUBLE(NUM_AXES),
- PSTR(" M201 X"), LINEAR_UNIT(planner.settings.max_acceleration_mm_per_s2[X_AXIS]),
- SP_Y_STR, LINEAR_UNIT(planner.settings.max_acceleration_mm_per_s2[Y_AXIS]),
- SP_Z_STR, LINEAR_UNIT(planner.settings.max_acceleration_mm_per_s2[Z_AXIS]),
- SP_I_STR, I_AXIS_UNIT(planner.settings.max_acceleration_mm_per_s2[I_AXIS]),
- SP_J_STR, J_AXIS_UNIT(planner.settings.max_acceleration_mm_per_s2[J_AXIS]),
- SP_K_STR, K_AXIS_UNIT(planner.settings.max_acceleration_mm_per_s2[K_AXIS]),
- SP_U_STR, U_AXIS_UNIT(planner.settings.max_acceleration_mm_per_s2[U_AXIS]),
- SP_V_STR, V_AXIS_UNIT(planner.settings.max_acceleration_mm_per_s2[V_AXIS]),
- SP_W_STR, W_AXIS_UNIT(planner.settings.max_acceleration_mm_per_s2[W_AXIS])
- )
- );
+ SERIAL_ECHOPGM_P(NUM_AXIS_PAIRED_LIST(
+ PSTR(" M201 X"), LINEAR_UNIT(planner.settings.max_acceleration_mm_per_s2[X_AXIS]),
+ SP_Y_STR, LINEAR_UNIT(planner.settings.max_acceleration_mm_per_s2[Y_AXIS]),
+ SP_Z_STR, LINEAR_UNIT(planner.settings.max_acceleration_mm_per_s2[Z_AXIS]),
+ SP_I_STR, I_AXIS_UNIT(planner.settings.max_acceleration_mm_per_s2[I_AXIS]),
+ SP_J_STR, J_AXIS_UNIT(planner.settings.max_acceleration_mm_per_s2[J_AXIS]),
+ SP_K_STR, K_AXIS_UNIT(planner.settings.max_acceleration_mm_per_s2[K_AXIS]),
+ SP_U_STR, U_AXIS_UNIT(planner.settings.max_acceleration_mm_per_s2[U_AXIS]),
+ SP_V_STR, V_AXIS_UNIT(planner.settings.max_acceleration_mm_per_s2[V_AXIS]),
+ SP_W_STR, W_AXIS_UNIT(planner.settings.max_acceleration_mm_per_s2[W_AXIS])
+ ));
#endif
#if HAS_EXTRUDERS && DISABLED(DISTINCT_E_FACTORS)
@@ -224,19 +222,17 @@ void GcodeSuite::M203_report(const bool forReplay/*=true*/) {
#if NUM_AXES
eol = true;
- SERIAL_ECHOPGM_P(
- LIST_N(DOUBLE(NUM_AXES),
- PSTR(" M203 X"), LINEAR_UNIT(planner.settings.max_feedrate_mm_s[X_AXIS]),
- SP_Y_STR, LINEAR_UNIT(planner.settings.max_feedrate_mm_s[Y_AXIS]),
- SP_Z_STR, LINEAR_UNIT(planner.settings.max_feedrate_mm_s[Z_AXIS]),
- SP_I_STR, LINEAR_UNIT(planner.settings.max_feedrate_mm_s[I_AXIS]),
- SP_J_STR, LINEAR_UNIT(planner.settings.max_feedrate_mm_s[J_AXIS]),
- SP_K_STR, LINEAR_UNIT(planner.settings.max_feedrate_mm_s[K_AXIS]),
- SP_U_STR, LINEAR_UNIT(planner.settings.max_feedrate_mm_s[U_AXIS]),
- SP_V_STR, LINEAR_UNIT(planner.settings.max_feedrate_mm_s[V_AXIS]),
- SP_W_STR, LINEAR_UNIT(planner.settings.max_feedrate_mm_s[W_AXIS])
- )
- );
+ SERIAL_ECHOPGM_P(NUM_AXIS_PAIRED_LIST(
+ PSTR(" M203 X"), LINEAR_UNIT(planner.settings.max_feedrate_mm_s[X_AXIS]),
+ SP_Y_STR, LINEAR_UNIT(planner.settings.max_feedrate_mm_s[Y_AXIS]),
+ SP_Z_STR, LINEAR_UNIT(planner.settings.max_feedrate_mm_s[Z_AXIS]),
+ SP_I_STR, LINEAR_UNIT(planner.settings.max_feedrate_mm_s[I_AXIS]),
+ SP_J_STR, LINEAR_UNIT(planner.settings.max_feedrate_mm_s[J_AXIS]),
+ SP_K_STR, LINEAR_UNIT(planner.settings.max_feedrate_mm_s[K_AXIS]),
+ SP_U_STR, LINEAR_UNIT(planner.settings.max_feedrate_mm_s[U_AXIS]),
+ SP_V_STR, LINEAR_UNIT(planner.settings.max_feedrate_mm_s[V_AXIS]),
+ SP_W_STR, LINEAR_UNIT(planner.settings.max_feedrate_mm_s[W_AXIS])
+ ));
#endif
#if HAS_EXTRUDERS && DISABLED(DISTINCT_E_FACTORS)
@@ -377,7 +373,7 @@ void GcodeSuite::M205_report(const bool forReplay/*=true*/) {
, PSTR(" J"), LINEAR_UNIT(planner.junction_deviation_mm)
#endif
#if ENABLED(CLASSIC_JERK) && NUM_AXES
- , LIST_N(DOUBLE(NUM_AXES),
+ , NUM_AXIS_PAIRED_LIST(
SP_X_STR, LINEAR_UNIT(planner.max_jerk.x),
SP_Y_STR, LINEAR_UNIT(planner.max_jerk.y),
SP_Z_STR, LINEAR_UNIT(planner.max_jerk.z),
diff --git a/Marlin/src/gcode/config/M210.cpp b/Marlin/src/gcode/config/M210.cpp
index 99c750bd25..f9ae155f60 100644
--- a/Marlin/src/gcode/config/M210.cpp
+++ b/Marlin/src/gcode/config/M210.cpp
@@ -82,19 +82,17 @@ void GcodeSuite::M210_report(const bool forReplay/*=true*/) {
report_heading_etc(forReplay, F(STR_HOMING_FEEDRATE));
SERIAL_ECHOPGM(" M210");
- SERIAL_ECHOLNPGM_P(
- LIST_N(DOUBLE(NUM_AXES)
- , SP_X_STR, X_AXIS_UNIT(homing_feedrate_mm_m.x)
- , SP_Y_STR, Y_AXIS_UNIT(homing_feedrate_mm_m.y)
- , SP_Z_STR, Z_AXIS_UNIT(homing_feedrate_mm_m.z)
- , SP_I_STR, I_AXIS_UNIT(homing_feedrate_mm_m.i)
- , SP_J_STR, J_AXIS_UNIT(homing_feedrate_mm_m.j)
- , SP_K_STR, K_AXIS_UNIT(homing_feedrate_mm_m.k)
- , SP_U_STR, U_AXIS_UNIT(homing_feedrate_mm_m.u)
- , SP_V_STR, V_AXIS_UNIT(homing_feedrate_mm_m.v)
- , SP_W_STR, W_AXIS_UNIT(homing_feedrate_mm_m.w)
- )
- );
+ SERIAL_ECHOLNPGM_P(NUM_AXIS_PAIRED_LIST(
+ SP_X_STR, X_AXIS_UNIT(homing_feedrate_mm_m.x),
+ SP_Y_STR, Y_AXIS_UNIT(homing_feedrate_mm_m.y),
+ SP_Z_STR, Z_AXIS_UNIT(homing_feedrate_mm_m.z),
+ SP_I_STR, I_AXIS_UNIT(homing_feedrate_mm_m.i),
+ SP_J_STR, J_AXIS_UNIT(homing_feedrate_mm_m.j),
+ SP_K_STR, K_AXIS_UNIT(homing_feedrate_mm_m.k),
+ SP_U_STR, U_AXIS_UNIT(homing_feedrate_mm_m.u),
+ SP_V_STR, V_AXIS_UNIT(homing_feedrate_mm_m.v),
+ SP_W_STR, W_AXIS_UNIT(homing_feedrate_mm_m.w)
+ ));
}
#endif // EDITABLE_HOMING_FEEDRATE
diff --git a/Marlin/src/gcode/config/M92.cpp b/Marlin/src/gcode/config/M92.cpp
index 2a5eb30f55..48c3c5f2f0 100644
--- a/Marlin/src/gcode/config/M92.cpp
+++ b/Marlin/src/gcode/config/M92.cpp
@@ -101,7 +101,7 @@ void GcodeSuite::M92_report(const bool forReplay/*=true*/, const int8_t e/*=-1*/
report_heading_etc(forReplay, F(STR_STEPS_PER_UNIT));
#if NUM_AXES
#define PRINT_EOL
- SERIAL_ECHOPGM_P(LIST_N(DOUBLE(NUM_AXES),
+ SERIAL_ECHOPGM_P(NUM_AXIS_PAIRED_LIST(
PSTR(" M92 X"), LINEAR_UNIT(planner.settings.axis_steps_per_mm[X_AXIS]),
SP_Y_STR, LINEAR_UNIT(planner.settings.axis_steps_per_mm[Y_AXIS]),
SP_Z_STR, LINEAR_UNIT(planner.settings.axis_steps_per_mm[Z_AXIS]),
diff --git a/Marlin/src/gcode/feature/camera/M240.cpp b/Marlin/src/gcode/feature/camera/M240.cpp
index bb1d3f9eee..23ec4ea1e7 100644
--- a/Marlin/src/gcode/feature/camera/M240.cpp
+++ b/Marlin/src/gcode/feature/camera/M240.cpp
@@ -47,7 +47,7 @@
#endif
#ifdef PHOTO_RETRACT_MM
- inline void e_move_m240(const float length, const_feedRate_t fr_mm_s) {
+ inline void e_move_m240(const float length, const feedRate_t fr_mm_s) {
if (length && thermalManager.hotEnoughToExtrude(active_extruder))
unscaled_e_move(length, fr_mm_s);
}
diff --git a/Marlin/src/gcode/feature/controllerfan/M710.cpp b/Marlin/src/gcode/feature/controllerfan/M710.cpp
index c8b5efa8cb..6bdfcd9b32 100644
--- a/Marlin/src/gcode/feature/controllerfan/M710.cpp
+++ b/Marlin/src/gcode/feature/controllerfan/M710.cpp
@@ -46,24 +46,22 @@
* M710 I127 A1 S255 D160 ; Set controller fan idle speed 50%, AutoMode On, Fan speed 100%, duration to 160 Secs
*/
void GcodeSuite::M710() {
+ if (!parser.seen("ADIRS")) return M710_report();
- const bool seenR = parser.seen('R');
- if (seenR) controllerFan.reset();
+ if (parser.seen_test('R'))
+ controllerFan.reset();
- const bool seenS = parser.seenval('S');
- if (seenS) controllerFan.settings.active_speed = parser.value_byte();
+ if (parser.seenval('S'))
+ controllerFan.settings.active_speed = parser.value_byte();
- const bool seenI = parser.seenval('I');
- if (seenI) controllerFan.settings.idle_speed = parser.value_byte();
+ if (parser.seenval('I'))
+ controllerFan.settings.idle_speed = parser.value_byte();
- const bool seenA = parser.seenval('A');
- if (seenA) controllerFan.settings.auto_mode = parser.value_bool();
+ if (parser.seenval('A'))
+ controllerFan.settings.auto_mode = parser.value_bool();
- const bool seenD = parser.seenval('D');
- if (seenD) controllerFan.settings.duration = parser.value_ushort();
-
- if (!(seenR || seenS || seenI || seenA || seenD))
- M710_report();
+ if (parser.seenval('D'))
+ controllerFan.settings.duration = parser.value_ushort();
}
void GcodeSuite::M710_report(const bool forReplay/*=true*/) {
diff --git a/Marlin/src/gcode/feature/ft_motion/M493.cpp b/Marlin/src/gcode/feature/ft_motion/M493.cpp
index d5cfc82005..606d23179d 100644
--- a/Marlin/src/gcode/feature/ft_motion/M493.cpp
+++ b/Marlin/src/gcode/feature/ft_motion/M493.cpp
@@ -61,13 +61,13 @@ void say_shaping() {
// FT Shaping
#if HAS_X_AXIS
- if (AXIS_HAS_SHAPER(X)) {
+ if (AXIS_IS_SHAPING(X)) {
SERIAL_ECHOPGM(" with " AXIS_0_NAME);
say_shaper_type(X_AXIS);
}
#endif
#if HAS_Y_AXIS
- if (AXIS_HAS_SHAPER(Y)) {
+ if (AXIS_IS_SHAPING(Y)) {
SERIAL_ECHOPGM(" and with " AXIS_1_NAME);
say_shaper_type(Y_AXIS);
}
@@ -80,7 +80,7 @@ void say_shaping() {
dynamic = z_based || g_based;
// FT Dynamic Frequency Mode
- if (AXIS_HAS_SHAPER(X) || AXIS_HAS_SHAPER(Y)) {
+ if (AXIS_IS_SHAPING(X) || AXIS_IS_SHAPING(Y)) {
#if HAS_DYNAMIC_FREQ
SERIAL_ECHOPGM("Dynamic Frequency Mode ");
switch (ftMotion.cfg.dynFreqMode) {
@@ -249,7 +249,7 @@ void GcodeSuite::M493() {
// Pressure control (linear advance) gain parameter.
if (parser.seenval('K')) {
const float val = parser.value_float();
- if (val >= 0.0f) {
+ if (WITHIN(val, 0.0f, 10.0f)) {
ftMotion.cfg.linearAdvK = val;
flag.report = true;
}
@@ -263,7 +263,7 @@ void GcodeSuite::M493() {
// Dynamic frequency mode parameter.
if (parser.seenval('D')) {
- if (AXIS_HAS_SHAPER(X) || AXIS_HAS_SHAPER(Y)) {
+ if (AXIS_IS_SHAPING(X) || AXIS_IS_SHAPING(Y)) {
const dynFreqMode_t val = dynFreqMode_t(parser.value_byte());
switch (val) {
#if HAS_DYNAMIC_FREQ_MM
@@ -297,7 +297,7 @@ void GcodeSuite::M493() {
// Parse frequency parameter (X axis).
if (parser.seenval('A')) {
- if (AXIS_HAS_SHAPER(X)) {
+ if (AXIS_IS_SHAPING(X)) {
const float val = parser.value_float();
// TODO: Frequency minimum is dependent on the shaper used; the above check isn't always correct.
if (WITHIN(val, FTM_MIN_SHAPE_FREQ, (FTM_FS) / 2)) {
@@ -326,7 +326,7 @@ void GcodeSuite::M493() {
// Parse zeta parameter (X axis).
if (parser.seenval('I')) {
const float val = parser.value_float();
- if (AXIS_HAS_SHAPER(X)) {
+ if (AXIS_IS_SHAPING(X)) {
if (WITHIN(val, 0.01f, 1.0f)) {
ftMotion.cfg.zeta[0] = val;
flag.update = true;
@@ -341,7 +341,7 @@ void GcodeSuite::M493() {
// Parse vtol parameter (X axis).
if (parser.seenval('Q')) {
const float val = parser.value_float();
- if (AXIS_HAS_EISHAPER(X)) {
+ if (AXIS_IS_EISHAPING(X)) {
if (WITHIN(val, 0.00f, 1.0f)) {
ftMotion.cfg.vtol[0] = val;
flag.update = true;
@@ -359,7 +359,7 @@ void GcodeSuite::M493() {
// Parse frequency parameter (Y axis).
if (parser.seenval('B')) {
- if (AXIS_HAS_SHAPER(Y)) {
+ if (AXIS_IS_SHAPING(Y)) {
const float val = parser.value_float();
if (WITHIN(val, FTM_MIN_SHAPE_FREQ, (FTM_FS) / 2)) {
ftMotion.cfg.baseFreq.y = val;
@@ -387,7 +387,7 @@ void GcodeSuite::M493() {
// Parse zeta parameter (Y axis).
if (parser.seenval('J')) {
const float val = parser.value_float();
- if (AXIS_HAS_SHAPER(Y)) {
+ if (AXIS_IS_SHAPING(Y)) {
if (WITHIN(val, 0.01f, 1.0f)) {
ftMotion.cfg.zeta[1] = val;
flag.update = true;
@@ -402,7 +402,7 @@ void GcodeSuite::M493() {
// Parse vtol parameter (Y axis).
if (parser.seenval('R')) {
const float val = parser.value_float();
- if (AXIS_HAS_EISHAPER(Y)) {
+ if (AXIS_IS_EISHAPING(Y)) {
if (WITHIN(val, 0.00f, 1.0f)) {
ftMotion.cfg.vtol[1] = val;
flag.update = true;
diff --git a/Marlin/src/gcode/feature/leds/M150.cpp b/Marlin/src/gcode/feature/leds/M150.cpp
index dd5752ee4c..cc451d368b 100644
--- a/Marlin/src/gcode/feature/leds/M150.cpp
+++ b/Marlin/src/gcode/feature/leds/M150.cpp
@@ -80,24 +80,28 @@ void GcodeSuite::M150() {
#endif
#endif
- const LEDColor color = LEDColor(
- parser.seen('R') ? (parser.has_value() ? parser.value_byte() : 255) : (old_color >> 16) & 0xFF,
- parser.seen('U') ? (parser.has_value() ? parser.value_byte() : 255) : (old_color >> 8) & 0xFF,
- parser.seen('B') ? (parser.has_value() ? parser.value_byte() : 255) : old_color & 0xFF
- OPTARG(HAS_WHITE_LED, parser.seen('W') ? (parser.has_value() ? parser.value_byte() : 255) : (old_color >> 24) & 0xFF)
- OPTARG(NEOPIXEL_LED, parser.seen('P') ? (parser.has_value() ? parser.value_byte() : 255) : brightness)
- );
-
- #if ENABLED(NEOPIXEL2_SEPARATE)
- switch (unit) {
- case 0: leds.set_color(color); return;
- case 1: leds2.set_color(color); return;
- }
+ const uint8_t valR = parser.seen('R') ? (parser.has_value() ? parser.value_byte() : 255) : (old_color >> 16) & 0xFF,
+ valU = parser.seen('U') ? (parser.has_value() ? parser.value_byte() : 255) : (old_color >> 8) & 0xFF,
+ valB = parser.seen('B') ? (parser.has_value() ? parser.value_byte() : 255) : old_color & 0xFF;
+ #if HAS_WHITE_LED || HAS_WHITE_LED2
+ const uint8_t valW = parser.seen('W') ? (parser.has_value() ? parser.value_byte() : 255) : (old_color >> 24) & 0xFF;
+ #endif
+ #if ENABLED(NEOPIXEL_LED)
+ const uint8_t valP = parser.seen('P') ? (parser.has_value() ? parser.value_byte() : 255) : brightness;
#endif
- // If 'S' is not specified use both
- leds.set_color(color);
- TERN_(NEOPIXEL2_SEPARATE, leds2.set_color(color));
+ const LED1Color_t color = LED1Color_t(valR, valU, valB OPTARG(HAS_WHITE_LED, valW) OPTARG(NEOPIXEL_LED, valP) );
+
+ #if ENABLED(NEOPIXEL2_SEPARATE)
+ const LED2Color_t color2 = LED2Color_t(valR, valU, valB OPTARG(HAS_WHITE_LED2, valW) OPTARG(NEOPIXEL_LED, valP) );
+ switch (unit) {
+ case 0: leds.set_color(color); return;
+ case 1: leds2.set_color(color2); return;
+ }
+ leds2.set_color(color2); // If 'S' is not specified set both leds2...
+ #endif
+
+ leds.set_color(color); // ...and leds1
}
#endif // HAS_COLOR_LEDS
diff --git a/Marlin/src/gcode/feature/mixing/M166.cpp b/Marlin/src/gcode/feature/mixing/M166.cpp
index 39fa4ac734..d3741f5931 100644
--- a/Marlin/src/gcode/feature/mixing/M166.cpp
+++ b/Marlin/src/gcode/feature/mixing/M166.cpp
@@ -33,7 +33,7 @@ inline void echo_mix() {
SERIAL_ECHOPGM(" (", mixer.mix[0], "%|", mixer.mix[1], "%)");
}
-inline void echo_zt(const int t, const_float_t z) {
+inline void echo_zt(const int t, const float z) {
mixer.update_mix_from_vtool(t);
SERIAL_ECHOPGM_P(SP_Z_STR, z, SP_T_STR, t);
echo_mix();
diff --git a/Marlin/src/gcode/feature/pause/G60.cpp b/Marlin/src/gcode/feature/pause/G60.cpp
index fe085200a9..21dbe1bf81 100644
--- a/Marlin/src/gcode/feature/pause/G60.cpp
+++ b/Marlin/src/gcode/feature/pause/G60.cpp
@@ -35,16 +35,12 @@ bool report_stored_position(const uint8_t slot) {
const xyze_pos_t &pos = stored_position[slot];
SERIAL_ECHO(STR_SAVED_POSITION, slot, C(':'));
#if NUM_AXES
- SERIAL_ECHOPGM_P(
- LIST_N(DOUBLE(NUM_AXES),
- SP_X_LBL, pos.x, SP_Y_LBL, pos.y, SP_Z_LBL, pos.z,
- SP_I_LBL, pos.i, SP_J_LBL, pos.j, SP_K_LBL, pos.k,
- SP_U_LBL, pos.u, SP_V_LBL, pos.v, SP_W_LBL, pos.w
- )
- );
- #endif
- #if HAS_EXTRUDERS
- SERIAL_ECHOPGM_P(SP_E_LBL, pos.e);
+ SERIAL_ECHOPGM_P(LOGICAL_AXIS_PAIRED_LIST(
+ SP_E_LBL, pos.e,
+ SP_X_LBL, pos.x, SP_Y_LBL, pos.y, SP_Z_LBL, pos.z,
+ SP_I_LBL, pos.i, SP_J_LBL, pos.j, SP_K_LBL, pos.k,
+ SP_U_LBL, pos.u, SP_V_LBL, pos.v, SP_W_LBL, pos.w
+ ));
#endif
SERIAL_EOL();
return true;
diff --git a/Marlin/src/gcode/feature/pause/M701_M702.cpp b/Marlin/src/gcode/feature/pause/M701_M702.cpp
index 7e7682824b..dcdc1c9cbc 100644
--- a/Marlin/src/gcode/feature/pause/M701_M702.cpp
+++ b/Marlin/src/gcode/feature/pause/M701_M702.cpp
@@ -90,7 +90,7 @@ void GcodeSuite::M701() {
tool_change(target_extruder);
#endif
- auto move_z_by = [](const_float_t zdist) {
+ auto move_z_by = [](const float zdist) {
if (zdist) {
destination = current_position;
destination.z += zdist;
diff --git a/Marlin/src/gcode/feature/prusa_MMU2/M704-M709.cpp b/Marlin/src/gcode/feature/prusa_MMU2/M704-M709.cpp
index ef248902fd..5ec0067a08 100644
--- a/Marlin/src/gcode/feature/prusa_MMU2/M704-M709.cpp
+++ b/Marlin/src/gcode/feature/prusa_MMU2/M704-M709.cpp
@@ -94,7 +94,7 @@ void GcodeSuite::M706() {
* M707 [ A ]
*
* Parameters:
- * A Address of register in hexidecimal
+ * A Address of register in hexadecimal
*
* Example:
* M707 A0x1b - Read a 8bit integer from register 0x1b and prints the result onto the serial line.
@@ -115,7 +115,7 @@ void GcodeSuite::M707() {
* M708 [ A | X ]
*
* Parameters:
- * A Address of register in hexidecimal
+ * A Address of register in hexadecimal
* X Data to write (16-bit integer). Default value 0
*
* Example:
diff --git a/Marlin/src/gcode/feature/trinamic/M920.cpp b/Marlin/src/gcode/feature/trinamic/M920.cpp
index f123c41622..4c777a83cc 100644
--- a/Marlin/src/gcode/feature/trinamic/M920.cpp
+++ b/Marlin/src/gcode/feature/trinamic/M920.cpp
@@ -95,15 +95,16 @@ void GcodeSuite::M920() {
void GcodeSuite::M920_report(const bool forReplay/*=true*/) {
TERN_(MARLIN_SMALL_BUILD, return);
- report_heading(forReplay, F(STR_HOMING_CURRENT));
-
- auto say_M920 = [](const bool forReplay, int8_t index=-1) {
- report_echo_start(forReplay);
- SERIAL_ECHOPGM(" M920");
- if (index >= 0) SERIAL_ECHOPGM(" " I_PARAM_STR, index);
- };
-
#if X_SENSORLESS || Y_SENSORLESS || Z_SENSORLESS
+
+ report_heading(forReplay, F(STR_HOMING_CURRENT));
+
+ auto say_M920 = [](const bool forReplay, int8_t index=-1) {
+ report_echo_start(forReplay);
+ SERIAL_ECHOPGM(" M920");
+ if (index >= 0) SERIAL_ECHOPGM(" " I_PARAM_STR, index);
+ };
+
#if X2_SENSORLESS || Y2_SENSORLESS || Z2_SENSORLESS || Z3_SENSORLESS || Z4_SENSORLESS
say_M920(forReplay, 0);
#else
@@ -123,23 +124,26 @@ void GcodeSuite::M920_report(const bool forReplay/*=true*/) {
TERN_(V_SENSORLESS, SERIAL_ECHOPGM_P(SP_V_STR, homing_current_mA.V));
TERN_(W_SENSORLESS, SERIAL_ECHOPGM_P(SP_W_STR, homing_current_mA.W));
SERIAL_EOL();
- #endif
- #if X2_SENSORLESS || Y2_SENSORLESS || Z2_SENSORLESS
- say_M920(forReplay, 1);
- TERN_(X2_SENSORLESS, SERIAL_ECHOPGM_P(SP_X_STR, homing_current_mA.X2));
- TERN_(Y2_SENSORLESS, SERIAL_ECHOPGM_P(SP_Y_STR, homing_current_mA.Y2));
- TERN_(Z2_SENSORLESS, SERIAL_ECHOPGM_P(SP_Z_STR, homing_current_mA.Z2));
- SERIAL_EOL();
- #endif
- #if Z3_SENSORLESS
- say_M920(forReplay, 2);
- SERIAL_ECHOLNPGM(" Z", homing_current_mA.Z3);
- #endif
- #if Z4_SENSORLESS
- say_M920(forReplay, 3);
- SERIAL_ECHOLNPGM(" Z", homing_current_mA.Z4);
- #endif
+ #if X2_SENSORLESS || Y2_SENSORLESS || Z2_SENSORLESS
+ say_M920(forReplay, 1);
+ TERN_(X2_SENSORLESS, SERIAL_ECHOPGM_P(SP_X_STR, homing_current_mA.X2));
+ TERN_(Y2_SENSORLESS, SERIAL_ECHOPGM_P(SP_Y_STR, homing_current_mA.Y2));
+ TERN_(Z2_SENSORLESS, SERIAL_ECHOPGM_P(SP_Z_STR, homing_current_mA.Z2));
+ SERIAL_EOL();
+ #endif
+
+ #if Z3_SENSORLESS
+ say_M920(forReplay, 2);
+ SERIAL_ECHOLNPGM(" Z", homing_current_mA.Z3);
+ #endif
+
+ #if Z4_SENSORLESS
+ say_M920(forReplay, 3);
+ SERIAL_ECHOLNPGM(" Z", homing_current_mA.Z4);
+ #endif
+
+ #endif // X_SENSORLESS || Y_SENSORLESS || Z_SENSORLESS
}
#endif // EDITABLE_HOMING_CURRENT
diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp
index 1fa5c55c22..b09fd69056 100644
--- a/Marlin/src/gcode/gcode.cpp
+++ b/Marlin/src/gcode/gcode.cpp
@@ -69,6 +69,10 @@ GcodeSuite gcode;
#include "../feature/fancheck.h"
#endif
+#if ENABLED(EXTENSIBLE_UI)
+ #include "../lcd/extui/ui_api.h" // for ExtUI::onLevelingDone
+#endif
+
#include "../MarlinCore.h" // for idle, kill
// Inactivity shutdown
diff --git a/Marlin/src/gcode/geometry/M206_M428.cpp b/Marlin/src/gcode/geometry/M206_M428.cpp
index dcf19625be..3cecbbca43 100644
--- a/Marlin/src/gcode/geometry/M206_M428.cpp
+++ b/Marlin/src/gcode/geometry/M206_M428.cpp
@@ -51,23 +51,21 @@ void GcodeSuite::M206_report(const bool forReplay/*=true*/) {
TERN_(MARLIN_SMALL_BUILD, return);
report_heading_etc(forReplay, F(STR_HOME_OFFSET));
- SERIAL_ECHOLNPGM_P(
- #if IS_CARTESIAN
- LIST_N(DOUBLE(NUM_AXES),
- PSTR(" M206 X"), LINEAR_UNIT(home_offset.x),
- SP_Y_STR, LINEAR_UNIT(home_offset.y),
- SP_Z_STR, LINEAR_UNIT(home_offset.z),
- SP_I_STR, I_AXIS_UNIT(home_offset.i),
- SP_J_STR, J_AXIS_UNIT(home_offset.j),
- SP_K_STR, K_AXIS_UNIT(home_offset.k),
- SP_U_STR, U_AXIS_UNIT(home_offset.u),
- SP_V_STR, V_AXIS_UNIT(home_offset.v),
- SP_W_STR, W_AXIS_UNIT(home_offset.w)
- )
- #else
- PSTR(" M206 Z"), LINEAR_UNIT(home_offset.z)
- #endif
- );
+ #if IS_CARTESIAN
+ SERIAL_ECHOLNPGM_P(NUM_AXIS_PAIRED_LIST(
+ PSTR(" M206 X"), LINEAR_UNIT(home_offset.x),
+ SP_Y_STR, LINEAR_UNIT(home_offset.y),
+ SP_Z_STR, LINEAR_UNIT(home_offset.z),
+ SP_I_STR, I_AXIS_UNIT(home_offset.i),
+ SP_J_STR, J_AXIS_UNIT(home_offset.j),
+ SP_K_STR, K_AXIS_UNIT(home_offset.k),
+ SP_U_STR, U_AXIS_UNIT(home_offset.u),
+ SP_V_STR, V_AXIS_UNIT(home_offset.v),
+ SP_W_STR, W_AXIS_UNIT(home_offset.w)
+ ));
+ #else
+ SERIAL_ECHOLNPGM_P(PSTR(" M206 Z"), LINEAR_UNIT(home_offset.z));
+ #endif
}
/**
diff --git a/Marlin/src/gcode/host/M115.cpp b/Marlin/src/gcode/host/M115.cpp
index e86819b84e..92193108f0 100644
--- a/Marlin/src/gcode/host/M115.cpp
+++ b/Marlin/src/gcode/host/M115.cpp
@@ -263,13 +263,13 @@ void GcodeSuite::M115() {
"area:{"
"full:{"
"min:{"
- LIST_N(DOUBLE(NUM_AXES),
+ NUM_AXIS_PAIRED_LIST(
"x:", lmin.x, ",y:", lmin.y, ",z:", lmin.z,
",i:", lmin.i, ",j:", lmin.j, ",k:", lmin.k,
",u:", lmin.u, ",v:", lmin.v, ",w:", lmin.w
),
"},max:{"
- LIST_N(DOUBLE(NUM_AXES),
+ NUM_AXIS_PAIRED_LIST(
"x:", lmax.x, ",y:", lmax.y, ",z:", lmax.z,
",i:", lmax.i, ",j:", lmax.j, ",k:", lmax.k,
",u:", lmax.u, ",v:", lmax.v, ",w:", lmax.w
@@ -280,13 +280,13 @@ void GcodeSuite::M115() {
SERIAL_ECHOLNPGM(
"work:{"
"min:{"
- LIST_N(DOUBLE(NUM_AXES),
+ NUM_AXIS_PAIRED_LIST(
"x:", wmin.x, ",y:", wmin.y, ",z:", wmin.z,
",i:", wmin.i, ",j:", wmin.j, ",k:", wmin.k,
",u:", wmin.u, ",v:", wmin.v, ",w:", wmin.w
),
"},max:{"
- LIST_N(DOUBLE(NUM_AXES),
+ NUM_AXIS_PAIRED_LIST(
"x:", wmax.x, ",y:", wmax.y, ",z:", wmax.z,
",i:", wmax.i, ",j:", wmax.j, ",k:", wmax.k,
",u:", wmax.u, ",v:", wmax.v, ",w:", wmax.w
diff --git a/Marlin/src/gcode/host/M360.cpp b/Marlin/src/gcode/host/M360.cpp
index a3f86d615d..ebd9b694d5 100644
--- a/Marlin/src/gcode/host/M360.cpp
+++ b/Marlin/src/gcode/host/M360.cpp
@@ -49,7 +49,7 @@ struct ProgStr {
constexpr explicit operator bool() const { return ptr != nullptr; }
};
-static void config_prefix(ProgStr name, ProgStr pref=nullptr, int8_t ind=-1) {
+static void config_prefix(ProgStr name, ProgStr pref=nullptr, const int8_t ind=-1) {
SERIAL_ECHOPGM("Config:");
if (pref) SERIAL_ECHOPGM_P(static_cast(pref));
if (ind >= 0) { SERIAL_ECHO(ind); SERIAL_CHAR(':'); }
@@ -57,15 +57,16 @@ static void config_prefix(ProgStr name, ProgStr pref=nullptr, int8_t ind=-1) {
}
template
-static void config_line(ProgStr name, const T val, ProgStr pref=nullptr, int8_t ind=-1) {
+static void config_line(ProgStr name, const T val, ProgStr pref=nullptr, const int8_t ind=-1) {
config_prefix(name, pref, ind);
SERIAL_ECHOLN(val);
}
template
-static void config_line_e(int8_t e, ProgStr name, const T val) {
+static void config_line_e(const int8_t e, ProgStr name, const T val) {
config_line(name, val, PSTR("Extr."), e + 1);
}
+
/**
* M360: Report Firmware configuration
* in RepRapFirmware-compatible format
diff --git a/Marlin/src/gcode/motion/G2_G3.cpp b/Marlin/src/gcode/motion/G2_G3.cpp
index c3c2758af4..e8051d2c2a 100644
--- a/Marlin/src/gcode/motion/G2_G3.cpp
+++ b/Marlin/src/gcode/motion/G2_G3.cpp
@@ -309,7 +309,7 @@ void plan_arc(
// a) is <= any configured maximum speed,
// b) does not require centripetal force greater than any configured maximum acceleration,
// c) is <= nominal speed,
- // d) allows the print head to stop in the remining length of the curve within all configured maximum accelerations.
+ // d) allows the print head to stop in the remaining length of the curve within all configured maximum accelerations.
// The last has to be calculated every time through the loop.
const float limiting_accel = _MIN(planner.settings.max_acceleration_mm_per_s2[axis_p], planner.settings.max_acceleration_mm_per_s2[axis_q]),
limiting_speed = _MIN(planner.settings.max_feedrate_mm_s[axis_p], planner.settings.max_feedrate_mm_s[axis_q]),
diff --git a/Marlin/src/gcode/motion/M290.cpp b/Marlin/src/gcode/motion/M290.cpp
index 192efe7e7f..039f48381a 100644
--- a/Marlin/src/gcode/motion/M290.cpp
+++ b/Marlin/src/gcode/motion/M290.cpp
@@ -35,7 +35,7 @@
#if ENABLED(BABYSTEP_ZPROBE_OFFSET)
- FORCE_INLINE void mod_probe_offset(const_float_t offs) {
+ FORCE_INLINE void mod_probe_offset(const float offs) {
if (TERN1(BABYSTEP_HOTEND_Z_OFFSET, active_extruder == 0)) {
probe.offset.z += offs;
SERIAL_ECHO_MSG(STR_PROBE_OFFSET " " STR_Z, probe.offset.z);
diff --git a/Marlin/src/gcode/parser.h b/Marlin/src/gcode/parser.h
index e56a723087..8e27064b63 100644
--- a/Marlin/src/gcode/parser.h
+++ b/Marlin/src/gcode/parser.h
@@ -301,8 +301,8 @@ public:
// Units modes: Inches, Fahrenheit, Kelvin
#if ENABLED(INCH_MODE_SUPPORT)
- 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); }
+ static float mm_to_linear_unit(const float mm) { return mm / linear_unit_factor; }
+ static float mm_to_volumetric_unit(const float mm) { return mm / (volumetric_enabled ? volumetric_unit_factor : linear_unit_factor); }
// Init linear units by constructor
GCodeParser() { set_input_linear_units(LINEARUNIT_MM); }
@@ -324,16 +324,16 @@ public:
return linear_unit_factor;
}
- static float linear_value_to_mm(const_float_t v) { return v * linear_unit_factor; }
+ static float linear_value_to_mm(const float 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 constexpr float mm_to_linear_unit(const_float_t mm) { return mm; }
- static constexpr float mm_to_volumetric_unit(const_float_t mm) { return mm; }
+ static constexpr float mm_to_linear_unit(const float mm) { return mm; }
+ static constexpr float mm_to_volumetric_unit(const float mm) { return mm; }
- static constexpr float linear_value_to_mm(const_float_t v) { return v; }
+ static constexpr float linear_value_to_mm(const float v) { return v; }
static constexpr float axis_value_to_mm(const AxisEnum, const float v) { return v; }
static constexpr float per_axis_value(const AxisEnum, const float v) { return v; }
@@ -420,17 +420,17 @@ public:
void unknown_command_warning();
// Provide simple value accessors with default option
- static char* stringval(const char c, char * const dval=nullptr) { return seenval(c) ? value_string() : dval; }
+ 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 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; }
+ { return seenval(c) ? value_axis_units(a) : 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; }
diff --git a/Marlin/src/gcode/temp/M306.cpp b/Marlin/src/gcode/temp/M306.cpp
index e0c9d935e3..b3f5b6b97b 100644
--- a/Marlin/src/gcode/temp/M306.cpp
+++ b/Marlin/src/gcode/temp/M306.cpp
@@ -39,7 +39,7 @@
* F Ambient heat transfer coefficient (fan on full).
* H Filament heat capacity per mm.
* P Heater power.
- * R Sensor responsiveness (= transfer coefficient / heat capcity).
+ * R Sensor responsiveness (= transfer coefficient / heat capacity).
*
* With MPC_AUTOTUNE:
* T Autotune the extruder specified with 'E' or the active extruder.
@@ -65,7 +65,7 @@ void GcodeSuite::M306() {
default: tuning_type = Temperature::MPCTuningType::AUTO; break;
}
if (TERN0(MPC_PTC, tuning_type == Temperature::MPCTuningType::FORCE_ASYMPTOTIC))
- SERIAL_ECHOLNPGM("Aymptotic tuning not avaiable for PTC hotends");
+ SERIAL_ECHOLNPGM("Asymptotic tuning not available for PTC hotends");
else {
LCD_MESSAGE(MSG_MPC_AUTOTUNE);
thermalManager.MPC_autotune(e, tuning_type);
diff --git a/Marlin/src/inc/Conditionals-2-LCD.h b/Marlin/src/inc/Conditionals-2-LCD.h
index 1897f66bbb..a53b7f8423 100644
--- a/Marlin/src/inc/Conditionals-2-LCD.h
+++ b/Marlin/src/inc/Conditionals-2-LCD.h
@@ -308,10 +308,6 @@
#endif
-#if ANY(FYSETC_MINI_12864, MKS_MINI_12864)
- #define U8G_SPI_USE_MODE_3 1
-#endif
-
// ST7920-based graphical displays
#if ANY(IS_RRD_FG_SC, LCD_FOR_MELZI, SILVER_GATE_GLCD_CONTROLLER)
#define DOGLCD
@@ -319,6 +315,10 @@
#define IS_RRD_SC 1
#endif
+#if ANY(FYSETC_MINI_12864, MKS_MINI_12864) || ALL(__PLAT_NATIVE_SIM__, IS_U8GLIB_ST7920)
+ #define U8G_SPI_USE_MODE_3 1
+#endif
+
// ST7565 / 64128N graphical displays
#if ANY(MAKRPANEL, MINIPANEL)
#define IS_ULTIPANEL 1
diff --git a/Marlin/src/inc/Conditionals-4-adv.h b/Marlin/src/inc/Conditionals-4-adv.h
index 758ac04ebd..a95868062e 100644
--- a/Marlin/src/inc/Conditionals-4-adv.h
+++ b/Marlin/src/inc/Conditionals-4-adv.h
@@ -340,7 +340,11 @@
#endif
// Linear advance uses Jerk since E is an isolated axis
-#if ALL(HAS_JUNCTION_DEVIATION, LIN_ADVANCE)
+#if ALL(FT_MOTION, HAS_EXTRUDERS)
+ #define FTM_HAS_LIN_ADVANCE 1
+#endif
+
+#if HAS_JUNCTION_DEVIATION && ANY(LIN_ADVANCE, FTM_HAS_LIN_ADVANCE)
#define HAS_LINEAR_E_JERK 1
#endif
@@ -1020,11 +1024,14 @@
#define HAS_RESUME_CONTINUE 1
#endif
+// Color LEDs (with optional White channel)
+
#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED)
#define HAS_COLOR_LEDS 1
#else
#undef LED_POWEROFF_TIMEOUT
#endif
+
#if ALL(HAS_RESUME_CONTINUE, PRINTER_EVENT_LEDS, HAS_MEDIA)
#define HAS_LEDS_OFF_FLAG 1
#endif
@@ -1483,7 +1490,7 @@
#if MB(MKS_MONSTER8_V1, BTT_SKR_MINI_E3_V1_0, BTT_SKR_MINI_E3_V1_2, BTT_SKR_MINI_E3_V2_0, BTT_SKR_MINI_E3_V3_0, BTT_SKR_MINI_E3_V3_0_1, BTT_SKR_E3_TURBO, BTT_OCTOPUS_V1_1, BTT_SKR_V3_0, BTT_SKR_V3_0_EZ, AQUILA_V101)
#define LCD_SERIAL_PORT 1
- #elif MB(CREALITY_V24S1_301, CREALITY_V24S1_301F4, CREALITY_F401RE, CREALITY_V423, CREALITY_CR4NTXXC10, CREALITY_CR4NS, MKS_ROBIN, PANOWIN_CUTLASS, KODAMA_BARDO)
+ #elif MB(CREALITY_V24S1_301, CREALITY_V24S1_301F4, CREALITY_F401RE, CREALITY_V422_GD32_MFL, CREALITY_V423, CREALITY_V427_GD32_MFL, CREALITY_CR4NTXXC10, CREALITY_CR4NS, MKS_ROBIN, PANOWIN_CUTLASS, KODAMA_BARDO)
#define LCD_SERIAL_PORT 2
#else
#define LCD_SERIAL_PORT 3
diff --git a/Marlin/src/inc/Conditionals-5-post.h b/Marlin/src/inc/Conditionals-5-post.h
index a919dc2544..cbb6781333 100644
--- a/Marlin/src/inc/Conditionals-5-post.h
+++ b/Marlin/src/inc/Conditionals-5-post.h
@@ -2490,6 +2490,59 @@
//
// ADC Temp Sensors (Thermistor or Thermocouple with amplifier ADC interface)
//
+
+#if TEMP_SENSOR(0)
+ #define HAS_TEMP_HOTEND 1
+#endif
+#if TEMP_SENSOR(BED)
+ #define HAS_HEATED_BED 1
+ #define HAS_TEMP_BED 1
+#endif
+#if TEMP_SENSOR(CHAMBER)
+ #define HAS_TEMP_CHAMBER 1
+#endif
+#if TEMP_SENSOR(PROBE)
+ #define HAS_TEMP_PROBE 1
+#endif
+#if TEMP_SENSOR(COOLER)
+ #define HAS_TEMP_COOLER 1
+#endif
+#if TEMP_SENSOR(BOARD)
+ #define HAS_TEMP_BOARD 1
+#endif
+#if TEMP_SENSOR(SOC)
+ #define HAS_TEMP_SOC 1
+#endif
+#if TEMP_SENSOR(REDUNDANT)
+ #define HAS_TEMP_REDUNDANT 1
+#endif
+
+// Unused ADC pins can be omitted
+#if ANY(KEEP_ADC_PINS_AROUND, PINS_DEBUGGING, MARLIN_DEV_MODE)
+ #if !HAS_TEMP_HOTEND
+ #undef TEMP_0_PIN
+ #endif
+ #if !HAS_HEATED_BED
+ #undef TEMP_BED_PIN
+ #endif
+ #if !HAS_TEMP_CHAMBER
+ #undef TEMP_CHAMBER_PIN
+ #endif
+ #if !HAS_TEMP_PROBE
+ #undef TEMP_PROBE_PIN
+ #endif
+ #if !HAS_TEMP_COOLER
+ #undef TEMP_COOLER_PIN
+ #endif
+ #if !HAS_TEMP_BOARD
+ #undef TEMP_BOARD_PIN
+ #endif
+ #if DISABLED(FILAMENT_WIDTH_SENSOR)
+ #undef FILWIDTH_PIN
+ #undef FILWIDTH2_PIN
+ #endif
+#endif
+
#define HAS_ADC_TEST(P) (TEMP_SENSOR(P) && PIN_EXISTS(TEMP_##P) && !TEMP_SENSOR_IS_MAX_TC(P) && !TEMP_SENSOR_##P##_IS_DUMMY)
#if HOTENDS > 0 && HAS_ADC_TEST(0)
#define HAS_TEMP_ADC_0 1
@@ -2515,11 +2568,8 @@
#if HOTENDS > 7 && HAS_ADC_TEST(7)
#define HAS_TEMP_ADC_7 1
#endif
-#if TEMP_SENSOR_BED
- #define HAS_HEATED_BED 1
- #if HAS_ADC_TEST(BED)
- #define HAS_TEMP_ADC_BED 1
- #endif
+#if HAS_HEATED_BED && HAS_ADC_TEST(BED)
+ #define HAS_TEMP_ADC_BED 1
#endif
#if HAS_ADC_TEST(PROBE)
#define HAS_TEMP_ADC_PROBE 1
@@ -2539,31 +2589,11 @@
#if HAS_ADC_TEST(REDUNDANT)
#define HAS_TEMP_ADC_REDUNDANT 1
#endif
-
-#define HAS_TEMP(N) (TEMP_SENSOR_IS_MAX_TC(N) || HAS_TEMP_ADC_##N || TEMP_SENSOR_##N##_IS_DUMMY)
-#if HAS_HOTEND && HAS_TEMP(0)
- #define HAS_TEMP_HOTEND 1
+#if PIN_EXISTS(FILWIDTH_PIN)
+ #define HAS_FILWIDTH_ADC 1
#endif
-#if HAS_TEMP(BED)
- #define HAS_TEMP_BED 1
-#endif
-#if HAS_TEMP(CHAMBER)
- #define HAS_TEMP_CHAMBER 1
-#endif
-#if HAS_TEMP(PROBE)
- #define HAS_TEMP_PROBE 1
-#endif
-#if HAS_TEMP(COOLER)
- #define HAS_TEMP_COOLER 1
-#endif
-#if HAS_TEMP(BOARD)
- #define HAS_TEMP_BOARD 1
-#endif
-#if HAS_TEMP(SOC)
- #define HAS_TEMP_SOC 1
-#endif
-#if HAS_TEMP(REDUNDANT)
- #define HAS_TEMP_REDUNDANT 1
+#if PIN_EXISTS(FILWIDTH2_PIN)
+ #define HAS_FILWIDTH2_ADC 1
#endif
#if ENABLED(JOYSTICK)
@@ -2581,7 +2611,9 @@
#endif
#endif
-// Heaters
+//
+// Heater Outputs
+//
#if PIN_EXISTS(HEATER_0)
#define HAS_HEATER_0 1
#endif
diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h
index 60b328ea67..8ac9ce4db9 100644
--- a/Marlin/src/inc/SanityCheck.h
+++ b/Marlin/src/inc/SanityCheck.h
@@ -77,18 +77,20 @@
* tell you about new options that you might find useful. So it's recommended to transfer
* your settings to new Configuration files matching your Marlin version as soon as possible.
*/
-#define HEXIFY(H) _CAT(0x,H)
-#if !defined(CONFIGURATION_H_VERSION) || HEXIFY(CONFIGURATION_H_VERSION) < HEXIFY(REQUIRED_CONFIGURATION_H_VERSION)
- #error "Your Configuration.h file is for an old version of Marlin. Downgrade Marlin or upgrade your Configuration.h."
-#elif HEXIFY(CONFIGURATION_H_VERSION) > HEXIFY(REQUIRED_CONFIGURATION_H_VERSION)
- #error "Your Configuration.h file is for a newer version of Marlin. Upgrade Marlin or downgrade your Configuration.h."
-#endif
-#if !defined(CONFIGURATION_ADV_H_VERSION) || HEXIFY(CONFIGURATION_ADV_H_VERSION) < HEXIFY(REQUIRED_CONFIGURATION_ADV_H_VERSION)
- #error "Your Configuration_adv.h file is for an old version of Marlin. Downgrade Marlin or upgrade your Configuration_adv.h."
-#elif HEXIFY(CONFIGURATION_ADV_H_VERSION) > HEXIFY(REQUIRED_CONFIGURATION_ADV_H_VERSION)
- #error "Your Configuration_adv.h file is for a newer version of Marlin. Upgrade Marlin or downgrade your Configuration_adv.h."
-#endif
-#undef HEXIFY
+#if USE_STD_CONFIGS
+ #define HEXIFY(H) _CAT(0x,H)
+ #if !defined(CONFIGURATION_H_VERSION) || HEXIFY(CONFIGURATION_H_VERSION) < HEXIFY(REQUIRED_CONFIGURATION_H_VERSION)
+ #error "Your Configuration.h file is for an old version of Marlin. Downgrade Marlin or upgrade your Configuration.h."
+ #elif HEXIFY(CONFIGURATION_H_VERSION) > HEXIFY(REQUIRED_CONFIGURATION_H_VERSION)
+ #error "Your Configuration.h file is for a newer version of Marlin. Upgrade Marlin or downgrade your Configuration.h."
+ #endif
+ #if !defined(CONFIGURATION_ADV_H_VERSION) || HEXIFY(CONFIGURATION_ADV_H_VERSION) < HEXIFY(REQUIRED_CONFIGURATION_ADV_H_VERSION)
+ #error "Your Configuration_adv.h file is for an old version of Marlin. Downgrade Marlin or upgrade your Configuration_adv.h."
+ #elif HEXIFY(CONFIGURATION_ADV_H_VERSION) > HEXIFY(REQUIRED_CONFIGURATION_ADV_H_VERSION)
+ #error "Your Configuration_adv.h file is for a newer version of Marlin. Upgrade Marlin or downgrade your Configuration_adv.h."
+ #endif
+ #undef HEXIFY
+#endif // HAS_IGNORED_CONFIGS
/**
* Warnings for old configurations
@@ -1028,6 +1030,9 @@ static_assert(NUM_SERVOS <= NUM_SERVO_PLUGS, "NUM_SERVOS (or some servo index) i
#undef MPC_AUTOTUNE_MENU
#undef MPC_PTC
#endif
+#if !WITHIN(PID_MAX, 0, 255)
+ #error "PID_MAX must be an integer from 0 to 255."
+#endif
#if ENABLED(MPC_INCLUDE_FAN)
#if !HAS_FAN
@@ -1048,6 +1053,9 @@ static_assert(NUM_SERVOS <= NUM_SERVO_PLUGS, "NUM_SERVOS (or some servo index) i
#if ALL(PIDTEMPBED, BED_LIMIT_SWITCHING)
#error "To use BED_LIMIT_SWITCHING you must disable PIDTEMPBED."
#endif
+#if !WITHIN(MAX_BED_POWER, 0, 255)
+ #error "MAX_BED_POWER must be an integer from 0 to 255."
+#endif
// Fan Kickstart power
#if FAN_KICKSTART_TIME
diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h
index 9259dcc0f9..76e2272cef 100644
--- a/Marlin/src/inc/Version.h
+++ b/Marlin/src/inc/Version.h
@@ -42,7 +42,7 @@
* version was tagged.
*/
#ifndef STRING_DISTRIBUTION_DATE
- #define STRING_DISTRIBUTION_DATE "2025-07-30"
+ #define STRING_DISTRIBUTION_DATE "2025-09-26"
#endif
/**
diff --git a/Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp b/Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp
index a9e8bb5646..703c18515a 100644
--- a/Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp
+++ b/Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp
@@ -478,13 +478,7 @@ void ST7920_Lite_Status_Screen::draw_fan_icon(const bool whichIcon) {
}
void ST7920_Lite_Status_Screen::draw_heat_icon(const bool whichIcon, const bool heating) {
- set_ddram_address(
- #if HOTENDS == 1
- DDRAM_LINE_2
- #else
- DDRAM_LINE_3
- #endif
- );
+ set_ddram_address((HOTENDS < 2) ? DDRAM_LINE_2 : DDRAM_LINE_3);
begin_data();
if (heating)
write_word(whichIcon ? CGRAM_ICON_1_WORD : CGRAM_ICON_2_WORD);
@@ -920,7 +914,7 @@ void ST7920_Lite_Status_Screen::update(const bool forceUpdate) {
cs();
update_indicators(forceUpdate);
update_status_or_position(forceUpdate);
- update_progress(forceUpdate);
+ TERN_(HAS_PRINT_PROGRESS, update_progress(forceUpdate));
ncs();
}
diff --git a/Marlin/src/lcd/dogm/status_screen_lite_ST7920.h b/Marlin/src/lcd/dogm/status_screen_lite_ST7920.h
index e096825f8a..ac47da8ee8 100644
--- a/Marlin/src/lcd/dogm/status_screen_lite_ST7920.h
+++ b/Marlin/src/lcd/dogm/status_screen_lite_ST7920.h
@@ -31,7 +31,7 @@ class ST7920_Lite_Status_Screen {
} current_bits;
static void cs() { ST7920_cs(); current_bits.synced = false; }
- static void ncs() { ST7920_cs(); current_bits.synced = false; }
+ static void ncs() { ST7920_ncs(); current_bits.synced = false; }
static void sync_cmd() { ST7920_set_cmd(); }
static void sync_dat() { ST7920_set_dat(); }
static void write_byte(const uint8_t w) { ST7920_write_byte(w); }
diff --git a/Marlin/src/lcd/dogm/u8g/ultralcd_st7920_u8glib_rrd_AVR.cpp b/Marlin/src/lcd/dogm/u8g/ultralcd_st7920_u8glib_rrd_AVR.cpp
index f7b50741ac..32911b5bf1 100644
--- a/Marlin/src/lcd/dogm/u8g/ultralcd_st7920_u8glib_rrd_AVR.cpp
+++ b/Marlin/src/lcd/dogm/u8g/ultralcd_st7920_u8glib_rrd_AVR.cpp
@@ -91,24 +91,17 @@
#define ST7920_DAT(V) ((V) & 0x80)
#endif
-#define ST7920_SND_BIT do{ \
+#define ST7920_SND_BIT(...) do{ \
WRITE(ST7920_CLK_PIN, LOW); ST7920_DELAY_1; \
WRITE(ST7920_DAT_PIN, ST7920_DAT(val)); ST7920_DELAY_2; \
WRITE(ST7920_CLK_PIN, HIGH); ST7920_DELAY_3; \
- val <<= 1; }while(0)
+ val <<= 1; }while(0);
// Optimize this code with -O3
#pragma GCC optimize (3)
void ST7920_SWSPI_SND_8BIT(uint8_t val) {
- ST7920_SND_BIT; // 1
- ST7920_SND_BIT; // 2
- ST7920_SND_BIT; // 3
- ST7920_SND_BIT; // 4
- ST7920_SND_BIT; // 5
- ST7920_SND_BIT; // 6
- ST7920_SND_BIT; // 7
- ST7920_SND_BIT; // 8
+ REPEAT(8, ST7920_SND_BIT);
}
uint8_t u8g_dev_rrd_st7920_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg) {
diff --git a/Marlin/src/lcd/e3v2/creality/dwin.cpp b/Marlin/src/lcd/e3v2/creality/dwin.cpp
index 896f279963..8a84bdc718 100644
--- a/Marlin/src/lcd/e3v2/creality/dwin.cpp
+++ b/Marlin/src/lcd/e3v2/creality/dwin.cpp
@@ -30,9 +30,6 @@
#include "dwin.h"
-//#define USE_STRING_HEADINGS
-//#define USE_STRING_TITLES
-
#if DISABLED(PROBE_MANUALLY) && ANY(AUTO_BED_LEVELING_BILINEAR, AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_3POINT)
#define HAS_ONESTEP_LEVELING 1
#endif
@@ -3679,7 +3676,7 @@ void hmiAdvSet() {
dwinUpdateLCD();
}
- void hmiHomeOffN(const AxisEnum axis, float &posScaled, const_float_t lo, const_float_t hi) {
+ void hmiHomeOffN(const AxisEnum axis, float &posScaled, const float lo, const float hi) {
EncoderState encoder_diffState = encoderReceiveAnalyze();
if (encoder_diffState == ENCODER_DIFF_NO) return;
diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp
index f2c54da745..4fbefa3c8b 100644
--- a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp
+++ b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp
@@ -454,7 +454,7 @@ void JyersDWIN::clearScreen(const uint8_t e/*=3*/) {
if (e == 4) dwinDrawRectangle(1, COLOR_BG_BLACK, 0, 31, DWIN_WIDTH, DWIN_HEIGHT); // Clear Popup Area
}
-void JyersDWIN::drawFloat(const_float_t value, const uint8_t row, const bool selected/*=false*/, const uint8_t minunit/*=10*/) {
+void JyersDWIN::drawFloat(const float value, const uint8_t row, const bool selected/*=false*/, const uint8_t minunit/*=10*/) {
const uint8_t digits = (uint8_t)floor(log10(abs(value))) + log10(minunit) + (minunit > 1);
const uint16_t bColor = selected ? COLOR_SELECT : COLOR_BG_BLACK;
const uint16_t xpos = 240 - (digits * 8);
@@ -4812,7 +4812,7 @@ void JyersDWIN::confirmControl() {
// In-Menu Value Modification
//
-void JyersDWIN::setupValue(const_float_t value, const_float_t min, const_float_t max, const_float_t unit, const uint8_t type) {
+void JyersDWIN::setupValue(const float value, const float min, const float max, const float unit, const uint8_t type) {
if (TERN0(PIDTEMP, valuepointer == &thermalManager.temp_hotend[0].pid.Ki) || TERN0(PIDTEMPBED, valuepointer == &thermalManager.temp_bed.pid.Ki))
tempvalue = unscalePID_i(value) * unit;
else if (TERN0(PIDTEMP, valuepointer == &thermalManager.temp_hotend[0].pid.Kd) || TERN0(PIDTEMPBED, valuepointer == &thermalManager.temp_bed.pid.Kd))
@@ -4828,32 +4828,32 @@ void JyersDWIN::setupValue(const_float_t value, const_float_t min, const_float_t
drawFloat(tempvalue / unit, selection - scrollpos, true, valueunit);
}
-void JyersDWIN::modifyValue(float &value, const_float_t min, const_float_t max, const_float_t unit, void (*f)()/*=nullptr*/) {
+void JyersDWIN::modifyValue(float &value, const float min, const float max, const float unit, void (*f)()/*=nullptr*/) {
valuepointer = &value;
funcpointer = f;
setupValue((float)value, min, max, unit, 0);
}
-void JyersDWIN::modifyValue(uint8_t &value, const_float_t min, const_float_t max, const_float_t unit, void (*f)()/*=nullptr*/) {
+void JyersDWIN::modifyValue(uint8_t &value, const float min, const float max, const float unit, void (*f)()/*=nullptr*/) {
valuepointer = &value;
funcpointer = f;
setupValue((float)value, min, max, unit, 1);
}
-void JyersDWIN::modifyValue(uint16_t &value, const_float_t min, const_float_t max, const_float_t unit, void (*f)()/*=nullptr*/) {
+void JyersDWIN::modifyValue(uint16_t &value, const float min, const float max, const float unit, void (*f)()/*=nullptr*/) {
valuepointer = &value;
funcpointer = f;
setupValue((float)value, min, max, unit, 2);
}
-void JyersDWIN::modifyValue(int16_t &value, const_float_t min, const_float_t max, const_float_t unit, void (*f)()/*=nullptr*/) {
+void JyersDWIN::modifyValue(int16_t &value, const float min, const float max, const float unit, void (*f)()/*=nullptr*/) {
valuepointer = &value;
funcpointer = f;
setupValue((float)value, min, max, unit, 3);
}
-void JyersDWIN::modifyValue(uint32_t &value, const_float_t min, const_float_t max, const_float_t unit, void (*f)()/*=nullptr*/) {
+void JyersDWIN::modifyValue(uint32_t &value, const float min, const float max, const float unit, void (*f)()/*=nullptr*/) {
valuepointer = &value;
funcpointer = f;
setupValue((float)value, min, max, unit, 4);
}
-void JyersDWIN::modifyValue(int8_t &value, const_float_t min, const_float_t max, const_float_t unit, void (*f)()/*=nullptr*/) {
+void JyersDWIN::modifyValue(int8_t &value, const float min, const float max, const float unit, void (*f)()/*=nullptr*/) {
valuepointer = &value;
funcpointer = f;
setupValue((float)value, min, max, unit, 5);
diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.h b/Marlin/src/lcd/e3v2/jyersui/dwin.h
index 40c7490e30..cc071ef134 100644
--- a/Marlin/src/lcd/e3v2/jyersui/dwin.h
+++ b/Marlin/src/lcd/e3v2/jyersui/dwin.h
@@ -173,7 +173,7 @@ public:
static constexpr const char * const preheat_modes[3] = { "Both", "Hotend", "Bed" };
static void clearScreen(const uint8_t e=3);
- static void drawFloat(const_float_t value, const uint8_t row, const bool selected=false, const uint8_t minunit=10);
+ static void drawFloat(const float value, const uint8_t row, const bool selected=false, const uint8_t minunit=10);
static void drawOption(const uint8_t value, const char * const * options, const uint8_t row, const bool selected=false, const bool color=false);
static uint16_t getColor(const uint8_t color, const uint16_t original, const bool light=false);
static void drawCheckbox(const uint8_t row, const bool value);
@@ -219,13 +219,13 @@ public:
static void popupControl();
static void confirmControl();
- static void setupValue(const_float_t value, const_float_t min, const_float_t max, const_float_t unit, const uint8_t type);
- static void modifyValue(float &value, const_float_t min, const_float_t max, const_float_t unit, void (*f)()=nullptr);
- static void modifyValue(uint8_t &value, const_float_t min, const_float_t max, const_float_t unit, void (*f)()=nullptr);
- static void modifyValue(uint16_t &value, const_float_t min, const_float_t max, const_float_t unit, void (*f)()=nullptr);
- static void modifyValue(int16_t &value, const_float_t min, const_float_t max, const_float_t unit, void (*f)()=nullptr);
- static void modifyValue(uint32_t &value, const_float_t min, const_float_t max, const_float_t unit, void (*f)()=nullptr);
- static void modifyValue(int8_t &value, const_float_t min, const_float_t max, const_float_t unit, void (*f)()=nullptr);
+ static void setupValue(const float value, const float min, const float max, const float unit, const uint8_t type);
+ static void modifyValue(float &value, const float min, const float max, const float unit, void (*f)()=nullptr);
+ static void modifyValue(uint8_t &value, const float min, const float max, const float unit, void (*f)()=nullptr);
+ static void modifyValue(uint16_t &value, const float min, const float max, const float unit, void (*f)()=nullptr);
+ static void modifyValue(int16_t &value, const float min, const float max, const float unit, void (*f)()=nullptr);
+ static void modifyValue(uint32_t &value, const float min, const float max, const float unit, void (*f)()=nullptr);
+ static void modifyValue(int8_t &value, const float min, const float max, const float unit, void (*f)()=nullptr);
static void modifyOption(const uint8_t value, const char * const * options, const uint8_t max);
static void updateStatus(const char * const text);
diff --git a/Marlin/src/lcd/e3v2/marlinui/ui_status_480x272.cpp b/Marlin/src/lcd/e3v2/marlinui/ui_status_480x272.cpp
index c0b7ba90ec..82e5af5db9 100644
--- a/Marlin/src/lcd/e3v2/marlinui/ui_status_480x272.cpp
+++ b/Marlin/src/lcd/e3v2/marlinui/ui_status_480x272.cpp
@@ -108,7 +108,7 @@ void _draw_axis_value(const AxisEnum axis, const char *value, const bool blink,
#if ENABLED(LCD_SHOW_E_TOTAL)
- void _draw_e_value(const_float_t value, const uint16_t x, const uint16_t y) {
+ void _draw_e_value(const float value, const uint16_t x, const uint16_t y) {
const uint8_t scale = value >= 100000.0f ? 10 : 1; // show cm after 99,999mm
const bool e_redraw = !ui.did_first_redraw || old_is_printing != print_job_timer.isRunning();
@@ -290,17 +290,17 @@ void MarlinUI::draw_status_screen() {
);
}
- uint16_t hx = STATUS_HEATERS_X;
+ uint16_t shx = STATUS_HEATERS_X;
#if HAS_HOTEND
- _draw_heater_status(H_E0, hx, STATUS_HEATERS_Y);
- hx += STATUS_HEATERS_XSPACE;
+ _draw_heater_status(H_E0, shx, STATUS_HEATERS_Y);
+ shx += STATUS_HEATERS_XSPACE;
#endif
#if HAS_MULTI_HOTEND
- _draw_heater_status(H_E1, hx, STATUS_HEATERS_Y);
- hx += STATUS_HEATERS_XSPACE;
+ _draw_heater_status(H_E1, shx, STATUS_HEATERS_Y);
+ shx += STATUS_HEATERS_XSPACE;
#endif
#if HAS_HEATED_BED
- _draw_heater_status(H_BED, hx, STATUS_HEATERS_Y);
+ _draw_heater_status(H_BED, shx, STATUS_HEATERS_Y);
#endif
#if HAS_FAN
_draw_fan_status(LCD_PIXEL_WIDTH - STATUS_CHR_WIDTH * 5, STATUS_FAN_Y);
diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp
index cf99a13529..1be7946286 100644
--- a/Marlin/src/lcd/e3v2/proui/dwin.cpp
+++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp
@@ -1567,7 +1567,7 @@ void dwinLevelingDone() {
}
#if HAS_MESH
- void dwinMeshUpdate(const int8_t cpos, const int8_t tpos, const_float_t zval) {
+ void dwinMeshUpdate(const int8_t cpos, const int8_t tpos, const float zval) {
ui.set_status(
&MString<32>(GET_TEXT_F(MSG_PROBING_POINT), ' ', cpos, '/', tpos, F(" Z="), p_float_t(zval, 2))
);
@@ -2169,7 +2169,7 @@ void autoHome() { queue.inject_P(G28_STR); }
void applyZOffset() { TERN_(EEPROM_SETTINGS, settings.save()); }
void liveZOffset() {
#if ANY(BABYSTEP_ZPROBE_OFFSET, JUST_BABYSTEP)
- const_float_t step_zoffset = round((menuData.value / 100.0f) * planner.settings.axis_steps_per_mm[Z_AXIS]) - babystep.accum;
+ const float step_zoffset = round((menuData.value / 100.0f) * planner.settings.axis_steps_per_mm[Z_AXIS]) - babystep.accum;
if (BABYSTEP_ALLOWED()) babystep.add_steps(Z_AXIS, step_zoffset);
#endif
}
@@ -2304,7 +2304,7 @@ void setMoveZ() { hmiValue.axis = Z_AXIS; setPFloatOnClick(Z_MIN_POS, Z_MAX_POS,
#if HAS_COLOR_LEDS
bool enableLiveLedColor = true;
void applyLEDColor() {
- hmiData.ledColor = LEDColor( {leds.color.r, leds.color.g, leds.color.b OPTARG(HAS_WHITE_LED, hmiData.ledColor.w) } );
+ hmiData.ledColor = LED1Color_t(leds.color.r, leds.color.g, leds.color.b OPTARG(HAS_WHITE_LED, hmiData.ledColor.w));
if (!enableLiveLedColor) leds.update();
}
void liveLEDColor(uint8_t *color) { *color = menuData.value; if (enableLiveLedColor) leds.update(); }
@@ -2690,8 +2690,12 @@ void applyMaxAccel() { planner.set_max_acceleration(hmiValue.axis, menuData.valu
#define LA_FDIGITS 3
void applyLA_K() { planner.set_advance_k(menuData.value / POW(10, LA_FDIGITS)); }
void setLA_K() { setFloatOnClick(0, 10, LA_FDIGITS, planner.extruder_advance_K[0], applyLA_K); }
+ void onDrawLA_K(MenuItem* menuitem, int8_t line) { onDrawFloatMenu(menuitem, line, LA_FDIGITS, planner.get_advance_k()); }
+ #if ENABLED(SMOOTH_LIN_ADVANCE)
+ void applySmoothLA() { Stepper::set_advance_tau(menuData.value / POW(10, 2)); }
+ void setSmoothLA() { setPFloatOnClick(0, 0.5, 2, applySmoothLA); }
+ #endif
#endif
-
#if HAS_X_AXIS
void setStepsX() { hmiValue.axis = X_AXIS; setPFloatOnClick( min_steps_edit_values.x, max_steps_edit_values.x, UNITFDIGITS); }
#endif
@@ -3547,9 +3551,13 @@ void drawTuneMenu() {
#if ENABLED(PROUI_ITEM_JD)
EDIT_ITEM(ICON_JDmm, MSG_JUNCTION_DEVIATION, onDrawPFloat3Menu, setJDmm, &planner.junction_deviation_mm);
#endif
- #if ENABLED(PROUI_ITEM_ADVK)
- float editable_k = planner.get_advance_k();
- EDIT_ITEM(ICON_MaxAccelerated, MSG_ADVANCE_K, onDrawPFloat3Menu, setLA_K, &editable_k);
+ #if ALL(PROUI_ITEM_ADVK, LIN_ADVANCE)
+ static float editable_k = planner.get_advance_k();
+ EDIT_ITEM(ICON_MaxAccelerated, MSG_ADVANCE_K, onDrawLA_K, setLA_K, &editable_k);
+ #if ENABLED(SMOOTH_LIN_ADVANCE)
+ static float editable_u = Stepper::get_advance_tau();
+ EDIT_ITEM(ICON_MaxSpeed, MSG_ADVANCE_TAU, onDrawPFloat2Menu, setSmoothLA, &editable_u);
+ #endif
#endif
#if HAS_LOCKSCREEN
MENU_ITEM(ICON_Lock, MSG_LOCKSCREEN, onDrawMenuItem, dwinLockScreen);
@@ -3687,8 +3695,12 @@ void drawMotionMenu() {
MENU_ITEM(ICON_Homing, MSG_HOMING_FEEDRATE, onDrawSubMenu, drawHomingFRMenu);
#endif
#if ENABLED(LIN_ADVANCE)
- float editable_k = planner.get_advance_k();
- EDIT_ITEM(ICON_MaxAccelerated, MSG_ADVANCE_K, onDrawPFloat3Menu, setLA_K, &editable_k);
+ static float editable_k = planner.get_advance_k();
+ EDIT_ITEM(ICON_MaxAccelerated, MSG_ADVANCE_K, onDrawLA_K, setLA_K, &editable_k);
+ #if ENABLED(SMOOTH_LIN_ADVANCE)
+ static float editable_u = Stepper::get_advance_tau();
+ EDIT_ITEM(ICON_MaxSpeed, MSG_ADVANCE_TAU, onDrawPFloat2Menu, setSmoothLA, &editable_u);
+ #endif
#endif
#if ENABLED(SHAPING_MENU)
MENU_ITEM(ICON_InputShaping, MSG_INPUT_SHAPING, onDrawSubMenu, drawInputShaping_menu);
diff --git a/Marlin/src/lcd/e3v2/proui/dwin.h b/Marlin/src/lcd/e3v2/proui/dwin.h
index b6534a617b..12910a2537 100644
--- a/Marlin/src/lcd/e3v2/proui/dwin.h
+++ b/Marlin/src/lcd/e3v2/proui/dwin.h
@@ -160,7 +160,7 @@ typedef struct {
#define Z_POST_CLEARANCE hmiData.zAfterHoming
#endif
#if ALL(LED_CONTROL_MENU, HAS_COLOR_LEDS)
- LEDColor ledColor = defColorLeds;
+ LED1Color_t ledColor = defColorLeds;
#endif
#if HAS_GCODE_PREVIEW
bool enablePreview = true;
@@ -288,7 +288,7 @@ void dwinCheckStatusMessage();
void dwinHomingStart();
void dwinHomingDone();
#if HAS_MESH
- void dwinMeshUpdate(const int8_t cpos, const int8_t tpos, const_float_t zval);
+ void dwinMeshUpdate(const int8_t cpos, const int8_t tpos, const float zval);
#endif
void dwinLevelingStart();
void dwinLevelingDone();
diff --git a/Marlin/src/lcd/e3v2/proui/gcode_preview.cpp b/Marlin/src/lcd/e3v2/proui/gcode_preview.cpp
index 045615f3c2..9ad098f149 100644
--- a/Marlin/src/lcd/e3v2/proui/gcode_preview.cpp
+++ b/Marlin/src/lcd/e3v2/proui/gcode_preview.cpp
@@ -83,7 +83,7 @@ fileprop_t fileprop;
void getValue(const char * const buf, PGM_P const key, float &value) {
if (value != 0.0f) return;
- char *posptr = strstr_P(buf, key);
+ const char *posptr = strstr_P(buf, key);
if (posptr == nullptr) return;
char num[10] = "";
@@ -101,8 +101,9 @@ void getValue(const char * const buf, PGM_P const key, float &value) {
bool Preview::hasPreview() {
const char * const tbstart = PSTR("; thumbnail begin " STRINGIFY(THUMBWIDTH) "x" STRINGIFY(THUMBHEIGHT));
- char *posptr = nullptr;
+ const char *posptr = nullptr;
uint32_t indx = 0;
+ uint32_t prev_indx = 0;
float tmp = 0;
fileprop.clear();
@@ -114,7 +115,7 @@ bool Preview::hasPreview() {
uint8_t nbyte = 1;
while (!fileprop.thumbstart && nbyte > 0 && indx < 4 * sizeof(buf)) {
nbyte = card.read(buf, sizeof(buf) - 1);
- if (nbyte > 0) {
+ if (nbyte >= 0) {
buf[nbyte] = '\0';
getValue(buf, PSTR(";TIME:"), fileprop.time);
getValue(buf, PSTR(";Filament used:"), fileprop.filament);
@@ -132,13 +133,17 @@ bool Preview::hasPreview() {
fileprop.height -= tmp;
posptr = strstr_P(buf, tbstart);
if (posptr != nullptr) {
- fileprop.thumbstart = indx + (posptr - &buf[0]);
+ fileprop.thumbstart = indx + (posptr - buf);
}
else {
indx += _MAX(10, nbyte - (signed)strlen_P(tbstart));
+ if (indx <= prev_indx) break;
+ prev_indx = indx;
card.setIndex(indx);
}
}
+ else
+ break;
}
if (!fileprop.thumbstart) {
@@ -190,7 +195,7 @@ void Preview::drawFromSD() {
return;
}
- MString<45> buf;
+ TString buf;
dwinDrawRectangle(1, hmiData.colorBackground, 0, 0, DWIN_WIDTH, STATUS_Y - 1);
if (fileprop.time) {
buf.setf(F("Estimated time: %i:%02i"), (uint16_t)fileprop.time / 3600, ((uint16_t)fileprop.time % 3600) / 60);
@@ -210,7 +215,7 @@ void Preview::drawFromSD() {
}
DWINUI::drawButton(BTN_Print, 26, 290);
DWINUI::drawButton(BTN_Cancel, 146, 290);
- show();
+ if (fileprop.thumbsize) show();
drawSelectHighlight(true, 290);
dwinUpdateLCD();
}
diff --git a/Marlin/src/lcd/e3v2/proui/menus.h b/Marlin/src/lcd/e3v2/proui/menus.h
index d1f5cdb698..1d3a394710 100644
--- a/Marlin/src/lcd/e3v2/proui/menus.h
+++ b/Marlin/src/lcd/e3v2/proui/menus.h
@@ -37,14 +37,14 @@
#endif
typedef struct {
- int32_t maxValue = 0; // Auxiliar max integer/scaled float value
- int32_t minValue = 0; // Auxiliar min integer/scaled float value
- int8_t dp = 0; // Auxiliar decimal places
- int32_t value = 0; // Auxiliar integer / scaled float value
- int16_t *intPtr = nullptr; // Auxiliar pointer to 16 bit integer variable
- float *floatPtr = nullptr; // Auxiliar pointer to float variable
- void (*apply)() = nullptr; // Auxiliar apply function
- void (*liveUpdate)() = nullptr; // Auxiliar live update function
+ int32_t maxValue = 0; // Auxiliary max integer/scaled float value
+ int32_t minValue = 0; // Auxiliary min integer/scaled float value
+ int8_t dp = 0; // Auxiliary decimal places
+ int32_t value = 0; // Auxiliary integer / scaled float value
+ int16_t *intPtr = nullptr; // Auxiliary pointer to 16 bit integer variable
+ float *floatPtr = nullptr; // Auxiliary pointer to float variable
+ void (*apply)() = nullptr; // Auxiliary apply function
+ void (*liveUpdate)() = nullptr; // Auxiliary live update function
} MenuData_t;
extern MenuData_t menuData;
diff --git a/Marlin/src/lcd/e3v2/proui/plot.cpp b/Marlin/src/lcd/e3v2/proui/plot.cpp
index f77ffaf13a..bd5638a6bc 100644
--- a/Marlin/src/lcd/e3v2/proui/plot.cpp
+++ b/Marlin/src/lcd/e3v2/proui/plot.cpp
@@ -45,7 +45,7 @@ Plot plot;
Plot::PlotData Plot::data;
-void Plot::draw(const frame_rect_t &frame, const_celsius_float_t max, const_celsius_float_t ref/*=0*/) {
+void Plot::draw(const frame_rect_t &frame, const celsius_float_t max, const celsius_float_t ref/*=0*/) {
data.graphframe = frame;
data.graphpoints = 0;
data.scale = frame.h / max;
@@ -58,7 +58,7 @@ void Plot::draw(const frame_rect_t &frame, const_celsius_float_t max, const_cels
dwinDrawHLine(COLOR_RED, frame.x, data.r, frame.w);
}
-void Plot::update(const_celsius_float_t value) {
+void Plot::update(const celsius_float_t value) {
if (!data.scale) return;
const uint16_t y = LROUND((data.y2) - value * data.scale);
if (data.graphpoints < data.graphframe.w) {
diff --git a/Marlin/src/lcd/e3v2/proui/plot.h b/Marlin/src/lcd/e3v2/proui/plot.h
index 2617d78061..927707f84e 100644
--- a/Marlin/src/lcd/e3v2/proui/plot.h
+++ b/Marlin/src/lcd/e3v2/proui/plot.h
@@ -32,8 +32,8 @@
class Plot {
public:
- static void draw(const frame_rect_t &frame, const_celsius_float_t max, const_celsius_float_t ref=0);
- static void update(const_celsius_float_t value);
+ static void draw(const frame_rect_t &frame, const celsius_float_t max, const celsius_float_t ref=0);
+ static void update(const celsius_float_t value);
private:
static struct PlotData {
diff --git a/Marlin/src/lcd/e3v2/proui/proui_extui.cpp b/Marlin/src/lcd/e3v2/proui/proui_extui.cpp
index 2adca7cbe6..f5a1ac21b9 100644
--- a/Marlin/src/lcd/e3v2/proui/proui_extui.cpp
+++ b/Marlin/src/lcd/e3v2/proui/proui_extui.cpp
@@ -163,7 +163,7 @@ namespace ExtUI {
#endif
#if HAS_MESH
- void onMeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval) {
+ void onMeshUpdate(const int8_t xpos, const int8_t ypos, const float zval) {
const int16_t idx = ypos * (GRID_MAX_POINTS_X) + xpos;
dwinMeshUpdate(_MIN(idx, GRID_MAX_POINTS), int(GRID_MAX_POINTS), zval);
dwinRedrawScreen();
diff --git a/Marlin/src/lcd/extui/anycubic_chiron/FileNavigator.cpp b/Marlin/src/lcd/extui/anycubic_chiron/FileNavigator.cpp
index ffc485a3dc..5cbeb193e0 100644
--- a/Marlin/src/lcd/extui/anycubic_chiron/FileNavigator.cpp
+++ b/Marlin/src/lcd/extui/anycubic_chiron/FileNavigator.cpp
@@ -28,7 +28,7 @@
* (not affiliated with Anycubic, Ltd.)
*
* The AC panel wants files in block of 4 and can only display a flat list
- * This library allows full folder traversal or flat file display and supports both standerd and new style panels.
+ * This library allows full folder traversal or flat file display and supports both standard and new style panels.
*
* ## Old Style TFT panel
* Supported chars {}[]-+=_"$%^&*()~<>|
diff --git a/Marlin/src/lcd/extui/anycubic_chiron/chiron_extui.cpp b/Marlin/src/lcd/extui/anycubic_chiron/chiron_extui.cpp
index 83db56ae20..966ff905d4 100644
--- a/Marlin/src/lcd/extui/anycubic_chiron/chiron_extui.cpp
+++ b/Marlin/src/lcd/extui/anycubic_chiron/chiron_extui.cpp
@@ -137,7 +137,7 @@ namespace ExtUI {
#endif
#if HAS_MESH
- void onMeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval) {
+ void onMeshUpdate(const int8_t xpos, const int8_t ypos, const float zval) {
// Called when any mesh points are updated
//SERIAL_ECHOLNPGM("onMeshUpdate() x:", xpos, " y:", ypos, " z:", zval);
}
diff --git a/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_extui.cpp b/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_extui.cpp
index d6dc4002b1..26be48f2ff 100644
--- a/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_extui.cpp
+++ b/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_extui.cpp
@@ -127,7 +127,7 @@ namespace ExtUI {
#endif
#if HAS_MESH
- void onMeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval) {
+ void onMeshUpdate(const int8_t xpos, const int8_t ypos, const float zval) {
// Called when any mesh points are updated
}
diff --git a/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.cpp b/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.cpp
index 696cfad684..af5e20d3a1 100644
--- a/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.cpp
+++ b/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.cpp
@@ -496,7 +496,7 @@ namespace Anycubic {
#endif
case AC_printer_printing:
case AC_printer_paused:
- // Heater timout, send acknowledgement
+ // Heater timeout, send acknowledgement
if (strcmp_P(msg, MARLIN_msg_heater_timeout) == 0) {
pause_state = AC_paused_heater_timed_out;
tftSendLn(AC_msg_paused); // enable continue button
diff --git a/Marlin/src/lcd/extui/anycubic_vyper/vyper_extui.cpp b/Marlin/src/lcd/extui/anycubic_vyper/vyper_extui.cpp
index 8cd6e89ef1..5342991320 100644
--- a/Marlin/src/lcd/extui/anycubic_vyper/vyper_extui.cpp
+++ b/Marlin/src/lcd/extui/anycubic_vyper/vyper_extui.cpp
@@ -140,7 +140,7 @@ namespace ExtUI {
#endif
#if HAS_MESH
- void onMeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval) {
+ void onMeshUpdate(const int8_t xpos, const int8_t ypos, const float zval) {
// Called when any mesh points are updated
//SERIAL_ECHOLNPGM("onMeshUpdate() x:", xpos, " y:", ypos, " z:", zval);
}
diff --git a/Marlin/src/lcd/extui/dgus/dgus_extui.cpp b/Marlin/src/lcd/extui/dgus/dgus_extui.cpp
index 3706ca449c..59a4599df6 100644
--- a/Marlin/src/lcd/extui/dgus/dgus_extui.cpp
+++ b/Marlin/src/lcd/extui/dgus/dgus_extui.cpp
@@ -153,7 +153,7 @@ namespace ExtUI {
#endif
#if HAS_MESH
- void onMeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval) {
+ void onMeshUpdate(const int8_t xpos, const int8_t ypos, const float zval) {
// Called when any mesh points are updated
}
diff --git a/Marlin/src/lcd/extui/dgus_e3s1pro/DGUSRxHandler.cpp b/Marlin/src/lcd/extui/dgus_e3s1pro/DGUSRxHandler.cpp
index 118cfd3514..9d27bc7db6 100644
--- a/Marlin/src/lcd/extui/dgus_e3s1pro/DGUSRxHandler.cpp
+++ b/Marlin/src/lcd/extui/dgus_e3s1pro/DGUSRxHandler.cpp
@@ -34,14 +34,14 @@
#include "../../../module/stepper.h"
void DGUSRxHandler::printSpeedPercentage(DGUS_VP &vp, void *data) {
- const_float_t feedratePercentage = dgus.fromFixedPoint(Endianness::fromBE_P(data));
+ const float feedratePercentage = dgus.fromFixedPoint(Endianness::fromBE_P(data));
ExtUI::setFeedrate_percent(feedratePercentage);
}
void DGUSRxHandler::zOffset(DGUS_VP &vp, void *data) {
- const_float_t zoffset = dgus.fromFixedPoint(Endianness::fromBE_P(data));
- const_float_t currentzOffset = ExtUI::getZOffset_mm();
- const_float_t zStepsPerMm = ExtUI::getAxisSteps_per_mm(ExtUI::Z);
+ const float zoffset = dgus.fromFixedPoint(Endianness::fromBE_P(data));
+ const float currentzOffset = ExtUI::getZOffset_mm();
+ const float zStepsPerMm = ExtUI::getAxisSteps_per_mm(ExtUI::Z);
int16_t zStepsDiff = zStepsPerMm * (zoffset - currentzOffset);
ExtUI::babystepAxis_steps(zStepsDiff, ExtUI::Z);
@@ -49,33 +49,33 @@ void DGUSRxHandler::zOffset(DGUS_VP &vp, void *data) {
}
void DGUSRxHandler::extruderTargetTemp(DGUS_VP &vp, void *data) {
- const_float_t temperature = dgus.fromFixedPoint(Endianness::fromBE_P(data));
+ const float temperature = dgus.fromFixedPoint(Endianness::fromBE_P(data));
ExtUI::setTargetTemp_celsius(temperature, ExtUI::H0);
}
void DGUSRxHandler::bedTargetTemp(DGUS_VP &vp, void *data) {
- const_float_t temperature = dgus.fromFixedPoint(Endianness::fromBE_P(data));
+ const float temperature = dgus.fromFixedPoint(Endianness::fromBE_P(data));
ExtUI::setTargetTemp_celsius(temperature, ExtUI::BED);
}
void DGUSRxHandler::axis_X(DGUS_VP &vp, void *data) {
- const_float_t axisValue = dgus.fromFixedPoint(Endianness::fromBE_P(data));
+ const float axisValue = dgus.fromFixedPoint(Endianness::fromBE_P(data));
ExtUI::setAxisPosition_mm(axisValue, ExtUI::X);
}
void DGUSRxHandler::axis_Y(DGUS_VP &vp, void *data) {
- const_float_t axisValue = dgus.fromFixedPoint(Endianness::fromBE_P(data));
+ const float axisValue = dgus.fromFixedPoint(Endianness::fromBE_P(data));
ExtUI::setAxisPosition_mm(axisValue, ExtUI::Y);
}
void DGUSRxHandler::axis_Z(DGUS_VP &vp, void *data) {
- const_float_t axisValue = dgus.fromFixedPoint(Endianness::fromBE_P(data));
+ const float axisValue = dgus.fromFixedPoint(Endianness::fromBE_P(data));
ExtUI::setAxisPosition_mm(axisValue, ExtUI::Z);
}
void DGUSRxHandler::extrudeLength(DGUS_VP &vp, void *data) {
- const_float_t length = dgus.fromFixedPoint(Endianness::fromBE_P(data));
- const_float_t currentPosition = ExtUI::getAxisPosition_mm(ExtUI::E0);
+ const float length = dgus.fromFixedPoint(Endianness::fromBE_P(data));
+ const float currentPosition = ExtUI::getAxisPosition_mm(ExtUI::E0);
#if HAS_FILAMENT_SENSOR
if (ExtUI::getFilamentRunoutEnabled() && ExtUI::getFilamentRunoutState()) {
@@ -87,8 +87,8 @@ void DGUSRxHandler::extrudeLength(DGUS_VP &vp, void *data) {
}
void DGUSRxHandler::retractLength(DGUS_VP &vp, void *data) {
- const_float_t length = dgus.fromFixedPoint(Endianness::fromBE_P(data));
- const_float_t currentPosition = ExtUI::getAxisPosition_mm(ExtUI::E0);
+ const float length = dgus.fromFixedPoint(Endianness::fromBE_P(data));
+ const float currentPosition = ExtUI::getAxisPosition_mm(ExtUI::E0);
#if HAS_FILAMENT_SENSOR
if (ExtUI::getFilamentRunoutEnabled() && ExtUI::getFilamentRunoutState()) {
@@ -138,7 +138,7 @@ void DGUSRxHandler::setLanguage(DGUS_VP &vp, void *data) {
#endif // PIDTEMPBED
void DGUSRxHandler::fanSpeed(DGUS_VP &vp, void *data) {
- const_float_t percentage = dgus.fromFixedPoint(Endianness::fromBE_P(data));
+ const float percentage = dgus.fromFixedPoint(Endianness::fromBE_P(data));
ExtUI::setTargetFan_percent(percentage, ExtUI::FAN0);
}
diff --git a/Marlin/src/lcd/extui/dgus_e3s1pro/dgus_e3s1pro_extui.cpp b/Marlin/src/lcd/extui/dgus_e3s1pro/dgus_e3s1pro_extui.cpp
index 20012b689f..f38931c33f 100644
--- a/Marlin/src/lcd/extui/dgus_e3s1pro/dgus_e3s1pro_extui.cpp
+++ b/Marlin/src/lcd/extui/dgus_e3s1pro/dgus_e3s1pro_extui.cpp
@@ -148,7 +148,7 @@ namespace ExtUI {
#endif
#if HAS_MESH
- void onMeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval) {
+ void onMeshUpdate(const int8_t xpos, const int8_t ypos, const float zval) {
screen.meshUpdate(xpos, ypos);
}
void onMeshUpdate(const int8_t xpos, const int8_t ypos, const probe_state_t state) { }
diff --git a/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp b/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp
index e8ee497297..2b7afa76d4 100644
--- a/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp
+++ b/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp
@@ -140,7 +140,7 @@ namespace ExtUI {
#endif
#if HAS_MESH
- void onMeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval) {
+ void onMeshUpdate(const int8_t xpos, const int8_t ypos, const float zval) {
screen.meshUpdate(xpos, ypos);
}
diff --git a/Marlin/src/lcd/extui/example/example.cpp b/Marlin/src/lcd/extui/example/example.cpp
index 05d4730149..177ce156d5 100644
--- a/Marlin/src/lcd/extui/example/example.cpp
+++ b/Marlin/src/lcd/extui/example/example.cpp
@@ -132,7 +132,7 @@ namespace ExtUI {
#endif
#if HAS_MESH
- void onMeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval) {
+ void onMeshUpdate(const int8_t xpos, const int8_t ypos, const float zval) {
// Called when any mesh points are updated
}
diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_extui.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_extui.cpp
index 2f9da20ecc..d2c320badb 100644
--- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_extui.cpp
+++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_extui.cpp
@@ -159,7 +159,7 @@ namespace ExtUI {
#endif
#if HAS_MESH
- void onMeshUpdate(const int8_t x, const int8_t y, const_float_t val) {
+ void onMeshUpdate(const int8_t x, const int8_t y, const float val) {
BedMeshViewScreen::onMeshUpdate(x, y, val);
}
void onMeshUpdate(const int8_t x, const int8_t y, const ExtUI::probe_state_t state) {
diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/README.md b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/README.md
index 6ba985d600..61e5f3a388 100644
--- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/README.md
+++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/README.md
@@ -1,5 +1,4 @@
-FTDI EVE Library
-----------------
+## FTDI EVE Library
The FTDI EVE Library is a fully open-source library and UI framework for the FTDI
FT800 and FT810 graphics processor.
diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/command_processor.h b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/command_processor.h
index fd3e8f921c..8a0697f18d 100644
--- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/command_processor.h
+++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/command_processor.h
@@ -389,7 +389,7 @@ class CommandProcessor : public CLCD::CommandFifo {
return *this;
}
- FORCEDINLINE CommandProcessor& icon(int16_t x, int16_t y, int16_t w, int16_t h, const FTDI::bitmap_info_t& info, const float scale = 1) {
+ FORCEDINLINE CommandProcessor& icon(int16_t x, int16_t y, int16_t w, int16_t h, const FTDI::bitmap_info_t& info, const float scale=1) {
using namespace FTDI;
cmd(BEGIN(BITMAPS));
if (scale != 1) {
diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/scripts/svg2cpp.py b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/scripts/svg2cpp.py
index 3b26cc4e47..db09ce61eb 100755
--- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/scripts/svg2cpp.py
+++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/scripts/svg2cpp.py
@@ -1,6 +1,7 @@
#!/usr/bin/python3
# Written By Marcio Teixeira 2018 - Aleph Objects, Inc.
+# Edited By Andrew 2025 - ClassicRocker883
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -16,13 +17,13 @@
# location: .
from __future__ import print_function
-import argparse, re, sys
+import argparse, re, sys, os
from html.parser import HTMLParser
-usage = '''
-This program extracts line segments from a SVG file and writes
-them as coordinates in a C array. The x and y values will be
+USAGE = """
+This program extracts line segments from an SVG file and writes
+them out as coordinates in a C array. The X and Y values will be
scaled from 0x0000 to 0xFFFE. 0xFFFF is used as path separator.
This program can only interpret straight segments, not curves.
@@ -33,19 +34,22 @@ SVG file into the proper format, use the following procedure:
- Convert all Objects to Paths (Path -> Object to Path)
- Convert all Strokes to Paths (Path -> Stroke to Path)
- Combine all paths into one (Path -> Combine) [1]
- - Convert all curves into short line segments
- (Extensions -> Modify Paths -> Flatten Beziers...)
+ - Convert all curves into short line segments [2]
+ (Extensions -> Modify Paths -> Appoximate Curves by Straight Lines...)
- Save as new SVG
- Convert into a header file using this utility
- To give paths individual names, break apart paths and
use the XML Editor to set the "id" attributes.
[1] Combining paths is necessary to remove transforms. You
-could also use inkscape-applytransforms Inkscape extension.
+ could also use the Inkscape extension inkscape-applytransforms.
-'''
+[2] "Approximate Curves by Straight Lines..." has replaced
+ "Flatten Beziers".
-header = '''
+"""
+
+header = """
/****************************************************************************
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@@ -70,249 +74,258 @@ header = '''
*/
#pragma once
-'''
+"""
class ComputeBoundingBox:
- def reset(self):
- self.x_min = float(" inf")
- self.y_min = float(" inf")
- self.x_max = float("-inf")
- self.y_max = float("-inf")
- self.n_points = 0
- self.n_paths = 0
+ def reset(self):
+ self.x_min = float(" inf")
+ self.y_min = float(" inf")
+ self.x_max = float("-inf")
+ self.y_max = float("-inf")
+ self.n_points = 0
+ self.n_paths = 0
- def command(self, type, x, y):
- self.x_min = min(self.x_min, x)
- self.x_max = max(self.x_max, x)
- self.y_min = min(self.y_min, y)
- self.y_max = max(self.y_max, y)
+ def command(self, type, x, y):
+ self.x_min = min(self.x_min, x)
+ self.x_max = max(self.x_max, x)
+ self.y_min = min(self.y_min, y)
+ self.y_max = max(self.y_max, y)
- if type == "M":
- self.n_paths += 1
- self.n_points += 1
+ if type == "M":
+ self.n_paths += 1
+ self.n_points += 1
- def scale(self, x, y):
- x -= self.x_min
- y -= self.y_min
- x /= self.x_max - self.x_min
- y /= self.y_max - self.y_min
- #y = 1 - y # Flip upside down
- return (x, y)
+ def scale(self, x, y):
+ x -= self.x_min
+ y -= self.y_min
+ x /= self.x_max - self.x_min
+ y /= self.y_max - self.y_min
+ #y = 1 - y # Flip upside down
+ return (x, y)
- def path_finished(self, id):
- pass
+ def path_finished(self, id):
+ pass
- def write(self):
- print("constexpr float x_min = %f;" % self.x_min)
- print("constexpr float x_max = %f;" % self.x_max)
- print("constexpr float y_min = %f;" % self.y_min)
- print("constexpr float y_max = %f;" % self.y_max)
- print()
+ def write(self):
+ print("constexpr float x_min = %f;" % self.x_min)
+ print("constexpr float x_max = %f;" % self.x_max)
+ print("constexpr float y_min = %f;" % self.y_min)
+ print("constexpr float y_max = %f;" % self.y_max)
+ print()
- def from_svg_view_box(self, viewbox):
- m = re.search('([0-9-.]+) ([0-9-.]+) ([0-9-.]+) ([0-9-.]+)', viewbox)
- if m:
- self.x_min = float(m[1])
- self.y_min = float(m[2])
- self.x_max = float(m[3])
- self.y_max = float(m[4])
- return True
- return False
+ def from_svg_view_box(self, viewbox):
+ m = re.search('([0-9-.]+) ([0-9-.]+) ([0-9-.]+) ([0-9-.]+)', viewbox)
+ if m:
+ self.x_min = float(m[1])
+ self.y_min = float(m[2])
+ self.x_max = float(m[3])
+ self.y_max = float(m[4])
+ return True
+ return False
class WriteDataStructure:
- def __init__(self, bounding_box):
- self.bounds = bounding_box
+ def __init__(self, bounding_box, input_filename):
+ self.bounds = bounding_box
+ self.reset()
+ self.input_filename = input_filename
- def reset(self, ):
- self.hex_words = []
+ def reset(self):
+ self.hex_words = []
- def push(self, value):
- self.hex_words.append("0x%04X" % (0xFFFF & int(value)))
+ def push(self, value):
+ self.hex_words.append("0x%04X" % (0xFFFF & int(value)))
- def command(self, type, x, y):
- if type == "M":
- self.push(0xFFFF)
- x, y = self.bounds.scale(x,y)
- self.push(x * 0xFFFE)
- self.push(y * 0xFFFE)
+ def command(self, type, x, y):
+ if type == "M":
+ self.push(0xFFFF)
+ x, y = self.bounds.scale(x,y)
+ self.push(x * 0xFFFE)
+ self.push(y * 0xFFFE)
- def path_finished(self, id):
- if self.hex_words and self.hex_words[0] == "0xFFFF":
- self.hex_words.pop(0)
- print("const PROGMEM uint16_t", id + "[] = {" + ", ".join (self.hex_words) + "};")
- self.hex_words = []
+ def path_finished(self, id):
+ if self.hex_words and self.hex_words[0] == "0xFFFF":
+ self.hex_words.pop(0)
+ self.write_to_file(id)
+ self.hex_words = []
+
+ def write_to_file(self, id):
+ base_filename = os.path.splitext(self.input_filename)[0] + '.h'
+
+ with open(base_filename, "w") as outfile:
+ outfile.write(header)
+ outfile.write("const PROGMEM uint16_t " + id + "[] = {" + ", ".join(self.hex_words) + "};\n")
class SVGParser(HTMLParser):
- def __init__(self, args):
- super().__init__()
- self.args = args
- self.tags = []
- self.groups = []
- self.op = None
- self.restart()
-
- def set_consumer(self, op):
- self.op = op
- if self.op:
- self.op.reset()
-
- def restart(self):
- self.last_x = 0
- self.last_y = 0
- self.initial_x = 0
- self.initial_y = 0
-
- def process_svg_path_L_or_M(self, cmd, x, y):
- if self.op:
- self.op.command(cmd, x, y)
- self.last_x = x
- self.last_y = y
- if cmd == "M":
- self.initial_x = x
- self.initial_y = y
-
- def process_svg_path_data_cmd(self, id, cmd, a, b):
- """Converts the various types of moves into L or M commands
- and dispatches to process_svg_path_L_or_M for further processing."""
- if cmd == "Z" or cmd == "z":
- self.process_svg_path_L_or_M("L", self.initial_x, self.initial_y)
- elif cmd == "H":
- self.process_svg_path_L_or_M("L", a, self.last_y)
- elif cmd == "V":
- self.process_svg_path_L_or_M("L", self.last_x, a)
- elif cmd == "h":
- self.process_svg_path_L_or_M("L", self.last_x + a, self.last_y)
- elif cmd == "v":
- self.process_svg_path_L_or_M("L", self.last_x, self.last_y + a)
- elif cmd == "L":
- self.process_svg_path_L_or_M("L", a, b)
- elif cmd == "l":
- self.process_svg_path_L_or_M("L", self.last_x + a, self.last_y + b)
- elif cmd == "M":
- self.process_svg_path_L_or_M("M", a, b)
- elif cmd == "m":
- self.process_svg_path_L_or_M("M", self.last_x + a, self.last_y + b)
- else:
- print("Unsupported path data command:", cmd, "in path", id, "\n", file=sys.stderr)
- quit()
-
- def eat_token(self, regex):
- """Looks for a token at the start of self.d.
- If found, the token is removed."""
- self.m = re.match(regex,self.d)
- if self.m:
- self.d = self.d[self.m.end():]
- return self.m
-
- def process_svg_path_data(self, id, d):
- """Breaks up the "d" attribute into individual commands
- and calls "process_svg_path_data_cmd" for each"""
-
- self.d = d
- while (self.d):
- if self.eat_token('\s+'):
- pass # Just eat the spaces
-
- elif self.eat_token('([LMHVZlmhvz])'):
- cmd = self.m[1]
- # The following commands take no arguments
- if cmd == "Z" or cmd == "z":
- self.process_svg_path_data_cmd(id, cmd, 0, 0)
-
- elif self.eat_token('([CScsQqTtAa])'):
- print("Unsupported path data command:", self.m[1], "in path", id, "\n", file=sys.stderr)
- quit()
-
- elif self.eat_token('([ ,]*[-0-9e.]+)+'):
- # Process list of coordinates following command
- coords = re.split('[ ,]+', self.m[0])
- # The following commands take two arguments
- if cmd == "L" or cmd == "l":
- while coords:
- self.process_svg_path_data_cmd(id, cmd, float(coords.pop(0)), float(coords.pop(0)))
- elif cmd == "M":
- while coords:
- self.process_svg_path_data_cmd(id, cmd, float(coords.pop(0)), float(coords.pop(0)))
- # If a MOVETO has multiple points, the subsequent ones are assumed to be LINETO
- cmd = "L"
- elif cmd == "m":
- while coords:
- self.process_svg_path_data_cmd(id, cmd, float(coords.pop(0)), float(coords.pop(0)))
- # If a MOVETO has multiple points, the subsequent ones are assumed to be LINETO
- cmd = "l"
- # Assume all other commands are single argument
- else:
- while coords:
- self.process_svg_path_data_cmd(id, cmd, float(coords.pop(0)), 0)
- else:
- print("Syntax error:", d, "in path", id, "\n", file=sys.stderr)
- quit()
-
- def find_attr(attrs, what):
- for attr, value in attrs:
- if attr == what:
- return value
-
- def layer_matches(self):
- """ Are we in the correct layer?"""
- if not self.args.layer:
- return True
- for l in self.groups:
- if l and l.find(self.args.layer) != -1:
- return True
- return False
-
- def handle_starttag(self, tag, attrs):
- self.tags.append(tag)
- if tag == 'svg':
- self.viewbox = SVGParser.find_attr(attrs, 'viewbox')
- if tag == 'g':
- label = SVGParser.find_attr(attrs, 'inkscape:label')
- self.groups.append(label)
- if label and self.layer_matches():
- print("Reading layer:", label, file=sys.stderr)
- if tag == 'path' and self.layer_matches():
- id = SVGParser.find_attr(attrs, 'id')
- transform = SVGParser.find_attr(attrs, 'transform')
- if transform:
- print("Found transform in path", id, "! Cannot process file!", file=sys.stderr)
- quit()
- d = SVGParser.find_attr(attrs, 'd')
- if d:
- self.process_svg_path_data(id, d)
- if self.op:
- self.op.path_finished(id)
+ def __init__(self, args):
+ super().__init__()
+ self.args = args
+ self.tags = []
+ self.groups = []
+ self.op = None
self.restart()
- def handle_endtag(self, tag):
- if tag == 'g':
- self.groups.pop()
- if tag != self.tags.pop():
- print("Error popping tag off list")
+ def set_consumer(self, op):
+ self.op = op
+ if self.op:
+ self.op.reset()
+
+ def restart(self):
+ self.last_x = 0
+ self.last_y = 0
+ self.initial_x = 0
+ self.initial_y = 0
+
+ def process_svg_path_L_or_M(self, cmd, x, y):
+ if self.op:
+ self.op.command(cmd, x, y)
+ self.last_x = x
+ self.last_y = y
+ if cmd == "M":
+ self.initial_x = x
+ self.initial_y = y
+
+ def process_svg_path_data_cmd(self, id, cmd, a, b):
+ """Converts the various types of moves into L or M commands
+ and dispatches to process_svg_path_L_or_M for further processing."""
+ if cmd == "Z" or cmd == "z":
+ self.process_svg_path_L_or_M("L", self.initial_x, self.initial_y)
+ elif cmd == "H":
+ self.process_svg_path_L_or_M("L", a, self.last_y)
+ elif cmd == "V":
+ self.process_svg_path_L_or_M("L", self.last_x, a)
+ elif cmd == "h":
+ self.process_svg_path_L_or_M("L", self.last_x + a, self.last_y)
+ elif cmd == "v":
+ self.process_svg_path_L_or_M("L", self.last_x, self.last_y + a)
+ elif cmd == "L":
+ self.process_svg_path_L_or_M("L", a, b)
+ elif cmd == "l":
+ self.process_svg_path_L_or_M("L", self.last_x + a, self.last_y + b)
+ elif cmd == "M":
+ self.process_svg_path_L_or_M("M", a, b)
+ elif cmd == "m":
+ self.process_svg_path_L_or_M("M", self.last_x + a, self.last_y + b)
+ else:
+ print("Unsupported path data command:", cmd, "in path", id, "\n", file=sys.stderr)
+ quit()
+
+ def eat_token(self, regex):
+ """Looks for a token at the start of self.d.
+ If found, the token is removed."""
+ self.m = re.match(regex,self.d)
+ if self.m:
+ self.d = self.d[self.m.end():]
+ return self.m
+
+ def process_svg_path_data(self, id, d):
+ """Breaks up the "d" attribute into individual commands
+ and calls "process_svg_path_data_cmd" for each"""
+
+ self.d = d
+ while (self.d):
+ if self.eat_token(r'\s+'):
+ pass # Just eat the spaces
+
+ elif self.eat_token('([LMHVZlmhvz])'):
+ cmd = self.m[1]
+ # The following commands take no arguments
+ if cmd == "Z" or cmd == "z":
+ self.process_svg_path_data_cmd(id, cmd, 0, 0)
+
+ elif self.eat_token('([CScsQqTtAa])'):
+ print("Unsupported path data command:", self.m[1], "in path", id, "\n", file=sys.stderr)
+ quit()
+
+ elif self.eat_token('([ ,]*[-0-9e.]+)+'):
+ # Process list of coordinates following command
+ coords = re.split('[ ,]+', self.m[0])
+ # The following commands take two arguments
+ if cmd == "L" or cmd == "l":
+ while coords:
+ self.process_svg_path_data_cmd(id, cmd, float(coords.pop(0)), float(coords.pop(0)))
+ elif cmd == "M":
+ while coords:
+ self.process_svg_path_data_cmd(id, cmd, float(coords.pop(0)), float(coords.pop(0)))
+ # If a MOVETO has multiple points, the subsequent ones are assumed to be LINETO
+ cmd = "L"
+ elif cmd == "m":
+ while coords:
+ self.process_svg_path_data_cmd(id, cmd, float(coords.pop(0)), float(coords.pop(0)))
+ # If a MOVETO has multiple points, the subsequent ones are assumed to be LINETO
+ cmd = "l"
+ # Assume all other commands are single argument
+ else:
+ while coords:
+ self.process_svg_path_data_cmd(id, cmd, float(coords.pop(0)), 0)
+ else:
+ print("Syntax error:", d, "in path", id, "\n", file=sys.stderr)
+ quit()
+
+ def find_attr(self, attrs, what):
+ for attr, value in attrs:
+ if attr == what:
+ return value
+
+ def layer_matches(self):
+ """ Are we in the correct layer?"""
+ if not self.args.layer:
+ return True
+ for l in self.groups:
+ if l and l.find(self.args.layer) != -1:
+ return True
+ return False
+
+ def handle_starttag(self, tag, attrs):
+ self.tags.append(tag)
+ if tag == 'svg':
+ self.viewbox = self.find_attr(attrs, 'viewbox')
+ if tag == 'g':
+ label = self.find_attr(attrs, 'inkscape:label')
+ self.groups.append(label)
+ if label and self.layer_matches():
+ print("Reading layer:", label, file=sys.stderr)
+ if tag == 'path' and self.layer_matches():
+ id = self.find_attr(attrs, 'id')
+ transform = self.find_attr(attrs, 'transform')
+ if transform:
+ print("Found transform in path", id, "! Cannot process file!", file=sys.stderr)
+ quit()
+ d = self.find_attr(attrs, 'd')
+ if d:
+ self.process_svg_path_data(id, d)
+ if self.op:
+ self.op.path_finished(id)
+ self.restart()
+
+ def handle_endtag(self, tag):
+ if tag == 'g':
+ self.groups.pop()
+ if tag != self.tags.pop():
+ print("Error popping tag off list")
if __name__ == "__main__":
- parser = argparse.ArgumentParser()
- parser.add_argument("filename")
- parser.add_argument('--layer', help='only include layers which have this string in their names')
- args = parser.parse_args()
+ parser = argparse.ArgumentParser(description=USAGE, formatter_class=argparse.RawTextHelpFormatter)
+ parser.add_argument("filename")
+ parser.add_argument('--layer', help='Only include layers which have this string in their names')
+ args = parser.parse_args()
- f = open(args.filename, "r", encoding='utf-8')
- data = f.read()
+ f = open(args.filename, "r", encoding="utf-8")
+ data = f.read()
- # First pass to grab viewbox
- p = SVGParser(args)
- p.feed(data)
-
- b = ComputeBoundingBox()
- if not b.from_svg_view_box(p.viewbox):
- # Can't find the view box, so use the bounding box of the elements themselves.
+ # First pass to grab viewbox
p = SVGParser(args)
- p.set_consumer(b)
p.feed(data)
- b.write()
- # Last pass to process paths
- w = WriteDataStructure(b)
- p = SVGParser(args)
- p.set_consumer(w)
- p.feed(data)
+ b = ComputeBoundingBox()
+ if not b.from_svg_view_box(p.viewbox):
+ # Can't find the view box, so use the bounding box of the elements themselves.
+ p = SVGParser(args)
+ p.set_consumer(b)
+ p.feed(data)
+ b.write()
+
+ # Last pass to process paths
+ w = WriteDataStructure(b, args.filename)
+ p = SVGParser(args)
+ p.set_consumer(w)
+ p.feed(data)
diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/move_axis_screen.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/move_axis_screen.cpp
index bbb1d33098..99e7dcf279 100644
--- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/move_axis_screen.cpp
+++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/move_axis_screen.cpp
@@ -75,7 +75,7 @@ void MoveAxisScreen::onRedraw(draw_mode_t what) {
#endif
w.increments();
#ifdef PARKING_COMMAND_GCODE
- if (!ExtUI::isPrinting()) { // making sure the Tool Head Swap Position is not avalible while printing
+ if (!ExtUI::isPrinting()) { // making sure the Tool Head Swap Position is not available while printing
cmd.font(font_medium)
.colors(normal_btn)
.tag(25).button(BTN_POS(1,(7+EXTRUDERS)), BTN_SIZE(13,1), GET_TEXT_F(MSG_TOOL_HEAD_SWAP));
@@ -136,7 +136,7 @@ void BaseMoveAxisScreen::raiseZtoTop() {
setAxisPosition_mm(Z_MAX_POS - 5, Z, homing_feedrate.z);
}
-float BaseMoveAxisScreen::getManualFeedrate(const uint8_t axis, const_float_t increment_mm) {
+float BaseMoveAxisScreen::getManualFeedrate(const uint8_t axis, const float increment_mm) {
// Compute feedrate so that the tool lags the adjuster when it is
// being held down, this allows enough margin for the planner to
// connect segments and even out the motion.
@@ -144,12 +144,12 @@ float BaseMoveAxisScreen::getManualFeedrate(const uint8_t axis, const_float_t in
return min(MMM_TO_MMS(max_manual_feedrate[axis]), ABS(increment_mm * (TOUCH_REPEATS_PER_SECOND) * 0.80f));
}
-void BaseMoveAxisScreen::setManualFeedrate(const ExtUI::axis_t axis, const_float_t increment_mm) {
+void BaseMoveAxisScreen::setManualFeedrate(const ExtUI::axis_t axis, const float increment_mm) {
ExtUI::setFeedrate_mm_s(getManualFeedrate(X_AXIS + (axis - ExtUI::X), increment_mm));
}
#if HAS_EXTRUDERS
- void BaseMoveAxisScreen::setManualFeedrate(const ExtUI::extruder_t, const_float_t increment_mm) {
+ void BaseMoveAxisScreen::setManualFeedrate(const ExtUI::extruder_t, const float increment_mm) {
ExtUI::setFeedrate_mm_s(getManualFeedrate(E_AXIS, increment_mm));
}
#endif
diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/move_axis_screen.h b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/move_axis_screen.h
index b26254c4df..8e9cfae4df 100644
--- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/move_axis_screen.h
+++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/move_axis_screen.h
@@ -32,11 +32,11 @@ struct MoveAxisScreenData {
class BaseMoveAxisScreen : public BaseNumericAdjustmentScreen {
private:
- static float getManualFeedrate(const uint8_t axis, const_float_t increment_mm);
+ static float getManualFeedrate(const uint8_t axis, const float increment_mm);
public:
static void raiseZtoTop();
- static void setManualFeedrate(const ExtUI::axis_t, const_float_t increment_mm);
- static void setManualFeedrate(const ExtUI::extruder_t, const_float_t increment_mm);
+ static void setManualFeedrate(const ExtUI::axis_t, const float increment_mm);
+ static void setManualFeedrate(const ExtUI::extruder_t, const float increment_mm);
static void onEntry();
static bool onTouchHeld(const uint8_t tag);
diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/string_format.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/string_format.cpp
index bb6d958c80..29c45ad450 100644
--- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/string_format.cpp
+++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/string_format.cpp
@@ -35,7 +35,7 @@
/**
* Formats a temperature string (e.g. "100°C")
*/
-void format_temp(char *str, const_celsius_float_t t1) {
+void format_temp(char *str, const celsius_float_t t1) {
#ifdef TOUCH_UI_LCD_TEMP_PRECISION
char num1[7];
dtostrf(t1, 4 + TOUCH_UI_LCD_TEMP_PRECISION, TOUCH_UI_LCD_TEMP_PRECISION, num1);
@@ -48,7 +48,7 @@ void format_temp(char *str, const_celsius_float_t t1) {
/**
* Formats a temperature string for an idle heater (e.g. "100 °C / idle")
*/
-void format_temp_and_idle(char *str, const_celsius_float_t t1) {
+void format_temp_and_idle(char *str, const celsius_float_t t1) {
#ifdef TOUCH_UI_LCD_TEMP_PRECISION
char num1[7];
dtostrf(t1, 4 + TOUCH_UI_LCD_TEMP_PRECISION, TOUCH_UI_LCD_TEMP_PRECISION, num1);
@@ -61,7 +61,7 @@ void format_temp_and_idle(char *str, const_celsius_float_t t1) {
/**
* Formats a temperature string for an active heater (e.g. "100 / 200°C")
*/
-void format_temp_and_temp(char *str, const_celsius_float_t t1, const_celsius_float_t t2) {
+void format_temp_and_temp(char *str, const celsius_float_t t1, const celsius_float_t t2) {
#ifdef TOUCH_UI_LCD_TEMP_PRECISION
char num1[7], num2[7];
dtostrf(t1, 4 + TOUCH_UI_LCD_TEMP_PRECISION, TOUCH_UI_LCD_TEMP_PRECISION, num1);
@@ -75,7 +75,7 @@ void format_temp_and_temp(char *str, const_celsius_float_t t1, const_celsius_flo
/**
* Formats a temperature string for a material (e.g. "100°C (PLA)")
*/
-void format_temp_and_material(char *str, const_celsius_float_t t1, const char *material) {
+void format_temp_and_material(char *str, const celsius_float_t t1, const char *material) {
#ifdef TOUCH_UI_LCD_TEMP_PRECISION
char num1[7];
dtostrf(t1, 4 + TOUCH_UI_LCD_TEMP_PRECISION, TOUCH_UI_LCD_TEMP_PRECISION, num1);
diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/string_format.h b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/string_format.h
index 44583f08ec..c6709e97e8 100644
--- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/string_format.h
+++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/string_format.h
@@ -21,9 +21,9 @@
#pragma once
-void format_temp(char *str, const_celsius_float_t t1);
-void format_temp_and_idle(char *str, const_celsius_float_t t1);
-void format_temp_and_temp(char *str, const_celsius_float_t t1, const_celsius_float_t t2);
-void format_temp_and_material(char *str, const_celsius_float_t t1, const char *material);
+void format_temp(char *str, const celsius_float_t t1);
+void format_temp_and_idle(char *str, const celsius_float_t t1);
+void format_temp_and_temp(char *str, const celsius_float_t t1, const celsius_float_t t2);
+void format_temp_and_material(char *str, const celsius_float_t t1, const char *material);
void format_position(char *str, float p, uint8_t decimals = 1);
void format_position(char *str, float x, float y, float z);
diff --git a/Marlin/src/lcd/extui/ia_creality/ia_creality_extui.cpp b/Marlin/src/lcd/extui/ia_creality/ia_creality_extui.cpp
index 86a19f6089..2110117c78 100644
--- a/Marlin/src/lcd/extui/ia_creality/ia_creality_extui.cpp
+++ b/Marlin/src/lcd/extui/ia_creality/ia_creality_extui.cpp
@@ -366,7 +366,7 @@ void onPostprocessSettings() {}
#if HAS_MESH
void onMeshUpdate(const int8_t xpos, const int8_t ypos, probe_state_t state) {}
- void onMeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval) {
+ void onMeshUpdate(const int8_t xpos, const int8_t ypos, const float zval) {
if (waitway == 3)
if (isPositionKnown() && (getActualTemp_celsius(BED) >= (getTargetTemp_celsius(BED) - 1)))
rts.sendData(ExchangePageBase + 64, ExchangepageAddr);
diff --git a/Marlin/src/lcd/extui/ia_creality/ia_creality_rts.cpp b/Marlin/src/lcd/extui/ia_creality/ia_creality_rts.cpp
index 8fb672931d..ca372e12f2 100644
--- a/Marlin/src/lcd/extui/ia_creality/ia_creality_rts.cpp
+++ b/Marlin/src/lcd/extui/ia_creality/ia_creality_rts.cpp
@@ -554,7 +554,7 @@ void RTS::sendData(const char c, const uint32_t addr, const uint8_t cmd/*=VarAdd
sendData();
}
-void RTS::sendData(const_float_t f, const uint32_t addr, const uint8_t cmd/*=VarAddr_W*/) {
+void RTS::sendData(const float f, const uint32_t addr, const uint8_t cmd/*=VarAddr_W*/) {
int16_t n = f;
if (cmd == VarAddr_W) {
snddat.data[0] = n;
diff --git a/Marlin/src/lcd/extui/ia_creality/ia_creality_rts.h b/Marlin/src/lcd/extui/ia_creality/ia_creality_rts.h
index 3b467f4d25..2f1846deac 100644
--- a/Marlin/src/lcd/extui/ia_creality/ia_creality_rts.h
+++ b/Marlin/src/lcd/extui/ia_creality/ia_creality_rts.h
@@ -228,7 +228,7 @@ class RTS {
static void sendData(char, const uint32_t, const uint8_t=VarAddr_W);
static void sendData(int, const uint32_t, const uint8_t=VarAddr_W);
static void sendData(unsigned long, const uint32_t, const uint8_t=VarAddr_W);
- static void sendData(const_float_t, const uint32_t, const uint8_t=VarAddr_W);
+ static void sendData(const float, const uint32_t, const uint8_t=VarAddr_W);
static void sendData(uint8_t * const str, const uint32_t addr, const uint8_t cmd=VarAddr_W) { sendData((char *)str, addr, cmd); }
static void sendData(const unsigned int n, uint32_t addr, const uint8_t cmd=VarAddr_W) { sendData(int(n), addr, cmd); }
diff --git a/Marlin/src/lcd/extui/malyan/malyan_extui.cpp b/Marlin/src/lcd/extui/malyan/malyan_extui.cpp
index 3ed4678a41..53c5fa7e74 100644
--- a/Marlin/src/lcd/extui/malyan/malyan_extui.cpp
+++ b/Marlin/src/lcd/extui/malyan/malyan_extui.cpp
@@ -187,7 +187,7 @@ namespace ExtUI {
#endif
#if HAS_MESH
- void onMeshUpdate(const int8_t, const int8_t, const_float_t) {}
+ void onMeshUpdate(const int8_t, const int8_t, const float) {}
void onMeshUpdate(const int8_t, const int8_t, const ExtUI::probe_state_t) {}
#endif
diff --git a/Marlin/src/lcd/extui/ui_api.cpp b/Marlin/src/lcd/extui/ui_api.cpp
index badb3335a3..5f69d4424a 100644
--- a/Marlin/src/lcd/extui/ui_api.cpp
+++ b/Marlin/src/lcd/extui/ui_api.cpp
@@ -337,7 +337,7 @@ namespace ExtUI {
return epos;
}
- void setAxisPosition_mm(const_float_t position, const axis_t axis, const feedRate_t feedrate/*=0*/) {
+ void setAxisPosition_mm(const float position, const axis_t axis, const feedRate_t feedrate/*=0*/) {
// Get motion limit from software endstops, if any
float min, max;
soft_endstop.get_manual_axis_limits((AxisEnum)axis, min, max);
@@ -355,7 +355,7 @@ namespace ExtUI {
line_to_current_position(feedrate ?: manual_feedrate_mm_s[axis]);
}
- void setAxisPosition_mm(const_float_t position, const extruder_t extruder, const feedRate_t feedrate/*=0*/) {
+ void setAxisPosition_mm(const float position, const extruder_t extruder, const feedRate_t feedrate/*=0*/) {
setActiveTool(extruder, true);
current_position.e = position;
@@ -470,7 +470,7 @@ namespace ExtUI {
};
}
- void setAxisCurrent_mA(const_float_t mA, const axis_t axis) {
+ void setAxisCurrent_mA(const float mA, const axis_t axis) {
switch (axis) {
case X: TERN_(X_IS_TRINAMIC, stepperX.rms_current(constrain(mA, 400, 1500))); break;
case Y: TERN_(Y_IS_TRINAMIC, stepperY.rms_current(constrain(mA, 400, 1500))); break;
@@ -490,7 +490,7 @@ namespace ExtUI {
};
}
- void setAxisCurrent_mA(const_float_t mA, const extruder_t extruder) {
+ void setAxisCurrent_mA(const float mA, const extruder_t extruder) {
switch (extruder) {
case E0: TERN_(E0_IS_TRINAMIC, stepperE0.rms_current(constrain(mA, 400, 1500))); break;
case E1: TERN_(E1_IS_TRINAMIC, stepperE1.rms_current(constrain(mA, 400, 1500))); break;
@@ -524,7 +524,7 @@ namespace ExtUI {
}
}
- void setTMCBumpSensitivity(const_float_t value, const axis_t axis) {
+ void setTMCBumpSensitivity(const float value, const axis_t axis) {
switch (axis) {
case X: TERN_(X_SENSORLESS, stepperX.homing_threshold(value)); break;
case Y: TERN_(Y_SENSORLESS, stepperY.homing_threshold(value)); break;
@@ -560,12 +560,12 @@ namespace ExtUI {
}
#if ENABLED(EDITABLE_STEPS_PER_UNIT)
- void setAxisSteps_per_mm(const_float_t value, const axis_t axis) {
+ void setAxisSteps_per_mm(const float value, const axis_t axis) {
planner.settings.axis_steps_per_mm[axis] = value;
planner.refresh_positioning();
}
- void setAxisSteps_per_mm(const_float_t value, const extruder_t extruder) {
+ void setAxisSteps_per_mm(const float value, const extruder_t extruder) {
UNUSED(extruder);
planner.settings.axis_steps_per_mm[E_AXIS_N(extruder - E0)] = value;
planner.refresh_positioning();
@@ -599,11 +599,11 @@ namespace ExtUI {
return planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(extruder - E0)];
}
- void setAxisMaxAcceleration_mm_s2(const_float_t value, const axis_t axis) {
+ void setAxisMaxAcceleration_mm_s2(const float value, const axis_t axis) {
planner.set_max_acceleration((AxisEnum)axis, value);
}
- void setAxisMaxAcceleration_mm_s2(const_float_t value, const extruder_t extruder) {
+ void setAxisMaxAcceleration_mm_s2(const float value, const extruder_t extruder) {
UNUSED(extruder);
planner.set_max_acceleration(E_AXIS_N(extruder - E0), value);
}
@@ -616,7 +616,7 @@ namespace ExtUI {
#if HAS_FILAMENT_RUNOUT_DISTANCE
float getFilamentRunoutDistance_mm() { return runout.runout_distance(); }
- void setFilamentRunoutDistance_mm(const_float_t value) { runout.set_runout_distance(constrain(value, 0, 999)); }
+ void setFilamentRunoutDistance_mm(const float value) { runout.set_runout_distance(constrain(value, 0, 999)); }
#endif
#endif
@@ -629,7 +629,7 @@ namespace ExtUI {
#if CASELIGHT_USES_BRIGHTNESS
float getCaseLightBrightness_percent() { return ui8_to_percent(caselight.brightness); }
- void setCaseLightBrightness_percent(const_float_t value) {
+ void setCaseLightBrightness_percent(const float value) {
caselight.brightness = map(constrain(value, 0, 100), 0, 100, 0, 255);
caselight.update_brightness();
}
@@ -646,7 +646,7 @@ namespace ExtUI {
return (extruder < EXTRUDERS) ? planner.get_advance_k(E_INDEX_N(extruder - E0)) : 0;
}
- void setLinearAdvance_mm_mm_s(const_float_t value, const extruder_t extruder) {
+ void setLinearAdvance_mm_mm_s(const float value, const extruder_t extruder) {
if (extruder < EXTRUDERS)
planner.set_advance_k(constrain(value, 0, 10), E_INDEX_N(extruder - E0));
}
@@ -674,7 +674,7 @@ namespace ExtUI {
float getJunctionDeviation_mm() { return planner.junction_deviation_mm; }
- void setJunctionDeviation_mm(const_float_t value) {
+ void setJunctionDeviation_mm(const float value) {
planner.junction_deviation_mm = constrain(value, 0.001, 0.3);
TERN_(LIN_ADVANCE, planner.recalculate_max_e_jerk());
}
@@ -682,8 +682,8 @@ namespace ExtUI {
#else
float getAxisMaxJerk_mm_s(const axis_t axis) { return planner.max_jerk[axis]; }
float getAxisMaxJerk_mm_s(const extruder_t) { return planner.max_jerk.e; }
- void setAxisMaxJerk_mm_s(const_float_t value, const axis_t axis) { planner.set_max_jerk((AxisEnum)axis, value); }
- void setAxisMaxJerk_mm_s(const_float_t value, const extruder_t) { planner.set_max_jerk(E_AXIS, value); }
+ void setAxisMaxJerk_mm_s(const float value, const axis_t axis) { planner.set_max_jerk((AxisEnum)axis, value); }
+ void setAxisMaxJerk_mm_s(const float value, const extruder_t) { planner.set_max_jerk(E_AXIS, value); }
#endif
#if ENABLED(DUAL_X_CARRIAGE)
@@ -711,9 +711,9 @@ namespace ExtUI {
void setFlow_percent(const int16_t flow, const extruder_t extr) { planner.set_flow(extr, flow); }
void setMinFeedrate_mm_s(const feedRate_t fr) { planner.settings.min_feedrate_mm_s = fr; }
void setMinTravelFeedrate_mm_s(const feedRate_t fr) { planner.settings.min_travel_feedrate_mm_s = fr; }
- void setPrintingAcceleration_mm_s2(const_float_t acc) { planner.settings.acceleration = acc; }
- void setRetractAcceleration_mm_s2(const_float_t acc) { planner.settings.retract_acceleration = acc; }
- void setTravelAcceleration_mm_s2(const_float_t acc) { planner.settings.travel_acceleration = acc; }
+ void setPrintingAcceleration_mm_s2(const float acc) { planner.settings.acceleration = acc; }
+ void setRetractAcceleration_mm_s2(const float acc) { planner.settings.retract_acceleration = acc; }
+ void setTravelAcceleration_mm_s2(const float acc) { planner.settings.travel_acceleration = acc; }
#if ENABLED(BABYSTEPPING)
@@ -780,7 +780,7 @@ namespace ExtUI {
* Converts a mm displacement to a number of whole number of
* steps that is at least mm long.
*/
- int16_t mmToWholeSteps(const_float_t mm, const axis_t axis) {
+ int16_t mmToWholeSteps(const float mm, const axis_t axis) {
const float steps = mm / planner.mm_per_step[axis];
return steps > 0 ? CEIL(steps) : FLOOR(steps);
}
@@ -803,7 +803,7 @@ namespace ExtUI {
);
}
- void setZOffset_mm(const_float_t value) {
+ void setZOffset_mm(const float value) {
#if HAS_BED_PROBE
if (WITHIN(value, PROBE_OFFSET_ZMIN, PROBE_OFFSET_ZMAX))
probe.offset.z = value;
@@ -821,7 +821,7 @@ namespace ExtUI {
return hotend_offset[extruder - E0][axis];
}
- void setNozzleOffset_mm(const_float_t value, const axis_t axis, const extruder_t extruder) {
+ void setNozzleOffset_mm(const float value, const axis_t axis, const extruder_t extruder) {
if (extruder - E0 >= HOTENDS) return;
hotend_offset[extruder - E0][axis] = value;
}
@@ -840,21 +840,21 @@ namespace ExtUI {
#if HAS_BED_PROBE
float getProbeOffset_mm(const axis_t axis) { return probe.offset.pos[axis]; }
- void setProbeOffset_mm(const_float_t val, const axis_t axis) { probe.offset.pos[axis] = val; }
+ void setProbeOffset_mm(const float val, const axis_t axis) { probe.offset.pos[axis] = val; }
probe_limits_t getBedProbeLimits() { return probe_limits_t({ probe.min_x(), probe.min_y(), probe.max_x(), probe.max_y() }); }
#endif
#if ENABLED(BACKLASH_GCODE)
float getAxisBacklash_mm(const axis_t axis) { return backlash.get_distance_mm((AxisEnum)axis); }
- void setAxisBacklash_mm(const_float_t value, const axis_t axis)
+ void setAxisBacklash_mm(const float value, const axis_t axis)
{ backlash.set_distance_mm((AxisEnum)axis, constrain(value,0,5)); }
float getBacklashCorrection_percent() { return backlash.get_correction() * 100.0f; }
- void setBacklashCorrection_percent(const_float_t value) { backlash.set_correction(constrain(value, 0, 100) / 100.0f); }
+ void setBacklashCorrection_percent(const float value) { backlash.set_correction(constrain(value, 0, 100) / 100.0f); }
#ifdef BACKLASH_SMOOTHING_MM
float getBacklashSmoothing_mm() { return backlash.get_smoothing_mm(); }
- void setBacklashSmoothing_mm(const_float_t value) { backlash.set_smoothing_mm(constrain(value, 0, 999)); }
+ void setBacklashSmoothing_mm(const float value) { backlash.set_smoothing_mm(constrain(value, 0, 999)); }
#endif
#endif
@@ -873,14 +873,14 @@ namespace ExtUI {
bed_mesh_t& getMeshArray() { return bedlevel.z_values; }
float getMeshPoint(const xy_uint8_t &pos) { return bedlevel.z_values[pos.x][pos.y]; }
- void setMeshPoint(const xy_uint8_t &pos, const_float_t zoff) {
+ void setMeshPoint(const xy_uint8_t &pos, const float zoff) {
if (WITHIN(pos.x, 0, (GRID_MAX_POINTS_X) - 1) && WITHIN(pos.y, 0, (GRID_MAX_POINTS_Y) - 1)) {
bedlevel.z_values[pos.x][pos.y] = zoff;
TERN_(ABL_BILINEAR_SUBDIVISION, bedlevel.refresh_bed_level());
}
}
- void moveToMeshPoint(const xy_uint8_t &pos, const_float_t z) {
+ void moveToMeshPoint(const xy_uint8_t &pos, const float z) {
#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_UBL)
REMEMBER(fr, feedrate_mm_s);
const float x_target = MESH_MIN_X + pos.x * (MESH_X_DIST),
@@ -931,7 +931,7 @@ namespace ExtUI {
float getPID_Ki(const extruder_t tool) { return thermalManager.temp_hotend[tool].pid.i(); }
float getPID_Kd(const extruder_t tool) { return thermalManager.temp_hotend[tool].pid.d(); }
- void setPID(const_float_t p, const_float_t i, const_float_t d, extruder_t tool) {
+ void setPID(const float p, const float i, const float d, extruder_t tool) {
thermalManager.setPID(uint8_t(tool), p, i, d);
}
@@ -945,7 +945,7 @@ namespace ExtUI {
float getBedPID_Ki() { return thermalManager.temp_bed.pid.i(); }
float getBedPID_Kd() { return thermalManager.temp_bed.pid.d(); }
- void setBedPID(const_float_t p, const_float_t i, const_float_t d) {
+ void setBedPID(const float p, const float i, const float d) {
thermalManager.temp_bed.pid.set(p, i, d);
}
@@ -969,7 +969,7 @@ namespace ExtUI {
return firmware_name;
}
- void setTargetTemp_celsius(const_float_t inval, const heater_t heater) {
+ void setTargetTemp_celsius(const float inval, const heater_t heater) {
float value = inval;
#ifdef TOUCH_UI_LCD_TEMP_SCALING
value *= TOUCH_UI_LCD_TEMP_SCALING;
@@ -994,7 +994,7 @@ namespace ExtUI {
}
}
- void setTargetTemp_celsius(const_float_t inval, const extruder_t extruder) {
+ void setTargetTemp_celsius(const float inval, const extruder_t extruder) {
float value = inval;
#ifdef TOUCH_UI_LCD_TEMP_SCALING
value *= TOUCH_UI_LCD_TEMP_SCALING;
@@ -1006,7 +1006,7 @@ namespace ExtUI {
#endif
}
- void setTargetFan_percent(const_float_t value, const fan_t fan) {
+ void setTargetFan_percent(const float value, const fan_t fan) {
#if HAS_FAN
if (fan < FAN_COUNT)
thermalManager.set_fan_speed(fan - FAN0, map(constrain(value, 0, 100), 0, 100, 0, 255));
@@ -1016,7 +1016,7 @@ namespace ExtUI {
#endif
}
- void setFeedrate_percent(const_float_t value) { feedrate_percentage = constrain(value, 10, 500); }
+ void setFeedrate_percent(const float value) { feedrate_percentage = constrain(value, 10, 500); }
void coolDown() { thermalManager.cooldown(); }
diff --git a/Marlin/src/lcd/extui/ui_api.h b/Marlin/src/lcd/extui/ui_api.h
index 7796a4e49f..a4b514d3ce 100644
--- a/Marlin/src/lcd/extui/ui_api.h
+++ b/Marlin/src/lcd/extui/ui_api.h
@@ -158,11 +158,11 @@ namespace ExtUI {
#if HAS_TRINAMIC_CONFIG
float getAxisCurrent_mA(const axis_t);
float getAxisCurrent_mA(const extruder_t);
- void setAxisCurrent_mA(const_float_t, const axis_t);
- void setAxisCurrent_mA(const_float_t, const extruder_t);
+ void setAxisCurrent_mA(const float, const axis_t);
+ void setAxisCurrent_mA(const float, const extruder_t);
int getTMCBumpSensitivity(const axis_t);
- void setTMCBumpSensitivity(const_float_t, const axis_t);
+ void setTMCBumpSensitivity(const float, const axis_t);
#endif
// Actual and target accessors, by Heater ID, Extruder ID, Fan ID
@@ -245,10 +245,10 @@ namespace ExtUI {
// Mesh data, utilities, events
bed_mesh_t& getMeshArray();
float getMeshPoint(const xy_uint8_t &pos);
- void setMeshPoint(const xy_uint8_t &pos, const_float_t zval);
- void moveToMeshPoint(const xy_uint8_t &pos, const_float_t z);
- void onMeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval);
- inline void onMeshUpdate(const xy_int8_t &pos, const_float_t zval) { onMeshUpdate(pos.x, pos.y, zval); }
+ void setMeshPoint(const xy_uint8_t &pos, const float zval);
+ void moveToMeshPoint(const xy_uint8_t &pos, const float z);
+ void onMeshUpdate(const int8_t xpos, const int8_t ypos, const float zval);
+ inline void onMeshUpdate(const xy_int8_t &pos, const float zval) { onMeshUpdate(pos.x, pos.y, zval); }
typedef enum : uint8_t {
G29_START, // Prior to start of probe
@@ -288,31 +288,31 @@ namespace ExtUI {
#endif
// Temperature Control
- void setTargetTemp_celsius(const_float_t, const heater_t);
- void setTargetTemp_celsius(const_float_t, const extruder_t);
- void setTargetFan_percent(const_float_t, const fan_t);
+ void setTargetTemp_celsius(const float, const heater_t);
+ void setTargetTemp_celsius(const float, const extruder_t);
+ void setTargetFan_percent(const float, const fan_t);
void coolDown();
// Motion Control
- void setAxisPosition_mm(const_float_t, const axis_t, const feedRate_t=0);
- void setAxisPosition_mm(const_float_t, const extruder_t, const feedRate_t=0);
+ void setAxisPosition_mm(const float, const axis_t, const feedRate_t=0);
+ void setAxisPosition_mm(const float, const extruder_t, const feedRate_t=0);
// Planner Control
#if ENABLED(EDITABLE_STEPS_PER_UNIT)
- void setAxisSteps_per_mm(const_float_t, const axis_t);
- void setAxisSteps_per_mm(const_float_t, const extruder_t);
+ void setAxisSteps_per_mm(const float, const axis_t);
+ void setAxisSteps_per_mm(const float, const extruder_t);
#endif
void setAxisMaxFeedrate_mm_s(const feedRate_t, const axis_t);
void setAxisMaxFeedrate_mm_s(const feedRate_t, const extruder_t);
- void setAxisMaxAcceleration_mm_s2(const_float_t, const axis_t);
- void setAxisMaxAcceleration_mm_s2(const_float_t, const extruder_t);
+ void setAxisMaxAcceleration_mm_s2(const float, const axis_t);
+ void setAxisMaxAcceleration_mm_s2(const float, const extruder_t);
void setFeedrate_mm_s(const feedRate_t);
void setMinFeedrate_mm_s(const feedRate_t);
void setMinTravelFeedrate_mm_s(const feedRate_t);
- void setPrintingAcceleration_mm_s2(const_float_t);
- void setRetractAcceleration_mm_s2(const_float_t);
- void setTravelAcceleration_mm_s2(const_float_t);
- void setFeedrate_percent(const_float_t);
+ void setPrintingAcceleration_mm_s2(const float);
+ void setRetractAcceleration_mm_s2(const float);
+ void setTravelAcceleration_mm_s2(const float);
+ void setFeedrate_percent(const float);
void setFlow_percent(const int16_t, const extruder_t);
// Waiting for User Interaction
@@ -328,7 +328,7 @@ namespace ExtUI {
#if ENABLED(LIN_ADVANCE)
// Linear Advance Control
float getLinearAdvance_mm_mm_s(const extruder_t);
- void setLinearAdvance_mm_mm_s(const_float_t, const extruder_t);
+ void setLinearAdvance_mm_mm_s(const float, const extruder_t);
#endif
#if HAS_SHAPING
@@ -341,12 +341,12 @@ namespace ExtUI {
// JD or Jerk Control
#if HAS_JUNCTION_DEVIATION
float getJunctionDeviation_mm();
- void setJunctionDeviation_mm(const_float_t);
+ void setJunctionDeviation_mm(const float);
#else
float getAxisMaxJerk_mm_s(const axis_t);
float getAxisMaxJerk_mm_s(const extruder_t);
- void setAxisMaxJerk_mm_s(const_float_t, const axis_t);
- void setAxisMaxJerk_mm_s(const_float_t, const extruder_t);
+ void setAxisMaxJerk_mm_s(const float, const axis_t);
+ void setAxisMaxJerk_mm_s(const float, const extruder_t);
#endif
// Tool Changing
@@ -356,7 +356,7 @@ namespace ExtUI {
// Babystepping (axis, probe offset)
#if ENABLED(BABYSTEPPING)
- int16_t mmToWholeSteps(const_float_t mm, const axis_t axis);
+ int16_t mmToWholeSteps(const float mm, const axis_t axis);
float mmFromWholeSteps(int16_t steps, const axis_t axis);
bool babystepAxis_steps(const int16_t steps, const axis_t axis);
@@ -366,32 +366,32 @@ namespace ExtUI {
// Hotend Offsets
#if HAS_HOTEND_OFFSET
float getNozzleOffset_mm(const axis_t, const extruder_t);
- void setNozzleOffset_mm(const_float_t, const axis_t, const extruder_t);
+ void setNozzleOffset_mm(const float, const axis_t, const extruder_t);
void normalizeNozzleOffset(const axis_t axis);
#endif
// The Probe Z Offset
float getZOffset_mm();
- void setZOffset_mm(const_float_t);
+ void setZOffset_mm(const float);
// The Probe XYZ Offset
#if HAS_BED_PROBE
float getProbeOffset_mm(const axis_t);
- void setProbeOffset_mm(const_float_t, const axis_t);
+ void setProbeOffset_mm(const float, const axis_t);
probe_limits_t getBedProbeLimits();
#endif
// Backlash Control
#if ENABLED(BACKLASH_GCODE)
float getAxisBacklash_mm(const axis_t);
- void setAxisBacklash_mm(const_float_t, const axis_t);
+ void setAxisBacklash_mm(const float, const axis_t);
float getBacklashCorrection_percent();
- void setBacklashCorrection_percent(const_float_t);
+ void setBacklashCorrection_percent(const float);
#ifdef BACKLASH_SMOOTHING_MM
float getBacklashSmoothing_mm();
- void setBacklashSmoothing_mm(const_float_t);
+ void setBacklashSmoothing_mm(const float);
#endif
#endif
@@ -404,7 +404,7 @@ namespace ExtUI {
#if HAS_FILAMENT_RUNOUT_DISTANCE
float getFilamentRunoutDistance_mm();
- void setFilamentRunoutDistance_mm(const_float_t);
+ void setFilamentRunoutDistance_mm(const float);
#endif
#endif
@@ -415,7 +415,7 @@ namespace ExtUI {
#if DISABLED(CASE_LIGHT_NO_BRIGHTNESS)
float getCaseLightBrightness_percent();
- void setCaseLightBrightness_percent(const_float_t);
+ void setCaseLightBrightness_percent(const float);
#endif
#endif
@@ -430,7 +430,7 @@ namespace ExtUI {
float getPID_Kp(const extruder_t);
float getPID_Ki(const extruder_t);
float getPID_Kd(const extruder_t);
- void setPID(const_float_t, const_float_t, const_float_t, extruder_t);
+ void setPID(const float, const float, const float, extruder_t);
void startPIDTune(const celsius_t, extruder_t);
#endif
@@ -439,7 +439,7 @@ namespace ExtUI {
float getBedPID_Kp();
float getBedPID_Ki();
float getBedPID_Kd();
- void setBedPID(const_float_t, const_float_t, const_float_t);
+ void setBedPID(const float, const float, const float);
void startBedPIDTune(const celsius_t);
#endif
diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp
index 9cfc6498a8..f3517d3116 100644
--- a/Marlin/src/lcd/marlinui.cpp
+++ b/Marlin/src/lcd/marlinui.cpp
@@ -1996,7 +1996,7 @@ uint8_t expand_u8str_P(char * const outstr, PGM_P const ptpl, const int8_t ind,
}
#if ANY(BABYSTEP_GFX_OVERLAY, MESH_EDIT_GFX_OVERLAY)
- void MarlinUI::zoffset_overlay(const_float_t zvalue) {
+ void MarlinUI::zoffset_overlay(const float zvalue) {
// Determine whether the user is raising or lowering the nozzle.
static int8_t dir;
static float old_zvalue;
diff --git a/Marlin/src/lcd/marlinui.h b/Marlin/src/lcd/marlinui.h
index 07797e67fa..85d05887e3 100644
--- a/Marlin/src/lcd/marlinui.h
+++ b/Marlin/src/lcd/marlinui.h
@@ -170,7 +170,7 @@ typedef bool (*statusResetFunc_t)();
static float axis_value(const AxisEnum axis) {
return NATIVE_TO_LOGICAL(processing ? destination[axis] : SUM_TERN(IS_KINEMATIC, current_position[axis], offset), axis);
}
- static bool apply_diff(const AxisEnum axis, const_float_t diff, const_float_t min, const_float_t max) {
+ static bool apply_diff(const AxisEnum axis, const float diff, const float min, const float max) {
#if IS_KINEMATIC
float &valref = offset;
const float rmin = min - current_position[axis], rmax = max - current_position[axis];
@@ -618,7 +618,7 @@ public:
#if ANY(BABYSTEP_GFX_OVERLAY, MESH_EDIT_GFX_OVERLAY)
static void zoffset_overlay(const int8_t dir);
- static void zoffset_overlay(const_float_t zvalue);
+ static void zoffset_overlay(const float zvalue);
#endif
static void draw_kill_screen();
@@ -734,7 +734,7 @@ public:
#endif
#if ENABLED(AUTO_BED_LEVELING_UBL)
- static void ubl_mesh_edit_start(const_float_t initial);
+ static void ubl_mesh_edit_start(const float initial);
static float ubl_mesh_value();
#endif
diff --git a/Marlin/src/lcd/menu/menu.cpp b/Marlin/src/lcd/menu/menu.cpp
index 6e22dfa23e..a9ddd978e7 100644
--- a/Marlin/src/lcd/menu/menu.cpp
+++ b/Marlin/src/lcd/menu/menu.cpp
@@ -295,7 +295,7 @@ void scroll_screen(const uint8_t limit, const bool is_menu) {
#if HAS_LINE_TO_Z
- void line_to_z(const_float_t z) {
+ void line_to_z(const float z) {
current_position.z = z;
line_to_current_position(manual_feedrate_mm_s.z);
}
diff --git a/Marlin/src/lcd/menu/menu.h b/Marlin/src/lcd/menu/menu.h
index 47f5a312eb..73f7a9dcc9 100644
--- a/Marlin/src/lcd/menu/menu.h
+++ b/Marlin/src/lcd/menu/menu.h
@@ -225,7 +225,7 @@ void _lcd_draw_homing();
#define HAS_LINE_TO_Z ANY(DELTA, PROBE_MANUALLY, MESH_BED_LEVELING, LCD_BED_TRAMMING)
#if HAS_LINE_TO_Z
- void line_to_z(const_float_t z);
+ void line_to_z(const float z);
#endif
#if ENABLED(PROBE_OFFSET_WIZARD)
diff --git a/Marlin/src/lcd/menu/menu_advanced.cpp b/Marlin/src/lcd/menu/menu_advanced.cpp
index 5ad33f9c4d..fbd07cc549 100644
--- a/Marlin/src/lcd/menu/menu_advanced.cpp
+++ b/Marlin/src/lcd/menu/menu_advanced.cpp
@@ -183,7 +183,7 @@ void menu_backlash();
auto set_runout_distance = []{ runout.set_runout_distance(editable.decimal); };
EDIT_ITEM_FAST(float3, MSG_RUNOUT_DISTANCE_MM, &editable.decimal, 1, 999, set_runout_distance, true);
#endif
- #if ENABLED(FILAMENT_MOTION_SENSOR)
+ #if ENABLED(FILAMENT_SWITCH_AND_MOTION)
editable.decimal = runout.motion_distance();
auto set_motion_distance = []{ runout.set_motion_distance(editable.decimal); };
EDIT_ITEM_FAST(float31, MSG_MOTION_DISTANCE_MM, &editable.decimal, 0.1, 10, set_motion_distance, true);
diff --git a/Marlin/src/lcd/menu/menu_delta_calibrate.cpp b/Marlin/src/lcd/menu/menu_delta_calibrate.cpp
index 5ffd052e14..5fae531e4a 100644
--- a/Marlin/src/lcd/menu/menu_delta_calibrate.cpp
+++ b/Marlin/src/lcd/menu/menu_delta_calibrate.cpp
@@ -88,7 +88,7 @@ void _man_probe_pt(const xy_pos_t &xy) {
ui.goto_screen(_lcd_calibrate_homing);
}
- void _goto_tower_a(const_float_t a) {
+ void _goto_tower_a(const float a) {
float dcr = PRINTABLE_RADIUS - PROBING_MARGIN;
TERN_(HAS_PROBE_XY_OFFSET, dcr -= HYPOT(probe.offset_xy.x, probe.offset_xy.y));
TERN_(HAS_DELTA_SENSORLESS_PROBING, dcr *= sensorless_radius_factor);
diff --git a/Marlin/src/lcd/menu/menu_motion.cpp b/Marlin/src/lcd/menu/menu_motion.cpp
index 956b58c633..7ae01a79d7 100644
--- a/Marlin/src/lcd/menu/menu_motion.cpp
+++ b/Marlin/src/lcd/menu/menu_motion.cpp
@@ -114,7 +114,7 @@ void lcd_move_axis(const AxisEnum axis) {
#if ANY(PROBE_OFFSET_WIZARD, X_AXIS_TWIST_COMPENSATION)
- void _goto_manual_move_z(const_float_t scale) {
+ void _goto_manual_move_z(const float scale) {
ui.manual_move.menu_scale = scale;
ui.goto_screen([]{ lcd_move_axis(Z_AXIS); });
}
@@ -129,7 +129,7 @@ void lcd_move_axis(const AxisEnum axis) {
#define FINE_MANUAL_MOVE 0.025
#endif
-void _goto_manual_move(const_float_t scale) {
+void _goto_manual_move(const float scale) {
ui.defer_status_screen();
ui.manual_move.menu_scale = scale;
ui.goto_screen(ui.manual_move.screen_ptr);
@@ -312,7 +312,7 @@ void menu_move() {
#include "../../module/ft_motion.h"
- FSTR_P get_shaper_name(const AxisEnum axis=X_AXIS) {
+ FSTR_P get_shaper_name(const AxisEnum axis) {
switch (ftMotion.cfg.shaper[axis]) {
default: return nullptr;
case ftMotionShaper_NONE: return GET_TEXT_F(MSG_LCD_OFF);
@@ -457,20 +457,20 @@ void menu_move() {
#if HAS_X_AXIS
SUBMENU_N_S(X_AXIS, _shaper_name(X_AXIS), MSG_FTM_CMPN_MODE, menu_ftm_shaper_x);
- if (AXIS_HAS_SHAPER(X)) {
+ if (AXIS_IS_SHAPING(X)) {
EDIT_ITEM_FAST_N(float42_52, X_AXIS, MSG_FTM_BASE_FREQ_N, &c.baseFreq.x, FTM_MIN_SHAPE_FREQ, (FTM_FS) / 2, ftMotion.update_shaping_params);
EDIT_ITEM_FAST_N(float42_52, X_AXIS, MSG_FTM_ZETA_N, &c.zeta.x, 0.0f, 1.0f, ftMotion.update_shaping_params);
- if (AXIS_HAS_EISHAPER(X))
+ if (AXIS_IS_EISHAPING(X))
EDIT_ITEM_FAST_N(float42_52, X_AXIS, MSG_FTM_VTOL_N, &c.vtol.x, 0.0f, 1.0f, ftMotion.update_shaping_params);
}
#endif
#if HAS_Y_AXIS
SUBMENU_N_S(Y_AXIS, _shaper_name(Y_AXIS), MSG_FTM_CMPN_MODE, menu_ftm_shaper_y);
- if (AXIS_HAS_SHAPER(Y)) {
+ if (AXIS_IS_SHAPING(Y)) {
EDIT_ITEM_FAST_N(float42_52, Y_AXIS, MSG_FTM_BASE_FREQ_N, &c.baseFreq.y, FTM_MIN_SHAPE_FREQ, (FTM_FS) / 2, ftMotion.update_shaping_params);
EDIT_ITEM_FAST_N(float42_52, Y_AXIS, MSG_FTM_ZETA_N, &c.zeta.y, 0.0f, 1.0f, ftMotion.update_shaping_params);
- if (AXIS_HAS_EISHAPER(Y))
+ if (AXIS_IS_EISHAPING(Y))
EDIT_ITEM_FAST_N(float42_52, Y_AXIS, MSG_FTM_VTOL_N, &c.vtol.y, 0.0f, 1.0f, ftMotion.update_shaping_params);
}
#endif
@@ -490,7 +490,7 @@ void menu_move() {
#if HAS_EXTRUDERS
EDIT_ITEM(bool, MSG_LINEAR_ADVANCE, &c.linearAdvEna);
if (c.linearAdvEna || ENABLED(FT_MOTION_NO_MENU_TOGGLE))
- EDIT_ITEM(float62, MSG_ADVANCE_K, &c.linearAdvK, 0.0f, 1000.0f);
+ EDIT_ITEM(float42_52, MSG_ADVANCE_K, &c.linearAdvK, 0.0f, 10.0f);
#endif
}
END_MENU();
@@ -547,7 +547,7 @@ void menu_move() {
#if HAS_EXTRUDERS
EDIT_ITEM(bool, MSG_LINEAR_ADVANCE, &c.linearAdvEna);
if (c.linearAdvEna || ENABLED(FT_MOTION_NO_MENU_TOGGLE))
- EDIT_ITEM(float62, MSG_ADVANCE_K, &c.linearAdvK, 0.0f, 1000.0f);
+ EDIT_ITEM(float42_52, MSG_ADVANCE_K, &c.linearAdvK, 0.0f, 10.0f);
#endif
END_MENU();
diff --git a/Marlin/src/lcd/menu/menu_probe_offset.cpp b/Marlin/src/lcd/menu/menu_probe_offset.cpp
index a0b7c2bed4..e959c687ed 100644
--- a/Marlin/src/lcd/menu/menu_probe_offset.cpp
+++ b/Marlin/src/lcd/menu/menu_probe_offset.cpp
@@ -39,13 +39,13 @@
#include "../../feature/bedlevel/bedlevel.h"
#endif
-void _goto_manual_move_z(const_float_t);
+void _goto_manual_move_z(const float);
// Global storage - TODO: Keep wizard/process data in a 'ui.scratch' union.
float z_offset_backup, calculated_z_offset, z_offset_ref;
// "Done" - Set the offset, re-enable leveling, go back to the previous screen.
-void set_offset_and_go_back(const_float_t z) {
+void set_offset_and_go_back(const float z) {
probe.offset.z = z;
SET_SOFT_ENDSTOP_LOOSE(false);
TERN_(HAS_LEVELING, set_bed_leveling_enabled(menu_leveling_was_active));
diff --git a/Marlin/src/lcd/menu/menu_ubl.cpp b/Marlin/src/lcd/menu/menu_ubl.cpp
index 63ad34a70b..3b14950ee0 100644
--- a/Marlin/src/lcd/menu/menu_ubl.cpp
+++ b/Marlin/src/lcd/menu/menu_ubl.cpp
@@ -95,7 +95,7 @@ void _lcd_mesh_fine_tune(FSTR_P const fmsg) {
// Init mesh editing and go to the fine tuning screen (bedlevel.fine_tune_mesh)
// To capture encoder events UBL will also call ui.capture and ui.release.
//
-void MarlinUI::ubl_mesh_edit_start(const_float_t initial) {
+void MarlinUI::ubl_mesh_edit_start(const float initial) {
TERN_(HAS_GRAPHICAL_TFT, clear_for_drawing());
mesh_edit_accumulator = initial;
goto_screen([]{ _lcd_mesh_fine_tune(GET_TEXT_F(MSG_MESH_EDIT_Z)); });
diff --git a/Marlin/src/lcd/menu/menu_x_twist.cpp b/Marlin/src/lcd/menu/menu_x_twist.cpp
index a9998e3e44..d6d55965ec 100644
--- a/Marlin/src/lcd/menu/menu_x_twist.cpp
+++ b/Marlin/src/lcd/menu/menu_x_twist.cpp
@@ -41,7 +41,7 @@
#include "../tft/touch.h"
#endif
-void _goto_manual_move_z(const_float_t);
+void _goto_manual_move_z(const float);
float measured_z, z_offset;
@@ -159,7 +159,7 @@ void xatc_wizard_goto_next_point() {
z_offset /= XATC_MAX_POINTS;
// Subtract the average from the values found with this wizard.
- // This way they are indipendent from the z-offset
+ // This way they are independent from the z-offset
for (uint8_t i = 0; i < XATC_MAX_POINTS; ++i) xatc.z_offset[i] -= z_offset;
ui.goto_screen(xatc_wizard_update_z_offset);
diff --git a/Marlin/src/lcd/sovol_rts/sovol_rts.h b/Marlin/src/lcd/sovol_rts/sovol_rts.h
index 8713223118..15642e06c9 100644
--- a/Marlin/src/lcd/sovol_rts/sovol_rts.h
+++ b/Marlin/src/lcd/sovol_rts/sovol_rts.h
@@ -283,7 +283,7 @@ class RTS {
static void sendData(const uint8_t str[], const uint32_t addr, const uint8_t cmd=VarAddr_W) { sendData((char *)str, addr, cmd); }
static void sendData(const uint16_t n, const uint32_t addr, const uint8_t cmd=VarAddr_W) { sendData(int16_t(n), addr, cmd); }
- static void sendData(const_float_t n, const uint32_t addr, const uint8_t cmd=VarAddr_W) { sendData(int16_t(n), addr, cmd); } //was originally int16 ?
+ static void sendData(const float n, const uint32_t addr, const uint8_t cmd=VarAddr_W) { sendData(int16_t(n), addr, cmd); } //was originally int16 ?
static void sendData(const int32_t n, const uint32_t addr, const uint8_t cmd=VarAddr_W) { sendData(uint32_t(n), addr, cmd); }
static void sendData(const int n, const uint32_t addr, const uint8_t cmd=VarAddr_W) { sendData(int16_t(n), addr, cmd); }
diff --git a/Marlin/src/lcd/tft/canvas.cpp b/Marlin/src/lcd/tft/canvas.cpp
index 2486179ce3..d10ca626ec 100644
--- a/Marlin/src/lcd/tft/canvas.cpp
+++ b/Marlin/src/lcd/tft/canvas.cpp
@@ -162,7 +162,7 @@ void Canvas::addImage(int16_t x, int16_t y, MarlinImage image, uint16_t *colors)
rle_state.dsty = dsty;
rle_state.srcx = srcx;
rle_state.srcy = srcy;
- rle_state.rle_offset = bytedata - (uint8_t *)images[image].data;; // Keep these for skipping full RLE decode on future iteratons
+ rle_state.rle_offset = bytedata - (uint8_t *)images[image].data;; // Keep these for skipping full RLE decode on future iterations
}
uint8_t count = *bytedata++; // Get the count byte
diff --git a/Marlin/src/lcd/tft/tft_string.cpp b/Marlin/src/lcd/tft/tft_string.cpp
index edf326cb97..d390ad64f3 100644
--- a/Marlin/src/lcd/tft/tft_string.cpp
+++ b/Marlin/src/lcd/tft/tft_string.cpp
@@ -122,7 +122,7 @@ void TFT_String::add_glyphs(const uint8_t *font) {
}
glyph_t *TFT_String::glyph(uint16_t character) {
- if (character == 0x2026) character = 0x0a; /* character 0x2026 "…" is remaped to 0x0a and should be part of symbols font */
+ if (character == 0x2026) character = 0x0a; /* character 0x2026 "…" is remapped to 0x0a and should be part of symbols font */
if (character < 0x00ff) return glyphs[character] ?: glyphs['?']; /* Use '?' for unknown glyphs */
#if EXTRA_GLYPHS
diff --git a/Marlin/src/libs/MAX31865.cpp b/Marlin/src/libs/MAX31865.cpp
index 83b03e24fd..d4f127f055 100644
--- a/Marlin/src/libs/MAX31865.cpp
+++ b/Marlin/src/libs/MAX31865.cpp
@@ -138,7 +138,7 @@ SPISettings MAX31865::spiConfig = SPISettings(
* @param ref_res The resistance of the reference resistor, in ohms.
* @param wire_res The resistance of the wire connecting the sensor to the RTD, in ohms.
*/
-void MAX31865::begin(max31865_numwires_t wires, const_float_t zero_res, const_float_t ref_res, const_float_t wire_res) {
+void MAX31865::begin(max31865_numwires_t wires, const float zero_res, const float ref_res, const float wire_res) {
resNormalizer = 100.0f / zero_res; // reciprocal of resistance, scaled by 100
refRes = ref_res;
wireRes = wire_res;
diff --git a/Marlin/src/libs/MAX31865.h b/Marlin/src/libs/MAX31865.h
index 3e9b0c139f..8094341d70 100644
--- a/Marlin/src/libs/MAX31865.h
+++ b/Marlin/src/libs/MAX31865.h
@@ -153,7 +153,7 @@ public:
int8_t spi_clk);
#endif
- void begin(max31865_numwires_t wires, const_float_t zero_res, const_float_t ref_res, const_float_t wire_res);
+ void begin(max31865_numwires_t wires, const float zero_res, const float ref_res, const float wire_res);
uint8_t readFault();
void clearFault();
diff --git a/Marlin/src/libs/least_squares_fit.h b/Marlin/src/libs/least_squares_fit.h
index 374a1f5ada..86a4972ad8 100644
--- a/Marlin/src/libs/least_squares_fit.h
+++ b/Marlin/src/libs/least_squares_fit.h
@@ -47,7 +47,7 @@ inline void incremental_LSF_reset(struct linear_fit_data *lsf) {
memset(lsf, 0, sizeof(linear_fit_data));
}
-inline void incremental_WLSF(struct linear_fit_data *lsf, const_float_t x, const_float_t y, const_float_t z, const_float_t w) {
+inline void incremental_WLSF(struct linear_fit_data *lsf, const float x, const float y, const float z, const float w) {
// weight each accumulator by factor w, including the "number" of samples
// (analogous to calling inc_LSF twice with same values to weight it by 2X)
const float wx = w * x, wy = w * y, wz = w * z;
@@ -63,11 +63,11 @@ inline void incremental_WLSF(struct linear_fit_data *lsf, const_float_t x, const
lsf->max_absx = _MAX(ABS(wx), lsf->max_absx);
lsf->max_absy = _MAX(ABS(wy), lsf->max_absy);
}
-inline void incremental_WLSF(struct linear_fit_data *lsf, const xy_pos_t &pos, const_float_t z, const_float_t w) {
+inline void incremental_WLSF(struct linear_fit_data *lsf, const xy_pos_t &pos, const float z, const float w) {
incremental_WLSF(lsf, pos.x, pos.y, z, w);
}
-inline void incremental_LSF(struct linear_fit_data *lsf, const_float_t x, const_float_t y, const_float_t z) {
+inline void incremental_LSF(struct linear_fit_data *lsf, const float x, const float y, const float z) {
lsf->xbar += x;
lsf->ybar += y;
lsf->zbar += z;
@@ -80,7 +80,7 @@ inline void incremental_LSF(struct linear_fit_data *lsf, const_float_t x, const_
lsf->max_absy = _MAX(ABS(y), lsf->max_absy);
lsf->N += 1.0;
}
-inline void incremental_LSF(struct linear_fit_data *lsf, const xy_pos_t &pos, const_float_t z) {
+inline void incremental_LSF(struct linear_fit_data *lsf, const xy_pos_t &pos, const float z) {
incremental_LSF(lsf, pos.x, pos.y, z);
}
diff --git a/Marlin/src/libs/nozzle.cpp b/Marlin/src/libs/nozzle.cpp
index fb9bc6dd4d..0f92bac812 100644
--- a/Marlin/src/libs/nozzle.cpp
+++ b/Marlin/src/libs/nozzle.cpp
@@ -133,7 +133,7 @@ Nozzle nozzle;
* @param strokes number of strokes to execute
* @param radius radius of circle
*/
- void Nozzle::circle(const xyz_pos_t &start, const xyz_pos_t &middle, const uint8_t strokes, const_float_t radius) {
+ void Nozzle::circle(const xyz_pos_t &start, const xyz_pos_t &middle, const uint8_t strokes, const float radius) {
if (strokes == 0) return;
#if ENABLED(NOZZLE_CLEAN_GOBACK)
@@ -162,7 +162,7 @@ Nozzle nozzle;
* @param pattern one of the available patterns
* @param argument depends on the cleaning pattern
*/
- void Nozzle::clean(const uint8_t pattern, const uint8_t strokes, const_float_t radius, const uint8_t objects, const uint8_t cleans) {
+ void Nozzle::clean(const uint8_t pattern, const uint8_t strokes, const float radius, const uint8_t objects, const uint8_t cleans) {
xyz_pos_t start[HOTENDS] = NOZZLE_CLEAN_START_POINT, end[HOTENDS] = NOZZLE_CLEAN_END_POINT;
#if ENABLED(NOZZLE_CLEAN_PATTERN_CIRCLE)
xyz_pos_t middle[HOTENDS] = NOZZLE_CLEAN_CIRCLE_MIDDLE;
@@ -246,7 +246,7 @@ Nozzle nozzle;
#if ENABLED(NOZZLE_PARK_FEATURE)
#if HAS_Z_AXIS
- float Nozzle::park_mode_0_height(const_float_t park_z) {
+ float Nozzle::park_mode_0_height(const float park_z) {
// Apply a minimum raise, if specified. Use park.z as a minimum height instead.
return _MAX(park_z, // Minimum height over 0 based on input
_MIN(Z_MAX_POS, // Maximum height is fixed
diff --git a/Marlin/src/libs/nozzle.h b/Marlin/src/libs/nozzle.h
index fb47c867f2..c2d595f053 100644
--- a/Marlin/src/libs/nozzle.h
+++ b/Marlin/src/libs/nozzle.h
@@ -62,7 +62,7 @@ class Nozzle {
* @param strokes number of strokes to execute
* @param radius radius of circle
*/
- static void circle(const xyz_pos_t &start, const xyz_pos_t &middle, const uint8_t strokes, const_float_t radius) __Os;
+ static void circle(const xyz_pos_t &start, const xyz_pos_t &middle, const uint8_t strokes, const float radius) __Os;
#endif // NOZZLE_CLEAN_FEATURE
@@ -77,13 +77,13 @@ class Nozzle {
* @param pattern one of the available patterns
* @param argument depends on the cleaning pattern
*/
- static void clean(const uint8_t pattern, const uint8_t strokes, const_float_t radius, const uint8_t objects, const uint8_t cleans) __Os;
+ static void clean(const uint8_t pattern, const uint8_t strokes, const float radius, const uint8_t objects, const uint8_t cleans) __Os;
#endif // NOZZLE_CLEAN_FEATURE
#if ENABLED(NOZZLE_PARK_FEATURE)
- static float park_mode_0_height(const_float_t park_z) __Os;
+ static float park_mode_0_height(const float park_z) __Os;
static void park(const uint8_t z_action, const xyz_pos_t &park=NOZZLE_PARK_POINT) __Os;
#endif
diff --git a/Marlin/src/libs/numtostr.cpp b/Marlin/src/libs/numtostr.cpp
index 830e9b356b..ec097f203f 100644
--- a/Marlin/src/libs/numtostr.cpp
+++ b/Marlin/src/libs/numtostr.cpp
@@ -181,7 +181,7 @@ const char* i16tostr4signrj(const int16_t i) {
}
// Convert unsigned float to string with 1.1 format
-const char* ftostr11ns(const_float_t f) {
+const char* ftostr11ns(const float f) {
const long i = UINTFLOAT(f, 1);
conv[5] = DIGIMOD(i, 10);
conv[6] = '.';
@@ -190,7 +190,7 @@ const char* ftostr11ns(const_float_t f) {
}
// Convert unsigned float to string with 1.23 format
-const char* ftostr12ns(const_float_t f) {
+const char* ftostr12ns(const float f) {
const long i = UINTFLOAT(f, 2);
conv[4] = DIGIMOD(i, 100);
conv[5] = '.';
@@ -200,7 +200,7 @@ const char* ftostr12ns(const_float_t f) {
}
// Convert unsigned float to string with 12.3 format
-const char* ftostr31ns(const_float_t f) {
+const char* ftostr31ns(const float f) {
const long i = UINTFLOAT(f, 1);
conv[4] = DIGIMOD(i, 100);
conv[5] = DIGIMOD(i, 10);
@@ -210,7 +210,7 @@ const char* ftostr31ns(const_float_t f) {
}
// Convert unsigned float to string with 123.4 format
-const char* ftostr41ns(const_float_t f) {
+const char* ftostr41ns(const float f) {
const long i = UINTFLOAT(f, 1);
conv[3] = DIGIMOD(i, 1000);
conv[4] = DIGIMOD(i, 100);
@@ -221,7 +221,7 @@ const char* ftostr41ns(const_float_t f) {
}
// Convert float to fixed-length string with 12.34 / _2.34 / -2.34 or -23.45 / 123.45 format
-const char* ftostr42_52(const_float_t f) {
+const char* ftostr42_52(const float f) {
if (f <= -10 || f >= 100) return ftostr52(f); // -23.45 / 123.45
long i = INTFLOAT(f, 2);
conv[3] = (f >= 0 && f < 10) ? ' ' : MINUSOR(i, DIGIMOD(i, 1000));
@@ -233,7 +233,7 @@ const char* ftostr42_52(const_float_t f) {
}
// Convert float to fixed-length string with 023.45 / -23.45 format
-const char* ftostr52(const_float_t f) {
+const char* ftostr52(const float f) {
long i = INTFLOAT(f, 2);
conv[2] = MINUSOR(i, DIGIMOD(i, 10000));
conv[3] = DIGIMOD(i, 1000);
@@ -245,7 +245,7 @@ const char* ftostr52(const_float_t f) {
}
// Convert float to fixed-length string with 12.345 / _2.345 / -2.345 or -23.45 / 123.45 format
-const char* ftostr53_63(const_float_t f) {
+const char* ftostr53_63(const float f) {
if (f <= -10 || f >= 100) return ftostr63(f); // -23.456 / 123.456
long i = INTFLOAT(f, 3);
conv[2] = (f >= 0 && f < 10) ? ' ' : MINUSOR(i, DIGIMOD(i, 10000));
@@ -258,7 +258,7 @@ const char* ftostr53_63(const_float_t f) {
}
// Convert float to fixed-length string with 023.456 / -23.456 format
-const char* ftostr63(const_float_t f) {
+const char* ftostr63(const float f) {
long i = INTFLOAT(f, 3);
conv[1] = MINUSOR(i, DIGIMOD(i, 100000));
conv[2] = DIGIMOD(i, 10000);
@@ -273,7 +273,7 @@ const char* ftostr63(const_float_t f) {
#if ENABLED(LCD_DECIMAL_SMALL_XY)
// Convert float to rj string with 1234, _123, -123, _-12, 12.3, _1.2, or -1.2 format
- const char* ftostr4sign(const_float_t f) {
+ const char* ftostr4sign(const float f) {
const int i = INTFLOAT(f, 1);
if (!WITHIN(i, -99, 999)) return i16tostr4signrj((int)f);
const bool neg = i < 0;
@@ -290,7 +290,7 @@ const char* ftostr63(const_float_t f) {
//
// Convert float to fixed-length string with +/- and a single decimal place
//
-inline const char* ftostrX1sign(const_float_t f, const int index) {
+inline const char* ftostrX1sign(const float f, const int index) {
long i = INTFLOAT(f, 1);
conv[index] = MINUSOR(i, '+');
switch (index + 1) {
@@ -306,18 +306,18 @@ inline const char* ftostrX1sign(const_float_t f, const int index) {
}
// Convert float to fixed-length string with +12.3 / -12.3 format
-const char* ftostr31sign(const_float_t f) { return ftostrX1sign(f, 3); }
+const char* ftostr31sign(const float f) { return ftostrX1sign(f, 3); }
// Convert float to fixed-length string with +123.4 / -123.4 format
-const char* ftostr41sign(const_float_t f) { return ftostrX1sign(f, 2); }
+const char* ftostr41sign(const float f) { return ftostrX1sign(f, 2); }
// Convert float to fixed-length string with +1234.5 / +1234.5 format
-const char* ftostr51sign(const_float_t f) { return ftostrX1sign(f, 1); }
+const char* ftostr51sign(const float f) { return ftostrX1sign(f, 1); }
//
// Convert float to string with +/ /- and 3 decimal places
//
-inline const char* ftostrX3sign(const_float_t f, const int index, char plus/*=' '*/) {
+inline const char* ftostrX3sign(const float f, const int index, char plus/*=' '*/) {
long i = INTFLOAT(f, 3);
conv[index] = i ? MINUSOR(i, plus) : ' ';
switch (index + 1) {
@@ -333,13 +333,13 @@ inline const char* ftostrX3sign(const_float_t f, const int index, char plus/*='
}
// Convert float to string (6 chars) with -1.234 / _0.000 / +1.234 format
-const char* ftostr43sign(const_float_t f, char plus/*=' '*/) { return ftostrX3sign(f, 2, plus); }
+const char* ftostr43sign(const float f, char plus/*=' '*/) { return ftostrX3sign(f, 2, plus); }
// Convert float to string (7 chars) with -12.345 / _00.000 / +12.345 format
-const char* ftostr53sign(const_float_t f, char plus/*=' '*/) { return ftostrX3sign(f, 1, plus); }
+const char* ftostr53sign(const float f, char plus/*=' '*/) { return ftostrX3sign(f, 1, plus); }
// Convert float to string (7 chars) with -1.2345 / _0.0000 / +1.2345 format
-const char* ftostr54sign(const_float_t f, char plus/*=' '*/) {
+const char* ftostr54sign(const float f, char plus/*=' '*/) {
long i = INTFLOAT(f, 4);
conv[1] = i ? MINUSOR(i, plus) : ' ';
conv[2] = DIGIMOD(i, 10000);
@@ -352,13 +352,13 @@ const char* ftostr54sign(const_float_t f, char plus/*=' '*/) {
}
// Convert unsigned float to rj string with 12345 format
-const char* ftostr5rj(const_float_t f) {
+const char* ftostr5rj(const float f) {
const long i = UINTFLOAT(f, 0);
return ui16tostr5rj(i);
}
// Convert signed float to string with +123.45 format
-const char* ftostr52sign(const_float_t f) {
+const char* ftostr52sign(const float f) {
long i = INTFLOAT(f, 2);
conv[1] = MINUSOR(i, '+');
conv[2] = DIGIMOD(i, 10000);
@@ -371,7 +371,7 @@ const char* ftostr52sign(const_float_t f) {
}
// Convert unsigned float to string with a single digit precision
-inline const char* ftostrX1rj(const_float_t f, const int index=1) {
+inline const char* ftostrX1rj(const float f, const int index=1) {
const long i = UINTFLOAT(f, 1);
switch (index) {
case 0: conv[0] = RJDIGIT(i, 1000000);
@@ -387,19 +387,19 @@ inline const char* ftostrX1rj(const_float_t f, const int index=1) {
}
// Convert unsigned float to string with _2.3 / 12.3 format
-const char* ftostr31rj(const_float_t f) { return ftostrX1rj(f, 7 - 3); }
+const char* ftostr31rj(const float f) { return ftostrX1rj(f, 7 - 3); }
// Convert unsigned float to string with __3.4 / _23.4 / 123.4 format
-const char* ftostr41rj(const_float_t f) { return ftostrX1rj(f, 7 - 4); }
+const char* ftostr41rj(const float f) { return ftostrX1rj(f, 7 - 4); }
// Convert unsigned float to string with ___4.5 / __34.5 / _234.5 / 1234.5 format
-const char* ftostr51rj(const_float_t f) { return ftostrX1rj(f, 7 - 5); }
+const char* ftostr51rj(const float f) { return ftostrX1rj(f, 7 - 5); }
// Convert unsigned float to string with ____5.6 / ___45.6 / __345.6 / _2345.6 / 12345.6 format
-const char* ftostr61rj(const_float_t f) { return ftostrX1rj(f, 7 - 6); }
+const char* ftostr61rj(const float f) { return ftostrX1rj(f, 7 - 6); }
// Convert unsigned float to string with two digit precision
-inline const char* ftostrX2rj(const_float_t f, const int index=1) {
+inline const char* ftostrX2rj(const float f, const int index=1) {
const long i = UINTFLOAT(f, 2);
switch (index) {
case 0: conv[0] = RJDIGIT(i, 1000000);
@@ -415,22 +415,22 @@ inline const char* ftostrX2rj(const_float_t f, const int index=1) {
}
// Convert unsigned float to string with 1.23 format
-const char* ftostr32rj(const_float_t f) { return ftostrX2rj(f, 4); }
+const char* ftostr32rj(const float f) { return ftostrX2rj(f, 4); }
// Convert unsigned float to string with _2.34, 12.34 format
-const char* ftostr42rj(const_float_t f) { return ftostrX2rj(f, 3); }
+const char* ftostr42rj(const float f) { return ftostrX2rj(f, 3); }
// Convert unsigned float to string with __3.45, _23.45, 123.45 format
-const char* ftostr52rj(const_float_t f) { return ftostrX2rj(f, 2); }
+const char* ftostr52rj(const float f) { return ftostrX2rj(f, 2); }
// Convert unsigned float to string with ___4.56, __34.56, _234.56, 1234.56 format
-const char* ftostr62rj(const_float_t f) { return ftostrX2rj(f, 1); }
+const char* ftostr62rj(const float f) { return ftostrX2rj(f, 1); }
// Convert unsigned float to string with ____5.67, ___45.67, __345.67, _2345.67, 12345.67 format
-const char* ftostr72rj(const_float_t f) { return ftostrX2rj(f, 0); }
+const char* ftostr72rj(const float f) { return ftostrX2rj(f, 0); }
// Convert float to space-padded string with -_23.4_ format
-const char* ftostr52sp(const_float_t f) {
+const char* ftostr52sp(const float f) {
long i = INTFLOAT(f, 2);
uint8_t dig;
conv[1] = MINUSOR(i, ' ');
@@ -461,7 +461,7 @@ const char* utostr3(const uint16_t x) {
}
// Convert float to space-padded string with 1.23, 12.34, 123.45 format
-const char* ftostr52sprj(const_float_t f) {
+const char* ftostr52sprj(const float f) {
long i = INTFLOAT(f, 2);
LIMIT(i, -99999, 99999); // cap to -999.99 - 999.99 range
if (WITHIN(i, -999, 999)) { // -9.99 - 9.99 range
diff --git a/Marlin/src/libs/numtostr.h b/Marlin/src/libs/numtostr.h
index fde07e8368..16f1f72d95 100644
--- a/Marlin/src/libs/numtostr.h
+++ b/Marlin/src/libs/numtostr.h
@@ -63,105 +63,105 @@ const char* i16tostr3left(const int16_t xx);
const char* i16tostr4signrj(const int16_t x);
// Convert unsigned float to string with 1.2 format
-const char* ftostr11ns(const_float_t x);
+const char* ftostr11ns(const float x);
// Convert unsigned float to string with 1.23 format
-const char* ftostr12ns(const_float_t x);
+const char* ftostr12ns(const float x);
// Convert unsigned float to string with 12.3 format
-const char* ftostr31ns(const_float_t x);
+const char* ftostr31ns(const float x);
// Convert unsigned float to string with 123.4 format
-const char* ftostr41ns(const_float_t x);
+const char* ftostr41ns(const float x);
// Convert signed float to fixed-length string with 12.34 / _2.34 / -2.34 or -23.45 / 123.45 format
-const char* ftostr42_52(const_float_t x);
+const char* ftostr42_52(const float x);
// Convert signed float to fixed-length string with 023.45 / -23.45 format
-const char* ftostr52(const_float_t x);
+const char* ftostr52(const float x);
// Convert signed float to fixed-length string with 12.345 / -2.345 or 023.456 / -23.456 format
-const char* ftostr53_63(const_float_t x);
+const char* ftostr53_63(const float x);
// Convert signed float to fixed-length string with 023.456 / -23.456 format
-const char* ftostr63(const_float_t x);
+const char* ftostr63(const float x);
// Convert signed float to fixed-length string with +12.3 / -12.3 format
-const char* ftostr31sign(const_float_t x);
+const char* ftostr31sign(const float x);
// Convert signed float to fixed-length string with +123.4 / -123.4 format
-const char* ftostr41sign(const_float_t x);
+const char* ftostr41sign(const float x);
// Convert signed float to fixed-length string with +1234.5 / +1234.5 format
-const char* ftostr51sign(const_float_t x);
+const char* ftostr51sign(const float x);
// Convert signed float to string (6 digit) with -1.234 / _0.000 / +1.234 format
-const char* ftostr43sign(const_float_t x, char plus=' ');
+const char* ftostr43sign(const float x, char plus=' ');
// Convert signed float to string (7 chars) with -12.345 / _00.000 / +12.345 format
-const char* ftostr53sign(const_float_t x, char plus=' ');
+const char* ftostr53sign(const float x, char plus=' ');
// Convert signed float to string (5 digit) with -1.2345 / _0.0000 / +1.2345 format
-const char* ftostr54sign(const_float_t x, char plus=' ');
+const char* ftostr54sign(const float x, char plus=' ');
// Convert unsigned float to rj string with 12345 format
-const char* ftostr5rj(const_float_t x);
+const char* ftostr5rj(const float x);
// Convert signed float to fixed-length string with +12.3 / -12.3 format
-const char* ftostr31sign(const_float_t x);
+const char* ftostr31sign(const float x);
// Convert signed float to fixed-length string with +123.4 / -123.4 format
-const char* ftostr41sign(const_float_t x);
+const char* ftostr41sign(const float x);
// Convert signed float to fixed-length string with +1234.5 format
-const char* ftostr51sign(const_float_t x);
+const char* ftostr51sign(const float x);
// Convert signed float to space-padded string with -_23.4_ format
-const char* ftostr52sp(const_float_t x);
+const char* ftostr52sp(const float x);
// Convert signed float to string with +123.45 format
-const char* ftostr52sign(const_float_t x);
+const char* ftostr52sign(const float x);
// Convert unsigned float to string with _2.3 / 12.3 format
-const char* ftostr31rj(const_float_t x);
+const char* ftostr31rj(const float x);
// Convert unsigned float to string with __3.4 / _23.4 / 123.4 format
-const char* ftostr41rj(const_float_t x);
+const char* ftostr41rj(const float x);
// Convert unsigned float to string with ___4.5 / __34.5 / _234.5 / 1234.5 format
-const char* ftostr51rj(const_float_t x);
+const char* ftostr51rj(const float x);
// Convert unsigned float to string with ____5.6 / ___45.6 / __345.6 / _2345.6 / 12345.6 format
-const char* ftostr61rj(const_float_t x);
+const char* ftostr61rj(const float x);
// Convert unsigned float to string with 1.23 format
-const char* ftostr32rj(const_float_t f);
+const char* ftostr32rj(const float f);
// Convert unsigned float to string with _2.34, 12.34 format
-const char* ftostr42rj(const_float_t f);
+const char* ftostr42rj(const float f);
// Convert unsigned float to string with __3.45, _23.45, 123.45 format
-const char* ftostr52rj(const_float_t f);
+const char* ftostr52rj(const float f);
// Convert unsigned float to string with ___4.56, __34.56, _234.56, 1234.56 format
-const char* ftostr62rj(const_float_t f);
+const char* ftostr62rj(const float f);
// Convert unsigned float to string with ____5.67, ___45.67, __345.67, _2345.67, 12345.67 format
-const char* ftostr72rj(const_float_t x);
+const char* ftostr72rj(const float x);
// Convert signed float to rj string with 123 or -12 format
-FORCE_INLINE const char* ftostr3rj(const_float_t x) { return i16tostr3rj(int16_t(x + (x < 0 ? -0.5f : 0.5f))); }
+FORCE_INLINE const char* ftostr3rj(const float x) { return i16tostr3rj(int16_t(x + (x < 0 ? -0.5f : 0.5f))); }
#if ENABLED(LCD_DECIMAL_SMALL_XY)
// Convert signed float to rj string with 1234, _123, 12.3, _1.2, -123, _-12, or -1.2 format
- const char* ftostr4sign(const_float_t fx);
+ const char* ftostr4sign(const float fx);
#else
// Convert signed float to rj string with 1234, _123, -123, __12, _-12, ___1, or __-1 format
- FORCE_INLINE const char* ftostr4sign(const_float_t x) { return i16tostr4signrj(int16_t(x + (x < 0 ? -0.5f : 0.5f))); }
+ FORCE_INLINE const char* ftostr4sign(const float x) { return i16tostr4signrj(int16_t(x + (x < 0 ? -0.5f : 0.5f))); }
#endif
// Convert unsigned int to string 1, 12, 123 format, capped at 999
const char* utostr3(const uint16_t x);
// Convert signed float to space-padded string with 1.23, 12.34, 123.45 format
-const char* ftostr52sprj(const_float_t f);
+const char* ftostr52sprj(const float f);
diff --git a/Marlin/src/libs/vector_3.h b/Marlin/src/libs/vector_3.h
index ab719c6a7f..9076cd58ab 100644
--- a/Marlin/src/libs/vector_3.h
+++ b/Marlin/src/libs/vector_3.h
@@ -49,7 +49,7 @@ struct vector_3 {
struct { float x, y, z; };
float pos[3];
};
- vector_3(const_float_t _x, const_float_t _y, const_float_t _z) : x(_x), y(_y), z(_z) {}
+ vector_3(const float _x, const float _y, const float _z) : x(_x), y(_y), z(_z) {}
vector_3(const xy_float_t &in) { TERN_(HAS_X_AXIS, x = in.x); TERN_(HAS_Y_AXIS, y = in.y); }
vector_3(const xyz_float_t &in) { TERN_(HAS_X_AXIS, x = in.x); TERN_(HAS_Y_AXIS, y = in.y); TERN_(HAS_Z_AXIS, z = in.z); }
vector_3(const xyze_float_t &in) { TERN_(HAS_X_AXIS, x = in.x); TERN_(HAS_Y_AXIS, y = in.y); TERN_(HAS_Z_AXIS, z = in.z); }
diff --git a/Marlin/src/module/delta.cpp b/Marlin/src/module/delta.cpp
index aa1bcebe70..2f0415babc 100644
--- a/Marlin/src/module/delta.cpp
+++ b/Marlin/src/module/delta.cpp
@@ -162,7 +162,7 @@ float delta_safe_distance_from_top() {
*
* The result is stored in the cartes[] array.
*/
-void forward_kinematics(const_float_t z1, const_float_t z2, const_float_t z3) {
+void forward_kinematics(const float z1, const float z2, const float z3) {
// Create a vector in old coordinates along x axis of new coordinate
const float p12[3] = { delta_tower[B_AXIS].x - delta_tower[A_AXIS].x, delta_tower[B_AXIS].y - delta_tower[A_AXIS].y, z2 - z1 },
diff --git a/Marlin/src/module/delta.h b/Marlin/src/module/delta.h
index 041094fd7f..a82f068615 100644
--- a/Marlin/src/module/delta.h
+++ b/Marlin/src/module/delta.h
@@ -116,7 +116,7 @@ void refresh_delta_clip_start_height();
*
* The result is stored in the cartes[] array.
*/
-void forward_kinematics(const_float_t z1, const_float_t z2, const_float_t z3);
+void forward_kinematics(const float z1, const float z2, const float z3);
FORCE_INLINE void forward_kinematics(const abc_float_t &point) {
forward_kinematics(point.a, point.b, point.c);
diff --git a/Marlin/src/module/ft_motion.cpp b/Marlin/src/module/ft_motion.cpp
index 5ccc364c1d..104a417e95 100644
--- a/Marlin/src/module/ft_motion.cpp
+++ b/Marlin/src/module/ft_motion.cpp
@@ -42,7 +42,7 @@ ft_command_t FTMotion::stepperCmdBuff[FTM_STEPPERCMD_BUFF_SIZE] = {0U}; // Stepp
int32_t FTMotion::stepperCmdBuff_produceIdx = 0, // Index of next stepper command write to the buffer.
FTMotion::stepperCmdBuff_consumeIdx = 0; // Index of next stepper command read from the buffer.
-bool FTMotion::sts_stepperBusy = false; // The stepper buffer has items and is in use.
+bool FTMotion::stepperCmdBuffHasData = false; // The stepper buffer has items and is in use.
XYZEval FTMotion::axis_move_end_ti = { 0 };
AxisBits FTMotion::axis_move_dir;
@@ -53,20 +53,19 @@ AxisBits FTMotion::axis_move_dir;
xyze_trajectory_t FTMotion::traj; // = {0.0f} Storage for fixed-time-based trajectory.
xyze_trajectoryMod_t FTMotion::trajMod; // = {0.0f} Storage for fixed time trajectory window.
-bool FTMotion::blockProcRdy = false; // Set when new block data is loaded from stepper module into FTM, ...
- // ... and reset when block is completely converted to FTM trajectory.
-bool FTMotion::batchRdy = false; // Indicates a batch of the fixed time trajectory...
- // ... has been generated, is now available in the upper -
- // batch of traj.x[], y, z ... e vectors, and is ready to be
- // post processed, if applicable, then interpolated. Reset when the
- // data has been shifted out.
-bool FTMotion::batchRdyForInterp = false; // Indicates the batch is done being post processed...
- // ... if applicable, and is ready to be converted to step commands.
+bool FTMotion::blockProcRdy = false; // Set when new block data is loaded from stepper module into FTM,
+ // and reset when block is completely converted to FTM trajectory.
+bool FTMotion::batchRdy = false; // Indicates a batch of the fixed time trajectory has been
+ // generated, is now available in the upper-batch of traj.A[], and
+ // is ready to be post-processed (if applicable) and interpolated.
+ // Reset once the data has been shifted out.
+bool FTMotion::batchRdyForInterp = false; // Indicates the batch is done being post processed
+ // (if applicable) and is ready to be converted to step commands.
// Trapezoid data variables.
-xyze_pos_t FTMotion::startPosn, // (mm) Start position of block
- FTMotion::endPosn_prevBlock = { 0.0f }; // (mm) End position of previous block
-xyze_float_t FTMotion::ratio; // (ratio) Axis move ratio of block
+xyze_pos_t FTMotion::startPos, // (mm) Start position of block
+ FTMotion::endPos_prevBlock = { 0.0f }; // (mm) End position of previous block
+xyze_float_t FTMotion::ratio; // (ratio) Axis move ratio of block
float FTMotion::accel_P, // Acceleration prime of block. [mm/sec/sec]
FTMotion::decel_P, // Deceleration prime of block. [mm/sec/sec]
FTMotion::F_P, // Feedrate prime of block. [mm/sec]
@@ -81,18 +80,20 @@ uint32_t FTMotion::N1, // Number of data points in the
uint32_t FTMotion::max_intervals; // Total number of data points that will be generated from block.
// Make vector variables.
-uint32_t FTMotion::makeVector_idx = 0, // Index of fixed time trajectory generation of the overall block.
- FTMotion::makeVector_batchIdx = 0; // Index of fixed time trajectory generation within the batch.
+uint32_t FTMotion::traj_idx_get = 0, // Index of fixed time trajectory generation of the overall block.
+ FTMotion::traj_idx_set = 0; // Index of fixed time trajectory generation within the batch.
// Interpolation variables.
xyze_long_t FTMotion::steps = { 0 }; // Step count accumulator.
+xyze_long_t FTMotion::step_error_q10 = { 0 }; // Fractional remainder in q10.21 format
uint32_t FTMotion::interpIdx = 0; // Index of current data point being interpolated.
#if ENABLED(DISTINCT_E_FACTORS)
uint8_t FTMotion::block_extruder_axis; // Cached E Axis from last-fetched block
-#else
+#elif HAS_EXTRUDERS
constexpr uint8_t FTMotion::block_extruder_axis;
+ bool FTMotion::use_advance_lead;
#endif
// Shaping variables.
@@ -103,15 +104,14 @@ uint32_t FTMotion::interpIdx = 0; // Index of current data point b
, x:{ false, { 0.0f }, { 0.0f }, { 0 }, 0 } // ena, d_zi[], Ai[], Ni[], max_i
#endif
#if HAS_Y_AXIS
- , y:{ false, { 0.0f }, { 0.0f }, { 0 }, 0 } // ena, d_zi[], Ai[], Ni[], max_i
+ , y:{ false, { 0.0f }, { 0.0f }, { 0 }, 0 }
#endif
};
#endif
#if HAS_EXTRUDERS
// Linear advance variables.
- float FTMotion::e_raw_z1 = 0.0f; // (ms) Unit delay of raw extruder position.
- float FTMotion::e_advanced_z1 = 0.0f; // (ms) Unit delay of advanced extruder position.
+ float FTMotion::prev_traj_e = 0.0f; // (ms) Unit delay of raw extruder position.
#endif
constexpr uint32_t BATCH_SIDX_IN_WINDOW = (FTM_WINDOW_SIZE) - (FTM_BATCH_SIZE); // Batch start index in window.
@@ -135,7 +135,7 @@ void FTMotion::loop() {
* 4. Signal ready for new block.
*/
if (stepper.abort_current_block) {
- if (sts_stepperBusy) return; // Wait until motion buffers are emptied
+ if (stepperCmdBuffHasData) return; // Wait until motion buffers are emptied
discard_planner_block_protected();
reset();
stepper.abort_current_block = false; // Abort finished.
@@ -149,13 +149,13 @@ void FTMotion::loop() {
continue;
}
loadBlockData(stepper.current_block);
+ blockProcRdy = true;
// If the endstop is already pressed, endstop interrupts won't invoke
// endstop_triggered and the move will grind. So check here for a
// triggered endstop, which shortly marks the block for discard.
endstops.update();
- blockProcRdy = true;
// Some kinematics track axis motion in HX, HY, HZ
#if ANY(CORE_IS_XY, CORE_IS_XZ, MARKFORGED_XY, MARKFORGED_YX)
stepper.last_direction_bits.hx = stepper.current_block->direction_bits.hx;
@@ -170,18 +170,14 @@ void FTMotion::loop() {
if (blockProcRdy) {
- if (!batchRdy) makeVector(); // Caution: Do not consolidate checks on blockProcRdy/batchRdy, as they are written by makeVector().
- // When makeVector is finished: either blockProcRdy has been set false (because the block is
- // done being processed) or batchRdy is set true, or both.
+ if (!batchRdy) generateTrajectoryPointsFromBlock(); // may clear blockProcRdy
// Check if the block has been completely converted:
if (!blockProcRdy) {
discard_planner_block_protected();
-
- // Check if the block needs to be runout:
if (!batchRdy && !planner.has_blocks_queued()) {
runoutBlock();
- makeVector(); // Do an additional makeVector call to guarantee batchRdy set this loop.
+ generateTrajectoryPointsFromBlock(); // Additional call to guarantee batchRdy is set this loop.
}
}
}
@@ -206,13 +202,13 @@ void FTMotion::loop() {
// ... data is ready in trajMod.
batchRdyForInterp = true;
- batchRdy = false; // Clear so makeVector() can resume generating points.
+ batchRdy = false; // Clear so generateTrajectoryPointsFromBlock() can resume generating points.
}
// Interpolation (generation of step commands from fixed time trajectory).
while (batchRdyForInterp
&& (stepperCmdBuffItems() < (FTM_STEPPERCMD_BUFF_SIZE) - (FTM_STEPS_PER_UNIT_TIME))) {
- convertToSteps(interpIdx);
+ generateStepsFromTrajectory(interpIdx);
if (++interpIdx == FTM_BATCH_SIZE) {
batchRdyForInterp = false;
interpIdx = 0;
@@ -220,14 +216,14 @@ void FTMotion::loop() {
}
// Report busy status to planner.
- busy = (sts_stepperBusy || blockProcRdy || batchRdy || batchRdyForInterp);
+ busy = (stepperCmdBuffHasData || blockProcRdy || batchRdy || batchRdyForInterp);
}
#if HAS_FTM_SHAPING
// Refresh the gains used by shaping functions.
- void FTMotion::AxisShaping::set_axis_shaping_A(const ftMotionShaper_t shaper, const_float_t zeta, const_float_t vtol) {
+ void FTMotion::AxisShaping::set_axis_shaping_A(const ftMotionShaper_t shaper, const float zeta, const float vtol) {
const float K = exp(-zeta * M_PI / sqrt(1.f - sq(zeta))),
K2 = sq(K),
@@ -273,11 +269,8 @@ void FTMotion::loop() {
Ai[2] = Ai[0] * K2;
const float adj = 1.0f / (Ai[0] + Ai[1] + Ai[2]);
- for (uint32_t i = 0U; i < 3U; i++) {
- Ai[i] *= adj;
- }
- }
- break;
+ for (uint32_t i = 0; i < 3U; i++) Ai[i] *= adj;
+ } break;
case ftMotionShaper_2HEI: {
max_i = 3U;
@@ -289,11 +282,8 @@ void FTMotion::loop() {
Ai[3] = Ai[0] * K3;
const float adj = 1.0f / (Ai[0] + Ai[1] + Ai[2] + Ai[3]);
- for (uint32_t i = 0U; i < 4U; i++) {
- Ai[i] *= adj;
- }
- }
- break;
+ for (uint32_t i = 0; i < 4U; i++) Ai[i] *= adj;
+ } break;
case ftMotionShaper_3HEI: {
max_i = 4U;
@@ -304,11 +294,8 @@ void FTMotion::loop() {
Ai[4] = Ai[0] * K4;
const float adj = 1.0f / (Ai[0] + Ai[1] + Ai[2] + Ai[3] + Ai[4]);
- for (uint32_t i = 0U; i < 5U; i++) {
- Ai[i] *= adj;
- }
- }
- break;
+ for (uint32_t i = 0; i < 5U; i++) Ai[i] *= adj;
+ } break;
case ftMotionShaper_MZV: {
max_i = 2U;
@@ -327,7 +314,7 @@ void FTMotion::loop() {
}
// Refresh the indices used by shaping functions.
- void FTMotion::AxisShaping::set_axis_shaping_N(const ftMotionShaper_t shaper, const_float_t f, const_float_t zeta) {
+ void FTMotion::AxisShaping::set_axis_shaping_N(const ftMotionShaper_t shaper, const float f, const float zeta) {
// Note that protections are omitted for DBZ and for index exceeding array length.
const float df = sqrt ( 1.f - sq(zeta) );
switch (shaper) {
@@ -362,13 +349,13 @@ void FTMotion::loop() {
void FTMotion::update_shaping_params() {
#if HAS_X_AXIS
- if ((shaping.x.ena = AXIS_HAS_SHAPER(X))) {
+ if ((shaping.x.ena = AXIS_IS_SHAPING(X))) {
shaping.x.set_axis_shaping_A(cfg.shaper.x, cfg.zeta.x, cfg.vtol.x);
shaping.x.set_axis_shaping_N(cfg.shaper.x, cfg.baseFreq.x, cfg.zeta.x);
}
#endif
#if HAS_Y_AXIS
- if ((shaping.y.ena = AXIS_HAS_SHAPER(Y))) {
+ if ((shaping.y.ena = AXIS_IS_SHAPING(Y))) {
shaping.y.set_axis_shaping_A(cfg.shaper.y, cfg.zeta.y, cfg.vtol.y);
shaping.y.set_axis_shaping_N(cfg.shaper.y, cfg.baseFreq.y, cfg.zeta.y);
}
@@ -386,12 +373,13 @@ void FTMotion::reset() {
blockProcRdy = batchRdy = batchRdyForInterp = false;
- endPosn_prevBlock.reset();
+ endPos_prevBlock.reset();
- makeVector_idx = 0;
- makeVector_batchIdx = TERN(FTM_UNIFIED_BWS, 0, _MIN(BATCH_SIDX_IN_WINDOW, FTM_BATCH_SIZE));
+ traj_idx_get = 0;
+ traj_idx_set = TERN(FTM_UNIFIED_BWS, 0, _MIN(BATCH_SIDX_IN_WINDOW, FTM_BATCH_SIZE));
steps.reset();
+ step_error_q10.reset();
interpIdx = 0;
#if HAS_FTM_SHAPING
@@ -400,7 +388,7 @@ void FTMotion::reset() {
shaping.zi_idx = 0;
#endif
- TERN_(HAS_EXTRUDERS, e_raw_z1 = e_advanced_z1 = 0.0f);
+ TERN_(HAS_EXTRUDERS, prev_traj_e = 0.0f); // Reset linear advance variables.
TERN_(DISTINCT_E_FACTORS, block_extruder_axis = E_AXIS);
axis_move_end_ti.reset();
@@ -424,16 +412,16 @@ void FTMotion::discard_planner_block_protected() {
/**
* Set up a pseudo block to allow motion to settle and buffers to empty.
* Called when the planner has one block left. The buffers will be filled
- * with the last commanded position by setting the startPosn block variable to
+ * with the last commanded position by setting the startPos block variable to
* the last position of the previous block and all ratios to zero such that no
* axes' positions are incremented.
*/
void FTMotion::runoutBlock() {
- startPosn = endPosn_prevBlock;
+ startPos = endPos_prevBlock;
ratio.reset();
- const int32_t n_to_fill_batch = (FTM_WINDOW_SIZE) - makeVector_batchIdx;
+ const int32_t n_to_fill_batch = (FTM_WINDOW_SIZE) - traj_idx_set;
// This line or function is to be modified for FBS use; do not optimize out.
const int32_t n_to_settle_shaper = num_samples_shaper_settle();
@@ -466,20 +454,8 @@ void FTMotion::loadBlockData(block_t * const current_block) {
const float totalLength = current_block->millimeters,
oneOverLength = 1.0f / totalLength;
- startPosn = endPosn_prevBlock;
- const xyze_pos_t moveDist = LOGICAL_AXIS_ARRAY(
- current_block->steps.e * planner.mm_per_step[block_extruder_axis] * (current_block->direction_bits.e ? 1 : -1),
- current_block->steps.x * planner.mm_per_step[X_AXIS] * (current_block->direction_bits.x ? 1 : -1),
- current_block->steps.y * planner.mm_per_step[Y_AXIS] * (current_block->direction_bits.y ? 1 : -1),
- current_block->steps.z * planner.mm_per_step[Z_AXIS] * (current_block->direction_bits.z ? 1 : -1),
- current_block->steps.i * planner.mm_per_step[I_AXIS] * (current_block->direction_bits.i ? 1 : -1),
- current_block->steps.j * planner.mm_per_step[J_AXIS] * (current_block->direction_bits.j ? 1 : -1),
- current_block->steps.k * planner.mm_per_step[K_AXIS] * (current_block->direction_bits.k ? 1 : -1),
- current_block->steps.u * planner.mm_per_step[U_AXIS] * (current_block->direction_bits.u ? 1 : -1),
- current_block->steps.v * planner.mm_per_step[V_AXIS] * (current_block->direction_bits.v ? 1 : -1),
- current_block->steps.w * planner.mm_per_step[W_AXIS] * (current_block->direction_bits.w ? 1 : -1)
- );
-
+ startPos = endPos_prevBlock;
+ const xyze_pos_t& moveDist = current_block->dist_mm;
ratio = moveDist * oneOverLength;
const float spm = totalLength / current_block->step_event_count; // (steps/mm) Distance for each step
@@ -561,59 +537,56 @@ void FTMotion::loadBlockData(block_t * const current_block) {
// Accel + Coasting + Decel datapoints
max_intervals = N1 + N2 + N3;
- endPosn_prevBlock += moveDist;
+ endPos_prevBlock += moveDist;
+
+ TERN_(FTM_HAS_LIN_ADVANCE, use_advance_lead = current_block->use_advance_lead);
// Watch endstops until the move ends
const millis_t move_end_ti = millis() + SEC_TO_MS((FTM_TS) * float(max_intervals + num_samples_shaper_settle() + ((PROP_BATCHES) + 1) * (FTM_BATCH_SIZE)) + (float(FTM_STEPPERCMD_BUFF_SIZE) / float(FTM_STEPPER_FS)));
- #define __SET_MOVE_END(A,V) do{ if (V) { axis_move_end_ti.A = move_end_ti; axis_move_dir.A = (V > 0); } }while(0);
- #define _SET_MOVE_END(A) __SET_MOVE_END(A, moveDist[_AXIS(A)])
- #if CORE_IS_XY
- __SET_MOVE_END(X, moveDist.x + moveDist.y);
- __SET_MOVE_END(Y, moveDist.x - moveDist.y);
- #else
- _SET_MOVE_END(X);
- _SET_MOVE_END(Y);
- #endif
- TERN_(HAS_Z_AXIS, _SET_MOVE_END(Z));
- SECONDARY_AXIS_MAP(_SET_MOVE_END);
+ #define _SET_MOVE_END(A) do{ \
+ if (moveDist.A) { \
+ axis_move_end_ti.A = move_end_ti; \
+ axis_move_dir.A = moveDist.A > 0; \
+ } \
+ }while(0);
+
+ LOGICAL_AXIS_MAP(_SET_MOVE_END);
}
// Generate data points of the trajectory.
-void FTMotion::makeVector() {
+void FTMotion::generateTrajectoryPointsFromBlock() {
do {
- float accel_k = 0.0f; // (mm/s^2) Acceleration K factor
- float tau = (makeVector_idx + 1) * (FTM_TS); // (s) Time since start of block
+ float tau = (traj_idx_get + 1) * (FTM_TS); // (s) Time since start of block
float dist = 0.0f; // (mm) Distance traveled
- if (makeVector_idx < N1) {
+ if (traj_idx_get < N1) {
// Acceleration phase
dist = (f_s * tau) + (0.5f * accel_P * sq(tau)); // (mm) Distance traveled for acceleration phase since start of block
- accel_k = accel_P; // (mm/s^2) Acceleration K factor from Accel phase
}
- else if (makeVector_idx < (N1 + N2)) {
+ else if (traj_idx_get < (N1 + N2)) {
// Coasting phase
dist = s_1e + F_P * (tau - N1 * (FTM_TS)); // (mm) Distance traveled for coasting phase since start of block
- //accel_k = 0.0f;
+ //TERN_(HAS_EXTRUDERS, accel_k = 0.0f);
}
else {
// Deceleration phase
tau -= (N1 + N2) * (FTM_TS); // (s) Time since start of decel phase
dist = s_2e + F_P * tau + 0.5f * decel_P * sq(tau); // (mm) Distance traveled for deceleration phase since start of block
- accel_k = decel_P; // (mm/s^2) Acceleration K factor from Decel phase
}
- #define _SET_TRAJ(q) traj.q[makeVector_batchIdx] = startPosn.q + ratio.q * dist;
+ #define _SET_TRAJ(q) traj.q[traj_idx_set] = startPos.q + ratio.q * dist;
LOGICAL_AXIS_MAP_LC(_SET_TRAJ);
- #if HAS_EXTRUDERS
+ #if FTM_HAS_LIN_ADVANCE
if (cfg.linearAdvEna) {
- float dedt_adj = (traj.e[makeVector_batchIdx] - e_raw_z1) * (FTM_FS);
- if (ratio.e > 0.0f) dedt_adj += accel_k * cfg.linearAdvK * 0.0001f;
-
- e_raw_z1 = traj.e[makeVector_batchIdx];
- e_advanced_z1 += dedt_adj * (FTM_TS);
- traj.e[makeVector_batchIdx] = e_advanced_z1;
+ float traj_e = traj.e[traj_idx_set];
+ if (use_advance_lead) {
+ // Don't apply LA to retract/unretract blocks
+ float e_rate = (traj_e - prev_traj_e) * (FTM_FS);
+ traj.e[traj_idx_set] += e_rate * cfg.linearAdvK;
+ }
+ prev_traj_e = traj_e;
}
#endif
@@ -624,7 +597,7 @@ void FTMotion::makeVector() {
#if HAS_DYNAMIC_FREQ_MM
case dynFreqMode_Z_BASED: {
static float oldz = 0.0f;
- const float z = traj.z[makeVector_batchIdx];
+ const float z = traj.z[traj_idx_set];
if (z != oldz) { // Only update if Z changed.
oldz = z;
#if HAS_X_AXIS
@@ -644,10 +617,10 @@ void FTMotion::makeVector() {
// Update constantly. The optimization done for Z value makes
// less sense for E, as E is expected to constantly change.
#if HAS_X_AXIS
- shaping.x.set_axis_shaping_N(cfg.shaper.x, cfg.baseFreq.x + cfg.dynFreqK.x * traj.e[makeVector_batchIdx], cfg.zeta.x);
+ shaping.x.set_axis_shaping_N(cfg.shaper.x, cfg.baseFreq.x + cfg.dynFreqK.x * traj.e[traj_idx_set], cfg.zeta.x);
#endif
#if HAS_Y_AXIS
- shaping.y.set_axis_shaping_N(cfg.shaper.y, cfg.baseFreq.y + cfg.dynFreqK.y * traj.e[makeVector_batchIdx], cfg.zeta.y);
+ shaping.y.set_axis_shaping_N(cfg.shaper.y, cfg.baseFreq.y + cfg.dynFreqK.y * traj.e[traj_idx_set], cfg.zeta.y);
#endif
break;
#endif
@@ -659,109 +632,105 @@ void FTMotion::makeVector() {
#if HAS_FTM_SHAPING
#if HAS_X_AXIS
if (shaping.x.ena) {
- shaping.x.d_zi[shaping.zi_idx] = traj.x[makeVector_batchIdx];
- traj.x[makeVector_batchIdx] *= shaping.x.Ai[0];
+ shaping.x.d_zi[shaping.zi_idx] = traj.x[traj_idx_set];
+ traj.x[traj_idx_set] *= shaping.x.Ai[0];
for (uint32_t i = 1U; i <= shaping.x.max_i; i++) {
const uint32_t udiffx = shaping.zi_idx - shaping.x.Ni[i];
- traj.x[makeVector_batchIdx] += shaping.x.Ai[i] * shaping.x.d_zi[shaping.x.Ni[i] > shaping.zi_idx ? (FTM_ZMAX) + udiffx : udiffx];
+ traj.x[traj_idx_set] += shaping.x.Ai[i] * shaping.x.d_zi[shaping.x.Ni[i] > shaping.zi_idx ? (FTM_ZMAX) + udiffx : udiffx];
}
}
#endif
#if HAS_Y_AXIS
if (shaping.y.ena) {
- shaping.y.d_zi[shaping.zi_idx] = traj.y[makeVector_batchIdx];
- traj.y[makeVector_batchIdx] *= shaping.y.Ai[0];
+ shaping.y.d_zi[shaping.zi_idx] = traj.y[traj_idx_set];
+ traj.y[traj_idx_set] *= shaping.y.Ai[0];
for (uint32_t i = 1U; i <= shaping.y.max_i; i++) {
const uint32_t udiffy = shaping.zi_idx - shaping.y.Ni[i];
- traj.y[makeVector_batchIdx] += shaping.y.Ai[i] * shaping.y.d_zi[shaping.y.Ni[i] > shaping.zi_idx ? (FTM_ZMAX) + udiffy : udiffy];
+ traj.y[traj_idx_set] += shaping.y.Ai[i] * shaping.y.d_zi[shaping.y.Ni[i] > shaping.zi_idx ? (FTM_ZMAX) + udiffy : udiffy];
}
}
#endif
if (++shaping.zi_idx == (FTM_ZMAX)) shaping.zi_idx = 0;
+
#endif // HAS_FTM_SHAPING
// Filled up the queue with regular and shaped steps
- if (++makeVector_batchIdx == FTM_WINDOW_SIZE) {
- makeVector_batchIdx = BATCH_SIDX_IN_WINDOW;
+ if (++traj_idx_set == FTM_WINDOW_SIZE) {
+ traj_idx_set = BATCH_SIDX_IN_WINDOW;
batchRdy = true;
}
-
- if (++makeVector_idx == max_intervals) {
+ if (++traj_idx_get == max_intervals) {
blockProcRdy = false;
- makeVector_idx = 0;
+ traj_idx_get = 0;
}
} while (blockProcRdy && !batchRdy);
-}
+} // generateTrajectoryPointsFromBlock
/**
- * Convert to steps
- * - Commands are written in a bitmask with step and dir as single bits.
- * - Tests for delta are moved outside the loop.
- * - Two functions are used for command computation with an array of function pointers.
+ * @brief Interpolate a single trajectory data point into stepper commands.
+ * @param idx The index of the trajectory point to convert.
+ *
+ * Calculate the required stepper movements for each axis based on the
+ * difference between the current and previous trajectory points.
+ * Add up to one stepper command to the buffer with STEP/DIR bits for all axes.
*/
-static void (*command_set[LOGICAL_AXES])(int32_t&, int32_t&, ft_command_t&, int32_t, int32_t);
+void FTMotion::generateStepsFromTrajectory(const uint32_t idx) {
+ constexpr float INV_FTM_STEPS_PER_UNIT_TIME = 1.0f / (FTM_STEPS_PER_UNIT_TIME);
-static void command_set_pos(int32_t &e, int32_t &s, ft_command_t &b, int32_t bd, int32_t bs) {
- if (e < FTM_CTS_COMPARE_VAL) return;
- s++;
- b |= bd | bs;
- e -= FTM_STEPS_PER_UNIT_TIME;
-}
+ // q10 per-stepper-slot increment toward this sample’s target step count.
+ // (traj * steps_per_mm - steps) = steps still due at the start of this UNIT_TIME.
+ // Convert to q10 (×2^10), then subtract the current accumulator error: step_error_q10 / FTM_STEPS_PER_UNIT_TIME.
+ // Over FTM_STEPS_PER_UNIT_TIME stepper-slots this sums to the exact target (no drift).
+ // Any fraction of a step that may remain will be accounted for by the next UNIT_TIME
+ #define TOSTEPS_q10(A, B) int32_t( \
+ (trajMod.A[idx] * planner.settings.axis_steps_per_mm[B] - steps.A) * _BV(10) \
+ - step_error_q10.A * INV_FTM_STEPS_PER_UNIT_TIME )
-static void command_set_neg(int32_t &e, int32_t &s, ft_command_t &b, int32_t bd, int32_t bs) {
- if (e > -(FTM_CTS_COMPARE_VAL)) return;
- s--;
- b |= bs;
- e += FTM_STEPS_PER_UNIT_TIME;
-}
+ xyze_long_t delta_q10 = LOGICAL_AXIS_ARRAY(
+ TOSTEPS_q10(e, block_extruder_axis),
+ TOSTEPS_q10(x, X_AXIS), TOSTEPS_q10(y, Y_AXIS), TOSTEPS_q10(z, Z_AXIS),
+ TOSTEPS_q10(i, I_AXIS), TOSTEPS_q10(j, J_AXIS), TOSTEPS_q10(k, K_AXIS),
+ TOSTEPS_q10(u, U_AXIS), TOSTEPS_q10(v, V_AXIS), TOSTEPS_q10(w, W_AXIS)
+ );
-// Interpolates single data point to stepper commands.
-void FTMotion::convertToSteps(const uint32_t idx) {
- xyze_long_t err_P = { 0 };
+ // Fixed-point denominator for step accumulation
+ constexpr int32_t denom_q10 = (FTM_STEPS_PER_UNIT_TIME) << 10;
- //#define STEPS_ROUNDING
- #if ENABLED(STEPS_ROUNDING)
- #define TOSTEPS(A,B) int32_t(trajMod.A[idx] * planner.settings.axis_steps_per_mm[B] + (trajMod.A[idx] < 0.0f ? -0.5f : 0.5f))
- const xyze_long_t steps_tar = LOGICAL_AXIS_ARRAY(
- TOSTEPS(e, block_extruder_axis), // May be eliminated if guaranteed positive.
- TOSTEPS(x, X_AXIS), TOSTEPS(y, Y_AXIS), TOSTEPS(z, Z_AXIS),
- TOSTEPS(i, I_AXIS), TOSTEPS(j, J_AXIS), TOSTEPS(k, K_AXIS),
- TOSTEPS(u, U_AXIS), TOSTEPS(v, V_AXIS), TOSTEPS(w, W_AXIS)
- );
- xyze_long_t delta = steps_tar - steps;
- #else
- #define TOSTEPS(A,B) int32_t(trajMod.A[idx] * planner.settings.axis_steps_per_mm[B]) - steps.A
- xyze_long_t delta = LOGICAL_AXIS_ARRAY(
- TOSTEPS(e, block_extruder_axis),
- TOSTEPS(x, X_AXIS), TOSTEPS(y, Y_AXIS), TOSTEPS(z, Z_AXIS),
- TOSTEPS(i, I_AXIS), TOSTEPS(j, J_AXIS), TOSTEPS(k, K_AXIS),
- TOSTEPS(u, U_AXIS), TOSTEPS(v, V_AXIS), TOSTEPS(w, W_AXIS)
- );
- #endif
+ // 1. Subtract one whole step from the accumulated distance
+ // 2. Accumulate one positive or negative step
+ // 3. Set the step and direction bits for the stepper command
+ #define RUN_AXIS(A) \
+ do { \
+ if (step_error_q10.A >= denom_q10) { \
+ step_error_q10.A -= denom_q10; \
+ steps.A++; \
+ cmd |= _BV(FT_BIT_DIR_##A) | _BV(FT_BIT_STEP_##A); \
+ } \
+ if (step_error_q10.A <= -denom_q10) { \
+ step_error_q10.A += denom_q10; \
+ steps.A--; \
+ cmd |= _BV(FT_BIT_STEP_##A); /* neg dir implicit */ \
+ } \
+ } while (0);
- #define _COMMAND_SET(AXIS) command_set[_AXIS(AXIS)] = delta[_AXIS(AXIS)] >= 0 ? command_set_pos : command_set_neg;
- LOGICAL_AXIS_MAP(_COMMAND_SET);
+ for (uint32_t i = 0; i < uint32_t(FTM_STEPS_PER_UNIT_TIME); i++) {
+ // Reference the next stepper command in the circular buffer
+ ft_command_t& cmd = stepperCmdBuff[stepperCmdBuff_produceIdx];
- for (uint32_t i = 0U; i < (FTM_STEPS_PER_UNIT_TIME); i++) {
-
- ft_command_t &cmd = stepperCmdBuff[stepperCmdBuff_produceIdx];
-
- // Init all step/dir bits to 0 (defaulting to reverse/negative motion)
+ // Init the command to no STEP (Reverse DIR)
cmd = 0;
- // Accumulate the errors for all axes
- err_P += delta;
+ // Accumulate the "error" for all axes according the fixed-point distance
+ step_error_q10 += delta_q10;
- // Set up step/dir bits for all axes
- #define _COMMAND_RUN(A) command_set[_AXIS(A)](err_P.A, steps.A, cmd, _BV(FT_BIT_DIR_##A), _BV(FT_BIT_STEP_##A));
- LOGICAL_AXIS_MAP(_COMMAND_RUN);
+ // Where the error has accumulated whole axis steps, add them to the command
+ LOGICAL_AXIS_MAP(RUN_AXIS);
// Next circular buffer index
if (++stepperCmdBuff_produceIdx == (FTM_STEPPERCMD_BUFF_SIZE))
stepperCmdBuff_produceIdx = 0;
-
- } // FTM_STEPS_PER_UNIT_TIME loop
+ }
}
#endif // FT_MOTION
diff --git a/Marlin/src/module/ft_motion.h b/Marlin/src/module/ft_motion.h
index 4cf8017083..84bca8ebc9 100644
--- a/Marlin/src/module/ft_motion.h
+++ b/Marlin/src/module/ft_motion.h
@@ -56,12 +56,14 @@ typedef struct FTConfig {
#else
static constexpr dynFreqMode_t dynFreqMode = dynFreqMode_DISABLED;
#endif
+
#endif // HAS_FTM_SHAPING
#if HAS_EXTRUDERS
bool linearAdvEna = FTM_LINEAR_ADV_DEFAULT_ENA; // Linear advance enable configuration.
float linearAdvK = FTM_LINEAR_ADV_DEFAULT_K; // Linear advance gain.
#endif
+
} ft_config_t;
class FTMotion {
@@ -113,7 +115,7 @@ class FTMotion {
static int32_t stepperCmdBuff_produceIdx, // Index of next stepper command write to the buffer.
stepperCmdBuff_consumeIdx; // Index of next stepper command read from the buffer.
- static bool sts_stepperBusy; // The stepper buffer has items and is in use.
+ static bool stepperCmdBuffHasData; // The stepper buffer has items and is in use.
static XYZEval axis_move_end_ti;
static AxisBits axis_move_dir;
@@ -145,9 +147,9 @@ class FTMotion {
static bool batchRdy, batchRdyForInterp;
// Trapezoid data variables.
- static xyze_pos_t startPosn, // (mm) Start position of block
- endPosn_prevBlock; // (mm) End position of previous block
- static xyze_float_t ratio; // (ratio) Axis move ratio of block
+ static xyze_pos_t startPos, // (mm) Start position of block
+ endPos_prevBlock; // (mm) End position of previous block
+ static xyze_float_t ratio; // (ratio) Axis move ratio of block
static float accel_P, decel_P,
F_P,
f_s,
@@ -160,19 +162,21 @@ class FTMotion {
// Number of batches needed to propagate the current trajectory to the stepper.
static constexpr uint32_t PROP_BATCHES = CEIL((FTM_WINDOW_SIZE) / (FTM_BATCH_SIZE)) - 1;
- // Make vector variables.
- static uint32_t makeVector_idx,
- makeVector_batchIdx;
+ // generateTrajectoryPointsFromBlock variables.
+ static uint32_t traj_idx_get,
+ traj_idx_set;
// Interpolation variables.
static uint32_t interpIdx;
static xyze_long_t steps;
+ static xyze_long_t step_error_q10;
#if ENABLED(DISTINCT_E_FACTORS)
static uint8_t block_extruder_axis; // Cached extruder axis index
- #else
+ #elif HAS_EXTRUDERS
static constexpr uint8_t block_extruder_axis = E_AXIS;
+ static bool use_advance_lead;
#endif
// Shaping variables.
@@ -185,8 +189,8 @@ class FTMotion {
uint32_t Ni[5]; // Shaping time index vector.
uint32_t max_i; // Vector length for the selected shaper.
- void set_axis_shaping_N(const ftMotionShaper_t shaper, const_float_t f, const_float_t zeta); // Sets the gains used by shaping functions.
- void set_axis_shaping_A(const ftMotionShaper_t shaper, const_float_t zeta, const_float_t vtol); // Sets the indices used by shaping functions.
+ void set_axis_shaping_N(const ftMotionShaper_t shaper, const float f, const float zeta); // Sets the gains used by shaping functions.
+ void set_axis_shaping_A(const ftMotionShaper_t shaper, const float zeta, const float vtol); // Sets the indices used by shaping functions.
} axis_shaping_t;
@@ -206,7 +210,7 @@ class FTMotion {
// Linear advance variables.
#if HAS_EXTRUDERS
- static float e_raw_z1, e_advanced_z1;
+ static float prev_traj_e;
#endif
// Private methods
@@ -214,8 +218,8 @@ class FTMotion {
static void runoutBlock();
static int32_t stepperCmdBuffItems();
static void loadBlockData(block_t *const current_block);
- static void makeVector();
- static void convertToSteps(const uint32_t idx);
+ static void generateTrajectoryPointsFromBlock();
+ static void generateStepsFromTrajectory(const uint32_t idx);
FORCE_INLINE static int32_t num_samples_shaper_settle() { return ( shaping.x.ena || shaping.y.ena ) ? FTM_ZMAX : 0; }
diff --git a/Marlin/src/module/ft_types.h b/Marlin/src/module/ft_types.h
index 1f7277b372..f8d361e1bf 100644
--- a/Marlin/src/module/ft_types.h
+++ b/Marlin/src/module/ft_types.h
@@ -41,15 +41,15 @@ enum dynFreqMode_t : uint8_t {
dynFreqMode_MASS_BASED = 2
};
-#define AXIS_HAS_SHAPER(A) (ftMotion.cfg.shaper[_AXIS(A)] != ftMotionShaper_NONE)
-#define AXIS_HAS_EISHAPER(A) WITHIN(ftMotion.cfg.shaper[_AXIS(A)], ftMotionShaper_EI, ftMotionShaper_3HEI)
+#define AXIS_IS_SHAPING(A) (ftMotion.cfg.shaper[_AXIS(A)] != ftMotionShaper_NONE)
+#define AXIS_IS_EISHAPING(A) WITHIN(ftMotion.cfg.shaper[_AXIS(A)], ftMotionShaper_EI, ftMotionShaper_3HEI)
typedef struct XYZEarray xyze_trajectory_t;
typedef struct XYZEarray xyze_trajectoryMod_t;
// TODO: Convert ft_command_t to a struct with bitfields instead of using a primitive type
enum {
- LIST_N(DOUBLE(LOGICAL_AXES),
+ LOGICAL_AXIS_PAIRED_LIST(
FT_BIT_DIR_E, FT_BIT_STEP_E,
FT_BIT_DIR_X, FT_BIT_STEP_X, FT_BIT_DIR_Y, FT_BIT_STEP_Y, FT_BIT_DIR_Z, FT_BIT_STEP_Z,
FT_BIT_DIR_I, FT_BIT_STEP_I, FT_BIT_DIR_J, FT_BIT_STEP_J, FT_BIT_DIR_K, FT_BIT_STEP_K,
diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp
index f2f27ee6a9..85ff4492e6 100644
--- a/Marlin/src/module/motion.cpp
+++ b/Marlin/src/module/motion.cpp
@@ -208,22 +208,12 @@ inline void report_more_positions() {
inline void report_logical_position(const xyze_pos_t &rpos) {
const xyze_pos_t lpos = rpos.asLogical();
#if NUM_AXES
- SERIAL_ECHOPGM_P(
- LIST_N(DOUBLE(NUM_AXES),
- X_LBL, lpos.x,
- SP_Y_LBL, lpos.y,
- SP_Z_LBL, lpos.z,
- SP_I_LBL, lpos.i,
- SP_J_LBL, lpos.j,
- SP_K_LBL, lpos.k,
- SP_U_LBL, lpos.u,
- SP_V_LBL, lpos.v,
- SP_W_LBL, lpos.w
- )
- );
- #endif
- #if HAS_EXTRUDERS
- SERIAL_ECHOPGM_P(SP_E_LBL, lpos.e);
+ SERIAL_ECHOPGM_P(LOGICAL_AXIS_PAIRED_LIST(
+ SP_E_LBL, lpos.e,
+ X_LBL, lpos.x, SP_Y_LBL, lpos.y, SP_Z_LBL, lpos.z,
+ SP_I_LBL, lpos.i, SP_J_LBL, lpos.j, SP_K_LBL, lpos.k,
+ SP_U_LBL, lpos.u, SP_V_LBL, lpos.v, SP_W_LBL, lpos.w
+ ));
#endif
}
@@ -608,22 +598,12 @@ void report_current_position_projected() {
get_cartesian_from_steppers();
const xyz_pos_t lpos = cartes.asLogical();
- SERIAL_ECHOPGM_P(
- LIST_N(DOUBLE(NUM_AXES),
- X_LBL, lpos.x,
- SP_Y_LBL, lpos.y,
- SP_Z_LBL, lpos.z,
- SP_I_LBL, lpos.i,
- SP_J_LBL, lpos.j,
- SP_K_LBL, lpos.k,
- SP_U_LBL, lpos.u,
- SP_V_LBL, lpos.v,
- SP_W_LBL, lpos.w
- )
- #if HAS_EXTRUDERS
- , SP_E_LBL, current_position.e
- #endif
- );
+ SERIAL_ECHOPGM_P(LOGICAL_AXIS_PAIRED_LIST(
+ SP_E_LBL, current_position.e,
+ X_LBL, lpos.x, SP_Y_LBL, lpos.y, SP_Z_LBL, lpos.z,
+ SP_I_LBL, lpos.i, SP_J_LBL, lpos.j, SP_K_LBL, lpos.k,
+ SP_U_LBL, lpos.u, SP_V_LBL, lpos.v, SP_W_LBL, lpos.w
+ ));
report_more_positions();
report_current_grblstate_moving();
@@ -649,7 +629,7 @@ void report_current_position_projected() {
#if IS_KINEMATIC
- bool position_is_reachable(const_float_t rx, const_float_t ry, const float inset/*=0*/) {
+ bool position_is_reachable(const float rx, const float ry, const float inset/*=0.0f*/) {
bool can_reach;
@@ -700,7 +680,7 @@ void report_current_position_projected() {
#else // CARTESIAN
// Return true if the given position is within the machine bounds.
- bool position_is_reachable(TERN_(HAS_X_AXIS, const_float_t rx) OPTARG(HAS_Y_AXIS, const_float_t ry)) {
+ bool position_is_reachable(TERN_(HAS_X_AXIS, const float rx) OPTARG(HAS_Y_AXIS, const float ry)) {
if (TERN0(HAS_Y_AXIS, !COORDINATE_OKAY(ry, Y_MIN_POS - fslop, Y_MAX_POS + fslop))) return false;
#if ENABLED(DUAL_X_CARRIAGE)
if (active_extruder)
@@ -822,12 +802,12 @@ void set_current_from_steppers_for_axis(const AxisEnum axis) {
* Move the planner to the current position from wherever it last moved
* (or from wherever it has been told it is located).
*/
-void line_to_current_position(const_feedRate_t fr_mm_s/*=feedrate_mm_s*/) {
+void line_to_current_position(const feedRate_t fr_mm_s/*=feedrate_mm_s*/) {
planner.buffer_line(current_position, fr_mm_s);
}
#if HAS_EXTRUDERS
- void unscaled_e_move(const_float_t length, const_feedRate_t fr_mm_s) {
+ void unscaled_e_move(const float length, const feedRate_t fr_mm_s) {
TERN_(HAS_FILAMENT_SENSOR, runout.reset());
current_position.e += length / planner.e_factor[active_extruder];
line_to_current_position(fr_mm_s);
@@ -840,7 +820,7 @@ void line_to_current_position(const_feedRate_t fr_mm_s/*=feedrate_mm_s*/) {
/**
* Buffer a fast move without interpolation. Set current_position to destination
*/
- void prepare_fast_move_to_destination(const_feedRate_t scaled_fr_mm_s/*=MMS_SCALED(feedrate_mm_s)*/) {
+ void prepare_fast_move_to_destination(const feedRate_t scaled_fr_mm_s/*=MMS_SCALED(feedrate_mm_s)*/) {
if (DEBUGGING(LEVELING)) DEBUG_POS("prepare_fast_move_to_destination", destination);
#if UBL_SEGMENTED
@@ -862,7 +842,7 @@ void line_to_current_position(const_feedRate_t fr_mm_s/*=feedrate_mm_s*/) {
* - Move at normal speed regardless of feedrate percentage.
* - Extrude the specified length regardless of flow percentage.
*/
-void _internal_move_to_destination(const_feedRate_t fr_mm_s/*=0.0f*/
+void _internal_move_to_destination(const feedRate_t fr_mm_s/*=0.0f*/
OPTARG(IS_KINEMATIC, const bool is_fast/*=false*/)
) {
REMEMBER(fr, feedrate_mm_s);
@@ -878,8 +858,8 @@ void _internal_move_to_destination(const_feedRate_t fr_mm_s/*=0.0f*/
#if SECONDARY_AXES
- void secondary_axis_moves(SECONDARY_AXIS_ARGS_LC(const_float_t), const_feedRate_t fr_mm_s) {
- auto move_one = [&](const AxisEnum a, const_float_t p) {
+ void secondary_axis_moves(SECONDARY_AXIS_ARGS_LC(const float), const feedRate_t fr_mm_s) {
+ auto move_one = [&](const AxisEnum a, const float p) {
const feedRate_t fr = fr_mm_s ?: homing_feedrate(a);
current_position[a] = p; line_to_current_position(fr);
};
@@ -900,7 +880,7 @@ void _internal_move_to_destination(const_feedRate_t fr_mm_s/*=0.0f*/
* - Delta may lower Z first to get into the free motion zone.
* - Before returning, wait for the planner buffer to empty.
*/
-void do_blocking_move_to(NUM_AXIS_ARGS_(const_float_t) const_feedRate_t fr_mm_s/*=0.0f*/) {
+void do_blocking_move_to(NUM_AXIS_ARGS_(const float) const feedRate_t fr_mm_s/*=0.0f*/) {
DEBUG_SECTION(log_move, "do_blocking_move_to", DEBUGGING(LEVELING));
#if NUM_AXES
if (DEBUGGING(LEVELING)) DEBUG_XYZ("> ", NUM_AXIS_ARGS_LC());
@@ -993,20 +973,20 @@ void do_blocking_move_to(NUM_AXIS_ARGS_(const_float_t) const_feedRate_t fr_mm_s/
planner.synchronize();
}
-void do_blocking_move_to(const xy_pos_t &raw, const_feedRate_t fr_mm_s/*=0.0f*/) {
+void do_blocking_move_to(const xy_pos_t &raw, const feedRate_t fr_mm_s/*=0.0f*/) {
do_blocking_move_to(NUM_AXIS_LIST_(raw.x, raw.y, current_position.z,
current_position.i, current_position.j, current_position.k,
current_position.u, current_position.v, current_position.w) fr_mm_s);
}
-void do_blocking_move_to(const xyz_pos_t &raw, const_feedRate_t fr_mm_s/*=0.0f*/) {
+void do_blocking_move_to(const xyz_pos_t &raw, const feedRate_t fr_mm_s/*=0.0f*/) {
do_blocking_move_to(NUM_AXIS_ELEM_(raw) fr_mm_s);
}
-void do_blocking_move_to(const xyze_pos_t &raw, const_feedRate_t fr_mm_s/*=0.0f*/) {
+void do_blocking_move_to(const xyze_pos_t &raw, const feedRate_t fr_mm_s/*=0.0f*/) {
do_blocking_move_to(NUM_AXIS_ELEM_(raw) fr_mm_s);
}
#if HAS_X_AXIS
- void do_blocking_move_to_x(const_float_t rx, const_feedRate_t fr_mm_s/*=0.0*/) {
+ void do_blocking_move_to_x(const float rx, const feedRate_t fr_mm_s/*=0.0*/) {
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("do_blocking_move_to_x(", rx, ", ", fr_mm_s, ")");
do_blocking_move_to(
NUM_AXIS_LIST_(rx, current_position.y, current_position.z,
@@ -1018,7 +998,7 @@ void do_blocking_move_to(const xyze_pos_t &raw, const_feedRate_t fr_mm_s/*=0.0f*
#endif
#if HAS_Y_AXIS
- void do_blocking_move_to_y(const_float_t ry, const_feedRate_t fr_mm_s/*=0.0*/) {
+ void do_blocking_move_to_y(const float ry, const feedRate_t fr_mm_s/*=0.0*/) {
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("do_blocking_move_to_y(", ry, ", ", fr_mm_s, ")");
do_blocking_move_to(
NUM_AXIS_LIST_(current_position.x, ry, current_position.z,
@@ -1027,7 +1007,7 @@ void do_blocking_move_to(const xyze_pos_t &raw, const_feedRate_t fr_mm_s/*=0.0f*
fr_mm_s
);
}
- void do_blocking_move_to_xy(const_float_t rx, const_float_t ry, const_feedRate_t fr_mm_s/*=0.0*/) {
+ void do_blocking_move_to_xy(const float rx, const float ry, const feedRate_t fr_mm_s/*=0.0*/) {
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("do_blocking_move_to_xy(", rx, ", ", ry, ", ", fr_mm_s, ")");
do_blocking_move_to(
NUM_AXIS_LIST_(rx, ry, current_position.z,
@@ -1036,17 +1016,17 @@ void do_blocking_move_to(const xyze_pos_t &raw, const_feedRate_t fr_mm_s/*=0.0f*
fr_mm_s
);
}
- void do_blocking_move_to_xy(const xy_pos_t &raw, const_feedRate_t fr_mm_s/*=0.0f*/) {
+ void do_blocking_move_to_xy(const xy_pos_t &raw, const feedRate_t fr_mm_s/*=0.0f*/) {
do_blocking_move_to_xy(raw.x, raw.y, fr_mm_s);
}
#endif
#if HAS_Z_AXIS
- void do_blocking_move_to_z(const_float_t rz, const_feedRate_t fr_mm_s/*=0.0*/) {
+ void do_blocking_move_to_z(const float rz, const feedRate_t fr_mm_s/*=0.0*/) {
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("do_blocking_move_to_z(", rz, ", ", fr_mm_s, ")");
do_blocking_move_to_xy_z(current_position, rz, fr_mm_s);
}
- void do_blocking_move_to_xy_z(const xy_pos_t &raw, const_float_t z, const_feedRate_t fr_mm_s/*=0.0f*/) {
+ void do_blocking_move_to_xy_z(const xy_pos_t &raw, const float z, const feedRate_t fr_mm_s/*=0.0f*/) {
do_blocking_move_to(
NUM_AXIS_LIST_(raw.x, raw.y, z,
current_position.i, current_position.j, current_position.k,
@@ -1062,7 +1042,7 @@ void do_blocking_move_to(const xyze_pos_t &raw, const_feedRate_t fr_mm_s/*=0.0f*
* - If lowering is not allowed then skip a downward move
* - Execute the move at the probing (or homing) feedrate
*/
- void do_z_clearance(const_float_t zclear, const bool with_probe/*=true*/, const bool lower_allowed/*=false*/) {
+ void do_z_clearance(const float zclear, const bool with_probe/*=true*/, const bool lower_allowed/*=false*/) {
UNUSED(with_probe);
float zdest = zclear;
TERN_(HAS_BED_PROBE, if (with_probe && probe.offset.z < 0) zdest -= probe.offset.z);
@@ -1071,7 +1051,7 @@ void do_blocking_move_to(const xyze_pos_t &raw, const_feedRate_t fr_mm_s/*=0.0f*
if ((!lower_allowed && zdest < current_position.z) || zdest == current_position.z) return;
do_blocking_move_to_z(zdest, TERN(HAS_BED_PROBE, z_probe_fast_mm_s, homing_feedrate(Z_AXIS)));
}
- void do_z_clearance_by(const_float_t zclear) {
+ void do_z_clearance_by(const float zclear) {
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("do_z_clearance_by(", zclear, ")");
do_z_clearance(current_position.z + zclear, false);
}
@@ -1094,73 +1074,73 @@ void do_blocking_move_to(const xyze_pos_t &raw, const_feedRate_t fr_mm_s/*=0.0f*
#endif // HAS_Z_AXIS
#if HAS_I_AXIS
- void do_blocking_move_to_xyz_i(const xyze_pos_t &raw, const_float_t i, const_feedRate_t fr_mm_s/*=0.0f*/) {
+ void do_blocking_move_to_xyz_i(const xyze_pos_t &raw, const float i, const feedRate_t fr_mm_s/*=0.0f*/) {
do_blocking_move_to(
NUM_AXIS_LIST_(raw.x, raw.y, raw.z, i, raw.j, raw.k, raw.u, raw.v, raw.w)
fr_mm_s
);
}
- void do_blocking_move_to_i(const_float_t ri, const_feedRate_t fr_mm_s/*=0.0*/) {
+ void do_blocking_move_to_i(const float ri, const feedRate_t fr_mm_s/*=0.0*/) {
do_blocking_move_to_xyz_i(current_position, ri, fr_mm_s);
}
#endif
#if HAS_J_AXIS
- void do_blocking_move_to_xyzi_j(const xyze_pos_t &raw, const_float_t j, const_feedRate_t fr_mm_s/*=0.0f*/) {
+ void do_blocking_move_to_xyzi_j(const xyze_pos_t &raw, const float j, const feedRate_t fr_mm_s/*=0.0f*/) {
do_blocking_move_to(
NUM_AXIS_LIST_(raw.x, raw.y, raw.z, raw.i, j, raw.k, raw.u, raw.v, raw.w)
fr_mm_s
);
}
- void do_blocking_move_to_j(const_float_t rj, const_feedRate_t fr_mm_s/*=0.0*/) {
+ void do_blocking_move_to_j(const float rj, const feedRate_t fr_mm_s/*=0.0*/) {
do_blocking_move_to_xyzi_j(current_position, rj, fr_mm_s);
}
#endif
#if HAS_K_AXIS
- void do_blocking_move_to_xyzij_k(const xyze_pos_t &raw, const_float_t k, const_feedRate_t fr_mm_s/*=0.0f*/) {
+ void do_blocking_move_to_xyzij_k(const xyze_pos_t &raw, const float k, const feedRate_t fr_mm_s/*=0.0f*/) {
do_blocking_move_to(
NUM_AXIS_LIST_(raw.x, raw.y, raw.z, raw.i, raw.j, k, raw.u, raw.v, raw.w)
fr_mm_s
);
}
- void do_blocking_move_to_k(const_float_t rk, const_feedRate_t fr_mm_s/*=0.0*/) {
+ void do_blocking_move_to_k(const float rk, const feedRate_t fr_mm_s/*=0.0*/) {
do_blocking_move_to_xyzij_k(current_position, rk, fr_mm_s);
}
#endif
#if HAS_U_AXIS
- void do_blocking_move_to_xyzijk_u(const xyze_pos_t &raw, const_float_t u, const_feedRate_t fr_mm_s/*=0.0f*/) {
+ void do_blocking_move_to_xyzijk_u(const xyze_pos_t &raw, const float u, const feedRate_t fr_mm_s/*=0.0f*/) {
do_blocking_move_to(
NUM_AXIS_LIST_(raw.x, raw.y, raw.z, raw.i, raw.j, raw.k, u, raw.v, raw.w)
fr_mm_s
);
}
- void do_blocking_move_to_u(const_float_t ru, const_feedRate_t fr_mm_s/*=0.0*/) {
+ void do_blocking_move_to_u(const float ru, const feedRate_t fr_mm_s/*=0.0*/) {
do_blocking_move_to_xyzijk_u(current_position, ru, fr_mm_s);
}
#endif
#if HAS_V_AXIS
- void do_blocking_move_to_xyzijku_v(const xyze_pos_t &raw, const_float_t v, const_feedRate_t fr_mm_s/*=0.0f*/) {
+ void do_blocking_move_to_xyzijku_v(const xyze_pos_t &raw, const float v, const feedRate_t fr_mm_s/*=0.0f*/) {
do_blocking_move_to(
NUM_AXIS_LIST_(raw.x, raw.y, raw.z, raw.i, raw.j, raw.k, raw.u, v, raw.w)
fr_mm_s
);
}
- void do_blocking_move_to_v(const_float_t rv, const_feedRate_t fr_mm_s/*=0.0*/) {
+ void do_blocking_move_to_v(const float rv, const feedRate_t fr_mm_s/*=0.0*/) {
do_blocking_move_to_xyzijku_v(current_position, rv, fr_mm_s);
}
#endif
#if HAS_W_AXIS
- void do_blocking_move_to_xyzijkuv_w(const xyze_pos_t &raw, const_float_t w, const_feedRate_t fr_mm_s/*=0.0f*/) {
+ void do_blocking_move_to_xyzijkuv_w(const xyze_pos_t &raw, const float w, const feedRate_t fr_mm_s/*=0.0f*/) {
do_blocking_move_to(
NUM_AXIS_LIST_(raw.x, raw.y, raw.z, raw.i, raw.j, raw.k, raw.u, raw.v, w)
fr_mm_s
);
}
- void do_blocking_move_to_w(const_float_t rw, const_feedRate_t fr_mm_s/*=0.0*/) {
+ void do_blocking_move_to_w(const float rw, const feedRate_t fr_mm_s/*=0.0*/) {
do_blocking_move_to_xyzijkuv_w(current_position, rw, fr_mm_s);
}
#endif
@@ -1653,7 +1633,7 @@ float get_move_distance(const xyze_pos_t &diff OPTARG(HAS_ROTATIONAL_AXES, bool
* small incremental moves. This allows the planner to
* apply more detailed bed leveling to the full move.
*/
- inline void segmented_line_to_destination(const_feedRate_t fr_mm_s, const float segment_size=LEVELED_SEGMENT_LENGTH) {
+ inline void segmented_line_to_destination(const feedRate_t fr_mm_s, const float segment_size=LEVELED_SEGMENT_LENGTH) {
const xyze_float_t diff = destination - current_position;
@@ -2876,7 +2856,7 @@ void set_axis_is_at_home(const AxisEnum axis) {
/**
* Set the home offset for an axis.
*/
- void set_home_offset(const AxisEnum axis, const_float_t v) {
+ void set_home_offset(const AxisEnum axis, const float v) {
home_offset[axis] = v;
}
#endif
diff --git a/Marlin/src/module/motion.h b/Marlin/src/module/motion.h
index edee41a903..ca318d8068 100644
--- a/Marlin/src/module/motion.h
+++ b/Marlin/src/module/motion.h
@@ -338,24 +338,24 @@ void sync_plan_position();
* Move the planner to the current position from wherever it last moved
* (or from wherever it has been told it is located).
*/
-void line_to_current_position(const_feedRate_t fr_mm_s=feedrate_mm_s);
+void line_to_current_position(const feedRate_t fr_mm_s=feedrate_mm_s);
#if HAS_EXTRUDERS
- void unscaled_e_move(const_float_t length, const_feedRate_t fr_mm_s);
+ void unscaled_e_move(const float length, const feedRate_t fr_mm_s);
#endif
void prepare_line_to_destination();
-void _internal_move_to_destination(const_feedRate_t fr_mm_s=0.0f OPTARG(IS_KINEMATIC, const bool is_fast=false));
+void _internal_move_to_destination(const feedRate_t fr_mm_s=0.0f OPTARG(IS_KINEMATIC, const bool is_fast=false));
-inline void prepare_internal_move_to_destination(const_feedRate_t fr_mm_s=0.0f) {
+inline void prepare_internal_move_to_destination(const feedRate_t fr_mm_s=0.0f) {
_internal_move_to_destination(fr_mm_s);
}
#if IS_KINEMATIC
- void prepare_fast_move_to_destination(const_feedRate_t scaled_fr_mm_s=MMS_SCALED(feedrate_mm_s));
+ void prepare_fast_move_to_destination(const feedRate_t scaled_fr_mm_s=MMS_SCALED(feedrate_mm_s));
- inline void prepare_internal_fast_move_to_destination(const_feedRate_t fr_mm_s=0.0f) {
+ inline void prepare_internal_fast_move_to_destination(const feedRate_t fr_mm_s=0.0f) {
_internal_move_to_destination(fr_mm_s, true);
}
#endif
@@ -363,56 +363,56 @@ inline void prepare_internal_move_to_destination(const_feedRate_t fr_mm_s=0.0f)
/**
* Blocking movement and shorthand functions
*/
-void do_blocking_move_to(NUM_AXIS_ARGS_(const_float_t) const_feedRate_t fr_mm_s=0.0f);
-void do_blocking_move_to(const xy_pos_t &raw, const_feedRate_t fr_mm_s=0.0f);
-void do_blocking_move_to(const xyz_pos_t &raw, const_feedRate_t fr_mm_s=0.0f);
-void do_blocking_move_to(const xyze_pos_t &raw, const_feedRate_t fr_mm_s=0.0f);
+void do_blocking_move_to(NUM_AXIS_ARGS_(const float) const feedRate_t fr_mm_s=0.0f);
+void do_blocking_move_to(const xy_pos_t &raw, const feedRate_t fr_mm_s=0.0f);
+void do_blocking_move_to(const xyz_pos_t &raw, const feedRate_t fr_mm_s=0.0f);
+void do_blocking_move_to(const xyze_pos_t &raw, const feedRate_t fr_mm_s=0.0f);
#if HAS_X_AXIS
- void do_blocking_move_to_x(const_float_t rx, const_feedRate_t fr_mm_s=0.0f);
+ void do_blocking_move_to_x(const float rx, const feedRate_t fr_mm_s=0.0f);
#endif
#if HAS_Y_AXIS
- void do_blocking_move_to_y(const_float_t ry, const_feedRate_t fr_mm_s=0.0f);
+ void do_blocking_move_to_y(const float ry, const feedRate_t fr_mm_s=0.0f);
#endif
#if HAS_Z_AXIS
- void do_blocking_move_to_z(const_float_t rz, const_feedRate_t fr_mm_s=0.0f);
+ void do_blocking_move_to_z(const float rz, const feedRate_t fr_mm_s=0.0f);
#endif
#if HAS_I_AXIS
- void do_blocking_move_to_i(const_float_t ri, const_feedRate_t fr_mm_s=0.0f);
- void do_blocking_move_to_xyz_i(const xyze_pos_t &raw, const_float_t i, const_feedRate_t fr_mm_s=0.0f);
+ void do_blocking_move_to_i(const float ri, const feedRate_t fr_mm_s=0.0f);
+ void do_blocking_move_to_xyz_i(const xyze_pos_t &raw, const float i, const feedRate_t fr_mm_s=0.0f);
#endif
#if HAS_J_AXIS
- void do_blocking_move_to_j(const_float_t rj, const_feedRate_t fr_mm_s=0.0f);
- void do_blocking_move_to_xyzi_j(const xyze_pos_t &raw, const_float_t j, const_feedRate_t fr_mm_s=0.0f);
+ void do_blocking_move_to_j(const float rj, const feedRate_t fr_mm_s=0.0f);
+ void do_blocking_move_to_xyzi_j(const xyze_pos_t &raw, const float j, const feedRate_t fr_mm_s=0.0f);
#endif
#if HAS_K_AXIS
- void do_blocking_move_to_k(const_float_t rk, const_feedRate_t fr_mm_s=0.0f);
- void do_blocking_move_to_xyzij_k(const xyze_pos_t &raw, const_float_t k, const_feedRate_t fr_mm_s=0.0f);
+ void do_blocking_move_to_k(const float rk, const feedRate_t fr_mm_s=0.0f);
+ void do_blocking_move_to_xyzij_k(const xyze_pos_t &raw, const float k, const feedRate_t fr_mm_s=0.0f);
#endif
#if HAS_U_AXIS
- void do_blocking_move_to_u(const_float_t ru, const_feedRate_t fr_mm_s=0.0f);
- void do_blocking_move_to_xyzijk_u(const xyze_pos_t &raw, const_float_t u, const_feedRate_t fr_mm_s=0.0f);
+ void do_blocking_move_to_u(const float ru, const feedRate_t fr_mm_s=0.0f);
+ void do_blocking_move_to_xyzijk_u(const xyze_pos_t &raw, const float u, const feedRate_t fr_mm_s=0.0f);
#endif
#if HAS_V_AXIS
- void do_blocking_move_to_v(const_float_t rv, const_feedRate_t fr_mm_s=0.0f);
- void do_blocking_move_to_xyzijku_v(const xyze_pos_t &raw, const_float_t v, const_feedRate_t fr_mm_s=0.0f);
+ void do_blocking_move_to_v(const float rv, const feedRate_t fr_mm_s=0.0f);
+ void do_blocking_move_to_xyzijku_v(const xyze_pos_t &raw, const float v, const feedRate_t fr_mm_s=0.0f);
#endif
#if HAS_W_AXIS
- void do_blocking_move_to_w(const_float_t rw, const_feedRate_t fr_mm_s=0.0f);
- void do_blocking_move_to_xyzijkuv_w(const xyze_pos_t &raw, const_float_t w, const_feedRate_t fr_mm_s=0.0f);
+ void do_blocking_move_to_w(const float rw, const feedRate_t fr_mm_s=0.0f);
+ void do_blocking_move_to_xyzijkuv_w(const xyze_pos_t &raw, const float w, const feedRate_t fr_mm_s=0.0f);
#endif
#if HAS_Y_AXIS
- void do_blocking_move_to_xy(const_float_t rx, const_float_t ry, const_feedRate_t fr_mm_s=0.0f);
- void do_blocking_move_to_xy(const xy_pos_t &raw, const_feedRate_t fr_mm_s=0.0f);
- FORCE_INLINE void do_blocking_move_to_xy(const xyz_pos_t &raw, const_feedRate_t fr_mm_s=0.0f) { do_blocking_move_to_xy(xy_pos_t(raw), fr_mm_s); }
- FORCE_INLINE void do_blocking_move_to_xy(const xyze_pos_t &raw, const_feedRate_t fr_mm_s=0.0f) { do_blocking_move_to_xy(xy_pos_t(raw), fr_mm_s); }
+ void do_blocking_move_to_xy(const float rx, const float ry, const feedRate_t fr_mm_s=0.0f);
+ void do_blocking_move_to_xy(const xy_pos_t &raw, const feedRate_t fr_mm_s=0.0f);
+ FORCE_INLINE void do_blocking_move_to_xy(const xyz_pos_t &raw, const feedRate_t fr_mm_s=0.0f) { do_blocking_move_to_xy(xy_pos_t(raw), fr_mm_s); }
+ FORCE_INLINE void do_blocking_move_to_xy(const xyze_pos_t &raw, const feedRate_t fr_mm_s=0.0f) { do_blocking_move_to_xy(xy_pos_t(raw), fr_mm_s); }
#endif
#if HAS_Z_AXIS
- void do_blocking_move_to_xy_z(const xy_pos_t &raw, const_float_t z, const_feedRate_t fr_mm_s=0.0f);
- FORCE_INLINE void do_blocking_move_to_xy_z(const xyz_pos_t &raw, const_float_t z, const_feedRate_t fr_mm_s=0.0f) { do_blocking_move_to_xy_z(xy_pos_t(raw), z, fr_mm_s); }
- FORCE_INLINE void do_blocking_move_to_xy_z(const xyze_pos_t &raw, const_float_t z, const_feedRate_t fr_mm_s=0.0f) { do_blocking_move_to_xy_z(xy_pos_t(raw), z, fr_mm_s); }
+ void do_blocking_move_to_xy_z(const xy_pos_t &raw, const float z, const feedRate_t fr_mm_s=0.0f);
+ FORCE_INLINE void do_blocking_move_to_xy_z(const xyz_pos_t &raw, const float z, const feedRate_t fr_mm_s=0.0f) { do_blocking_move_to_xy_z(xy_pos_t(raw), z, fr_mm_s); }
+ FORCE_INLINE void do_blocking_move_to_xy_z(const xyze_pos_t &raw, const float z, const feedRate_t fr_mm_s=0.0f) { do_blocking_move_to_xy_z(xy_pos_t(raw), z, fr_mm_s); }
#endif
void remember_feedrate_scaling_off();
@@ -426,8 +426,8 @@ void restore_feedrate_and_scaling();
#define Z_POST_CLEARANCE Z_CLEARANCE_FOR_HOMING
#endif
#endif
- void do_z_clearance(const_float_t zclear, const bool with_probe=true, const bool lower_allowed=false);
- void do_z_clearance_by(const_float_t zclear);
+ void do_z_clearance(const float zclear, const bool with_probe=true, const bool lower_allowed=false);
+ void do_z_clearance_by(const float zclear);
void do_move_after_z_homing();
inline void do_z_post_clearance() { do_z_clearance(Z_POST_CLEARANCE); }
#else
@@ -569,16 +569,16 @@ void home_if_needed(const bool keeplev=false);
#endif
// Return true if the given point is within the printable area
- bool position_is_reachable(const_float_t rx, const_float_t ry, const float inset=0);
+ bool position_is_reachable(const float rx, const float ry, const float inset=0.0f);
- inline bool position_is_reachable(const xy_pos_t &pos, const float inset=0) {
+ inline bool position_is_reachable(const xy_pos_t &pos, const float inset=0.0f) {
return position_is_reachable(pos.x, pos.y, inset);
}
#else
// Return true if the given position is within the machine bounds.
- bool position_is_reachable(TERN_(HAS_X_AXIS, const_float_t rx) OPTARG(HAS_Y_AXIS, const_float_t ry));
+ bool position_is_reachable(TERN_(HAS_X_AXIS, const float rx) OPTARG(HAS_Y_AXIS, const float ry));
inline bool position_is_reachable(const xy_pos_t &pos) {
return position_is_reachable(TERN_(HAS_X_AXIS, pos.x) OPTARG(HAS_Y_AXIS, pos.y));
}
@@ -636,7 +636,7 @@ void home_if_needed(const bool keeplev=false);
#endif
#if HAS_HOME_OFFSET
- void set_home_offset(const AxisEnum axis, const_float_t v);
+ void set_home_offset(const AxisEnum axis, const float v);
#endif
//
diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp
index 156ab142f9..f1317b0780 100644
--- a/Marlin/src/module/planner.cpp
+++ b/Marlin/src/module/planner.cpp
@@ -142,7 +142,7 @@ planner_settings_t Planner::settings; // Initialized by settings.load
/**
* Set up inline block variables
- * Set laser_power_floor based on SPEED_POWER_MIN to pevent a zero power output state with LASER_POWER_TRAP
+ * Set laser_power_floor based on SPEED_POWER_MIN to prevent a zero power output state with LASER_POWER_TRAP
*/
#if ENABLED(LASER_FEATURE)
laser_state_t Planner::laser_inline; // Current state for blocks
@@ -799,7 +799,7 @@ block_t* Planner::get_future_block(const uint8_t offset) {
* NOT BUSY and it is marked as RECALCULATE. That WARRANTIES the Stepper ISR
* is not and will not use the block while we modify it.
*/
-void Planner::calculate_trapezoid_for_block(block_t * const block, const_float_t entry_speed, const_float_t exit_speed) {
+void Planner::calculate_trapezoid_for_block(block_t * const block, const float entry_speed, const float exit_speed) {
const float spmm = block->steps_per_mm;
uint32_t initial_rate = entry_speed ? LROUND(entry_speed * spmm) : block->initial_rate,
@@ -1006,7 +1006,7 @@ void Planner::calculate_trapezoid_for_block(block_t * const block, const_float_t
// The kernel called by recalculate() when scanning the plan from last to first entry.
// Returns true if it could increase the current block's entry speed.
-bool Planner::reverse_pass_kernel(block_t * const current, const block_t * const next, const_float_t safe_exit_speed_sqr) {
+bool Planner::reverse_pass_kernel(block_t * const current, const block_t * const next, const float safe_exit_speed_sqr) {
// We need to recalculate only for the last block added or if next->entry_speed_sqr changed.
if (!next || next->flag.recalculate) {
// And only if we're not already at max entry speed.
@@ -1045,7 +1045,7 @@ bool Planner::reverse_pass_kernel(block_t * const current, const block_t * const
* coarsely maximizes the entry speeds starting from last block.
* Requires there's at least one block with flag.recalculate in the buffer.
*/
-void Planner::reverse_pass(const_float_t safe_exit_speed_sqr) {
+void Planner::reverse_pass(const float safe_exit_speed_sqr) {
// Initialize block index to the last block in the planner buffer.
// This last block will have flag.recalculate set.
uint8_t block_index = prev_block_index(block_buffer_head);
@@ -1107,7 +1107,7 @@ void Planner::forward_pass_kernel(const block_t * const previous, block_t * cons
* Do the forward pass and recalculate the trapezoid speed profiles for all blocks in the plan
* according to entry/exit speeds.
*/
-void Planner::recalculate_trapezoids(const_float_t safe_exit_speed_sqr) {
+void Planner::recalculate_trapezoids(const float safe_exit_speed_sqr) {
// Start with the block that's about to execute or is executing.
uint8_t block_index = block_buffer_tail,
head_block_index = block_buffer_head;
@@ -1182,7 +1182,7 @@ void Planner::recalculate_trapezoids(const_float_t safe_exit_speed_sqr) {
}
// Requires there's at least one block with flag.recalculate in the buffer
-void Planner::recalculate(const_float_t safe_exit_speed_sqr) {
+void Planner::recalculate(const float safe_exit_speed_sqr) {
reverse_pass(safe_exit_speed_sqr);
// The forward pass is done as part of recalculate_trapezoids()
recalculate_trapezoids(safe_exit_speed_sqr);
@@ -1421,7 +1421,7 @@ void Planner::check_axes_activity() {
* This is the reciprocal of the circular cross-section area.
* Return 1.0 with volumetric off or a diameter of 0.0.
*/
- inline float calculate_volumetric_multiplier(const_float_t diameter) {
+ inline float calculate_volumetric_multiplier(const float diameter) {
return (parser.volumetric_enabled && diameter) ? 1.0f / CIRCLE_AREA(diameter * 0.5f) : 1;
}
@@ -2097,6 +2097,8 @@ bool Planner::_populate_block(
TERN_(BACKLASH_COMPENSATION, backlash.add_correction_steps(dist, dm, block));
}
+ TERN_(FT_MOTION, block->dist_mm = dist_mm); // Store the distance for all axes in mm for this block
+
TERN_(HAS_EXTRUDERS, block->steps.e = esteps);
block->step_event_count = (
@@ -2377,8 +2379,8 @@ bool Planner::_populate_block(
const float steps_per_mm = block->step_event_count * inverse_millimeters;
block->steps_per_mm = steps_per_mm;
uint32_t accel;
- #if ENABLED(LIN_ADVANCE)
- bool use_advance_lead = false;
+ #if ANY(LIN_ADVANCE, FTM_HAS_LIN_ADVANCE)
+ bool use_adv_lead = false;
#endif
if (!ANY_AXIS_MOVES(block)) { // Is this a retract / recover move?
accel = CEIL(settings.retract_acceleration * steps_per_mm); // Convert to: acceleration steps/sec^2
@@ -2401,45 +2403,50 @@ bool Planner::_populate_block(
// Start with print or travel acceleration
accel = CEIL((esteps ? settings.acceleration : settings.travel_acceleration) * steps_per_mm);
- #if ENABLED(LIN_ADVANCE)
+ #if ANY(LIN_ADVANCE, FTM_HAS_LIN_ADVANCE)
// Linear advance is currently not ready for HAS_I_AXIS
#define MAX_E_JERK(N) TERN(HAS_LINEAR_E_JERK, max_e_jerk[E_INDEX_N(N)], max_jerk.e)
/**
- * Use LIN_ADVANCE for blocks if all these are true:
- *
- * esteps : This is a print move, because we checked for A, B, C steps before.
- *
- * extruder_advance_K[extruder] : There is an advance factor set for this extruder.
- *
- * dm.e : Extruder is running forward (e.g., for "Wipe while retracting" (Slic3r) or "Combing" (Cura) moves)
+ * Apply Linear/Pressure Advance for blocks when:
+ * !!esteps : This is a print move, because we checked for A, B, C steps before.
+ * !!dm.e : Extruder is running forward (e.g., for "Wipe while retracting" (Slic3r) or "Combing" (Cura) moves)
+ * ...then...
+ * !!advanceK : There is an Advance K set so Linear/Pressure Advance is active.
+ * Check the appropriate K value for Standard or Fixed-Time Motion.
*/
- use_advance_lead = esteps && extruder_advance_K[E_INDEX_N(extruder)] && dm.e;
+ if (esteps && dm.e) {
+ const bool ftm_active = TERN0(FTM_HAS_LIN_ADVANCE, ftMotion.cfg.active);
+ const float advK = TERN_(FTM_HAS_LIN_ADVANCE, ftm_active ? ftMotion.cfg.linearAdvK :) TERN0(LIN_ADVANCE, extruder_advance_K[E_INDEX_N(extruder)]);
+ if (advK) {
+ float e_D_ratio = (target_float.e - position_float.e) /
+ TERN(IS_KINEMATIC, block->millimeters,
+ SQRT(sq(target_float.x - position_float.x)
+ + sq(target_float.y - position_float.y)
+ + sq(target_float.z - position_float.z))
+ );
- if (use_advance_lead) {
- float e_D_ratio = (target_float.e - position_float.e) /
- TERN(IS_KINEMATIC, block->millimeters,
- SQRT(sq(target_float.x - position_float.x)
- + sq(target_float.y - position_float.y)
- + sq(target_float.z - position_float.z))
- );
-
- // Check for unusual high e_D ratio to detect if a retract move was combined with the last print move due to min. steps per segment. Never execute this with advance!
- // This assumes no one will use a retract length of 0mm < retr_length < ~0.2mm and no one will print 100mm wide lines using 3mm filament or 35mm wide lines using 1.75mm filament.
- if (e_D_ratio > 3.0f)
- use_advance_lead = false;
- else {
- #if HAS_ROUGH_LIN_ADVANCE
- // Scale E acceleration so that it will be possible to jump to the advance speed.
- const uint32_t max_accel_steps_per_s2 = MAX_E_JERK(extruder) / (extruder_advance_K[E_INDEX_N(extruder)] * e_D_ratio) * steps_per_mm;
- if (accel > max_accel_steps_per_s2) {
- accel = max_accel_steps_per_s2;
- if (TERN0(LA_DEBUG, DEBUGGING(INFO))) SERIAL_ECHOLNPGM("Acceleration limited.");
+ // Stay below an unusually high e_D ratio, a retract move combined with the last print move (due to min steps per segment).
+ // Never execute this with advance!
+ // This assumes no one will use a retract length of 0mm < retr_length < ~0.2mm
+ // and no one will print 100mm wide lines using 3mm filament or 35mm wide lines using 1.75mm filament.
+ use_adv_lead = e_D_ratio <= 3.0f;
+ if (use_adv_lead) {
+ if (TERN0(HAS_ROUGH_LIN_ADVANCE, !ftm_active)) {
+ // Scale E acceleration so that it will be possible to jump to the advance speed.
+ const uint32_t max_accel_steps_per_s2 = (MAX_E_JERK(extruder) / (advK * e_D_ratio)) * steps_per_mm;
+ if (accel > max_accel_steps_per_s2) {
+ accel = max_accel_steps_per_s2;
+ if (TERN0(LA_DEBUG, DEBUGGING(INFO))) SERIAL_ECHOLNPGM("Acceleration limited.");
+ }
}
- #endif
+ }
}
+ #if ANY(SMOOTH_LIN_ADVANCE, FTM_HAS_LIN_ADVANCE)
+ block->use_advance_lead = use_adv_lead;
+ #endif
}
- #endif // LIN_ADVANCE
+ #endif // LIN_ADVANCE || FTM_HAS_LIN_ADVANCE
// Limit acceleration per axis
if (block->step_event_count <= acceleration_long_cutoff) {
@@ -2468,7 +2475,7 @@ bool Planner::_populate_block(
#if HAS_ROUGH_LIN_ADVANCE
block->la_advance_rate = 0;
block->la_scaling = 0;
- if (use_advance_lead) {
+ if (use_adv_lead) {
// The Bresenham algorithm will convert this step rate into extruder steps
block->la_advance_rate = extruder_advance_K[E_INDEX_N(extruder)] * block->acceleration_steps_per_s2;
@@ -2482,7 +2489,6 @@ bool Planner::_populate_block(
SERIAL_ECHOLNPGM("eISR running at > 10kHz: ", block->la_advance_rate);
}
#elif ENABLED(SMOOTH_LIN_ADVANCE)
- block->use_advance_lead = use_advance_lead;
const uint32_t ratio = (uint64_t(block->steps.e) * _BV32(30)) / block->step_event_count;
block->e_step_ratio_q30 = block->direction_bits.e ? ratio : -ratio;
@@ -2507,7 +2513,7 @@ bool Planner::_populate_block(
* Compute maximum allowable entry speed at junction by centripetal acceleration approximation.
* Let a circle be tangent to both previous and current path line segments, where the junction
* deviation is defined as the distance from the junction to the closest edge of the circle,
- * colinear with the circle center. The circular segment joining the two paths represents the
+ * collinear with the circle center. The circular segment joining the two paths represents the
* path of centripetal acceleration. Solve for max velocity based on max acceleration about the
* radius of the circle, defined indirectly by junction deviation. This may be also viewed as
* path width or max_jerk in the previous Grbl version. This approach does not actually deviate
@@ -2864,7 +2870,7 @@ void Planner::buffer_sync_block(const BlockFlagBit sync_flag/*=BLOCK_BIT_SYNC_PO
*/
bool Planner::buffer_segment(const abce_pos_t &abce
OPTARG(HAS_DIST_MM_ARG, const xyze_float_t &cart_dist_mm)
- , const_feedRate_t fr_mm_s
+ , const feedRate_t fr_mm_s
, const uint8_t extruder/*=active_extruder*/
, const PlannerHints &hints/*=PlannerHints()*/
) {
@@ -2989,7 +2995,7 @@ bool Planner::buffer_segment(const abce_pos_t &abce
* @param extruder Optional target extruder (otherwise active_extruder)
* @param hints Optional parameters to aid planner calculations
*/
-bool Planner::buffer_line(const xyze_pos_t &cart, const_feedRate_t fr_mm_s
+bool Planner::buffer_line(const xyze_pos_t &cart, const feedRate_t fr_mm_s
, const uint8_t extruder/*=active_extruder*/
, const PlannerHints &hints/*=PlannerHints()*/
) {
@@ -3191,7 +3197,7 @@ void Planner::set_machine_position_mm(const abce_pos_t &abce) {
/**
* Set the machine positions in millimeters (soon) given the native position.
- * Synchonized with the planner queue.
+ * Synchronized with the planner queue.
*
* - Modifiers are applied for skew, leveling, retract, etc.
* - Kinematics are applied to remap cartesian positions to stepper positions.
@@ -3215,7 +3221,7 @@ void Planner::set_position_mm(const xyze_pos_t &xyze) {
/**
* Special setter for planner E position (also setting E stepper position).
*/
- void Planner::set_e_position_mm(const_float_t e) {
+ void Planner::set_e_position_mm(const float e) {
const uint8_t axis_index = E_AXIS_N(active_extruder);
TERN_(DISTINCT_E_FACTORS, last_extruder = active_extruder);
diff --git a/Marlin/src/module/planner.h b/Marlin/src/module/planner.h
index eb8f2ed17f..0ad68352ee 100644
--- a/Marlin/src/module/planner.h
+++ b/Marlin/src/module/planner.h
@@ -266,11 +266,16 @@ typedef struct PlannerBlock {
AxisBits direction_bits; // Direction bits set for this block, where 1 is negative motion
- // Advance extrusion
+ #if ENABLED(FT_MOTION)
+ xyze_pos_t dist_mm; // The distance traveled in mm along each axis
+ #endif
+
+ #if ANY(SMOOTH_LIN_ADVANCE, FTM_HAS_LIN_ADVANCE)
+ bool use_advance_lead; // Linear / Pressure Advance extrusion
+ #endif
+
#if ENABLED(LIN_ADVANCE)
- #if ENABLED(SMOOTH_LIN_ADVANCE)
- bool use_advance_lead;
- #else
+ #if HAS_ROUGH_LIN_ADVANCE
uint32_t la_advance_rate; // The rate at which steps are added whilst accelerating
uint8_t la_scaling; // Scale ISR frequency down and step frequency up by 2 ^ la_scaling
uint16_t max_adv_steps, // Max advance steps to get cruising speed pressure
@@ -316,7 +321,7 @@ typedef struct PlannerBlock {
} block_t;
-#if ANY(LIN_ADVANCE, FEEDRATE_SCALING, GRADIENT_MIX, LCD_SHOW_E_TOTAL, POWER_LOSS_RECOVERY)
+#if ANY(LIN_ADVANCE, FTM_HAS_LIN_ADVANCE, FEEDRATE_SCALING, GRADIENT_MIX, LCD_SHOW_E_TOTAL, POWER_LOSS_RECOVERY)
#define HAS_POSITION_FLOAT 1
#endif
@@ -435,7 +440,7 @@ struct PlannerHints {
// False if no movement of the tool center point relative to the work piece occurs
// (i.e. the tool rotates around the tool centerpoint)
#endif
- PlannerHints(const_float_t mm=0.0f) : millimeters(mm) {}
+ PlannerHints(const float mm=0.0f) : millimeters(mm) {}
};
class Planner {
@@ -527,7 +532,7 @@ class Planner {
#if ENABLED(LIN_ADVANCE)
static float extruder_advance_K[DISTINCT_E];
- static void set_advance_k(const_float_t k, const uint8_t e=active_extruder) {
+ static void set_advance_k(const float k, const uint8_t e=active_extruder) {
UNUSED(e);
extruder_advance_K[E_INDEX_N(e)] = k;
TERN_(SMOOTH_LIN_ADVANCE, extruder_advance_K_q27[E_INDEX_N(e)] = k * _BV32(27));
@@ -542,7 +547,7 @@ class Planner {
return extruder_advance_K_q27[E_INDEX_N(e)];
}
#endif
- #endif
+ #endif // LIN_ADVANCE
/**
* The current position of the tool in absolute steps
@@ -655,7 +660,7 @@ class Planner {
#if ENABLED(CLASSIC_JERK)
static void set_max_jerk(const AxisEnum axis, float inMaxJerkMMS);
#else
- static void set_max_jerk(const AxisEnum, const_float_t) {}
+ static void set_max_jerk(const AxisEnum, const float) {}
#endif
#if HAS_EXTRUDERS
@@ -709,7 +714,7 @@ class Planner {
static void calculate_volumetric_extruder_limits();
#endif
- FORCE_INLINE static void set_filament_size(const uint8_t e, const_float_t v) {
+ FORCE_INLINE static void set_filament_size(const uint8_t e, const float v) {
filament_size[e] = v;
if (v > 0) volumetric_area_nominal = CIRCLE_AREA(v * 0.5); //TODO: should it be per extruder
// make sure all extruders have some sane value for the filament size
@@ -720,7 +725,7 @@ class Planner {
#endif
#if ENABLED(VOLUMETRIC_EXTRUDER_LIMIT)
- FORCE_INLINE static void set_volumetric_extruder_limit(const uint8_t e, const_float_t v) {
+ FORCE_INLINE static void set_volumetric_extruder_limit(const uint8_t e, const float v) {
volumetric_extruder_limit[e] = v;
calculate_volumetric_extruder_limit(e);
}
@@ -735,7 +740,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 float fade_scaling_factor_for_z(const_float_t rz) {
+ static float fade_scaling_factor_for_z(const float rz) {
static float z_fade_factor = 1;
if (!z_fade_height || rz <= 0) return 1;
if (rz >= z_fade_height) return 0;
@@ -748,27 +753,27 @@ class Planner {
FORCE_INLINE static void force_fade_recalc() { last_fade_z = -999.999f; }
- FORCE_INLINE static void set_z_fade_height(const_float_t zfh) {
+ FORCE_INLINE static void set_z_fade_height(const float zfh) {
z_fade_height = zfh > 0 ? zfh : 0;
inverse_z_fade_height = RECIPROCAL(z_fade_height);
force_fade_recalc();
}
- FORCE_INLINE static bool leveling_active_at_z(const_float_t rz) {
+ FORCE_INLINE static bool leveling_active_at_z(const float rz) {
return !z_fade_height || rz < z_fade_height;
}
#else
- FORCE_INLINE static float fade_scaling_factor_for_z(const_float_t) { return 1; }
+ FORCE_INLINE static float fade_scaling_factor_for_z(const float) { return 1; }
- FORCE_INLINE static bool leveling_active_at_z(const_float_t) { return true; }
+ FORCE_INLINE static bool leveling_active_at_z(const float) { return true; }
#endif
#if ENABLED(SKEW_CORRECTION)
- FORCE_INLINE static void skew(float &cx, float &cy, const_float_t cz) {
+ FORCE_INLINE static void skew(float &cx, float &cy, const float cz) {
if (COORDINATE_OKAY(cx, X_MIN_POS + 1, X_MAX_POS) && COORDINATE_OKAY(cy, Y_MIN_POS + 1, Y_MAX_POS)) {
const float sx = cx - cy * skew_factor.xy - cz * (skew_factor.xz - (skew_factor.xy * skew_factor.yz)),
sy = cy - cz * skew_factor.yz;
@@ -779,7 +784,7 @@ class Planner {
}
FORCE_INLINE static void skew(xyz_pos_t &raw) { skew(raw.x, raw.y, raw.z); }
- FORCE_INLINE static void unskew(float &cx, float &cy, const_float_t cz) {
+ FORCE_INLINE static void unskew(float &cx, float &cy, const float cz) {
if (COORDINATE_OKAY(cx, X_MIN_POS, X_MAX_POS) && COORDINATE_OKAY(cy, Y_MIN_POS, Y_MAX_POS)) {
const float sx = cx + cy * skew_factor.xy + cz * skew_factor.xz,
sy = cy + cz * skew_factor.yz;
@@ -955,7 +960,7 @@ class Planner {
*/
static bool buffer_segment(const abce_pos_t &abce
OPTARG(HAS_DIST_MM_ARG, const xyze_float_t &cart_dist_mm)
- , const_feedRate_t fr_mm_s
+ , const feedRate_t fr_mm_s
, const uint8_t extruder=active_extruder
, const PlannerHints &hints=PlannerHints()
);
@@ -974,7 +979,7 @@ class Planner {
*
* @return false if no segment was queued due to cleaning, cold extrusion, full queue, etc...
*/
- static bool buffer_line(const xyze_pos_t &cart, const_feedRate_t fr_mm_s
+ static bool buffer_line(const xyze_pos_t &cart, const feedRate_t fr_mm_s
, const uint8_t extruder=active_extruder
, const PlannerHints &hints=PlannerHints()
);
@@ -999,7 +1004,7 @@ class Planner {
static void set_position_mm(const xyze_pos_t &xyze);
#if HAS_EXTRUDERS
- static void set_e_position_mm(const_float_t e);
+ static void set_e_position_mm(const float e);
#endif
/**
@@ -1134,7 +1139,7 @@ class Planner {
* to reach 'target_velocity_sqr' using 'acceleration' within a given
* 'distance'.
*/
- static float max_allowable_speed_sqr(const_float_t accel, const_float_t target_velocity_sqr, const_float_t distance) {
+ static float max_allowable_speed_sqr(const float accel, const float target_velocity_sqr, const float distance) {
return target_velocity_sqr - 2 * accel * distance;
}
@@ -1142,21 +1147,21 @@ class Planner {
/**
* Calculate the speed reached given initial speed, acceleration and distance
*/
- static float final_speed(const_float_t initial_velocity, const_float_t accel, const_float_t distance) {
+ static float final_speed(const float initial_velocity, const float accel, const float distance) {
return SQRT(sq(initial_velocity) + 2 * accel * distance);
}
#endif
- static void calculate_trapezoid_for_block(block_t * const block, const_float_t entry_speed, const_float_t exit_speed);
+ static void calculate_trapezoid_for_block(block_t * const block, const float entry_speed, const float exit_speed);
- static bool reverse_pass_kernel(block_t * const current, const block_t * const next, const_float_t safe_exit_speed_sqr);
+ static bool reverse_pass_kernel(block_t * const current, const block_t * const next, const float safe_exit_speed_sqr);
static void forward_pass_kernel(const block_t * const previous, block_t * const current);
- static void reverse_pass(const_float_t safe_exit_speed_sqr);
+ static void reverse_pass(const float safe_exit_speed_sqr);
- static void recalculate_trapezoids(const_float_t safe_exit_speed_sqr);
+ static void recalculate_trapezoids(const float safe_exit_speed_sqr);
- static void recalculate(const_float_t safe_exit_speed_sqr);
+ static void recalculate(const float safe_exit_speed_sqr);
#if IS_KINEMATIC
// Allow do_homing_move to access internal functions, such as buffer_segment.
@@ -1171,7 +1176,7 @@ class Planner {
vector *= RSQRT(magnitude_sq);
}
- FORCE_INLINE static float limit_value_by_axis_maximum(const_float_t max_value, xyze_float_t &unit_vec) {
+ FORCE_INLINE static float limit_value_by_axis_maximum(const float max_value, xyze_float_t &unit_vec) {
float limit_value = max_value;
LOOP_LOGICAL_AXES(idx) {
if (unit_vec[idx]) {
diff --git a/Marlin/src/module/planner_bezier.cpp b/Marlin/src/module/planner_bezier.cpp
index a3f98435d0..bc39d278f1 100644
--- a/Marlin/src/module/planner_bezier.cpp
+++ b/Marlin/src/module/planner_bezier.cpp
@@ -43,15 +43,15 @@
#define SIGMA 0.1f
// Compute the linear interpolation between two real numbers.
-static inline float interp(const_float_t a, const_float_t b, const_float_t t) { return (1 - t) * a + t * b; }
+static inline float interp(const float a, const float b, const float t) { return (1 - t) * a + t * b; }
/**
* Compute a Bézier curve using the De Casteljau's algorithm (see
* https://en.wikipedia.org/wiki/De_Casteljau%27s_algorithm), which is
* easy to code and has good numerical stability (very important,
- * since Arudino works with limited precision real numbers).
+ * since Arduino works with limited precision real numbers).
*/
-static inline float eval_bezier(const_float_t a, const_float_t b, const_float_t c, const_float_t d, const_float_t t) {
+static inline float eval_bezier(const float a, const float b, const float c, const float d, const float t) {
const float iab = interp(a, b, t),
ibc = interp(b, c, t),
icd = interp(c, d, t),
@@ -64,7 +64,7 @@ static inline float eval_bezier(const_float_t a, const_float_t b, const_float_t
* We approximate Euclidean distance with the sum of the coordinates
* offset (so-called "norm 1"), which is quicker to compute.
*/
-static inline float dist1(const_float_t x1, const_float_t y1, const_float_t x2, const_float_t y2) { return ABS(x1 - x2) + ABS(y1 - y2); }
+static inline float dist1(const float x1, const float y1, const float x2, const float y2) { return ABS(x1 - x2) + ABS(y1 - y2); }
/**
* The algorithm for computing the step is loosely based on the one in Kig
@@ -109,7 +109,7 @@ void cubic_b_spline(
const xyze_pos_t &position, // current position
const xyze_pos_t &target, // target position
const xy_pos_t (&offsets)[2], // a pair of offsets
- const_feedRate_t scaled_fr_mm_s, // mm/s scaled by feedrate %
+ const feedRate_t scaled_fr_mm_s, // mm/s scaled by feedrate %
const uint8_t extruder
) {
// Absolute first and second control points are recovered.
diff --git a/Marlin/src/module/planner_bezier.h b/Marlin/src/module/planner_bezier.h
index eb48cf5e1a..3ce08f558f 100644
--- a/Marlin/src/module/planner_bezier.h
+++ b/Marlin/src/module/planner_bezier.h
@@ -33,6 +33,6 @@ void cubic_b_spline(
const xyze_pos_t &position, // current position
const xyze_pos_t &target, // target position
const xy_pos_t (&offsets)[2], // a pair of offsets
- const_feedRate_t scaled_fr_mm_s, // mm/s scaled by feedrate %
+ const feedRate_t scaled_fr_mm_s, // mm/s scaled by feedrate %
const uint8_t extruder
);
diff --git a/Marlin/src/module/polar.cpp b/Marlin/src/module/polar.cpp
index 4fbd33cccf..fb35ae9f58 100644
--- a/Marlin/src/module/polar.cpp
+++ b/Marlin/src/module/polar.cpp
@@ -54,7 +54,7 @@ float absoluteAngle(float a) {
return a;
}
-void forward_kinematics(const_float_t r, const_float_t theta) {
+void forward_kinematics(const float r, const float theta) {
const float absTheta = absoluteAngle(theta);
float radius = r;
if (polar_center_offset > 0.0) radius = SQRT( ABS( sq(r) - sq(-polar_center_offset) ) );
diff --git a/Marlin/src/module/polar.h b/Marlin/src/module/polar.h
index 79fbd4194d..b3105f886b 100644
--- a/Marlin/src/module/polar.h
+++ b/Marlin/src/module/polar.h
@@ -30,7 +30,7 @@
extern float segments_per_second;
float absoluteAngle(float a);
-void forward_kinematics(const_float_t r, const_float_t theta);
+void forward_kinematics(const float r, const float theta);
void inverse_kinematics(const xyz_pos_t &raw);
void polar_report_positions();
diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp
index 8cacc7dfc2..758d2300bc 100644
--- a/Marlin/src/module/probe.cpp
+++ b/Marlin/src/module/probe.cpp
@@ -613,7 +613,7 @@ bool Probe::set_deployed(const bool deploy, const bool no_return/*=false*/) {
*
* @return TRUE if the probe failed to trigger.
*/
-bool Probe::probe_down_to_z(const_float_t z, const_feedRate_t fr_mm_s) {
+bool Probe::probe_down_to_z(const float z, const feedRate_t fr_mm_s) {
DEBUG_SECTION(log_probe, "Probe::probe_down_to_z", DEBUGGING(LEVELING));
#if ALL(HAS_HEATED_BED, WAIT_FOR_BED_HEATER)
@@ -774,12 +774,12 @@ bool Probe::probe_down_to_z(const_float_t z, const_feedRate_t fr_mm_s) {
*
* @return The Z position of the bed at the current XY or NAN on error.
*/
-float Probe::run_z_probe(const bool sanity_check/*=true*/, const_float_t z_min_point/*=Z_PROBE_LOW_POINT*/, const_float_t z_clearance/*=Z_TWEEN_SAFE_CLEARANCE*/) {
+float Probe::run_z_probe(const bool sanity_check/*=true*/, const float z_min_point/*=Z_PROBE_LOW_POINT*/, const float z_clearance/*=Z_TWEEN_SAFE_CLEARANCE*/) {
DEBUG_SECTION(log_probe, "Probe::run_z_probe", DEBUGGING(LEVELING));
const float zoffs = SUM_TERN(HAS_HOTEND_OFFSET, -offset.z, hotend_offset[active_extruder].z);
- auto try_to_probe = [&](PGM_P const plbl, const_float_t z_probe_low_point, const feedRate_t fr_mm_s, const bool scheck) -> bool {
+ auto try_to_probe = [&](PGM_P const plbl, const float z_probe_low_point, const feedRate_t fr_mm_s, const bool scheck) -> bool {
constexpr float error_tolerance = Z_PROBE_ERROR_TOLERANCE;
if (DEBUGGING(LEVELING)) {
DEBUG_ECHOPGM_P(plbl);
@@ -966,13 +966,13 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/, const_float_t z_min_p
*
*/
float Probe::probe_at_point(
- const_float_t rx, const_float_t ry,
+ const float rx, const float ry,
const ProbePtRaise raise_after, // = PROBE_PT_NONE
const uint8_t verbose_level, // = 0
const bool probe_relative, // = true
const bool sanity_check, // = true
- const_float_t z_min_point, // = Z_PROBE_LOW_POINT
- const_float_t z_clearance, // = Z_TWEEN_SAFE_CLEARANCE
+ const float z_min_point, // = Z_PROBE_LOW_POINT
+ const float z_clearance, // = Z_TWEEN_SAFE_CLEARANCE
const bool raise_after_is_rel // = false
) {
DEBUG_SECTION(log_probe, "Probe::probe_at_point", DEBUGGING(LEVELING));
@@ -1100,7 +1100,7 @@ float Probe::probe_at_point(
/**
* Set the sensorless Z offset
*/
- void Probe::set_offset_sensorless_adj(const_float_t sz) {
+ void Probe::set_offset_sensorless_adj(const float sz) {
DEBUG_SECTION(pso, "Probe::set_offset_sensorless_adj", true);
if (test_sensitivity.x) offset_sensorless_adj.a = sz;
if (test_sensitivity.y) offset_sensorless_adj.b = sz;
diff --git a/Marlin/src/module/probe.h b/Marlin/src/module/probe.h
index 08a02b4d40..8d9133ab15 100644
--- a/Marlin/src/module/probe.h
+++ b/Marlin/src/module/probe.h
@@ -100,7 +100,7 @@ public:
#if HAS_PROBE_XY_OFFSET
// Return true if the both nozzle and the probe can reach the given point.
// Note: This won't work on SCARA since the probe offset rotates with the arm.
- static bool can_reach(const_float_t rx, const_float_t ry, const bool probe_relative=true) {
+ static bool can_reach(const float rx, const float ry, const bool probe_relative=true) {
if (probe_relative) {
return position_is_reachable(rx - offset_xy.x, ry - offset_xy.y) // The nozzle can go where it needs to go?
&& position_is_reachable(rx, ry, PROBING_MARGIN); // Can the probe also go near there?
@@ -111,7 +111,7 @@ public:
}
}
#else
- static bool can_reach(const_float_t rx, const_float_t ry, const bool=true) {
+ static bool can_reach(const float rx, const float ry, const bool=true) {
return position_is_reachable(rx, ry)
&& position_is_reachable(rx, ry, PROBING_MARGIN);
}
@@ -119,7 +119,7 @@ public:
#else // !IS_KINEMATIC
- static bool obstacle_check(const_float_t rx, const_float_t ry) {
+ static bool obstacle_check(const float rx, const float ry) {
#if ENABLED(AVOID_OBSTACLES)
#ifdef OBSTACLE1
constexpr float obst1[] = OBSTACLE1;
@@ -152,7 +152,7 @@ public:
* Example: For a probe offset of -10,+10, then for the probe to reach 0,0 the
* nozzle must be be able to reach +10,-10.
*/
- static bool can_reach(const_float_t rx, const_float_t ry, const bool probe_relative=true) {
+ static bool can_reach(const float rx, const float ry, const bool probe_relative=true) {
if (probe_relative) {
return position_is_reachable(rx - offset_xy.x, ry - offset_xy.y)
&& COORDINATE_OKAY(rx, min_x() - fslop, max_x() + fslop)
@@ -172,14 +172,14 @@ public:
#endif // !IS_KINEMATIC
static float probe_at_point(
- const_float_t rx,
- const_float_t ry,
+ const float rx,
+ const float ry,
const ProbePtRaise raise_after = PROBE_PT_NONE,
const uint8_t verbose_level = 0,
const bool probe_relative = true,
const bool sanity_check = true,
- const_float_t z_min_point = Z_PROBE_LOW_POINT,
- const_float_t z_clearance = Z_TWEEN_SAFE_CLEARANCE,
+ const float z_min_point = Z_PROBE_LOW_POINT,
+ const float z_clearance = Z_TWEEN_SAFE_CLEARANCE,
const bool raise_after_is_rel = false
);
@@ -189,8 +189,8 @@ public:
const uint8_t verbose_level = 0,
const bool probe_relative = true,
const bool sanity_check = true,
- const_float_t z_min_point = Z_PROBE_LOW_POINT,
- const_float_t z_clearance = Z_TWEEN_SAFE_CLEARANCE,
+ const float z_min_point = Z_PROBE_LOW_POINT,
+ const float z_clearance = Z_TWEEN_SAFE_CLEARANCE,
const bool raise_after_is_rel = false
) {
return probe_at_point(pos.x, pos.y, raise_after, verbose_level, probe_relative, sanity_check, z_min_point, z_clearance, raise_after_is_rel);
@@ -202,7 +202,7 @@ public:
static bool set_deployed(const bool, const bool=false) { return false; }
- static bool can_reach(const_float_t rx, const_float_t ry, const bool=true) { return position_is_reachable(TERN_(HAS_X_AXIS, rx) OPTARG(HAS_Y_AXIS, ry)); }
+ static bool can_reach(const float rx, const float ry, const bool=true) { return position_is_reachable(TERN_(HAS_X_AXIS, rx) OPTARG(HAS_Y_AXIS, ry)); }
#endif // !HAS_BED_PROBE
@@ -356,14 +356,14 @@ public:
// Basic functions for Sensorless Homing and Probing
#if HAS_DELTA_SENSORLESS_PROBING
- static void set_offset_sensorless_adj(const_float_t sz);
+ static void set_offset_sensorless_adj(const float sz);
static void refresh_largest_sensorless_adj();
#endif
private:
#if HAS_BED_PROBE
- static bool probe_down_to_z(const_float_t z, const_feedRate_t fr_mm_s);
- static float run_z_probe(const bool sanity_check=true, const_float_t z_min_point=Z_PROBE_LOW_POINT, const_float_t z_clearance=Z_TWEEN_SAFE_CLEARANCE);
+ static bool probe_down_to_z(const float z, const feedRate_t fr_mm_s);
+ static float run_z_probe(const bool sanity_check=true, const float z_min_point=Z_PROBE_LOW_POINT, const float z_clearance=Z_TWEEN_SAFE_CLEARANCE);
#endif
};
diff --git a/Marlin/src/module/scara.cpp b/Marlin/src/module/scara.cpp
index 50aaf56196..d6016d77a1 100644
--- a/Marlin/src/module/scara.cpp
+++ b/Marlin/src/module/scara.cpp
@@ -48,7 +48,7 @@ float segments_per_second = DEFAULT_SEGMENTS_PER_SECOND;
* Maths and first version by QHARLEY.
* Integrated into Marlin and slightly restructured by Joachim Cerny.
*/
- void forward_kinematics(const_float_t a, const_float_t b) {
+ void forward_kinematics(const float a, const float b) {
const float a_sin = sin(RADIANS(a)) * L1,
a_cos = cos(RADIANS(a)) * L1,
b_sin = sin(RADIANS(SUM_TERN(MP_SCARA, b, a))) * L2,
@@ -197,7 +197,7 @@ float segments_per_second = DEFAULT_SEGMENTS_PER_SECOND;
}
// Convert ABC inputs in degrees to XYZ outputs in mm
- void forward_kinematics(const_float_t a, const_float_t b, const_float_t c) {
+ void forward_kinematics(const float a, const float b, const float c) {
const float w = c - b,
r = L1 * cos(RADIANS(b)) + L2 * sin(RADIANS(w - (90 - b))),
x = r * cos(RADIANS(a)),
diff --git a/Marlin/src/module/scara.h b/Marlin/src/module/scara.h
index c574b2f818..193f80f6f9 100644
--- a/Marlin/src/module/scara.h
+++ b/Marlin/src/module/scara.h
@@ -35,7 +35,7 @@ extern float segments_per_second;
L1_2 = FLOAT_SQ(L1), L1_2_2 = 2.0 * L1_2,
L2_2 = FLOAT_SQ(L2);
- void forward_kinematics(const_float_t a, const_float_t b, const_float_t c);
+ void forward_kinematics(const float a, const float b, const float c);
void home_TPARA();
#else
@@ -44,7 +44,7 @@ extern float segments_per_second;
L1_2 = FLOAT_SQ(L1), L1_2_2 = 2.0 * L1_2,
L2_2 = FLOAT_SQ(L2);
- void forward_kinematics(const_float_t a, const_float_t b);
+ void forward_kinematics(const float a, const float b);
#endif
diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp
index 2196848acb..f5ba1faa89 100644
--- a/Marlin/src/module/stepper.cpp
+++ b/Marlin/src/module/stepper.cpp
@@ -2474,7 +2474,7 @@ hal_timer_t Stepper::block_phase_isr() {
* isPowered - True when a move is powered.
* isEnabled - laser power is active.
*
- * Laser power variables are calulated and stored in this block by the planner code.
+ * Laser power variables are calculated and stored in this block by the planner code.
* trap_ramp_active_pwr - the active power in this block across accel or decel trap steps.
* trap_ramp_entry_incr - holds the precalculated value to increase the current power per accel step.
*/
@@ -3007,7 +3007,7 @@ hal_timer_t Stepper::block_phase_isr() {
static int32_t smoothed_vals[SMOOTH_LIN_ADV_EXP_ORDER] = {0};
for (uint8_t i = 0; i < SMOOTH_LIN_ADV_EXP_ORDER; i++) {
- // Approximate gaussian smoothing via higher order exponential smoothing
+ // Approximate Gaussian smoothing via higher order exponential smoothing
smoothed_vals[i] += MULT_Q(30, la_step_rate - smoothed_vals[i], extruder_advance_alpha_q30[E_INDEX_N(active_extruder)]);
la_step_rate = smoothed_vals[i];
}
@@ -3276,7 +3276,7 @@ void Stepper::init() {
* Calculate a fixed point factor to apply to the signal and its echo
* when shaping an axis.
*/
- void Stepper::set_shaping_damping_ratio(const AxisEnum axis, const_float_t zeta) {
+ void Stepper::set_shaping_damping_ratio(const AxisEnum axis, const float zeta) {
// From the damping ratio, get a factor that can be applied to advance_dividend for fixed-point maths.
// For ZV, we use amplitudes 1/(1+K) and K/(1+K) where K = exp(-zeta * π / sqrt(1.0f - zeta * zeta))
// which can be converted to 1:7 fixed point with an excellent fit with a 3rd-order polynomial.
@@ -3307,7 +3307,7 @@ void Stepper::init() {
return -1;
}
- void Stepper::set_shaping_frequency(const AxisEnum axis, const_float_t freq) {
+ void Stepper::set_shaping_frequency(const AxisEnum axis, const float freq) {
// enabling or disabling shaping whilst moving can result in lost steps
planner.synchronize();
@@ -3534,15 +3534,13 @@ int32_t Stepper::triggered_position(const AxisEnum axis) {
void Stepper::report_a_position(const xyz_long_t &pos) {
#if NUM_AXES
- SERIAL_ECHOLNPGM_P(
- LIST_N(DOUBLE(NUM_AXES),
- TERN(SAYS_A, PSTR(STR_COUNT_A), PSTR(STR_COUNT_X)), pos.x,
- TERN(SAYS_B, PSTR("B:"), SP_Y_LBL), pos.y,
- TERN(SAYS_C, PSTR("C:"), SP_Z_LBL), pos.z,
- SP_I_LBL, pos.i, SP_J_LBL, pos.j, SP_K_LBL, pos.k,
- SP_U_LBL, pos.u, SP_V_LBL, pos.v, SP_W_LBL, pos.w
- )
- );
+ SERIAL_ECHOLNPGM_P(NUM_AXIS_PAIRED_LIST(
+ TERN(SAYS_A, PSTR(STR_COUNT_A), PSTR(STR_COUNT_X)), pos.x,
+ TERN(SAYS_B, PSTR("B:"), SP_Y_LBL), pos.y,
+ TERN(SAYS_C, PSTR("C:"), SP_Z_LBL), pos.z,
+ SP_I_LBL, pos.i, SP_J_LBL, pos.j, SP_K_LBL, pos.k,
+ SP_U_LBL, pos.u, SP_V_LBL, pos.v, SP_W_LBL, pos.w
+ ));
#endif
}
@@ -3567,8 +3565,8 @@ void Stepper::report_positions() {
void Stepper::ftMotion_stepper() {
// Check if the buffer is empty.
- ftMotion.sts_stepperBusy = (ftMotion.stepperCmdBuff_produceIdx != ftMotion.stepperCmdBuff_consumeIdx);
- if (!ftMotion.sts_stepperBusy) return;
+ ftMotion.stepperCmdBuffHasData = (ftMotion.stepperCmdBuff_produceIdx != ftMotion.stepperCmdBuff_consumeIdx);
+ if (!ftMotion.stepperCmdBuffHasData) return;
// "Pop" one command from current motion buffer
const ft_command_t command = ftMotion.stepperCmdBuff[ftMotion.stepperCmdBuff_consumeIdx];
diff --git a/Marlin/src/module/stepper.h b/Marlin/src/module/stepper.h
index 330ff9f6b6..0295730c7f 100644
--- a/Marlin/src/module/stepper.h
+++ b/Marlin/src/module/stepper.h
@@ -383,7 +383,7 @@ class Stepper {
#if ENABLED(SMOOTH_LIN_ADVANCE)
static float extruder_advance_tau[DISTINCT_E]; // Smoothing time; also the lookahead time of the smoother
- static void set_advance_tau(const_float_t tau, const uint8_t e=active_extruder) {
+ static void set_advance_tau(const float tau, const uint8_t e=active_extruder) {
const uint8_t i = E_INDEX_N(e);
extruder_advance_tau[i] = tau;
extruder_advance_tau_ticks[i] = tau * STEPPER_TIMER_RATE;
@@ -749,9 +749,9 @@ class Stepper {
#endif
#if HAS_ZV_SHAPING
- static void set_shaping_damping_ratio(const AxisEnum axis, const_float_t zeta);
+ static void set_shaping_damping_ratio(const AxisEnum axis, const float zeta);
static float get_shaping_damping_ratio(const AxisEnum axis);
- static void set_shaping_frequency(const AxisEnum axis, const_float_t freq);
+ static void set_shaping_frequency(const AxisEnum axis, const float freq);
static float get_shaping_frequency(const AxisEnum axis);
#endif
diff --git a/Marlin/src/module/stepper/cycles.h b/Marlin/src/module/stepper/cycles.h
index b01d199cd8..fa76f60127 100644
--- a/Marlin/src/module/stepper/cycles.h
+++ b/Marlin/src/module/stepper/cycles.h
@@ -38,7 +38,7 @@
* ...as measured on an LPC1768 with a scope and converted to cycles.
* Not applicable to other 32-bit processors, but as long as others
* take longer, pulses will be longer. For example the SKR Pro
- * (stm32f407zgt6) requires ~60 cyles.
+ * (stm32f407zgt6) requires ~60 cycles.
*/
constexpr uint32_t timer_read_add_and_store_cycles = 34UL;
diff --git a/Marlin/src/module/stepper/indirection.h b/Marlin/src/module/stepper/indirection.h
index 19594df66c..05adff7a4e 100644
--- a/Marlin/src/module/stepper/indirection.h
+++ b/Marlin/src/module/stepper/indirection.h
@@ -53,7 +53,7 @@
* Q_STEP_INIT() Q_STEP_WRITE(S) Q_STEP_READ()
*
* Steppers may not have an enable state or may be enabled by other methods
- * beyond a single pin (SOFTWARE_DRIVER_ENABLE) so these can be overriden:
+ * beyond a single pin (SOFTWARE_DRIVER_ENABLE) so these can be overridden:
* ENABLE_STEPPER_Q() DISABLE_STEPPER_Q()
*
* Axis Stepper Control (X Y Z I J K U V W)
diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp
index b79172da13..73f64aedb6 100644
--- a/Marlin/src/module/temperature.cpp
+++ b/Marlin/src/module/temperature.cpp
@@ -882,7 +882,7 @@ void Temperature::factory_reset() {
#if ENABLED(PRINTER_EVENT_LEDS)
const celsius_float_t start_temp = GHV(degChamber(), degBed(), degHotend(heater_id));
- const LEDColor oldcolor = ONHEATINGSTART();
+ const LED1Color_t oldcolor = ONHEATINGSTART();
#endif
TERN_(TEMP_TUNING_MAINTAIN_FAN, adaptive_fan_slowing = false);
@@ -1777,7 +1777,7 @@ void Temperature::mintemp_error(const heater_id_t heater_id OPTARG(ERR_INCLUDE_T
#endif // !PID_OPENLOOP
}
- FORCE_INLINE void debug(const_celsius_float_t c, const_float_t pid_out, FSTR_P const name=nullptr, const int8_t index=-1) {
+ FORCE_INLINE void debug(const celsius_float_t c, const float pid_out, FSTR_P const name=nullptr, const int8_t index=-1) {
if (TERN0(HAS_PID_DEBUG, thermalManager.pid_debug_flag)) {
SERIAL_ECHO_START();
if (name) SERIAL_ECHO(name);
@@ -3220,7 +3220,8 @@ void Temperature::init() {
TERN_(HAS_TEMP_ADC_BOARD, hal.adc_enable(TEMP_BOARD_PIN));
TERN_(HAS_TEMP_ADC_SOC, hal.adc_enable(TEMP_SOC_PIN));
TERN_(HAS_TEMP_ADC_REDUNDANT, hal.adc_enable(TEMP_REDUNDANT_PIN));
- TERN_(FILAMENT_WIDTH_SENSOR, hal.adc_enable(FILWIDTH_PIN));
+ TERN_(HAS_FILWIDTH_ADC, hal.adc_enable(FILWIDTH_PIN));
+ TERN_(HAS_FILWIDTH2_ADC, hal.adc_enable(FILWIDTH2_PIN));
TERN_(HAS_ADC_BUTTONS, hal.adc_enable(ADC_KEYPAD_PIN));
TERN_(POWER_MONITOR_CURRENT, hal.adc_enable(POWER_MONITOR_CURRENT_PIN));
TERN_(POWER_MONITOR_VOLTAGE, hal.adc_enable(POWER_MONITOR_VOLTAGE_PIN));
@@ -3405,7 +3406,7 @@ void Temperature::init() {
*
* TODO: Embed the last 3 parameters during init, if not less optimal
*/
- void Temperature::tr_state_machine_t::run(const_celsius_float_t current, const_celsius_float_t target, const heater_id_t heater_id, const uint16_t period_seconds, const celsius_float_t hysteresis_degc) {
+ void Temperature::tr_state_machine_t::run(const celsius_float_t current, const celsius_float_t target, const heater_id_t heater_id, const uint16_t period_seconds, const celsius_float_t hysteresis_degc) {
#if HEATER_IDLE_HANDLER
// Convert the given heater_id_t to an idle array index
@@ -4517,11 +4518,25 @@ void Temperature::isr() {
case MeasureTemp_7: ACCUMULATE_ADC(temp_hotend[7]); break;
#endif
- #if ENABLED(FILAMENT_WIDTH_SENSOR)
+ #if HAS_FILWIDTH_ADC
case Prepare_FILWIDTH: hal.adc_start(FILWIDTH_PIN); break;
case Measure_FILWIDTH:
- if (!hal.adc_ready()) next_sensor_state = adc_sensor_state; // Redo this state
- else filwidth.accumulate(hal.adc_value());
+ if (!hal.adc_ready())
+ next_sensor_state = adc_sensor_state; // Redo this state
+ else {
+ TERN_(FILAMENT_WIDTH_SENSOR, filwidth.accumulate(hal.adc_value()));
+ }
+ break;
+ #endif
+
+ #if HAS_FILWIDTH2_ADC
+ case Prepare_FILWIDTH2: hal.adc_start(FILWIDTH2_PIN); break;
+ case Measure_FILWIDTH2:
+ if (!hal.adc_ready())
+ next_sensor_state = adc_sensor_state; // Redo this state
+ else {
+ TERN_(FILAMENT_WIDTH_SENSOR, filwidth.accumulate(hal.adc_value()));
+ }
break;
#endif
@@ -4620,7 +4635,7 @@ void Temperature::isr() {
* Redundant: " R:nnn.nn /nnn.nn"
* With ADC: " T0:nnn.nn /nnn.nn (nnn.nn)"
*/
- static void print_heater_state(const heater_id_t e, const_celsius_float_t c, const_celsius_float_t t
+ static void print_heater_state(const heater_id_t e, const celsius_float_t c, const celsius_float_t t
OPTARG(SHOW_TEMP_ADC_VALUES, const float r)
) {
char k;
diff --git a/Marlin/src/module/temperature.h b/Marlin/src/module/temperature.h
index 33b7bfb226..92fae44deb 100644
--- a/Marlin/src/module/temperature.h
+++ b/Marlin/src/module/temperature.h
@@ -118,9 +118,12 @@ enum ADCSensorState : char {
#if HAS_JOY_ADC_Z
PrepareJoy_Z, MeasureJoy_Z,
#endif
- #if ENABLED(FILAMENT_WIDTH_SENSOR)
+ #if HAS_FILWIDTH_ADC
Prepare_FILWIDTH, Measure_FILWIDTH,
#endif
+ #if HAS_FILWIDTH2_ADC
+ Prepare_FILWIDTH2, Measure_FILWIDTH2,
+ #endif
#if ENABLED(POWER_MONITOR_CURRENT)
Prepare_POWER_MONITOR_CURRENT,
Measure_POWER_MONITOR_CURRENT,
@@ -396,9 +399,9 @@ typedef struct { float p, i, d, c, f; } raw_pidcf_t;
float filament_heat_capacity_permm; // M306 H
#if ENABLED(MPC_INCLUDE_FAN)
float fan255_adjustment; // M306 F
- void applyFanAdjustment(const_float_t cf) { fan255_adjustment = cf - ambient_xfer_coeff_fan0; }
+ void applyFanAdjustment(const float cf) { fan255_adjustment = cf - ambient_xfer_coeff_fan0; }
#else
- void applyFanAdjustment(const_float_t) {}
+ void applyFanAdjustment(const float) {}
#endif
float fanCoefficient() { return SUM_TERN(MPC_INCLUDE_FAN, ambient_xfer_coeff_fan0, fan255_adjustment); }
} MPC_t;
@@ -456,7 +459,7 @@ struct PIDHeaterInfo : public HeaterInfo {
modeled_block_temp,
modeled_sensor_temp;
float fanCoefficient() { return mpc.fanCoefficient(); }
- void applyFanAdjustment(const_float_t cf) { mpc.applyFanAdjustment(cf); }
+ void applyFanAdjustment(const float cf) { mpc.applyFanAdjustment(cf); }
};
#endif
@@ -1221,7 +1224,7 @@ class Temperature {
// Update the temp manager when PID values change
#if ENABLED(PIDTEMP)
static void updatePID() { HOTEND_LOOP() temp_hotend[e].pid.reset(); }
- static void setPID(const uint8_t hotend, const_float_t p, const_float_t i, const_float_t d) {
+ static void setPID(const uint8_t hotend, const float p, const float i, const float d) {
#if ENABLED(PID_PARAMS_PER_HOTEND)
temp_hotend[hotend].pid.set(p, i, d);
#else
@@ -1422,7 +1425,7 @@ class Temperature {
millis_t variance_timer = 0;
celsius_float_t last_temp = 0.0, variance = 0.0;
#endif
- void run(const_celsius_float_t current, const_celsius_float_t target, const heater_id_t heater_id, const uint16_t period_seconds, const celsius_float_t hysteresis_degc);
+ void run(const celsius_float_t current, const celsius_float_t target, const heater_id_t heater_id, const uint16_t period_seconds, const celsius_float_t hysteresis_degc);
} tr_state_machine_t;
static tr_state_machine_t tr_state_machine[NR_HEATER_RUNAWAY];
diff --git a/Marlin/src/module/thermistor/thermistor_61.h b/Marlin/src/module/thermistor/thermistor_61.h
index 2916bffd3b..5a82341a19 100644
--- a/Marlin/src/module/thermistor/thermistor_61.h
+++ b/Marlin/src/module/thermistor/thermistor_61.h
@@ -31,7 +31,7 @@
// B Value 3950K at 25/50 deg. C
// B Value Tolerance + / - 1%
constexpr temp_entry_t temptable_61[] PROGMEM = {
- { OV( 2.00), 420 }, // Guestimate to ensure we don't lose a reading and drop temps to -50 when over
+ { OV( 2.00), 420 }, // Guesstimate to ensure we don't lose a reading and drop temps to -50 when over
{ OV( 12.07), 350 },
{ OV( 12.79), 345 },
{ OV( 13.59), 340 },
diff --git a/Marlin/src/module/tool_change.cpp b/Marlin/src/module/tool_change.cpp
index 980f9327b5..baf4ad813e 100644
--- a/Marlin/src/module/tool_change.cpp
+++ b/Marlin/src/module/tool_change.cpp
@@ -940,7 +940,7 @@ void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_axis, 0.
* current_position.e = e;
* sync_plan_position_e();
*/
- void extruder_cutting_recover(const_float_t e) {
+ void extruder_cutting_recover(const float e) {
if (too_cold(active_extruder)) return;
const float dist = toolchange_settings.extra_resume + toolchange_settings.wipe_retract;
DEBUG_ECHOLNPGM("Performing Cutting Recover | Distance: ", dist, " | Speed: ", MMM_TO_MMS(toolchange_settings.unretract_speed), "mm/s");
diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h
index c2fba90b9b..5d6022ca41 100644
--- a/Marlin/src/pins/pins.h
+++ b/Marlin/src/pins/pins.h
@@ -177,6 +177,8 @@
#include "ramps/pins_RAMPS_ENDER_4.h" // ATmega2560 env:mega2560
#elif MB(RAMPS_CREALITY)
#include "ramps/pins_RAMPS_CREALITY.h" // ATmega2560 env:mega2560
+#elif MB(CREALITY_V252)
+ #include "ramps/pins_CREALITY_V252.h" // ATmega2560 env:mega2560
#elif MB(DAGOMA_F5)
#include "ramps/pins_DAGOMA_F5.h" // ATmega2560 env:mega2560
#elif MB(DAGOMA_D6)
diff --git a/Marlin/src/pins/pins_postprocess.h b/Marlin/src/pins/pins_postprocess.h
index 2c29cf4d8c..0934d25c1a 100644
--- a/Marlin/src/pins/pins_postprocess.h
+++ b/Marlin/src/pins/pins_postprocess.h
@@ -629,7 +629,7 @@
//
#if HAS_X_AXIS
- #ifdef X_STOP_PIN
+ #if PIN_EXISTS(X_STOP)
#if X_HOME_TO_MIN
#define X_MIN_PIN X_STOP_PIN
#elif X_HOME_TO_MAX
@@ -657,7 +657,7 @@
#endif
#if HAS_Y_AXIS
- #ifdef Y_STOP_PIN
+ #if PIN_EXISTS(Y_STOP)
#if Y_HOME_TO_MIN
#define Y_MIN_PIN Y_STOP_PIN
#elif Y_HOME_TO_MAX
@@ -685,7 +685,7 @@
#endif
#if HAS_Z_AXIS
- #ifdef Z_STOP_PIN
+ #if PIN_EXISTS(Z_STOP)
#if Z_HOME_TO_MIN
#define Z_MIN_PIN Z_STOP_PIN
#elif Z_HOME_TO_MAX
@@ -716,7 +716,7 @@
#endif
#if HAS_I_AXIS
- #ifdef I_STOP_PIN
+ #if PIN_EXISTS(I_STOP)
#if I_HOME_TO_MIN
#define I_MIN_PIN I_STOP_PIN
#elif I_HOME_TO_MAX
@@ -730,7 +730,7 @@
#endif
#if HAS_J_AXIS
- #ifdef J_STOP_PIN
+ #if PIN_EXISTS(J_STOP)
#if J_HOME_TO_MIN
#define J_MIN_PIN J_STOP_PIN
#elif J_HOME_TO_MAX
@@ -744,7 +744,7 @@
#endif
#if HAS_K_AXIS
- #ifdef K_STOP_PIN
+ #if PIN_EXISTS(K_STOP)
#if K_HOME_TO_MIN
#define K_MIN_PIN K_STOP_PIN
#elif K_HOME_TO_MAX
@@ -758,7 +758,7 @@
#endif
#if HAS_U_AXIS
- #ifdef U_STOP_PIN
+ #if PIN_EXISTS(U_STOP)
#if U_HOME_TO_MIN
#define U_MIN_PIN U_STOP_PIN
#elif U_HOME_TO_MAX
@@ -772,7 +772,7 @@
#endif
#if HAS_V_AXIS
- #ifdef V_STOP_PIN
+ #if PIN_EXISTS(V_STOP)
#if V_HOME_TO_MIN
#define V_MIN_PIN V_STOP_PIN
#elif V_HOME_TO_MAX
@@ -786,7 +786,7 @@
#endif
#if HAS_W_AXIS
- #ifdef W_STOP_PIN
+ #if PIN_EXISTS(W_STOP)
#if W_HOME_TO_MIN
#define W_MIN_PIN W_STOP_PIN
#elif W_HOME_TO_MAX
@@ -1871,9 +1871,9 @@
// Get a NeoPixel pin from the LCD or board, if provided
#ifndef NEOPIXEL_PIN
- #ifdef LCD_NEOPIXEL_PIN
+ #if PIN_EXISTS(LCD_NEOPIXEL)
#define NEOPIXEL_PIN LCD_NEOPIXEL_PIN
- #elif defined(BOARD_NEOPIXEL_PIN)
+ #elif PIN_EXISTS(BOARD_NEOPIXEL)
#define NEOPIXEL_PIN BOARD_NEOPIXEL_PIN
#endif
#endif
diff --git a/Marlin/src/pins/ramps/pins_CREALITY_V252.h b/Marlin/src/pins/ramps/pins_CREALITY_V252.h
new file mode 100644
index 0000000000..e8e19f1c9b
--- /dev/null
+++ b/Marlin/src/pins/ramps/pins_CREALITY_V252.h
@@ -0,0 +1,37 @@
+/**
+ * Marlin 3D Printer Firmware
+ * Copyright (c) 2025 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
+ *
+ * Based on Sprinter and grbl.
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ */
+#pragma once
+
+#if HOTENDS > 2 || E_STEPPERS > 1
+ #error "Creality V252 supports up to 2 hotends and 1 E stepper."
+#endif
+
+#define BOARD_INFO_NAME "Creality3D V252"
+
+#if !AXIS_DRIVER_TYPE_X(TMC2208_STANDALONE) || !AXIS_DRIVER_TYPE_Y(TMC2208_STANDALONE) || !AXIS_DRIVER_TYPE_Z(TMC2208_STANDALONE) || !AXIS_DRIVER_TYPE_E0(TMC2208_STANDALONE)
+ #error "Creality V252 requires TMC2208_STANDALONE for X,Y,Z and E."
+#endif
+
+//
+// Based on RAMPS CREALITY
+//
+#include "pins_RAMPS_CREALITY.h"
diff --git a/Marlin/src/pins/ramps/pins_RAMPS.h b/Marlin/src/pins/ramps/pins_RAMPS.h
index 6b4795adff..f3aecb247b 100644
--- a/Marlin/src/pins/ramps/pins_RAMPS.h
+++ b/Marlin/src/pins/ramps/pins_RAMPS.h
@@ -864,7 +864,7 @@
#elif ENABLED(MINIPANEL)
#ifndef BEEPER_PIN
- #define BEEPER_PIN AUX2_08_PIN
+ #define BEEPER_PIN AUX2_08
#endif
#define LCD_BACKLIGHT_PIN AUX2_10
diff --git a/Marlin/src/pins/ramps/pins_RAMPS_CREALITY.h b/Marlin/src/pins/ramps/pins_RAMPS_CREALITY.h
index 09a1608aa1..655b2c9b59 100644
--- a/Marlin/src/pins/ramps/pins_RAMPS_CREALITY.h
+++ b/Marlin/src/pins/ramps/pins_RAMPS_CREALITY.h
@@ -27,7 +27,9 @@
#error "Creality RAMPS supports up to 2 hotends / E steppers."
#endif
-#define BOARD_INFO_NAME "Creality3D RAMPS"
+#ifndef BOARD_INFO_NAME
+ #define BOARD_INFO_NAME "Creality3D RAMPS"
+#endif
//#define CR2020_INDUSTRIAL_SERIES // Use layout specific to CR2020
diff --git a/Marlin/src/pins/stm32f1/pins_CHITU3D_V6.h b/Marlin/src/pins/stm32f1/pins_CHITU3D_V6.h
index 18c8e22dff..14e7f3ab23 100644
--- a/Marlin/src/pins/stm32f1/pins_CHITU3D_V6.h
+++ b/Marlin/src/pins/stm32f1/pins_CHITU3D_V6.h
@@ -27,7 +27,11 @@
#define Z2_STEP_PIN PF5
#define Z2_DIR_PIN PF1
-#define Z_STOP_PIN PA14
+// Some Chitu v6 boards use PA14 and some use PG9.
+// The CXY-V6-191017 in early Tronxy X5SA Pro printers apparently use PG9.
+#ifndef Z_STOP_PIN
+ #define Z_STOP_PIN PA14
+#endif
#ifndef FIL_RUNOUT2_PIN
#define FIL_RUNOUT2_PIN PF13
diff --git a/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h b/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h
index a0e36c7f1b..34b1e633df 100644
--- a/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h
+++ b/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h
@@ -326,13 +326,26 @@
// Changing these will not change the pin they are on.
// Hardware UART pins
-#define UART1_TX_PIN PA9 // default uses CH340 RX
-#define UART1_RX_PIN PA10 // default uses CH340 TX
-#define UART2_TX_PIN PA2 // default uses HEATER_BED_PIN
-#define UART2_RX_PIN PA3 // not connected
-#define UART3_TX_PIN PB10 // default uses LCD connector
-#define UART3_RX_PIN PB11 // default uses LCD connector
-#define UART4_TX_PIN PC10 // default uses sdcard SDIO_D2
-#define UART4_RX_PIN PC11 // default uses sdcard SDIO_D3
-#define UART5_TX_PIN PC12 // default uses sdcard SDIO_CK
-#define UART5_RX_PIN PD2 // default uses sdcard SDIO_CMD
+#ifdef ARDUINO_ARCH_MFL // GD32 MFL UARTs start from 0
+ #define UART0_TX_PIN PA9 // default uses CH340 RX
+ #define UART0_RX_PIN PA10 // default uses CH340 TX
+ #define UART1_TX_PIN PA2 // default uses HEATER_BED_PIN
+ #define UART1_RX_PIN PA3 // not connected
+ #define UART2_TX_PIN PB10 // default uses LCD connector
+ #define UART2_RX_PIN PB11 // default uses LCD connector
+ #define UART3_TX_PIN PC10 // default uses sdcard SDIO_D2
+ #define UART3_RX_PIN PC11 // default uses sdcard SDIO_D3
+ #define UART4_TX_PIN PC12 // default uses sdcard SDIO_CK
+ #define UART4_RX_PIN PD2 // default uses sdcard SDIO_CMD
+#else
+ #define UART1_TX_PIN PA9 // default uses CH340 RX
+ #define UART1_RX_PIN PA10 // default uses CH340 TX
+ #define UART2_TX_PIN PA2 // default uses HEATER_BED_PIN
+ #define UART2_RX_PIN PA3 // not connected
+ #define UART3_TX_PIN PB10 // default uses LCD connector
+ #define UART3_RX_PIN PB11 // default uses LCD connector
+ #define UART4_TX_PIN PC10 // default uses sdcard SDIO_D2
+ #define UART4_RX_PIN PC11 // default uses sdcard SDIO_D3
+ #define UART5_TX_PIN PC12 // default uses sdcard SDIO_CK
+ #define UART5_RX_PIN PD2 // default uses sdcard SDIO_CMD
+#endif
diff --git a/Marlin/src/pins/stm32g0/pins_BTT_EBB42_V1_1.h b/Marlin/src/pins/stm32g0/pins_BTT_EBB42_V1_1.h
index 1b5aad04e1..f452fc1ebd 100644
--- a/Marlin/src/pins/stm32g0/pins_BTT_EBB42_V1_1.h
+++ b/Marlin/src/pins/stm32g0/pins_BTT_EBB42_V1_1.h
@@ -93,7 +93,7 @@
*/
//#define E0_HARDWARE_SERIAL MSerial4
- // This is the stable default value after testing, but, higher UART rates could be configured, remeber to test the Steppers with the M122 command to check if everything works.
+ // This is the stable default value after testing, but, higher UART rates could be configured, remember to test the Steppers with the M122 command to check if everything works.
//#define TMC_BAUD_RATE 250000
#define E0_SERIAL_TX_PIN PA15
diff --git a/Marlin/src/sd/SdBaseFile.cpp b/Marlin/src/sd/SdBaseFile.cpp
index 3963043ca6..cc14ca9c29 100644
--- a/Marlin/src/sd/SdBaseFile.cpp
+++ b/Marlin/src/sd/SdBaseFile.cpp
@@ -255,10 +255,12 @@ bool SdBaseFile::exists(const char *name) {
* If no data is read, fgets() returns zero for EOF or -1 if an error occurred.
*/
int16_t SdBaseFile::fgets(char *str, int16_t num, char *delim) {
+ if (!str || num <= 1) return -1; // Ensure space for at least '\0'
+
char ch;
int16_t n = 0;
int16_t r = -1;
- while ((n + 1) < num && (r = read(&ch, 1)) == 1) {
+ while (n < num - 1 && (r = read(&ch, 1)) == 1) {
// delete CR
if (ch == '\r') continue;
str[n++] = ch;
@@ -269,10 +271,7 @@ int16_t SdBaseFile::fgets(char *str, int16_t num, char *delim) {
if (strchr(delim, ch)) break;
}
}
- if (r < 0) {
- // read error
- return -1;
- }
+ if (r < 0) return -1; // read error
str[n] = '\0';
return n;
}
@@ -342,7 +341,9 @@ int8_t SdBaseFile::lsPrintNext(const uint8_t flags, const uint8_t indent) {
uint8_t w = 0;
while (1) {
- if (read(&dir, sizeof(dir)) != sizeof(dir)) return 0;
+ const int16_t r = read(&dir, sizeof(dir));
+ if (r < 0) return -1;
+ if (r != sizeof(dir)) return 0;
if (dir.name[0] == DIR_NAME_FREE) return 0;
// skip deleted entry and entries for . and ..
@@ -1277,7 +1278,8 @@ int SdBaseFile::peek() {
filepos_t pos;
getpos(&pos);
int c = read();
- if (c >= 0) setpos(&pos);
+ if (c < 0) return -1;
+ setpos(&pos);
return c;
}
@@ -1346,8 +1348,10 @@ bool SdBaseFile::printName() {
* If an error occurs or end of file is reached -1 is returned.
*/
int16_t SdBaseFile::read() {
- uint8_t b;
- return read(&b, 1) == 1 ? b : -1;
+ uint8_t b = 0;
+ const int16_t r = read(&b, 1);
+ if (r != 1) return -1;
+ return static_cast(b);
}
/**
diff --git a/Marlin/src/sd/cardreader.cpp b/Marlin/src/sd/cardreader.cpp
index b7d6f70f65..83d0caea4f 100644
--- a/Marlin/src/sd/cardreader.cpp
+++ b/Marlin/src/sd/cardreader.cpp
@@ -209,11 +209,11 @@ inline bool extIsBIN(char *ext) {
//
// Return 'true' if the item is a folder, G-code file or Binary file
//
-bool CardReader::is_visible_entity(const dir_t &p OPTARG(CUSTOM_FIRMWARE_UPLOAD, const bool onlyBin/*=false*/)) {
+bool CardReader::is_visible_entity(const dir_t &p OPTARG(CUSTOM_FIRMWARE_UPLOAD, const bool binFiles/*=false*/)) {
//uint8_t pn0 = p.name[0];
#if DISABLED(CUSTOM_FIRMWARE_UPLOAD)
- constexpr bool onlyBin = false;
+ constexpr bool binFiles = false;
#endif
if ( (p.attributes & DIR_ATT_HIDDEN) // Hidden by attribute
@@ -228,9 +228,9 @@ bool CardReader::is_visible_entity(const dir_t &p OPTARG(CUSTOM_FIRMWARE_UPLOAD,
return (
flag.filenameIsDir // All Directories are ok
- || fileIsBinary() // BIN files are accepted
- || (!onlyBin && p.name[8] == 'G'
- && p.name[9] != '~') // Non-backup *.G* files are accepted
+ || ( binFiles && fileIsBinary()) // BIN files are accepted
+ || (!binFiles && p.name[8] == 'G'
+ && p.name[9] != '~') // Non-backup *.G* files are accepted
);
}
@@ -292,7 +292,7 @@ void CardReader::printListing(MediaFile parent, const char * const prepend, cons
const bool includeLong = TEST(lsflags, LS_LONG_FILENAME);
#endif
#if ENABLED(CUSTOM_FIRMWARE_UPLOAD)
- const bool onlyBin = TEST(lsflags, LS_ONLY_BIN);
+ const bool binFiles = TEST(lsflags, LS_ONLY_BIN);
#endif
UNUSED(lsflags);
dir_t p;
@@ -328,7 +328,7 @@ void CardReader::printListing(MediaFile parent, const char * const prepend, cons
return;
}
}
- else if (is_visible_entity(p OPTARG(CUSTOM_FIRMWARE_UPLOAD, onlyBin))) {
+ else if (is_visible_entity(p OPTARG(CUSTOM_FIRMWARE_UPLOAD, binFiles))) {
if (prepend) SERIAL_ECHO(prepend, C('/'));
SERIAL_ECHO(createFilename(filename, p), C(' '), p.fileSize);
if (includeTime) {
diff --git a/Marlin/src/sd/cardreader.h b/Marlin/src/sd/cardreader.h
index 6c1f05b8af..19e08b5b4d 100644
--- a/Marlin/src/sd/cardreader.h
+++ b/Marlin/src/sd/cardreader.h
@@ -60,6 +60,10 @@ extern const char M23_STR[], M24_STR[];
#include "Sd2Card.h"
#endif
+#if ANY(DO_LIST_BIN_FILES, CUSTOM_FIRMWARE_UPLOAD)
+ #define MEDIA_SUPPORT_BIN_FILES 1
+#endif
+
typedef struct {
bool saving:1, // Receiving a G-code file or logging commands during a print
logging:1, // Log enqueued commands to the open file. See GCodeQueue::advance()
@@ -69,7 +73,7 @@ typedef struct {
filenameIsDir:1, // The working item is a directory
workDirIsRoot:1, // The working directory is / so there's no parent
abort_sd_printing:1 // Abort by calling abortSDPrinting() at the main loop()
- #if DO_LIST_BIN_FILES
+ #if MEDIA_SUPPORT_BIN_FILES
, filenameIsBin:1 // The working item is a BIN file
#endif
#if ENABLED(BINARY_FILE_TRANSFER)
@@ -300,8 +304,8 @@ public:
#endif
// Binary flag for the current file
- static bool fileIsBinary() { return TERN0(DO_LIST_BIN_FILES, flag.filenameIsBin); }
- static void setBinFlag(const bool bin) { TERN(DO_LIST_BIN_FILES, flag.filenameIsBin = bin, UNUSED(bin)); }
+ static bool fileIsBinary() { return TERN0(MEDIA_SUPPORT_BIN_FILES, flag.filenameIsBin); }
+ static void setBinFlag(const bool bin) { TERN(MEDIA_SUPPORT_BIN_FILES, flag.filenameIsBin = bin, UNUSED(bin)); }
// Current Working Dir - Set by cd, cdup, cdroot, and diveToFile(true, ...)
static char* getWorkDirName() { workDir.getDosName(filename); return filename; }
@@ -412,7 +416,7 @@ private:
//
// Directory items
//
- static bool is_visible_entity(const dir_t &p OPTARG(CUSTOM_FIRMWARE_UPLOAD, const bool onlyBin=false));
+ static bool is_visible_entity(const dir_t &p OPTARG(CUSTOM_FIRMWARE_UPLOAD, const bool binFiles=false));
static int16_t countVisibleItems(MediaFile dir);
static void selectByIndex(MediaFile dir, const int16_t index);
static void selectByName(MediaFile dir, const char * const match);
diff --git a/Marlin/src/sd/usb_flashdrive/lib-uhs3/UHS_host/USB_HOST_SHIELD/USB_HOST_SHIELD_INLINE.h b/Marlin/src/sd/usb_flashdrive/lib-uhs3/UHS_host/USB_HOST_SHIELD/USB_HOST_SHIELD_INLINE.h
index f126a6fcef..1dde32f949 100644
--- a/Marlin/src/sd/usb_flashdrive/lib-uhs3/UHS_host/USB_HOST_SHIELD/USB_HOST_SHIELD_INLINE.h
+++ b/Marlin/src/sd/usb_flashdrive/lib-uhs3/UHS_host/USB_HOST_SHIELD/USB_HOST_SHIELD_INLINE.h
@@ -303,7 +303,7 @@ int16_t UHS_NI MAX3421E_HOST::Init(int16_t mseconds) {
pinMode(ss_pin, OUTPUT);
MARLIN_UHS_WRITE_SS(HIGH);
- #ifdef USB_HOST_SHIELD_TIMING_PIN
+ #if PIN_EXISTS(USB_HOST_SHIELD_TIMING)
pinMode(USB_HOST_SHIELD_TIMING_PIN, OUTPUT);
// My counter/timer can't work on an inverted gate signal
// so we gate using a high pulse -- AJK
@@ -863,7 +863,7 @@ void UHS_NI MAX3421E_HOST::ISRbottom() {
interrupts();
}
#endif
- #ifdef USB_HOST_SHIELD_TIMING_PIN
+ #if PIN_EXISTS(USB_HOST_SHIELD_TIMING)
// My counter/timer can't work on an inverted gate signal
// so we gate using a high pulse -- AJK
UHS_PIN_WRITE(USB_HOST_SHIELD_TIMING_PIN, LOW);
@@ -969,7 +969,7 @@ void UHS_NI MAX3421E_HOST::ISRbottom() {
if (!sof_countdown && !counted && !usb_task_polling_disabled) {
DisablePoll();
//usb_task_polling_disabled++;
- #ifdef USB_HOST_SHIELD_TIMING_PIN
+ #if PIN_EXISTS(USB_HOST_SHIELD_TIMING)
// My counter/timer can't work on an inverted gate signal
// so we gate using a high pulse -- AJK
UHS_PIN_WRITE(USB_HOST_SHIELD_TIMING_PIN, HIGH);
diff --git a/README.md b/README.md
index cc5fa60db7..90815578c8 100644
--- a/README.md
+++ b/README.md
@@ -14,6 +14,7 @@
### 🌍 Translations
+
| Aragonés |
@@ -69,7 +70,7 @@ Please test this firmware and let us know if it misbehaves in any way. Volunteer
## Marlin 2.1 Bugfix Branch
-__Not for production use. Use with caution!__
+**Not for production use. Use with caution!**
Marlin 2.1 continues to support both 32-bit ARM and 8-bit AVR boards while adding support for up to 9 coordinated axes and to up to 8 extruders.
@@ -103,32 +104,32 @@ Every new HAL opens up a world of hardware. At this time we need HALs for RP2040
### Supported Platforms
- Platform|MCU|Example Boards
- --------|---|-------
- [Arduino AVR](//www.arduino.cc/)|ATmega|RAMPS, Melzi, RAMBo
- [Teensy++ 2.0](//www.microchip.com/en-us/product/AT90USB1286)|AT90USB1286|Printrboard
- [Arduino Due](//www.arduino.cc/en/Guide/ArduinoDue)|SAM3X8E|RAMPS-FD, RADDS, RAMPS4DUE
- [ESP32](//github.com/espressif/arduino-esp32)|ESP32|FYSETC E4, E4d@BOX, MRR
- [GD32](//www.gigadevice.com/)|GD32 ARM Cortex-M4|Creality MFL GD32 V4.2.2
- [HC32](//www.huazhoucn.com/)|HC32|Ender-2 Pro, Voxelab Aquila
- [LPC1768](//www.nxp.com/products/processors-and-microcontrollers/arm-microcontrollers/general-purpose-mcus/lpc1700-cortex-m3/512-kb-flash-64-kb-sram-ethernet-usb-lqfp100-package:LPC1768FBD100)|ARM® Cortex-M3|MKS SBASE, Re-ARM, Selena Compact
- [LPC1769](//www.nxp.com/products/processors-and-microcontrollers/arm-microcontrollers/general-purpose-mcus/lpc1700-cortex-m3/512-kb-flash-64-kb-sram-ethernet-usb-lqfp100-package:LPC1769FBD100)|ARM® Cortex-M3|Smoothieboard, Azteeg X5 mini, TH3D EZBoard
- [Pico RP2040](//www.raspberrypi.com/documentation/microcontrollers/pico-series.html)|Dual Cortex M0+|BigTreeTech SKR Pico
- [STM32F103](//www.st.com/en/microcontrollers-microprocessors/stm32f103.html)|ARM® Cortex-M3|Malyan M200, GTM32 Pro, MKS Robin, BTT SKR Mini
- [STM32F401](//www.st.com/en/microcontrollers-microprocessors/stm32f401.html)|ARM® Cortex-M4|ARMED, Rumba32, SKR Pro, Lerdge, FYSETC S6, Artillery Ruby
- [STM32F7x6](//www.st.com/en/microcontrollers-microprocessors/stm32f7x6.html)|ARM® Cortex-M7|The Borg, RemRam V1
- [STM32G0B1RET6](//www.st.com/en/microcontrollers-microprocessors/stm32g0x1.html)|ARM® Cortex-M0+|BigTreeTech SKR mini E3 V3.0
- [STM32H743xIT6](//www.st.com/en/microcontrollers-microprocessors/stm32h743-753.html)|ARM® Cortex-M7|BigTreeTech SKR V3.0, SKR EZ V3.0, SKR SE BX V2.0/V3.0
- [SAMD21P20A](//www.adafruit.com/product/4064)|ARM® Cortex-M0+|Adafruit Grand Central M4
- [SAMD51P20A](//www.adafruit.com/product/4064)|ARM® Cortex-M4|Adafruit Grand Central M4
- [Teensy 3.2/3.1](//www.pjrc.com/teensy/teensy31.html)|MK20DX256VLH7 ARM® Cortex-M4|
- [Teensy 3.5](//www.pjrc.com/store/teensy35.html)|MK64FX512-VMD12 ARM® Cortex-M4|
- [Teensy 3.6](//www.pjrc.com/store/teensy36.html)|MK66FX1MB-VMD18 ARM® Cortex-M4|
- [Teensy 4.0](//www.pjrc.com/store/teensy40.html)|MIMXRT1062-DVL6B ARM® Cortex-M7|
- [Teensy 4.1](//www.pjrc.com/store/teensy41.html)|MIMXRT1062-DVJ6B ARM® Cortex-M7|
- Linux Native|x86 / ARM / RISC-V|Raspberry Pi GPIO
- Simulator|Windows, macOS, Linux|Desktop OS
- [All supported boards](//marlinfw.org/docs/hardware/boards.html#boards-list)|All platforms|All boards
+| Platform | MCU | Example Boards |
+| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------- | ---------------------------------------------------------- |
+| [Arduino AVR](//www.arduino.cc/) | ATmega | RAMPS, Melzi, RAMBo |
+| [Teensy++ 2.0](//www.microchip.com/en-us/product/AT90USB1286) | AT90USB1286 | Printrboard |
+| [Arduino Due](//www.arduino.cc/en/Guide/ArduinoDue) | SAM3X8E | RAMPS-FD, RADDS, RAMPS4DUE |
+| [ESP32](//github.com/espressif/arduino-esp32) | ESP32 | FYSETC E4, E4d@BOX, MRR |
+| [GD32](//www.gigadevice.com/) | GD32 ARM Cortex-M4 | Creality MFL GD32 V4.2.2 |
+| [HC32](//www.huazhoucn.com/) | HC32 | Ender-2 Pro, Voxelab Aquila |
+| [LPC1768](//www.nxp.com/products/processors-and-microcontrollers/arm-microcontrollers/general-purpose-mcus/lpc1700-cortex-m3/512-kb-flash-64-kb-sram-ethernet-usb-lqfp100-package:LPC1768FBD100) | ARM® Cortex-M3 | MKS SBASE, Re-ARM, Selena Compact |
+| [LPC1769](//www.nxp.com/products/processors-and-microcontrollers/arm-microcontrollers/general-purpose-mcus/lpc1700-cortex-m3/512-kb-flash-64-kb-sram-ethernet-usb-lqfp100-package:LPC1769FBD100) | ARM® Cortex-M3 | Smoothieboard, Azteeg X5 mini, TH3D EZBoard |
+| [Pico RP2040](//www.raspberrypi.com/documentation/microcontrollers/pico-series.html) | Dual Cortex M0+ | BigTreeTech SKR Pico |
+| [STM32F103](//www.st.com/en/microcontrollers-microprocessors/stm32f103.html) | ARM® Cortex-M3 | Malyan M200, GTM32 Pro, MKS Robin, BTT SKR Mini |
+| [STM32F401](//www.st.com/en/microcontrollers-microprocessors/stm32f401.html) | ARM® Cortex-M4 | ARMED, Rumba32, SKR Pro, Lerdge, FYSETC S6, Artillery Ruby |
+| [STM32F7x6](//www.st.com/en/microcontrollers-microprocessors/stm32f7x6.html) | ARM® Cortex-M7 | The Borg, RemRam V1 |
+| [STM32G0B1RET6](//www.st.com/en/microcontrollers-microprocessors/stm32g0x1.html) | ARM® Cortex-M0+ | BigTreeTech SKR mini E3 V3.0 |
+| [STM32H743xIT6](//www.st.com/en/microcontrollers-microprocessors/stm32h743-753.html) | ARM® Cortex-M7 | BigTreeTech SKR V3.0, SKR EZ V3.0, SKR SE BX V2.0/V3.0 |
+| [SAMD21P20A](//www.adafruit.com/product/4064) | ARM® Cortex-M0+ | Adafruit Grand Central M4 |
+| [SAMD51P20A](//www.adafruit.com/product/4064) | ARM® Cortex-M4 | Adafruit Grand Central M4 |
+| [Teensy 3.2/3.1](//www.pjrc.com/teensy/teensy31.html) | MK20DX256VLH7 ARM® Cortex-M4 |
+| [Teensy 3.5](//www.pjrc.com/store/teensy35.html) | MK64FX512-VMD12 ARM® Cortex-M4 |
+| [Teensy 3.6](//www.pjrc.com/store/teensy36.html) | MK66FX1MB-VMD18 ARM® Cortex-M4 |
+| [Teensy 4.0](//www.pjrc.com/store/teensy40.html) | MIMXRT1062-DVL6B ARM® Cortex-M7 |
+| [Teensy 4.1](//www.pjrc.com/store/teensy41.html) | MIMXRT1062-DVJ6B ARM® Cortex-M7 |
+| Linux Native | x86 / ARM / RISC-V | Raspberry Pi GPIO |
+| Simulator | Windows, macOS, Linux | Desktop OS |
+| [All supported boards](//marlinfw.org/docs/hardware/boards.html#boards-list) | All platforms | All boards |
## Marlin Support
@@ -173,17 +174,17 @@ Marlin Firmware original logo design by Ahmet Cem TURAN [@ahmetcemturan](//githu
## Project Leadership
-Name|Role|Link|Donate
-----|----|----|----
-🇺🇸 Scott Lahteine|Project Lead|[[@thinkyhead](//github.com/thinkyhead)]|[💸 Donate](//marlinfw.org/docs/development/contributing.html#donate)
-🇺🇸 Roxanne Neufeld|Admin|[[@Roxy-3D](//github.com/Roxy-3D)]|
-🇺🇸 Keith Bennett|Admin|[[@thisiskeithb](//github.com/thisiskeithb)]|[💸 Donate](//github.com/sponsors/thisiskeithb)
-🇺🇸 Jason Smith|Admin|[[@sjasonsmith](//github.com/sjasonsmith)]|
-🇧🇷 Victor Oliveira|Admin|[[@rhapsodyv](//github.com/rhapsodyv)]|
-🇬🇧 Chris Pepper|Admin|[[@p3p](//github.com/p3p)]|
-🇳🇿 Peter Ellens|Admin|[[@ellensp](//github.com/ellensp)]|[💸 Donate](//ko-fi.com/ellensp)
-🇺🇸 Bob Kuhn|Admin|[[@Bob-the-Kuhn](//github.com/Bob-the-Kuhn)]|
-🇳🇱 Erik van der Zalm|Founder|[[@ErikZalm](//github.com/ErikZalm)]|
+| Name | Role | Link | Donate |
+| -------------------- | ------------ | -------------------------------------------- | --------------------------------------------------------------------- |
+| 🇺🇸 Scott Lahteine | Project Lead | [[@thinkyhead](//github.com/thinkyhead)] | [💸 Donate](//marlinfw.org/docs/development/contributing.html#donate) |
+| 🇺🇸 Roxanne Neufeld | Admin | [[@Roxy-3D](//github.com/Roxy-3D)] |
+| 🇺🇸 Keith Bennett | Admin | [[@thisiskeithb](//github.com/thisiskeithb)] | [💸 Donate](//github.com/sponsors/thisiskeithb) |
+| 🇺🇸 Jason Smith | Admin | [[@sjasonsmith](//github.com/sjasonsmith)] |
+| 🇧🇷 Victor Oliveira | Admin | [[@rhapsodyv](//github.com/rhapsodyv)] |
+| 🇬🇧 Chris Pepper | Admin | [[@p3p](//github.com/p3p)] |
+| 🇳🇿 Peter Ellens | Admin | [[@ellensp](//github.com/ellensp)] | [💸 Donate](//ko-fi.com/ellensp) |
+| 🇺🇸 Bob Kuhn | Admin | [[@Bob-the-Kuhn](//github.com/Bob-the-Kuhn)] |
+| 🇳🇱 Erik van der Zalm | Founder | [[@ErikZalm](//github.com/ErikZalm)] |
## Star History
diff --git a/buildroot/bin/use_example_configs b/buildroot/bin/use_example_configs
index ff2b0ca689..08b32d67f6 100755
--- a/buildroot/bin/use_example_configs
+++ b/buildroot/bin/use_example_configs
@@ -14,7 +14,7 @@
# The fallback branch is bugfix-2.1.x.
#
-import os, subprocess, sys, urllib.request
+import os, subprocess, sys, urllib.request, urllib.error
from pathlib import Path
DEBUGGING = False
diff --git a/buildroot/share/PlatformIO/scripts/STM32F1_create_variant.py b/buildroot/share/PlatformIO/scripts/STM32F1_create_variant.py
index 6fa53ef57f..7998776783 100644
--- a/buildroot/share/PlatformIO/scripts/STM32F1_create_variant.py
+++ b/buildroot/share/PlatformIO/scripts/STM32F1_create_variant.py
@@ -38,6 +38,6 @@ if pioutil.is_pio_build():
else:
# The following almost works, but __start__ (from wirish/start.S) is not seen by common.inc
- board.update("build.variants_dir", source_root_str);
+ board.update("build.variants_dir", source_root_str)
src = str(source_dir)
env.Append(BUILD_FLAGS=[f"-I{src}", f"-L{src}/ld"]) # Add include path for variant
diff --git a/buildroot/share/PlatformIO/scripts/collect-code-tests.py b/buildroot/share/PlatformIO/scripts/collect-code-tests.py
index 62f95f4b4b..a5758e97d3 100644
--- a/buildroot/share/PlatformIO/scripts/collect-code-tests.py
+++ b/buildroot/share/PlatformIO/scripts/collect-code-tests.py
@@ -22,7 +22,7 @@ if pioutil.is_pio_build():
test_suites = collect_test_suites()
for path in test_suites:
name = re.sub(r'^\d+-|\.ini$', '', path.name)
- targets += [name];
+ targets += [name]
env.AddCustomTarget(
name = f"marlin_{name}",
diff --git a/buildroot/share/PlatformIO/scripts/configuration.py b/buildroot/share/PlatformIO/scripts/configuration.py
index e7b4998f75..7d811b47ed 100755
--- a/buildroot/share/PlatformIO/scripts/configuration.py
+++ b/buildroot/share/PlatformIO/scripts/configuration.py
@@ -3,7 +3,7 @@
# configuration.py
# Apply options from config.ini to the existing Configuration headers
#
-import re, shutil, configparser, datetime
+import re, os, shutil, configparser, datetime
from pathlib import Path
verbose = 0
@@ -145,8 +145,6 @@ def fetch_example(url):
blab("Couldn't find curl or wget", -1)
return False
- import os
-
# Reset configurations to default
os.system("git checkout HEAD Marlin/*.h")
diff --git a/buildroot/share/PlatformIO/scripts/offset_and_rename.py b/buildroot/share/PlatformIO/scripts/offset_and_rename.py
index c7bb002b48..29d66151af 100644
--- a/buildroot/share/PlatformIO/scripts/offset_and_rename.py
+++ b/buildroot/share/PlatformIO/scripts/offset_and_rename.py
@@ -23,18 +23,56 @@ if pioutil.is_pio_build():
LD_FLASH_OFFSET = board.get("build.offset")
marlin.relocate_vtab(LD_FLASH_OFFSET)
- # Flash size
- maximum_flash_size = board.get("upload.maximum_size") // 1024
+ # Chip total flash (bytes) from board JSON
+ _max_flash_bytes = int(board.get("upload.maximum_size"))
+
+ # Keep STM32_FLASH_SIZE as the chip total (KiB)
+ maximum_flash_size = _max_flash_bytes // 1024
marlin.replace_define('STM32_FLASH_SIZE', maximum_flash_size)
+ # Also compute available flash after bootloader for Project Inspect
+ try:
+ _offset_int = int(str(LD_FLASH_OFFSET), 0)
+ except Exception:
+ _offset_int = 0
+
+ if _max_flash_bytes and _offset_int:
+ _avail = _max_flash_bytes - _offset_int
+ if _avail > 0:
+ # Update in-memory manifest so Advanced Memory Usage shows the correct total
+ try:
+ board.manifest.setdefault("upload", {})
+ board.manifest["upload"]["maximum_size"] = _avail
+ except Exception:
+ pass
+
# Get upload.maximum_ram_size (defined by /buildroot/share/PlatformIO/boards/VARIOUS.json)
maximum_ram_size = board.get("upload.maximum_ram_size")
- for i, flag in enumerate(env["LINKFLAGS"]):
- if "-Wl,--defsym=LD_FLASH_OFFSET" in flag:
- env["LINKFLAGS"][i] = "-Wl,--defsym=LD_FLASH_OFFSET=" + LD_FLASH_OFFSET
- if "-Wl,--defsym=LD_MAX_DATA_SIZE" in flag:
- env["LINKFLAGS"][i] = "-Wl,--defsym=LD_MAX_DATA_SIZE=" + str(maximum_ram_size - 40)
+ # Helper: replace existing -Wl,--defsym=NAME=... or append if missing
+ def _upsert_defsym(name, value):
+ key = "-Wl,--defsym=" + name
+ if isinstance(value, int):
+ val = key + "=" + (hex(value) if value >= 10 else str(value))
+ else:
+ val = key + "=" + str(value)
+ found = False
+ for i, flag in enumerate(env["LINKFLAGS"]):
+ if key in flag:
+ env["LINKFLAGS"][i] = val
+ found = True
+ break
+ if not found:
+ env.Append(LINKFLAGS=[val])
+
+ # Provide the symbols the linker script expects:
+ # ORIGIN = 0x08000000 + LD_FLASH_OFFSET
+ # LENGTH = LD_MAX_SIZE - LD_FLASH_OFFSET
+ _upsert_defsym("LD_FLASH_OFFSET", _offset_int)
+ _upsert_defsym("LD_MAX_SIZE", _max_flash_bytes)
+
+ if maximum_ram_size:
+ _upsert_defsym("LD_MAX_DATA_SIZE", int(maximum_ram_size) - 40)
#
# For build.encrypt_mks rename and encode the firmware file.
@@ -62,8 +100,37 @@ if pioutil.is_pio_build():
from pathlib import Path
from datetime import datetime
from os import path
- _newpath = Path(target[0].dir.path, datetime.now().strftime(new_name.replace('{date}', '%Y%m%d').replace('{time}', '%H%M%S')))
- Path(target[0].path).replace(_newpath)
- env['PROGNAME'] = path.splitext(_newpath)[0]
+
+ # Build the timestamped base name from your template (may already include ".bin")
+ base = datetime.now().strftime(new_name.replace('{date}', '%Y%m%d').replace('{time}', '%H%M%S'))
+
+ # Ensure correct extensions for both outputs
+ if base.lower().endswith('.bin'):
+ stem = base[:-4] # strip ".bin" for the ELF stem
+ bin_name = base
+ else:
+ stem = base
+ bin_name = base + '.bin'
+
+ elf_name = stem + '.elf'
+
+ # Current files produced by PlatformIO
+ bin_old = Path(target[0].path) # e.g. .pio/build//firmware.bin
+ elf_old = Path(source[0].path) # e.g. .pio/build//firmware.elf
+
+ # New paths in the same directories
+ bin_new = Path(target[0].dir.path, bin_name)
+ elf_new = Path(source[0].dir.path, elf_name)
+
+ # Rename both
+ bin_old.replace(bin_new)
+ elf_old.replace(elf_new)
+
+ # Update PROGNAME (base without extension) for any later steps that read it
+ env['PROGNAME'] = path.splitext(str(bin_new))[0]
+
+ # Optional: log the results
+ print(f"FIRMWARE BIN: {bin_new}")
+ print(f"FIRMWARE ELF: {elf_new}")
marlin.add_post_action(rename_target)
diff --git a/buildroot/share/PlatformIO/scripts/preflight-checks.py b/buildroot/share/PlatformIO/scripts/preflight-checks.py
index 561b3bc50b..80f0985cfd 100644
--- a/buildroot/share/PlatformIO/scripts/preflight-checks.py
+++ b/buildroot/share/PlatformIO/scripts/preflight-checks.py
@@ -125,6 +125,12 @@ if pioutil.is_pio_build():
#
rm_ofile("inc", "Warnings")
+ #
+ # Renew date/time
+ #
+ rm_ofile("gcode/host", "M115")
+ rm_ofile("lcd/menu", "menu_info")
+
#
# Rebuild 'settings.cpp' for EEPROM_INIT_NOW
#
diff --git a/buildroot/share/PlatformIO/scripts/schema.py b/buildroot/share/PlatformIO/scripts/schema.py
index fcfae998c4..6a669d887e 100755
--- a/buildroot/share/PlatformIO/scripts/schema.py
+++ b/buildroot/share/PlatformIO/scripts/schema.py
@@ -1,16 +1,34 @@
#!/usr/bin/env python3
-#
-# schema.py
-#
-# Used by signature.py via common-dependencies.py to generate a schema file during the PlatformIO build
-# when CONFIG_EXPORT is defined in the configuration.
-#
-# This script can also be run standalone from within the Marlin repo to generate JSON and YAML schema files.
-#
-# This script is a companion to abm/js/schema.js in the MarlinFirmware/AutoBuildMarlin project, which has
-# been extended to evaluate conditions and can determine what options are actually enabled, not just which
-# options are uncommented. That will be migrated to this script for standalone migration.
-#
+"""
+schema.py
+
+Extract firmware configuration into structured JSON or YAML schema format.
+
+Used by signature.py via common-dependencies.py to generate a schema file during the
+PlatformIO build when CONFIG_EXPORT is defined in the configuration.
+
+This script can also be run standalone from within the Marlin repo, and is a companion to
+abm/js/schema.js in the MarlinFirmware/AutoBuildMarlin project, which has been extended to
+evaluate conditions and can determine what options are actually enabled, not just which
+options are uncommented. That will be migrated to this script for standalone migration.
+
+Usage: schema.py [-h] [some|json|jsons|group|yml|yaml]
+
+Process Marlin firmware configuration files (Configuration.h and Configuration_adv.h)
+to produce structured output suitable for documentation, tooling, or automated processing.
+
+Positional arguments:
+ some Generate both JSON and YAML output (schema.json and schema.yml)
+ json Generate JSON output (schema.json)
+ jsons Generate grouped JSON output with wildcard options (schema.json and schema_grouped.json)
+ group Generate grouped JSON output only (schema_grouped.json)
+ yml Generate YAML output (schema.yml)
+ yaml Same as 'yml'
+
+Optional arguments:
+ -h, --help Show this help message and exit
+"""
+
import re, json
from pathlib import Path
@@ -475,10 +493,10 @@ def main():
def inargs(c): return len(set(args) & set(c)) > 0
# Help / Unknown option
- unk = not inargs(['some','json','jsons','group','yml','yaml'])
+ unk = not inargs(['some','json','jsons','group','yml','yaml', '-h', '--help'])
if (unk): print(f"Unknown option: '{args[0]}'")
if inargs(['-h', '--help']) or unk:
- print("Usage: schema.py [some|json|jsons|group|yml|yaml]...")
+ print("Usage: schema.py [-h] [some|json|jsons|group|yml|yaml]")
print(" some = json + yml")
print(" jsons = json + group")
return
diff --git a/buildroot/share/PlatformIO/scripts/signature.py b/buildroot/share/PlatformIO/scripts/signature.py
index 5cda69d89b..2384fe9f05 100755
--- a/buildroot/share/PlatformIO/scripts/signature.py
+++ b/buildroot/share/PlatformIO/scripts/signature.py
@@ -281,7 +281,7 @@ def compute_build_signature(env):
for line in sec_lines[1:]: sec_list += '\n' + ext_fmt.format('', line)
config_ini = build_path / 'config.ini'
- with config_ini.open('w') as outfile:
+ with config_ini.open('w', encoding='utf-8') as outfile:
filegrp = { 'Configuration.h':'config:basic', 'Configuration_adv.h':'config:advanced' }
vers = build_defines["CONFIGURATION_H_VERSION"]
dt_string = datetime.now().strftime("%Y-%m-%d at %H:%M:%S")
diff --git a/buildroot/share/dwin/bin/README.md b/buildroot/share/dwin/bin/README.md
index c78f4eb97f..b439d53905 100644
--- a/buildroot/share/dwin/bin/README.md
+++ b/buildroot/share/dwin/bin/README.md
@@ -42,13 +42,15 @@ These tools must be run from a terminal with access to an installed Python 3 and
Pillow is most easily installed with pip:
- python3 -m pip install pillow
+```sh
+python3 -m pip install pillow
+```
## Examples
These tools process an `.ICO` file that you specify. The safest method is to create a folder and copy your `.ICO` file there. For example:
-```
+```sh
$ mkdir hackicons
$ cp 7.ICO hackicons
$ cd hackicons
@@ -61,11 +63,13 @@ The following explanations will refer back to this layout.
If you want to edit the individual icons stored in an ICO file (or add more images) you'll first need to extract all the images from the archive using `splitIco.py`.
#### Usage:
-```
+
+```sh
splitIco.py #.ICO foldername
```
#### Splitting .ICO FIle In Windows:
+
- Create `Split-ICO.bat` file in this folder with the following code:
- `for /f %%f in ('dir *.ICO /B /O:-D') do splitico.py %%f %%f-icons`
- Paste `.ICO` file into this folder
@@ -99,11 +103,13 @@ Once the individual JPEG files have been saved they can be edited using common g
If you want to create an ICO file you'll need to use `makeIco.py`.
#### Usage:
-```
+
+```sh
makeIco.py foldername #.ICO
```
#### Making .ICO FIle In Windows:
+
- Create `Make-ICO.bat` file in this folder with the following code:
- ```
setlocal enabledelayedexpansion
diff --git a/buildroot/share/fonts/README.md b/buildroot/share/fonts/README.md
index b80de8e26e..57b4d1f57e 100644
--- a/buildroot/share/fonts/README.md
+++ b/buildroot/share/fonts/README.md
@@ -1,21 +1,23 @@
# Marlin fonts
## Author and license
+
The original author of the following font files is [A. Hardtung](https://github.com/AnHardt).
Any copyright is dedicated to the Public Domain.
https://creativecommons.org/publicdomain/zero/1.0/
- - HD44780_C.fon ([fe2bd23](https://github.com/MarlinFirmware/Marlin/commit/fe2bd237d556439499dfdee852c1550c7a16430a))
- - HD44780_J.fon ([fe2bd23](https://github.com/MarlinFirmware/Marlin/commit/fe2bd237d556439499dfdee852c1550c7a16430a))
- - HD44780_W.fon ([fe2bd23](https://github.com/MarlinFirmware/Marlin/commit/fe2bd237d556439499dfdee852c1550c7a16430a))
- - ISO10646-1.fon ([be79235](https://github.com/MarlinFirmware/Marlin/commit/be79235ef255a5c42fd385820447ec351f23b9b1))
- - ISO10646_5_Cyrillic.fon ([fe2bd23](https://github.com/MarlinFirmware/Marlin/commit/fe2bd237d556439499dfdee852c1550c7a16430a))
- - ISO10646_CN.fon ([6b1b718](https://github.com/MarlinFirmware/Marlin/commit/6b1b71837c98ceab55db7433357a13cd829d1ede))
- - ISO10646_Kana.fon ([fe2bd23](https://github.com/MarlinFirmware/Marlin/commit/fe2bd237d556439499dfdee852c1550c7a16430a))
- - Marlin_symbols.fon ([fe2bd23](https://github.com/MarlinFirmware/Marlin/commit/fe2bd237d556439499dfdee852c1550c7a16430a))
+- HD44780_C.fon ([fe2bd23](https://github.com/MarlinFirmware/Marlin/commit/fe2bd237d556439499dfdee852c1550c7a16430a))
+- HD44780_J.fon ([fe2bd23](https://github.com/MarlinFirmware/Marlin/commit/fe2bd237d556439499dfdee852c1550c7a16430a))
+- HD44780_W.fon ([fe2bd23](https://github.com/MarlinFirmware/Marlin/commit/fe2bd237d556439499dfdee852c1550c7a16430a))
+- ISO10646-1.fon ([be79235](https://github.com/MarlinFirmware/Marlin/commit/be79235ef255a5c42fd385820447ec351f23b9b1))
+- ISO10646_5_Cyrillic.fon ([fe2bd23](https://github.com/MarlinFirmware/Marlin/commit/fe2bd237d556439499dfdee852c1550c7a16430a))
+- ISO10646_CN.fon ([6b1b718](https://github.com/MarlinFirmware/Marlin/commit/6b1b71837c98ceab55db7433357a13cd829d1ede))
+- ISO10646_Kana.fon ([fe2bd23](https://github.com/MarlinFirmware/Marlin/commit/fe2bd237d556439499dfdee852c1550c7a16430a))
+- Marlin_symbols.fon ([fe2bd23](https://github.com/MarlinFirmware/Marlin/commit/fe2bd237d556439499dfdee852c1550c7a16430a))
Additional changes to the original font files distributed with Marlin are copyrighted under the terms of the [GPLv3](https://www.gnu.org/licenses/gpl-3.0.txt) license.
## Documentation
+
For detailed information about adding new fonts to Marlin [see this article](https://marlinfw.org/docs/development/fonts.html).
diff --git a/buildroot/share/fonts/buildhzk.py b/buildroot/share/fonts/buildhzk.py
index 2b59980f66..dea8b66fed 100644
--- a/buildroot/share/fonts/buildhzk.py
+++ b/buildroot/share/fonts/buildhzk.py
@@ -47,6 +47,11 @@ def marlin_font_hzk():
with open(f[2], 'rb') as file:
print(f'{f[0]}x{f[1]}')
font = bdflib.reader.read_bdf(file)
+
+ if font is None:
+ print(f'Failed to read font from {f[2]}')
+ continue # Skip this font and move to the next one
+
for glyph in range(128):
bits = glyph_bits(f[0], f[1], font, glyph)
glyph_bytes = math.ceil(f[0]/8)
@@ -58,6 +63,7 @@ def marlin_font_hzk():
except OverflowError:
print('Overflow')
print(f'{glyph}')
- print(font[glyph])
+ if font and glyph in font: print(font[glyph])
+ else: print(f'Glyph {glyph} not found in the font or font is None')
for b in bits: print(f'{b:0{f[0]}b}')
return
diff --git a/buildroot/share/git/README.md b/buildroot/share/git/README.md
index 4dcd7c15a7..c1474c603b 100755
--- a/buildroot/share/git/README.md
+++ b/buildroot/share/git/README.md
@@ -16,42 +16,42 @@ The following scripts can be used on any system with a GNU environment to speed
#### Remotes
-File|Description
-----|-----------
-mfadd [user]|Add and Fetch Remote - Add and fetch another user's Marlin fork. Optionally, check out one of their branches.
-mfinit|Init Working Copy - Create a remote named '`upstream`' (for use by the other scripts) pointing to the '`MarlinFirmware`' fork. This only needs to be used once. Newer versions of Github Desktop may create `upstream` on your behalf.
+| File | Description |
+| ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| mfadd [user] | Add and Fetch Remote - Add and fetch another user's Marlin fork. Optionally, check out one of their branches. |
+| mfinit | Init Working Copy - Create a remote named '`upstream`' (for use by the other scripts) pointing to the '`MarlinFirmware`' fork. This only needs to be used once. Newer versions of Github Desktop may create `upstream` on your behalf. |
#### Branches
-File|Description
-----|-----------
-mfnew [branch]|New Branch - Creates a new branch based on `upstream/[PR-target]`. All new work should start with this command.
-mffp|Fast Push - Push the HEAD or a commit ID to `upstream` immediately. Requires privileged access to the MarlinFirmware repo.
-firstpush|Push the current branch to 'origin' -your fork on Github- and set it to track '`origin`'. The branch needs to reside on Github before you can use it to make a PR.
+| File | Description |
+| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
+| mfnew [branch] | New Branch - Creates a new branch based on `upstream/[PR-target]`. All new work should start with this command. |
+| mffp | Fast Push - Push the HEAD or a commit ID to `upstream` immediately. Requires privileged access to the MarlinFirmware repo. |
+| firstpush | Push the current branch to 'origin' -your fork on Github- and set it to track '`origin`'. The branch needs to reside on Github before you can use it to make a PR. |
#### Making / Amending PRs
-File|Description
-----|-----------
-mfpr|Pull Request - Open the Compare / Pull Request page on Github for the current branch.
-mfrb|Do a `git rebase` then `git rebase -i` of the current branch onto `upstream/[PR-target]`. Use this to edit your commits anytime.
-mfqp|Quick Patch - Commit all current changes as "patch", then do `mfrb`, followed by `git push -f` if no conflicts need resolution.
+| File | Description |
+| ---- | -------------------------------------------------------------------------------------------------------------------------------- |
+| mfpr | Pull Request - Open the Compare / Pull Request page on Github for the current branch. |
+| mfrb | Do a `git rebase` then `git rebase -i` of the current branch onto `upstream/[PR-target]`. Use this to edit your commits anytime. |
+| mfqp | Quick Patch - Commit all current changes as "patch", then do `mfrb`, followed by `git push -f` if no conflicts need resolution. |
#### Documentation
-File|Description
-----|-----------
-mfdoc|Build the documentation with Jekyll and preview it locally.
-mfpub|Build and publish the documentation to marlinfw.org.
+| File | Description |
+| ----- | ----------------------------------------------------------- |
+| mfdoc | Build the documentation with Jekyll and preview it locally. |
+| mfpub | Build and publish the documentation to marlinfw.org. |
#### Utilities
-File|Description
-----|-----------
-ghtp -[h/s]|Set the protocol to use for all remotes. -h for HTTPS, -s for SSL.
-ghpc [-f]|Push current branch to 'origin' or to the remote indicated by the error.
-mfinfo|This utility script is used by the other scripts to get:
- The upstream project ('`MarlinFirmware`')
- the '`origin`' project (i.e., your Github username),
- the repository name ('`Marlin`'),
- the PR target branch ('`bugfix-1.1.x`'), and
- the current branch (or the first command-line argument).
By itself, `mfinfo` simply prints these values to the console.
-mfclean |Prune your merged and remotely-deleted branches.
+| File | Description |
+| ------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| ghtp -[h/s] | Set the protocol to use for all remotes. -h for HTTPS, -s for SSL. |
+| ghpc [-f] | Push current branch to 'origin' or to the remote indicated by the error. |
+| mfinfo | This utility script is used by the other scripts to get:
- The upstream project ('`MarlinFirmware`')
- the '`origin`' project (i.e., your Github username),
- the repository name ('`Marlin`'),
- the PR target branch ('`bugfix-1.1.x`'), and
- the current branch (or the first command-line argument).
By itself, `mfinfo` simply prints these values to the console. |
+| mfclean | Prune your merged and remotely-deleted branches. |
---
diff --git a/buildroot/share/scripts/g29_auto.py b/buildroot/share/scripts/g29_auto.py
index 5cf27b9968..c2ac083d1e 100755
--- a/buildroot/share/scripts/g29_auto.py
+++ b/buildroot/share/scripts/g29_auto.py
@@ -11,27 +11,27 @@ from __future__ import print_function
folder = './'
my_file = 'test.gcode'
-# this is the minimum of G1 instructions which should be between 2 different heights
-min_g1 = 3
+# The minimum number of G1 instructions that should be between 2 different heights
+min_g = 3
-# maximum number of lines to parse, I don't want to parse the complete file
-# only the first plane is we are interested in
-max_g1 = 100000000
+# Maximum number of lines to parse. We don't want to parse the
+# whole file since we're only interested in the first plane.
+max_g = 100000000
-# g29 keyword
-g29_keyword = 'g29'
-g29_keyword = g29_keyword.upper()
+# G29 keyword
+g29_keyword = 'G29'
-# output filename
+# Output filename
output_file = folder + 'g29_' + my_file
-# input filename
+# Input filename
input_file = folder + my_file
-# minimum scan size
+# Minimum scan size
min_size = 40
probing_points = 3 # points x points
+max_lines = 1500
-# other stuff
+# Other stuff
min_x = 500
min_y = min_x
max_x = -500
@@ -43,13 +43,19 @@ lines_of_g1 = 0
gcode = []
+g29_found = False
+g28_found = False
-# return only g1-lines
-def has_g1(line):
- return line[:2].upper() == "G1"
+YELLOW = '\033[33m'
+GREEN = '\033[32m'
+RED = '\033[31m'
+RESET = '\033[0m'
+# Return only G0-G1 lines
+def has_g_move(line):
+ return line[:2].upper() in ("G0", "G1")
-# find position in g1 (x,y,z)
+# Find position in G move (x,y,z)
def find_axis(line, axis):
found = False
number = ""
@@ -73,7 +79,7 @@ def find_axis(line, axis):
return None
-# save the min or max-values for each axis
+# Save the min or max-values for each axis
def set_mima(line):
global min_x, max_x, min_y, max_y, last_z
@@ -90,7 +96,7 @@ def set_mima(line):
return min_x, max_x, min_y, max_y
-# find z in the code and return it
+# Find z in the code and return it
def find_z(gcode, start_at_line=0):
for i in range(start_at_line, len(gcode)):
my_z = find_axis(gcode[i], 'Z')
@@ -103,65 +109,74 @@ def z_parse(gcode, start_at_line=0, end_at_line=0):
all_z = []
line_between_z = []
z_at_line = []
- # last_z = 0
+ #last_z = 0
last_i = -1
while len(gcode) > i:
- try:
- z, i = find_z(gcode, i + 1)
- except TypeError:
- break
+ result = find_z(gcode, i + 1)
+
+ if result is None:
+ raise ValueError(f'{RED}Unable to determine Z height.{RESET}')
+
+ z, i = result
all_z.append(z)
z_at_line.append(i)
temp_line = i - last_i -1
line_between_z.append(i - last_i - 1)
- # last_z = z
+ #last_z = z
last_i = i
- if 0 < end_at_line <= i or temp_line >= min_g1:
- # print('break at line {} at height {}'.format(i, z))
+ if 0 < end_at_line <= i or temp_line >= min_g:
+ #print('break at line {} at height {}'.format(i, z))
break
line_between_z = line_between_z[1:]
return all_z, line_between_z, z_at_line
-# get the lines which should be the first layer
+# Get the lines which should be the first layer
def get_lines(gcode, minimum):
i = 0
- all_z, line_between_z, z_at_line = z_parse(gcode, end_at_line=max_g1)
+ all_z, line_between_z, z_at_line = z_parse(gcode, end_at_line=max_g)
+ #print('Detected Z heights:', all_z)
for count in line_between_z:
i += 1
if count > minimum:
- # print('layer: {}:{}'.format(z_at_line[i-1], z_at_line[i]))
+ #print('layer: {}:{}'.format(z_at_line[i-1], z_at_line[i]))
return z_at_line[i - 1], z_at_line[i]
-with open(input_file, 'r') as file:
+with open(input_file, 'r', encoding='utf_8') as file:
lines = 0
for line in file:
lines += 1
- if lines > 1000:
+ if lines > max_lines:
break
- if has_g1(line):
+ if has_g_move(line):
gcode.append(line)
file.close()
-start, end = get_lines(gcode, min_g1)
+layer_range = get_lines(gcode, min_g)
+
+if layer_range is None:
+ raise ValueError(f'{RED}Unable to determine layer range.{RESET}')
+
+start, end = layer_range
+
for i in range(start, end):
set_mima(gcode[i])
print('x_min:{} x_max:{}\ny_min:{} y_max:{}'.format(min_x, max_x, min_y, max_y))
-# resize min/max - values for minimum scan
+# Resize min/max - values for minimum scan
if max_x - min_x < min_size:
offset_x = int((min_size - (max_x - min_x)) / 2 + 0.5) # int round up
- # print('min_x! with {}'.format(int(max_x - min_x)))
+ #print('min_x! with {}'.format(int(max_x - min_x)))
min_x = int(min_x) - offset_x
max_x = int(max_x) + offset_x
if max_y - min_y < min_size:
offset_y = int((min_size - (max_y - min_y)) / 2 + 0.5) # int round up
- # print('min_y! with {}'.format(int(max_y - min_y)))
+ #print('min_y! with {}'.format(int(max_y - min_y)))
min_y = int(min_y) - offset_y
max_y = int(max_y) + offset_y
@@ -172,17 +187,24 @@ new_command = 'G29 L{0} R{1} F{2} B{3} P{4}\n'.format(min_x,
max_y,
probing_points)
-out_file = open(output_file, 'w')
-in_file = open(input_file, 'r')
+with open(input_file, 'r', encoding='utf_8') as in_file, open(output_file, 'w', encoding='utf_8') as out_file:
+ for line in in_file:
+ # Check if G29 already exists
+ if line.strip().upper().startswith(g29_keyword):
+ g29_found = True
+ out_file.write(new_command)
+ print(f'{YELLOW}Write G29.{RESET}')
+ else:
+ out_file.write(line)
-for line in in_file:
- if line[:len(g29_keyword)].upper() == g29_keyword:
- out_file.write(new_command)
- print('write G29')
- else:
- out_file.write(line)
+ # If we find G28 and G29 wasn't found earlier, insert G29 after G28
+ if not g29_found and line.strip().upper().startswith('G28'):
+ g28_found = True # Mark that G28 was found
+ out_file.write(new_command) # Insert G29 command
+ print(f'{YELLOW}Note: G29 was not found.\nInserted G29 after G28.{RESET}')
-file.close()
-out_file.close()
-
-print('auto G29 finished')
+# Debugging messages
+if not g28_found and not g29_found:
+ print(f'{RED}Error: G28 not found! G29 was not added.{RESET}')
+else:
+ print(f'{GREEN}auto G29 finished!{RESET}')
diff --git a/buildroot/share/scripts/linesformat.py b/buildroot/share/scripts/linesformat.py
new file mode 100755
index 0000000000..4cbe8190f5
--- /dev/null
+++ b/buildroot/share/scripts/linesformat.py
@@ -0,0 +1,72 @@
+#!/usr/bin/env python3
+"""
+Formatter script for *.h, *.c, *.cpp, *.md, *.txt, and other source files
+
+usage: linesformat.py [infile] [outfile]
+
+With no parameters convert STDIN to STDOUT
+"""
+
+import sys, re, argparse
+
+do_log = False
+def logmsg(msg, line):
+ if do_log: print(msg, line)
+
+def format_text(argv):
+ parser = argparse.ArgumentParser(description="Formatter script for source files")
+ parser.add_argument('infile', nargs='?', default=None, help="Input file to read from. If not provided, reads from stdin.")
+ parser.add_argument('outfile', nargs='?', default=None, help="Output file to write to. If not provided, writes to stdout.")
+ parser.add_argument('-v', action='store_true', help="Enable logging.")
+
+ args = parser.parse_args(argv)
+
+ src_file = args.infile or 'stdin'
+ dst_file = args.outfile or None
+
+ scnt = 0
+ for arg in argv:
+ if arg == '-v':
+ global do_log
+ do_log = args.v or True
+ elif scnt == 0:
+ # Get a source file if specified. Default destination is the same file
+ src_file = dst_file = arg
+ scnt += 1
+ elif scnt == 1:
+ # Get destination file if specified
+ dst_file = arg
+ scnt += 1
+
+ # No text to process yet
+ file_text = ''
+
+ if src_file == 'stdin':
+ # If no source file specified read from STDIN
+ file_text = sys.stdin.read()
+ else:
+ # Directory will be processed recursively with editorconfig
+ if os.path.isdir(src_file):
+ apply_editorconfig_rules(src_file)
+ return
+
+ # Open and read the file src_file
+ with open(src_file, 'r', encoding='utf-8') as rf: file_text = rf.read()
+
+ if len(file_text) == 0:
+ print('No text to process')
+ return
+
+ # Read from file or STDIN until it terminates
+ filtered = re.sub(r'\s+$', '', file_text) + '\n'
+ if dst_file:
+ with open(dst_file, 'w', encoding='utf-8') as wf: wf.write(filtered)
+ else:
+ print(filtered)
+
+# Python standard startup for command line with arguments
+if __name__ == '__main__':
+ format_text(sys.argv[1:])
+
+# Usage
+apply_editorconfig_rules('/path/to/your/folder')
diff --git a/buildroot/share/scripts/pinsformat.py b/buildroot/share/scripts/pinsformat.py
index c1d88934b7..d9712bbc63 100755
--- a/buildroot/share/scripts/pinsformat.py
+++ b/buildroot/share/scripts/pinsformat.py
@@ -1,14 +1,13 @@
#!/usr/bin/env python3
+"""
+Formatter script for pins_MYPINS.h files
-#
-# Formatter script for pins_MYPINS.h files
-#
-# Usage: pinsformat.py [infile] [outfile]
-#
-# With no parameters convert STDIN to STDOUT
-#
+usage: pinsformat.py [infile] [outfile]
-import sys, re
+With no parameters convert STDIN to STDOUT
+"""
+
+import sys, re, argparse
do_log = False
def logmsg(msg, line):
@@ -39,21 +38,28 @@ mpatt = [ r'-?\d{1,3}', r'P[A-I]\d+', r'P\d_\d+', r'Pin[A-Z]\d\b' ]
mstr = '|'.join(mpatt)
mexpr = [ re.compile(f'^{m}$') for m in mpatt ]
-# Corrsponding padding for each pattern
+# Corresponding padding for each pattern
ppad = [ 3, 4, 5, 5 ]
# Match a define line
definePinPatt = re.compile(rf'^\s*(//)?#define\s+[A-Z_][A-Z0-9_]+?_PIN\s+({mstr})\s*(//.*)?$')
def format_pins(argv):
- src_file = 'stdin'
- dst_file = None
+ parser = argparse.ArgumentParser(description="Formatter script for pins_MYPINS.h files")
+ parser.add_argument('infile', nargs='?', default=None, help="Input file to read from. If not provided, reads from stdin.")
+ parser.add_argument('outfile', nargs='?', default=None, help="Output file to write to. If not provided, writes to stdout.")
+ parser.add_argument('-v', action='store_true', help="Enable logging.")
+
+ args = parser.parse_args(argv)
+
+ src_file = args.infile or 'stdin'
+ dst_file = args.outfile or None
scnt = 0
for arg in argv:
if arg == '-v':
global do_log
- do_log = True
+ do_log = args.v or True
elif scnt == 0:
# Get a source file if specified. Default destination is the same file
src_file = dst_file = arg
@@ -258,7 +264,7 @@ def process_text(txt):
if wDict['check_comment_next']:
# Comments in column 50
- line = rpad('', col_comment) + r[1]
+ line = rpad('', col_comment) + (r[1] if r else '')
elif trySkip1(wDict): pass #define SKIP_ME
elif tryPindef(wDict): pass #define MY_PIN [pin]
diff --git a/buildroot/share/scripts/upload.py b/buildroot/share/scripts/upload.py
index a20c2701fe..66397ae557 100644
--- a/buildroot/share/scripts/upload.py
+++ b/buildroot/share/scripts/upload.py
@@ -81,6 +81,7 @@ def Upload(source, target, env):
_Send('M21')
Responses = _Recv()
if len(Responses) < 1 or not any('SD card ok' in r for r in Responses):
+ debugPrint(Responses)
raise Exception('Error accessing SD card')
debugPrint('SD Card OK')
return True
diff --git a/buildroot/tests/rambo b/buildroot/tests/rambo
index 13a8e1e719..3198c71cf3 100755
--- a/buildroot/tests/rambo
+++ b/buildroot/tests/rambo
@@ -71,8 +71,8 @@ opt_set MOTHERBOARD BOARD_RAMBO EXTRUDERS 0 TEMP_SENSOR_BED 1 TEMP_SENSOR_PROBE
DEFAULT_MAX_ACCELERATION '{ 3000, 3000, 100 }' \
MANUAL_FEEDRATE '{ 50*60, 50*60, 4*60 }' \
AXIS_RELATIVE_MODES '{ false, false, false }'
-opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER FIX_MOUNTED_PROBE Z_SAFE_HOMING
-exec_test $1 $2 "Rambo heated bed only" "$3"
+opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER FIX_MOUNTED_PROBE Z_SAFE_HOMING FT_MOTION
+exec_test $1 $2 "Rambo with ZERO EXTRUDERS, heated bed, FT_MOTION" "$3"
#
# Rambo with MMU2
diff --git a/docs/BinaryFileTransferProtocol.md b/docs/BinaryFileTransferProtocol.md
index 6d52671789..ebb1194aac 100644
--- a/docs/BinaryFileTransferProtocol.md
+++ b/docs/BinaryFileTransferProtocol.md
@@ -1,10 +1,13 @@
# Marlin Binary File Transfer (BFT)
+
Marlin is capable of transferring binary data to the internal storage (SD card) via serial when built with `BINARY_FILE_TRANSFER` enabled. The following is a description of the binary protocol that must be used to conduct transfers once the printer is in binary mode after running `M28 B1`.
## Data Endianness
+
All data structures are **little-endian**! This means that when constructing the packets with multi-byte values, the lower bits are packed first. For example, each packet should start with a 16-bit start token with the value of `0xB5AD`. The data itself should start with a value of `0xAD` followed by `0xB5` etc.
An example Connection SYNC packet, which is only a header and has no payload:
+
```
S S P P P H
t y r a a e
@@ -35,16 +38,17 @@ ADB5 00 0 1 0000 0103
+-------------------------------+-------------------------------+
```
-| Field | Width | Description |
-|-----------------|---------|---|
-| Start Token | 16 bits | Each packet must start with the 16-bit value `0xB5AD`. |
-| Sync Number | 8 bits | Synchronization value, each packet after sync should increment this value by 1. |
-| Protocol ID | 4 bits | Protocol ID. `0` for Connection Control, `1` for Transfer. See Below. |
-| Packet Type | 4 bits | Packet Type ID. Depends on the Protocol ID, see below. |
+| Field | Width | Description |
+| --------------- | ------- | ------------------------------------------------------------------------------------------------- |
+| Start Token | 16 bits | Each packet must start with the 16-bit value `0xB5AD`. |
+| Sync Number | 8 bits | Synchronization value, each packet after sync should increment this value by 1. |
+| Protocol ID | 4 bits | Protocol ID. `0` for Connection Control, `1` for Transfer. See Below. |
+| Packet Type | 4 bits | Packet Type ID. Depends on the Protocol ID, see below. |
| Payload Length | 16 bits | Length of payload data. If this value is greater than 0, a packet payload will follow the header. |
-| Header Checksum | 16 bits | 16-bit Fletchers checksum of the header data excluding the Start Token |
+| Header Checksum | 16 bits | 16-bit Fletchers checksum of the header data excluding the Start Token |
## Packet Payload
+
If the Payload Length field of the header is non-zero, payload data is expected to follow.
```
@@ -57,15 +61,17 @@ If the Payload Length field of the header is non-zero, payload data is expected
+-------------------------------+-------------------------------+
```
-| Field | Width | Description |
-|-----------------|------------------------|---|
-| Payload Data | Payload Length bytes | Payload data. This should be no longer than the buffer length reported by the Connection SYNC operation. |
-| Packet Checksum | 16 bits | 16-bit Fletchers checksum of the header and payload, including the Header Checksum, but excluding the Start Token. |
+| Field | Width | Description |
+| --------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------ |
+| Payload Data | Payload Length bytes | Payload data. This should be no longer than the buffer length reported by the Connection SYNC operation. |
+| Packet Checksum | 16 bits | 16-bit Fletchers checksum of the header and payload, including the Header Checksum, but excluding the Start Token. |
## Fletchers Checksum
+
Data packets require a checksum for the header and a checksum for the entire packet if the packet has a payload. In both cases the checksum does not include the first two bytes of the packet, the Start Token.
A simple example implementation:
+
```c++
uint16_t cs = 0;
for (size_t i = 2; i` message. This acknowledgement only signifies the client has received the packet and that the header was well formed. An `ok` acknowledgement does not signify successful operation in cases where the client also sends detailed response messages (see details on packet types below). Most notably, with the current implementation the client will still respond `ok` when a client sends multiple packets with the same Sync Number, but will not send the proper response or any errors.
**NOTE**: The `ok` acknowledgement is sent before any packet type specific output. The `SYNC` value should match the Sync Number of the last packet sent, and the next packet sent should use a Sync Number of this value + 1.
Example:
+
```
ok1
```
### rs
+
In the case of a packet being sent out of order, where the Sync Number is not the previous Sync Number + 1, an `rs` message will be sent with the last Sync Number received.
Example:
+
```
rs1
```
## Connection Control (`Protocol ID` 0)
+
`Protocol ID` 0 packets control the binary connection itself. There are only 2 types:
-| Packet Type | Name | Description |
-|---|---|---|
-| 1 | SYNC | Synchronize host and client and get connection info. |
-| 2 | CLOSE | Close the binary connection and switch back to ASCII. |
+| Packet Type | Name | Description |
+| ----------- | ----- | ----------------------------------------------------- |
+| 1 | SYNC | Synchronize host and client and get connection info. |
+| 2 | CLOSE | Close the binary connection and switch back to ASCII. |
### SYNC Packet
+
A SYNC packet should be the first packet sent by a host after enabling binary mode. On success, a sync response will be sent.
**Note**: This is the only packet that is not acknowledged with an `ok` response.
Returns a sync response:
+
```
ss,,..
```
-| Value | Description |
-|---|---|
-| SYNC | The current Sync Number, this should be used in the next packet sent and incremented by 1 for each packet sent after. |
-| BUFFER_SIZE | The client buffer size. Packet Payload Length must not exceed this value. |
-| VERSION_MAJOR | The major version number of the client Marlin BFT protocol, e.g., `0`. |
-| VERSION_MINOR | The minor version number of the client Marlin BFT protocol, e.g., `1`. |
-| VERSION_PATCH | The patch version number of the client Marlin BFT protocol, e.g., `0`. |
+| Value | Description |
+| ------------- | --------------------------------------------------------------------------------------------------------------------- |
+| SYNC | The current Sync Number, this should be used in the next packet sent and incremented by 1 for each packet sent after. |
+| BUFFER_SIZE | The client buffer size. Packet Payload Length must not exceed this value. |
+| VERSION_MAJOR | The major version number of the client Marlin BFT protocol, e.g., `0`. |
+| VERSION_MINOR | The minor version number of the client Marlin BFT protocol, e.g., `1`. |
+| VERSION_PATCH | The patch version number of the client Marlin BFT protocol, e.g., `0`. |
Example response:
+
```
ss0,96,0.1.0
```
### CLOSE Packet
+
A CLOSE packet should be the last packet sent by a host. On success, the client will switch back to ASCII mode.
-## Transfer Control (`Protocol ID` 1)
+## Transfer Control (`Protocol ID` 1)
+
`Protocol ID` 1 packets control the file transfers performed over the connection:
-| Packet Type | Name | Description |
-|---|---|---|
-| 0 | QUERY | Query the client protocol details and compression parameters. |
-| 1 | OPEN | Open a file for writing and begin accepting data to transfer. |
-| 2 | CLOSE | Finish writing and close the current file. |
-| 3 | WRITE | Write data to an open file. |
-| 4 | ABORT | Abort file transfer. |
+| Packet Type | Name | Description |
+| ----------- | ----- | ------------------------------------------------------------- |
+| 0 | QUERY | Query the client protocol details and compression parameters. |
+| 1 | OPEN | Open a file for writing and begin accepting data to transfer. |
+| 2 | CLOSE | Finish writing and close the current file. |
+| 3 | WRITE | Write data to an open file. |
+| 4 | ABORT | Abort file transfer. |
### QUERY Packet
+
A QUERY packet should be the second packet sent by a host, after a SYNC packet. On success a query response will be sent in addition to an `ok` acknowledgement.
Returns a query response:
+
```
PFT:version:..:compression:(,)
```
-| Value | Description |
-|---|---|
-| VERSION_MAJOR | The major version number of the client Marlin BFT protocol, e.g., `0`. |
-| VERSION_MINOR | The minor version number of the client Marlin BFT protocol, e.g., `1`. |
-| VERSION_PATCH | The patch version number of the client Marlin BFT protocol, e.g., `0`. |
-| COMPRESSION_ALGO | Compression algorithm. Currently either `heatshrink` or `none` |
+| Value | Description |
+| ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------- |
+| VERSION_MAJOR | The major version number of the client Marlin BFT protocol, e.g., `0`. |
+| VERSION_MINOR | The minor version number of the client Marlin BFT protocol, e.g., `1`. |
+| VERSION_PATCH | The patch version number of the client Marlin BFT protocol, e.g., `0`. |
+| COMPRESSION_ALGO | Compression algorithm. Currently either `heatshrink` or `none` |
| COMPRESSION_PARAMS | Compression parameters, separated by commas. Currently, if `COMPRESSION_AGLO` is heatshrink, this will be the window size and lookahead size. |
Example response:
+
```
PFT:version:0.1.0:compression:heatshrink,8,4
```
### OPEN Packet
+
Opens a file for writing. The filename and other options are specified in the Packet Payload. The filename can be a long filename if the firmware is compiled with support, however the entire Packet Payload must not be longer than the buffer length returned by the SYNC Packet. The filename value must include a null terminator.
Payload:
+
```
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
@@ -176,50 +197,53 @@ Payload:
+-------------------------------+-------------------------------+
```
-| Field | Width | Description |
-|-----------------|------------------------|---|
-| Dummy | 8 bits | A boolean value indicating if this file transfer should be actually carried out or not. If `1`, the client will respond as if the file is opened and accept data transfer, but no data will be written. |
-| Compression | 8 bits | A boolean value indicating if the data to be transferred will be compressed using the algorithm and parameters returned in the QUERY Packet. |
-| Filename | ... | A filename including a null terminator byte. |
-| Packet Checksum | 16 bits | 16-bit Fletchers checksum of the header and payload, including the Header Checksum, but excluding the Start Token. |
+| Field | Width | Description |
+| --------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| Dummy | 8 bits | A boolean value indicating if this file transfer should be actually carried out or not. If `1`, the client will respond as if the file is opened and accept data transfer, but no data will be written. |
+| Compression | 8 bits | A boolean value indicating if the data to be transferred will be compressed using the algorithm and parameters returned in the QUERY Packet. |
+| Filename | ... | A filename including a null terminator byte. |
+| Packet Checksum | 16 bits | 16-bit Fletchers checksum of the header and payload, including the Header Checksum, but excluding the Start Token. |
Responses:
-| Response | Description |
-|---|---|
-| `PFT:success` | File opened and ready for write. |
+| Response | Description |
+| ------------- | ---------------------------------- |
+| `PFT:success` | File opened and ready for write. |
| `PFT:fail` | The client couldn't open the file. |
-| `PFT:busy` | The file is already open. |
+| `PFT:busy` | The file is already open. |
### CLOSE Packet
+
Closes the currently open file.
Responses:
-| Response | Description |
-|---|---|
+| Response | Description |
+| ------------- | ------------------------------- |
| `PFT:success` | Buffer flushed and file closed. |
-| `PFT:ioerror` | Client storage device failure. |
-| `PFT:invalid` | No file open. |
+| `PFT:ioerror` | Client storage device failure. |
+| `PFT:invalid` | No file open. |
### WRITE Packet
+
Writes payload data to the currently open file. If the file was opened with Compression set to 1, the data will be decompressed first. Payload Length must not exceed the buffer size returned by the SYNC Packet.
Responses:
On success, an `ok` response will be sent. On error, an `ok` response will be followed by an error response:
-| Response | Description |
-|---|---|
+| Response | Description |
+| ------------- | ------------------------------ |
| `PFT:ioerror` | Client storage device failure. |
-| `PFT:invalid` | No file open. |
+| `PFT:invalid` | No file open. |
### ABORT Packet
+
Closes the currently open file and remove it.
Responses:
-| Response | Description |
-|---|---|
+| Response | Description |
+| ------------- | ------------------------------- |
| `PFT:success` | Transfer aborted, file removed. |
## Typical Usage
diff --git a/docs/Bresenham.md b/docs/Bresenham.md
index 2d57a1cdab..6916e35f48 100644
--- a/docs/Bresenham.md
+++ b/docs/Bresenham.md
@@ -97,7 +97,7 @@ The update rules for the error on each step may also be cast into ε' form. Cons
ε = ε + m - 1
```
- Multiplying through by Δx yields:
+Multiplying through by Δx yields:
```
ε.Δx = ε.Δx + Δy
@@ -111,7 +111,7 @@ Which is in ε' form:
ε' = ε' + Δy - Δx
```
-Using this new ``error'' value, ε' with the new test and update equations gives Bresenham's integer-only line drawing algorithm:
+Using this new ``error'' value, ε' with the new test and update equations gives Bresenham's integer-only line drawing algorithm:
```
ε' = 0, y = y[1]
@@ -125,7 +125,7 @@ for x = x1 to x2 do
endfor
```
-It is a Integer only algorithm - hence efficient (fast). And the Multiplication by 2 can be implemented by left-shift. 0 <= m <= 1
+It is a Integer only algorithm - hence efficient (fast). And the Multiplication by 2 can be implemented by left-shift. 0 <= m <= 1
### Oversampling Bresenham algorithm:
@@ -170,12 +170,14 @@ y + ε + m/r < y + 0.5
Once we did the decision, then the error update conditions are:
Decision A:
+
```
ε[new] = y + ε + m/r - y
ε[new] = ε + m/r [2]
```
Decision B:
+
```
ε[new] = y + ε + m/r - (y+1)
ε[new] = ε + m/r - 1 [3]
diff --git a/docs/ConfigEmbedding.md b/docs/ConfigEmbedding.md
index 562661e111..a9770fb42b 100644
--- a/docs/ConfigEmbedding.md
+++ b/docs/ConfigEmbedding.md
@@ -3,13 +3,16 @@
Starting with version 2.0.9.3, Marlin can automatically extract the configuration used to generate the firmware and store it in the firmware binary. This is enabled by defining `CONFIGURATION_EMBEDDING` in `Configuration_adv.h`.
## How it's done
+
At the start of the PlatformIO build process, we create an embedded configuration by extracting all active options from the Configuration files and writing them out as JSON to `marlin_config.json`, which also includes specific build information (like the git revision, the build date, and some version information). The JSON file is then compressed in a ZIP archive called `.pio/build/mc.zip` which is converted into a C array and stored in a C++ file called `mc.h` which is included in the build.
## Extracting configurations from a Marlin binary
+
To get the configuration out of a binary firmware, you'll need a non-write-protected SD card inserted into the printer while running the firmware.
Send the command `M503 C` to write the file `mc.zip` to the SD card. Copy the file to your computer, ideally in the same folder as the Marlin repository.
Run the following commands to extract and apply the configuration:
+
```
$ git checkout -f
$ unzip mc.zip
diff --git a/docs/Cutter.md b/docs/Cutter.md
index 207036c6e8..ace957210a 100644
--- a/docs/Cutter.md
+++ b/docs/Cutter.md
@@ -92,33 +92,33 @@ Once the entry and exit power values are determined, the values are divided into
trap step power incr_decr = ( cruize power - entry_exit ) / accel_decel_steps
The trap steps are incremented or decremented during each accel or decel step until the block is complete.
-Step power is either cumulatively added or subtracted during trapeziod ramp progressions.
+Step power is either cumulatively added or subtracted during trapezoid ramp progressions.
#### Planner Code:
- ```
- if (block->laser.power > 0) {
- NOLESS(block->laser.power, laser_power_floor);
- block->laser.trap_ramp_active_pwr = (block->laser.power - laser_power_floor) * (initial_rate / float(block->nominal_rate)) + laser_power_floor;
- block->laser.trap_ramp_entry_incr = (block->laser.power - block->laser.trap_ramp_active_pwr) / accelerate_steps;
- float laser_pwr = block->laser.power * (final_rate / float(block->nominal_rate));
- NOLESS(laser_pwr, laser_power_floor);
- block->laser.trap_ramp_exit_decr = (block->laser.power - laser_pwr) / decelerate_steps;
- ```
+```
+if (block->laser.power > 0) {
+ NOLESS(block->laser.power, laser_power_floor);
+ block->laser.trap_ramp_active_pwr = (block->laser.power - laser_power_floor) * (initial_rate / float(block->nominal_rate)) + laser_power_floor;
+ block->laser.trap_ramp_entry_incr = (block->laser.power - block->laser.trap_ramp_active_pwr) / accelerate_steps;
+ float laser_pwr = block->laser.power * (final_rate / float(block->nominal_rate));
+ NOLESS(laser_pwr, laser_power_floor);
+ block->laser.trap_ramp_exit_decr = (block->laser.power - laser_pwr) / decelerate_steps;
+```
#### Stepper Code:
- ```
- if (current_block->laser.trap_ramp_entry_incr > 0) {
- cutter.apply_power(current_block->laser.trap_ramp_active_pwr);
- current_block->laser.trap_ramp_active_pwr += current_block->laser.trap_ramp_entry_incr;
- ```
+```
+if (current_block->laser.trap_ramp_entry_incr > 0) {
+ cutter.apply_power(current_block->laser.trap_ramp_active_pwr);
+ current_block->laser.trap_ramp_active_pwr += current_block->laser.trap_ramp_entry_incr;
+```
- ```
- if (current_block->laser.trap_ramp_exit_decr > 0) {
- current_block->laser.trap_ramp_active_pwr -= current_block->laser.trap_ramp_exit_decr;
- cutter.apply_power(current_block->laser.trap_ramp_active_pwr);
- ```
+```
+if (current_block->laser.trap_ramp_exit_decr > 0) {
+ current_block->laser.trap_ramp_active_pwr -= current_block->laser.trap_ramp_exit_decr;
+ cutter.apply_power(current_block->laser.trap_ramp_active_pwr);
+```
### Dynamic Inline Calculations
diff --git a/docs/Queue.md b/docs/Queue.md
index 6d4fb9d041..e0f50e7807 100644
--- a/docs/Queue.md
+++ b/docs/Queue.md
@@ -13,6 +13,7 @@ Whenever the command queue gets full the sender needs to wait for space to open
An opposite problem called "planner starvation" occurs when Marlin receives many short and fast moves in a row so the Planner Buffer gets completed very quickly. In this case the host can't send commands fast enough to prevent the Planner Buffer from emptying out. Planner starvation causes obvious stuttering and is commonly seen on overloaded deltabots during small curves. Marlin has strategies to mitigate this issue, but sometimes a model has to be re-sliced (or the G-code has to be post-processed with Arc Welder) just to stay within the machine's inherent limits.
Here's a basic flowchart of Marlin command processing:
+
```
+------+ Marlin's GCodeQueue
| | +--------------------------------------+ +-----------+
@@ -39,6 +40,7 @@ Here's a basic flowchart of Marlin command processing:
```
Marlin is a single-threaded application with a main `loop()` that manages the command queue and an `idle()` routine that manages the hardware. The command queue is handled in two stages:
+
1. The `idle()` routine reads all inputs and attempts to enqueue any completed command lines.
2. The main `loop()` gets the command at the front the G-code queue (if any) and runs it. Each G-code command blocks the main loop, preventing the queue from advancing until it returns. To keep essential tasks and the UI running, any commands that run a long process need to call `idle()` frequently.
@@ -51,6 +53,7 @@ If no data is available on the serial buffer, Marlin can be configured to period
## Limitation of the design
Some limitations to the design are evident:
+
1. Whenever the G-code processor is busy processing a command, the G-code queue cannot advance.
2. A long command like `G29` causes commands to pile up and to fill the queue, making the host wait.
3. Each serial input requires a buffer large enough for a complete G-code line. This is set by `MAX_CMD_SIZE` with a default value of 96.
diff --git a/docs/Serial.md b/docs/Serial.md
index 5e0d7e63eb..9ef9a781fa 100644
--- a/docs/Serial.md
+++ b/docs/Serial.md
@@ -3,7 +3,7 @@
Marlin is targeting a plethora of different CPU architectures and platforms. Each of these platforms has its own serial interface.
While many provide a Arduino-like Serial class, it's not all of them, and the differences in the existing API create a very complex brain teaser for writing code that works more or less on each platform.
-Moreover, many platform have intrinsic needs about serial port (like forwarding the output on multiple serial port, providing a *serial-like* telnet server, mixing USB-based serial port with SD card emulation) that are difficult to handle cleanly in the other platform serial logic.
+Moreover, many platform have intrinsic needs about serial port (like forwarding the output on multiple serial port, providing a _serial-like_ telnet server, mixing USB-based serial port with SD card emulation) that are difficult to handle cleanly in the other platform serial logic.
Starting with version 2.0.8, Marlin provides a common interface for its serial needs.
@@ -18,54 +18,64 @@ Instead, the Curiously Recurring Template Pattern (**CRTP**) is used so that, up
Because some platform do not follow the same interface, the missing method in the actual low-level implementation are detected via SFINAE and a wrapper is generated when such method are missing. See the `CALL_IF_EXISTS` macro in `Marlin/src/core/macros.h` for documentation of this technique.
## Composing the desired feature
+
The different specificities for each architecture are provided by composing the serial type based on desired functionality.
In the `Marlin/src/core/serial_hook.h` file, the different serial feature are declared and defined in each templated type:
+
1. `BaseSerial` is a simple 1:1 wrapper to the underlying, Arduino compatible, `Serial`'s class. It derives from it. You'll use this if the platform does not do anything specific for the `Serial` object (for example, if an interrupt callback calls directly the serial **instance** in the platform's framework code, this is not the right class to use). This wrapper is completely inlined so that it does not generate any code upon compilation. `BaseSerial` constructor forwards any parameter to the platform's `Serial`'s constructor.
2. `ForwardSerial` is a composing wrapper. It references an actual Arduino compatible `Serial` instance. You'll use this if the instance is declared in the platform's framework and is being referred directly in the framework. This is not as efficient as the `BaseSerial` implementation since static dereferencing is done for each method call (it'll still be faster than virtual dispatching)
-3. `ConditionalSerial` is working a bit like the `ForwardSerial` interface, but it checks a boolean condition before calling the referenced instance. You'll use it when the serial output can be switch off at runtime, for example in a *telnet* like serial output that should not emit any packet if no client is connected.
+3. `ConditionalSerial` is working a bit like the `ForwardSerial` interface, but it checks a boolean condition before calling the referenced instance. You'll use it when the serial output can be switch off at runtime, for example in a _telnet_ like serial output that should not emit any packet if no client is connected.
4. `RuntimeSerial` is providing a runtime-modifiable hooking method for its `write` and `msgDone` method. You'll use it if you need to capture the serial output of Marlin, for example to display the G-Code parser's output on a GUI interface. The hooking interface is setup via the `setHook` method.
-5. `MultiSerial` is a runtime modifiable serial output multiplexer. It can output (*respectively input*) to 2 different interface based on a port *mask*. You'll use this if you need to output the same serial stream to multiple port. You can plug a `MultiSerial` to itself to duplicate to more than 2 ports.
+5. `MultiSerial` is a runtime modifiable serial output multiplexer. It can output (_respectively input_) to 2 different interface based on a port _mask_. You'll use this if you need to output the same serial stream to multiple port. You can plug a `MultiSerial` to itself to duplicate to more than 2 ports.
## Plumbing
+
Since all the types above are using CRTP, it's possible to combine them to get the appropriate functionality.
This is easily done via type definition of the feature.
For example, to create a single serial interface with 2 serial outputs (one enabled at runtime and the other switchable):
+
```cpp
typedef MultiSerial< RuntimeSerial, ConditionalSerial > Serial1Class;
```
To send the same output to 4 serial ports you could nest `MultiSerial` like this:
+
```cpp
typedef MultiSerial< MultiSerial< BaseSerial, BaseSerial >, MultiSerial< BaseSerial, BaseSerial, 2, 1>, 0, 2> Serial1Class;
```
+
The magical numbers here are the step and offset for computing the serial port. Simplifying the above monster a bit:
+
```cpp
MS< A = MS, B=MS, offset=0, step=2>
```
+
This means that the underlying multiserial A (with output to `a,b`) is available from offset = 0 to offset + step = 1 (default value).
The multiserial B (with output to `c,d`) is available from offset = 2 (the next step from the root multiserial) to offset + step = 3.
In practice, the root multiserial will redirect any index/mask `offset` to `offset + step - 1` to its first leaf, and any index/mask `offset + step` to `offset + 2*step - 1` to its second leaf.
## Emergency parser
+
By default, the serial base interface provide an emergency parser that's only enable for serial classes that support it. Because of this condition, all underlying types take a first `bool emergencyParserEnabled` argument to their constructor. You must take into account this parameter when defining the actual type used.
## SERIAL macros
+
The following macros are defined (in `serial.h`) to output data to the serial ports:
-| MACRO | Parameters | Usage | Example | Expected output |
-|-------|------------|-------|---------|-----------------|
-| `SERIAL_ECHO` | Any basic type is supported (`char`, `uint8_t`, `int16_t`, `int32_t`, `float`, `long`, `const char*`, ...). | For a numeric type it prints the number in decimal. A string is output as a string. | `uint8_t a = 123; SERIAL_ECHO(a); SERIAL_CHAR(' '); SERIAL_ECHO(' '); ` | `123 32` |
-| `SERIAL_ECHOLN` | Same as `SERIAL_ECHO` | Do `SERIAL_ECHO`, adding a newline | `int a = 456; SERIAL_ECHOLN(a);` | `456\n` |
-| `SERIAL_ECHOPGM` | String / Value pairs | Print a series of string literals and values alternately | `SERIAL_ECHOPGM("Bob", 34);` | `Bob34` |
-| `SERIAL_ECHOLNPGM` | Same as `SERIAL_ECHOPGM` | Do `SERIAL_ECHOPGM`, adding a newline | `SERIAL_ECHOPGM("Alice", 56);` | `alice56` |
-| `SERIAL_ECHOPGM_P` | Like `SERIAL_ECHOPGM` but takes PGM strings | Print a series of PGM strings and values alternately | `SERIAL_ECHOPGM_P(GET_TEXT(MSG_HELLO), 123);` | `Hello123` |
-| `SERIAL_ECHOLNPGM_P` | Same as `SERIAL_ECHOPGM_P` | Do `SERIAL_ECHOPGM_P`, adding a newline | `SERIAL_ECHOLNPGM_P(PSTR("Alice"), 78);` | `alice78\n` |
-| `SERIAL_ECHO_START` | None | Prefix an echo line | `SERIAL_ECHO_START();` | `echo:` |
-| `SERIAL_ECHO_MSG` | Same as `SERIAL_ECHOLNPGM` | Print a full echo line | `SERIAL_ECHO_MSG("Count is ", count);` | `echo:Count is 3` |
-| `SERIAL_ERROR_START`| None | Prefix an error line | `SERIAL_ERROR_START();` | `Error:` |
-| `SERIAL_ERROR_MSG` | Same as `SERIAL_ECHOLNPGM` | Print a full error line | `SERIAL_ERROR_MSG("Not found");` | `Error:Not found` |
-| `SERIAL_ECHO_SP` | Number of spaces | Print one or more spaces | `SERIAL_ECHO_SP(3)` | ` ` |
-| `SERIAL_EOL` | None | Print an end of line | `SERIAL_EOL();` | `\n` |
+| MACRO | Parameters | Usage | Example | Expected output |
+| -------------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------- |
+| `SERIAL_ECHO` | Any basic type is supported (`char`, `uint8_t`, `int16_t`, `int32_t`, `float`, `long`, `const char*`, ...). | For a numeric type it prints the number in decimal. A string is output as a string. | `uint8_t a = 123; SERIAL_ECHO(a); SERIAL_CHAR(' '); SERIAL_ECHO(' '); ` | `123 32` |
+| `SERIAL_ECHOLN` | Same as `SERIAL_ECHO` | Do `SERIAL_ECHO`, adding a newline | `int a = 456; SERIAL_ECHOLN(a);` | `456\n` |
+| `SERIAL_ECHOPGM` | String / Value pairs | Print a series of string literals and values alternately | `SERIAL_ECHOPGM("Bob", 34);` | `Bob34` |
+| `SERIAL_ECHOLNPGM` | Same as `SERIAL_ECHOPGM` | Do `SERIAL_ECHOPGM`, adding a newline | `SERIAL_ECHOPGM("Alice", 56);` | `alice56` |
+| `SERIAL_ECHOPGM_P` | Like `SERIAL_ECHOPGM` but takes PGM strings | Print a series of PGM strings and values alternately | `SERIAL_ECHOPGM_P(GET_TEXT(MSG_HELLO), 123);` | `Hello123` |
+| `SERIAL_ECHOLNPGM_P` | Same as `SERIAL_ECHOPGM_P` | Do `SERIAL_ECHOPGM_P`, adding a newline | `SERIAL_ECHOLNPGM_P(PSTR("Alice"), 78);` | `alice78\n` |
+| `SERIAL_ECHO_START` | None | Prefix an echo line | `SERIAL_ECHO_START();` | `echo:` |
+| `SERIAL_ECHO_MSG` | Same as `SERIAL_ECHOLNPGM` | Print a full echo line | `SERIAL_ECHO_MSG("Count is ", count);` | `echo:Count is 3` |
+| `SERIAL_ERROR_START` | None | Prefix an error line | `SERIAL_ERROR_START();` | `Error:` |
+| `SERIAL_ERROR_MSG` | Same as `SERIAL_ECHOLNPGM` | Print a full error line | `SERIAL_ERROR_MSG("Not found");` | `Error:Not found` |
+| `SERIAL_ECHO_SP` | Number of spaces | Print one or more spaces | `SERIAL_ECHO_SP(3)` | ` ` |
+| `SERIAL_EOL` | None | Print an end of line | `SERIAL_EOL();` | `\n` |
-*This document was written by [X-Ryl669](https://blog.cyril.by) and is under [CC-SA license](https://creativecommons.org/licenses/by-sa)*
+_This document was written by [X-Ryl669](https://blog.cyril.by) and is under [CC-SA license](https://creativecommons.org/licenses/by-sa)_
diff --git a/ini/features.ini b/ini/features.ini
index 3b00dc792d..1f09858f07 100644
--- a/ini/features.ini
+++ b/ini/features.ini
@@ -39,7 +39,7 @@ USES_LIQUIDCRYSTAL_I2C = marcoschwartz/LiquidCrystal_I2C@1.1.4
USES_LIQUIDTWI2 = LiquidTWI2@1.2.7
HAS_LCDPRINT = build_src_filter=+
HAS_MARLINUI_HD44780 = build_src_filter=+
-HAS_MARLINUI_U8GLIB = marlinfirmware/U8glib-HAL@0.5.4
+HAS_MARLINUI_U8GLIB = marlinfirmware/U8glib-HAL@0.5.5
build_src_filter=+
HAS_(FSMC|SPI|LTDC)_TFT = build_src_filter=+
I2C_EEPROM = build_src_filter=+
diff --git a/ini/native.ini b/ini/native.ini
index 5f56b1c843..bdfa6827ad 100644
--- a/ini/native.ini
+++ b/ini/native.ini
@@ -58,7 +58,7 @@ debug_build_flags = -fstack-protector-strong -g -g3 -ggdb
lib_compat_mode = off
build_src_filter = ${common.default_src_filter} +
lib_deps = ${common.lib_deps}
- MarlinSimUI=https://github.com/p3p/MarlinSimUI/archive/af62611296.zip
+ MarlinSimUI=https://github.com/p3p/MarlinSimUI/archive/2e71215018.zip
Adafruit NeoPixel=https://github.com/p3p/Adafruit_NeoPixel/archive/c6b319f447.zip
LiquidCrystal=https://github.com/p3p/LiquidCrystal/archive/322fb5fc23.zip
extra_scripts = ${common.extra_scripts}
diff --git a/test/README.md b/test/README.md
index 19b4cd7d59..3bcd29bcc2 100644
--- a/test/README.md
+++ b/test/README.md
@@ -1,6 +1,7 @@
# Testing Marlin
Marlin included two types of automated tests:
+
- [Build Tests](../buildroot/tests) to catch syntax and code build errors.
- Unit Tests (this folder) to catch implementation errors.
@@ -21,15 +22,19 @@ Generally speaking, the types of errors caught by unit tests are most often caug
### Unit test FAQ
#### Q: Isn't writing unit tests a lot of work?
+
A: Yes, and it can be especially difficult with existing code that wasn't designed for unit testing. Some common sense should be used to decide where to employ unit testing, and at what level to perform it. While unit testing takes effort, it pays dividends in preventing regressions, and helping to pinpoint the source of failures when they do occur.
#### Q: Will this make refactoring harder?
+
A: Yes and No. Of course if you refactor code that unit tests use directly, it will have to be reworked as well. It actually can make refactoring more efficient, by providing assurance that the mechanism still works as intended.
#### Q: How can I debug one of these failing unit tests?
+
A: That's a great question, without a known immediate answer. It is likely possible to debug them interactively through PlatformIO, but that can at times take some creativity to configure. Unit tests are generally extremely small, so even without interactive debugging it can get you fairly close to the cause of the problem.
### Unit test architecture
+
We are currently using [PlatformIO unit tests](https://docs.platformio.org/en/latest/plus/unit-testing.html).
Since Marlin only compiles code required by the configuration, a separate test binary must be generated for any configuration change. The following process is used to unit test a variety of configurations: