From 149c483db2c358b147fc7c5869846949ea3c634f Mon Sep 17 00:00:00 2001 From: InsanityAutomation Date: Fri, 12 Apr 2019 14:01:48 -0400 Subject: [PATCH] Update --- Marlin/Configuration.h | 8 +- Marlin/src/HAL/HAL_AVR/SanityCheck.h | 4 +- .../HAL/HAL_ESP32/FlushableHardwareSerial.cpp | 33 +++ .../HAL_ESP32/FlushableHardwareSerial.h} | 22 +- Marlin/src/HAL/HAL_ESP32/HAL.h | 3 +- Marlin/src/HAL/HAL_ESP32/HAL_spi_ESP32.cpp | 26 ++- Marlin/src/HAL/HAL_ESP32/fastio_ESP32.h | 3 + Marlin/src/HAL/HAL_LINUX/SanityCheck.h | 4 +- Marlin/src/HAL/HAL_LPC1768/HAL.cpp | 10 +- Marlin/src/HAL/HAL_LPC1768/SanityCheck.h | 4 +- Marlin/src/HAL/HAL_LPC1768/pinsDebug.h | 6 + Marlin/src/HAL/HAL_LPC1768/watchdog.cpp | 6 +- Marlin/src/HAL/HAL_STM32/HAL.cpp | 4 +- Marlin/src/HAL/HAL_STM32/SanityCheck.h | 4 +- Marlin/src/HAL/HAL_STM32F1/SanityCheck.h | 4 +- Marlin/src/HAL/HAL_STM32F4/SanityCheck.h | 4 +- Marlin/src/HAL/HAL_STM32F7/SanityCheck.h | 4 +- Marlin/src/Marlin.cpp | 23 +- Marlin/src/core/boards.h | 5 +- Marlin/src/core/debug_out.h | 2 + Marlin/src/core/drivers.h | 51 ++-- Marlin/src/core/enum.h | 6 + Marlin/src/core/serial.cpp | 35 +-- Marlin/src/core/serial.h | 15 +- Marlin/src/core/utility.cpp | 23 +- Marlin/src/core/utility.h | 5 +- Marlin/src/feature/I2CPositionEncoder.cpp | 12 +- Marlin/src/feature/I2CPositionEncoder.h | 5 +- Marlin/src/feature/babystep.cpp | 135 +++++++++++ Marlin/src/feature/babystep.h | 63 +++++ Marlin/src/feature/bedlevel/bedlevel.cpp | 4 - Marlin/src/feature/bedlevel/bedlevel.h | 6 - .../bedlevel/mbl/mesh_bed_leveling.cpp | 4 +- Marlin/src/feature/bedlevel/ubl/ubl.cpp | 52 +---- Marlin/src/feature/bedlevel/ubl/ubl.h | 8 - Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp | 8 +- .../src/feature/bedlevel/ubl/ubl_motion.cpp | 26 --- .../src/feature/digipot/digipot_mcp4451.cpp | 3 + Marlin/src/feature/leds/leds.h | 31 ++- Marlin/src/feature/power_loss_recovery.cpp | 85 ++++--- Marlin/src/feature/power_loss_recovery.h | 8 +- Marlin/src/feature/prusa_MMU2/mmu2.cpp | 80 +++---- Marlin/src/feature/prusa_MMU2/mmu2.h | 36 +-- Marlin/src/feature/tmc_util.cpp | 18 +- Marlin/src/feature/tmc_util.h | 2 +- Marlin/src/gcode/bedlevel/G26.cpp | 70 ++---- Marlin/src/gcode/calibrate/G28.cpp | 5 +- Marlin/src/gcode/config/M217.cpp | 2 +- Marlin/src/gcode/config/M43.cpp | 16 +- Marlin/src/gcode/control/M3-M5.cpp | 12 +- Marlin/src/gcode/control/M605.cpp | 4 +- Marlin/src/gcode/control/T.cpp | 2 +- Marlin/src/gcode/feature/pause/M701_M702.cpp | 2 +- Marlin/src/gcode/feature/powerloss/M1000.cpp | 26 +-- Marlin/src/gcode/feature/prusa_MMU2/M403.cpp | 2 +- Marlin/src/gcode/gcode.cpp | 14 +- Marlin/src/gcode/gcode.h | 4 - Marlin/src/gcode/geometry/G53-G59.cpp | 2 +- Marlin/src/gcode/motion/M290.cpp | 7 +- Marlin/src/inc/Conditionals_LCD.h | 52 +++-- Marlin/src/inc/Conditionals_post.h | 5 +- Marlin/src/inc/SanityCheck.h | 3 + Marlin/src/lcd/HD44780/ultralcd_HD44780.cpp | 12 +- Marlin/src/lcd/dogm/dogm_Bootscreen.h | 56 +++-- Marlin/src/lcd/dogm/u8g_fontutf8.cpp | 2 +- Marlin/src/lcd/dogm/ultralcd_DOGM.cpp | 77 +++++-- Marlin/src/lcd/dogm/ultralcd_DOGM.h | 2 +- Marlin/src/lcd/extensible_ui/ui_api.cpp | 10 +- Marlin/src/lcd/extensible_ui/ui_api.h | 2 +- Marlin/src/lcd/fontutils.cpp | 4 +- Marlin/src/lcd/language/language_de.h | 7 +- Marlin/src/lcd/language/language_en.h | 36 ++- Marlin/src/lcd/language/language_it.h | 22 +- Marlin/src/lcd/language/language_ko_KR.h | 7 +- Marlin/src/lcd/language/language_pt-br.h | 7 +- Marlin/src/lcd/language/language_sk.h | 7 +- Marlin/src/lcd/language/language_tr.h | 7 +- Marlin/src/lcd/menu/game/game.cpp | 3 +- Marlin/src/lcd/menu/game/invaders.cpp | 16 +- Marlin/src/lcd/menu/menu.cpp | 38 +-- Marlin/src/lcd/menu/menu.h | 27 ++- Marlin/src/lcd/menu/menu_bed_leveling.cpp | 2 +- Marlin/src/lcd/menu/menu_configuration.cpp | 38 ++- Marlin/src/lcd/menu/menu_main.cpp | 7 +- Marlin/src/lcd/menu/menu_mixer.cpp | 6 +- Marlin/src/lcd/menu/menu_mmu2.cpp | 118 +++++----- Marlin/src/lcd/menu/menu_mmu2.h | 2 +- Marlin/src/lcd/menu/menu_motion.cpp | 12 +- Marlin/src/lcd/menu/menu_sdcard.cpp | 48 +++- Marlin/src/lcd/menu/menu_tune.cpp | 48 +++- Marlin/src/lcd/menu/menu_ubl.cpp | 2 +- Marlin/src/lcd/ultralcd.cpp | 37 ++- Marlin/src/lcd/ultralcd.h | 30 +-- Marlin/src/module/motion.cpp | 16 +- Marlin/src/module/temperature.cpp | 86 +------ Marlin/src/module/temperature.h | 8 - Marlin/src/module/tool_change.cpp | 175 +++++++++++--- Marlin/src/pins/pins.h | 42 ++-- Marlin/src/pins/pinsDebug.h | 3 + Marlin/src/pins/pinsDebug_list.h | 4 +- Marlin/src/pins/pins_3DRAG.h | 8 +- Marlin/src/pins/pins_5DPRINT.h | 4 +- Marlin/src/pins/pins_AZTEEG_X3.h | 4 +- Marlin/src/pins/pins_AZTEEG_X3_PRO.h | 12 +- Marlin/src/pins/pins_AZTEEG_X5_MINI.h | 218 ++++++++++++++++++ Marlin/src/pins/pins_AZTEEG_X5_MINI_WIFI.h | 180 +-------------- Marlin/src/pins/pins_BAM_DICE_DUE.h | 2 +- Marlin/src/pins/pins_BLACK_STM32F407VE.h | 131 +++++++++++ Marlin/src/pins/pins_BQ_ZUM_MEGA_3D.h | 2 +- Marlin/src/pins/pins_COHESION3D_MINI.h | 2 +- Marlin/src/pins/pins_COHESION3D_REMIX.h | 2 +- Marlin/src/pins/pins_EINSY_RAMBO.h | 2 +- Marlin/src/pins/pins_EINSY_RETRO.h | 2 +- Marlin/src/pins/pins_FELIX2.h | 2 +- Marlin/src/pins/pins_FORMBOT_RAPTOR.h | 6 + Marlin/src/pins/pins_FORMBOT_RAPTOR2.h | 12 +- Marlin/src/pins/pins_FORMBOT_TREX3.h | 2 +- Marlin/src/pins/pins_FYSETC_F6_13.h | 88 +++++-- Marlin/src/pins/pins_GEN6.h | 2 +- Marlin/src/pins/pins_GEN7_12.h | 2 +- Marlin/src/pins/pins_GEN7_14.h | 2 +- Marlin/src/pins/pins_GEN7_CUSTOM.h | 2 +- Marlin/src/pins/pins_MEGACONTROLLER.h | 2 +- Marlin/src/pins/pins_MEGATRONICS.h | 2 +- Marlin/src/pins/pins_MEGATRONICS_2.h | 2 +- Marlin/src/pins/pins_MEGATRONICS_3.h | 4 +- Marlin/src/pins/pins_MIGHTYBOARD_REVE.h | 6 +- Marlin/src/pins/pins_MINIRAMBO.h | 2 +- Marlin/src/pins/pins_MINITRONICS.h | 2 +- Marlin/src/pins/pins_MKS_BASE.h | 2 +- Marlin/src/pins/pins_MKS_BASE_14.h | 12 +- Marlin/src/pins/pins_RAMBO.h | 2 +- Marlin/src/pins/pins_RAMPS.h | 41 +++- Marlin/src/pins/pins_RAMPS_FD_V1.h | 4 +- Marlin/src/pins/pins_RAMPS_LINUX.h | 8 +- Marlin/src/pins/pins_RAMPS_OLD.h | 2 +- Marlin/src/pins/pins_RAMPS_RE_ARM.h | 6 +- Marlin/src/pins/pins_RUMBA.h | 4 +- Marlin/src/pins/pins_RURAMPS4D_13.h | 4 +- Marlin/src/pins/pins_SANGUINOLOLU_11.h | 6 +- Marlin/src/pins/pins_SAV_MKI.h | 2 +- Marlin/src/pins/pins_STM3R_MINI.h | 2 +- Marlin/src/pins/pins_TEENSY2.h | 2 +- Marlin/src/pins/pins_TEENSYLU.h | 2 +- Marlin/src/pins/pins_ULTIMAIN_2.h | 2 +- Marlin/src/pins/pins_ULTIMAKER.h | 2 +- Marlin/src/pins/pins_ULTIMAKER_OLD.h | 10 +- Marlin/src/pins/sensitive_pins.h | 26 +-- 148 files changed, 1851 insertions(+), 1149 deletions(-) create mode 100644 Marlin/src/HAL/HAL_ESP32/FlushableHardwareSerial.cpp rename Marlin/src/{gcode/bedlevel/ubl/M49.cpp => HAL/HAL_ESP32/FlushableHardwareSerial.h} (69%) create mode 100644 Marlin/src/feature/babystep.cpp create mode 100644 Marlin/src/feature/babystep.h create mode 100644 Marlin/src/pins/pins_AZTEEG_X5_MINI.h create mode 100644 Marlin/src/pins/pins_BLACK_STM32F407VE.h diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index cb40ea6f79..1d1a322a87 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -1146,13 +1146,13 @@ #if DISABLED(TREX3) || ENABLED(TREX3_UPGRADE) #define X_MIN_POS -42 #define Y_MIN_POS 0 - #define Z_MIN_POS 0 + #define Z_MIN_POS 3 #define X_MAX_POS 450 #define Y_MAX_POS Y_BED_SIZE -#else ENABLED(TREX3) +#else #define X_MIN_POS -47 #define Y_MIN_POS 0 - #define Z_MIN_POS 0 + #define Z_MIN_POS -3 #define X_MAX_POS 460 #define Y_MAX_POS Y_BED_SIZE #endif @@ -1432,7 +1432,7 @@ // For DELTA this is the top-center of the Cartesian print volume. //#define MANUAL_X_HOME_POS 0 //#define MANUAL_Y_HOME_POS 0 -//#define MANUAL_Z_HOME_POS 0 +#define MANUAL_Z_HOME_POS 0 // Use "Z Safe Homing" to avoid homing with a Z probe outside the bed area. // diff --git a/Marlin/src/HAL/HAL_AVR/SanityCheck.h b/Marlin/src/HAL/HAL_AVR/SanityCheck.h index 197c6554d7..68bfdc16a0 100644 --- a/Marlin/src/HAL/HAL_AVR/SanityCheck.h +++ b/Marlin/src/HAL/HAL_AVR/SanityCheck.h @@ -46,8 +46,8 @@ * Sanity checks for Spindle / Laser */ #if ENABLED(SPINDLE_LASER_ENABLE) - #if PIN_EXISTS(SPINDLE_LASER_ENABLE) - #error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENABLE_PIN." + #if !PIN_EXISTS(SPINDLE_LASER_ENA) + #error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENA_PIN." #elif SPINDLE_DIR_CHANGE && !PIN_EXISTS(SPINDLE_DIR) #error "SPINDLE_DIR_PIN not defined." #elif ENABLED(SPINDLE_LASER_PWM) && PIN_EXISTS(SPINDLE_LASER_PWM) diff --git a/Marlin/src/HAL/HAL_ESP32/FlushableHardwareSerial.cpp b/Marlin/src/HAL/HAL_ESP32/FlushableHardwareSerial.cpp new file mode 100644 index 0000000000..2d99792d21 --- /dev/null +++ b/Marlin/src/HAL/HAL_ESP32/FlushableHardwareSerial.cpp @@ -0,0 +1,33 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2016 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 . + * + */ + +#include "FlushableHardwareSerial.h" + +#ifdef ARDUINO_ARCH_ESP32 + +FlushableHardwareSerial::FlushableHardwareSerial(int uart_nr) + : HardwareSerial(uart_nr) +{} + +FlushableHardwareSerial flushableSerial(0); + +#endif // ARDUINO_ARCH_ESP32 diff --git a/Marlin/src/gcode/bedlevel/ubl/M49.cpp b/Marlin/src/HAL/HAL_ESP32/FlushableHardwareSerial.h similarity index 69% rename from Marlin/src/gcode/bedlevel/ubl/M49.cpp rename to Marlin/src/HAL/HAL_ESP32/FlushableHardwareSerial.h index 5c1f096a72..082fa7df04 100644 --- a/Marlin/src/gcode/bedlevel/ubl/M49.cpp +++ b/Marlin/src/HAL/HAL_ESP32/FlushableHardwareSerial.h @@ -20,21 +20,17 @@ * */ -/** - * M49.cpp - Toggle the G26 debug flag - */ +#ifdef ARDUINO_ARCH_ESP32 -#include "../../../inc/MarlinConfig.h" +#include -#if ENABLED(G26_MESH_VALIDATION) +class FlushableHardwareSerial : public HardwareSerial { +public: + FlushableHardwareSerial(int uart_nr); -#include "../../gcode.h" -#include "../../../feature/bedlevel/bedlevel.h" + inline void flushTX(void) { /* No need to flush the hardware serial, but defined here for compatibility. */ } +}; -void GcodeSuite::M49() { - g26_debug_flag ^= true; - SERIAL_ECHOPGM("G26 Debug: "); - serialprintPGM(g26_debug_flag ? PSTR("On\n") : PSTR("Off\n")); -} +extern FlushableHardwareSerial flushableSerial; -#endif // G26_MESH_VALIDATION +#endif // ARDUINO_ARCH_ESP32 diff --git a/Marlin/src/HAL/HAL_ESP32/HAL.h b/Marlin/src/HAL/HAL_ESP32/HAL.h index 8218447305..a291458b33 100644 --- a/Marlin/src/HAL/HAL_ESP32/HAL.h +++ b/Marlin/src/HAL/HAL_ESP32/HAL.h @@ -48,6 +48,7 @@ #include "HAL_timers_ESP32.h" #include "WebSocketSerial.h" +#include "FlushableHardwareSerial.h" // -------------------------------------------------------------------------- // Defines @@ -55,7 +56,7 @@ extern portMUX_TYPE spinlock; -#define MYSERIAL0 Serial +#define MYSERIAL0 flushableSerial #if ENABLED(WIFISUPPORT) #define NUM_SERIAL 2 diff --git a/Marlin/src/HAL/HAL_ESP32/HAL_spi_ESP32.cpp b/Marlin/src/HAL/HAL_ESP32/HAL_spi_ESP32.cpp index 7beb9b4991..d48b14d610 100644 --- a/Marlin/src/HAL/HAL_ESP32/HAL_spi_ESP32.cpp +++ b/Marlin/src/HAL/HAL_ESP32/HAL_spi_ESP32.cpp @@ -44,6 +44,15 @@ static SPISettings spiConfig; // Public functions // -------------------------------------------------------------------------- +#if ENABLED(SOFTWARE_SPI) + + // -------------------------------------------------------------------------- + // Software SPI + // -------------------------------------------------------------------------- + #error "Software SPI not supported for ESP32. Use Hardware SPI." + +#else + // -------------------------------------------------------------------------- // Hardware SPI // -------------------------------------------------------------------------- @@ -61,13 +70,14 @@ void spiInit(uint8_t spiRate) { uint32_t clock; switch (spiRate) { - case SPI_FULL_SPEED: clock = SPI_CLOCK_DIV2; break; - case SPI_HALF_SPEED: clock = SPI_CLOCK_DIV4; break; - case SPI_QUARTER_SPEED: clock = SPI_CLOCK_DIV8; break; - case SPI_EIGHTH_SPEED: clock = SPI_CLOCK_DIV16; break; - case SPI_SPEED_5: clock = SPI_CLOCK_DIV32; break; - case SPI_SPEED_6: clock = SPI_CLOCK_DIV64; break; - default: clock = SPI_CLOCK_DIV2; // Default from the SPI library + case SPI_FULL_SPEED: clock = 16000000; break; + case SPI_HALF_SPEED: clock = 8000000; break; + case SPI_QUARTER_SPEED: clock = 4000000; break; + case SPI_EIGHTH_SPEED: clock = 2000000; break; + case SPI_SIXTEENTH_SPEED: clock = 1000000; break; + case SPI_SPEED_5: clock = 500000; break; + case SPI_SPEED_6: clock = 250000; break; + default: clock = 1000000; // Default from the SPI library } spiConfig = SPISettings(clock, MSBFIRST, SPI_MODE0); @@ -106,4 +116,6 @@ void spiBeginTransaction(uint32_t spiClock, uint8_t bitOrder, uint8_t dataMode) SPI.beginTransaction(spiConfig); } +#endif // !SOFTWARE_SPI + #endif // ARDUINO_ARCH_ESP32 diff --git a/Marlin/src/HAL/HAL_ESP32/fastio_ESP32.h b/Marlin/src/HAL/HAL_ESP32/fastio_ESP32.h index 08a09201b6..dc2cd708de 100644 --- a/Marlin/src/HAL/HAL_ESP32/fastio_ESP32.h +++ b/Marlin/src/HAL/HAL_ESP32/fastio_ESP32.h @@ -64,6 +64,9 @@ #define PWM_PIN(P) true #define USEABLE_HARDWARE_PWM(P) PWM_PIN(P) +// Toggle pin value +#define TOGGLE(IO) WRITE(IO, !READ(IO)) + // // Ports and functions // diff --git a/Marlin/src/HAL/HAL_LINUX/SanityCheck.h b/Marlin/src/HAL/HAL_LINUX/SanityCheck.h index fd4c53241a..0b4322512f 100644 --- a/Marlin/src/HAL/HAL_LINUX/SanityCheck.h +++ b/Marlin/src/HAL/HAL_LINUX/SanityCheck.h @@ -25,8 +25,8 @@ */ #if ENABLED(SPINDLE_LASER_ENABLE) - #if !PIN_EXISTS(SPINDLE_LASER_ENABLE) - #error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENABLE_PIN." + #if !PIN_EXISTS(SPINDLE_LASER_ENA) + #error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENA_PIN." #elif SPINDLE_DIR_CHANGE && !PIN_EXISTS(SPINDLE_DIR) #error "SPINDLE_DIR_PIN not defined." #elif ENABLED(SPINDLE_LASER_PWM) && PIN_EXISTS(SPINDLE_LASER_PWM) diff --git a/Marlin/src/HAL/HAL_LPC1768/HAL.cpp b/Marlin/src/HAL/HAL_LPC1768/HAL.cpp index fedca7a1ff..ac242ca4ab 100644 --- a/Marlin/src/HAL/HAL_LPC1768/HAL.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/HAL.cpp @@ -52,11 +52,13 @@ int freeMemory() { return result; } +// scan command line for code +// return index into pin map array if found and the pin is valid. +// return dval if not found or not a valid pin. int16_t PARSED_PIN_INDEX(const char code, const int16_t dval) { - const uint16_t val = (uint16_t)parser.intval(code), port = val / 100, pin = val % 100; - const int16_t ind = (port < (NUM_DIGITAL_PINS >> 5) && (pin < 32)) - ? GET_PIN_MAP_INDEX(port << 5 | pin) : -2; - return ind > -2 ? ind : dval; + const uint16_t val = (uint16_t)parser.intval(code, -1), port = val / 100, pin = val % 100; + const int16_t ind = (port < ((NUM_DIGITAL_PINS) >> 5) && pin < 32) ? GET_PIN_MAP_INDEX((port << 5) | pin) : -2; + return ind > -1 ? ind : dval; } void flashFirmware(int16_t value) { diff --git a/Marlin/src/HAL/HAL_LPC1768/SanityCheck.h b/Marlin/src/HAL/HAL_LPC1768/SanityCheck.h index 4ee5cca4a2..ecf0eb0c07 100644 --- a/Marlin/src/HAL/HAL_LPC1768/SanityCheck.h +++ b/Marlin/src/HAL/HAL_LPC1768/SanityCheck.h @@ -25,8 +25,8 @@ */ #if ENABLED(SPINDLE_LASER_ENABLE) - #if !PIN_EXISTS(SPINDLE_LASER_ENABLE) - #error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENABLE_PIN." + #if !PIN_EXISTS(SPINDLE_LASER_ENA) + #error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENA_PIN." #elif SPINDLE_DIR_CHANGE && !PIN_EXISTS(SPINDLE_DIR) #error "SPINDLE_DIR_PIN not defined." #elif ENABLED(SPINDLE_LASER_PWM) && PIN_EXISTS(SPINDLE_LASER_PWM) diff --git a/Marlin/src/HAL/HAL_LPC1768/pinsDebug.h b/Marlin/src/HAL/HAL_LPC1768/pinsDebug.h index 83d8c27fda..af3d7c92e7 100644 --- a/Marlin/src/HAL/HAL_LPC1768/pinsDebug.h +++ b/Marlin/src/HAL/HAL_LPC1768/pinsDebug.h @@ -40,6 +40,12 @@ #define PRINT_PIN(p) do {sprintf_P(buffer, PSTR("%d.%02d"), LPC1768_PIN_PORT(p), LPC1768_PIN_PIN(p)); SERIAL_ECHO(buffer);} while (0) #define MULTI_NAME_PAD 16 // space needed to be pretty if not first name assigned to a pin +// pins that will cause hang/reset/disconnect in M43 Toggle and Watch utilities +// uses pin index +#ifndef M43_NEVER_TOUCH + #define M43_NEVER_TOUCH(Q) ((Q) == 29 || (Q) == 30 || (Q) == 73) // USB pins +#endif + // active ADC function/mode/code values for PINSEL registers constexpr int8_t ADC_pin_mode(pin_t pin) { return (LPC1768_PIN_PORT(pin) == 0 && LPC1768_PIN_PIN(pin) == 2 ? 2 : diff --git a/Marlin/src/HAL/HAL_LPC1768/watchdog.cpp b/Marlin/src/HAL/HAL_LPC1768/watchdog.cpp index 104b449736..4418cc2364 100644 --- a/Marlin/src/HAL/HAL_LPC1768/watchdog.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/watchdog.cpp @@ -74,8 +74,10 @@ void watchdog_reset() { #else - void HAL_clear_reset_source(void) {} - uint8_t HAL_get_reset_source(void) { return RST_POWER_ON; } +void watchdog_init(void) {} +void watchdog_reset(void) {} +void HAL_clear_reset_source(void) {} +uint8_t HAL_get_reset_source(void) { return RST_POWER_ON; } #endif // USE_WATCHDOG diff --git a/Marlin/src/HAL/HAL_STM32/HAL.cpp b/Marlin/src/HAL/HAL_STM32/HAL.cpp index ab61e57bfd..0eaee0711b 100644 --- a/Marlin/src/HAL/HAL_STM32/HAL.cpp +++ b/Marlin/src/HAL/HAL_STM32/HAL.cpp @@ -36,8 +36,10 @@ #if ENABLED(EEPROM_EMULATED_WITH_SRAM) #if STM32F7xx #include "stm32f7xx_ll_pwr.h" + #elif STM32F4xx + #include "stm32f4xx_ll_pwr.h" #else - #error "EEPROM_EMULATED_WITH_SRAM is currently only supported for STM32F7xx" + #error "EEPROM_EMULATED_WITH_SRAM is currently only supported for STM32F4xx and STM32F7xx" #endif #endif // EEPROM_EMULATED_WITH_SRAM diff --git a/Marlin/src/HAL/HAL_STM32/SanityCheck.h b/Marlin/src/HAL/HAL_STM32/SanityCheck.h index 9a65f9bfa8..6c6ede24b4 100644 --- a/Marlin/src/HAL/HAL_STM32/SanityCheck.h +++ b/Marlin/src/HAL/HAL_STM32/SanityCheck.h @@ -25,8 +25,8 @@ * Test Re-ARM specific configuration values for errors at compile-time. */ #if ENABLED(SPINDLE_LASER_ENABLE) - #if !PIN_EXISTS(SPINDLE_LASER_ENABLE) - #error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENABLE_PIN." + #if !PIN_EXISTS(SPINDLE_LASER_ENA) + #error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENA_PIN." #elif SPINDLE_DIR_CHANGE && !PIN_EXISTS(SPINDLE_DIR) #error "SPINDLE_DIR_PIN not defined." #elif ENABLED(SPINDLE_LASER_PWM) && PIN_EXISTS(SPINDLE_LASER_PWM) diff --git a/Marlin/src/HAL/HAL_STM32F1/SanityCheck.h b/Marlin/src/HAL/HAL_STM32F1/SanityCheck.h index 82a0789eeb..c1470ca51e 100644 --- a/Marlin/src/HAL/HAL_STM32F1/SanityCheck.h +++ b/Marlin/src/HAL/HAL_STM32F1/SanityCheck.h @@ -28,8 +28,8 @@ * Test Re-ARM specific configuration values for errors at compile-time. */ #if ENABLED(SPINDLE_LASER_ENABLE) - #if !PIN_EXISTS(SPINDLE_LASER_ENABLE) - #error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENABLE_PIN." + #if !PIN_EXISTS(SPINDLE_LASER_ENA) + #error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENA_PIN." #elif SPINDLE_DIR_CHANGE && !PIN_EXISTS(SPINDLE_DIR) #error "SPINDLE_DIR_PIN not defined." #elif ENABLED(SPINDLE_LASER_PWM) && PIN_EXISTS(SPINDLE_LASER_PWM) diff --git a/Marlin/src/HAL/HAL_STM32F4/SanityCheck.h b/Marlin/src/HAL/HAL_STM32F4/SanityCheck.h index 31e7ce6248..441daf9257 100644 --- a/Marlin/src/HAL/HAL_STM32F4/SanityCheck.h +++ b/Marlin/src/HAL/HAL_STM32F4/SanityCheck.h @@ -24,8 +24,8 @@ * Test Re-ARM specific configuration values for errors at compile-time. */ #if ENABLED(SPINDLE_LASER_ENABLE) - #if !PIN_EXISTS(SPINDLE_LASER_ENABLE) - #error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENABLE_PIN." + #if !PIN_EXISTS(SPINDLE_LASER_ENA) + #error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENA_PIN." #elif SPINDLE_DIR_CHANGE && !PIN_EXISTS(SPINDLE_DIR) #error "SPINDLE_DIR_PIN not defined." #elif ENABLED(SPINDLE_LASER_PWM) && PIN_EXISTS(SPINDLE_LASER_PWM) diff --git a/Marlin/src/HAL/HAL_STM32F7/SanityCheck.h b/Marlin/src/HAL/HAL_STM32F7/SanityCheck.h index 2192d6ffcf..8ba1f870c2 100644 --- a/Marlin/src/HAL/HAL_STM32F7/SanityCheck.h +++ b/Marlin/src/HAL/HAL_STM32F7/SanityCheck.h @@ -24,8 +24,8 @@ * Test Re-ARM specific configuration values for errors at compile-time. */ #if ENABLED(SPINDLE_LASER_ENABLE) - #if !PIN_EXISTS(SPINDLE_LASER_ENABLE) - #error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENABLE_PIN." + #if !PIN_EXISTS(SPINDLE_LASER_ENA) + #error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENA_PIN." #elif SPINDLE_DIR_CHANGE && !PIN_EXISTS(SPINDLE_DIR) #error "SPINDLE_DIR_PIN not defined." #elif ENABLED(SPINDLE_LASER_PWM) && PIN_EXISTS(SPINDLE_LASER_PWM) diff --git a/Marlin/src/Marlin.cpp b/Marlin/src/Marlin.cpp index 4bdbe74b57..c6e25b5a5a 100644 --- a/Marlin/src/Marlin.cpp +++ b/Marlin/src/Marlin.cpp @@ -457,7 +457,7 @@ void manage_inactivity(const bool ignore_stepper_queue/*=false*/) { if (stepper_inactive_time) { static bool already_shutdown_steppers; // = false if (planner.has_blocks_queued()) - gcode.previous_move_ms = ms; // reset_stepper_timeout to keep steppers powered + gcode.reset_stepper_timeout(); else if (MOVE_AWAY_TEST && !ignore_stepper_queue && ELAPSED(ms, gcode.previous_move_ms + stepper_inactive_time)) { if (!already_shutdown_steppers) { already_shutdown_steppers = true; // L6470 SPI will consume 99% of free time without this @@ -473,14 +473,11 @@ void manage_inactivity(const bool ignore_stepper_queue/*=false*/) { #if ENABLED(DISABLE_INACTIVE_E) disable_e_steppers(); #endif - #if HAS_LCD_MENU - ui.status_screen(); - #if ENABLED(AUTO_BED_LEVELING_UBL) - if (ubl.lcd_map_control) { - ubl.lcd_map_control = false; - ui.defer_status_screen(false); - } - #endif + #if HAS_LCD_MENU && ENABLED(AUTO_BED_LEVELING_UBL) + if (ubl.lcd_map_control) { + ubl.lcd_map_control = false; + ui.defer_status_screen(false); + } #endif } } @@ -617,7 +614,7 @@ void manage_inactivity(const bool ignore_stepper_queue/*=false*/) { } #endif // !SWITCHING_EXTRUDER - gcode.previous_move_ms = ms; // reset_stepper_timeout to keep steppers powered + gcode.reset_stepper_timeout(); } #endif // EXTRUDER_RUNOUT_PREVENT @@ -723,7 +720,7 @@ void idle( #endif #if ENABLED(PRUSA_MMU2) - mmu2.mmuLoop(); + mmu2.mmu_loop(); #endif } @@ -975,7 +972,7 @@ void setup() { #endif #if ENABLED(SPINDLE_LASER_ENABLE) - OUT_WRITE(SPINDLE_LASER_ENABLE_PIN, !SPINDLE_LASER_ENABLE_INVERT); // init spindle to off + OUT_WRITE(SPINDLE_LASER_ENA_PIN, !SPINDLE_LASER_ENABLE_INVERT); // init spindle to off #if SPINDLE_DIR_CHANGE OUT_WRITE(SPINDLE_DIR_PIN, SPINDLE_INVERT_DIR ? 255 : 0); // init rotation to clockwise (M3) #endif @@ -1145,7 +1142,7 @@ void loop() { #endif #ifdef EVENT_GCODE_SD_STOP enqueue_and_echo_commands_P(PSTR(EVENT_GCODE_SD_STOP)); - #endif + #endif } #endif // SDSUPPORT diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index 120bb34853..ee9da1fd16 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -189,10 +189,11 @@ #define BOARD_COHESION3D_REMIX 1755 // Cohesion3D ReMix #define BOARD_COHESION3D_MINI 1756 // Cohesion3D Mini #define BOARD_SMOOTHIEBOARD 1757 // Smoothieboard -#define BOARD_AZTEEG_X5_MINI_WIFI 1758 // Azteeg X5 Mini (Power outputs: Hotend0, Bed, Fan) +#define BOARD_AZTEEG_X5_MINI_WIFI 1758 // Azteeg X5 Mini Wifi (Power outputs: Hotend0, Bed, Fan) #define BOARD_BIQU_SKR_V1_1 1759 // BIQU SKR_V1.1 (Power outputs: Hotend0,Hotend1, Fan, Bed) #define BOARD_BIQU_B300_V1_0 1760 // BIQU B300_V1.0 (Power outputs: Hotend0, Fan, Bed, SPI Driver) #define BOARD_BIGTREE_SKR_V1_3 1761 // BIGTREE SKR_V1.3 (Power outputs: Hotend0, Hotend1, Fan, Bed) +#define BOARD_AZTEEG_X5_MINI 1762 // Azteeg X5 Mini (Power outputs: Hotend0, Bed, Fan) // // SAM3X8E ARM Cortex M3 @@ -253,6 +254,8 @@ #define BOARD_STM32F4 1804 // STM32 STM32GENERIC based STM32F4 controller #define BOARD_ARMED 1807 // Arm'ed STM32F4 based controller #define BOARD_RUMBA32 1809 // RUMBA32 STM32F4 based controller +#define BOARD_BLACK_STM32F407VE 1810 // BLACK_STM32F407VE +#define BOARD_BLACK_STM32F407ZE 1811 // BLACK_STM32F407ZE #define BOARD_STEVAL 1866 // STEVAL-3DP001V1 3D PRINTER BOARD // diff --git a/Marlin/src/core/debug_out.h b/Marlin/src/core/debug_out.h index 5b8e4b253b..e92c5c5416 100644 --- a/Marlin/src/core/debug_out.h +++ b/Marlin/src/core/debug_out.h @@ -47,6 +47,7 @@ #undef DEBUG_DELAY #if DEBUG_OUT + #define DEBUG_PRINT_P(P) serialprintPGM(P) #define DEBUG_ECHO_START SERIAL_ECHO_START #define DEBUG_ERROR_START SERIAL_ERROR_START #define DEBUG_CHAR SERIAL_CHAR @@ -66,6 +67,7 @@ #define DEBUG_XYZ SERIAL_XYZ #define DEBUG_DELAY(ms) serial_delay(ms) #else + #define DEBUG_PRINT_P(P) NOOP #define DEBUG_ECHO_START() NOOP #define DEBUG_ERROR_START() NOOP #define DEBUG_CHAR(...) NOOP diff --git a/Marlin/src/core/drivers.h b/Marlin/src/core/drivers.h index a405bd3144..a686ea584f 100644 --- a/Marlin/src/core/drivers.h +++ b/Marlin/src/core/drivers.h @@ -65,20 +65,45 @@ #define AXIS_DRIVER_TYPE(A,T) AXIS_DRIVER_TYPE_##A(T) -#define HAS_DRIVER(T) (AXIS_DRIVER_TYPE_X(T) || AXIS_DRIVER_TYPE_X2(T) || \ - AXIS_DRIVER_TYPE_Y(T) || AXIS_DRIVER_TYPE_Y2(T) || \ - AXIS_DRIVER_TYPE_Z(T) || AXIS_DRIVER_TYPE_Z2(T) || AXIS_DRIVER_TYPE_Z3(T) || \ - AXIS_DRIVER_TYPE_E0(T) || AXIS_DRIVER_TYPE_E1(T) || \ - AXIS_DRIVER_TYPE_E2(T) || AXIS_DRIVER_TYPE_E3(T) || \ - AXIS_DRIVER_TYPE_E4(T) || AXIS_DRIVER_TYPE_E5(T) ) +#define HAS_DRIVER(T) ( AXIS_DRIVER_TYPE_X(T) || AXIS_DRIVER_TYPE_X2(T) \ + || AXIS_DRIVER_TYPE_Y(T) || AXIS_DRIVER_TYPE_Y2(T) \ + || AXIS_DRIVER_TYPE_Z(T) || AXIS_DRIVER_TYPE_Z2(T) || AXIS_DRIVER_TYPE_Z3(T) \ + || AXIS_DRIVER_TYPE_E0(T) || AXIS_DRIVER_TYPE_E1(T) \ + || AXIS_DRIVER_TYPE_E2(T) || AXIS_DRIVER_TYPE_E3(T) \ + || AXIS_DRIVER_TYPE_E4(T) || AXIS_DRIVER_TYPE_E5(T) ) // Test for supported TMC drivers that require advanced configuration // Does not match standalone configurations -#define HAS_TRINAMIC ( HAS_DRIVER(TMC2130) || HAS_DRIVER(TMC2160) || HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2660) || HAS_DRIVER(TMC5130) || HAS_DRIVER(TMC5160) ) +#define HAS_TRINAMIC ( HAS_DRIVER(TMC2130) \ + || HAS_DRIVER(TMC2160) \ + || HAS_DRIVER(TMC2208) \ + || HAS_DRIVER(TMC2660) \ + || HAS_DRIVER(TMC5130) \ + || HAS_DRIVER(TMC5160) ) -#define AXIS_IS_TMC(A) ( AXIS_DRIVER_TYPE_##A(TMC2130) || \ - AXIS_DRIVER_TYPE_##A(TMC2160) || \ - AXIS_DRIVER_TYPE_##A(TMC2208) || \ - AXIS_DRIVER_TYPE_##A(TMC2660) || \ - AXIS_DRIVER_TYPE_##A(TMC5130) || \ - AXIS_DRIVER_TYPE_##A(TMC5160)) +#define AXIS_IS_TMC(A) ( AXIS_DRIVER_TYPE(A,TMC2130) \ + || AXIS_DRIVER_TYPE(A,TMC2160) \ + || AXIS_DRIVER_TYPE(A,TMC2208) \ + || AXIS_DRIVER_TYPE(A,TMC2660) \ + || AXIS_DRIVER_TYPE(A,TMC5130) \ + || AXIS_DRIVER_TYPE(A,TMC5160) ) + +// Test for a driver that uses SPI - this allows checking whether a _CS_ pin +// is considered sensitive +#define AXIS_HAS_SPI(A) ( AXIS_DRIVER_TYPE(A,TMC2130) \ + || AXIS_DRIVER_TYPE(A,TMC2160) \ + || AXIS_DRIVER_TYPE(A,TMC2660) \ + || AXIS_DRIVER_TYPE(A,TMC5130) \ + || AXIS_DRIVER_TYPE(A,TMC5160) ) + +#define AXIS_HAS_STALLGUARD(A) ( AXIS_DRIVER_TYPE(A,TMC2130) \ + || AXIS_DRIVER_TYPE(A,TMC2160) \ + || AXIS_DRIVER_TYPE(A,TMC2660) \ + || AXIS_DRIVER_TYPE(A,TMC5130) \ + || AXIS_DRIVER_TYPE(A,TMC5160) ) + +#define AXIS_HAS_STEALTHCHOP(A) ( AXIS_DRIVER_TYPE(A,TMC2130) \ + || AXIS_DRIVER_TYPE(A,TMC2160) \ + || AXIS_DRIVER_TYPE(A,TMC2208) \ + || AXIS_DRIVER_TYPE(A,TMC5130) \ + || AXIS_DRIVER_TYPE(A,TMC5160) ) diff --git a/Marlin/src/core/enum.h b/Marlin/src/core/enum.h index d3d7d948da..f2e0fe063b 100644 --- a/Marlin/src/core/enum.h +++ b/Marlin/src/core/enum.h @@ -39,6 +39,12 @@ enum AxisEnum : unsigned char { X_HEAD = 4, Y_HEAD = 5, Z_HEAD = 6, + E0_AXIS = 3, + E1_AXIS = 4, + E2_AXIS = 5, + E3_AXIS = 6, + E4_AXIS = 7, + E5_AXIS = 8, ALL_AXES = 0xFE, NO_AXIS = 0xFF }; diff --git a/Marlin/src/core/serial.cpp b/Marlin/src/core/serial.cpp index d2cbde239b..aae0d63698 100644 --- a/Marlin/src/core/serial.cpp +++ b/Marlin/src/core/serial.cpp @@ -22,6 +22,7 @@ #include "serial.h" #include "language.h" +#include "enum.h" uint8_t marlin_debug_flags = MARLIN_DEBUG_NONE; @@ -49,8 +50,14 @@ void serial_echopair_PGM(PGM_P const s_P, unsigned long v) { serialprintPGM(s_P) void serial_spaces(uint8_t count) { count *= (PROPORTIONAL_FONT_RATIO); while (count--) SERIAL_CHAR(' '); } +void serial_ternary(const bool onoff, PGM_P const pre, PGM_P const on, PGM_P const off, PGM_P const post/*=NULL*/) { + if (pre) serialprintPGM(pre); + serialprintPGM(onoff ? on : off); + if (post) serialprintPGM(post); +} void serialprint_onoff(const bool onoff) { serialprintPGM(onoff ? PSTR(MSG_ON) : PSTR(MSG_OFF)); } void serialprintln_onoff(const bool onoff) { serialprint_onoff(onoff); SERIAL_EOL(); } +void serialprint_truefalse(const bool tf) { serialprintPGM(tf ? PSTR("true") : PSTR("false")); } void print_bin(const uint16_t val) { uint16_t mask = 0x8000; @@ -61,21 +68,15 @@ void print_bin(const uint16_t val) { } } -#if ENABLED(DEBUG_LEVELING_FEATURE) +void print_xyz(PGM_P const prefix, PGM_P const suffix, const float x, const float y, const float z) { + serialprintPGM(prefix); + SERIAL_CHAR('('); + SERIAL_ECHO(x); + SERIAL_ECHOPAIR(", ", y, ", ", z); + SERIAL_CHAR(')'); + if (suffix) serialprintPGM(suffix); else SERIAL_EOL(); +} - #include "enum.h" - - void print_xyz(PGM_P const prefix, PGM_P const suffix, const float x, const float y, const float z) { - serialprintPGM(prefix); - SERIAL_CHAR('('); - SERIAL_ECHO(x); - SERIAL_ECHOPAIR(", ", y, ", ", z); - SERIAL_CHAR(')'); - if (suffix) serialprintPGM(suffix); else SERIAL_EOL(); - } - - void print_xyz(PGM_P const prefix, PGM_P const suffix, const float xyz[]) { - print_xyz(prefix, suffix, xyz[X_AXIS], xyz[Y_AXIS], xyz[Z_AXIS]); - } - -#endif +void print_xyz(PGM_P const prefix, PGM_P const suffix, const float xyz[]) { + print_xyz(prefix, suffix, xyz[X_AXIS], xyz[Y_AXIS], xyz[Z_AXIS]); +} diff --git a/Marlin/src/core/serial.h b/Marlin/src/core/serial.h index 5764c4c2df..f79856178c 100644 --- a/Marlin/src/core/serial.h +++ b/Marlin/src/core/serial.h @@ -174,18 +174,15 @@ inline void serial_echopair_PGM(PGM_P const s_P, void *v) { serial_echopair_PG void serialprintPGM(PGM_P str); void serial_echo_start(); void serial_error_start(); +void serial_ternary(const bool onoff, PGM_P const pre, PGM_P const on, PGM_P const off, PGM_P const post=NULL); void serialprint_onoff(const bool onoff); void serialprintln_onoff(const bool onoff); +void serialprint_truefalse(const bool tf); void serial_spaces(uint8_t count); void print_bin(const uint16_t val); -#if ENABLED(DEBUG_LEVELING_FEATURE) - void print_xyz(PGM_P const prefix, PGM_P const suffix, const float x, const float y, const float z); - void print_xyz(PGM_P const prefix, PGM_P const suffix, const float xyz[]); - #define SERIAL_POS(SUFFIX,VAR) do { print_xyz(PSTR(" " STRINGIFY(VAR) "="), PSTR(" : " SUFFIX "\n"), VAR); } while(0) - #define SERIAL_XYZ(PREFIX,...) do { print_xyz(PSTR(PREFIX), NULL, __VA_ARGS__); } while(0) -#else - #define SERIAL_POS(...) NOOP - #define SERIAL_XYZ(...) NOOP -#endif +void print_xyz(PGM_P const prefix, PGM_P const suffix, const float x, const float y, const float z); +void print_xyz(PGM_P const prefix, PGM_P const suffix, const float xyz[]); +#define SERIAL_POS(SUFFIX,VAR) do { print_xyz(PSTR(" " STRINGIFY(VAR) "="), PSTR(" : " SUFFIX "\n"), VAR); } while(0) +#define SERIAL_XYZ(PREFIX,...) do { print_xyz(PSTR(PREFIX), NULL, __VA_ARGS__); } while(0) diff --git a/Marlin/src/core/utility.cpp b/Marlin/src/core/utility.cpp index 261a27eefb..e695601cef 100644 --- a/Marlin/src/core/utility.cpp +++ b/Marlin/src/core/utility.cpp @@ -58,11 +58,11 @@ void safe_delay(millis_t ms) { #define MINUSOR(n, alt) (n >= 0 ? (alt) : (n = -n, '-')) // Convert a full-range unsigned 8bit int to a percentage - char* ui8tostr_percent(const uint8_t i) { - const uint8_t percent = ui8_to_percent(i); - conv[3] = RJDIGIT(percent, 100); - conv[4] = RJDIGIT(percent, 10); - conv[5] = DIGIMOD(percent, 1); + char* ui8tostr4pct(const uint8_t i) { + const uint8_t n = ui8_to_percent(i); + conv[3] = RJDIGIT(n, 100); + conv[4] = RJDIGIT(n, 10); + conv[5] = DIGIMOD(n, 1); conv[6] = '%'; return &conv[3]; } @@ -214,6 +214,19 @@ void safe_delay(millis_t ms) { return &conv[1]; } + // Convert signed float to string (5 digit) with -1.2345 / _0.0000 / +1.2345 format + char* ftostr54sign(const float &f, char plus/*=' '*/) { + long i = (f * 100000 + (f < 0 ? -5: 5)) / 10; + conv[0] = i ? MINUSOR(i, plus) : ' '; + conv[1] = DIGIMOD(i, 10000); + conv[2] = '.'; + conv[3] = DIGIMOD(i, 1000); + conv[4] = DIGIMOD(i, 100); + conv[5] = DIGIMOD(i, 10); + conv[6] = DIGIMOD(i, 1); + return &conv[0]; + } + // Convert unsigned float to rj string with 12345 format char* ftostr5rj(const float &f) { const long i = ((f < 0 ? -f : f) * 10 + 5) / 10; diff --git a/Marlin/src/core/utility.h b/Marlin/src/core/utility.h index 37e9c9e2e1..48f775b529 100644 --- a/Marlin/src/core/utility.h +++ b/Marlin/src/core/utility.h @@ -56,7 +56,7 @@ inline void serial_delay(const millis_t ms) { #if ANY(ULTRA_LCD, DEBUG_LEVELING_FEATURE, EXTENSIBLE_UI) // Convert a full-range unsigned 8bit int to a percentage - char* ui8tostr_percent(const uint8_t i); + char* ui8tostr4pct(const uint8_t i); // Convert uint8_t to string with 123 format char* ui8tostr3(const uint8_t x); @@ -91,6 +91,9 @@ inline void serial_delay(const millis_t ms) { // Convert signed float to string (6 digit) with -1.234 / _0.000 / +1.234 format char* ftostr43sign(const float &x, char plus=' '); + // Convert signed float to string (5 digit) with -1.2345 / _0.0000 / +1.2345 format + char* ftostr54sign(const float &x, char plus=' '); + // Convert unsigned float to rj string with 12345 format char* ftostr5rj(const float &x); diff --git a/Marlin/src/feature/I2CPositionEncoder.cpp b/Marlin/src/feature/I2CPositionEncoder.cpp index 6e25d6f7da..c1c20021ea 100644 --- a/Marlin/src/feature/I2CPositionEncoder.cpp +++ b/Marlin/src/feature/I2CPositionEncoder.cpp @@ -38,6 +38,8 @@ #include "../module/stepper.h" #include "../gcode/parser.h" +#include "../feature/babystep.h" + #include void I2CPositionEncoder::init(const uint8_t address, const AxisEnum axis) { @@ -169,7 +171,7 @@ void I2CPositionEncoder::update() { const int32_t errorP = int32_t(sumP * (1.0f / (I2CPE_ERR_PRST_ARRAY_SIZE))); SERIAL_ECHO(axis_codes[encoderAxis]); SERIAL_ECHOLNPAIR(" - err detected: ", errorP * planner.steps_to_mm[encoderAxis], "mm; correcting!"); - thermalManager.babystepsTodo[encoderAxis] = -LROUND(errorP); + babystep.add_steps(encoderAxis, -LROUND(errorP)); errPrstIdx = 0; } } @@ -180,7 +182,7 @@ void I2CPositionEncoder::update() { if (ABS(error) > threshold * planner.settings.axis_steps_per_mm[encoderAxis]) { //SERIAL_ECHOLN(error); //SERIAL_ECHOLN(position); - thermalManager.babystepsTodo[encoderAxis] = -LROUND(error / 2); + babystep.add_steps(encoderAxis, -LROUND(error / 2)); } #endif @@ -227,13 +229,11 @@ bool I2CPositionEncoder::passes_test(const bool report) { if (report) { if (H != I2CPE_MAG_SIG_GOOD) SERIAL_ECHOPGM("Warning. "); SERIAL_ECHO(axis_codes[encoderAxis]); - SERIAL_ECHOPGM(" axis "); - serialprintPGM(H == I2CPE_MAG_SIG_BAD ? PSTR("magnetic strip ") : PSTR("encoder ")); + serial_ternary(H == I2CPE_MAG_SIG_BAD, PSTR(" axis "), PSTR("magnetic strip "), PSTR("encoder ")); switch (H) { case I2CPE_MAG_SIG_GOOD: case I2CPE_MAG_SIG_MID: - SERIAL_ECHOLNPGM("passes test; field strength "); - serialprintPGM(H == I2CPE_MAG_SIG_GOOD ? PSTR("good.\n") : PSTR("fair.\n")); + serial_ternary(H == I2CPE_MAG_SIG_GOOD, PSTR("passes test; field strength "), PSTR("good"), PSTR("fair"), PSTR(".\n")); break; default: SERIAL_ECHOLNPGM("not detected!"); diff --git a/Marlin/src/feature/I2CPositionEncoder.h b/Marlin/src/feature/I2CPositionEncoder.h index b88ca88cb0..592aeb328d 100644 --- a/Marlin/src/feature/I2CPositionEncoder.h +++ b/Marlin/src/feature/I2CPositionEncoder.h @@ -275,9 +275,8 @@ class I2CPositionEncodersMgr { static void enable_ec(const int8_t idx, const bool enabled, const AxisEnum axis) { CHECK_IDX(); encoders[idx].set_ec_enabled(enabled); - SERIAL_ECHOPAIR("Error correction on ", axis_codes[axis], " axis is "); - serialprintPGM(encoders[idx].get_ec_enabled() ? PSTR("en") : PSTR("dis")); - SERIAL_ECHOLNPGM("abled."); + SERIAL_ECHOPAIR("Error correction on ", axis_codes[axis]); + serial_ternary(encoders[idx].get_ec_enabled(), PSTR(" axis is "), PSTR("en"), PSTR("dis"), PSTR("abled.\n")); } static void set_ec_threshold(const int8_t idx, const float newThreshold, const AxisEnum axis) { diff --git a/Marlin/src/feature/babystep.cpp b/Marlin/src/feature/babystep.cpp new file mode 100644 index 0000000000..efce79a092 --- /dev/null +++ b/Marlin/src/feature/babystep.cpp @@ -0,0 +1,135 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2019 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 . + * + */ + +#include "../inc/MarlinConfig.h" + +#if ENABLED(BABYSTEPPING) + +#include "babystep.h" +#include "../Marlin.h" +#include "../module/planner.h" +#include "../module/stepper.h" + +#if ENABLED(BABYSTEP_ALWAYS_AVAILABLE) + #include "../gcode/gcode.h" +#endif + +Babystep babystep; + +volatile int16_t Babystep::todo[BS_TODO_AXIS(Z_AXIS) + 1]; + +#if HAS_LCD_MENU + int16_t Babystep::accum; + #if ENABLED(BABYSTEP_DISPLAY_TOTAL) + int16_t Babystep::axis_total[BS_TOTAL_AXIS(Z_AXIS) + 1]; + #endif +#endif + +void Babystep::step_axis(const AxisEnum axis) { + const int16_t curTodo = todo[BS_TODO_AXIS(axis)]; // get rid of volatile for performance + if (curTodo) { + stepper.babystep((AxisEnum)axis, curTodo > 0); + if (curTodo > 0) todo[BS_TODO_AXIS(axis)]--; else todo[BS_TODO_AXIS(axis)]++; + } +} + +void Babystep::task() { + #if EITHER(BABYSTEP_XY, I2C_POSITION_ENCODERS) + LOOP_XYZ(axis) step_axis((AxisEnum)axis); + #else + step_axis(Z_AXIS); + #endif +} + +void Babystep::add_mm(const AxisEnum axis, const float &mm) { + add_steps(axis, mm * planner.settings.axis_steps_per_mm[axis]); +} + +void Babystep::add_steps(const AxisEnum axis, const int32_t distance) { + + #if ENABLED(BABYSTEP_WITHOUT_HOMING) + #define CAN_BABYSTEP(AXIS) true + #else + extern uint8_t axis_known_position; + #define CAN_BABYSTEP(AXIS) TEST(axis_known_position, AXIS) + #endif + + if (!CAN_BABYSTEP(axis)) return; + + #if HAS_LCD_MENU + accum += distance; // Count up babysteps for the UI + #if ENABLED(BABYSTEP_DISPLAY_TOTAL) + axis_total[BS_TOTAL_AXIS(axis)] += distance; + #endif + #endif + + #if ENABLED(BABYSTEP_ALWAYS_AVAILABLE) + #define BSA_ENABLE(AXIS) do{ switch (AXIS) { case X_AXIS: enable_X(); break; case Y_AXIS: enable_Y(); break; case Z_AXIS: enable_Z(); } }while(0) + #else + #define BSA_ENABLE(AXIS) NOOP + #endif + + #if IS_CORE + #if ENABLED(BABYSTEP_XY) + switch (axis) { + case CORE_AXIS_1: // X on CoreXY and CoreXZ, Y on CoreYZ + BSA_ENABLE(CORE_AXIS_1); + BSA_ENABLE(CORE_AXIS_2); + todo[CORE_AXIS_1] += distance * 2; + todo[CORE_AXIS_2] += distance * 2; + break; + case CORE_AXIS_2: // Y on CoreXY, Z on CoreXZ and CoreYZ + BSA_ENABLE(CORE_AXIS_1); + BSA_ENABLE(CORE_AXIS_2); + todo[CORE_AXIS_1] += CORESIGN(distance * 2); + todo[CORE_AXIS_2] -= CORESIGN(distance * 2); + break; + case NORMAL_AXIS: // Z on CoreXY, Y on CoreXZ, X on CoreYZ + default: + BSA_ENABLE(NORMAL_AXIS); + todo[NORMAL_AXIS] += distance; + break; + } + #elif CORE_IS_XZ || CORE_IS_YZ + // Only Z stepping needs to be handled here + BSA_ENABLE(CORE_AXIS_1); + BSA_ENABLE(CORE_AXIS_2); + todo[CORE_AXIS_1] += CORESIGN(distance * 2); + todo[CORE_AXIS_2] -= CORESIGN(distance * 2); + #else + BSA_ENABLE(Z_AXIS); + todo[Z_AXIS] += distance; + #endif + #else + #if ENABLED(BABYSTEP_XY) + BSA_ENABLE(axis); + #else + BSA_ENABLE(Z_AXIS); + #endif + todo[BS_TODO_AXIS(axis)] += distance; + #endif + #if ENABLED(BABYSTEP_ALWAYS_AVAILABLE) + gcode.reset_stepper_timeout(); + #endif +} + +#endif // BABYSTEPPING diff --git a/Marlin/src/feature/babystep.h b/Marlin/src/feature/babystep.h new file mode 100644 index 0000000000..3f22fac11f --- /dev/null +++ b/Marlin/src/feature/babystep.h @@ -0,0 +1,63 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2019 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 + +#include "../inc/MarlinConfigPre.h" +#include "../core/enum.h" + +#if IS_CORE || EITHER(BABYSTEP_XY, I2C_POSITION_ENCODERS) + #define BS_TODO_AXIS(A) A +#else + #define BS_TODO_AXIS(A) 0 +#endif + +#if HAS_LCD_MENU && ENABLED(BABYSTEP_DISPLAY_TOTAL) + #if ENABLED(BABYSTEP_XY) + #define BS_TOTAL_AXIS(A) A + #else + #define BS_TOTAL_AXIS(A) 0 + #endif +#endif + +class Babystep { +public: + static volatile int16_t todo[BS_TODO_AXIS(Z_AXIS) + 1]; + #if HAS_LCD_MENU + static int16_t accum; // Total babysteps in current edit + #if ENABLED(BABYSTEP_DISPLAY_TOTAL) + static int16_t axis_total[BS_TOTAL_AXIS(Z_AXIS) + 1]; // Total babysteps since G28 + static inline void reset_total(const AxisEnum axis) { + #if ENABLED(BABYSTEP_XY) + if (axis == Z_AXIS) + #endif + axis_total[BS_TOTAL_AXIS(axis)] = 0; + } + #endif + #endif + static void add_steps(const AxisEnum axis, const int32_t distance); + static void add_mm(const AxisEnum axis, const float &mm); + static void task(); +private: + static void step_axis(const AxisEnum axis); +}; + +extern Babystep babystep; diff --git a/Marlin/src/feature/bedlevel/bedlevel.cpp b/Marlin/src/feature/bedlevel/bedlevel.cpp index e7f2fcbdc5..55267b44e0 100644 --- a/Marlin/src/feature/bedlevel/bedlevel.cpp +++ b/Marlin/src/feature/bedlevel/bedlevel.cpp @@ -42,10 +42,6 @@ #define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE) #include "../../core/debug_out.h" -#if ENABLED(G26_MESH_VALIDATION) - bool g26_debug_flag; // = false -#endif - bool leveling_is_valid() { return #if ENABLED(MESH_BED_LEVELING) diff --git a/Marlin/src/feature/bedlevel/bedlevel.h b/Marlin/src/feature/bedlevel/bedlevel.h index fe05e7c4ff..e2e7e182f1 100644 --- a/Marlin/src/feature/bedlevel/bedlevel.h +++ b/Marlin/src/feature/bedlevel/bedlevel.h @@ -28,12 +28,6 @@ typedef struct { float distance; // When populated, the distance from the search location } mesh_index_pair; -#if ENABLED(G26_MESH_VALIDATION) - extern bool g26_debug_flag; -#else - constexpr bool g26_debug_flag = false; -#endif - #if ENABLED(PROBE_MANUALLY) extern bool g29_in_progress; #else diff --git a/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.cpp b/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.cpp index 15899bdee9..188ddb898d 100644 --- a/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.cpp +++ b/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.cpp @@ -49,8 +49,8 @@ ZERO(z_values); #if ENABLED(EXTENSIBLE_UI) for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++) - for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++) - ExtUI::onMeshUpdate(x, y, 0); + for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++) + ExtUI::onMeshUpdate(x, y, 0); #endif } diff --git a/Marlin/src/feature/bedlevel/ubl/ubl.cpp b/Marlin/src/feature/bedlevel/ubl/ubl.cpp index ad0799a6d2..9e637c7deb 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl.cpp @@ -35,7 +35,7 @@ #if ENABLED(EXTENSIBLE_UI) #include "../../../lcd/extensible_ui/ui_api.h" #endif - + #include "math.h" void unified_bed_leveling::echo_name() { @@ -58,54 +58,10 @@ void unified_bed_leveling::report_state() { echo_name(); - SERIAL_ECHOPGM(" System v" UBL_VERSION " "); - if (!planner.leveling_active) SERIAL_ECHOPGM("in"); - SERIAL_ECHOLNPGM("active."); + serial_ternary(planner.leveling_active, PSTR(" System v" UBL_VERSION " "), PSTR(""), PSTR("in"), PSTR("active\n")); serial_delay(50); } - #if ENABLED(UBL_DEVEL_DEBUGGING) - - static void debug_echo_axis(const AxisEnum axis) { - if (current_position[axis] == destination[axis]) - SERIAL_ECHOPGM("-------------"); - else - SERIAL_ECHO_F(destination[X_AXIS], 6); - } - - void debug_current_and_destination(PGM_P title) { - - // if the title message starts with a '!' it is so important, we are going to - // ignore the status of the g26_debug_flag - if (*title != '!' && !g26_debug_flag) return; - - const float de = destination[E_AXIS] - current_position[E_AXIS]; - - if (de == 0.0) return; // Printing moves only - - const float dx = destination[X_AXIS] - current_position[X_AXIS], - dy = destination[Y_AXIS] - current_position[Y_AXIS], - xy_dist = HYPOT(dx, dy); - - if (xy_dist == 0.0) return; - - const float fpmm = de / xy_dist; - SERIAL_ECHOPAIR_F(" fpmm=", fpmm, 6); - SERIAL_ECHOPAIR_F(" current=( ", current_position[X_AXIS], 6); - SERIAL_ECHOPAIR_F(", ", current_position[Y_AXIS], 6); - SERIAL_ECHOPAIR_F(", ", current_position[Z_AXIS], 6); - SERIAL_ECHOPAIR_F(", ", current_position[E_AXIS], 6); - SERIAL_ECHOPGM(" ) destination=( "); debug_echo_axis(X_AXIS); - SERIAL_ECHOPGM(", "); debug_echo_axis(Y_AXIS); - SERIAL_ECHOPGM(", "); debug_echo_axis(Z_AXIS); - SERIAL_ECHOPGM(", "); debug_echo_axis(E_AXIS); - SERIAL_ECHOPGM(" ) "); - serialprintPGM(title); - SERIAL_EOL(); - } - - #endif // UBL_DEVEL_DEBUGGING - int8_t unified_bed_leveling::storage_slot; float unified_bed_leveling::z_values[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y]; @@ -135,8 +91,8 @@ ZERO(z_values); #if ENABLED(EXTENSIBLE_UI) for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++) - for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++) - ExtUI::onMeshUpdate(x, y, 0); + for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++) + ExtUI::onMeshUpdate(x, y, 0); #endif if (was_enabled) report_current_position(); } diff --git a/Marlin/src/feature/bedlevel/ubl/ubl.h b/Marlin/src/feature/bedlevel/ubl/ubl.h index 969fd209dc..a7c7f033b3 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl.h +++ b/Marlin/src/feature/bedlevel/ubl/ubl.h @@ -39,14 +39,6 @@ #define USE_NOZZLE_AS_REFERENCE 0 #define USE_PROBE_AS_REFERENCE 1 -// ubl_motion.cpp - -#if ENABLED(UBL_DEVEL_DEBUGGING) - void debug_current_and_destination(PGM_P const title); -#else - FORCE_INLINE void debug_current_and_destination(PGM_P const title) { UNUSED(title); } -#endif - // ubl_G29.cpp enum MeshPointType : char { INVALID, REAL, SET_IN_BITMAP }; diff --git a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp index e588bd2b50..ba9205b9c3 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp @@ -24,8 +24,6 @@ #if ENABLED(AUTO_BED_LEVELING_UBL) - //#define UBL_DEVEL_DEBUGGING - #include "ubl.h" #include "../../../Marlin.h" @@ -765,14 +763,12 @@ if (location.x_index >= 0) { // mesh point found and is reachable by probe const float rawx = mesh_index_to_xpos(location.x_index), - rawy = mesh_index_to_ypos(location.y_index); - - const float measured_z = probe_pt(rawx, rawy, stow_probe ? PROBE_PT_STOW : PROBE_PT_RAISE, g29_verbose_level); // TODO: Needs error handling + rawy = mesh_index_to_ypos(location.y_index), + measured_z = probe_pt(rawx, rawy, stow_probe ? PROBE_PT_STOW : PROBE_PT_RAISE, g29_verbose_level); // TODO: Needs error handling z_values[location.x_index][location.y_index] = measured_z; #if ENABLED(EXTENSIBLE_UI) ExtUI::onMeshUpdate(location.x_index, location.y_index, measured_z); #endif - } SERIAL_FLUSH(); // Prevent host M105 buffer overrun. } while (location.x_index >= 0 && --count); diff --git a/Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp b/Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp index 4034531a04..d3cf1ac924 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp @@ -64,17 +64,6 @@ cell_dest_xi = get_cell_index_x(end[X_AXIS]), cell_dest_yi = get_cell_index_y(end[Y_AXIS]); - if (g26_debug_flag) { - SERIAL_ECHOLNPAIR( - " ubl.line_to_destination_cartesian(xe=", destination[X_AXIS], - ", ye=", destination[Y_AXIS], - ", ze=", destination[Z_AXIS], - ", ee=", destination[E_AXIS], - ")" - ); - debug_current_and_destination(PSTR("Start of ubl.line_to_destination_cartesian()")); - } - // A move within the same cell needs no splitting if (cell_start_xi == cell_dest_xi && cell_start_yi == cell_dest_yi) { @@ -93,9 +82,6 @@ planner.buffer_segment(end[X_AXIS], end[Y_AXIS], end[Z_AXIS] + z_raise, end[E_AXIS], feed_rate, extruder); set_current_from_destination(); - if (g26_debug_flag) - debug_current_and_destination(PSTR("out of bounds in ubl.line_to_destination_cartesian()")); - return; } @@ -119,9 +105,6 @@ // Replace NAN corrections with 0.0 to prevent NAN propagation. planner.buffer_segment(end[X_AXIS], end[Y_AXIS], end[Z_AXIS] + (isnan(z0) ? 0.0 : z0), end[E_AXIS], feed_rate, extruder); - if (g26_debug_flag) - debug_current_and_destination(PSTR("FINAL_MOVE in ubl.line_to_destination_cartesian()")); - set_current_from_destination(); return; } @@ -215,9 +198,6 @@ } //else printf("FIRST MOVE PRUNED "); } - if (g26_debug_flag) - debug_current_and_destination(PSTR("vertical move done in ubl.line_to_destination_cartesian()")); - // At the final destination? Usually not, but when on a Y Mesh Line it's completed. if (current_position[X_AXIS] != end[X_AXIS] || current_position[Y_AXIS] != end[Y_AXIS]) goto FINAL_MOVE; @@ -267,9 +247,6 @@ } //else printf("FIRST MOVE PRUNED "); } - if (g26_debug_flag) - debug_current_and_destination(PSTR("horizontal move done in ubl.line_to_destination_cartesian()")); - if (current_position[X_AXIS] != end[X_AXIS] || current_position[Y_AXIS] != end[Y_AXIS]) goto FINAL_MOVE; @@ -353,9 +330,6 @@ if (xi_cnt < 0 || yi_cnt < 0) break; // Too far! Exit the loop and go to FINAL_MOVE } - if (g26_debug_flag) - debug_current_and_destination(PSTR("generic move done in ubl.line_to_destination_cartesian()")); - if (current_position[X_AXIS] != end[X_AXIS] || current_position[Y_AXIS] != end[Y_AXIS]) goto FINAL_MOVE; diff --git a/Marlin/src/feature/digipot/digipot_mcp4451.cpp b/Marlin/src/feature/digipot/digipot_mcp4451.cpp index 6e02a1607c..bc43304055 100644 --- a/Marlin/src/feature/digipot/digipot_mcp4451.cpp +++ b/Marlin/src/feature/digipot/digipot_mcp4451.cpp @@ -35,6 +35,9 @@ #if MB(5DPRINT) #define DIGIPOT_I2C_FACTOR 117.96 #define DIGIPOT_I2C_MAX_CURRENT 1.736 +#elif MB(AZTEEG_X5_MINI) || MB(AZTEEG_X5_MINI_WIFI) + #define DIGIPOT_I2C_FACTOR 113.5 + #define DIGIPOT_I2C_MAX_CURRENT 2.0 #else #define DIGIPOT_I2C_FACTOR 106.7 #define DIGIPOT_I2C_MAX_CURRENT 2.5 diff --git a/Marlin/src/feature/leds/leds.h b/Marlin/src/feature/leds/leds.h index bbd609c29a..eafede7dc9 100644 --- a/Marlin/src/feature/leds/leds.h +++ b/Marlin/src/feature/leds/leds.h @@ -120,19 +120,28 @@ typedef struct LEDColor { #else #define MakeLEDColor(R,G,B,W,I) LEDColor(R, G, B, W) #endif - #define LEDColorWhite() LEDColor(0, 0, 0, 255) #else - #define MakeLEDColor(R,G,B,W,I) LEDColor(R, G, B) - #define LEDColorWhite() LEDColor(255, 255, 255) + #define MakeLEDColor(R,G,B,W,I) LEDColor(R, G, B) +#endif + +#define LEDColorOff() LEDColor( 0, 0, 0) +#define LEDColorRed() LEDColor(255, 0, 0) +#if ENABLED(LED_COLORS_REDUCE_GREEN) + #define LEDColorOrange() LEDColor(255, 25, 0) + #define LEDColorYellow() LEDColor(255, 75, 0) +#else + #define LEDColorOrange() LEDColor(255, 80, 0) + #define LEDColorYellow() LEDColor(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) +#if HAS_WHITE_LED + #define LEDColorWhite() LEDColor( 0, 0, 0, 255) +#else + #define LEDColorWhite() LEDColor(255, 255, 255) #endif -#define LEDColorOff() LEDColor( 0, 0, 0) -#define LEDColorRed() LEDColor(255, 0, 0) -#define LEDColorOrange() LEDColor(255, 80, 0) -#define LEDColorYellow() LEDColor(255, 255, 0) -#define LEDColorGreen() LEDColor( 0, 255, 0) -#define LEDColorBlue() LEDColor( 0, 0, 255) -#define LEDColorIndigo() LEDColor( 0, 255, 255) -#define LEDColorViolet() LEDColor(255, 0, 255) class LEDLights { public: diff --git a/Marlin/src/feature/power_loss_recovery.cpp b/Marlin/src/feature/power_loss_recovery.cpp index a16218c29a..17ba4a101b 100644 --- a/Marlin/src/feature/power_loss_recovery.cpp +++ b/Marlin/src/feature/power_loss_recovery.cpp @@ -50,6 +50,9 @@ job_recovery_info_t PrintJobRecovery::info; #include "fwretract.h" #endif +#define DEBUG_OUT ENABLED(DEBUG_POWER_LOSS_RECOVERY) +#include "../core/debug_out.h" + PrintJobRecovery recovery; /** @@ -110,9 +113,7 @@ void PrintJobRecovery::load() { (void)file.read(&info, sizeof(info)); close(); } - #if ENABLED(DEBUG_POWER_LOSS_RECOVERY) - debug(PSTR("Load")); - #endif + debug(PSTR("Load")); } /** @@ -126,8 +127,6 @@ void PrintJobRecovery::save(const bool force/*=false*/, const bool save_queue/*= #endif // Did Z change since the last call? - const float zmoved = current_position[Z_AXIS] - info.current_position[Z_AXIS]; - if (force #if DISABLED(SAVE_EACH_CMD_MODE) // Always save state when enabled #if PIN_EXISTS(POWER_LOSS) // Save if power loss pin is triggered @@ -136,8 +135,8 @@ void PrintJobRecovery::save(const bool force/*=false*/, const bool save_queue/*= #if SAVE_INFO_INTERVAL_MS > 0 // Save if interval is elapsed || ELAPSED(ms, next_save_ms) #endif - || zmoved > 0 // Z moved up (including Z-hop) - || zmoved < -5 // Z moved down a lot (for some reason) + // Save every time Z is higher than the last call + || current_position[Z_AXIS] > info.current_position[Z_AXIS] #endif ) { @@ -218,20 +217,14 @@ void PrintJobRecovery::save(const bool force/*=false*/, const bool save_queue/*= */ void PrintJobRecovery::write() { - #if ENABLED(DEBUG_POWER_LOSS_RECOVERY) - debug(PSTR("Write")); - #endif + debug(PSTR("Write")); open(false); file.seekSet(0); const int16_t ret = file.write(&info, sizeof(info)); close(); - #if ENABLED(DEBUG_POWER_LOSS_RECOVERY) - if (ret == -1) SERIAL_ECHOLNPGM("Power-loss file write failed."); - #else - UNUSED(ret); - #endif + if (ret == -1) DEBUG_ECHOLNPGM("Power-loss file write failed."); } /** @@ -369,65 +362,65 @@ void PrintJobRecovery::resume() { #if ENABLED(DEBUG_POWER_LOSS_RECOVERY) void PrintJobRecovery::debug(PGM_P const prefix) { - serialprintPGM(prefix); - SERIAL_ECHOLNPAIR(" Job Recovery Info...\nvalid_head:", int(info.valid_head), " valid_foot:", int(info.valid_foot)); + DEBUG_PRINT_P(prefix); + DEBUG_ECHOLNPAIR(" Job Recovery Info...\nvalid_head:", int(info.valid_head), " valid_foot:", int(info.valid_foot)); if (info.valid_head) { if (info.valid_head == info.valid_foot) { - SERIAL_ECHOPGM("current_position: "); + DEBUG_ECHOPGM("current_position: "); LOOP_XYZE(i) { - SERIAL_ECHO(info.current_position[i]); - if (i < E_AXIS) SERIAL_CHAR(','); + if (i) DEBUG_CHAR(','); + DEBUG_ECHO(info.current_position[i]); } - SERIAL_EOL(); - SERIAL_ECHOLNPAIR("feedrate: ", info.feedrate); + DEBUG_EOL(); + DEBUG_ECHOLNPAIR("feedrate: ", info.feedrate); #if HOTENDS > 1 - SERIAL_ECHOLNPAIR("active_hotend: ", int(info.active_hotend)); + DEBUG_ECHOLNPAIR("active_hotend: ", int(info.active_hotend)); #endif - SERIAL_ECHOPGM("target_temperature: "); + DEBUG_ECHOPGM("target_temperature: "); HOTEND_LOOP() { - SERIAL_ECHO(info.target_temperature[e]); - if (e < HOTENDS - 1) SERIAL_CHAR(','); + DEBUG_ECHO(info.target_temperature[e]); + if (e < HOTENDS - 1) DEBUG_CHAR(','); } - SERIAL_EOL(); + DEBUG_EOL(); #if HAS_HEATED_BED - SERIAL_ECHOLNPAIR("target_temperature_bed: ", info.target_temperature_bed); + DEBUG_ECHOLNPAIR("target_temperature_bed: ", info.target_temperature_bed); #endif #if FAN_COUNT - SERIAL_ECHOPGM("fan_speed: "); + DEBUG_ECHOPGM("fan_speed: "); FANS_LOOP(i) { - SERIAL_ECHO(int(info.fan_speed[i])); - if (i < FAN_COUNT - 1) SERIAL_CHAR(','); + DEBUG_ECHO(int(info.fan_speed[i])); + if (i < FAN_COUNT - 1) DEBUG_CHAR(','); } - SERIAL_EOL(); + DEBUG_EOL(); #endif #if HAS_LEVELING - SERIAL_ECHOLNPAIR("leveling: ", int(info.leveling), "\n fade: ", int(info.fade)); + DEBUG_ECHOLNPAIR("leveling: ", int(info.leveling), "\n fade: ", int(info.fade)); #endif #if ENABLED(FWRETRACT) - SERIAL_ECHOPGM("retract: "); + DEBUG_ECHOPGM("retract: "); for (int8_t e = 0; e < EXTRUDERS; e++) { - SERIAL_ECHO(info.retract[e]); - if (e < EXTRUDERS - 1) SERIAL_CHAR(','); + DEBUG_ECHO(info.retract[e]); + if (e < EXTRUDERS - 1) DEBUG_CHAR(','); } - SERIAL_EOL(); - SERIAL_ECHOLNPAIR("retract_hop: ", info.retract_hop); + DEBUG_EOL(); + DEBUG_ECHOLNPAIR("retract_hop: ", info.retract_hop); #endif - SERIAL_ECHOLNPAIR("cmd_queue_index_r: ", int(info.cmd_queue_index_r)); - SERIAL_ECHOLNPAIR("commands_in_queue: ", int(info.commands_in_queue)); - for (uint8_t i = 0; i < info.commands_in_queue; i++) SERIAL_ECHOLNPAIR("> ", info.command_queue[i]); - SERIAL_ECHOLNPAIR("sd_filename: ", info.sd_filename); - SERIAL_ECHOLNPAIR("sdpos: ", info.sdpos); - SERIAL_ECHOLNPAIR("print_job_elapsed: ", info.print_job_elapsed); + DEBUG_ECHOLNPAIR("cmd_queue_index_r: ", int(info.cmd_queue_index_r)); + DEBUG_ECHOLNPAIR("commands_in_queue: ", int(info.commands_in_queue)); + for (uint8_t i = 0; i < info.commands_in_queue; i++) DEBUG_ECHOLNPAIR("> ", info.command_queue[i]); + DEBUG_ECHOLNPAIR("sd_filename: ", info.sd_filename); + DEBUG_ECHOLNPAIR("sdpos: ", info.sdpos); + DEBUG_ECHOLNPAIR("print_job_elapsed: ", info.print_job_elapsed); } else - SERIAL_ECHOLNPGM("INVALID DATA"); + DEBUG_ECHOLNPGM("INVALID DATA"); } - SERIAL_ECHOLNPGM("---"); + DEBUG_ECHOLNPGM("---"); } #endif // DEBUG_POWER_LOSS_RECOVERY diff --git a/Marlin/src/feature/power_loss_recovery.h b/Marlin/src/feature/power_loss_recovery.h index c2f8687711..45b057e752 100644 --- a/Marlin/src/feature/power_loss_recovery.h +++ b/Marlin/src/feature/power_loss_recovery.h @@ -125,9 +125,11 @@ class PrintJobRecovery { static inline bool valid() { return info.valid_head && info.valid_head == info.valid_foot; } - #if ENABLED(DEBUG_POWER_LOSS_RECOVERY) - static void debug(PGM_P const prefix); - #endif + #if ENABLED(DEBUG_POWER_LOSS_RECOVERY) + static void debug(PGM_P const prefix); + #else + static inline void debug(PGM_P const prefix) { UNUSED(prefix); } + #endif private: static void write(); diff --git a/Marlin/src/feature/prusa_MMU2/mmu2.cpp b/Marlin/src/feature/prusa_MMU2/mmu2.cpp index d2134e4076..7d0e6fcfda 100644 --- a/Marlin/src/feature/prusa_MMU2/mmu2.cpp +++ b/Marlin/src/feature/prusa_MMU2/mmu2.cpp @@ -90,7 +90,7 @@ bool MMU2::enabled, MMU2::ready, MMU2::mmu_print_saved; uint8_t MMU2::cmd, MMU2::cmd_arg, MMU2::last_cmd, MMU2::extruder; int8_t MMU2::state = 0; volatile int8_t MMU2::finda = 1; -volatile bool MMU2::findaRunoutValid; +volatile bool MMU2::finda_runout_valid; int16_t MMU2::version = -1, MMU2::buildnr = -1; millis_t MMU2::last_request, MMU2::next_P0_request; char MMU2::rx_buffer[16], MMU2::tx_buffer[16]; @@ -103,7 +103,7 @@ char MMU2::rx_buffer[16], MMU2::tx_buffer[16]; }; static constexpr E_Step ramming_sequence[] PROGMEM = { MMU2_RAMMING_SEQUENCE }; - static constexpr E_Step loadToNozzle_sequence[] PROGMEM = { MMU2_LOAD_TO_NOZZLE_SEQUENCE }; + static constexpr E_Step load_to_nozzle_sequence[] PROGMEM = { MMU2_LOAD_TO_NOZZLE_SEQUENCE }; #endif // MMU2_MENUS @@ -142,11 +142,11 @@ void MMU2::reset() { #endif } -uint8_t MMU2::getCurrentTool() { +uint8_t MMU2::get_current_tool() { return extruder == MMU2_NO_TOOL ? -1 : extruder; } -void MMU2::mmuLoop() { +void MMU2::mmu_loop() { switch (state) { @@ -185,7 +185,7 @@ void MMU2::mmuLoop() { DEBUG_ECHOLNPAIR("MMU => ", buildnr); - checkVersion(); + check_version(); #if ENABLED(MMU2_MODE_12V) DEBUG_ECHOLNPGM("MMU <= 'M1'"); @@ -207,7 +207,7 @@ void MMU2::mmuLoop() { if (rx_ok()) { DEBUG_ECHOLNPGM("MMU => ok"); - checkVersion(); + check_version(); DEBUG_ECHOLNPGM("MMU <= 'P0'"); @@ -294,13 +294,13 @@ void MMU2::mmuLoop() { sscanf(rx_buffer, "%hhuok\n", &finda); // This is super annoying. Only activate if necessary - // if (findaRunoutValid) DEBUG_ECHOLNPAIR_F("MMU <= 'P0'\nMMU => ", finda, 6); + // if (finda_runout_valid) DEBUG_ECHOLNPAIR_F("MMU <= 'P0'\nMMU => ", finda, 6); state = 1; if (cmd == 0) ready = true; - if (!finda && findaRunoutValid) filamentRunout(); + if (!finda && finda_runout_valid) filament_runout(); } else if (ELAPSED(millis(), last_request + MMU_P0_TIMEOUT)) // Resend request after timeout (30s) state = 1; @@ -434,7 +434,7 @@ bool MMU2::rx_ok() { /** * Check if MMU has compatible firmware */ -void MMU2::checkVersion() { +void MMU2::check_version() { if (buildnr < MMU_REQUIRED_FW_BUILDNR) { SERIAL_ERROR_START(); SERIAL_ECHOPGM("MMU2 firmware version invalid. Required version >= "); @@ -447,7 +447,7 @@ void MMU2::checkVersion() { /** * Handle tool change */ -void MMU2::toolChange(uint8_t index) { +void MMU2::tool_change(uint8_t index) { if (!enabled) return; @@ -461,7 +461,7 @@ void MMU2::toolChange(uint8_t index) { command(MMU_CMD_T0 + index); - manageResponse(true, true); + manage_response(true, true); KEEPALIVE_STATE(IN_HANDLER); command(MMU_CMD_C0); @@ -490,7 +490,7 @@ void MMU2::toolChange(uint8_t index) { * Tc Load to nozzle after filament was prepared by Tx and extruder nozzle is already heated. * */ -void MMU2::toolChange(const char* special) { +void MMU2::tool_change(const char* special) { if (!enabled) return; @@ -501,19 +501,19 @@ void MMU2::toolChange(const char* special) { switch (*special) { case '?': { - uint8_t index = mmu2_chooseFilament(); + uint8_t index = mmu2_choose_filament(); while (!thermalManager.wait_for_hotend(active_extruder, false)) safe_delay(100); - loadFilamentToNozzle(index); + load_filament_to_nozzle(index); } break; case 'x': { planner.synchronize(); - uint8_t index = mmu2_chooseFilament(); + uint8_t index = mmu2_choose_filament(); disable_E0(); command(MMU_CMD_T0 + index); - manageResponse(true, true); + manage_response(true, true); command(MMU_CMD_C0); - mmuLoop(); + mmu_loop(); enable_E0(); extruder = index; @@ -522,7 +522,7 @@ void MMU2::toolChange(const char* special) { case 'c': { while (!thermalManager.wait_for_hotend(active_extruder, false)) safe_delay(100); - executeExtruderSequence((const E_Step *)loadToNozzle_sequence, COUNT(loadToNozzle_sequence)); + execute_extruder_sequence((const E_Step *)load_to_nozzle_sequence, COUNT(load_to_nozzle_sequence)); } break; } @@ -547,7 +547,7 @@ void MMU2::command(const uint8_t mmu_cmd) { /** * Wait for response from MMU */ -bool MMU2::getResponse(void) { +bool MMU2::get_response(void) { while (cmd != MMU_CMD_NONE) idle(); while (!ready) { @@ -565,7 +565,7 @@ bool MMU2::getResponse(void) { /** * Wait for response and deal with timeout if nexcessary */ -void MMU2::manageResponse(bool move_axes, bool turn_off_nozzle) { +void MMU2::manage_response(bool move_axes, bool turn_off_nozzle) { bool response = false; mmu_print_saved = false; @@ -575,7 +575,7 @@ void MMU2::manageResponse(bool move_axes, bool turn_off_nozzle) { while (!response) { - response = getResponse(); //wait for "ok" from mmu + response = get_response(); //wait for "ok" from mmu if (!response) { //no "ok" was received in reserved time frame, user will fix the issue on mmu unit if (!mmu_print_saved) { //first occurence, we are saving current position, park print head in certain position and disable nozzle heater @@ -636,7 +636,7 @@ void MMU2::manageResponse(bool move_axes, bool turn_off_nozzle) { } } -void MMU2::setFilamentType(uint8_t index, uint8_t filamentType) { +void MMU2::set_filament_type(uint8_t index, uint8_t filamentType) { if (!enabled) return; KEEPALIVE_STATE(IN_HANDLER); @@ -644,12 +644,12 @@ void MMU2::setFilamentType(uint8_t index, uint8_t filamentType) { cmd_arg = filamentType; command(MMU_CMD_F0 + index); - manageResponse(true, true); + manage_response(true, true); KEEPALIVE_STATE(NOT_BUSY); } -void MMU2::filamentRunout() { +void MMU2::filament_runout() { enqueue_and_echo_commands_P(PSTR(MMU2_FILAMENT_RUNOUT_SCRIPT)); planner.synchronize(); } @@ -657,10 +657,10 @@ void MMU2::filamentRunout() { #if HAS_LCD_MENU && ENABLED(MMU2_MENUS) // Load filament into MMU2 - void MMU2::loadFilament(uint8_t index) { + void MMU2::load_filament(uint8_t index) { if (!enabled) return; command(MMU_CMD_L0 + index); - manageResponse(false, false); + manage_response(false, false); BUZZ(200, 404); } @@ -669,7 +669,7 @@ void MMU2::filamentRunout() { * Switch material and load to nozzle * */ - bool MMU2::loadFilamentToNozzle(uint8_t index) { + bool MMU2::load_filament_to_nozzle(uint8_t index) { if (!enabled) return false; @@ -682,14 +682,14 @@ void MMU2::filamentRunout() { KEEPALIVE_STATE(IN_HANDLER); command(MMU_CMD_T0 + index); - manageResponse(true, true); + manage_response(true, true); command(MMU_CMD_C0); - mmuLoop(); + mmu_loop(); extruder = index; active_extruder = 0; - loadToNozzle(); + load_to_nozzle(); BUZZ(200, 404); @@ -706,12 +706,12 @@ void MMU2::filamentRunout() { * It is not used after T0 .. T4 command (select filament), in such case, gcode is responsible for loading * filament to nozzle. */ - void MMU2::loadToNozzle() { + void MMU2::load_to_nozzle() { if (!enabled) return; - executeExtruderSequence((const E_Step *)loadToNozzle_sequence, COUNT(loadToNozzle_sequence)); + execute_extruder_sequence((const E_Step *)load_to_nozzle_sequence, COUNT(load_to_nozzle_sequence)); } - bool MMU2::ejectFilament(uint8_t index, bool recover) { + bool MMU2::eject_filament(uint8_t index, bool recover) { if (!enabled) return false; @@ -731,7 +731,7 @@ void MMU2::filamentRunout() { planner.buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 2500 / 60, active_extruder); planner.synchronize(); command(MMU_CMD_E0 + index); - manageResponse(false, false); + manage_response(false, false); if (recover) { LCD_MESSAGEPGM(MSG_MMU2_EJECT_RECOVER); @@ -745,7 +745,7 @@ void MMU2::filamentRunout() { BUZZ(200, 404); command(MMU_CMD_R0); - manageResponse(false, false); + manage_response(false, false); } ui.reset_status(); @@ -783,10 +783,10 @@ void MMU2::filamentRunout() { KEEPALIVE_STATE(IN_HANDLER); - filamentRamming(); + filament_ramming(); command(MMU_CMD_U0); - manageResponse(false, true); + manage_response(false, true); BUZZ(200, 404); @@ -803,11 +803,11 @@ void MMU2::filamentRunout() { /** * Unload sequence to optimize shape of the tip of the unloaded filament */ - void MMU2::filamentRamming() { - executeExtruderSequence((const E_Step *)ramming_sequence, sizeof(ramming_sequence) / sizeof(E_Step)); + void MMU2::filament_ramming() { + execute_extruder_sequence((const E_Step *)ramming_sequence, sizeof(ramming_sequence) / sizeof(E_Step)); } - void MMU2::executeExtruderSequence(const E_Step * sequence, int steps) { + void MMU2::execute_extruder_sequence(const E_Step * sequence, int steps) { planner.synchronize(); enable_E0(); diff --git a/Marlin/src/feature/prusa_MMU2/mmu2.h b/Marlin/src/feature/prusa_MMU2/mmu2.h index e7546b3406..9c280479c1 100644 --- a/Marlin/src/feature/prusa_MMU2/mmu2.h +++ b/Marlin/src/feature/prusa_MMU2/mmu2.h @@ -36,18 +36,18 @@ public: static void init(); static void reset(); - static void mmuLoop(); - static void toolChange(uint8_t index); - static void toolChange(const char* special); - static uint8_t getCurrentTool(); - static void setFilamentType(uint8_t index, uint8_t type); + static void mmu_loop(); + static void tool_change(uint8_t index); + static void tool_change(const char* special); + static uint8_t get_current_tool(); + static void set_filament_type(uint8_t index, uint8_t type); #if HAS_LCD_MENU && ENABLED(MMU2_MENUS) static bool unload(); - static void loadFilament(uint8_t); - static void loadAll(); - static bool loadFilamentToNozzle(uint8_t index); - static bool ejectFilament(uint8_t index, bool recover); + static void load_filament(uint8_t); + static void load_all(); + static bool load_filament_to_nozzle(uint8_t index); + static bool eject_filament(uint8_t index, bool recover); #endif private: @@ -59,31 +59,31 @@ private: static bool rx_ok(); static bool rx_start(); - static void checkVersion(); + static void check_version(); static void command(const uint8_t cmd); - static bool getResponse(void); - static void manageResponse(bool move_axes, bool turn_off_nozzle); + static bool get_response(void); + static void manage_response(bool move_axes, bool turn_off_nozzle); #if HAS_LCD_MENU && ENABLED(MMU2_MENUS) - static void loadToNozzle(); - static void filamentRamming(); - static void executeExtruderSequence(const E_Step * sequence, int steps); + static void load_to_nozzle(); + static void filament_ramming(); + static void execute_extruder_sequence(const E_Step * sequence, int steps); #endif - static void filamentRunout(); + static void filament_runout(); static bool enabled, ready, mmu_print_saved; static uint8_t cmd, cmd_arg, last_cmd, extruder; static int8_t state; static volatile int8_t finda; - static volatile bool findaRunoutValid; + static volatile bool finda_runout_valid; static int16_t version, buildnr; static millis_t last_request, next_P0_request; static char rx_buffer[16], tx_buffer[16]; static inline void set_runout_valid(const bool valid) { - findaRunoutValid = valid; + finda_runout_valid = valid; #if HAS_FILAMENT_SENSOR if (valid) runout.reset(); #endif diff --git a/Marlin/src/feature/tmc_util.cpp b/Marlin/src/feature/tmc_util.cpp index ee28f70633..ff477818fe 100644 --- a/Marlin/src/feature/tmc_util.cpp +++ b/Marlin/src/feature/tmc_util.cpp @@ -474,7 +474,7 @@ switch (i) { case TMC_PWM_SCALE: SERIAL_PRINT(st.PWM_SCALE(), DEC); break; case TMC_SGT: SERIAL_PRINT(st.sgt(), DEC); break; - case TMC_STEALTHCHOP: serialprintPGM(st.en_pwm_mode() ? PSTR("true") : PSTR("false")); break; + case TMC_STEALTHCHOP: serialprint_truefalse(st.en_pwm_mode()); break; default: break; } } @@ -497,7 +497,7 @@ switch (i) { case TMC_PWM_SCALE: SERIAL_PRINT(st.PWM_SCALE(), DEC); break; case TMC_SGT: SERIAL_PRINT(st.sgt(), DEC); break; - case TMC_STEALTHCHOP: serialprintPGM(st.en_pwm_mode() ? PSTR("true") : PSTR("false")); break; + case TMC_STEALTHCHOP: serialprint_truefalse(st.en_pwm_mode()); break; case TMC_GLOBAL_SCALER: { uint16_t value = st.GLOBAL_SCALER(); @@ -514,7 +514,7 @@ static void tmc_status(TMC2208Stepper &st, const TMC_debug_enum i) { switch (i) { case TMC_PWM_SCALE: SERIAL_PRINT(st.pwm_scale_sum(), DEC); break; - case TMC_STEALTHCHOP: serialprintPGM(st.stealth() ? PSTR("true") : PSTR("false")); break; + case TMC_STEALTHCHOP: serialprint_truefalse(st.stealth()); break; case TMC_S2VSA: if (st.s2vsa()) SERIAL_CHAR('X'); break; case TMC_S2VSB: if (st.s2vsb()) SERIAL_CHAR('X'); break; default: break; @@ -541,7 +541,7 @@ SERIAL_CHAR('\t'); switch (i) { case TMC_CODES: st.printLabel(); break; - case TMC_ENABLED: serialprintPGM(st.isEnabled() ? PSTR("true") : PSTR("false")); break; + case TMC_ENABLED: serialprint_truefalse(st.isEnabled()); break; case TMC_CURRENT: SERIAL_ECHO(st.getMilliamps()); break; case TMC_RMS_CURRENT: SERIAL_ECHO(st.rms_current()); break; case TMC_MAX_CURRENT: SERIAL_PRINT((float)st.rms_current() * 1.41, 0); break; @@ -578,9 +578,9 @@ SERIAL_CHAR('-'); } break; - case TMC_OTPW: serialprintPGM(st.otpw() ? PSTR("true") : PSTR("false")); break; + case TMC_OTPW: serialprint_truefalse(st.otpw()); break; #if ENABLED(MONITOR_DRIVER_STATUS) - case TMC_OTPW_TRIGGERED: serialprintPGM(st.getOTPW() ? PSTR("true") : PSTR("false")); break; + case TMC_OTPW_TRIGGERED: serialprint_truefalse(st.getOTPW()); break; #endif case TMC_TOFF: SERIAL_PRINT(st.toff(), DEC); break; case TMC_TBL: SERIAL_PRINT(st.blank_time(), DEC); break; @@ -596,7 +596,7 @@ SERIAL_CHAR('\t'); switch (i) { case TMC_CODES: st.printLabel(); break; - case TMC_ENABLED: serialprintPGM(st.isEnabled() ? PSTR("true") : PSTR("false")); break; + case TMC_ENABLED: serialprint_truefalse(st.isEnabled()); break; case TMC_CURRENT: SERIAL_ECHO(st.getMilliamps()); break; case TMC_RMS_CURRENT: SERIAL_ECHO(st.rms_current()); break; case TMC_MAX_CURRENT: SERIAL_PRINT((float)st.rms_current() * 1.41, 0); break; @@ -606,8 +606,8 @@ break; case TMC_VSENSE: serialprintPGM(st.vsense() ? PSTR("1=.165") : PSTR("0=.310")); break; case TMC_MICROSTEPS: SERIAL_ECHO(st.microsteps()); break; - //case TMC_OTPW: serialprintPGM(st.otpw() ? PSTR("true") : PSTR("false")); break; - //case TMC_OTPW_TRIGGERED: serialprintPGM(st.getOTPW() ? PSTR("true") : PSTR("false")); break; + //case TMC_OTPW: serialprint_truefalse(st.otpw()); break; + //case TMC_OTPW_TRIGGERED: serialprint_truefalse(st.getOTPW()); break; case TMC_SGT: SERIAL_PRINT(st.sgt(), DEC); break; case TMC_TOFF: SERIAL_PRINT(st.toff(), DEC); break; case TMC_TBL: SERIAL_PRINT(st.blank_time(), DEC); break; diff --git a/Marlin/src/feature/tmc_util.h b/Marlin/src/feature/tmc_util.h index 81ef2e06a5..132efbb79e 100644 --- a/Marlin/src/feature/tmc_util.h +++ b/Marlin/src/feature/tmc_util.h @@ -227,7 +227,7 @@ void tmc_set_current(TMC &st, const int mA) { void tmc_report_otpw(TMC &st) { st.printLabel(); SERIAL_ECHOPGM(" temperature prewarn triggered: "); - serialprintPGM(st.getOTPW() ? PSTR("true") : PSTR("false")); + serialprint_truefalse(st.getOTPW()); SERIAL_EOL(); } template diff --git a/Marlin/src/gcode/bedlevel/G26.cpp b/Marlin/src/gcode/bedlevel/G26.cpp index 60979aad00..cdc2b7478e 100644 --- a/Marlin/src/gcode/bedlevel/G26.cpp +++ b/Marlin/src/gcode/bedlevel/G26.cpp @@ -246,8 +246,6 @@ void move_to(const float &rx, const float &ry, const float &z, const float &e_de // Yes: a 'normal' movement. No: a retract() or recover() feed_value = has_xy_component ? G26_XY_FEEDRATE : planner.settings.max_feedrate_mm_s[E_AXIS] / 1.5; - if (g26_debug_flag) SERIAL_ECHOLNPAIR("in move_to() feed_value for XY:", feed_value); - destination[X_AXIS] = rx; destination[Y_AXIS] = ry; destination[E_AXIS] += e_delta; @@ -327,19 +325,15 @@ inline bool look_for_lines_to_connect() { for (uint8_t j = 0; j < GRID_MAX_POINTS_Y; j++) { #if HAS_LCD_MENU - if (user_canceled()) return true; // Check if the user wants to stop the Mesh Validation + if (user_canceled()) return true; #endif - if (i < GRID_MAX_POINTS_X) { // We can't connect to anything to the right than GRID_MAX_POINTS_X. - // This is already a half circle because we are at the edge of the bed. + if (i < GRID_MAX_POINTS_X) { // Can't connect to anything to the right than GRID_MAX_POINTS_X. + // Already a half circle at the edge of the bed. if (is_bitmap_set(circle_flags, i, j) && is_bitmap_set(circle_flags, i + 1, j)) { // check if we can do a line to the left if (!is_bitmap_set(horizontal_mesh_line_flags, i, j)) { - - // - // We found two circles that need a horizontal line to connect them - // Print it! - // + // Two circles need a horizontal line to connect them sx = _GET_MESH_X( i ) + (INTERSECTION_CIRCLE_RADIUS - (CROSSHAIRS_SIZE)); // right edge ex = _GET_MESH_X(i + 1) - (INTERSECTION_CIRCLE_RADIUS - (CROSSHAIRS_SIZE)); // left edge @@ -347,27 +341,19 @@ inline bool look_for_lines_to_connect() { sy = ey = constrain(_GET_MESH_Y(j), Y_MIN_POS + 1, Y_MAX_POS - 1); ex = constrain(ex, X_MIN_POS + 1, X_MAX_POS - 1); - if (position_is_reachable(sx, sy) && position_is_reachable(ex, ey)) { - - if (g26_debug_flag) { - SERIAL_ECHOLNPAIR(" Connecting with horizontal line (sx=", sx, ", sy=", sy, ") -> (ex=", ex, ", ey=", ey, ")"); - //debug_current_and_destination(PSTR("Connecting horizontal line.")); - } + if (position_is_reachable(sx, sy) && position_is_reachable(ex, ey)) print_line_from_here_to_there(sx, sy, g26_layer_height, ex, ey, g26_layer_height); - } - bitmap_set(horizontal_mesh_line_flags, i, j); // Mark it as done so we don't do it again, even if we skipped it + + bitmap_set(horizontal_mesh_line_flags, i, j); // Mark done, even if skipped } } - if (j < GRID_MAX_POINTS_Y) { // We can't connect to anything further back than GRID_MAX_POINTS_Y. - // This is already a half circle because we are at the edge of the bed. + if (j < GRID_MAX_POINTS_Y) { // Can't connect to anything further back than GRID_MAX_POINTS_Y. + // Already a half circle at the edge of the bed. if (is_bitmap_set(circle_flags, i, j) && is_bitmap_set(circle_flags, i, j + 1)) { // check if we can do a line straight down if (!is_bitmap_set( vertical_mesh_line_flags, i, j)) { - // - // We found two circles that need a vertical line to connect them - // Print it! - // + // Two circles that need a vertical line to connect them sy = _GET_MESH_Y( j ) + (INTERSECTION_CIRCLE_RADIUS - (CROSSHAIRS_SIZE)); // top edge ey = _GET_MESH_Y(j + 1) - (INTERSECTION_CIRCLE_RADIUS - (CROSSHAIRS_SIZE)); // bottom edge @@ -375,23 +361,10 @@ inline bool look_for_lines_to_connect() { sy = constrain(sy, Y_MIN_POS + 1, Y_MAX_POS - 1); ey = constrain(ey, Y_MIN_POS + 1, Y_MAX_POS - 1); - if (position_is_reachable(sx, sy) && position_is_reachable(ex, ey)) { - - if (g26_debug_flag) { - SERIAL_ECHOPAIR(" Connecting with vertical line (sx=", sx); - SERIAL_ECHOPAIR(", sy=", sy); - SERIAL_ECHOPAIR(") -> (ex=", ex); - SERIAL_ECHOPAIR(", ey=", ey); - SERIAL_CHAR(')'); - SERIAL_EOL(); - - #if ENABLED(AUTO_BED_LEVELING_UBL) - debug_current_and_destination(PSTR("Connecting vertical line.")); - #endif - } + if (position_is_reachable(sx, sy) && position_is_reachable(ex, ey)) print_line_from_here_to_there(sx, sy, g26_layer_height, ex, ey, g26_layer_height); - } - bitmap_set(vertical_mesh_line_flags, i, j); // Mark it as done so we don't do it again, even if skipped + + bitmap_set(vertical_mesh_line_flags, i, j); // Mark done, even if skipped } } } @@ -725,8 +698,6 @@ void GcodeSuite::G26() { ui.capture(); #endif - //debug_current_and_destination(PSTR("Starting G26 Mesh Validation Pattern.")); - #if DISABLED(ARC_SUPPORT) /** @@ -819,18 +790,6 @@ void GcodeSuite::G26() { const float save_feedrate = feedrate_mm_s; feedrate_mm_s = PLANNER_XY_FEEDRATE() / 10.0; - if (g26_debug_flag) { - SERIAL_ECHOPAIR(" plan_arc(ex=", endpoint[X_AXIS]); - SERIAL_ECHOPAIR(", ey=", endpoint[Y_AXIS]); - SERIAL_ECHOPAIR(", ez=", endpoint[Z_AXIS]); - SERIAL_ECHOPAIR(", len=", arc_length); - SERIAL_ECHOPAIR(") -> (ex=", current_position[X_AXIS]); - SERIAL_ECHOPAIR(", ey=", current_position[Y_AXIS]); - SERIAL_ECHOPAIR(", ez=", current_position[Z_AXIS]); - SERIAL_CHAR(')'); - SERIAL_EOL(); - } - plan_arc(endpoint, arc_offset, false); // Draw a counter-clockwise arc feedrate_mm_s = save_feedrate; set_destination_from_current(); @@ -898,16 +857,13 @@ void GcodeSuite::G26() { retract_filament(destination); destination[Z_AXIS] = Z_CLEARANCE_BETWEEN_PROBES; - //debug_current_and_destination(PSTR("ready to do Z-Raise.")); move_to(destination, 0); // Raise the nozzle - //debug_current_and_destination(PSTR("done doing Z-Raise.")); destination[X_AXIS] = g26_x_pos; // Move back to the starting position destination[Y_AXIS] = g26_y_pos; //destination[Z_AXIS] = Z_CLEARANCE_BETWEEN_PROBES; // Keep the nozzle where it is move_to(destination, 0); // Move back to the starting position - //debug_current_and_destination(PSTR("done doing X/Y move.")); #if DISABLED(NO_VOLUMETRICS) parser.volumetric_enabled = volumetric_was_enabled; diff --git a/Marlin/src/gcode/calibrate/G28.cpp b/Marlin/src/gcode/calibrate/G28.cpp index 02c6e8a37d..1a6922cfa4 100644 --- a/Marlin/src/gcode/calibrate/G28.cpp +++ b/Marlin/src/gcode/calibrate/G28.cpp @@ -406,14 +406,13 @@ void GcodeSuite::G28(const bool always_home_all) { #ifdef HOMING_BACKOFF_MM endstops.enable(false); - constexpr float backoff[XYZ] = HOMING_BACKOFF_MM; + constexpr float endstop_backoff[XYZ] = HOMING_BACKOFF_MM; const float backoff_x = doX ? ABS(endstop_backoff[X_AXIS]) * (X_HOME_DIR) : 0, backoff_y = doY ? ABS(endstop_backoff[Y_AXIS]) * (Y_HOME_DIR) : 0, backoff_z = doZ ? ABS(endstop_backoff[Z_AXIS]) * (Z_HOME_DIR) : 0; if (backoff_z) do_blocking_move_to_z(current_position[Z_AXIS] - backoff_z); if (backoff_x || backoff_y) do_blocking_move_to_xy(current_position[X_AXIS] - backoff_x, current_position[Y_AXIS] - backoff_y); #endif - endstops.not_homing(); #if BOTH(DELTA, DELTA_HOME_TO_SAFE_ZONE) @@ -429,7 +428,7 @@ void GcodeSuite::G28(const bool always_home_all) { // Restore the active tool after homing #if HOTENDS > 1 && (DISABLED(DELTA) || ENABLED(DELTA_HOME_TO_SAFE_ZONE)) - #if ENABLED(PARKING_EXTRUDER) || ENABLED(DUAL_X_CARRIAGE) + #if EITHER(PARKING_EXTRUDER, DUAL_X_CARRIAGE) #define NO_FETCH false // fetch the previous toolhead #else #define NO_FETCH true diff --git a/Marlin/src/gcode/config/M217.cpp b/Marlin/src/gcode/config/M217.cpp index 31271ba2ca..89ae9b6eeb 100644 --- a/Marlin/src/gcode/config/M217.cpp +++ b/Marlin/src/gcode/config/M217.cpp @@ -30,7 +30,7 @@ void M217_report(const bool eeprom=false) { #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) - serialprintPGM(eeprom ? PSTR(" M217") : PSTR("Singlenozzle:")); + serialprintPGM(eeprom ? PSTR(" M217") : PSTR("Toolchange:")); SERIAL_ECHOPAIR(" S", LINEAR_UNIT(toolchange_settings.swap_length)); SERIAL_ECHOPAIR(" P", LINEAR_UNIT(toolchange_settings.prime_speed)); SERIAL_ECHOPAIR(" R", LINEAR_UNIT(toolchange_settings.retract_speed)); diff --git a/Marlin/src/gcode/config/M43.cpp b/Marlin/src/gcode/config/M43.cpp index 5965f48b77..e1445eaf6d 100644 --- a/Marlin/src/gcode/config/M43.cpp +++ b/Marlin/src/gcode/config/M43.cpp @@ -47,13 +47,13 @@ inline void toggle_pins() { for (uint8_t i = start; i <= end; i++) { pin_t pin = GET_PIN_MAP_PIN(i); - //report_pin_state_extended(pin, ignore_protection, false); if (!VALID_PIN(pin)) continue; - if (!ignore_protection && pin_is_protected(pin)) { + if (M43_NEVER_TOUCH(i) || (!ignore_protection && pin_is_protected(pin))) { report_pin_state_extended(pin, ignore_protection, true, "Untouched "); SERIAL_EOL(); } else { + watchdog_reset(); report_pin_state_extended(pin, ignore_protection, true, "Pulsing "); #if AVR_AT90USB1286_FAMILY // Teensy IDEs don't know about these pins so must use FASTIO if (pin == TEENSY_E2) { @@ -77,12 +77,12 @@ inline void toggle_pins() { { pinMode(pin, OUTPUT); for (int16_t j = 0; j < repeat; j++) { - extDigitalWrite(pin, 0); safe_delay(wait); - extDigitalWrite(pin, 1); safe_delay(wait); - extDigitalWrite(pin, 0); safe_delay(wait); + watchdog_reset(); extDigitalWrite(pin, 0); safe_delay(wait); + watchdog_reset(); extDigitalWrite(pin, 1); safe_delay(wait); + watchdog_reset(); extDigitalWrite(pin, 0); safe_delay(wait); + watchdog_reset(); } } - } SERIAL_EOL(); } @@ -277,7 +277,7 @@ void GcodeSuite::M43() { for (uint8_t i = first_pin; i <= last_pin; i++) { pin_t pin = GET_PIN_MAP_PIN(i); if (!VALID_PIN(pin)) continue; - if (!ignore_protection && pin_is_protected(pin)) continue; + if (M43_NEVER_TOUCH(i) || (!ignore_protection && pin_is_protected(pin))) continue; pinMode(pin, INPUT_PULLUP); delay(1); /* @@ -300,7 +300,7 @@ void GcodeSuite::M43() { for (uint8_t i = first_pin; i <= last_pin; i++) { pin_t pin = GET_PIN_MAP_PIN(i); if (!VALID_PIN(pin)) continue; - if (!ignore_protection && pin_is_protected(pin)) continue; + if (M43_NEVER_TOUCH(i) || (!ignore_protection && pin_is_protected(pin))) continue; const byte val = /* IS_ANALOG(pin) diff --git a/Marlin/src/gcode/control/M3-M5.cpp b/Marlin/src/gcode/control/M3-M5.cpp index 39405e1cbe..8612e0c03f 100644 --- a/Marlin/src/gcode/control/M3-M5.cpp +++ b/Marlin/src/gcode/control/M3-M5.cpp @@ -53,7 +53,7 @@ uint8_t spindle_laser_power; // = 0 * NOTE: A minimum PWM frequency of 50 Hz is needed. All prescaler * factors for timers 2, 3, 4, and 5 are acceptable. * - * SPINDLE_LASER_ENABLE_PIN needs an external pullup or it may power on + * SPINDLE_LASER_ENA_PIN needs an external pullup or it may power on * the spindle/laser during power-up or when connecting to the host * (usually goes through a reset which sets all I/O pins to tri-state) * @@ -73,7 +73,7 @@ inline void delay_for_power_down() { safe_delay(SPINDLE_LASER_POWERDOWN_DELAY); */ inline void set_spindle_laser_ocr(const uint8_t ocr) { - WRITE(SPINDLE_LASER_ENABLE_PIN, SPINDLE_LASER_ENABLE_INVERT); // turn spindle on (active low) + WRITE(SPINDLE_LASER_ENA_PIN, SPINDLE_LASER_ENABLE_INVERT); // turn spindle on (active low) analogWrite(SPINDLE_LASER_PWM_PIN, (SPINDLE_LASER_PWM_INVERT) ? 255 - ocr : ocr); } @@ -81,7 +81,7 @@ inline void set_spindle_laser_ocr(const uint8_t ocr) { void update_spindle_laser_power() { if (spindle_laser_power == 0) { - WRITE(SPINDLE_LASER_ENABLE_PIN, !SPINDLE_LASER_ENABLE_INVERT); // turn spindle off (active low) + WRITE(SPINDLE_LASER_ENA_PIN, !SPINDLE_LASER_ENABLE_INVERT); // turn spindle off (active low) analogWrite(SPINDLE_LASER_PWM_PIN, SPINDLE_LASER_PWM_INVERT ? 255 : 0); // only write low byte delay_for_power_down(); } @@ -101,7 +101,7 @@ inline void set_spindle_laser_ocr(const uint8_t ocr) { #endif // SPINDLE_LASER_PWM bool spindle_laser_enabled() { - return !!spindle_laser_power; // READ(SPINDLE_LASER_ENABLE_PIN) == SPINDLE_LASER_ENABLE_INVERT; + return !!spindle_laser_power; // READ(SPINDLE_LASER_ENA_PIN) == SPINDLE_LASER_ENABLE_INVERT; } void set_spindle_laser_enabled(const bool enable) { @@ -111,11 +111,11 @@ void set_spindle_laser_enabled(const bool enable) { update_spindle_laser_power(); #else if (enable) { - WRITE(SPINDLE_LASER_ENABLE_PIN, SPINDLE_LASER_ENABLE_INVERT); + WRITE(SPINDLE_LASER_ENA_PIN, SPINDLE_LASER_ENABLE_INVERT); delay_for_power_up(); } else { - WRITE(SPINDLE_LASER_ENABLE_PIN, !SPINDLE_LASER_ENABLE_INVERT); + WRITE(SPINDLE_LASER_ENA_PIN, !SPINDLE_LASER_ENABLE_INVERT); delay_for_power_down(); } #endif diff --git a/Marlin/src/gcode/control/M605.cpp b/Marlin/src/gcode/control/M605.cpp index 5894e66da7..f1f64f0ce3 100644 --- a/Marlin/src/gcode/control/M605.cpp +++ b/Marlin/src/gcode/control/M605.cpp @@ -42,10 +42,10 @@ * * M605 S0 : (FULL_CONTROL) The slicer has full control over both X-carriages and can achieve optimal travel * results as long as it supports dual X-carriages. - * + * * M605 S1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so that * additional slicer support is not required. - * + * * M605 S2 X R : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with * the first X-carriage and extruder, to print 2 copies of the same object at the same time. * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and diff --git a/Marlin/src/gcode/control/T.cpp b/Marlin/src/gcode/control/T.cpp index bcb180a968..fb8f09eeeb 100644 --- a/Marlin/src/gcode/control/T.cpp +++ b/Marlin/src/gcode/control/T.cpp @@ -55,7 +55,7 @@ void GcodeSuite::T(const uint8_t tool_index) { #if ENABLED(PRUSA_MMU2) if (parser.string_arg) { - mmu2.toolChange(parser.string_arg); // Special commands T?/Tx/Tc + mmu2.tool_change(parser.string_arg); // Special commands T?/Tx/Tc return; } #endif diff --git a/Marlin/src/gcode/feature/pause/M701_M702.cpp b/Marlin/src/gcode/feature/pause/M701_M702.cpp index 08c0b6a5d4..a09d8aa710 100644 --- a/Marlin/src/gcode/feature/pause/M701_M702.cpp +++ b/Marlin/src/gcode/feature/pause/M701_M702.cpp @@ -84,7 +84,7 @@ void GcodeSuite::M701() { // Load filament #if ENABLED(PRUSA_MMU2) - mmu2.loadFilamentToNozzle(target_extruder); + mmu2.load_filament_to_nozzle(target_extruder); #else constexpr float slow_load_length = FILAMENT_CHANGE_SLOW_LOAD_LENGTH; const float fast_load_length = ABS(parser.seen('L') ? parser.value_axis_units(E_AXIS) diff --git a/Marlin/src/gcode/feature/powerloss/M1000.cpp b/Marlin/src/gcode/feature/powerloss/M1000.cpp index 06a3196869..dfa55fc759 100644 --- a/Marlin/src/gcode/feature/powerloss/M1000.cpp +++ b/Marlin/src/gcode/feature/powerloss/M1000.cpp @@ -29,17 +29,20 @@ #include "../../../module/motion.h" #include "../../../lcd/ultralcd.h" +#define DEBUG_OUT ENABLED(DEBUG_POWER_LOSS_RECOVERY) +#include "../../../core/debug_out.h" + void menu_job_recovery(); -#if ENABLED(DEBUG_POWER_LOSS_RECOVERY) - - inline void plr_error(PGM_P const prefix) { - SERIAL_ECHO_START(); +inline void plr_error(PGM_P const prefix) { + #if ENABLED(DEBUG_POWER_LOSS_RECOVERY) + DEBUG_ECHO_START(); serialprintPGM(prefix); - SERIAL_ECHOLNPGM(" Power-Loss Recovery Data"); - } - -#endif + DEBUG_ECHOLNPGM(" Power-Loss Recovery Data"); + #else + UNUSED(prefix); + #endif +} /** * M1000: Resume from power-loss (undocumented) @@ -54,11 +57,8 @@ void GcodeSuite::M1000() { else recovery.resume(); } - else { - #if ENABLED(DEBUG_POWER_LOSS_RECOVERY) - plr_error(recovery.info.valid_head ? PSTR("No") : PSTR("Invalid")); - #endif - } + else + plr_error(recovery.info.valid_head ? PSTR("No") : PSTR("Invalid")); } diff --git a/Marlin/src/gcode/feature/prusa_MMU2/M403.cpp b/Marlin/src/gcode/feature/prusa_MMU2/M403.cpp index d362bd3e00..c186c1ff2f 100644 --- a/Marlin/src/gcode/feature/prusa_MMU2/M403.cpp +++ b/Marlin/src/gcode/feature/prusa_MMU2/M403.cpp @@ -41,7 +41,7 @@ void GcodeSuite::M403() { type = parser.intval('F', -1); if (WITHIN(index, 0, 4) && WITHIN(type, 0, 2)) - mmu2.setFilamentType(index, type); + mmu2.set_filament_type(index, type); else SERIAL_ECHO_MSG("M403 - bad arguments."); } diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index c8d8131770..546898433a 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -269,6 +269,16 @@ void GcodeSuite::process_parsed_command( break; #endif + #if ENABLED(CNC_COORDINATE_SYSTEMS) + case 53: G53(); break; + case 54: G54(); break; + case 55: G55(); break; + case 56: G56(); break; + case 57: G57(); break; + case 58: G58(); break; + case 59: G59(); break; + #endif + #if ENABLED(GCODE_MOTION_MODES) case 80: G80(); break; // G80: Reset the current motion mode #endif @@ -348,10 +358,6 @@ void GcodeSuite::process_parsed_command( case 48: M48(); break; // M48: Z probe repeatability test #endif - #if ENABLED(G26_MESH_VALIDATION) - case 49: M49(); break; // M49: Turn on or off G26 debug flag for verbose output - #endif - #if ENABLED(LCD_SET_PROGRESS_MANUALLY) case 73: M73(); break; // M73: Set progress percentage (for display on LCD) #endif diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h index dcd015c2bb..af99e4fbed 100644 --- a/Marlin/src/gcode/gcode.h +++ b/Marlin/src/gcode/gcode.h @@ -495,10 +495,6 @@ private: static void M48(); #endif - #if ENABLED(G26_MESH_VALIDATION) - static void M49(); - #endif - #if ENABLED(LCD_SET_PROGRESS_MANUALLY) static void M73(); #endif diff --git a/Marlin/src/gcode/geometry/G53-G59.cpp b/Marlin/src/gcode/geometry/G53-G59.cpp index 4d53a885d6..38765f2e1b 100644 --- a/Marlin/src/gcode/geometry/G53-G59.cpp +++ b/Marlin/src/gcode/geometry/G53-G59.cpp @@ -59,7 +59,7 @@ bool GcodeSuite::select_coordinate_system(const int8_t _new) { * * Marlin also uses G53 on a line by itself to go back to native space. */ -inline void GcodeSuite::G53() { +void GcodeSuite::G53() { const int8_t _system = active_coordinate_system; active_coordinate_system = -1; if (parser.chain()) { // If this command has more following... diff --git a/Marlin/src/gcode/motion/M290.cpp b/Marlin/src/gcode/motion/M290.cpp index e1222688e6..4dd1fc4475 100644 --- a/Marlin/src/gcode/motion/M290.cpp +++ b/Marlin/src/gcode/motion/M290.cpp @@ -25,6 +25,7 @@ #if ENABLED(BABYSTEPPING) #include "../gcode.h" +#include "../../feature/babystep.h" #include "../../module/probe.h" #include "../../module/temperature.h" #include "../../module/planner.h" @@ -49,7 +50,7 @@ else { hotend_offset[Z_AXIS][active_extruder] -= offs; SERIAL_ECHO_START(); - SERIAL_ECHOLNPAIR(MSG_IDEX_Z_OFFSET ": ", hotend_offset[Z_AXIS][active_extruder]); + SERIAL_ECHOLNPAIR(MSG_Z_OFFSET ": ", hotend_offset[Z_AXIS][active_extruder]); } #endif } @@ -64,7 +65,7 @@ void GcodeSuite::M290() { for (uint8_t a = X_AXIS; a <= Z_AXIS; a++) if (parser.seenval(axis_codes[a]) || (a == Z_AXIS && parser.seenval('S'))) { const float offs = constrain(parser.value_axis_units((AxisEnum)a), -2, 2); - thermalManager.babystep_axis((AxisEnum)a, offs * planner.settings.axis_steps_per_mm[a]); + babystep.add_mm((AxisEnum)a, offs); #if ENABLED(BABYSTEP_ZPROBE_OFFSET) if (a == Z_AXIS && (!parser.seen('P') || parser.value_bool())) mod_zprobe_zoffset(offs); #endif @@ -72,7 +73,7 @@ void GcodeSuite::M290() { #else if (parser.seenval('Z') || parser.seenval('S')) { const float offs = constrain(parser.value_axis_units(Z_AXIS), -2, 2); - thermalManager.babystep_axis(Z_AXIS, offs * planner.settings.axis_steps_per_mm[Z_AXIS]); + babystep.add_mm(Z_AXIS, offs); #if ENABLED(BABYSTEP_ZPROBE_OFFSET) if (!parser.seen('P') || parser.value_bool()) mod_zprobe_zoffset(offs); #endif diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index 5054b622dc..8581f2dd19 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -87,8 +87,8 @@ #define U8GLIB_LM6059_AF #define SD_DETECT_INVERTED #elif ENABLED(AZSMZ_12864) - #define LCD_CONTRAST_MIN 120 - #define LCD_CONTRAST_MAX 255 + #define LCD_CONTRAST_MIN 120 + #define LCD_CONTRAST_MAX 255 #define DEFAULT_LCD_CONTRAST 190 #define U8GLIB_ST7565_64128N #endif @@ -139,6 +139,13 @@ #define MINIPANEL +#elif ENABLED(FYSETC_MINI_12864) + + #define DOGLCD + #define ULTIPANEL + #define DEFAULT_LCD_CONTRAST 255 + #define LED_COLORS_REDUCE_GREEN + #endif #if EITHER(MAKRPANEL, MINIPANEL) @@ -313,28 +320,19 @@ #define HAS_ADC_BUTTONS ENABLED(ADC_KEYPAD) -#if HAS_GRAPHICAL_LCD - /** - * Default LCD contrast for Graphical LCD displays - */ - #define HAS_LCD_CONTRAST ( \ - ENABLED(MAKRPANEL) \ - || ENABLED(CARTESIO_UI) \ - || ENABLED(VIKI2) \ - || ENABLED(AZSMZ_12864) \ - || ENABLED(miniVIKI) \ - || ENABLED(ELB_FULL_GRAPHIC_CONTROLLER) \ - ) - #if HAS_LCD_CONTRAST - #ifndef LCD_CONTRAST_MIN - #define LCD_CONTRAST_MIN 0 - #endif - #ifndef LCD_CONTRAST_MAX - #define LCD_CONTRAST_MAX 63 - #endif - #ifndef DEFAULT_LCD_CONTRAST - #define DEFAULT_LCD_CONTRAST 32 - #endif +/** + * Default LCD contrast for Graphical LCD displays + */ +#define HAS_LCD_CONTRAST HAS_GRAPHICAL_LCD && defined(DEFAULT_LCD_CONTRAST) +#if HAS_LCD_CONTRAST + #ifndef LCD_CONTRAST_MIN + #define LCD_CONTRAST_MIN 0 + #endif + #ifndef LCD_CONTRAST_MAX + #define LCD_CONTRAST_MAX 63 + #endif + #ifndef DEFAULT_LCD_CONTRAST + #define DEFAULT_LCD_CONTRAST 32 #endif #endif @@ -427,7 +425,7 @@ */ #if ENABLED(DISTINCT_E_FACTORS) && E_STEPPERS > 1 #define XYZE_N (XYZ + E_STEPPERS) - #define E_AXIS_N(E) (E_AXIS + E) + #define E_AXIS_N(E) AxisEnum(E_AXIS + E) #else #undef DISTINCT_E_FACTORS #define XYZE_N XYZE @@ -558,3 +556,7 @@ #endif #endif #endif + +#if ENABLED(SLIM_LCD_MENUS) + #define BOOT_MARLIN_LOGO_SMALL +#endif diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index d82f238097..b1e53c608a 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -873,9 +873,6 @@ #define TMC_HAS_SPI (HAS_TMCX1X0 || HAS_DRIVER(TMC2660)) #define HAS_STALLGUARD (HAS_TMCX1X0 || HAS_DRIVER(TMC2660)) #define HAS_STEALTHCHOP (HAS_TMCX1X0 || HAS_DRIVER(TMC2208)) - #define AXIS_HAS_SPI(ST) (AXIS_DRIVER_TYPE(ST, TMC2130) || AXIS_DRIVER_TYPE(ST, TMC2160) || AXIS_DRIVER_TYPE(ST, TMC2660)) - #define AXIS_HAS_STALLGUARD(ST) (AXIS_DRIVER_TYPE(ST, TMC2130) || AXIS_DRIVER_TYPE(ST, TMC2160) || AXIS_DRIVER_TYPE(ST, TMC2660) || AXIS_DRIVER_TYPE(ST, TMC5130) || AXIS_DRIVER_TYPE(ST, TMC5160)) - #define AXIS_HAS_STEALTHCHOP(ST) (AXIS_DRIVER_TYPE(ST, TMC2130) || AXIS_DRIVER_TYPE(ST, TMC2160) || AXIS_DRIVER_TYPE(ST, TMC2208) || AXIS_DRIVER_TYPE(ST, TMC5130) || AXIS_DRIVER_TYPE(ST, TMC5160)) #define STEALTHCHOP_ENABLED ANY(STEALTHCHOP_XY, STEALTHCHOP_Z, STEALTHCHOP_E) #define USE_SENSORLESS EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) @@ -1679,7 +1676,7 @@ // Get LCD character width/height, which may be overridden by pins, configs, etc. #ifndef LCD_WIDTH #if HAS_GRAPHICAL_LCD - #define LCD_WIDTH 22 + #define LCD_WIDTH 21 #elif ENABLED(ULTIPANEL) #define LCD_WIDTH 20 #elif HAS_SPI_LCD diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 11de3fa178..a927900557 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -341,6 +341,8 @@ #error "MAX6675_SS is now MAX6675_SS_PIN. Please update your configuration and/or pins." #elif defined(MAX6675_SS2) #error "MAX6675_SS2 is now MAX6675_SS2_PIN. Please update your configuration and/or pins." +#elif defined(SPINDLE_LASER_ENABLE_PIN) + #error "SPINDLE_LASER_ENABLE_PIN is now SPINDLE_LASER_ENA_PIN. Please update your configuration and/or pins." #elif defined(TMC_Z_CALIBRATION) #error "TMC_Z_CALIBRATION has been deprecated in favor of Z_STEPPER_AUTO_ALIGN. Please update your configuration." #elif defined(Z_MIN_PROBE_ENDSTOP) @@ -1762,6 +1764,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS + ENABLED(G3D_PANEL) \ + (ENABLED(MINIPANEL) && DISABLED(MKS_MINI_12864)) \ + ENABLED(MKS_MINI_12864) \ + + ENABLED(FYSETC_MINI_12864) \ + (ENABLED(REPRAPWORLD_KEYPAD) && DISABLED(CARTESIO_UI, ZONESTAR_LCD)) \ + ENABLED(RIGIDBOT_PANEL) \ + ENABLED(RA_CONTROL_PANEL) \ diff --git a/Marlin/src/lcd/HD44780/ultralcd_HD44780.cpp b/Marlin/src/lcd/HD44780/ultralcd_HD44780.cpp index 56127b5464..c493b371c2 100644 --- a/Marlin/src/lcd/HD44780/ultralcd_HD44780.cpp +++ b/Marlin/src/lcd/HD44780/ultralcd_HD44780.cpp @@ -1025,7 +1025,7 @@ void MarlinUI::draw_status_screen() { } void draw_edit_screen(PGM_P const pstr, const char* const value/*=NULL*/) { - lcd_moveto(1, 1); + lcd_moveto(0, 1); lcd_put_u8str_P(pstr); if (value != NULL) { lcd_put_wchar(':'); @@ -1037,6 +1037,16 @@ void MarlinUI::draw_status_screen() { } } + void draw_select_screen(PGM_P const yes, PGM_P const no, const bool yesno, PGM_P const pref, const char * const string, PGM_P const suff) { + SETCURSOR(0, 0); lcd_put_u8str_P(pref); + if (string) wrap_string(1, string); + if (suff) lcd_put_u8str_P(suff); + SETCURSOR(0, LCD_HEIGHT - 1); + lcd_put_wchar(yesno ? ' ' : '['); lcd_put_u8str_P(no); lcd_put_wchar(yesno ? ' ' : ']'); + SETCURSOR_RJ(utf8_strlen_P(yes) + 2, LCD_HEIGHT - 1); + lcd_put_wchar(yesno ? '[' : ' '); lcd_put_u8str_P(yes); lcd_put_wchar(yesno ? ']' : ' '); + } + #if ENABLED(SDSUPPORT) void draw_sd_menu_item(const bool sel, const uint8_t row, PGM_P const pstr, CardReader &theCard, const bool isDir) { diff --git a/Marlin/src/lcd/dogm/dogm_Bootscreen.h b/Marlin/src/lcd/dogm/dogm_Bootscreen.h index 7361ca0d46..aafe6dfbfd 100644 --- a/Marlin/src/lcd/dogm/dogm_Bootscreen.h +++ b/Marlin/src/lcd/dogm/dogm_Bootscreen.h @@ -29,8 +29,6 @@ #include "../../inc/MarlinConfig.h" -//#define START_BMPHIGH // Costs 399 bytes more flash - #if ENABLED(SHOW_CUSTOM_BOOTSCREEN) #include "../../../_Bootscreen.h" @@ -44,7 +42,33 @@ #endif -#if ENABLED(START_BMPHIGH) +#if ENABLED(BOOT_MARLIN_LOGO_SMALL) + + #define START_BMPWIDTH 56 + + const unsigned char start_bmp[] PROGMEM = { + B00011111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111, + B01100000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111111, + B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111, + B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111111, + B10000011,B11001111,B00000000,B00000000,B00001100,B00110000,B00111111, + B10000111,B11111111,B10000000,B00000000,B00001100,B00110000,B00011111, + B10000110,B01111001,B10000000,B00000000,B00001100,B00000000,B00001111, + B10001100,B00110000,B11000111,B10000011,B10001100,B00110000,B11100111, + B10001100,B00110000,B11001111,B11000111,B11001100,B00110001,B11110011, + B10001100,B00110000,B11011100,B11101100,B11101100,B00110011,B10111001, + B10001100,B00110000,B11011000,B01101100,B01101100,B00110011,B00011001, + B10001100,B00110000,B11010000,B01101100,B00001100,B00110011,B00011001, + B10001100,B00110000,B11011000,B01101100,B00001100,B00110011,B00011001, + B10001100,B00110000,B11011100,B01101100,B00001110,B00111011,B00011001, + B10001100,B00110000,B11001111,B01111100,B00000111,B10011111,B00011001, + B10001100,B00110000,B11000111,B01111100,B00000011,B10001111,B00011001, + B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000010, + B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110, + B00011111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111000 + }; + +#else #define START_BMPWIDTH 112 @@ -89,32 +113,6 @@ B00000001,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B10000000 }; -#else - - #define START_BMPWIDTH 56 - - const unsigned char start_bmp[] PROGMEM = { - B00011111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111, - B01100000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111111, - B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111, - B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111111, - B10000011,B11001111,B00000000,B00000000,B00001100,B00110000,B00111111, - B10000111,B11111111,B10000000,B00000000,B00001100,B00110000,B00011111, - B10000110,B01111001,B10000000,B00000000,B00001100,B00000000,B00001111, - B10001100,B00110000,B11000111,B10000011,B10001100,B00110000,B11100111, - B10001100,B00110000,B11001111,B11000111,B11001100,B00110001,B11110011, - B10001100,B00110000,B11011100,B11101100,B11101100,B00110011,B10111001, - B10001100,B00110000,B11011000,B01101100,B01101100,B00110011,B00011001, - B10001100,B00110000,B11010000,B01101100,B00001100,B00110011,B00011001, - B10001100,B00110000,B11011000,B01101100,B00001100,B00110011,B00011001, - B10001100,B00110000,B11011100,B01101100,B00001110,B00111011,B00011001, - B10001100,B00110000,B11001111,B01111100,B00000111,B10011111,B00011001, - B10001100,B00110000,B11000111,B01111100,B00000011,B10001111,B00011001, - B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000010, - B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110, - B00011111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111000 - }; - #endif #ifndef START_BMP_BYTEWIDTH diff --git a/Marlin/src/lcd/dogm/u8g_fontutf8.cpp b/Marlin/src/lcd/dogm/u8g_fontutf8.cpp index 890cd4217c..115919954f 100644 --- a/Marlin/src/lcd/dogm/u8g_fontutf8.cpp +++ b/Marlin/src/lcd/dogm/u8g_fontutf8.cpp @@ -97,7 +97,7 @@ static void fontgroup_drawwchar(font_group_t *group, const font_t *fnt_default, * @param utf8_msg : the UTF-8 string * @param cb_read_byte : how to read the utf8_msg, from RAM or ROM (call read_byte_ram or pgm_read_byte) * @param userdata : User's data - * @param cb_draw_ram : the callback function of userdata to draw a !RAM! string (actural it is to draw a one byte string in RAM) + * @param cb_draw_ram : the callback function of userdata to draw a !RAM! string (actually it is to draw a one byte string in RAM) * * @return N/A * diff --git a/Marlin/src/lcd/dogm/ultralcd_DOGM.cpp b/Marlin/src/lcd/dogm/ultralcd_DOGM.cpp index ca953f7b5d..defbfc3bfa 100644 --- a/Marlin/src/lcd/dogm/ultralcd_DOGM.cpp +++ b/Marlin/src/lcd/dogm/ultralcd_DOGM.cpp @@ -154,29 +154,53 @@ void MarlinUI::set_font(const MarlinFont font_nr) { lcd_custom_bootscreen(); #endif - constexpr uint8_t offy = - #if ENABLED(START_BMPHIGH) - (LCD_PIXEL_HEIGHT - (START_BMPHEIGHT)) / 2 - #else - MENU_FONT_HEIGHT - #endif - ; + // Screen dimensions. + //const uint8_t width = u8g.getWidth(), height = u8g.getHeight(); + constexpr uint8_t width = LCD_PIXEL_WIDTH, height = LCD_PIXEL_HEIGHT; - const uint8_t width = u8g.getWidth(), height = u8g.getHeight(), - offx = (width - (START_BMPWIDTH)) / 2; + // Determine text space needed + #ifndef STRING_SPLASH_LINE2 + constexpr uint8_t text_total_height = MENU_FONT_HEIGHT, + text_width_1 = (sizeof(STRING_SPLASH_LINE1) - 1) * (MENU_FONT_WIDTH), + text_width_2 = 0; + #else + constexpr uint8_t text_total_height = (MENU_FONT_HEIGHT) * 2, + text_width_1 = (sizeof(STRING_SPLASH_LINE1) - 1) * (MENU_FONT_WIDTH), + text_width_2 = (sizeof(STRING_SPLASH_LINE2) - 1) * (MENU_FONT_WIDTH); + #endif + constexpr uint8_t text_max_width = MAX(text_width_1, text_width_2), + rspace = width - (START_BMPWIDTH); + + int8_t offx, offy, txt_base, txt_offx_1, txt_offx_2; + + // Can the text fit to the right of the bitmap? + if (text_max_width < rspace) { + constexpr uint8_t inter = (width - text_max_width - (START_BMPWIDTH)) / 3; // Evenly distribute horizontal space + offx = inter; // First the boot logo... + offy = (height - (START_BMPHEIGHT)) / 2; // ...V-aligned in the full height + txt_offx_1 = txt_offx_2 = inter + (START_BMPWIDTH) + inter; // Text right of the bitmap + txt_base = (height + MENU_FONT_ASCENT + text_total_height - (MENU_FONT_HEIGHT)) / 2; // Text vertical center + } + else { + constexpr uint8_t inter = (height - text_total_height - (START_BMPHEIGHT)) / 3; // Evenly distribute vertical space + offy = inter; // V-align boot logo proportionally + offx = rspace / 2; // Center the boot logo in the whole space + txt_offx_1 = (width - text_width_1) / 2; // Text 1 centered + txt_offx_2 = (width - text_width_2) / 2; // Text 2 centered + txt_base = offy + START_BMPHEIGHT + offy + text_total_height - (MENU_FONT_DESCENT); // Even spacing looks best + } + NOLESS(offx, 0); + NOLESS(offy, 0); u8g.firstPage(); do { u8g.drawBitmapP(offx, offy, (START_BMPWIDTH + 7) / 8, START_BMPHEIGHT, start_bmp); set_font(FONT_MENU); #ifndef STRING_SPLASH_LINE2 - const uint8_t txt1X = width - (sizeof(STRING_SPLASH_LINE1) - 1) * (MENU_FONT_WIDTH); - u8g.drawStr(txt1X, (height + MENU_FONT_HEIGHT) / 2, STRING_SPLASH_LINE1); + u8g.drawStr(txt_offx_1, txt_base, STRING_SPLASH_LINE1); #else - const uint8_t txt1X = (width - (sizeof(STRING_SPLASH_LINE1) - 1) * (MENU_FONT_WIDTH)) / 2, - txt2X = (width - (sizeof(STRING_SPLASH_LINE2) - 1) * (MENU_FONT_WIDTH)) / 2; - u8g.drawStr(txt1X, height - (MENU_FONT_HEIGHT) * 3 / 2, STRING_SPLASH_LINE1); - u8g.drawStr(txt2X, height - (MENU_FONT_HEIGHT) * 1 / 2, STRING_SPLASH_LINE2); + u8g.drawStr(txt_offx_1, txt_base - (MENU_FONT_HEIGHT), STRING_SPLASH_LINE1); + u8g.drawStr(txt_offx_2, txt_base, STRING_SPLASH_LINE2); #endif } while (u8g.nextPage()); #ifndef BOOTSCREEN_TIMEOUT @@ -389,7 +413,7 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop if (value != NULL) { lcd_put_wchar(':'); if (extra_row) { - // Assume the value is numeric (with no descender) + // Assume that value is numeric (with no descender) baseline += EDIT_FONT_ASCENT + 2; onpage = PAGE_CONTAINS(baseline - (EDIT_FONT_ASCENT - 1), baseline); } @@ -401,6 +425,27 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop } } + inline void draw_boxed_string(const uint8_t x, const uint8_t y, PGM_P const pstr, const bool inv) { + const uint8_t len = utf8_strlen_P(pstr), bw = len * (MENU_FONT_WIDTH), + bx = x * (MENU_FONT_WIDTH), by = (y + 1) * (MENU_FONT_HEIGHT); + if (inv) { + u8g.setColorIndex(1); + u8g.drawBox(bx - 1, by - (MENU_FONT_ASCENT) + 1, bw + 2, MENU_FONT_HEIGHT - 1); + u8g.setColorIndex(0); + } + lcd_moveto(bx, by); + lcd_put_u8str_P(pstr); + if (inv) u8g.setColorIndex(1); + } + + void draw_select_screen(PGM_P const yes, PGM_P const no, const bool yesno, PGM_P const pref, const char * const string, PGM_P const suff) { + SETCURSOR(0, 0); lcd_put_u8str_P(pref); + if (string) wrap_string(1, string); + if (suff) lcd_put_u8str_P(suff); + draw_boxed_string(1, LCD_HEIGHT - 1, no, !yesno); + draw_boxed_string(LCD_WIDTH - (utf8_strlen_P(yes) + 1), LCD_HEIGHT - 1, yes, yesno); + } + #if ENABLED(SDSUPPORT) void draw_sd_menu_item(const bool sel, const uint8_t row, PGM_P const pstr, CardReader &theCard, const bool isDir) { diff --git a/Marlin/src/lcd/dogm/ultralcd_DOGM.h b/Marlin/src/lcd/dogm/ultralcd_DOGM.h index 6d591c37b0..fe799473f8 100644 --- a/Marlin/src/lcd/dogm/ultralcd_DOGM.h +++ b/Marlin/src/lcd/dogm/ultralcd_DOGM.h @@ -107,7 +107,7 @@ // Generic support for SSD1309 OLED I2C LCDs #define U8G_CLASS U8GLIB_SSD1309_128X64 #define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST) -#elif ENABLED(MINIPANEL) +#elif EITHER(MINIPANEL, FYSETC_MINI_12864) // The MINIPanel display //#define U8G_CLASS U8GLIB_MINI12864 //#define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // 8 stripes diff --git a/Marlin/src/lcd/extensible_ui/ui_api.cpp b/Marlin/src/lcd/extensible_ui/ui_api.cpp index 3965371439..aa71743e12 100644 --- a/Marlin/src/lcd/extensible_ui/ui_api.cpp +++ b/Marlin/src/lcd/extensible_ui/ui_api.cpp @@ -97,6 +97,10 @@ #include "../../feature/runout.h" #endif +#if ENABLED(BABYSTEPPING) + #include "../../feature/babystep.h" +#endif + inline float clamp(const float value, const float minimum, const float maximum) { return MAX(MIN(value, maximum), minimum); } @@ -584,10 +588,10 @@ namespace ExtUI { bool babystepAxis_steps(const int16_t steps, const axis_t axis) { switch (axis) { #if ENABLED(BABYSTEP_XY) - case X: thermalManager.babystep_axis(X_AXIS, steps); break; - case Y: thermalManager.babystep_axis(Y_AXIS, steps); break; + case X: babystep.add_steps(X_AXIS, steps); break; + case Y: babystep.add_steps(Y_AXIS, steps); break; #endif - case Z: thermalManager.babystep_axis(Z_AXIS, steps); break; + case Z: babystep.add_steps(Z_AXIS, steps); break; default: return false; }; return true; diff --git a/Marlin/src/lcd/extensible_ui/ui_api.h b/Marlin/src/lcd/extensible_ui/ui_api.h index fc7a867818..b5be58dcca 100644 --- a/Marlin/src/lcd/extensible_ui/ui_api.h +++ b/Marlin/src/lcd/extensible_ui/ui_api.h @@ -105,7 +105,7 @@ namespace ExtUI { float getFeedrate_percent(); uint8_t getProgress_percent(); uint32_t getProgress_seconds_elapsed(); - + #if HAS_LEVELING bool getLevelingActive(); void setLevelingActive(const bool); diff --git a/Marlin/src/lcd/fontutils.cpp b/Marlin/src/lcd/fontutils.cpp index 5685e6e4c3..4e714d0804 100644 --- a/Marlin/src/lcd/fontutils.cpp +++ b/Marlin/src/lcd/fontutils.cpp @@ -10,8 +10,8 @@ #include "../inc/MarlinConfig.h" #if ENABLED(ULTRA_LCD) -#include "ultralcd.h" -#include "../Marlin.h" + #include "ultralcd.h" + #include "../Marlin.h" #endif #include "fontutils.h" diff --git a/Marlin/src/lcd/language/language_de.h b/Marlin/src/lcd/language/language_de.h index b844c1052b..241f3ab3cd 100644 --- a/Marlin/src/lcd/language/language_de.h +++ b/Marlin/src/lcd/language/language_de.h @@ -101,10 +101,9 @@ #define MSG_IDEX_MODE_DUPLICATE _UxGT("Duplizieren") #define MSG_IDEX_MODE_MIRRORED_COPY _UxGT("Spiegelkopie") #define MSG_IDEX_MODE_FULL_CTRL _UxGT("vollstä. Kontrolle") -#define MSG_IDEX_X_OFFSET _UxGT("2. Düse X") -#define MSG_IDEX_Y_OFFSET _UxGT("2. Düse Y") -#define MSG_IDEX_Z_OFFSET _UxGT("2. Düse Z") -#define MSG_IDEX_SAVE_OFFSETS _UxGT("Versätze speichern") +#define MSG_X_OFFSET _UxGT("2. Düse X") +#define MSG_Y_OFFSET _UxGT("2. Düse Y") +#define MSG_Z_OFFSET _UxGT("2. Düse Z") #define MSG_UBL_MANUAL_MESH _UxGT("Netz manuell erst.") #define MSG_UBL_BC_INSERT _UxGT("Unterlegen & messen") #define MSG_UBL_BC_INSERT2 _UxGT("Messen") diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index 862f8a1998..dc6c26cf93 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -52,6 +52,12 @@ #ifndef WELCOME_MSG #define WELCOME_MSG MACHINE_NAME _UxGT(" Ready.") #endif +#ifndef MSG_YES + #define MSG_YES _UxGT("YES") +#endif +#ifndef MSG_NO + #define MSG_NO _UxGT("NO") +#endif #ifndef MSG_BACK #define MSG_BACK _UxGT("Back") #endif @@ -241,6 +247,9 @@ #ifndef MSG_IDEX_MENU #define MSG_IDEX_MENU _UxGT("IDEX Mode") #endif +#ifndef MSG_OFFSETS_MENU + #define MSG_OFFSETS_MENU _UxGT("Tool Offsets") +#endif #ifndef MSG_IDEX_MODE_AUTOPARK #define MSG_IDEX_MODE_AUTOPARK _UxGT("Auto-Park") #endif @@ -253,17 +262,14 @@ #ifndef MSG_IDEX_MODE_FULL_CTRL #define MSG_IDEX_MODE_FULL_CTRL _UxGT("Full control") #endif -#ifndef MSG_IDEX_X_OFFSET - #define MSG_IDEX_X_OFFSET _UxGT("2nd nozzle X") +#ifndef MSG_X_OFFSET + #define MSG_X_OFFSET _UxGT("2nd nozzle X") #endif -#ifndef MSG_IDEX_Y_OFFSET - #define MSG_IDEX_Y_OFFSET _UxGT("2nd nozzle Y") +#ifndef MSG_Y_OFFSET + #define MSG_Y_OFFSET _UxGT("2nd nozzle Y") #endif -#ifndef MSG_IDEX_Z_OFFSET - #define MSG_IDEX_Z_OFFSET _UxGT("2nd nozzle Z") -#endif -#ifndef MSG_IDEX_SAVE_OFFSETS - #define MSG_IDEX_SAVE_OFFSETS _UxGT("Save Offsets") +#ifndef MSG_Z_OFFSET + #define MSG_Z_OFFSET _UxGT("2nd nozzle Z") #endif #ifndef MSG_UBL_MANUAL_MESH #define MSG_UBL_MANUAL_MESH _UxGT("Manually Build Mesh") @@ -744,6 +750,15 @@ #ifndef MSG_TUNE #define MSG_TUNE _UxGT("Tune") #endif +#ifndef MSG_START_PRINT + #define MSG_START_PRINT _UxGT("Start print") +#endif +#ifndef MSG_BUTTON_PRINT + #define MSG_BUTTON_PRINT _UxGT("Print") +#endif +#ifndef MSG_BUTTON_CANCEL + #define MSG_BUTTON_CANCEL _UxGT("Cancel") +#endif #ifndef MSG_PAUSE_PRINT #define MSG_PAUSE_PRINT _UxGT("Pause print") #endif @@ -903,6 +918,9 @@ #ifndef MSG_BABYSTEP_Z #define MSG_BABYSTEP_Z _UxGT("Babystep Z") #endif +#ifndef MSG_BABYSTEP_TOTAL + #define MSG_BABYSTEP_TOTAL _UxGT("Total") +#endif #ifndef MSG_ENDSTOP_ABORT #define MSG_ENDSTOP_ABORT _UxGT("Endstop abort") #endif diff --git a/Marlin/src/lcd/language/language_it.h b/Marlin/src/lcd/language/language_it.h index 5c2e2f5ebc..36bfd70f19 100644 --- a/Marlin/src/lcd/language/language_it.h +++ b/Marlin/src/lcd/language/language_it.h @@ -32,6 +32,8 @@ #define DISPLAY_CHARSET_ISO10646_1 #define WELCOME_MSG MACHINE_NAME _UxGT(" pronto.") +#define MSG_YES _UxGT("SI") +#define MSG_NO _UxGT("NO") #define MSG_BACK _UxGT("Indietro") #define MSG_SD_INSERTED _UxGT("SD Card inserita") #define MSG_SD_REMOVED _UxGT("SD Card rimossa") @@ -95,14 +97,14 @@ #define MSG_UBL_TOOLS _UxGT("Strumenti UBL") #define MSG_UBL_LEVEL_BED _UxGT("Unified Bed Leveling") #define MSG_IDEX_MENU _UxGT("Modo IDEX") +#define MSG_OFFSETS_MENU _UxGT("Strumenti Offsets") #define MSG_IDEX_MODE_AUTOPARK _UxGT("Auto-Park") #define MSG_IDEX_MODE_DUPLICATE _UxGT("Duplicazione") #define MSG_IDEX_MODE_MIRRORED_COPY _UxGT("Copia speculare") #define MSG_IDEX_MODE_FULL_CTRL _UxGT("Pieno controllo") -#define MSG_IDEX_X_OFFSET _UxGT("2° ugello X") -#define MSG_IDEX_Y_OFFSET _UxGT("2° ugello Y") -#define MSG_IDEX_Z_OFFSET _UxGT("2° ugello Z") -#define MSG_IDEX_SAVE_OFFSETS _UxGT("Memorizza Offsets") +#define MSG_X_OFFSET _UxGT("2° ugello X") +#define MSG_Y_OFFSET _UxGT("2° ugello Y") +#define MSG_Z_OFFSET _UxGT("2° ugello Z") #define MSG_UBL_MANUAL_MESH _UxGT("Mesh Manuale") #define MSG_UBL_BC_INSERT _UxGT("Metti spes. e misura") #define MSG_UBL_BC_INSERT2 _UxGT("Misura") @@ -268,6 +270,9 @@ #define MSG_WATCH _UxGT("Schermata info") #define MSG_PREPARE _UxGT("Prepara") #define MSG_TUNE _UxGT("Regola") +#define MSG_START_PRINT _UxGT("Avvia stampa") +#define MSG_BUTTON_PRINT _UxGT("Stampa") +#define MSG_BUTTON_CANCEL _UxGT("Annulla") #define MSG_PAUSE_PRINT _UxGT("Pausa stampa") #define MSG_RESUME_PRINT _UxGT("Riprendi stampa") #define MSG_STOP_PRINT _UxGT("Arresta stampa") @@ -321,6 +326,7 @@ #define MSG_BABYSTEP_X _UxGT("Babystep X") #define MSG_BABYSTEP_Y _UxGT("Babystep Y") #define MSG_BABYSTEP_Z _UxGT("Babystep Z") +#define MSG_BABYSTEP_TOTAL _UxGT("Totali") #define MSG_ENDSTOP_ABORT _UxGT("Finecorsa annullati") #define MSG_HEATING_FAILED_LCD _UxGT("Riscald. Fallito") #define MSG_HEATING_FAILED_LCD_BED _UxGT("Risc. piatto fallito") @@ -449,6 +455,10 @@ #define MSG_VTOOLS_RESET _UxGT("V-tools ripristin.") #define MSG_START_Z _UxGT("Z inizio") #define MSG_END_Z _UxGT("Z fine") +#define MSG_BRICKOUT _UxGT("Brickout") +#define MSG_INVADERS _UxGT("Invaders") +#define MSG_SNAKE _UxGT("Sn4k3") +#define MSG_MAZE _UxGT("Maze") // // Le schermate di Cambio Filamento possono visualizzare fino a 3 linee su un display a 4 righe @@ -505,3 +515,7 @@ #define MSG_SERVICE_RESET _UxGT("Resetta") #define MSG_SERVICE_IN _UxGT(" tra:") + +#define MSG_BACKLASH _UxGT("Gioco") +#define MSG_BACKLASH_CORRECTION _UxGT("Correzione") +#define MSG_BACKLASH_SMOOTHING _UxGT("Smoothing") diff --git a/Marlin/src/lcd/language/language_ko_KR.h b/Marlin/src/lcd/language/language_ko_KR.h index e367b501f7..2755727173 100644 --- a/Marlin/src/lcd/language/language_ko_KR.h +++ b/Marlin/src/lcd/language/language_ko_KR.h @@ -90,10 +90,9 @@ #define MSG_IDEX_MODE_DUPLICATE _UxGT("Duplication") #define MSG_IDEX_MODE_MIRRORED_COPY _UxGT("미러 사본") #define MSG_IDEX_MODE_FULL_CTRL _UxGT("Full control") -#define MSG_IDEX_X_OFFSET _UxGT("2nd nozzle X") -#define MSG_IDEX_Y_OFFSET _UxGT("2nd nozzle Y") -#define MSG_IDEX_Z_OFFSET _UxGT("2nd nozzle Z") -#define MSG_IDEX_SAVE_OFFSETS _UxGT("Save Offsets") +#define MSG_X_OFFSET _UxGT("2nd nozzle X") +#define MSG_Y_OFFSET _UxGT("2nd nozzle Y") +#define MSG_Z_OFFSET _UxGT("2nd nozzle Z") #define MSG_UBL_MANUAL_MESH _UxGT("Manually Build Mesh") #define MSG_UBL_BC_INSERT _UxGT("Place shim & measure") #define MSG_UBL_BC_INSERT2 _UxGT("Measure") diff --git a/Marlin/src/lcd/language/language_pt-br.h b/Marlin/src/lcd/language/language_pt-br.h index d48046776c..6baf1fdf06 100644 --- a/Marlin/src/lcd/language/language_pt-br.h +++ b/Marlin/src/lcd/language/language_pt-br.h @@ -101,10 +101,9 @@ #define MSG_IDEX_MODE_DUPLICATE _UxGT("Duplicação") #define MSG_IDEX_MODE_MIRRORED_COPY _UxGT("Cópia espelhada") #define MSG_IDEX_MODE_FULL_CTRL _UxGT("Controle Total") -#define MSG_IDEX_X_OFFSET _UxGT("2o bico X") -#define MSG_IDEX_Y_OFFSET _UxGT("2o bico Y") -#define MSG_IDEX_Z_OFFSET _UxGT("2o bico Z") -#define MSG_IDEX_SAVE_OFFSETS _UxGT("Salvar Compensação") +#define MSG_X_OFFSET _UxGT("2o bico X") +#define MSG_Y_OFFSET _UxGT("2o bico Y") +#define MSG_Z_OFFSET _UxGT("2o bico Z") #define MSG_UBL_MANUAL_MESH _UxGT("Fazer malha manual") #define MSG_UBL_BC_INSERT _UxGT("Calçar e calibrar") diff --git a/Marlin/src/lcd/language/language_sk.h b/Marlin/src/lcd/language/language_sk.h index 8841a57170..965ae22310 100644 --- a/Marlin/src/lcd/language/language_sk.h +++ b/Marlin/src/lcd/language/language_sk.h @@ -108,10 +108,9 @@ #define MSG_IDEX_MODE_DUPLICATE _UxGT("Duplikácia") #define MSG_IDEX_MODE_MIRRORED_COPY _UxGT("Zrkadlená kópia") #define MSG_IDEX_MODE_FULL_CTRL _UxGT("Plná kontrola") -#define MSG_IDEX_X_OFFSET _UxGT("2. tryska X") -#define MSG_IDEX_Y_OFFSET _UxGT("2. tryska Y") -#define MSG_IDEX_Z_OFFSET _UxGT("2. tryska Z") -#define MSG_IDEX_SAVE_OFFSETS _UxGT("Uložiť offsety") +#define MSG_X_OFFSET _UxGT("2. tryska X") +#define MSG_Y_OFFSET _UxGT("2. tryska Y") +#define MSG_Z_OFFSET _UxGT("2. tryska Z") #define MSG_UBL_MANUAL_MESH _UxGT("Manuálna sieť bodov") #define MSG_UBL_BC_INSERT _UxGT("Položte a zmerajte") #define MSG_UBL_BC_INSERT2 _UxGT("Zmerajte") diff --git a/Marlin/src/lcd/language/language_tr.h b/Marlin/src/lcd/language/language_tr.h index 0edb2e539b..f8569dd526 100644 --- a/Marlin/src/lcd/language/language_tr.h +++ b/Marlin/src/lcd/language/language_tr.h @@ -100,10 +100,9 @@ #define MSG_IDEX_MODE_DUPLICATE _UxGT("Kopyala") #define MSG_IDEX_MODE_MIRRORED_COPY _UxGT("Yansıtılmış kopya") #define MSG_IDEX_MODE_FULL_CTRL _UxGT("Tam Kontrol") -#define MSG_IDEX_X_OFFSET _UxGT("2. nozul X") -#define MSG_IDEX_Y_OFFSET _UxGT("2. nozul Y") -#define MSG_IDEX_Z_OFFSET _UxGT("2. nozul Z") -#define MSG_IDEX_SAVE_OFFSETS _UxGT("Ofsetleri Kaydet") +#define MSG_X_OFFSET _UxGT("2. nozul X") +#define MSG_Y_OFFSET _UxGT("2. nozul Y") +#define MSG_Z_OFFSET _UxGT("2. nozul Z") #define MSG_UBL_MANUAL_MESH _UxGT("Elle Mesh Oluştur") #define MSG_UBL_BC_INSERT _UxGT("Altlık & Ölçü Ver") #define MSG_UBL_BC_INSERT2 _UxGT("Ölçü") diff --git a/Marlin/src/lcd/menu/game/game.cpp b/Marlin/src/lcd/menu/game/game.cpp index 1b1d838a8e..e11c414a13 100644 --- a/Marlin/src/lcd/menu/game/game.cpp +++ b/Marlin/src/lcd/menu/game/game.cpp @@ -62,8 +62,7 @@ void MarlinGame::init_game(const uint8_t init_state, const screenFunc_t screen) } void MarlinGame::exit_game() { - ui.goto_previous_screen(); - ui.defer_status_screen(false); + ui.goto_previous_screen_no_defer(); } #endif // HAS_GAMES diff --git a/Marlin/src/lcd/menu/game/invaders.cpp b/Marlin/src/lcd/menu/game/invaders.cpp index 4bb90f3565..b454d6c17e 100644 --- a/Marlin/src/lcd/menu/game/invaders.cpp +++ b/Marlin/src/lcd/menu/game/invaders.cpp @@ -63,7 +63,7 @@ const unsigned char invader[3][2][16] PROGMEM = { B01111111,B11110000, B00011111,B11000000, B00010000,B01000000, - B00100000,B00100000 + B00100000,B00100000 } }, { { B00001111,B00000000, @@ -182,7 +182,7 @@ typedef struct { int8_t x, y, v; } laser_t; uint8_t cannons_left; int8_t cannon_x; -laser_t laser, expl, bullet[10]; +laser_t explod, laser, bullet[10]; constexpr uint8_t inv_off[] = { 2, 1, 0 }, inv_wide[] = { 8, 11, 12 }; int8_t invaders_x, invaders_y, invaders_dir, leftmost, rightmost, botmost; uint8_t invader_count, quit_count, bugs[INVADER_ROWS], shooters[(INVADER_ROWS) * (INVADER_COLS)]; @@ -236,7 +236,9 @@ inline void fire_cannon() { } inline void explode(const int8_t x, const int8_t y, const int8_t v=4) { - expl.x = x - (EXPL_W) / 2; expl.y = y; expl.v = v; + explod.x = x - (EXPL_W) / 2; + explod.y = y; + explod.v = v; } inline void kill_cannon(uint8_t &game_state, const uint8_t st) { @@ -261,7 +263,7 @@ void InvadersGame::game_screen() { if (ui.first_page) { // Update Cannon Position - int32_t ep = (int32_t)ui.encoderPosition; + int16_t ep = int16_t(ui.encoderPosition); ep = constrain(ep, 0, (LCD_PIXEL_WIDTH - (CANNON_W)) / (CANNON_VEL)); ui.encoderPosition = ep; @@ -431,9 +433,9 @@ void InvadersGame::game_screen() { } // Draw explosion - if (expl.v && PAGE_CONTAINS(expl.y, expl.y + 7 - 1)) { - u8g.drawBitmapP(expl.x, expl.y, 2, 7, explosion); - --expl.v; + if (explod.v && PAGE_CONTAINS(explod.y, explod.y + 7 - 1)) { + u8g.drawBitmapP(explod.x, explod.y, 2, 7, explosion); + --explod.v; } // Blink GAME OVER when game is over diff --git a/Marlin/src/lcd/menu/menu.cpp b/Marlin/src/lcd/menu/menu.cpp index 0365df2356..91b1ad448e 100644 --- a/Marlin/src/lcd/menu/menu.cpp +++ b/Marlin/src/lcd/menu/menu.cpp @@ -37,7 +37,7 @@ #include "../../module/configuration_store.h" #endif -#if WATCH_HOTENDS || WATCH_BED || ENABLED(BABYSTEP_ZPROBE_OFFSET) +#if WATCH_HOTENDS || WATCH_BED #include "../../module/temperature.h" #endif @@ -59,18 +59,18 @@ int8_t encoderTopLine, encoderLine, screen_items; typedef struct { screenFunc_t menu_function; uint32_t encoder_position; - uint8_t top_line, items; + int8_t top_line, items; } menuPosition; menuPosition screen_history[6]; uint8_t screen_history_depth = 0; bool screen_changed; // Value Editing -PGM_P editLabel; -void *editValue; -int32_t minEditValue, maxEditValue; -screenFunc_t callbackFunc; -bool liveEdit; +PGM_P MenuItemBase::editLabel; +void* MenuItemBase::editValue; +int16_t MenuItemBase::minEditValue, MenuItemBase::maxEditValue; +screenFunc_t MenuItemBase::callbackFunc; +bool MenuItemBase::liveEdit; // Prevent recursion into screen handlers bool no_reentry = false; @@ -131,8 +131,8 @@ void MenuItem_gcode::action(PGM_P pgcode) { enqueue_and_echo_commands_P(pgcode); */ void MenuItemBase::edit(strfunc_t strfunc, loadfunc_t loadfunc) { ui.encoder_direction_normal(); - if ((int32_t)ui.encoderPosition < 0) ui.encoderPosition = 0; - if ((int32_t)ui.encoderPosition > maxEditValue) ui.encoderPosition = maxEditValue; + if (int16_t(ui.encoderPosition) < 0) ui.encoderPosition = 0; + if (int16_t(ui.encoderPosition) > maxEditValue) ui.encoderPosition = maxEditValue; if (ui.should_draw()) draw_edit_screen(editLabel, strfunc(ui.encoderPosition + minEditValue)); if (ui.lcd_clicked || (liveEdit && ui.should_draw())) { @@ -142,7 +142,7 @@ void MenuItemBase::edit(strfunc_t strfunc, loadfunc_t loadfunc) { } } -void MenuItemBase::init(PGM_P const el, void * const ev, const int32_t minv, const int32_t maxv, const uint32_t ep, const screenFunc_t cs, const screenFunc_t cb, const bool le) { +void MenuItemBase::init(PGM_P const el, void * const ev, const int16_t minv, const int16_t maxv, const uint16_t ep, const screenFunc_t cs, const screenFunc_t cb, const bool le) { ui.save_previous_screen(); ui.refresh(); editLabel = el; @@ -193,7 +193,7 @@ bool printer_busy() { /** * General function to go directly to a screen */ -void MarlinUI::goto_screen(screenFunc_t screen, const uint32_t encoder/*=0*/, const uint8_t top/*=0*/, const uint8_t items/*=0*/) { +void MarlinUI::goto_screen(screenFunc_t screen, const uint16_t encoder/*=0*/, const uint8_t top/*=0*/, const uint8_t items/*=0*/) { if (currentScreen != screen) { #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) @@ -352,6 +352,8 @@ void MarlinUI::completion_feedback(const bool good/*=true*/) { #if ENABLED(BABYSTEP_ZPROBE_OFFSET) + #include "../../feature/babystep.h" + void lcd_babystep_zoffset() { if (ui.use_click()) return ui.goto_previous_screen_no_defer(); ui.defer_status_screen(); @@ -362,7 +364,7 @@ void MarlinUI::completion_feedback(const bool good/*=true*/) { #endif ui.encoder_direction_normal(); if (ui.encoderPosition) { - const int16_t babystep_increment = (int32_t)ui.encoderPosition * (BABYSTEP_MULTIPLICATOR); + const int16_t babystep_increment = int16_t(ui.encoderPosition) * (BABYSTEP_MULTIPLICATOR); ui.encoderPosition = 0; const float diff = planner.steps_to_mm[Z_AXIS] * babystep_increment, @@ -376,7 +378,7 @@ void MarlinUI::completion_feedback(const bool good/*=true*/) { ; if (WITHIN(new_offs, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) { - thermalManager.babystep_axis(Z_AXIS, babystep_increment); + babystep.add_steps(Z_AXIS, babystep_increment); if (do_probe) zprobe_zoffset = new_offs; #if ENABLED(BABYSTEP_HOTEND_Z_OFFSET) @@ -389,7 +391,7 @@ void MarlinUI::completion_feedback(const bool good/*=true*/) { if (ui.should_draw()) { #if ENABLED(BABYSTEP_HOTEND_Z_OFFSET) if (!do_probe) - draw_edit_screen(PSTR(MSG_IDEX_Z_OFFSET), ftostr43sign(hotend_offset[Z_AXIS][active_extruder])); + draw_edit_screen(PSTR(MSG_Z_OFFSET), ftostr43sign(hotend_offset[Z_AXIS][active_extruder])); else #endif draw_edit_screen(PSTR(MSG_ZPROBE_ZOFFSET), ftostr43sign(zprobe_zoffset)); @@ -434,4 +436,12 @@ void _lcd_draw_homing() { void _lcd_toggle_bed_leveling() { set_bed_leveling_enabled(!planner.leveling_active); } #endif +void do_select_screen(PGM_P const yes, PGM_P const no, bool &yesno, PGM_P const pref, const char * const string, PGM_P const suff) { + if (ui.encoderPosition) { + yesno = int16_t(ui.encoderPosition) > 0; + ui.encoderPosition = 0; + } + draw_select_screen(yes, no, yesno, pref, string, suff); +} + #endif // HAS_LCD_MENU diff --git a/Marlin/src/lcd/menu/menu.h b/Marlin/src/lcd/menu/menu.h index e695a02433..6e8d44b13e 100644 --- a/Marlin/src/lcd/menu/menu.h +++ b/Marlin/src/lcd/menu/menu.h @@ -43,7 +43,7 @@ bool printer_busy(); static inline char* strfunc(const float value) { return STRFUNC((TYPE) value); } \ }; -DECLARE_MENU_EDIT_TYPE(uint8_t, percent, ui8tostr_percent,1 ); // 100% right-justified +DECLARE_MENU_EDIT_TYPE(uint8_t, percent, ui8tostr4pct, 1 ); // 100% right-justified DECLARE_MENU_EDIT_TYPE(int16_t, int3, i16tostr3, 1 ); // 123, -12 right-justified DECLARE_MENU_EDIT_TYPE(int16_t, int4, i16tostr4sign, 1 ); // 1234, -123 right-justified DECLARE_MENU_EDIT_TYPE(int8_t, int8, i8tostr3, 1 ); // 123, -12 right-justified @@ -64,6 +64,11 @@ DECLARE_MENU_EDIT_TYPE(uint32_t, long5, ftostr5rj, 0.01f ); // 123 //////////////////////////////////////////// void draw_edit_screen(PGM_P const pstr, const char* const value=NULL); +void draw_select_screen(PGM_P const yes, PGM_P const no, const bool yesno, PGM_P const pref, const char * const string, PGM_P const suff); +void do_select_screen(PGM_P const yes, PGM_P const no, bool &yesno, PGM_P const pref, const char * const string=NULL, PGM_P const suff=NULL); +inline void do_select_screen_yn(bool &yesno, PGM_P const pref, const char * const string, PGM_P const suff) { + do_select_screen(PSTR(MSG_YES), PSTR(MSG_NO), yesno, pref, string, suff); +} void draw_menu_item(const bool sel, const uint8_t row, PGM_P const pstr, const char pre_char, const char post_char); void draw_menu_item_static(const uint8_t row, PGM_P const pstr, const bool center=true, const bool invert=false, const char *valstr=NULL); void _draw_menu_item_edit(const bool sel, const uint8_t row, PGM_P const pstr, const char* const data, const bool pgm); @@ -151,10 +156,16 @@ class MenuItem_function { //////////////////////////////////////////// class MenuItemBase { + private: + static PGM_P editLabel; + static void *editValue; + static int16_t minEditValue, maxEditValue; + static screenFunc_t callbackFunc; + static bool liveEdit; protected: - typedef char* (*strfunc_t)(const int32_t); - typedef void (*loadfunc_t)(void *, const int32_t); - static void init(PGM_P const el, void * const ev, const int32_t minv, const int32_t maxv, const uint32_t ep, const screenFunc_t cs, const screenFunc_t cb, const bool le); + typedef char* (*strfunc_t)(const int16_t); + typedef void (*loadfunc_t)(void *, const int16_t); + static void init(PGM_P const el, void * const ev, const int16_t minv, const int16_t maxv, const uint16_t ep, const screenFunc_t cs, const screenFunc_t cb, const bool le); static void edit(strfunc_t, loadfunc_t); }; @@ -164,12 +175,12 @@ class TMenuItem : MenuItemBase { typedef typename NAME::type_t type_t; static inline float unscale(const float value) { return value * (1.0f / NAME::scale); } static inline float scale(const float value) { return value * NAME::scale; } - static void load(void *ptr, const int32_t value) { *((type_t*)ptr) = unscale(value); } - static char* to_string(const int32_t value) { return NAME::strfunc(unscale(value)); } + static void load(void *ptr, const int16_t value) { *((type_t*)ptr) = unscale(value); } + static char* to_string(const int16_t value) { return NAME::strfunc(unscale(value)); } public: static void action_edit(PGM_P const pstr, type_t * const ptr, const type_t minValue, const type_t maxValue, const screenFunc_t callback=NULL, const bool live=false) { - const int32_t minv = scale(minValue); - init(pstr, ptr, minv, int32_t(scale(maxValue)) - minv, int32_t(scale(*ptr)) - minv, edit, callback, live); + const int16_t minv = scale(minValue); + init(pstr, ptr, minv, int16_t(scale(maxValue)) - minv, int16_t(scale(*ptr)) - minv, edit, callback, live); } static void edit() { MenuItemBase::edit(to_string, load); } }; diff --git a/Marlin/src/lcd/menu/menu_bed_leveling.cpp b/Marlin/src/lcd/menu/menu_bed_leveling.cpp index 3e2508647e..e8107aa58a 100644 --- a/Marlin/src/lcd/menu/menu_bed_leveling.cpp +++ b/Marlin/src/lcd/menu/menu_bed_leveling.cpp @@ -120,7 +120,7 @@ // Encoder knob or keypad buttons adjust the Z position // if (ui.encoderPosition) { - const float z = current_position[Z_AXIS] + float((int32_t)ui.encoderPosition) * (MESH_EDIT_Z_STEP); + const float z = current_position[Z_AXIS] + float(int16_t(ui.encoderPosition)) * (MESH_EDIT_Z_STEP); line_to_z(constrain(z, -(LCD_PROBE_Z_RANGE) * 0.5f, (LCD_PROBE_Z_RANGE) * 0.5f)); ui.refresh(LCDVIEW_CALL_REDRAW_NEXT); ui.encoderPosition = 0; diff --git a/Marlin/src/lcd/menu/menu_configuration.cpp b/Marlin/src/lcd/menu/menu_configuration.cpp index d6115f5501..3dab293334 100644 --- a/Marlin/src/lcd/menu/menu_configuration.cpp +++ b/Marlin/src/lcd/menu/menu_configuration.cpp @@ -119,19 +119,37 @@ static void lcd_factory_settings() { #endif -#if ENABLED(DUAL_X_CARRIAGE) - +#if HAS_HOTEND_OFFSET #include "../../module/motion.h" #include "../../gcode/queue.h" - void _recalc_IDEX_settings() { - if (active_extruder) { // For the 2nd extruder re-home so the next tool-change gets the new offsets. + void _recalc_offsets() { + if (active_extruder && all_axes_known()) { // For the 2nd extruder re-home so the next tool-change gets the new offsets. enqueue_and_echo_commands_P(PSTR("G28")); // In future, we can babystep the 2nd extruder (if active), making homing unnecessary. active_extruder = 0; } } - void menu_IDEX() { + void menu_tool_offsets() { + START_MENU(); + MENU_BACK(MSG_MAIN); + #if ENABLED(DUAL_X_CARRIAGE) + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float52, MSG_X_OFFSET, &hotend_offset[X_AXIS][1], MIN(X2_HOME_POS, X2_MAX_POS) - 25.0, MAX(X2_HOME_POS, X2_MAX_POS) + 25.0, _recalc_offsets); + #else + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float52, MSG_X_OFFSET, &hotend_offset[X_AXIS][1], -10.0, 10.0, _recalc_offsets); + #endif + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float52, MSG_Y_OFFSET, &hotend_offset[Y_AXIS][1], -10.0, 10.0, _recalc_offsets); + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float52, MSG_Z_OFFSET, &hotend_offset[Z_AXIS][1], Z_PROBE_LOW_POINT, 10.0, _recalc_offsets); + #if ENABLED(EEPROM_SETTINGS) + MENU_ITEM(function, MSG_STORE_EEPROM, lcd_store_settings); + #endif + END_MENU(); + } +#endif + +#if ENABLED(DUAL_X_CARRIAGE) + + void menu_idex() { START_MENU(); MENU_BACK(MSG_MAIN); @@ -146,10 +164,6 @@ static void lcd_factory_settings() { : PSTR("M605 S1\nT0\nM605 S2 X200\nG28 X\nG1 X100\nM605 S3 X200") ); MENU_ITEM(gcode, MSG_IDEX_MODE_FULL_CTRL, PSTR("M605 S0\nG28 X")); - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float52, MSG_IDEX_X_OFFSET , &hotend_offset[X_AXIS][1], MIN(X2_HOME_POS, X2_MAX_POS) - 25.0, MAX(X2_HOME_POS, X2_MAX_POS) + 25.0, _recalc_IDEX_settings); - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float52, MSG_IDEX_Y_OFFSET , &hotend_offset[Y_AXIS][1], -10.0, 10.0, _recalc_IDEX_settings); - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float52, MSG_IDEX_Z_OFFSET , &hotend_offset[Z_AXIS][1], -10.0, 10.0, _recalc_IDEX_settings); - MENU_ITEM(gcode, MSG_IDEX_SAVE_OFFSETS, PSTR("M500")); END_MENU(); } @@ -287,8 +301,12 @@ void menu_configuration() { MENU_ITEM(submenu, MSG_DELTA_CALIBRATE, menu_delta_calibrate); #endif + #if HAS_HOTEND_OFFSET + MENU_ITEM(submenu, MSG_OFFSETS_MENU, menu_tool_offsets); + #endif + #if ENABLED(DUAL_X_CARRIAGE) - MENU_ITEM(submenu, MSG_IDEX_MENU, menu_IDEX); + MENU_ITEM(submenu, MSG_IDEX_MENU, menu_idex); #endif #if ENABLED(BLTOUCH) diff --git a/Marlin/src/lcd/menu/menu_main.cpp b/Marlin/src/lcd/menu/menu_main.cpp index ad7dc241a5..52178b873c 100644 --- a/Marlin/src/lcd/menu/menu_main.cpp +++ b/Marlin/src/lcd/menu/menu_main.cpp @@ -33,15 +33,12 @@ #include "../../gcode/queue.h" #include "../../module/printcounter.h" #include "../../module/stepper.h" +#include "../../sd/cardreader.h" #if ENABLED(POWER_LOSS_RECOVERY) #include "../../feature/power_loss_recovery.h" #endif -#if ENABLED(SDSUPPORT) - #include "../../sd/cardreader.h" -#endif - #if ENABLED(HOST_ACTION_COMMANDS) #include "../../feature/host_actions.h" #endif @@ -146,7 +143,7 @@ void menu_main() { START_MENU(); MENU_BACK(MSG_WATCH); - const bool busy = printer_busy() + const bool busy = IS_SD_PRINTING() || print_job_timer.isRunning() #if ENABLED(SDSUPPORT) , card_detected = card.isDetected() , card_open = card_detected && card.isFileOpen() diff --git a/Marlin/src/lcd/menu/menu_mixer.cpp b/Marlin/src/lcd/menu/menu_mixer.cpp index a99052ec11..8e5b6f4d0f 100644 --- a/Marlin/src/lcd/menu/menu_mixer.cpp +++ b/Marlin/src/lcd/menu/menu_mixer.cpp @@ -44,7 +44,7 @@ ui.encoder_direction_normal(); ENCODER_RATE_MULTIPLY(true); if (ui.encoderPosition != 0) { - mixer.gradient.start_z += float((int)ui.encoderPosition) * 0.1; + mixer.gradient.start_z += float(int16_t(ui.encoderPosition)) * 0.1; ui.encoderPosition = 0; NOLESS(mixer.gradient.start_z, 0); NOMORE(mixer.gradient.start_z, Z_MAX_POS); @@ -69,7 +69,7 @@ ui.encoder_direction_normal(); ENCODER_RATE_MULTIPLY(true); if (ui.encoderPosition != 0) { - mixer.gradient.end_z += float((int)ui.encoderPosition) * 0.1; + mixer.gradient.end_z += float(int16_t(ui.encoderPosition)) * 0.1; ui.encoderPosition = 0; NOLESS(mixer.gradient.end_z, 0); NOMORE(mixer.gradient.end_z, Z_MAX_POS); @@ -185,7 +185,7 @@ void lcd_mixer_mix_edit() { #elif DUAL_MIXING_EXTRUDER if (ui.encoderPosition != 0) { - mixer.mix[0] += (int)ui.encoderPosition; + mixer.mix[0] += int16_t(ui.encoderPosition); ui.encoderPosition = 0; if (mixer.mix[0] < 0) mixer.mix[0] += 101; if (mixer.mix[0] > 100) mixer.mix[0] -= 101; diff --git a/Marlin/src/lcd/menu/menu_mmu2.cpp b/Marlin/src/lcd/menu/menu_mmu2.cpp index cebf996900..af2e296083 100644 --- a/Marlin/src/lcd/menu/menu_mmu2.cpp +++ b/Marlin/src/lcd/menu/menu_mmu2.cpp @@ -35,60 +35,60 @@ bool mmuMenuWait; // Load Filament // -void _mmu2_loadFilamentToNozzle(uint8_t index) { +void _mmu2_load_filamentToNozzle(uint8_t index) { ui.reset_status(); ui.return_to_status(); ui.status_printf_P(0, PSTR(MSG_MMU2_LOADING_FILAMENT), int(index + 1)); - if (mmu2.loadFilamentToNozzle(index)) ui.reset_status(); + if (mmu2.load_filament_to_nozzle(index)) ui.reset_status(); } -inline void action_mmu2_loadFilamentToNozzle(const uint8_t tool) { - _mmu2_loadFilamentToNozzle(tool); +inline void action_mmu2_load_filament_to_nozzl_e(const uint8_t tool) { + _mmu2_load_filamentToNozzle(tool); ui.return_to_status(); } -inline void action_mmu2_loadFilamentToNozzle0() { action_mmu2_loadFilamentToNozzle(0); } -inline void action_mmu2_loadFilamentToNozzle1() { action_mmu2_loadFilamentToNozzle(1); } -inline void action_mmu2_loadFilamentToNozzle2() { action_mmu2_loadFilamentToNozzle(2); } -inline void action_mmu2_loadFilamentToNozzle3() { action_mmu2_loadFilamentToNozzle(3); } -inline void action_mmu2_loadFilamentToNozzle4() { action_mmu2_loadFilamentToNozzle(4); } +inline void action_mmu2_load_filament_to_nozzle_0() { action_mmu2_load_filament_to_nozzl_e(0); } +inline void action_mmu2_load_filament_to_nozzle_1() { action_mmu2_load_filament_to_nozzl_e(1); } +inline void action_mmu2_load_filament_to_nozzle_2() { action_mmu2_load_filament_to_nozzl_e(2); } +inline void action_mmu2_load_filament_to_nozzle_3() { action_mmu2_load_filament_to_nozzl_e(3); } +inline void action_mmu2_load_filament_to_nozzle_4() { action_mmu2_load_filament_to_nozzl_e(4); } -void _mmu2_loadFilament(uint8_t index) { +void _mmu2_load_filament(uint8_t index) { ui.return_to_status(); ui.status_printf_P(0, PSTR(MSG_MMU2_LOADING_FILAMENT), int(index + 1)); - mmu2.loadFilament(index); + mmu2.load_filament(index); ui.reset_status(); } -void action_mmu2_loadAll() { +void action_mmu2_load_all() { for (uint8_t i = 0; i < EXTRUDERS; i++) - _mmu2_loadFilament(i); + _mmu2_load_filament(i); ui.return_to_status(); } -inline void action_mmu2_loadFilament0() { _mmu2_loadFilament(0); } -inline void action_mmu2_loadFilament1() { _mmu2_loadFilament(1); } -inline void action_mmu2_loadFilament2() { _mmu2_loadFilament(2); } -inline void action_mmu2_loadFilament3() { _mmu2_loadFilament(3); } -inline void action_mmu2_loadFilament4() { _mmu2_loadFilament(4); } +inline void action_mmu2_load_filament_0() { _mmu2_load_filament(0); } +inline void action_mmu2_load_filament_1() { _mmu2_load_filament(1); } +inline void action_mmu2_load_filament_2() { _mmu2_load_filament(2); } +inline void action_mmu2_load_filament_3() { _mmu2_load_filament(3); } +inline void action_mmu2_load_filament_4() { _mmu2_load_filament(4); } -void menu_mmu2_loadFilament() { +void menu_mmu2_load_filament() { START_MENU(); MENU_BACK(MSG_MMU2_MENU); - MENU_ITEM(function, MSG_MMU2_ALL, action_mmu2_loadAll); - MENU_ITEM(function, MSG_MMU2_FILAMENT0, action_mmu2_loadFilament0); - MENU_ITEM(function, MSG_MMU2_FILAMENT1, action_mmu2_loadFilament1); - MENU_ITEM(function, MSG_MMU2_FILAMENT2, action_mmu2_loadFilament2); - MENU_ITEM(function, MSG_MMU2_FILAMENT3, action_mmu2_loadFilament3); - MENU_ITEM(function, MSG_MMU2_FILAMENT4, action_mmu2_loadFilament4); + MENU_ITEM(function, MSG_MMU2_ALL, action_mmu2_load_all); + MENU_ITEM(function, MSG_MMU2_FILAMENT0, action_mmu2_load_filament_0); + MENU_ITEM(function, MSG_MMU2_FILAMENT1, action_mmu2_load_filament_1); + MENU_ITEM(function, MSG_MMU2_FILAMENT2, action_mmu2_load_filament_2); + MENU_ITEM(function, MSG_MMU2_FILAMENT3, action_mmu2_load_filament_3); + MENU_ITEM(function, MSG_MMU2_FILAMENT4, action_mmu2_load_filament_4); END_MENU(); } -void menu_mmu2_loadToNozzle() { +void menu_mmu2_load_to_nozzle() { START_MENU(); MENU_BACK(MSG_MMU2_MENU); - MENU_ITEM(function, MSG_MMU2_FILAMENT0, action_mmu2_loadFilamentToNozzle0); - MENU_ITEM(function, MSG_MMU2_FILAMENT1, action_mmu2_loadFilamentToNozzle1); - MENU_ITEM(function, MSG_MMU2_FILAMENT2, action_mmu2_loadFilamentToNozzle2); - MENU_ITEM(function, MSG_MMU2_FILAMENT3, action_mmu2_loadFilamentToNozzle3); - MENU_ITEM(function, MSG_MMU2_FILAMENT4, action_mmu2_loadFilamentToNozzle4); + MENU_ITEM(function, MSG_MMU2_FILAMENT0, action_mmu2_load_filament_to_nozzle_0); + MENU_ITEM(function, MSG_MMU2_FILAMENT1, action_mmu2_load_filament_to_nozzle_1); + MENU_ITEM(function, MSG_MMU2_FILAMENT2, action_mmu2_load_filament_to_nozzle_2); + MENU_ITEM(function, MSG_MMU2_FILAMENT3, action_mmu2_load_filament_to_nozzle_3); + MENU_ITEM(function, MSG_MMU2_FILAMENT4, action_mmu2_load_filament_to_nozzle_4); END_MENU(); } @@ -96,19 +96,19 @@ void menu_mmu2_loadToNozzle() { // Eject Filament // -void _mmu2_ejectFilament(uint8_t index) { +void _mmu2_eject_filament(uint8_t index) { ui.reset_status(); ui.return_to_status(); ui.status_printf_P(0, PSTR(MSG_MMU2_EJECTING_FILAMENT), int(index + 1)); - if (mmu2.ejectFilament(index, true)) ui.reset_status(); + if (mmu2.eject_filament(index, true)) ui.reset_status(); } -inline void action_mmu2_ejectFilament0() { _mmu2_ejectFilament(0); } -inline void action_mmu2_ejectFilament1() { _mmu2_ejectFilament(1); } -inline void action_mmu2_ejectFilament2() { _mmu2_ejectFilament(2); } -inline void action_mmu2_ejectFilament3() { _mmu2_ejectFilament(3); } -inline void action_mmu2_ejectFilament4() { _mmu2_ejectFilament(4); } +inline void action_mmu2_eject_filament_0() { _mmu2_eject_filament(0); } +inline void action_mmu2_eject_filament_1() { _mmu2_eject_filament(1); } +inline void action_mmu2_eject_filament_2() { _mmu2_eject_filament(2); } +inline void action_mmu2_eject_filament_3() { _mmu2_eject_filament(3); } +inline void action_mmu2_eject_filament_4() { _mmu2_eject_filament(4); } -void action_mmu2_unloadFilament() { +void action_mmu2_unload_filament() { ui.reset_status(); ui.return_to_status(); LCD_MESSAGEPGM(MSG_MMU2_UNLOADING_FILAMENT); @@ -116,14 +116,14 @@ void action_mmu2_unloadFilament() { if (mmu2.unload()) ui.reset_status(); } -void menu_mmu2_ejectFilament() { +void menu_mmu2_eject_filament() { START_MENU(); MENU_BACK(MSG_MMU2_MENU); - MENU_ITEM(function, MSG_MMU2_FILAMENT0, action_mmu2_ejectFilament0); - MENU_ITEM(function, MSG_MMU2_FILAMENT1, action_mmu2_ejectFilament1); - MENU_ITEM(function, MSG_MMU2_FILAMENT2, action_mmu2_ejectFilament2); - MENU_ITEM(function, MSG_MMU2_FILAMENT3, action_mmu2_ejectFilament3); - MENU_ITEM(function, MSG_MMU2_FILAMENT4, action_mmu2_ejectFilament4); + MENU_ITEM(function, MSG_MMU2_FILAMENT0, action_mmu2_eject_filament_0); + MENU_ITEM(function, MSG_MMU2_FILAMENT1, action_mmu2_eject_filament_1); + MENU_ITEM(function, MSG_MMU2_FILAMENT2, action_mmu2_eject_filament_2); + MENU_ITEM(function, MSG_MMU2_FILAMENT3, action_mmu2_eject_filament_3); + MENU_ITEM(function, MSG_MMU2_FILAMENT4, action_mmu2_eject_filament_4); END_MENU(); } @@ -139,10 +139,10 @@ void action_mmu2_reset() { void menu_mmu2() { START_MENU(); MENU_BACK(MSG_MAIN); - MENU_ITEM(submenu, MSG_MMU2_LOAD_FILAMENT, menu_mmu2_loadFilament); - MENU_ITEM(submenu, MSG_MMU2_LOAD_TO_NOZZLE, menu_mmu2_loadToNozzle); - MENU_ITEM(submenu, MSG_MMU2_EJECT_FILAMENT, menu_mmu2_ejectFilament); - MENU_ITEM(function, MSG_MMU2_UNLOAD_FILAMENT, action_mmu2_unloadFilament); + MENU_ITEM(submenu, MSG_MMU2_LOAD_FILAMENT, menu_mmu2_load_filament); + MENU_ITEM(submenu, MSG_MMU2_LOAD_TO_NOZZLE, menu_mmu2_load_to_nozzle); + MENU_ITEM(submenu, MSG_MMU2_EJECT_FILAMENT, menu_mmu2_eject_filament); + MENU_ITEM(function, MSG_MMU2_UNLOAD_FILAMENT, action_mmu2_unload_filament); MENU_ITEM(function, MSG_MMU2_RESET, action_mmu2_reset); END_MENU(); } @@ -161,7 +161,7 @@ inline void action_mmu2_choose2() { action_mmu2_choose(2); } inline void action_mmu2_choose3() { action_mmu2_choose(3); } inline void action_mmu2_choose4() { action_mmu2_choose(4); } -void menu_mmu2_chooseFilament() { +void menu_mmu2_choose_filament() { START_MENU(); #if LCD_HEIGHT > 2 STATIC_ITEM(MSG_MMU2_CHOOSE_FILAMENT_HEADER, true, true); @@ -178,21 +178,21 @@ void menu_mmu2_chooseFilament() { // MMU2 Filament Runout // -inline void action_mmu2_M600_loadCurrentFilament() { mmu2.loadFilament(currentTool); } -inline void action_mmu2_M600_loadCurrentFilamentToNozzle() { mmu2.loadFilamentToNozzle(currentTool); } -inline void action_mmu2_M600_unloadFilament() { mmu2.unload(); } +inline void action_mmu2_M600_load_current_filament() { mmu2.load_filament(currentTool); } +inline void action_mmu2_M600_load_current_filament_to_nozzle() { mmu2.load_filament_to_nozzle(currentTool); } +inline void action_mmu2_M600_unload_filament() { mmu2.unload(); } inline void action_mmu2_M600_resume() { mmuMenuWait = false; } void menu_mmu2_pause() { - currentTool = mmu2.getCurrentTool(); + currentTool = mmu2.get_current_tool(); START_MENU(); #if LCD_HEIGHT > 2 STATIC_ITEM(MSG_MMU2_FILAMENT_CHANGE_HEADER, true, true); #endif MENU_ITEM(function, MSG_MMU2_RESUME, action_mmu2_M600_resume); - MENU_ITEM(function, MSG_MMU2_UNLOAD_FILAMENT, action_mmu2_M600_unloadFilament); - MENU_ITEM(function, MSG_MMU2_LOAD_FILAMENT, action_mmu2_M600_loadCurrentFilament); - MENU_ITEM(function, MSG_MMU2_LOAD_TO_NOZZLE, action_mmu2_M600_loadCurrentFilamentToNozzle); + MENU_ITEM(function, MSG_MMU2_UNLOAD_FILAMENT, action_mmu2_M600_unload_filament); + MENU_ITEM(function, MSG_MMU2_LOAD_FILAMENT, action_mmu2_M600_load_current_filament); + MENU_ITEM(function, MSG_MMU2_LOAD_TO_NOZZLE, action_mmu2_M600_load_current_filament_to_nozzle); END_MENU(); } @@ -203,9 +203,9 @@ void mmu2_M600() { while (mmuMenuWait) idle(); } -uint8_t mmu2_chooseFilament() { +uint8_t mmu2_choose_filament() { ui.defer_status_screen(); - ui.goto_screen(menu_mmu2_chooseFilament); + ui.goto_screen(menu_mmu2_choose_filament); mmuMenuWait = true; while (mmuMenuWait) idle(); ui.return_to_status(); diff --git a/Marlin/src/lcd/menu/menu_mmu2.h b/Marlin/src/lcd/menu/menu_mmu2.h index fa9dff612c..ee14e1191c 100644 --- a/Marlin/src/lcd/menu/menu_mmu2.h +++ b/Marlin/src/lcd/menu/menu_mmu2.h @@ -25,4 +25,4 @@ void menu_mmu2(); void mmu2_M600(); -uint8_t mmu2_chooseFilament(); +uint8_t mmu2_choose_filament(); diff --git a/Marlin/src/lcd/menu/menu_motion.cpp b/Marlin/src/lcd/menu/menu_motion.cpp index 46670ccced..e6d7b8bc48 100644 --- a/Marlin/src/lcd/menu/menu_motion.cpp +++ b/Marlin/src/lcd/menu/menu_motion.cpp @@ -121,16 +121,16 @@ static void _lcd_move_xyz(PGM_P name, AxisEnum axis) { #endif // Get the new position - const float diff = float((int32_t)ui.encoderPosition) * move_menu_scale; + const float diff = float(int16_t(ui.encoderPosition)) * move_menu_scale; #if IS_KINEMATIC manual_move_offset += diff; - if ((int32_t)ui.encoderPosition < 0) + if (int16_t(ui.encoderPosition) < 0) NOLESS(manual_move_offset, min - current_position[axis]); else NOMORE(manual_move_offset, max - current_position[axis]); #else current_position[axis] += diff; - if ((int32_t)ui.encoderPosition < 0) + if (int16_t(ui.encoderPosition) < 0) NOLESS(current_position[axis], min); else NOMORE(current_position[axis], max); @@ -161,7 +161,7 @@ static void _lcd_move_e( ui.encoder_direction_normal(); if (ui.encoderPosition) { if (!ui.processing_manual_move) { - const float diff = float((int32_t)ui.encoderPosition) * move_menu_scale; + const float diff = float(int16_t(ui.encoderPosition)) * move_menu_scale; #if IS_KINEMATIC manual_move_offset += diff; #else @@ -335,7 +335,7 @@ void menu_move() { else MENU_ITEM(gcode, MSG_AUTO_HOME, PSTR("G28")); - #if EITHER(SWITCHING_EXTRUDER, SWITCHING_NOZZLE) + #if ANY(SWITCHING_EXTRUDER, SWITCHING_NOZZLE, MAGNETIC_SWITCHING_TOOLHEAD) #if EXTRUDERS == 6 switch (active_extruder) { @@ -465,7 +465,7 @@ void menu_motion() { #if DISABLED(PROBE_MANUALLY) MENU_ITEM(gcode, MSG_LEVEL_BED, PSTR("G28\nG29")); #endif - if (leveling_is_valid()) { + if (all_axes_homed() && leveling_is_valid()) { bool new_level_state = planner.leveling_active; MENU_ITEM_EDIT_CALLBACK(bool, MSG_BED_LEVELING, &new_level_state, _lcd_toggle_bed_leveling); } diff --git a/Marlin/src/lcd/menu/menu_sdcard.cpp b/Marlin/src/lcd/menu/menu_sdcard.cpp index 42ffc452a3..274643841f 100644 --- a/Marlin/src/lcd/menu/menu_sdcard.cpp +++ b/Marlin/src/lcd/menu/menu_sdcard.cpp @@ -47,10 +47,11 @@ void lcd_sd_updir() { #if ENABLED(SD_REPRINT_LAST_SELECTED_FILE) - uint32_t last_sdfile_encoderPosition = 0xFFFF; + uint16_t sd_encoder_position = 0xFFFF; + int8_t sd_top_line, sd_items; void MarlinUI::reselect_last_file() { - if (last_sdfile_encoderPosition == 0xFFFF) return; + if (sd_encoder_position == 0xFFFF) return; //#if HAS_GRAPHICAL_LCD // // This is a hack to force a screen update. // ui.refresh(LCDVIEW_CALL_REDRAW_NEXT); @@ -61,8 +62,8 @@ void lcd_sd_updir() { // ui.drawing_screen = screen_changed = true; //#endif - goto_screen(menu_sdcard, last_sdfile_encoderPosition); - last_sdfile_encoderPosition = 0xFFFF; + goto_screen(menu_sdcard, sd_encoder_position, sd_top_line, sd_items); + sd_encoder_position = 0xFFFF; defer_status_screen(); @@ -72,15 +73,44 @@ void lcd_sd_updir() { } #endif +inline void sdcard_start_selected_file() { + card.openAndPrintFile(card.filename); + ui.return_to_status(); + ui.reset_status(); +} + +#if ENABLED(SD_MENU_CONFIRM_START) + + bool do_print_file; + void menu_sd_confirm() { + if (ui.should_draw()) + do_select_screen(PSTR(MSG_BUTTON_PRINT), PSTR(MSG_BUTTON_CANCEL), do_print_file, PSTR(MSG_START_PRINT " "), card.longest_filename(), PSTR("?")); + + if (ui.use_click()) { + if (do_print_file) + sdcard_start_selected_file(); + else + ui.goto_previous_screen(); + } + } + +#endif + class MenuItem_sdfile { public: static void action(CardReader &theCard) { #if ENABLED(SD_REPRINT_LAST_SELECTED_FILE) - last_sdfile_encoderPosition = ui.encoderPosition; // Save which file was selected for later use + // Save menu state for the selected file + sd_encoder_position = ui.encoderPosition; + sd_top_line = encoderTopLine; + sd_items = screen_items; + #endif + #if ENABLED(SD_MENU_CONFIRM_START) + do_print_file = false; + MenuItem_submenu::action(menu_sd_confirm); + #else + sdcard_start_selected_file(); #endif - card.openAndPrintFile(theCard.filename); - ui.return_to_status(); - ui.reset_status(); } }; @@ -89,7 +119,7 @@ class MenuItem_sdfolder { static void action(CardReader &theCard) { card.chdir(theCard.filename); encoderTopLine = 0; - ui.encoderPosition = 2 * ENCODER_STEPS_PER_MENU_ITEM; + ui.encoderPosition = 2 * (ENCODER_STEPS_PER_MENU_ITEM); screen_changed = true; #if HAS_GRAPHICAL_LCD ui.drawing_screen = false; diff --git a/Marlin/src/lcd/menu/menu_tune.cpp b/Marlin/src/lcd/menu/menu_tune.cpp index b5853b25c2..1044b7076b 100644 --- a/Marlin/src/lcd/menu/menu_tune.cpp +++ b/Marlin/src/lcd/menu/menu_tune.cpp @@ -65,32 +65,60 @@ #if ENABLED(BABYSTEPPING) - long babysteps_done = 0; + #include "../../feature/babystep.h" + #include "../lcdprint.h" + #if HAS_GRAPHICAL_LCD + #include "../dogm/ultralcd_DOGM.h" + #endif - void _lcd_babystep(const AxisEnum axis, PGM_P msg) { + void _lcd_babystep(const AxisEnum axis, PGM_P const msg) { if (ui.use_click()) return ui.goto_previous_screen_no_defer(); ui.encoder_direction_normal(); if (ui.encoderPosition) { - const int16_t babystep_increment = (int32_t)ui.encoderPosition * (BABYSTEP_MULTIPLICATOR); + const int16_t steps = int16_t(ui.encoderPosition) * (BABYSTEP_MULTIPLICATOR); ui.encoderPosition = 0; ui.refresh(LCDVIEW_REDRAW_NOW); - thermalManager.babystep_axis(axis, babystep_increment); - babysteps_done += babystep_increment; + babystep.add_steps(axis, steps); } - if (ui.should_draw()) - draw_edit_screen(msg, ftostr43sign(planner.steps_to_mm[axis] * babysteps_done)); + if (ui.should_draw()) { + const float spm = planner.steps_to_mm[axis]; + draw_edit_screen(msg, ftostr54sign(spm * babystep.accum)); + #if ENABLED(BABYSTEP_DISPLAY_TOTAL) + const bool in_view = (true + #if HAS_GRAPHICAL_LCD + && PAGE_CONTAINS(LCD_PIXEL_HEIGHT - MENU_FONT_HEIGHT, LCD_PIXEL_HEIGHT - 1) + #endif + ); + if (in_view) { + #if HAS_GRAPHICAL_LCD + ui.set_font(FONT_MENU); + lcd_moveto(0, LCD_PIXEL_HEIGHT - MENU_FONT_DESCENT); + #else + lcd_moveto(0, LCD_HEIGHT - 1); + #endif + lcd_put_u8str_P(PSTR(MSG_BABYSTEP_TOTAL ":")); + lcd_put_u8str(ftostr54sign(spm * babystep.axis_total[BS_TOTAL_AXIS(axis)])); + } + #endif + } + } + + inline void _lcd_babystep_go(const screenFunc_t screen) { + ui.goto_screen(screen); + ui.defer_status_screen(); + babystep.accum = 0; } #if ENABLED(BABYSTEP_XY) void _lcd_babystep_x() { _lcd_babystep(X_AXIS, PSTR(MSG_BABYSTEP_X)); } void _lcd_babystep_y() { _lcd_babystep(Y_AXIS, PSTR(MSG_BABYSTEP_Y)); } - void lcd_babystep_x() { ui.goto_screen(_lcd_babystep_x); babysteps_done = 0; ui.defer_status_screen(); } - void lcd_babystep_y() { ui.goto_screen(_lcd_babystep_y); babysteps_done = 0; ui.defer_status_screen(); } + void lcd_babystep_x() { _lcd_babystep_go(_lcd_babystep_x); } + void lcd_babystep_y() { _lcd_babystep_go(_lcd_babystep_y); } #endif #if DISABLED(BABYSTEP_ZPROBE_OFFSET) void _lcd_babystep_z() { _lcd_babystep(Z_AXIS, PSTR(MSG_BABYSTEP_Z)); } - void lcd_babystep_z() { ui.goto_screen(_lcd_babystep_z); babysteps_done = 0; ui.defer_status_screen(); } + void lcd_babystep_z() { _lcd_babystep_go(_lcd_babystep_z); } #endif #endif // BABYSTEPPING diff --git a/Marlin/src/lcd/menu/menu_ubl.cpp b/Marlin/src/lcd/menu/menu_ubl.cpp index a7fa3cf641..9b7a5b5fa6 100644 --- a/Marlin/src/lcd/menu/menu_ubl.cpp +++ b/Marlin/src/lcd/menu/menu_ubl.cpp @@ -471,7 +471,7 @@ void _lcd_ubl_output_map_lcd() { ui.encoder_direction_normal(); if (ui.encoderPosition) { - step_scaler += (int32_t)ui.encoderPosition; + step_scaler += int16_t(ui.encoderPosition); x_plot += step_scaler / (ENCODER_STEPS_PER_MENU_ITEM); ui.encoderPosition = 0; ui.refresh(LCDVIEW_REDRAW_NOW); diff --git a/Marlin/src/lcd/ultralcd.cpp b/Marlin/src/lcd/ultralcd.cpp index 5b18ebc368..cb8b308df3 100644 --- a/Marlin/src/lcd/ultralcd.cpp +++ b/Marlin/src/lcd/ultralcd.cpp @@ -118,7 +118,7 @@ millis_t next_button_update_ms; // Encoder Handling #if HAS_ENCODER_ACTION - uint32_t MarlinUI::encoderPosition; + uint16_t MarlinUI::encoderPosition; volatile int8_t encoderDiff; // Updated in update_buttons, added to encoderPosition every LCD update #endif @@ -192,7 +192,25 @@ millis_t next_button_update_ms; #endif -#endif + void wrap_string(uint8_t y, const char * const string) { + uint8_t x = LCD_WIDTH; + if (string) { + uint8_t *p = (uint8_t*)string; + for (;;) { + if (x >= LCD_WIDTH) { + x = 0; + SETCURSOR(0, y++); + } + wchar_t ch; + p = get_utf8_value_cb(p, read_byte_ram, &ch); + if (!ch) break; + lcd_put_wchar(ch); + x++; + } + } + } + +#endif // HAS_LCD_MENU void MarlinUI::init() { @@ -462,13 +480,13 @@ void MarlinUI::status_screen() { #if ENABLED(ULTIPANEL_FEEDMULTIPLY) const int16_t old_frm = feedrate_percentage; - int16_t new_frm = old_frm + (int32_t)encoderPosition; + int16_t new_frm = old_frm + int16_t(encoderPosition); // Dead zone at 100% feedrate if (old_frm == 100) { - if ((int32_t)encoderPosition > ENCODER_FEEDRATE_DEADZONE) + if (int16_t(encoderPosition) > ENCODER_FEEDRATE_DEADZONE) new_frm -= ENCODER_FEEDRATE_DEADZONE; - else if ((int32_t)encoderPosition < -(ENCODER_FEEDRATE_DEADZONE)) + else if (int16_t(encoderPosition) < -(ENCODER_FEEDRATE_DEADZONE)) new_frm += ENCODER_FEEDRATE_DEADZONE; else new_frm = old_frm; @@ -809,10 +827,13 @@ void MarlinUI::update() { #if HAS_LCD_MENU && ENABLED(SCROLL_LONG_FILENAMES) // If scrolling of long file names is enabled and we are in the sd card menu, // cause a refresh to occur until all the text has scrolled into view. - if (currentScreen == menu_sdcard && filename_scroll_pos < filename_scroll_max && !lcd_status_update_delay--) { - lcd_status_update_delay = 6; + if (currentScreen == menu_sdcard && !lcd_status_update_delay--) { + lcd_status_update_delay = 4; + if (++filename_scroll_pos > filename_scroll_max) { + filename_scroll_pos = 0; + lcd_status_update_delay = 12; + } refresh(LCDVIEW_REDRAW_NOW); - filename_scroll_pos++; #if LCD_TIMEOUT_TO_STATUS return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS; #endif diff --git a/Marlin/src/lcd/ultralcd.h b/Marlin/src/lcd/ultralcd.h index df36256ba1..be694ddfe4 100644 --- a/Marlin/src/lcd/ultralcd.h +++ b/Marlin/src/lcd/ultralcd.h @@ -56,22 +56,24 @@ uint8_t get_ADC_keyValue(); #endif - #if HAS_GRAPHICAL_LCD - #define SETCURSOR(col, row) lcd_moveto(col * (MENU_FONT_WIDTH), (row + 1) * (MENU_FONT_HEIGHT)) - #define SETCURSOR_RJ(len, row) lcd_moveto(LCD_PIXEL_WIDTH - len * (MENU_FONT_WIDTH), (row + 1) * (MENU_FONT_HEIGHT)) - #define LCDPRINT(p) u8g.print(p) - #define LCDWRITE(c) u8g.print(c) - #else - #define SETCURSOR(col, row) lcd_moveto(col, row) - #define SETCURSOR_RJ(len, row) lcd_moveto(LCD_WIDTH - len, row) - #define LCDPRINT(p) lcd_put_u8str(p) - #define LCDWRITE(c) lcd_put_wchar(c) - #endif - #define LCD_UPDATE_INTERVAL 100 #if HAS_LCD_MENU + #if HAS_GRAPHICAL_LCD + #define SETCURSOR(col, row) lcd_moveto(col * (MENU_FONT_WIDTH), (row + 1) * (MENU_FONT_HEIGHT)) + #define SETCURSOR_RJ(len, row) lcd_moveto(LCD_PIXEL_WIDTH - (len) * (MENU_FONT_WIDTH), (row + 1) * (MENU_FONT_HEIGHT)) + #define LCDPRINT(p) u8g.print(p) + #define LCDWRITE(c) u8g.print(c) + #else + #define SETCURSOR(col, row) lcd_moveto(col, row) + #define SETCURSOR_RJ(len, row) lcd_moveto(LCD_WIDTH - (len), row) + #define LCDPRINT(p) lcd_put_u8str(p) + #define LCDWRITE(c) lcd_put_wchar(c) + #endif + + void wrap_string(uint8_t y, const char * const string); + #if ENABLED(SDSUPPORT) #include "../sd/cardreader.h" #endif @@ -419,7 +421,7 @@ public: static void synchronize(PGM_P const msg=NULL); static screenFunc_t currentScreen; - static void goto_screen(const screenFunc_t screen, const uint32_t encoder=0, const uint8_t top=0, const uint8_t items=0); + static void goto_screen(const screenFunc_t screen, const uint16_t encoder=0, const uint8_t top=0, const uint8_t items=0); static void save_previous_screen(); static void goto_previous_screen(); static void return_to_status(); @@ -494,7 +496,7 @@ public: static void wait_for_release(); #endif - static uint32_t encoderPosition; + static uint16_t encoderPosition; #if ENABLED(REVERSE_ENCODER_DIRECTION) #define ENCODERBASE -1 diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index c226c180aa..30f63ebed5 100644 --- a/Marlin/src/module/motion.cpp +++ b/Marlin/src/module/motion.cpp @@ -63,6 +63,10 @@ #include "../feature/fwretract.h" #endif +#if ENABLED(BABYSTEP_DISPLAY_TOTAL) + #include "../feature/babystep.h" +#endif + #define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE) #include "../core/debug_out.h" @@ -1316,6 +1320,14 @@ void set_axis_is_at_home(const AxisEnum axis) { } #endif + #if ENABLED(I2C_POSITION_ENCODERS) + I2CPEM.homed(axis); + #endif + + #if ENABLED(BABYSTEP_DISPLAY_TOTAL) + babystep.reset_total(axis); + #endif + if (DEBUGGING(LEVELING)) { #if HAS_HOME_OFFSET DEBUG_ECHOLNPAIR("> home_offset[", axis_codes[axis], "] = ", home_offset[axis]); @@ -1323,10 +1335,6 @@ void set_axis_is_at_home(const AxisEnum axis) { DEBUG_POS("", current_position); DEBUG_ECHOLNPAIR("<<< set_axis_is_at_home(", axis_codes[axis], ")"); } - - #if ENABLED(I2C_POSITION_ENCODERS) - I2CPEM.homed(axis); - #endif } /** diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index e7545ae8cc..d8bf25747e 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -44,7 +44,7 @@ #endif #if ENABLED(BABYSTEPPING) - #include "../module/motion.h" + #include "../feature/babystep.h" #if ENABLED(BABYSTEP_ALWAYS_AVAILABLE) #include "../gcode/gcode.h" #endif @@ -239,10 +239,6 @@ hotend_info_t Temperature::temp_hotend[HOTENDS]; // = { 0 } //hotend_pid_t Temperature::pid[HOTENDS]; #endif -#if ENABLED(BABYSTEPPING) - volatile int16_t Temperature::babystepsTodo[XYZ] = { 0 }; -#endif - #if ENABLED(PREVENT_COLD_EXTRUSION) bool Temperature::allow_cold_extrude = false; int16_t Temperature::extrude_min_temp = EXTRUDE_MINTEMP; @@ -2516,21 +2512,7 @@ void Temperature::isr() { // #if ENABLED(BABYSTEPPING) - #if EITHER(BABYSTEP_XY, I2C_POSITION_ENCODERS) - LOOP_XYZ(axis) { - const int16_t curTodo = babystepsTodo[axis]; // get rid of volatile for performance - if (curTodo) { - stepper.babystep((AxisEnum)axis, curTodo > 0); - if (curTodo > 0) babystepsTodo[axis]--; else babystepsTodo[axis]++; - } - } - #else - const int16_t curTodo = babystepsTodo[Z_AXIS]; - if (curTodo) { - stepper.babystep(Z_AXIS, curTodo > 0); - if (curTodo > 0) babystepsTodo[Z_AXIS]--; else babystepsTodo[Z_AXIS]++; - } - #endif + babystep.task(); #endif // Poll endstops state, if required @@ -2540,70 +2522,6 @@ void Temperature::isr() { planner.tick(); } -#if ENABLED(BABYSTEPPING) - - #if ENABLED(BABYSTEP_ALWAYS_AVAILABLE) - #define BSA_ENABLE(AXIS) do{ switch (AXIS) { case X_AXIS: enable_X(); break; case Y_AXIS: enable_Y(); break; case Z_AXIS: enable_Z(); } }while(0) - #else - #define BSA_ENABLE(AXIS) NOOP - #endif - - #if ENABLED(BABYSTEP_WITHOUT_HOMING) - #define CAN_BABYSTEP(AXIS) true - #else - #define CAN_BABYSTEP(AXIS) TEST(axis_known_position, AXIS) - #endif - - extern uint8_t axis_known_position; - - void Temperature::babystep_axis(const AxisEnum axis, const int16_t distance) { - if (!CAN_BABYSTEP(axis)) return; - #if IS_CORE - #if ENABLED(BABYSTEP_XY) - switch (axis) { - case CORE_AXIS_1: // X on CoreXY and CoreXZ, Y on CoreYZ - BSA_ENABLE(CORE_AXIS_1); - BSA_ENABLE(CORE_AXIS_2); - babystepsTodo[CORE_AXIS_1] += distance * 2; - babystepsTodo[CORE_AXIS_2] += distance * 2; - break; - case CORE_AXIS_2: // Y on CoreXY, Z on CoreXZ and CoreYZ - BSA_ENABLE(CORE_AXIS_1); - BSA_ENABLE(CORE_AXIS_2); - babystepsTodo[CORE_AXIS_1] += CORESIGN(distance * 2); - babystepsTodo[CORE_AXIS_2] -= CORESIGN(distance * 2); - break; - case NORMAL_AXIS: // Z on CoreXY, Y on CoreXZ, X on CoreYZ - default: - BSA_ENABLE(NORMAL_AXIS); - babystepsTodo[NORMAL_AXIS] += distance; - break; - } - #elif CORE_IS_XZ || CORE_IS_YZ - // Only Z stepping needs to be handled here - BSA_ENABLE(CORE_AXIS_1); - BSA_ENABLE(CORE_AXIS_2); - babystepsTodo[CORE_AXIS_1] += CORESIGN(distance * 2); - babystepsTodo[CORE_AXIS_2] -= CORESIGN(distance * 2); - #else - BSA_ENABLE(Z_AXIS); - babystepsTodo[Z_AXIS] += distance; - #endif - #else - #if ENABLED(BABYSTEP_XY) - BSA_ENABLE(axis); - #else - BSA_ENABLE(Z_AXIS); - #endif - babystepsTodo[axis] += distance; - #endif - #if ENABLED(BABYSTEP_ALWAYS_AVAILABLE) - gcode.reset_stepper_timeout(); - #endif - } - -#endif // BABYSTEPPING - #if HAS_TEMP_SENSOR #include "../gcode/gcode.h" diff --git a/Marlin/src/module/temperature.h b/Marlin/src/module/temperature.h index 6de0bba660..a8cfad34b3 100644 --- a/Marlin/src/module/temperature.h +++ b/Marlin/src/module/temperature.h @@ -266,10 +266,6 @@ class Temperature { soft_pwm_count_fan[FAN_COUNT]; #endif - #if ENABLED(BABYSTEPPING) - static volatile int16_t babystepsTodo[3]; - #endif - #if ENABLED(PREVENT_COLD_EXTRUSION) static bool allow_cold_extrude; static int16_t extrude_min_temp; @@ -689,10 +685,6 @@ class Temperature { #endif - #if ENABLED(BABYSTEPPING) - static void babystep_axis(const AxisEnum axis, const int16_t distance); - #endif - #if ENABLED(PROBING_HEATERS_OFF) static void pause(const bool p); FORCE_INLINE static bool is_paused() { return paused; } diff --git a/Marlin/src/module/tool_change.cpp b/Marlin/src/module/tool_change.cpp index 231f2c7969..9108a23ab4 100644 --- a/Marlin/src/module/tool_change.cpp +++ b/Marlin/src/module/tool_change.cpp @@ -121,7 +121,7 @@ void move_nozzle_servo(const uint8_t angle_index) { planner.synchronize(); - MOVE_SERVO(SWITCHING_NOZZLE_SERVO_NR, servo_angles[SWITCHING_NOZZLE_SERVO_NR][e]); + MOVE_SERVO(SWITCHING_NOZZLE_SERVO_NR, servo_angles[SWITCHING_NOZZLE_SERVO_NR][angle_index]); safe_delay(500); } @@ -369,12 +369,6 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { pe_activate_solenoid(active_extruder); // Just save power for inverted magnets #endif } - - #if HAS_HOTEND_OFFSET - current_position[Z_AXIS] += hotend_offset[Z_AXIS][active_extruder] - hotend_offset[Z_AXIS][tmp_extruder]; - #endif - - if (DEBUGGING(LEVELING)) DEBUG_POS("Applying Z-offset", current_position); } #endif // PARKING_EXTRUDER @@ -493,6 +487,133 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { #endif // SWITCHING_TOOLHEAD +#if ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + + inline void magnetic_switching_toolhead_tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool no_move/*=false*/) { + if (no_move) return; + + const float toolheadposx[] = SWITCHING_TOOLHEAD_X_POS, + placexpos = toolheadposx[active_extruder], + grabxpos = toolheadposx[tmp_extruder]; + + /** + * 1. Raise Z to give enough clearance + * 2. Move to switch position of current toolhead + * 3. Release and place toolhead in the dock + * 4. Move to the new toolhead + * 5. Grab the new toolhead and move to security position + */ + + if (DEBUGGING(LEVELING)) DEBUG_POS("Starting Toolhead change", current_position); + + // 1. Raise Z to give enough clearance + + current_position[Z_AXIS] += toolchange_settings.z_raise; + + if (DEBUGGING(LEVELING)) DEBUG_POS("(1) Raise Z-Axis", current_position); + + planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[Z_AXIS], active_extruder); + planner.synchronize(); + + // 2. Move to switch position current toolhead + + current_position[Y_AXIS] = SWITCHING_TOOLHEAD_Y_POS + SWITCHING_TOOLHEAD_Y_CLEAR; + + if (DEBUGGING(LEVELING)) { + SERIAL_ECHOLNPAIR("(2) Place old tool ", int(active_extruder)); + DEBUG_POS("Move Y SwitchPos + Security", current_position); + } + + planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[Y_AXIS], active_extruder); + planner.synchronize(); + + current_position[X_AXIS] = placexpos + SWITCHING_TOOLHEAD_X_SECURITY; + + if (DEBUGGING(LEVELING)) DEBUG_POS("Move X SwitchPos + Security", current_position); + + planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[X_AXIS], active_extruder); + planner.synchronize(); + + current_position[Y_AXIS] = SWITCHING_TOOLHEAD_Y_POS; + + if (DEBUGGING(LEVELING)) DEBUG_POS("Move Y SwitchPos", current_position); + + planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[Y_AXIS], active_extruder); + planner.synchronize(); + + current_position[X_AXIS] = placexpos; + + if (DEBUGGING(LEVELING)) DEBUG_POS("Move X SwitchPos", current_position); + + planner.buffer_line(current_position, (planner.settings.max_feedrate_mm_s[X_AXIS] * 0.25), active_extruder); + planner.synchronize(); + + // 3. Release and place toolhead in the dock + + if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("(3) Release and Place Toolhead"); + + current_position[Y_AXIS] = SWITCHING_TOOLHEAD_Y_POS + SWITCHING_TOOLHEAD_Y_RELEASE; + + if (DEBUGGING(LEVELING)) DEBUG_POS("Move Y SwitchPos + Release", current_position); + + planner.buffer_line(current_position, (planner.settings.max_feedrate_mm_s[Y_AXIS] * 0.1), active_extruder); + planner.synchronize(); + + current_position[Y_AXIS] = SWITCHING_TOOLHEAD_Y_POS + SWITCHING_TOOLHEAD_Y_SECURITY; + + if (DEBUGGING(LEVELING)) DEBUG_POS("Move Y SwitchPos + Security", current_position); + + planner.buffer_line(current_position, (planner.settings.max_feedrate_mm_s[Y_AXIS]), active_extruder); + planner.synchronize(); + + // 4. Move to new toolhead position + + if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("(4) Move to new toolhead position"); + + current_position[X_AXIS] = grabxpos; + + if (DEBUGGING(LEVELING)) DEBUG_POS("Move to new toolhead X", current_position); + + planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[X_AXIS], active_extruder); + planner.synchronize(); + + // 5. Grab the new toolhead and move to security position + + if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("(5) Grab new toolhead and move to security position"); + + current_position[Y_AXIS] = SWITCHING_TOOLHEAD_Y_POS + SWITCHING_TOOLHEAD_Y_RELEASE; + + if (DEBUGGING(LEVELING)) DEBUG_POS("Move Y SwitchPos + Release", current_position); + + planner.buffer_line(current_position, (planner.settings.max_feedrate_mm_s[Y_AXIS]), active_extruder); + planner.synchronize(); + + current_position[Y_AXIS] = SWITCHING_TOOLHEAD_Y_POS; + + if (DEBUGGING(LEVELING)) DEBUG_POS("Move Y SwitchPos", current_position); + + planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[Y_AXIS] * 0.2, active_extruder); + planner.synchronize(); + safe_delay(100); + + current_position[X_AXIS] = grabxpos + SWITCHING_TOOLHEAD_X_SECURITY; + + if (DEBUGGING(LEVELING)) DEBUG_POS("Move to new toolhead X + Security", current_position); + + planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[X_AXIS] * 0.1, active_extruder); + planner.synchronize(); + safe_delay(100); + + current_position[Y_AXIS] += SWITCHING_TOOLHEAD_Y_CLEAR; + + if (DEBUGGING(LEVELING)) DEBUG_POS("Move back Y clear", current_position); + + planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[Y_AXIS], active_extruder); // move away from docked toolhead + planner.synchronize(); + } + +#endif // MAGNETIC_SWITCHING_TOOLHEAD + inline void invalid_extruder_error(const uint8_t e) { SERIAL_ECHO_START(); SERIAL_CHAR('T'); SERIAL_ECHO(int(e)); @@ -525,10 +646,6 @@ inline void invalid_extruder_error(const uint8_t e) { planner.synchronize(); } - // Apply Y & Z extruder offset (X offset is used as home pos with Dual X) - current_position[Y_AXIS] -= hotend_offset[Y_AXIS][active_extruder] - hotend_offset[Y_AXIS][tmp_extruder]; - current_position[Z_AXIS] -= hotend_offset[Z_AXIS][active_extruder] - hotend_offset[Z_AXIS][tmp_extruder]; - // Activate the new extruder ahead of calling set_axis_is_at_home! active_extruder = tmp_extruder; @@ -567,6 +684,11 @@ inline void invalid_extruder_error(const uint8_t e) { * previous tool out of the way and the new tool into place. */ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool no_move/*=false*/) { + + #if ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + if (tmp_extruder == active_extruder) return; + #endif + #if ENABLED(MIXING_EXTRUDER) UNUSED(fr_mm_s); UNUSED(no_move); @@ -583,7 +705,7 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n UNUSED(fr_mm_s); UNUSED(no_move); - mmu2.toolChange(tmp_extruder); + mmu2.tool_change(tmp_extruder); #elif EXTRUDERS < 2 @@ -696,6 +818,8 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n magnetic_parking_extruder_tool_change(tmp_extruder); #elif ENABLED(SWITCHING_TOOLHEAD) // Switching Toolhead switching_toolhead_tool_change(tmp_extruder, fr_mm_s, no_move); + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) // Magnetic Switching Toolhead + magnetic_switching_toolhead_tool_change(tmp_extruder, fr_mm_s, no_move); #elif ENABLED(SWITCHING_NOZZLE) && !SWITCHING_NOZZLE_TWO_SERVOS // Raise by a configured distance to avoid workpiece, except with // SWITCHING_NOZZLE_TWO_SERVOS, as both nozzles will lift instead. @@ -765,7 +889,16 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n #endif // Prevent a move outside physical bounds - apply_motion_limits(destination); + #if ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + // If the original position is within tool store area, go to X origin at once + if (destination[Y_AXIS] < SWITCHING_TOOLHEAD_Y_POS + SWITCHING_TOOLHEAD_Y_CLEAR) { + current_position[X_AXIS] = 0; + planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[X_AXIS], active_extruder); + planner.synchronize(); + } + #else + apply_motion_limits(destination); + #endif // Move back to the original (or tweaked) position do_blocking_move_to(destination); @@ -783,27 +916,13 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n #endif #if ENABLED(PRUSA_MMU2) - mmu2.toolChange(tmp_extruder); + mmu2.tool_change(tmp_extruder); #endif #if SWITCHING_NOZZLE_TWO_SERVOS lower_nozzle(active_extruder); #endif - #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) && ADVANCED_PAUSE_RESUME_PRIME != 0 - if (should_swap && !too_cold) { - const float resume_eaxis = current_position[E_AXIS]; - #if ENABLED(ADVANCED_PAUSE_FEATURE) - do_pause_e_move(toolchange_settings.swap_length, toolchange_settings.prime_speed); - #else - current_position[E_AXIS] += (ADVANCED_PAUSE_RESUME_PRIME) / planner.e_factor[active_extruder]; - planner.buffer_line(current_position, ADVANCED_PAUSE_PURGE_FEEDRATE, active_extruder); - #endif - planner.synchronize(); - planner.set_e_position_mm((destination[E_AXIS] = current_position[E_AXIS] = resume_eaxis)); - } - #endif - } // (tmp_extruder != active_extruder) planner.synchronize(); diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 19afa1c550..68de292c0c 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -305,39 +305,41 @@ // #elif MB(RAMPS_14_RE_ARM_EFB) - #include "pins_RAMPS_RE_ARM.h" // LPC1768 env:LPC1768 + #include "pins_RAMPS_RE_ARM.h" // LPC1768 env:LPC1768 #elif MB(RAMPS_14_RE_ARM_EEB) - #include "pins_RAMPS_RE_ARM.h" // LPC1768 env:LPC1768 + #include "pins_RAMPS_RE_ARM.h" // LPC1768 env:LPC1768 #elif MB(RAMPS_14_RE_ARM_EFF) - #include "pins_RAMPS_RE_ARM.h" // LPC1768 env:LPC1768 + #include "pins_RAMPS_RE_ARM.h" // LPC1768 env:LPC1768 #elif MB(RAMPS_14_RE_ARM_EEF) - #include "pins_RAMPS_RE_ARM.h" // LPC1768 env:LPC1768 + #include "pins_RAMPS_RE_ARM.h" // LPC1768 env:LPC1768 #elif MB(RAMPS_14_RE_ARM_SF) - #include "pins_RAMPS_RE_ARM.h" // LPC1768 env:LPC1768 + #include "pins_RAMPS_RE_ARM.h" // LPC1768 env:LPC1768 #elif MB(MKS_SBASE) - #include "pins_MKS_SBASE.h" // LPC1768 env:LPC1768 + #include "pins_MKS_SBASE.h" // LPC1768 env:LPC1768 #elif MB(AZSMZ_MINI) - #include "pins_AZSMZ_MINI.h" // LPC1768 env:LPC1768 + #include "pins_AZSMZ_MINI.h" // LPC1768 env:LPC1768 #elif MB(AZTEEG_X5_GT) - #include "pins_AZTEEG_X5_GT.h" // LPC1769 env:LPC1769 + #include "pins_AZTEEG_X5_GT.h" // LPC1769 env:LPC1769 +#elif MB(AZTEEG_X5_MINI) + #include "pins_AZTEEG_X5_MINI.h" // LPC1769 env:LPC1769 #elif MB(AZTEEG_X5_MINI_WIFI) - #include "pins_AZTEEG_X5_MINI_WIFI.h" // LPC1769 env:LPC1769 + #include "pins_AZTEEG_X5_MINI_WIFI.h" // LPC1769 env:LPC1769 #elif MB(BIQU_BQ111_A4) - #include "pins_BIQU_BQ111_A4.h" // LPC1768 env:LPC1768 + #include "pins_BIQU_BQ111_A4.h" // LPC1768 env:LPC1768 #elif MB(SELENA_COMPACT) - #include "pins_SELENA_COMPACT.h" // LPC1768 env:LPC1768 + #include "pins_SELENA_COMPACT.h" // LPC1768 env:LPC1768 #elif MB(COHESION3D_REMIX) - #include "pins_COHESION3D_REMIX.h" // LPC1769 env:LPC1769 + #include "pins_COHESION3D_REMIX.h" // LPC1769 env:LPC1769 #elif MB(COHESION3D_MINI) - #include "pins_COHESION3D_MINI.h" // LPC1769 env:LPC1769 + #include "pins_COHESION3D_MINI.h" // LPC1769 env:LPC1769 #elif MB(SMOOTHIEBOARD) - #include "pins_SMOOTHIEBOARD.h" // LPC1769 env:LPC1769 + #include "pins_SMOOTHIEBOARD.h" // LPC1769 env:LPC1769 #elif MB(BIQU_SKR_V1_1) - #include "pins_BIQU_SKR_V1.1.h" // LPC1768 env:LPC1768 + #include "pins_BIQU_SKR_V1.1.h" // LPC1768 env:LPC1768 #elif MB(BIQU_B300_V1_0) - #include "pins_BIQU_B300_V1.0.h" // LPC1768 env:LPC1768 + #include "pins_BIQU_B300_V1.0.h" // LPC1768 env:LPC1768 #elif MB(BIGTREE_SKR_V1_3) - #include "pins_BIGTREE_SKR_V1.3.h" // LPC1768 env:LPC1768 + #include "pins_BIGTREE_SKR_V1.3.h" // LPC1768 env:LPC1768 // // Other 32-bit Boards @@ -417,7 +419,7 @@ #elif MB(MORPHEUS) #include "pins_MORPHEUS.h" // STM32F1 env:STM32F1 #elif MB(MKS_ROBIN) - #include "pins_MKS_ROBIN.h" // STM32F1 env:STM32F1 + #include "pins_MKS_ROBIN.h" // STM32F1 env:mks_robin // // STM32 ARM Cortex-M4F @@ -435,9 +437,13 @@ #include "pins_ARMED.h" // STM32F4 env:ARMED #elif MB(RUMBA32) #include "pins_RUMBA32.h" // STM32F4 env:RUMBA32 +#elif MB(BLACK_STM32F407VE) + #include "pins_BLACK_STM32F407VE.h" // STM32F4 env:black_stm32f407ve #elif MB(STEVAL) #include "pins_STEVAL.h" // STM32F4 env:STM32F4 + + // // ARM Cortex M7 // diff --git a/Marlin/src/pins/pinsDebug.h b/Marlin/src/pins/pinsDebug.h index a8003fcd97..2cf896abbb 100644 --- a/Marlin/src/pins/pinsDebug.h +++ b/Marlin/src/pins/pinsDebug.h @@ -102,6 +102,9 @@ const PinInfo pin_array[] PROGMEM = { #include HAL_PATH(../HAL, pinsDebug.h) // get the correct support file for this CPU +#ifndef M43_NEVER_TOUCH + #define M43_NEVER_TOUCH(Q) false +#endif static void print_input_or_output(const bool isout) { serialprintPGM(isout ? PSTR("Output = ") : PSTR("Input = ")); diff --git a/Marlin/src/pins/pinsDebug_list.h b/Marlin/src/pins/pinsDebug_list.h index 533a945447..c03bd1db36 100644 --- a/Marlin/src/pins/pinsDebug_list.h +++ b/Marlin/src/pins/pinsDebug_list.h @@ -788,8 +788,8 @@ #if PIN_EXISTS(SPINDLE_ENABLE) REPORT_NAME_DIGITAL(__LINE__, SPINDLE_ENABLE_PIN) #endif -#if PIN_EXISTS(SPINDLE_LASER_ENABLE) - REPORT_NAME_DIGITAL(__LINE__, SPINDLE_LASER_ENABLE_PIN) +#if PIN_EXISTS(SPINDLE_LASER_ENA) + REPORT_NAME_DIGITAL(__LINE__, SPINDLE_LASER_ENA_PIN) #endif #if PIN_EXISTS(SPINDLE_LASER_PWM) REPORT_NAME_DIGITAL(__LINE__, SPINDLE_LASER_PWM_PIN) diff --git a/Marlin/src/pins/pins_3DRAG.h b/Marlin/src/pins/pins_3DRAG.h index d84edb3c49..6d32ada052 100644 --- a/Marlin/src/pins/pins_3DRAG.h +++ b/Marlin/src/pins/pins_3DRAG.h @@ -124,7 +124,7 @@ * * stepper signal socket name socket name * ------- - * SPINDLE_LASER_ENABLE_PIN /ENABLE O| |O VMOT + * SPINDLE_LASER_ENA_PIN /ENABLE O| |O VMOT * MS1 O| |O GND * MS2 O| |O 2B * MS3 O| |O 2A @@ -137,7 +137,7 @@ * Note: Socket names vary from vendor to vendor */ #undef SPINDLE_LASER_PWM_PIN // Definitions in pins_RAMPS.h are not good with 3DRAG -#undef SPINDLE_LASER_ENABLE_PIN +#undef SPINDLE_LASER_ENA_PIN #undef SPINDLE_DIR_PIN #if ENABLED(SPINDLE_LASER_ENABLE) @@ -152,10 +152,10 @@ #define Z_ENABLE_PIN 24 #define Z_STEP_PIN 26 #define SPINDLE_LASER_PWM_PIN 46 // MUST BE HARDWARE PWM - #define SPINDLE_LASER_ENABLE_PIN 62 // Pin should have a pullup! + #define SPINDLE_LASER_ENA_PIN 62 // Pin should have a pullup! #define SPINDLE_DIR_PIN 48 #elif !BOTH(ULTRA_LCD, NEWPANEL) // use expansion header if no LCD in use - #define SPINDLE_LASER_ENABLE_PIN 16 // Pin should have a pullup/pulldown! + #define SPINDLE_LASER_ENA_PIN 16 // Pin should have a pullup/pulldown! #define SPINDLE_DIR_PIN 17 #endif #endif diff --git a/Marlin/src/pins/pins_5DPRINT.h b/Marlin/src/pins/pins_5DPRINT.h index f8184f567e..9eb36ba621 100644 --- a/Marlin/src/pins/pins_5DPRINT.h +++ b/Marlin/src/pins/pins_5DPRINT.h @@ -142,4 +142,6 @@ #define SDSS 20 // B0 //DIGIPOTS slave addresses -#define DIGIPOT_I2C_ADDRESS_A 0x2C // unshifted slave address for DIGIPOT 0x2C (0x58 <- 0x2C << 1) +#ifndef DIGIPOT_I2C_ADDRESS_A + #define DIGIPOT_I2C_ADDRESS_A 0x2C // unshifted slave address for DIGIPOT 0x2C (0x58 <- 0x2C << 1) +#endif diff --git a/Marlin/src/pins/pins_AZTEEG_X3.h b/Marlin/src/pins/pins_AZTEEG_X3.h index f86d7ecbc2..fe5cb627a9 100644 --- a/Marlin/src/pins/pins_AZTEEG_X3.h +++ b/Marlin/src/pins/pins_AZTEEG_X3.h @@ -83,7 +83,7 @@ // M3/M4/M5 - Spindle/Laser Control // #undef SPINDLE_LASER_PWM_PIN // Definitions in pins_RAMPS.h are no good with the AzteegX3 board -#undef SPINDLE_LASER_ENABLE_PIN +#undef SPINDLE_LASER_ENA_PIN #undef SPINDLE_DIR_PIN #if ENABLED(SPINDLE_LASER_ENABLE) @@ -94,6 +94,6 @@ #define SERVO0_PIN 11 #endif #define SPINDLE_LASER_PWM_PIN 7 // MUST BE HARDWARE PWM - #define SPINDLE_LASER_ENABLE_PIN 20 // Pin should have a pullup! + #define SPINDLE_LASER_ENA_PIN 20 // Pin should have a pullup! #define SPINDLE_DIR_PIN 21 #endif diff --git a/Marlin/src/pins/pins_AZTEEG_X3_PRO.h b/Marlin/src/pins/pins_AZTEEG_X3_PRO.h index ea72af04da..55ee39f84f 100644 --- a/Marlin/src/pins/pins_AZTEEG_X3_PRO.h +++ b/Marlin/src/pins/pins_AZTEEG_X3_PRO.h @@ -48,8 +48,12 @@ #include "pins_RAMPS.h" // DIGIPOT slave addresses -#define DIGIPOT_I2C_ADDRESS_A 0x2C // unshifted slave address for first DIGIPOT 0x2C (0x58 <- 0x2C << 1) -#define DIGIPOT_I2C_ADDRESS_B 0x2E // unshifted slave address for second DIGIPOT 0x2E (0x5C <- 0x2E << 1) +#ifndef DIGIPOT_I2C_ADDRESS_A + #define DIGIPOT_I2C_ADDRESS_A 0x2C // unshifted slave address for first DIGIPOT 0x2C (0x58 <- 0x2C << 1) +#endif +#ifndef DIGIPOT_I2C_ADDRESS_B + #define DIGIPOT_I2C_ADDRESS_B 0x2E // unshifted slave address for second DIGIPOT 0x2E (0x5C <- 0x2E << 1) +#endif // // Servos @@ -162,7 +166,7 @@ // M3/M4/M5 - Spindle/Laser Control // #undef SPINDLE_LASER_PWM_PIN // Definitions in pins_RAMPS.h are no good with the AzteegX3pro board -#undef SPINDLE_LASER_ENABLE_PIN +#undef SPINDLE_LASER_ENA_PIN #undef SPINDLE_DIR_PIN #if ENABLED(SPINDLE_LASER_ENABLE) // EXP2 header @@ -171,6 +175,6 @@ #define BTN_EN2 31 // need 7 for the spindle speed PWM #endif #define SPINDLE_LASER_PWM_PIN 7 // must have a hardware PWM - #define SPINDLE_LASER_ENABLE_PIN 20 // Pin should have a pullup! + #define SPINDLE_LASER_ENA_PIN 20 // Pin should have a pullup! #define SPINDLE_DIR_PIN 21 #endif diff --git a/Marlin/src/pins/pins_AZTEEG_X5_MINI.h b/Marlin/src/pins/pins_AZTEEG_X5_MINI.h new file mode 100644 index 0000000000..91349c0f6e --- /dev/null +++ b/Marlin/src/pins/pins_AZTEEG_X5_MINI.h @@ -0,0 +1,218 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2019 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 . + * + */ + +/** + * Azteeg X5 MINI pin assignments + */ + +#ifndef LPC1769 + #error "Oops! Make sure you have the LPC1769 environment selected in your IDE." +#endif + +#ifndef BOARD_NAME + #define BOARD_NAME "Azteeg X5 MINI" +#endif +#define BOARD_WEBSITE_URL "http://www.panucatt.com/azteeg_X5_mini_reprap_3d_printer_controller_p/ax5mini.htm" + +// +// LED +// +#define LED_PIN P1_18 + +// +// Servos +// +#define SERVO0_PIN P1_29 + +// +// Limit Switches +// +#define X_STOP_PIN P1_24 +#define Y_STOP_PIN P1_26 +#define Z_STOP_PIN P1_28 + +#ifndef FILWIDTH_PIN + #define FILWIDTH_PIN P2_04 +#endif + +// +// Steppers +// +#define X_STEP_PIN P2_01 +#define X_DIR_PIN P0_11 +#define X_ENABLE_PIN P0_10 + +#define Y_STEP_PIN P2_02 +#define Y_DIR_PIN P0_20 +#define Y_ENABLE_PIN P0_19 + +#define Z_STEP_PIN P2_03 +#define Z_DIR_PIN P0_22 +#define Z_ENABLE_PIN P0_21 + +#define E0_STEP_PIN P2_00 +#define E0_DIR_PIN P0_05 +#define E0_ENABLE_PIN P0_04 + +// +// DIGIPOT slave addresses +// +#ifndef DIGIPOT_I2C_ADDRESS_A + #define DIGIPOT_I2C_ADDRESS_A 0x2C // unshifted slave address for first DIGIPOT +#endif + +#ifndef DIGIPOT_I2C_ADDRESS_B + #define DIGIPOT_I2C_ADDRESS_B 0x2E // unshifted slave address for second DIGIPOT +#endif + +// +// Temperature Sensors +// 3.3V max when defined as an analog input +// +#define TEMP_BED_PIN 0 // A0 (TH1) +#define TEMP_0_PIN 1 // A1 (TH2) + +// +// Heaters / Fans +// +#define HEATER_BED_PIN P2_07 +#define HEATER_0_PIN P2_05 +#ifndef FAN_PIN + #define FAN_PIN P0_26 +#endif +#define FAN1_PIN P1_25 + +// +// Display +// +#if ENABLED(ULTRA_LCD) + + #if ENABLED(CR10_STOCKDISPLAY) + + // Re-Arm can support Creality stock display without SD card reader and single cable on EXP3. + // Re-Arm J3 pins 1 (p1.31) & 2 (P3.26) are not used. Stock cable will need to have one + // 10-pin IDC connector trimmed or replaced with a 12-pin IDC connector to fit J3. + // Requires REVERSE_ENCODER_DIRECTION in Configuration.h + + #define BEEPER_PIN P2_11 // J3-3 & AUX-4 + + #define BTN_EN1 P0_16 // J3-7 & AUX-4 + #define BTN_EN2 P1_23 // J3-5 & AUX-4 + #define BTN_ENC P3_25 // J3-4 & AUX-4 + + #define LCD_PINS_RS P0_15 // J3-9 & AUX-4 (CS) + #define LCD_PINS_ENABLE P0_18 // J3-10 & AUX-3 (SID, MOSI) + #define LCD_PINS_D4 P2_06 // J3-8 & AUX-3 (SCK, CLK) + + #else + + #define BTN_EN1 P3_26 // (31) J3-2 & AUX-4 + #define BTN_EN2 P3_25 // (33) J3-4 & AUX-4 + #define BTN_ENC P2_11 // (35) J3-3 & AUX-4 + + #define SD_DETECT_PIN P1_31 // (49) not 5V tolerant J3-1 & AUX-3 + #define KILL_PIN P1_22 // (41) J5-4 & AUX-4 + #define LCD_PINS_RS P0_16 // (16) J3-7 & AUX-4 + #define LCD_SDSS P0_16 // (16) J3-7 & AUX-4 + #define LCD_BACKLIGHT_PIN P0_16 // (16) J3-7 & AUX-4 - only used on DOGLCD controllers + #define LCD_PINS_ENABLE P0_18 // (51) (MOSI) J3-10 & AUX-3 + #define LCD_PINS_D4 P0_15 // (52) (SCK) J3-9 & AUX-3 + + #define DOGLCD_A0 P2_06 // (59) J3-8 & AUX-2 + + #if ENABLED(REPRAPWORLD_KEYPAD) + #define SHIFT_OUT P0_18 // (51) (MOSI) J3-10 & AUX-3 + #define SHIFT_CLK P0_15 // (52) (SCK) J3-9 & AUX-3 + #define SHIFT_LD P1_31 // (49) not 5V tolerant J3-1 & AUX-3 + #elif DISABLED(NEWPANEL) + //#define SHIFT_OUT P2_11 // (35) J3-3 & AUX-4 + //#define SHIFT_CLK P3_26 // (31) J3-2 & AUX-4 + //#define SHIFT_LD P3_25 // (33) J3-4 & AUX-4 + //#define SHIFT_EN P1_22 // (41) J5-4 & AUX-4 + #endif + + #if ANY(VIKI2, miniVIKI) + //#define LCD_SCREEN_ROT_180 + + #define BEEPER_PIN P1_30 // (37) may change if cable changes + #define DOGLCD_CS P0_26 // (63) J5-3 & AUX-2 + #define DOGLCD_SCK SCK_PIN + #define DOGLCD_MOSI MOSI_PIN + + #define STAT_LED_BLUE_PIN P0_26 // (63) may change if cable changes + #define STAT_LED_RED_PIN P1_21 // ( 6) may change if cable changes + #else + #if ENABLED(ULTIPANEL) + #define LCD_PINS_D5 P1_17 // (71) ENET_MDIO + #define LCD_PINS_D6 P1_14 // (73) ENET_RX_ER + #define LCD_PINS_D7 P1_10 // (75) ENET_RXD1 + #endif + #define BEEPER_PIN P1_30 // (37) not 5V tolerant + #define DOGLCD_CS P0_16 // (16) + #endif + + #if ENABLED(MINIPANEL) + // GLCD features + // Uncomment screen orientation + //#define LCD_SCREEN_ROT_90 + //#define LCD_SCREEN_ROT_180 + //#define LCD_SCREEN_ROT_270 + #endif + + #endif + +#endif // ULTRA_LCD + +// +// SD Support +// +//#define USB_SD_DISABLED // Disable host access to SD card as mass storage device through USB +//#define USB_SD_ONBOARD // Enable host access to SD card as mass storage device through USB + +//#define LPC_SD_LCD // Marlin uses the SD drive attached to the LCD +#define LPC_SD_ONBOARD // Marlin uses the SD drive on the control board. There is no SD detect pin + // for the onboard card. Init card from LCD menu or send M21 whenever printer + // is powered on to enable SD access. + +#if ENABLED(LPC_SD_LCD) + + #define SCK_PIN P0_15 + #define MISO_PIN P0_17 + #define MOSI_PIN P0_18 + #define SS_PIN P1_23 // Chip select for SD card used by Marlin + #define ONBOARD_SD_CS P0_06 // Chip select for "System" SD card + +#elif ENABLED(LPC_SD_ONBOARD) + + #if ENABLED(USB_SD_ONBOARD) + // When sharing the SD card with a PC we want the menu options to + // mount/unmount the card and refresh it. So we disable card detect. + #define SHARED_SD_CARD + #undef SD_DETECT_PIN // there is also no detect pin for the onboard card + #endif + #define SCK_PIN P0_07 + #define MISO_PIN P0_08 + #define MOSI_PIN P0_09 + #define SS_PIN P0_06 // Chip select for SD card used by Marlin + #define ONBOARD_SD_CS P0_06 // Chip select for "System" SD card + +#endif diff --git a/Marlin/src/pins/pins_AZTEEG_X5_MINI_WIFI.h b/Marlin/src/pins/pins_AZTEEG_X5_MINI_WIFI.h index b71cf0e530..760e0d76de 100644 --- a/Marlin/src/pins/pins_AZTEEG_X5_MINI_WIFI.h +++ b/Marlin/src/pins/pins_AZTEEG_X5_MINI_WIFI.h @@ -29,183 +29,15 @@ #endif #define BOARD_NAME "Azteeg X5 MINI WIFI" -#define BOARD_WEBSITE_URL "http://www.panucatt.com/azteeg_X5_mini_reprap_3d_printer_controller_p/ax5mini.htm" - -// -// LED -// -#define LED_PIN P1_18 - -// -// Servos -// -#define SERVO0_PIN P1_29 - -// -// Limit Switches -// -#define X_STOP_PIN P1_24 -#define Y_STOP_PIN P1_26 -#define Z_STOP_PIN P1_28 - -#ifndef FILWIDTH_PIN - #define FILWIDTH_PIN P2_04 -#endif - -// -// Steppers -// -#define X_STEP_PIN P2_01 -#define X_DIR_PIN P0_11 -#define X_ENABLE_PIN P0_10 - -#define Y_STEP_PIN P2_02 -#define Y_DIR_PIN P0_20 -#define Y_ENABLE_PIN P0_19 - -#define Z_STEP_PIN P2_03 -#define Z_DIR_PIN P0_22 -#define Z_ENABLE_PIN P0_21 - -#define E0_STEP_PIN P2_00 -#define E0_DIR_PIN P0_05 -#define E0_ENABLE_PIN P0_04 // // DIGIPOT slave addresses // -#define DIGIPOT_I2C_ADDRESS_A 0x58 // shifted slave address for first DIGIPOT (0x58 <- 0x2C << 1) -#define DIGIPOT_I2C_ADDRESS_B 0x5C // shifted slave address for second DIGIPOT (0x5C <- 0x2E << 1) - -// -// Temperature Sensors -// 3.3V max when defined as an analog input -// -#define TEMP_BED_PIN 0 // A0 (TH1) -#define TEMP_0_PIN 1 // A1 (TH2) - -// -// Heaters / Fans -// -#define HEATER_BED_PIN P2_07 -#define HEATER_0_PIN P2_05 -#ifndef FAN_PIN - #define FAN_PIN P0_26 +#ifndef DIGIPOT_I2C_ADDRESS_A + #define DIGIPOT_I2C_ADDRESS_A 0x58 // shifted slave address for first DIGIPOT (0x58 <- 0x2C << 1) #endif -#define FAN1_PIN P1_25 - -// -// Display -// -#if ENABLED(ULTRA_LCD) - - #if ENABLED(CR10_STOCKDISPLAY) - - // Re-Arm can support Creality stock display without SD card reader and single cable on EXP3. - // Re-Arm J3 pins 1 (p1.31) & 2 (P3.26) are not used. Stock cable will need to have one - // 10-pin IDC connector trimmed or replaced with a 12-pin IDC connector to fit J3. - // Requires REVERSE_ENCODER_DIRECTION in Configuration.h - - #define BEEPER_PIN P2_11 // J3-3 & AUX-4 - - #define BTN_EN1 P0_16 // J3-7 & AUX-4 - #define BTN_EN2 P1_23 // J3-5 & AUX-4 - #define BTN_ENC P3_25 // J3-4 & AUX-4 - - #define LCD_PINS_RS P0_15 // J3-9 & AUX-4 (CS) - #define LCD_PINS_ENABLE P0_18 // J3-10 & AUX-3 (SID, MOSI) - #define LCD_PINS_D4 P2_06 // J3-8 & AUX-3 (SCK, CLK) - - #else - - #define BTN_EN1 P3_26 // (31) J3-2 & AUX-4 - #define BTN_EN2 P3_25 // (33) J3-4 & AUX-4 - #define BTN_ENC P2_11 // (35) J3-3 & AUX-4 - - #define SD_DETECT_PIN P1_31 // (49) not 5V tolerant J3-1 & AUX-3 - #define KILL_PIN P1_22 // (41) J5-4 & AUX-4 - #define LCD_PINS_RS P0_16 // (16) J3-7 & AUX-4 - #define LCD_SDSS P0_16 // (16) J3-7 & AUX-4 - #define LCD_BACKLIGHT_PIN P0_16 // (16) J3-7 & AUX-4 - only used on DOGLCD controllers - #define LCD_PINS_ENABLE P0_18 // (51) (MOSI) J3-10 & AUX-3 - #define LCD_PINS_D4 P0_15 // (52) (SCK) J3-9 & AUX-3 - - #define DOGLCD_A0 P2_06 // (59) J3-8 & AUX-2 - - #if ENABLED(REPRAPWORLD_KEYPAD) - #define SHIFT_OUT P0_18 // (51) (MOSI) J3-10 & AUX-3 - #define SHIFT_CLK P0_15 // (52) (SCK) J3-9 & AUX-3 - #define SHIFT_LD P1_31 // (49) not 5V tolerant J3-1 & AUX-3 - #elif DISABLED(NEWPANEL) - //#define SHIFT_OUT P2_11 // (35) J3-3 & AUX-4 - //#define SHIFT_CLK P3_26 // (31) J3-2 & AUX-4 - //#define SHIFT_LD P3_25 // (33) J3-4 & AUX-4 - //#define SHIFT_EN P1_22 // (41) J5-4 & AUX-4 - #endif - - #if ANY(VIKI2, miniVIKI) - //#define LCD_SCREEN_ROT_180 - - #define BEEPER_PIN P1_30 // (37) may change if cable changes - #define DOGLCD_CS P0_26 // (63) J5-3 & AUX-2 - #define DOGLCD_SCK SCK_PIN - #define DOGLCD_MOSI MOSI_PIN - - #define STAT_LED_BLUE_PIN P0_26 // (63) may change if cable changes - #define STAT_LED_RED_PIN P1_21 // ( 6) may change if cable changes - #else - #if ENABLED(ULTIPANEL) - #define LCD_PINS_D5 P1_17 // (71) ENET_MDIO - #define LCD_PINS_D6 P1_14 // (73) ENET_RX_ER - #define LCD_PINS_D7 P1_10 // (75) ENET_RXD1 - #endif - #define BEEPER_PIN P1_30 // (37) not 5V tolerant - #define DOGLCD_CS P0_16 // (16) - #endif - - #if ENABLED(MINIPANEL) - // GLCD features - // Uncomment screen orientation - //#define LCD_SCREEN_ROT_90 - //#define LCD_SCREEN_ROT_180 - //#define LCD_SCREEN_ROT_270 - #endif - - #endif - -#endif // ULTRA_LCD - -// -// SD Support -// -//#define USB_SD_DISABLED // Disable host access to SD card as mass storage device through USB -//#define USB_SD_ONBOARD // Enable host access to SD card as mass storage device through USB - -//#define LPC_SD_LCD // Marlin uses the SD drive attached to the LCD -#define LPC_SD_ONBOARD // Marlin uses the SD drive on the control board. There is no SD detect pin - // for the onboard card. Init card from LCD menu or send M21 whenever printer - // is powered on to enable SD access. - -#if ENABLED(LPC_SD_LCD) - - #define SCK_PIN P0_15 - #define MISO_PIN P0_17 - #define MOSI_PIN P0_18 - #define SS_PIN P1_23 // Chip select for SD card used by Marlin - #define ONBOARD_SD_CS P0_06 // Chip select for "System" SD card - -#elif ENABLED(LPC_SD_ONBOARD) - - #if ENABLED(USB_SD_ONBOARD) - // When sharing the SD card with a PC we want the menu options to - // mount/unmount the card and refresh it. So we disable card detect. - #define SHARED_SD_CARD - #undef SD_DETECT_PIN // there is also no detect pin for the onboard card - #endif - #define SCK_PIN P0_07 - #define MISO_PIN P0_08 - #define MOSI_PIN P0_09 - #define SS_PIN P0_06 // Chip select for SD card used by Marlin - #define ONBOARD_SD_CS P0_06 // Chip select for "System" SD card - +#ifndef DIGIPOT_I2C_ADDRESS_B + #define DIGIPOT_I2C_ADDRESS_B 0x5C // shifted slave address for second DIGIPOT (0x5C <- 0x2E << 1) #endif + +#include "pins_AZTEEG_X5_MINI.h" diff --git a/Marlin/src/pins/pins_BAM_DICE_DUE.h b/Marlin/src/pins/pins_BAM_DICE_DUE.h index b6b8ce1254..e985b140d8 100644 --- a/Marlin/src/pins/pins_BAM_DICE_DUE.h +++ b/Marlin/src/pins/pins_BAM_DICE_DUE.h @@ -33,7 +33,7 @@ // // M3/M4/M5 - Spindle/Laser Control // -#define SPINDLE_LASER_ENABLE_PIN 66 // Pin should have a pullup/pulldown! +#define SPINDLE_LASER_ENA_PIN 66 // Pin should have a pullup/pulldown! #define SPINDLE_DIR_PIN 67 #define SPINDLE_LASER_PWM_PIN 44 // MUST BE HARDWARE PWM diff --git a/Marlin/src/pins/pins_BLACK_STM32F407VE.h b/Marlin/src/pins/pins_BLACK_STM32F407VE.h new file mode 100644 index 0000000000..477bb909ad --- /dev/null +++ b/Marlin/src/pins/pins_BLACK_STM32F407VE.h @@ -0,0 +1,131 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2019 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 . + * + */ + +/** + * STM32F407VET6 with RAMPS-like shield + * 'Black' STM32F407VET6 board - http://wiki.stm32duino.com/index.php?title=STM32F407 + * Shield - https://github.com/jmz52/Hardware + */ + +#pragma once + +#if !defined(STM32F4) && !defined(STM32F4xx) + #error "Oops! Select an STM32F4 board in 'Tools > Board.'" +#endif + +#define DEFAULT_MACHINE_NAME "STM32F407VET6" +//#define BOARD_NAME "Black STM32F4VET6" + +//#define I2C_EEPROM +//#define E2END 0x1FFF // EEPROM end address (8kB) +#define EEPROM_EMULATED_WITH_SRAM + +#if HOTENDS > 2 || E_STEPPERS > 2 + #error "Black STM32F4VET6 supports up to 2 hotends / E-steppers." +#endif + +// +// Servos +// +#define SERVO0_PIN PC6 +#define SERVO1_PIN PC7 + +// +// Limit Switches +// +#define X_MIN_PIN PC13 +#define X_MAX_PIN PA15 +#define Y_MIN_PIN PA5 +#define Y_MAX_PIN PD12 +#define Z_MIN_PIN PD14 +#define Z_MAX_PIN PD15 + +// +// Steppers +// +#define X_STEP_PIN PC4 +#define X_DIR_PIN PA4 +#define X_ENABLE_PIN PE7 + +#define Y_STEP_PIN PE5 +#define Y_DIR_PIN PE2 +#define Y_ENABLE_PIN PE6 + +#define Z_STEP_PIN PD5 +#define Z_DIR_PIN PD3 +#define Z_ENABLE_PIN PD6 + +#define E0_STEP_PIN PD7 +#define E0_DIR_PIN PD0 +#define E0_ENABLE_PIN PB9 + +#define E1_STEP_PIN PE0 +#define E1_DIR_PIN PE1 +#define E1_ENABLE_PIN PB8 + +// +// Temperature Sensors +// +#define TEMP_0_PIN PC0 // T0 +#define TEMP_1_PIN PC1 // T1 +#define TEMP_BED_PIN PC2 // TB +#define TEMP_CHAMBER_PIN PC3 // TC + +// +// Heaters / Fans +// +#define HEATER_0_PIN PA2 // Heater0 +#define HEATER_1_PIN PA3 // Heater1 +#define HEATER_BED_PIN PA1 // Hotbed + +#define FAN_PIN PE9 // Fan0 +#define FAN1_PIN PE11 // Fan1 +#define FAN2_PIN PE13 // Fan2 +#define FAN3_PIN PE14 // Fan3 + +// +// Misc. Functions +// +#define SDSS PB12 +#define LED_PIN PA6 +//#define LED_PIN PA7 +#define KILL_PIN PB1 + +// +// LCD / Controller +// +#define SD_DETECT_PIN PC5 +//#define SD_DETECT_PIN PA8 // SDIO SD_DETECT_PIN, external SDIO card reader only + +#define BEEPER_PIN PD10 +#define LCD_PINS_RS PE15 +#define LCD_PINS_ENABLE PD8 +#define LCD_PINS_D4 PE10 +#define LCD_PINS_D5 PE12 +#define LCD_PINS_D6 PD1 +#define LCD_PINS_D7 PE8 +#define BTN_ENC PD9 +#define BTN_EN1 PD4 +#define BTN_EN2 PD13 + +#define DOGLCD_CS LCD_PINS_D5 +#define DOGLCD_A0 LCD_PINS_D6 diff --git a/Marlin/src/pins/pins_BQ_ZUM_MEGA_3D.h b/Marlin/src/pins/pins_BQ_ZUM_MEGA_3D.h index 7b4834e20d..c09e946f5d 100644 --- a/Marlin/src/pins/pins_BQ_ZUM_MEGA_3D.h +++ b/Marlin/src/pins/pins_BQ_ZUM_MEGA_3D.h @@ -49,7 +49,7 @@ // // M3/M4/M5 - Spindle/Laser Control // -#define SPINDLE_LASER_ENABLE_PIN 40 // Pin should have a pullup/pulldown! +#define SPINDLE_LASER_ENA_PIN 40 // Pin should have a pullup/pulldown! #define SPINDLE_LASER_PWM_PIN 44 // MUST BE HARDWARE PWM #define SPINDLE_DIR_PIN 42 diff --git a/Marlin/src/pins/pins_COHESION3D_MINI.h b/Marlin/src/pins/pins_COHESION3D_MINI.h index 6ceb457603..edea670b7a 100644 --- a/Marlin/src/pins/pins_COHESION3D_MINI.h +++ b/Marlin/src/pins/pins_COHESION3D_MINI.h @@ -118,7 +118,7 @@ // #if ENABLED(SPINDLE_LASER_ENABLE) #undef HEATER_0_PIN - #define SPINDLE_LASER_ENABLE_PIN P2_07 // FET 1 + #define SPINDLE_LASER_ENA_PIN P2_07 // FET 1 #undef HEATER_BED_PIN #define SPINDLE_LASER_PWM_PIN P2_05 // Bed FET #undef FAN_PIN diff --git a/Marlin/src/pins/pins_COHESION3D_REMIX.h b/Marlin/src/pins/pins_COHESION3D_REMIX.h index f240d38376..00b6714cea 100644 --- a/Marlin/src/pins/pins_COHESION3D_REMIX.h +++ b/Marlin/src/pins/pins_COHESION3D_REMIX.h @@ -139,7 +139,7 @@ // #if ENABLED(SPINDLE_LASER_ENABLE) #undef HEATER_0_PIN - #define SPINDLE_LASER_ENABLE_PIN P2_07 // FET 1 + #define SPINDLE_LASER_ENA_PIN P2_07 // FET 1 #undef HEATER_BED_PIN #define SPINDLE_LASER_PWM_PIN P2_05 // Bed FET #undef FAN_PIN diff --git a/Marlin/src/pins/pins_EINSY_RAMBO.h b/Marlin/src/pins/pins_EINSY_RAMBO.h index 6cb6d848c7..0f2aff6dd9 100644 --- a/Marlin/src/pins/pins_EINSY_RAMBO.h +++ b/Marlin/src/pins/pins_EINSY_RAMBO.h @@ -135,7 +135,7 @@ // // use P1 connector for spindle pins #define SPINDLE_LASER_PWM_PIN 9 // MUST BE HARDWARE PWM -#define SPINDLE_LASER_ENABLE_PIN 18 // Pin should have a pullup! +#define SPINDLE_LASER_ENA_PIN 18 // Pin should have a pullup! #define SPINDLE_DIR_PIN 19 // diff --git a/Marlin/src/pins/pins_EINSY_RETRO.h b/Marlin/src/pins/pins_EINSY_RETRO.h index 40db378f43..dd55c9b727 100644 --- a/Marlin/src/pins/pins_EINSY_RETRO.h +++ b/Marlin/src/pins/pins_EINSY_RETRO.h @@ -149,7 +149,7 @@ // // use P1 connector for spindle pins #define SPINDLE_LASER_PWM_PIN 9 // MUST BE HARDWARE PWM -#define SPINDLE_LASER_ENABLE_PIN 18 // Pin should have a pullup! +#define SPINDLE_LASER_ENA_PIN 18 // Pin should have a pullup! #define SPINDLE_DIR_PIN 19 // diff --git a/Marlin/src/pins/pins_FELIX2.h b/Marlin/src/pins/pins_FELIX2.h index 615629d9c7..4080ac6746 100644 --- a/Marlin/src/pins/pins_FELIX2.h +++ b/Marlin/src/pins/pins_FELIX2.h @@ -59,5 +59,5 @@ // M3/M4/M5 - Spindle/Laser Control // #undef SPINDLE_LASER_PWM_PIN // Definitions in pins_RAMPS.h are not valid with this board -#undef SPINDLE_LASER_ENABLE_PIN +#undef SPINDLE_LASER_ENA_PIN #undef SPINDLE_DIR_PIN diff --git a/Marlin/src/pins/pins_FORMBOT_RAPTOR.h b/Marlin/src/pins/pins_FORMBOT_RAPTOR.h index e746c16995..5944be04af 100644 --- a/Marlin/src/pins/pins_FORMBOT_RAPTOR.h +++ b/Marlin/src/pins/pins_FORMBOT_RAPTOR.h @@ -149,6 +149,10 @@ #define FAN_PIN 9 #endif +#ifndef FIL_RUNOUT_PIN + #define FIL_RUNOUT_PIN 57 +#endif + #if !HAS_FILAMENT_SENSOR #define FAN1_PIN 4 #endif @@ -169,6 +173,8 @@ #define PS_ON_PIN 12 #endif +#define CASE_LIGHT_PIN 5 + // // LCD / Controller // diff --git a/Marlin/src/pins/pins_FORMBOT_RAPTOR2.h b/Marlin/src/pins/pins_FORMBOT_RAPTOR2.h index 30de2e3ffc..733308f973 100644 --- a/Marlin/src/pins/pins_FORMBOT_RAPTOR2.h +++ b/Marlin/src/pins/pins_FORMBOT_RAPTOR2.h @@ -29,24 +29,24 @@ #define FAN_PIN 6 -#include "pins_FORMBOT_RAPTOR.h" - #ifndef FIL_RUNOUT_PIN #define FIL_RUNOUT_PIN 22 #endif +#include "pins_FORMBOT_RAPTOR.h" + #define GREEDY_PANEL ANY(PANEL_ONE, VIKI2, miniVIKI, MINIPANEL, REPRAPWORLD_KEYPAD) // // M3/M4/M5 - Spindle/Laser Control // -#if ENABLED(SPINDLE_LASER_ENABLE) && !PIN_EXISTS(SPINDLE_LASER_ENABLE) +#if ENABLED(SPINDLE_LASER_ENABLE) && !PIN_EXISTS(SPINDLE_LASER_ENA) #if !NUM_SERVOS // Try to use servo connector first - #define SPINDLE_LASER_ENABLE_PIN 6 // Pin should have a pullup/pulldown! + #define SPINDLE_LASER_ENA_PIN 6 // Pin should have a pullup/pulldown! #define SPINDLE_LASER_PWM_PIN 4 // MUST BE HARDWARE PWM #define SPINDLE_DIR_PIN 5 #elif !GREEDY_PANEL // Try to use AUX2 - #define SPINDLE_LASER_ENABLE_PIN 40 // Pin should have a pullup/pulldown! + #define SPINDLE_LASER_ENA_PIN 40 // Pin should have a pullup/pulldown! #define SPINDLE_LASER_PWM_PIN 44 // MUST BE HARDWARE PWM #define SPINDLE_DIR_PIN 65 #endif @@ -62,6 +62,6 @@ #undef GREEDY_PANEL -#if ENABLED(CASE_LIGHT_ENABLE) && PIN_EXISTS(CASE_LIGHT) && (CASE_LIGHT_PIN == SPINDLE_LASER_ENABLE_PIN || CASE_LIGHT_PIN == SPINDLE_LASER_PWM_PIN) +#if ENABLED(CASE_LIGHT_ENABLE) && PIN_EXISTS(CASE_LIGHT) && (CASE_LIGHT_PIN == SPINDLE_LASER_ENA_PIN || CASE_LIGHT_PIN == SPINDLE_LASER_PWM_PIN) #error "CASE_LIGHT_PIN conflicts with a Spindle / Laser pin." #endif diff --git a/Marlin/src/pins/pins_FORMBOT_TREX3.h b/Marlin/src/pins/pins_FORMBOT_TREX3.h index 3e3d88c2b3..3615ca742c 100644 --- a/Marlin/src/pins/pins_FORMBOT_TREX3.h +++ b/Marlin/src/pins/pins_FORMBOT_TREX3.h @@ -144,7 +144,7 @@ #endif #define SPINDLE_LASER_PWM_PIN 7 // MUST BE HARDWARE PWM -#define SPINDLE_LASER_ENABLE_PIN 4 // Pin should have a pullup! +#define SPINDLE_LASER_ENA_PIN 4 // Pin should have a pullup! // Use the RAMPS 1.4 Analog input 5 on the AUX2 connector #define FILWIDTH_PIN 5 // Analog Input diff --git a/Marlin/src/pins/pins_FYSETC_F6_13.h b/Marlin/src/pins/pins_FYSETC_F6_13.h index cd67db281a..e725583008 100644 --- a/Marlin/src/pins/pins_FYSETC_F6_13.h +++ b/Marlin/src/pins/pins_FYSETC_F6_13.h @@ -116,7 +116,6 @@ // the jumper next to the limit switch socket when using sensorless homing. // - #if HAS_DRIVER(TMC2208) // Software serial #define X_SERIAL_RX_PIN 71 @@ -168,18 +167,16 @@ #define PS_ON_PIN SERVO1_PIN #endif -#ifndef RGB_LED_R_PIN - #define RGB_LED_R_PIN 3 -#endif -#ifndef RGB_LED_G_PIN - #define RGB_LED_G_PIN SERVO3_PIN -#endif -#ifndef RGB_LED_B_PIN - #define RGB_LED_B_PIN 9 -#endif -#ifndef RGB_LED_W_PIN - #define RGB_LED_W_PIN -1 -#endif +/** + * ----- ----- + * 5V/D41 | · · | GND 5V | · · | GND + * RESET | · · | D49 (SD_DETECT) (LCD_D7) D29 | · · | D27 (LCD_D6) + * (MOSI) D51 | · · | D33 (BTN_EN2) (LCD_D5) D25 | · · | D23 (LCD_D4) + * (SD_SS) D53 | · · | D31 (BTN_EN1) (LCD_RS) D16 | · · | D17 (LCD_EN) + * (SCK) D52 | · · | D50 (MISO) (BTN_ENC) D35 | · · | D37 (BEEPER) + * ----- ----- + * EXP2 EXP1 + */ // // LCDs and Controllers @@ -187,20 +184,67 @@ #define BEEPER_PIN 37 #define SD_DETECT_PIN 49 -#define LCD_PINS_RS 16 -#define LCD_PINS_ENABLE 17 -#define LCD_PINS_D4 23 -#define LCD_PINS_D5 25 -#define LCD_PINS_D6 27 -#define LCD_PINS_D7 29 +#if ENABLED(MKS_MINI_12864) + #define DOGLCD_A0 27 + #define DOGLCD_CS 25 +#endif + +#if ENABLED(FYSETC_MINI_12864) + // + // See https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 + // + #define DOGLCD_A0 16 + #define DOGLCD_CS 17 + #ifndef RGB_LED_R_PIN + #define RGB_LED_R_PIN 25 + #endif + #ifndef RGB_LED_G_PIN + #define RGB_LED_G_PIN 27 + #endif + #ifndef RGB_LED_B_PIN + #define RGB_LED_B_PIN 29 + #endif + +#elif HAS_GRAPHICAL_LCD + + #define LCD_PINS_RS 16 + #define LCD_PINS_ENABLE 17 + #define LCD_PINS_D4 23 + #define LCD_PINS_D5 25 + #define LCD_PINS_D6 27 + #define LCD_PINS_D7 29 + +#endif #if ENABLED(NEWPANEL) #define BTN_EN1 31 #define BTN_EN2 33 #define BTN_ENC 35 +#endif - #if ENABLED(MKS_MINI_12864) - #define DOGLCD_A0 27 - #define DOGLCD_CS 25 +#if ENABLED(FYSETC_MINI_12864) + #define LCD_BACKLIGHT_PIN -1 + #define LCD_RESET_PIN 23 + #define KILL_PIN 41 + #ifndef RGB_LED_R_PIN + #define RGB_LED_R_PIN 25 + #endif + #ifndef RGB_LED_G_PIN + #define RGB_LED_G_PIN 27 + #endif + #ifndef RGB_LED_B_PIN + #define RGB_LED_B_PIN 29 #endif #endif +#ifndef RGB_LED_R_PIN + #define RGB_LED_R_PIN 3 +#endif +#ifndef RGB_LED_G_PIN + #define RGB_LED_G_PIN 4 +#endif +#ifndef RGB_LED_B_PIN + #define RGB_LED_B_PIN 9 +#endif +#ifndef RGB_LED_W_PIN + #define RGB_LED_W_PIN -1 +#endif diff --git a/Marlin/src/pins/pins_GEN6.h b/Marlin/src/pins/pins_GEN6.h index 98194604cf..17124a596a 100644 --- a/Marlin/src/pins/pins_GEN6.h +++ b/Marlin/src/pins/pins_GEN6.h @@ -114,6 +114,6 @@ // // M3/M4/M5 - Spindle/Laser Control // -#define SPINDLE_LASER_ENABLE_PIN 5 // Pin should have a pullup/pulldown! +#define SPINDLE_LASER_ENA_PIN 5 // Pin should have a pullup/pulldown! #define SPINDLE_LASER_PWM_PIN 16 // MUST BE HARDWARE PWM #define SPINDLE_DIR_PIN 6 diff --git a/Marlin/src/pins/pins_GEN7_12.h b/Marlin/src/pins/pins_GEN7_12.h index 8df03d6831..d040738b1a 100644 --- a/Marlin/src/pins/pins_GEN7_12.h +++ b/Marlin/src/pins/pins_GEN7_12.h @@ -140,7 +140,7 @@ // // M3/M4/M5 - Spindle/Laser Control // -#define SPINDLE_LASER_ENABLE_PIN 10 // Pin should have a pullup/pulldown! +#define SPINDLE_LASER_ENA_PIN 10 // Pin should have a pullup/pulldown! #define SPINDLE_DIR_PIN 11 #if GEN7_VERSION < 13 #define SPINDLE_LASER_PWM_PIN 16 // MUST BE HARDWARE PWM diff --git a/Marlin/src/pins/pins_GEN7_14.h b/Marlin/src/pins/pins_GEN7_14.h index 660d9aea9c..b4ae7ffe10 100644 --- a/Marlin/src/pins/pins_GEN7_14.h +++ b/Marlin/src/pins/pins_GEN7_14.h @@ -113,6 +113,6 @@ // // M3/M4/M5 - Spindle/Laser Control // -#define SPINDLE_LASER_ENABLE_PIN 20 // Pin should have a pullup/pulldown! +#define SPINDLE_LASER_ENA_PIN 20 // Pin should have a pullup/pulldown! #define SPINDLE_LASER_PWM_PIN 16 // MUST BE HARDWARE PWM #define SPINDLE_DIR_PIN 21 diff --git a/Marlin/src/pins/pins_GEN7_CUSTOM.h b/Marlin/src/pins/pins_GEN7_CUSTOM.h index 2c92efe2b8..4d6a059df8 100644 --- a/Marlin/src/pins/pins_GEN7_CUSTOM.h +++ b/Marlin/src/pins/pins_GEN7_CUSTOM.h @@ -133,6 +133,6 @@ // // M3/M4/M5 - Spindle/Laser Control // -#define SPINDLE_LASER_ENABLE_PIN 5 // Pin should have a pullup/pulldown! +#define SPINDLE_LASER_ENA_PIN 5 // Pin should have a pullup/pulldown! #define SPINDLE_LASER_PWM_PIN 16 // MUST BE HARDWARE PWM #define SPINDLE_DIR_PIN 6 diff --git a/Marlin/src/pins/pins_MEGACONTROLLER.h b/Marlin/src/pins/pins_MEGACONTROLLER.h index 0899e65f25..6c0f8cad30 100644 --- a/Marlin/src/pins/pins_MEGACONTROLLER.h +++ b/Marlin/src/pins/pins_MEGACONTROLLER.h @@ -161,5 +161,5 @@ // M3/M4/M5 - Spindle/Laser Control // #define SPINDLE_LASER_PWM_PIN 6 // MUST BE HARDWARE PWM -#define SPINDLE_LASER_ENABLE_PIN 7 // Pin should have a pullup! +#define SPINDLE_LASER_ENA_PIN 7 // Pin should have a pullup! #define SPINDLE_DIR_PIN 8 diff --git a/Marlin/src/pins/pins_MEGATRONICS.h b/Marlin/src/pins/pins_MEGATRONICS.h index c5eea8dcc3..858fcb6e34 100644 --- a/Marlin/src/pins/pins_MEGATRONICS.h +++ b/Marlin/src/pins/pins_MEGATRONICS.h @@ -126,5 +126,5 @@ // M3/M4/M5 - Spindle/Laser Control // #define SPINDLE_LASER_PWM_PIN 3 // MUST BE HARDWARE PWM -#define SPINDLE_LASER_ENABLE_PIN 4 // Pin should have a pullup! +#define SPINDLE_LASER_ENA_PIN 4 // Pin should have a pullup! #define SPINDLE_DIR_PIN 11 diff --git a/Marlin/src/pins/pins_MEGATRONICS_2.h b/Marlin/src/pins/pins_MEGATRONICS_2.h index 72214212db..9f7f958e68 100644 --- a/Marlin/src/pins/pins_MEGATRONICS_2.h +++ b/Marlin/src/pins/pins_MEGATRONICS_2.h @@ -141,5 +141,5 @@ // M3/M4/M5 - Spindle/Laser Control // #define SPINDLE_LASER_PWM_PIN 3 // MUST BE HARDWARE PWM -#define SPINDLE_LASER_ENABLE_PIN 16 // Pin should have a pullup! +#define SPINDLE_LASER_ENA_PIN 16 // Pin should have a pullup! #define SPINDLE_DIR_PIN 11 diff --git a/Marlin/src/pins/pins_MEGATRONICS_3.h b/Marlin/src/pins/pins_MEGATRONICS_3.h index 965bec3a84..38a0f8e7ef 100644 --- a/Marlin/src/pins/pins_MEGATRONICS_3.h +++ b/Marlin/src/pins/pins_MEGATRONICS_3.h @@ -174,7 +174,7 @@ // #if DISABLED(REPRAPWORLD_KEYPAD) // try to use the keypad connector first #define SPINDLE_LASER_PWM_PIN 44 // MUST BE HARDWARE PWM - #define SPINDLE_LASER_ENABLE_PIN 43 // Pin should have a pullup! + #define SPINDLE_LASER_ENA_PIN 43 // Pin should have a pullup! #define SPINDLE_DIR_PIN 42 #elif EXTRUDERS <= 2 // Hijack the last extruder so that we can get the PWM signal off the Y breakout @@ -189,6 +189,6 @@ #define Y_STEP_PIN 22 #define Y_DIR_PIN 60 #define SPINDLE_LASER_PWM_PIN 4 // MUST BE HARDWARE PWM - #define SPINDLE_LASER_ENABLE_PIN 17 // Pin should have a pullup! + #define SPINDLE_LASER_ENA_PIN 17 // Pin should have a pullup! #define SPINDLE_DIR_PIN 5 #endif diff --git a/Marlin/src/pins/pins_MIGHTYBOARD_REVE.h b/Marlin/src/pins/pins_MIGHTYBOARD_REVE.h index 115f86b1e7..d9def846c2 100644 --- a/Marlin/src/pins/pins_MIGHTYBOARD_REVE.h +++ b/Marlin/src/pins/pins_MIGHTYBOARD_REVE.h @@ -104,7 +104,9 @@ #define DIGIPOTS_I2C_SDA_E0 27 // A5 #define DIGIPOTS_I2C_SDA_E1 77 // J6 -#define DIGIPOT_I2C_ADDRESS_A 0x2F // unshifted slave address (5E <- 2F << 1) +#ifndef DIGIPOT_I2C_ADDRESS_A + #define DIGIPOT_I2C_ADDRESS_A 0x2F // unshifted slave address (5E <- 2F << 1) +#endif // // Temperature Sensors @@ -263,7 +265,7 @@ // // M3/M4/M5 - Spindle/Laser Control // -#define SPINDLE_LASER_ENABLE_PIN 66 // K4 Pin should have a pullup! +#define SPINDLE_LASER_ENA_PIN 66 // K4 Pin should have a pullup! #define SPINDLE_LASER_PWM_PIN 8 // H5 MUST BE HARDWARE PWM #define SPINDLE_DIR_PIN 67 // K5 diff --git a/Marlin/src/pins/pins_MINIRAMBO.h b/Marlin/src/pins/pins_MINIRAMBO.h index 456029cf2c..1fbb52194a 100644 --- a/Marlin/src/pins/pins_MINIRAMBO.h +++ b/Marlin/src/pins/pins_MINIRAMBO.h @@ -125,7 +125,7 @@ // // use P1 connector for spindle pins #define SPINDLE_LASER_PWM_PIN 9 // MUST BE HARDWARE PWM -#define SPINDLE_LASER_ENABLE_PIN 18 // Pin should have a pullup! +#define SPINDLE_LASER_ENA_PIN 18 // Pin should have a pullup! #define SPINDLE_DIR_PIN 19 // diff --git a/Marlin/src/pins/pins_MINITRONICS.h b/Marlin/src/pins/pins_MINITRONICS.h index 742b82a8d5..f54a4f85f3 100644 --- a/Marlin/src/pins/pins_MINITRONICS.h +++ b/Marlin/src/pins/pins_MINITRONICS.h @@ -138,7 +138,7 @@ #define HEATER_BED_PIN 4 // won't compile #define TEMP_BED_PIN 50 #define TEMP_0_PIN 51 - #define SPINDLE_LASER_ENABLE_PIN 52 // using A6 because it already has a pullup + #define SPINDLE_LASER_ENA_PIN 52 // using A6 because it already has a pullup #define SPINDLE_LASER_PWM_PIN 3 // WARNING - LED & resistor pull up to +12/+24V stepper voltage #define SPINDLE_DIR_PIN 53 #endif diff --git a/Marlin/src/pins/pins_MKS_BASE.h b/Marlin/src/pins/pins_MKS_BASE.h index 3b7c0588de..8e5d0dd7bd 100644 --- a/Marlin/src/pins/pins_MKS_BASE.h +++ b/Marlin/src/pins/pins_MKS_BASE.h @@ -44,7 +44,7 @@ // M3/M4/M5 - Spindle/Laser Control // #define SPINDLE_LASER_PWM_PIN 2 // MUST BE HARDWARE PWM -#define SPINDLE_LASER_ENABLE_PIN 15 // Pin should have a pullup! +#define SPINDLE_LASER_ENA_PIN 15 // Pin should have a pullup! #define SPINDLE_DIR_PIN 19 #include "pins_RAMPS.h" diff --git a/Marlin/src/pins/pins_MKS_BASE_14.h b/Marlin/src/pins/pins_MKS_BASE_14.h index 91fca71857..d25c2c2e01 100644 --- a/Marlin/src/pins/pins_MKS_BASE_14.h +++ b/Marlin/src/pins/pins_MKS_BASE_14.h @@ -47,7 +47,7 @@ // M3/M4/M5 - Spindle/Laser Control // #define SPINDLE_LASER_PWM_PIN 2 // X+ // PE4 ** Pin6 ** PWM2 **MUST BE HARDWARE PWM -#define SPINDLE_LASER_ENABLE_PIN 15 // Y+ // PJ0 ** Pin63 ** USART3_RX **Pin should have a pullup! +#define SPINDLE_LASER_ENA_PIN 15 // Y+ // PJ0 ** Pin63 ** USART3_RX **Pin should have a pullup! #define SPINDLE_DIR_PIN 19 // Z+ // PD2 ** Pin45 ** USART1_RX // @@ -64,6 +64,16 @@ #define E1_MS1_PIN 57 // PF3 ** Pin94 ** A3 #define E1_MS2_PIN 4 // PG5 ** Pin1 ** PWM4 +#ifndef RGB_LED_R_PIN + #define RGB_LED_R_PIN 50 +#endif +#ifndef RGB_LED_R_PIN + #define RGB_LED_G_PIN 51 +#endif +#ifndef RGB_LED_R_PIN + #define RGB_LED_B_PIN 52 +#endif + #include "pins_RAMPS.h" /* diff --git a/Marlin/src/pins/pins_RAMBO.h b/Marlin/src/pins/pins_RAMBO.h index 95ce033936..b6890d9537 100644 --- a/Marlin/src/pins/pins_RAMBO.h +++ b/Marlin/src/pins/pins_RAMBO.h @@ -149,7 +149,7 @@ // M3/M4/M5 - Spindle/Laser Control // #define SPINDLE_LASER_PWM_PIN 45 // MUST BE HARDWARE PWM -#define SPINDLE_LASER_ENABLE_PIN 31 // Pin should have a pullup! +#define SPINDLE_LASER_ENA_PIN 31 // Pin should have a pullup! #define SPINDLE_DIR_PIN 32 // diff --git a/Marlin/src/pins/pins_RAMPS.h b/Marlin/src/pins/pins_RAMPS.h index 1f06992cfa..40d3dd11e2 100644 --- a/Marlin/src/pins/pins_RAMPS.h +++ b/Marlin/src/pins/pins_RAMPS.h @@ -231,10 +231,12 @@ #define PS_ON_PIN 12 #endif -#if ENABLED(CASE_LIGHT_ENABLE) && !defined(CASE_LIGHT_PIN) && !defined(SPINDLE_LASER_ENABLE_PIN) +#define AUX2_PINS_FREE !( BOTH(ULTRA_LCD, NEWPANEL) && ANY(PANEL_ONE, VIKI2, miniVIKI, MINIPANEL, REPRAPWORLD_KEYPAD) ) + +#if ENABLED(CASE_LIGHT_ENABLE) && !defined(CASE_LIGHT_PIN) && !defined(SPINDLE_LASER_ENA_PIN) #if NUM_SERVOS <= 1 // try to use servo connector first #define CASE_LIGHT_PIN 6 // MUST BE HARDWARE PWM - #elif !(BOTH(ULTRA_LCD, NEWPANEL) && ANY(PANEL_ONE, VIKI2, miniVIKI, MINIPANEL, REPRAPWORLD_KEYPAD)) // try to use AUX 2 + #elif AUX2_PINS_FREE #define CASE_LIGHT_PIN 44 // MUST BE HARDWARE PWM #endif #endif @@ -242,18 +244,20 @@ // // M3/M4/M5 - Spindle/Laser Control // -#if ENABLED(SPINDLE_LASER_ENABLE) && !PIN_EXISTS(SPINDLE_LASER_ENABLE) +#if ENABLED(SPINDLE_LASER_ENABLE) && !PIN_EXISTS(SPINDLE_LASER_ENA) #if !defined(NUM_SERVOS) || NUM_SERVOS == 0 // try to use servo connector first - #define SPINDLE_LASER_ENABLE_PIN 4 // Pin should have a pullup/pulldown! + #define SPINDLE_LASER_ENA_PIN 4 // Pin should have a pullup/pulldown! #define SPINDLE_LASER_PWM_PIN 6 // MUST BE HARDWARE PWM #define SPINDLE_DIR_PIN 5 - #elif !(BOTH(ULTRA_LCD, NEWPANEL) && ANY(PANEL_ONE, VIKI2, miniVIKI, MINIPANEL, REPRAPWORLD_KEYPAD)) // try to use AUX 2 - #define SPINDLE_LASER_ENABLE_PIN 40 // Pin should have a pullup/pulldown! + #elif AUX2_PINS_FREE + #define SPINDLE_LASER_ENA_PIN 40 // Pin should have a pullup/pulldown! #define SPINDLE_LASER_PWM_PIN 44 // MUST BE HARDWARE PWM #define SPINDLE_DIR_PIN 65 #endif #endif +#undef AUX2_PINS_FREE + // // TMC software SPI // @@ -518,6 +522,31 @@ #define SD_DETECT_PIN 49 #define KILL_PIN 41 + #elif ENABLED(FYSETC_MINI_12864) // Added in Marlin 1.1.9+ + + // From https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 + #define BEEPER_PIN 37 + #define LCD_RESET_PIN 23 + + #define DOGLCD_A0 16 + #define DOGLCD_CS 17 + + #define BTN_EN1 31 + #define BTN_EN2 33 + #define BTN_ENC 35 + + #define SD_DETECT_PIN 49 + + #ifndef RGB_LED_R_PIN + #define RGB_LED_R_PIN 25 + #endif + #ifndef RGB_LED_G_PIN + #define RGB_LED_G_PIN 27 + #endif + #ifndef RGB_LED_B_PIN + #define RGB_LED_B_PIN 29 + #endif + #elif ENABLED(MINIPANEL) #define BEEPER_PIN 42 diff --git a/Marlin/src/pins/pins_RAMPS_FD_V1.h b/Marlin/src/pins/pins_RAMPS_FD_V1.h index 45ad8d1651..8cee2e7f4d 100644 --- a/Marlin/src/pins/pins_RAMPS_FD_V1.h +++ b/Marlin/src/pins/pins_RAMPS_FD_V1.h @@ -198,9 +198,9 @@ // // M3/M4/M5 - Spindle/Laser Control // -#if ENABLED(SPINDLE_LASER_ENABLE) && !PIN_EXISTS(SPINDLE_LASER_ENABLE) +#if ENABLED(SPINDLE_LASER_ENABLE) && !PIN_EXISTS(SPINDLE_LASER_ENA) #if HOTENDS < 3 - #define SPINDLE_LASER_ENABLE_PIN 45 // Use E2 ENA + #define SPINDLE_LASER_ENA_PIN 45 // Use E2 ENA #define SPINDLE_LASER_PWM_PIN 12 // MUST BE HARDWARE PWM #define SPINDLE_DIR_PIN 47 // Use E2 DIR #endif diff --git a/Marlin/src/pins/pins_RAMPS_LINUX.h b/Marlin/src/pins/pins_RAMPS_LINUX.h index 8520975bce..7db43fbab3 100644 --- a/Marlin/src/pins/pins_RAMPS_LINUX.h +++ b/Marlin/src/pins/pins_RAMPS_LINUX.h @@ -217,7 +217,7 @@ #define PS_ON_PIN 12 #endif -#if ENABLED(CASE_LIGHT_ENABLE) && !defined(CASE_LIGHT_PIN) && !defined(SPINDLE_LASER_ENABLE_PIN) +#if ENABLED(CASE_LIGHT_ENABLE) && !defined(CASE_LIGHT_PIN) && !defined(SPINDLE_LASER_ENA_PIN) #if NUM_SERVOS <= 1 // try to use servo connector first #define CASE_LIGHT_PIN 6 // MUST BE HARDWARE PWM #elif !(BOTH(ULTRA_LCD, NEWPANEL) && ANY(PANEL_ONE, VIKI2, miniVIKI, MINIPANEL, REPRAPWORLD_KEYPAD)) // try to use AUX 2 @@ -228,13 +228,13 @@ // // M3/M4/M5 - Spindle/Laser Control // -#if ENABLED(SPINDLE_LASER_ENABLE) && !PIN_EXISTS(SPINDLE_LASER_ENABLE) +#if ENABLED(SPINDLE_LASER_ENABLE) && !PIN_EXISTS(SPINDLE_LASER_ENA) #if !defined(NUM_SERVOS) || NUM_SERVOS == 0 // try to use servo connector first - #define SPINDLE_LASER_ENABLE_PIN 4 // Pin should have a pullup/pulldown! + #define SPINDLE_LASER_ENA_PIN 4 // Pin should have a pullup/pulldown! #define SPINDLE_LASER_PWM_PIN 6 // MUST BE HARDWARE PWM #define SPINDLE_DIR_PIN 5 #elif !(BOTH(ULTRA_LCD, NEWPANEL) && ANY(PANEL_ONE, VIKI2, miniVIKI, MINIPANEL, REPRAPWORLD_KEYPAD)) // try to use AUX 2 - #define SPINDLE_LASER_ENABLE_PIN 40 // Pin should have a pullup/pulldown! + #define SPINDLE_LASER_ENA_PIN 40 // Pin should have a pullup/pulldown! #define SPINDLE_LASER_PWM_PIN 44 // MUST BE HARDWARE PWM #define SPINDLE_DIR_PIN 65 #endif diff --git a/Marlin/src/pins/pins_RAMPS_OLD.h b/Marlin/src/pins/pins_RAMPS_OLD.h index 1a84013545..bbcd4f38d3 100644 --- a/Marlin/src/pins/pins_RAMPS_OLD.h +++ b/Marlin/src/pins/pins_RAMPS_OLD.h @@ -110,6 +110,6 @@ // // M3/M4/M5 - Spindle/Laser Control // -#define SPINDLE_LASER_ENABLE_PIN 41 // Pin should have a pullup/pulldown! +#define SPINDLE_LASER_ENA_PIN 41 // Pin should have a pullup/pulldown! #define SPINDLE_LASER_PWM_PIN 45 // MUST BE HARDWARE PWM #define SPINDLE_DIR_PIN 43 diff --git a/Marlin/src/pins/pins_RAMPS_RE_ARM.h b/Marlin/src/pins/pins_RAMPS_RE_ARM.h index 496a6d29aa..25c85a360f 100644 --- a/Marlin/src/pins/pins_RAMPS_RE_ARM.h +++ b/Marlin/src/pins/pins_RAMPS_RE_ARM.h @@ -200,7 +200,7 @@ #define MAX6675_SS_PIN P1_28 #endif -#if ENABLED(CASE_LIGHT_ENABLE) && !PIN_EXISTS(CASE_LIGHT) && !defined(SPINDLE_LASER_ENABLE_PIN) +#if ENABLED(CASE_LIGHT_ENABLE) && !PIN_EXISTS(CASE_LIGHT) && !defined(SPINDLE_LASER_ENA_PIN) #if !defined(NUM_SERVOS) || NUM_SERVOS < 4 // Try to use servo connector #define CASE_LIGHT_PIN P1_18 // (4) MUST BE HARDWARE PWM #endif @@ -210,11 +210,11 @@ // M3/M4/M5 - Spindle/Laser Control // Use servo pins, if available // -#if ENABLED(SPINDLE_LASER_ENABLE) && !PIN_EXISTS(SPINDLE_LASER_ENABLE) +#if ENABLED(SPINDLE_LASER_ENABLE) && !PIN_EXISTS(SPINDLE_LASER_ENA) #if NUM_SERVOS > 1 #error "SPINDLE_LASER_ENABLE requires 3 free servo pins." #endif - #define SPINDLE_LASER_ENABLE_PIN SERVO1_PIN // (6) Pin should have a pullup/pulldown! + #define SPINDLE_LASER_ENA_PIN SERVO1_PIN // (6) Pin should have a pullup/pulldown! #define SPINDLE_LASER_PWM_PIN SERVO3_PIN // (4) MUST BE HARDWARE PWM #define SPINDLE_DIR_PIN SERVO2_PIN // (5) #endif diff --git a/Marlin/src/pins/pins_RUMBA.h b/Marlin/src/pins/pins_RUMBA.h index d7ce1c2112..e0bed70e22 100644 --- a/Marlin/src/pins/pins_RUMBA.h +++ b/Marlin/src/pins/pins_RUMBA.h @@ -157,8 +157,8 @@ #ifndef SPINDLE_LASER_PWM_PIN #define SPINDLE_LASER_PWM_PIN 4 // MUST BE HARDWARE PWM. Pin 4 interrupts OC0* and OC1* always in use? #endif -#ifndef SPINDLE_LASER_ENABLE_PIN - #define SPINDLE_LASER_ENABLE_PIN 14 // Pin should have a pullup! +#ifndef SPINDLE_LASER_ENA_PIN + #define SPINDLE_LASER_ENA_PIN 14 // Pin should have a pullup! #endif #ifndef SPINDLE_DIR_PIN #define SPINDLE_DIR_PIN 15 diff --git a/Marlin/src/pins/pins_RURAMPS4D_13.h b/Marlin/src/pins/pins_RURAMPS4D_13.h index 8ea571ed46..ab4aea0f2b 100644 --- a/Marlin/src/pins/pins_RURAMPS4D_13.h +++ b/Marlin/src/pins/pins_RURAMPS4D_13.h @@ -161,11 +161,11 @@ // MKS TFT / Nextion Use internal USART-1 #define TFT_LCD_MODULE_COM 1 -#define TFT_LCD_MODULE_BAUDRATE 115600 +#define TFT_LCD_MODULE_BAUDRATE 115200 // ESP WiFi Use internal USART-2 #define ESP_WIFI_MODULE_COM 2 -#define ESP_WIFI_MODULE_BAUDRATE 115600 +#define ESP_WIFI_MODULE_BAUDRATE 115200 #define ESP_WIFI_MODULE_RESET_PIN -1 #define PIGGY_GPIO_PIN -1 diff --git a/Marlin/src/pins/pins_SANGUINOLOLU_11.h b/Marlin/src/pins/pins_SANGUINOLOLU_11.h index fb80edc1f2..42f624af39 100644 --- a/Marlin/src/pins/pins_SANGUINOLOLU_11.h +++ b/Marlin/src/pins/pins_SANGUINOLOLU_11.h @@ -279,7 +279,7 @@ #if ENABLED(SPINDLE_LASER_ENABLE) #if !MB(AZTEEG_X1) && ENABLED(SANGUINOLOLU_V_1_2) && !BOTH(ULTRA_LCD, NEWPANEL) // try to use IO Header - #define SPINDLE_LASER_ENABLE_PIN 10 // Pin should have a pullup/pulldown! + #define SPINDLE_LASER_ENA_PIN 10 // Pin should have a pullup/pulldown! #define SPINDLE_LASER_PWM_PIN 4 // MUST BE HARDWARE PWM #define SPINDLE_DIR_PIN 11 @@ -307,7 +307,7 @@ * /RESET O| |O 1A * /SLEEP O| |O 1B * SPINDLE_LASER_PWM_PIN STEP O| |O VDD - * SPINDLE_LASER_ENABLE_PIN DIR O| |O GND + * SPINDLE_LASER_ENA_PIN DIR O| |O GND * ------- * * Note: Socket names vary from vendor to vendor. @@ -319,7 +319,7 @@ #define X_ENABLE_PIN 14 #define X_STEP_PIN 1 #define SPINDLE_LASER_PWM_PIN 15 // MUST BE HARDWARE PWM - #define SPINDLE_LASER_ENABLE_PIN 21 // Pin should have a pullup! + #define SPINDLE_LASER_ENA_PIN 21 // Pin should have a pullup! #define SPINDLE_DIR_PIN -1 // No pin available on the socket for the direction pin #endif #endif // SPINDLE_LASER_ENABLE diff --git a/Marlin/src/pins/pins_SAV_MKI.h b/Marlin/src/pins/pins_SAV_MKI.h index c4744c69b5..521918b5ba 100644 --- a/Marlin/src/pins/pins_SAV_MKI.h +++ b/Marlin/src/pins/pins_SAV_MKI.h @@ -176,7 +176,7 @@ // M3/M4/M5 - Spindle/Laser Control // #define SPINDLE_LASER_PWM_PIN 24 // B4 PWM2A - #define SPINDLE_LASER_ENABLE_PIN 39 // F1 Pin should have a pullup! + #define SPINDLE_LASER_ENA_PIN 39 // F1 Pin should have a pullup! #define SPINDLE_DIR_PIN 40 // F2 #define CASE_LIGHT_PIN 0 // D0 PWM0B diff --git a/Marlin/src/pins/pins_STM3R_MINI.h b/Marlin/src/pins/pins_STM3R_MINI.h index 2b5c6c3a4d..bf1a085139 100644 --- a/Marlin/src/pins/pins_STM3R_MINI.h +++ b/Marlin/src/pins/pins_STM3R_MINI.h @@ -108,7 +108,7 @@ // Laser control #if ENABLED(SPINDLE_LASER_ENABLE) #define SPINDLE_LASER_PWM_PIN PB8 - #define SPINDLE_LASER_ENABLE_PIN PD5 + #define SPINDLE_LASER_ENA_PIN PD5 #endif // diff --git a/Marlin/src/pins/pins_TEENSY2.h b/Marlin/src/pins/pins_TEENSY2.h index 182eed75cc..c867769ecc 100644 --- a/Marlin/src/pins/pins_TEENSY2.h +++ b/Marlin/src/pins/pins_TEENSY2.h @@ -179,6 +179,6 @@ // // M3/M4/M5 - Spindle/Laser Control // -#define SPINDLE_LASER_ENABLE_PIN 5 // D5 Pin should have a pullup! +#define SPINDLE_LASER_ENA_PIN 5 // D5 Pin should have a pullup! #define SPINDLE_LASER_PWM_PIN 0 // D0 PWM0B MUST BE HARDWARE PWM #define SPINDLE_DIR_PIN 7 // D7 diff --git a/Marlin/src/pins/pins_TEENSYLU.h b/Marlin/src/pins/pins_TEENSYLU.h index d60233da52..87a241116f 100644 --- a/Marlin/src/pins/pins_TEENSYLU.h +++ b/Marlin/src/pins/pins_TEENSYLU.h @@ -159,5 +159,5 @@ // M3/M4/M5 - Spindle/Laser Control // #define SPINDLE_LASER_PWM_PIN 24 // B4 IO-3 PWM2A - MUST BE HARDWARE PWM -#define SPINDLE_LASER_ENABLE_PIN 39 // F1 IO-11 - Pin should have a pullup! +#define SPINDLE_LASER_ENA_PIN 39 // F1 IO-11 - Pin should have a pullup! #define SPINDLE_DIR_PIN 40 // F2 IO-9 diff --git a/Marlin/src/pins/pins_ULTIMAIN_2.h b/Marlin/src/pins/pins_ULTIMAIN_2.h index 7d2e18510f..821494d129 100644 --- a/Marlin/src/pins/pins_ULTIMAIN_2.h +++ b/Marlin/src/pins/pins_ULTIMAIN_2.h @@ -131,7 +131,7 @@ #if ENABLED(SPINDLE_LASER_ENABLE) // use the LED_PIN for spindle speed control or case light #undef LED_PIN #define SPINDLE_DIR_PIN 16 - #define SPINDLE_LASER_ENABLE_PIN 17 // Pin should have a pullup! + #define SPINDLE_LASER_ENA_PIN 17 // Pin should have a pullup! #define SPINDLE_LASER_PWM_PIN 8 // MUST BE HARDWARE PWM #else #undef LED_PIN diff --git a/Marlin/src/pins/pins_ULTIMAKER.h b/Marlin/src/pins/pins_ULTIMAKER.h index afaf3aa4fb..ca177f2ac0 100644 --- a/Marlin/src/pins/pins_ULTIMAKER.h +++ b/Marlin/src/pins/pins_ULTIMAKER.h @@ -160,5 +160,5 @@ // M3/M4/M5 - Spindle/Laser Control // #define SPINDLE_LASER_PWM_PIN 9 // MUST BE HARDWARE PWM -#define SPINDLE_LASER_ENABLE_PIN 10 // Pin should have a pullup! +#define SPINDLE_LASER_ENA_PIN 10 // Pin should have a pullup! #define SPINDLE_DIR_PIN 11 // use the EXP3 PWM header diff --git a/Marlin/src/pins/pins_ULTIMAKER_OLD.h b/Marlin/src/pins/pins_ULTIMAKER_OLD.h index 44e14354d8..3b6a2dc067 100644 --- a/Marlin/src/pins/pins_ULTIMAKER_OLD.h +++ b/Marlin/src/pins/pins_ULTIMAKER_OLD.h @@ -221,13 +221,13 @@ #define SPINDLE_DIR_PIN 10 // SW4 #define SPINDLE_LASER_PWM_PIN 9 // SW5 MUST BE HARDWARE PWM - #define SPINDLE_LASER_ENABLE_PIN 8 // SW6 Pin should have a pullup! + #define SPINDLE_LASER_ENA_PIN 8 // SW6 Pin should have a pullup! #elif ENABLED(board_rev_1_5) // use the same pins - but now they are on a different connector #define SPINDLE_DIR_PIN 10 // EXP3-6 (silkscreen says 10) #define SPINDLE_LASER_PWM_PIN 9 // EXP3-7 (silkscreen says 9) MUST BE HARDWARE PWM - #define SPINDLE_LASER_ENABLE_PIN 8 // EXP3-8 (silkscreen says 8) Pin should have a pullup! + #define SPINDLE_LASER_ENA_PIN 8 // EXP3-8 (silkscreen says 8) Pin should have a pullup! #elif ENABLED(board_rev_1_1_TO_1_3) @@ -251,12 +251,12 @@ #define E0_ENABLE_PIN 48 #define SPINDLE_DIR_PIN 43 #define SPINDLE_LASER_PWM_PIN 45 // MUST BE HARDWARE PWM - #define SPINDLE_LASER_ENABLE_PIN 41 // Pin should have a pullup! + #define SPINDLE_LASER_ENA_PIN 41 // Pin should have a pullup! #elif TEMP_SENSOR_BED == 0 // Can't use E0 so see if HEATER_BED_PIN is available #undef HEATER_BED_PIN #define SPINDLE_DIR_PIN 38 // Probably pin 4 on 10 pin connector closest to the E0 socket #define SPINDLE_LASER_PWM_PIN 4 // MUST BE HARDWARE PWM - Special precautions usually needed. - #define SPINDLE_LASER_ENABLE_PIN 40 // Pin should have a pullup! (Probably pin 6 on the 10-pin + #define SPINDLE_LASER_ENA_PIN 40 // Pin should have a pullup! (Probably pin 6 on the 10-pin // connector closest to the E0 socket) #endif #endif @@ -267,7 +267,7 @@ * * spindle signal socket name socket name * ------- - * SPINDLE_LASER_ENABLE_PIN /ENABLE *| |O VMOT + * SPINDLE_LASER_ENA_PIN /ENABLE *| |O VMOT * MS1 O| |O GND * MS2 O| |O 2B * MS3 O| |O 2A diff --git a/Marlin/src/pins/sensitive_pins.h b/Marlin/src/pins/sensitive_pins.h index 02d888cc43..e23960c8ad 100644 --- a/Marlin/src/pins/sensitive_pins.h +++ b/Marlin/src/pins/sensitive_pins.h @@ -35,7 +35,7 @@ #else #define _X_MAX #endif -#if PIN_EXISTS(X_CS) +#if PIN_EXISTS(X_CS) && AXIS_HAS_SPI(X) #define _X_CS X_CS_PIN, #else #define _X_CS @@ -68,7 +68,7 @@ #else #define _Y_MAX #endif -#if PIN_EXISTS(Y_CS) +#if PIN_EXISTS(Y_CS) && AXIS_HAS_SPI(Y) #define _Y_CS Y_CS_PIN, #else #define _Y_CS @@ -101,7 +101,7 @@ #else #define _Z_MAX #endif -#if PIN_EXISTS(Z_CS) +#if PIN_EXISTS(Z_CS) && AXIS_HAS_SPI(Z) #define _Z_CS Z_CS_PIN, #else #define _Z_CS @@ -139,7 +139,7 @@ #define _E0_MS3 #if E_NEEDED(0) - #if PIN_EXISTS(E0_CS) + #if PIN_EXISTS(E0_CS) && AXIS_HAS_SPI(E0) #undef _E0_CS #define _E0_CS E0_CS_PIN, #endif @@ -163,7 +163,7 @@ #define _E1_MS3 #if E_NEEDED(1) - #if PIN_EXISTS(E1_CS) + #if PIN_EXISTS(E1_CS) && AXIS_HAS_SPI(E1) #undef _E1_CS #define _E1_CS E1_CS_PIN, #endif @@ -187,7 +187,7 @@ #define _E2_MS3 #if E_NEEDED(2) - #if PIN_EXISTS(E2_CS) + #if PIN_EXISTS(E2_CS) && AXIS_HAS_SPI(E2) #undef _E2_CS #define _E2_CS E2_CS_PIN, #endif @@ -211,7 +211,7 @@ #define _E3_MS3 #if E_NEEDED(3) - #if PIN_EXISTS(E3_CS) + #if PIN_EXISTS(E3_CS) && AXIS_HAS_SPI(E3) #undef _E3_CS #define _E3_CS E3_CS_PIN, #endif @@ -235,7 +235,7 @@ #define _E4_MS3 #if E_NEEDED(4) - #if PIN_EXISTS(E4_CS) + #if PIN_EXISTS(E4_CS) && AXIS_HAS_SPI(E4) #undef _E4_CS #define _E4_CS E4_CS_PIN, #endif @@ -259,7 +259,7 @@ #define _E5_MS3 #if E_NEEDED(5) - #if PIN_EXISTS(E5_CS) + #if PIN_EXISTS(E5_CS) && AXIS_HAS_SPI(E5) #undef _E5_CS #define _E5_CS E5_CS_PIN, #endif @@ -368,7 +368,7 @@ // #if EITHER(DUAL_X_CARRIAGE, X_DUAL_STEPPER_DRIVERS) - #if PIN_EXISTS(X2_CS) + #if PIN_EXISTS(X2_CS) && AXIS_HAS_SPI(X2) #define _X2_CS X2_CS_PIN, #else #define _X2_CS @@ -394,7 +394,7 @@ #endif #if ENABLED(Y_DUAL_STEPPER_DRIVERS) - #if PIN_EXISTS(Y2_CS) + #if PIN_EXISTS(Y2_CS) && AXIS_HAS_SPI(Y2) #define _Y2_CS Y2_CS_PIN, #else #define _Y2_CS @@ -420,7 +420,7 @@ #endif #if Z_MULTI_STEPPER_DRIVERS - #if PIN_EXISTS(Z2_CS) + #if PIN_EXISTS(Z2_CS) && AXIS_HAS_SPI(Z2) #define _Z2_CS Z2_CS_PIN, #else #define _Z2_CS @@ -446,7 +446,7 @@ #endif #if ENABLED(Z_TRIPLE_STEPPER_DRIVERS) - #if PIN_EXISTS(Z3_CS) + #if PIN_EXISTS(Z3_CS) && AXIS_HAS_SPI(Z3) #define _Z3_CS Z3_CS_PIN, #else #define _Z3_CS