From ee31e8e9685a6e671a4430eb77db2ca37c5b1843 Mon Sep 17 00:00:00 2001 From: InsanityAutomation Date: Fri, 23 Nov 2018 20:42:39 -0500 Subject: [PATCH] Bump to head with initial raptor2 support --- Marlin/Configuration.h | 105 +- Marlin/Configuration_adv.h | 55 +- Marlin/Makefile | 390 +- Marlin/_Statusscreen.h | 464 +- Marlin/src/HAL/HAL_AVR/HAL.h | 28 +- Marlin/src/HAL/HAL_AVR/MarlinSerial.cpp | 476 +- Marlin/src/HAL/HAL_AVR/MarlinSerial.h | 264 +- Marlin/src/HAL/HAL_AVR/SanityCheck.h | 12 +- Marlin/src/HAL/HAL_AVR/ServoTimers.h | 6 +- Marlin/src/HAL/HAL_AVR/endstop_interrupts.h | 13 +- Marlin/src/HAL/HAL_AVR/fastio_1280.h | 6 +- Marlin/src/HAL/HAL_AVR/fastio_1281.h | 6 +- Marlin/src/HAL/HAL_AVR/fastio_168.h | 6 +- Marlin/src/HAL/HAL_AVR/fastio_644.h | 6 +- Marlin/src/HAL/HAL_AVR/fastio_AT90USB.h | 6 +- Marlin/src/HAL/HAL_AVR/fastio_AVR.h | 6 +- Marlin/src/HAL/HAL_AVR/math_AVR.h | 16 +- .../HAL/HAL_AVR/persistent_store_eeprom.cpp | 6 +- Marlin/src/HAL/HAL_AVR/pinsDebug.h | 6 +- .../src/HAL/HAL_AVR/pinsDebug_Teensyduino.h | 6 +- Marlin/src/HAL/HAL_AVR/pinsDebug_plus_70.h | 7 +- Marlin/src/HAL/HAL_AVR/spi_pins.h | 7 +- Marlin/src/HAL/HAL_AVR/watchdog_AVR.cpp | 5 +- Marlin/src/HAL/HAL_AVR/watchdog_AVR.h | 6 +- Marlin/src/HAL/HAL_DUE/DebugMonitor_Due.cpp | 4 +- Marlin/src/HAL/HAL_DUE/HAL.cpp | 1 + Marlin/src/HAL/HAL_DUE/HAL.h | 32 +- Marlin/src/HAL/HAL_DUE/HAL_spi_Due.cpp | 287 +- Marlin/src/HAL/HAL_DUE/HAL_timers_Due.cpp | 2 +- Marlin/src/HAL/HAL_DUE/HAL_timers_Due.h | 6 +- .../src/HAL/HAL_DUE/InterruptVectors_Due.cpp | 1 + Marlin/src/HAL/HAL_DUE/InterruptVectors_Due.h | 7 +- .../src/HAL/HAL_DUE/MarlinSerialUSB_Due.cpp | 6 +- Marlin/src/HAL/HAL_DUE/MarlinSerialUSB_Due.h | 11 +- Marlin/src/HAL/HAL_DUE/MarlinSerial_Due.cpp | 1092 ++- Marlin/src/HAL/HAL_DUE/MarlinSerial_Due.h | 122 +- Marlin/src/HAL/HAL_DUE/Servo_Due.cpp | 6 +- Marlin/src/HAL/HAL_DUE/Tone.cpp | 1 + Marlin/src/HAL/HAL_DUE/endstop_interrupts.h | 6 +- Marlin/src/HAL/HAL_DUE/fastio_Due.h | 11 +- .../HAL/HAL_DUE/persistent_store_eeprom.cpp | 2 +- Marlin/src/HAL/HAL_DUE/spi_pins.h | 18 +- .../HAL_DUE/u8g_com_HAL_DUE_shared_hw_spi.cpp | 12 +- .../HAL_DUE/u8g_com_HAL_DUE_st7920_sw_spi.cpp | 4 +- Marlin/src/HAL/HAL_DUE/usb/arduino_due_x.h | 12 +- Marlin/src/HAL/HAL_DUE/usb/compiler.h | 2 +- Marlin/src/HAL/HAL_DUE/usb/conf_usb.h | 8 +- Marlin/src/HAL/HAL_DUE/usb/sd_mmc_spi_mem.cpp | 14 +- Marlin/src/HAL/HAL_DUE/watchdog_Due.h | 6 +- Marlin/src/HAL/HAL_ESP32/HAL.h | 10 +- Marlin/src/HAL/HAL_ESP32/HAL_timers_ESP32.h | 6 +- Marlin/src/HAL/HAL_ESP32/endstop_interrupts.h | 6 +- Marlin/src/HAL/HAL_ESP32/fastio_ESP32.h | 10 +- Marlin/src/HAL/HAL_ESP32/ota.h | 6 +- Marlin/src/HAL/HAL_ESP32/spi_pins.h | 6 +- Marlin/src/HAL/HAL_ESP32/watchdog_ESP32.h | 8 +- .../HAL/HAL_LPC1768/DebugMonitor_LPC1768.cpp | 318 + Marlin/src/HAL/HAL_LPC1768/HAL.cpp | 233 +- Marlin/src/HAL/HAL_LPC1768/HAL.h | 103 +- Marlin/src/HAL/HAL_LPC1768/HAL_spi.cpp | 75 +- Marlin/src/HAL/HAL_LPC1768/HAL_temp.h | 1 - Marlin/src/HAL/HAL_LPC1768/HAL_timers.h | 9 +- Marlin/src/HAL/HAL_LPC1768/LPC1768_PWM.cpp | 576 -- Marlin/src/HAL/HAL_LPC1768/LPC1768_PWM.h | 79 - Marlin/src/HAL/HAL_LPC1768/LPC1768_Servo.cpp | 163 - Marlin/src/HAL/HAL_LPC1768/LPC1768_Servo.h | 62 - Marlin/src/HAL/HAL_LPC1768/MarlinSerial.cpp | 56 + Marlin/src/HAL/HAL_LPC1768/MarlinSerial.h | 67 + .../{servo_private.h => MarlinServo.h} | 48 +- Marlin/src/HAL/HAL_LPC1768/SanityCheck.h | 8 + Marlin/src/HAL/HAL_LPC1768/SoftwareSPI.cpp | 90 - Marlin/src/HAL/HAL_LPC1768/SoftwareSPI.h | 50 - Marlin/src/HAL/HAL_LPC1768/WInterrupts.cpp | 162 - Marlin/src/HAL/HAL_LPC1768/arduino.cpp | 179 - .../src/HAL/HAL_LPC1768/debug_extra_script.py | 21 - .../src/HAL/HAL_LPC1768/endstop_interrupts.h | 12 +- Marlin/src/HAL/HAL_LPC1768/fastio.h | 34 +- Marlin/src/HAL/HAL_LPC1768/include/Arduino.h | 125 - .../HAL_LPC1768/include/HardwareSerial.cpp | 335 - .../HAL/HAL_LPC1768/include/HardwareSerial.h | 91 - .../HAL_LPC1768/include/SoftwareSerial.cpp | 329 - .../HAL/HAL_LPC1768/include/SoftwareSerial.h | 120 - Marlin/src/HAL/HAL_LPC1768/include/Wire.cpp | 219 - Marlin/src/HAL/HAL_LPC1768/include/Wire.h | 67 - .../include/digipot_mcp4451_I2C_routines.h | 6 +- .../HAL/HAL_LPC1768/include/pinmapping.cpp | 74 - .../src/HAL/HAL_LPC1768/include/pinmapping.h | 294 - Marlin/src/HAL/HAL_LPC1768/include/serial.h | 161 - .../HAL/HAL_LPC1768/lpc1768_flag_script.py | 60 - Marlin/src/HAL/HAL_LPC1768/main.cpp | 148 +- .../HAL/HAL_LPC1768/persistent_store_api.h | 2 +- .../HAL_LPC1768/persistent_store_flash.cpp | 23 +- .../HAL_LPC1768/persistent_store_sdcard.cpp | 2 +- Marlin/src/HAL/HAL_LPC1768/spi_pins.h | 11 +- .../HAL_LPC1768/u8g/HAL_LCD_I2C_routines.c | 8 +- .../{ => u8g}/u8g_com_HAL_LPC1768_hw_spi.cpp | 6 +- .../u8g_com_HAL_LPC1768_ssd_hw_i2c.cpp | 10 +- ...LPC1768_ssd_sw_i2c.cpp under construction | 8 +- .../u8g_com_HAL_LPC1768_st7920_hw_spi.cpp | 8 +- .../u8g_com_HAL_LPC1768_st7920_sw_spi.cpp | 9 +- .../{ => u8g}/u8g_com_HAL_LPC1768_sw_spi.cpp | 7 +- Marlin/src/HAL/HAL_LPC1768/usb_serial.cpp | 13 + Marlin/src/HAL/HAL_LPC1768/watchdog.cpp | 30 +- Marlin/src/HAL/HAL_LPC1768/watchdog.h | 6 +- .../win_usb_driver/lpc176x_usb_driver.inf | 36 + Marlin/src/HAL/HAL_STM32/HAL.cpp | 146 + Marlin/src/HAL/HAL_STM32/HAL.h | 220 + Marlin/src/HAL/HAL_STM32/HAL_Servo_STM32.cpp | 57 + Marlin/src/HAL/HAL_STM32/HAL_Servo_STM32.h | 36 + Marlin/src/HAL/HAL_STM32/HAL_spi_STM32.cpp | 155 + Marlin/src/HAL/HAL_STM32/HAL_timers_STM32.cpp | 117 + Marlin/src/HAL/HAL_STM32/HAL_timers_STM32.h | 178 + Marlin/src/HAL/HAL_STM32/README.md | 11 + Marlin/src/HAL/HAL_STM32/SanityCheck.h | 71 + Marlin/src/HAL/HAL_STM32/endstop_interrupts.h | 64 + Marlin/src/HAL/HAL_STM32/fastio_STM32.cpp | 34 + Marlin/src/HAL/HAL_STM32/fastio_STM32.h | 82 + .../HAL/HAL_STM32/persistent_store_impl.cpp | 119 + Marlin/src/HAL/HAL_STM32/pinsDebug.h | 1 + Marlin/src/HAL/HAL_STM32/spi_pins.h | 35 + Marlin/src/HAL/HAL_STM32/watchdog_STM32.cpp | 42 + Marlin/src/HAL/HAL_STM32/watchdog_STM32.h | 25 + Marlin/src/HAL/HAL_STM32F1/HAL.h | 23 +- .../src/HAL/HAL_STM32F1/HAL_Servo_Stm32f1.h | 6 +- .../src/HAL/HAL_STM32F1/HAL_timers_Stm32f1.h | 6 +- Marlin/src/HAL/HAL_STM32F1/README.md | 9 - .../src/HAL/HAL_STM32F1/endstop_interrupts.h | 6 +- Marlin/src/HAL/HAL_STM32F1/fastio_Stm32f1.h | 12 +- .../HAL_STM32F1/persistent_store_sdcard.cpp | 4 +- Marlin/src/HAL/HAL_STM32F1/spi_pins.h | 6 +- Marlin/src/HAL/HAL_STM32F1/watchdog_Stm32f1.h | 6 +- .../HAL_STM32F4/EEPROM_Emul/eeprom_emul.cpp | 8 +- .../HAL/HAL_STM32F4/EEPROM_Emul/eeprom_emul.h | 7 +- Marlin/src/HAL/HAL_STM32F4/EmulatedEeprom.cpp | 7 +- Marlin/src/HAL/HAL_STM32F4/HAL.cpp | 2 +- Marlin/src/HAL/HAL_STM32F4/HAL.h | 15 +- .../src/HAL/HAL_STM32F4/HAL_Servo_STM32F4.cpp | 2 +- .../src/HAL/HAL_STM32F4/HAL_Servo_STM32F4.h | 10 +- .../src/HAL/HAL_STM32F4/HAL_spi_STM32F4.cpp | 2 +- .../HAL/HAL_STM32F4/HAL_timers_STM32F4.cpp | 4 +- .../src/HAL/HAL_STM32F4/HAL_timers_STM32F4.h | 6 +- .../src/HAL/HAL_STM32F4/endstop_interrupts.h | 6 +- Marlin/src/HAL/HAL_STM32F4/fastio_STM32F4.h | 15 +- .../HAL_STM32F4/persistent_store_eeprom.cpp | 4 +- Marlin/src/HAL/HAL_STM32F4/spi_pins.h | 50 +- .../src/HAL/HAL_STM32F4/watchdog_STM32F4.cpp | 8 +- Marlin/src/HAL/HAL_STM32F4/watchdog_STM32F4.h | 8 +- .../HAL_STM32F7/EEPROM_Emul/eeprom_emul.cpp | 6 +- .../HAL/HAL_STM32F7/EEPROM_Emul/eeprom_emul.h | 7 +- Marlin/src/HAL/HAL_STM32F7/EmulatedEeprom.cpp | 5 +- Marlin/src/HAL/HAL_STM32F7/HAL.cpp | 1 - Marlin/src/HAL/HAL_STM32F7/HAL.h | 13 +- .../src/HAL/HAL_STM32F7/HAL_Servo_STM32F7.h | 6 +- .../HAL/HAL_STM32F7/HAL_timers_STM32F7.cpp | 4 +- .../src/HAL/HAL_STM32F7/HAL_timers_STM32F7.h | 6 +- Marlin/src/HAL/HAL_STM32F7/TMC2660.cpp | 8 +- Marlin/src/HAL/HAL_STM32F7/TMC2660.h | 15 +- .../src/HAL/HAL_STM32F7/endstop_interrupts.h | 8 +- Marlin/src/HAL/HAL_STM32F7/fastio_STM32F7.h | 12 +- .../HAL_STM32F7/persistent_store_eeprom.cpp | 2 +- Marlin/src/HAL/HAL_STM32F7/spi_pins.h | 41 +- Marlin/src/HAL/HAL_STM32F7/watchdog_STM32F7.h | 8 +- Marlin/src/HAL/HAL_TEENSY31_32/HAL.cpp | 2 +- .../HAL/HAL_TEENSY31_32/HAL_spi_Teensy.cpp | 2 +- .../HAL_TEENSY31_32/persistent_store_impl.cpp | 2 +- Marlin/src/HAL/HAL_TEENSY35_36/HAL.cpp | 28 +- Marlin/src/HAL/HAL_TEENSY35_36/HAL.h | 10 +- .../HAL/HAL_TEENSY35_36/HAL_Servo_Teensy.h | 26 +- .../HAL/HAL_TEENSY35_36/HAL_timers_Teensy.h | 45 +- .../HAL/HAL_TEENSY35_36/endstop_interrupts.h | 6 +- .../src/HAL/HAL_TEENSY35_36/fastio_Teensy.h | 6 +- .../persistent_store_eeprom.cpp | 2 +- .../HAL_TEENSY35_36/persistent_store_impl.cpp | 2 +- Marlin/src/HAL/HAL_TEENSY35_36/pinsDebug.h | 2 +- Marlin/src/HAL/HAL_TEENSY35_36/spi_pins.h | 8 +- .../src/HAL/HAL_TEENSY35_36/watchdog_Teensy.h | 10 +- Marlin/src/HAL/platforms.h | 36 +- Marlin/src/HAL/shared/Delay.h | 115 +- Marlin/src/HAL/shared/HAL_SPI.h | 6 +- Marlin/src/HAL/shared/I2cEeprom.cpp | 8 +- Marlin/src/HAL/shared/MarlinSerial.h | 60 + Marlin/src/HAL/shared/backtrace/backtrace.h | 6 +- Marlin/src/HAL/shared/backtrace/unwarm.cpp | 2 +- Marlin/src/HAL/shared/backtrace/unwarm.h | 7 +- .../src/HAL/shared/backtrace/unwarm_arm.cpp | 10 +- .../src/HAL/shared/backtrace/unwarm_thumb.cpp | 2 +- Marlin/src/HAL/shared/backtrace/unwarmbytab.h | 5 +- Marlin/src/HAL/shared/backtrace/unwarmmem.cpp | 2 +- Marlin/src/HAL/shared/backtrace/unwarmmem.h | 6 +- Marlin/src/HAL/shared/backtrace/unwinder.cpp | 2 - Marlin/src/HAL/shared/backtrace/unwinder.h | 5 +- .../src/HAL/shared/backtrace/unwmemaccess.cpp | 15 +- .../src/HAL/shared/backtrace/unwmemaccess.h | 6 +- Marlin/src/HAL/shared/math_32bit.h | 6 +- .../src/HAL/shared/persistent_store_api.cpp | 2 +- Marlin/src/HAL/shared/servo.cpp | 2 +- Marlin/src/HAL/shared/servo.h | 8 +- Marlin/src/HAL/shared/servo_private.h | 6 +- Marlin/src/Marlin.cpp | 150 +- Marlin/src/Marlin.h | 29 +- Marlin/src/config/default/Configuration.h | 63 +- Marlin/src/config/default/Configuration_adv.h | 241 +- .../AlephObjects/TAZ4/Configuration.h | 63 +- .../AlephObjects/TAZ4/Configuration_adv.h | 240 +- .../AliExpress/CL-260/Configuration.h | 63 +- .../config/examples/Anet/A2/Configuration.h | 65 +- .../examples/Anet/A2/Configuration_adv.h | 240 +- .../examples/Anet/A2plus/Configuration.h | 65 +- .../examples/Anet/A2plus/Configuration_adv.h | 240 +- .../config/examples/Anet/A6/Configuration.h | 67 +- .../examples/Anet/A6/Configuration_adv.h | 241 +- .../config/examples/Anet/A8/Configuration.h | 65 +- .../examples/Anet/A8/Configuration_adv.h | 242 +- .../examples/AnimationExample/_Bootscreen.h | 339 + .../src/config/examples/ArmEd/Configuration.h | 2031 ++++++ .../config/examples/ArmEd/Configuration_adv.h | 1859 +++++ .../examples/Azteeg/X5GT/Configuration.h | 63 +- .../BIBO/TouchX/cyclops/Configuration.h | 63 +- .../BIBO/TouchX/cyclops/Configuration_adv.h | 241 +- .../BIBO/TouchX/default/Configuration.h | 63 +- .../BIBO/TouchX/default/Configuration_adv.h | 240 +- .../examples/BQ/Hephestos/Configuration.h | 63 +- .../examples/BQ/Hephestos/Configuration_adv.h | 242 +- .../examples/BQ/Hephestos_2/Configuration.h | 63 +- .../BQ/Hephestos_2/Configuration_adv.h | 240 +- .../config/examples/BQ/WITBOX/Configuration.h | 63 +- .../examples/BQ/WITBOX/Configuration_adv.h | 242 +- .../config/examples/Cartesio/Configuration.h | 63 +- .../examples/Cartesio/Configuration_adv.h | 240 +- .../examples/Creality/CR-10/Configuration.h | 63 +- .../Creality/CR-10/Configuration_adv.h | 240 +- .../examples/Creality/CR-10/_Statusscreen.h | 77 +- .../examples/Creality/CR-10S/Configuration.h | 97 +- .../Creality/CR-10S/Configuration_adv.h | 240 +- .../examples/Creality/CR-10S/_Statusscreen.h | 455 +- .../Creality/CR-10mini/Configuration.h | 63 +- .../Creality/CR-10mini/Configuration_adv.h | 240 +- .../Creality/CR-10mini/_Statusscreen.h | 85 +- .../examples/Creality/CR-8/Configuration.h | 63 +- .../Creality/CR-8/Configuration_adv.h | 240 +- .../examples/Creality/Ender-2/Configuration.h | 65 +- .../Creality/Ender-2/Configuration_adv.h | 240 +- .../examples/Creality/Ender-2/README.md | 15 + .../examples/Creality/Ender-2/_Statusscreen.h | 125 +- .../examples/Creality/Ender-3/Configuration.h | 65 +- .../Creality/Ender-3/Configuration_adv.h | 240 +- .../examples/Creality/Ender-3/_Statusscreen.h | 121 +- .../examples/Creality/Ender-4/Configuration.h | 103 +- .../Creality/Ender-4/Configuration_adv.h | 270 +- .../examples/Einstart-S/Configuration.h | 54 +- .../examples/Einstart-S/Configuration_adv.h | 240 +- .../src/config/examples/Einstart-S/readme.md | 2 +- .../src/config/examples/Felix/Configuration.h | 65 +- .../config/examples/Felix/Configuration_adv.h | 240 +- .../examples/Felix/DUAL/Configuration.h | 65 +- .../FolgerTech/i3-2020/Configuration.h | 63 +- .../FolgerTech/i3-2020/Configuration_adv.h | 240 +- .../examples/Formbot/Raptor/Configuration.h | 97 +- .../Formbot/Raptor/Configuration_adv.h | 248 +- .../examples/Formbot/Raptor/_Statusscreen.h | 455 +- .../examples/Formbot/T_Rex_2+/Configuration.h | 97 +- .../Formbot/T_Rex_2+/Configuration_adv.h | 289 +- .../examples/Formbot/T_Rex_2+/_Bootscreen.h | 2 - .../examples/Formbot/T_Rex_2+/_Statusscreen.h | 133 +- .../examples/Formbot/T_Rex_3/Configuration.h | 63 +- .../Formbot/T_Rex_3/Configuration_adv.h | 236 +- .../examples/Formbot/T_Rex_3/_Bootscreen.h | 2 - .../examples/Formbot/T_Rex_3/_Statusscreen.h | 134 +- .../examples/Geeetech/GT2560/Configuration.h | 67 +- .../Geeetech/I3_Pro_X-GT2560/Configuration.h | 63 +- .../Geeetech/MeCreator2/Configuration.h | 2026 ++++++ .../Geeetech/MeCreator2/Configuration_adv.h | 1871 +++++ .../Prusa i3 Pro B/bltouch/Configuration.h | 69 +- .../Prusa i3 Pro B/noprobe/Configuration.h | 65 +- .../Geeetech/Prusa i3 Pro C/Configuration.h | 65 +- .../Prusa i3 Pro C/Configuration_adv.h | 240 +- .../Geeetech/Prusa i3 Pro W/Configuration.h | 65 +- .../Prusa i3 Pro W/Configuration_adv.h | 240 +- .../examples/Infitary/i3-M508/Configuration.h | 63 +- .../Infitary/i3-M508/Configuration_adv.h | 240 +- .../examples/JGAurora/A5/Configuration.h | 66 +- .../examples/JGAurora/A5/Configuration_adv.h | 240 +- .../examples/MakerParts/Configuration.h | 63 +- .../examples/MakerParts/Configuration_adv.h | 240 +- .../examples/Malyan/M150/Configuration.h | 63 +- .../examples/Malyan/M150/Configuration_adv.h | 240 +- .../examples/Malyan/M200/Configuration.h | 65 +- .../examples/Malyan/M200/Configuration_adv.h | 240 +- .../Micromake/C1/basic/Configuration.h | 63 +- .../Micromake/C1/enhanced/Configuration.h | 63 +- .../Micromake/C1/enhanced/Configuration_adv.h | 242 +- .../config/examples/Mks/Sbase/Configuration.h | 63 +- .../examples/Mks/Sbase/Configuration_adv.h | 240 +- .../examples/RepRapPro/Huxley/Configuration.h | 65 +- .../RepRapWorld/Megatronics/Configuration.h | 63 +- .../config/examples/RigidBot/Configuration.h | 65 +- .../examples/RigidBot/Configuration_adv.h | 240 +- .../src/config/examples/SCARA/Configuration.h | 65 +- .../config/examples/SCARA/Configuration_adv.h | 240 +- .../config/examples/STM32F10/Configuration.h | 63 +- .../config/examples/STM32F4/Configuration.h | 65 +- .../examples/Sanguinololu/Configuration.h | 63 +- .../examples/Sanguinololu/Configuration_adv.h | 240 +- .../config/examples/TheBorg/Configuration.h | 63 +- .../examples/TheBorg/Configuration_adv.h | 240 +- .../config/examples/TinyBoy2/Configuration.h | 63 +- .../examples/TinyBoy2/Configuration_adv.h | 240 +- .../config/examples/Tronxy/X1/Configuration.h | 63 +- .../examples/Tronxy/X3A/Configuration.h | 63 +- .../examples/Tronxy/X3A/Configuration_adv.h | 240 +- .../examples/Tronxy/X5S/Configuration.h | 63 +- .../examples/Tronxy/XY100/Configuration.h | 63 +- .../UltiMachine/Archim1/Configuration.h | 2019 ++++++ .../UltiMachine/Archim1/Configuration_adv.h | 1886 +++++ .../UltiMachine/Archim2/Configuration.h | 63 +- .../UltiMachine/Archim2/Configuration_adv.h | 240 +- .../examples/Velleman/K8200/Configuration.h | 63 +- .../Velleman/K8200/Configuration_adv.h | 240 +- .../examples/Velleman/K8400/Configuration.h | 63 +- .../Velleman/K8400/Configuration_adv.h | 240 +- .../Velleman/K8400/Dual-head/Configuration.h | 63 +- .../Wanhao/Duplicator 6/Configuration.h | 63 +- .../Wanhao/Duplicator 6/Configuration_adv.h | 240 +- .../examples/adafruit/ST7565/Configuration.h | 63 +- .../delta/Anycubic/Kossel/Configuration.h | 102 +- .../delta/Anycubic/Kossel/Configuration_adv.h | 240 +- .../FLSUN/auto_calibrate/Configuration.h | 73 +- .../FLSUN/auto_calibrate/Configuration_adv.h | 240 +- .../delta/FLSUN/kossel/Configuration.h | 73 +- .../delta/FLSUN/kossel/Configuration_adv.h | 240 +- .../delta/FLSUN/kossel_mini/Configuration.h | 73 +- .../FLSUN/kossel_mini/Configuration_adv.h | 240 +- .../Geeetech/Rostock 301/Configuration.h | 2148 ++++++ .../Geeetech/Rostock 301/Configuration_adv.h | 1860 +++++ .../delta/Hatchbox_Alpha/Configuration.h | 75 +- .../delta/Tevo Little Monster/Configuration.h | 2138 ++++++ .../Tevo Little Monster/Configuration_adv.h | 1875 +++++ .../examples/delta/generic/Configuration.h | 73 +- .../delta/generic/Configuration_adv.h | 240 +- .../delta/kossel_mini/Configuration.h | 73 +- .../delta/kossel_mini/Configuration_adv.h | 240 +- .../examples/delta/kossel_pro/Configuration.h | 71 +- .../examples/delta/kossel_xl/Configuration.h | 73 +- .../delta/kossel_xl/Configuration_adv.h | 240 +- .../examples/gCreate/gMax1.5+/Configuration.h | 63 +- .../gCreate/gMax1.5+/Configuration_adv.h | 240 +- .../config/examples/makibox/Configuration.h | 65 +- .../examples/makibox/Configuration_adv.h | 240 +- .../examples/stm32f103ret6/Configuration.h | 63 +- .../examples/tvrrug/Round2/Configuration.h | 63 +- .../tvrrug/Round2/Configuration_adv.h | 240 +- .../src/config/examples/wt150/Configuration.h | 63 +- .../config/examples/wt150/Configuration_adv.h | 240 +- Marlin/src/core/boards.h | 16 +- Marlin/src/core/drivers.h | 15 +- Marlin/src/core/enum.h | 22 +- Marlin/src/core/language.h | 72 +- Marlin/src/core/macros.h | 59 +- Marlin/src/core/{types.h => millis_t.h} | 8 +- Marlin/src/core/minmax.h | 71 + Marlin/src/core/serial.cpp | 55 +- Marlin/src/core/serial.h | 306 +- Marlin/src/core/utility.cpp | 31 +- Marlin/src/core/utility.h | 10 +- Marlin/src/feature/I2CPositionEncoder.cpp | 26 +- Marlin/src/feature/I2CPositionEncoder.h | 16 +- Marlin/src/feature/Max7219_Debug_LEDs.h | 2 +- Marlin/src/feature/baricuda.h | 6 +- Marlin/src/feature/bedlevel/abl/abl.cpp | 1 + Marlin/src/feature/bedlevel/abl/abl.h | 42 +- Marlin/src/feature/bedlevel/bedlevel.cpp | 5 +- Marlin/src/feature/bedlevel/bedlevel.h | 8 +- .../bedlevel/mbl/mesh_bed_leveling.cpp | 4 +- .../feature/bedlevel/mbl/mesh_bed_leveling.h | 18 +- Marlin/src/feature/bedlevel/ubl/ubl.cpp | 38 +- Marlin/src/feature/bedlevel/ubl/ubl.h | 34 +- Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp | 733 +- Marlin/src/feature/caselight.h | 6 +- Marlin/src/feature/controllerfan.cpp | 4 +- Marlin/src/feature/controllerfan.h | 6 +- Marlin/src/feature/dac/dac_dac084s085.h | 26 +- Marlin/src/feature/dac/dac_mcp4728.h | 6 +- Marlin/src/feature/dac/stepper_dac.h | 23 +- Marlin/src/feature/digipot/digipot.h | 6 +- Marlin/src/feature/emergency_parser.cpp | 3 +- Marlin/src/feature/emergency_parser.h | 18 +- Marlin/src/feature/fanmux.h | 6 +- Marlin/src/feature/filwidth.h | 6 +- Marlin/src/feature/fwretract.cpp | 86 +- Marlin/src/feature/fwretract.h | 46 +- Marlin/src/feature/leds/blinkm.h | 6 +- Marlin/src/feature/leds/leds.cpp | 17 +- Marlin/src/feature/leds/leds.h | 50 +- Marlin/src/feature/leds/neopixel.h | 6 +- Marlin/src/feature/leds/pca9632.h | 6 +- .../src/feature/leds/printer_event_leds.cpp | 81 + Marlin/src/feature/leds/printer_event_leds.h | 79 + Marlin/src/feature/leds/tempstat.cpp | 14 +- Marlin/src/feature/leds/tempstat.h | 6 +- Marlin/src/feature/mixing.cpp | 137 +- Marlin/src/feature/mixing.h | 98 +- Marlin/src/feature/pause.cpp | 188 +- Marlin/src/feature/pause.h | 30 +- Marlin/src/feature/power.cpp | 6 +- Marlin/src/feature/power.h | 8 +- Marlin/src/feature/power_loss_recovery.cpp | 513 +- Marlin/src/feature/power_loss_recovery.h | 68 +- Marlin/src/feature/runout.cpp | 49 +- Marlin/src/feature/runout.h | 341 +- Marlin/src/feature/snmm.h | 6 +- Marlin/src/feature/solenoid.cpp | 4 +- Marlin/src/feature/solenoid.h | 7 +- Marlin/src/feature/tmc_util.cpp | 436 +- Marlin/src/feature/tmc_util.h | 184 +- Marlin/src/feature/twibus.h | 6 +- Marlin/src/gcode/bedlevel/G26.cpp | 192 +- Marlin/src/gcode/bedlevel/M420.cpp | 36 +- Marlin/src/gcode/bedlevel/abl/G29.cpp | 27 +- Marlin/src/gcode/bedlevel/mbl/G29.cpp | 72 +- Marlin/src/gcode/calibrate/G28.cpp | 27 +- Marlin/src/gcode/calibrate/G33.cpp | 22 +- Marlin/src/gcode/calibrate/G34_M422.cpp | 286 + Marlin/src/gcode/calibrate/M100.cpp | 19 +- Marlin/src/gcode/calibrate/M48.cpp | 2 - Marlin/src/gcode/calibrate/M665.cpp | 49 +- Marlin/src/gcode/calibrate/M666.cpp | 25 +- Marlin/src/gcode/calibrate/M852.cpp | 18 +- Marlin/src/gcode/config/M200-M205.cpp | 67 +- Marlin/src/gcode/config/M217.cpp | 92 + Marlin/src/gcode/config/M218.cpp | 24 +- Marlin/src/gcode/config/M221.cpp | 5 +- Marlin/src/gcode/config/M304.cpp | 12 +- Marlin/src/gcode/config/M43.cpp | 2 +- Marlin/src/gcode/config/M92.cpp | 15 +- Marlin/src/gcode/control/M108_M112_M410.cpp | 5 +- Marlin/src/gcode/control/M111.cpp | 10 +- Marlin/src/gcode/control/M17_M18_M84.cpp | 10 +- Marlin/src/gcode/control/M211.cpp | 14 +- Marlin/src/gcode/control/M350_M351.cpp | 14 +- Marlin/src/gcode/control/M380_M381.cpp | 15 +- Marlin/src/gcode/control/M42.cpp | 6 +- Marlin/src/gcode/control/M605.cpp | 89 +- Marlin/src/gcode/control/M80_M81.cpp | 14 +- Marlin/src/gcode/control/M999.cpp | 2 +- Marlin/src/gcode/control/T.cpp | 16 +- Marlin/src/gcode/eeprom/M500-M504.cpp | 13 + Marlin/src/gcode/feature/camera/M240.cpp | 16 +- .../src/gcode/feature/fwretract/M207-M209.cpp | 18 +- Marlin/src/gcode/feature/macro/M810-M819.cpp | 67 + Marlin/src/gcode/feature/mixing/M163-M165.cpp | 55 +- Marlin/src/gcode/feature/pause/M125.cpp | 23 +- Marlin/src/gcode/feature/pause/M600.cpp | 13 +- Marlin/src/gcode/feature/pause/M603.cpp | 11 +- Marlin/src/gcode/feature/pause/M701_M702.cpp | 27 +- Marlin/src/gcode/feature/powerloss/M1000.cpp | 65 + Marlin/src/gcode/feature/powerloss/M413.cpp | 58 + Marlin/src/gcode/feature/runout/M412.cpp | 45 + Marlin/src/gcode/feature/trinamic/M122.cpp | 12 +- Marlin/src/gcode/feature/trinamic/M906.cpp | 11 +- .../src/gcode/feature/trinamic/M911-M915.cpp | 244 +- Marlin/src/gcode/gcode.cpp | 157 +- Marlin/src/gcode/gcode.h | 115 +- Marlin/src/gcode/geometry/G53-G59.cpp | 2 +- Marlin/src/gcode/geometry/G92.cpp | 4 +- Marlin/src/gcode/geometry/M206_M428.cpp | 1 - Marlin/src/gcode/host/M115.cpp | 9 +- Marlin/src/gcode/lcd/M0_M1.cpp | 24 +- Marlin/src/gcode/lcd/M117.cpp | 2 +- Marlin/src/gcode/lcd/M145.cpp | 14 +- Marlin/src/gcode/lcd/M250.cpp | 6 +- Marlin/src/gcode/lcd/M73.cpp | 6 +- Marlin/src/gcode/motion/G0_G1.cpp | 42 +- Marlin/src/gcode/motion/G2_G3.cpp | 15 +- Marlin/src/gcode/motion/G4.cpp | 2 +- Marlin/src/gcode/motion/G80.cpp | 38 + Marlin/src/gcode/motion/M290.cpp | 4 +- Marlin/src/gcode/parser.cpp | 119 +- Marlin/src/gcode/parser.h | 134 +- Marlin/src/gcode/queue.cpp | 397 +- Marlin/src/gcode/queue.h | 12 +- ...M928.cpp => M20-M30_M32-M34_M524_M928.cpp} | 60 +- Marlin/src/gcode/stats/M31.cpp | 2 +- Marlin/src/gcode/stats/M75-M78.cpp | 25 +- Marlin/src/gcode/temperature/M104_M109.cpp | 170 +- Marlin/src/gcode/temperature/M105.cpp | 8 +- Marlin/src/gcode/temperature/M106_M107.cpp | 36 +- Marlin/src/gcode/temperature/M140_M190.cpp | 112 +- Marlin/src/gcode/temperature/M303.cpp | 48 +- Marlin/src/inc/Conditionals_LCD.h | 147 +- Marlin/src/inc/Conditionals_adv.h | 36 +- Marlin/src/inc/Conditionals_post.h | 188 +- Marlin/src/inc/MarlinConfig.h | 11 +- Marlin/src/inc/MarlinConfigPre.h | 12 +- Marlin/src/inc/SanityCheck.h | 320 +- Marlin/src/inc/Version.h | 4 +- .../lcd/{ => HD44780}/lcdprint_hd44780.cpp | 213 +- .../ultralcd_HD44780.cpp} | 1083 +-- Marlin/src/lcd/HD44780/ultralcd_HD44780.h | 101 + Marlin/src/lcd/dogm/HAL_LCD_class_defines.h | 78 +- Marlin/src/lcd/dogm/HAL_LCD_com_defines.h | 5 +- Marlin/src/lcd/dogm/dogm_Bootscreen.h | 137 + Marlin/src/lcd/dogm/dogm_Statusscreen.h | 1168 +++ Marlin/src/lcd/dogm/dogm_bitmaps.h | 1193 ---- .../fontdata_6x9_marlin.h} | 0 .../fontdata_ISO10646_1.h} | 0 .../langdata_an.h} | 0 .../langdata_bg.h} | 0 .../langdata_ca.h} | 0 .../langdata_cz.h} | 0 .../langdata_da.h} | 0 .../langdata_de.h} | 0 .../langdata_el-gr.h} | 0 .../langdata_el.h} | 0 .../langdata_en.h} | 0 .../langdata_es.h} | 0 .../langdata_eu.h} | 0 .../langdata_fi.h} | 0 .../langdata_fr.h} | 0 .../langdata_gl.h} | 0 .../langdata_hr.h} | 0 .../langdata_it.h} | 0 .../langdata_jp-kana.h} | 0 Marlin/src/lcd/dogm/fontdata/langdata_ko_KR.h | 532 ++ .../langdata_nl.h} | 0 .../langdata_pl.h} | 0 .../langdata_pt-br.h} | 0 .../langdata_pt.h} | 0 .../langdata_ru.h} | 0 .../langdata_sk.h} | 0 .../langdata_test.h} | 0 .../langdata_tr.h} | 0 .../langdata_uk.h} | 0 .../langdata_zh_CN.h} | 0 .../langdata_zh_TW.h} | 0 Marlin/src/lcd/dogm/lcdprint_u8g.cpp | 60 + Marlin/src/lcd/dogm/status_screen_DOGM.cpp | 604 ++ Marlin/src/lcd/dogm/status_screen_DOGM.h | 495 -- .../lcd/dogm/status_screen_lite_ST7920.cpp | 968 +++ .../src/lcd/dogm/status_screen_lite_ST7920.h | 1010 +-- .../dogm/status_screen_lite_ST7920_class.h | 111 - .../lcd/dogm/status_screen_lite_ST7920_spi.h | 39 - .../u8g_dev_ssd1306_sh1106_128x64_I2C.cpp | 4 +- .../lcd/dogm/u8g_dev_st7565_64128n_HAL.cpp | 4 +- .../lcd/dogm/u8g_dev_st7920_128x64_HAL.cpp | 32 +- .../lcd/dogm/u8g_dev_uc1701_mini12864_HAL.cpp | 63 +- Marlin/src/lcd/{ => dogm}/u8g_fontutf8.cpp | 15 +- Marlin/src/lcd/{ => dogm}/u8g_fontutf8.h | 17 +- Marlin/src/lcd/dogm/ultralcd_DOGM.cpp | 625 ++ Marlin/src/lcd/dogm/ultralcd_DOGM.h | 175 + .../dogm/ultralcd_st7920_u8glib_rrd_AVR.cpp | 86 +- .../lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.h | 97 + Marlin/src/lcd/extensible_ui/lib/example.cpp | 64 + Marlin/src/lcd/extensible_ui/ui_api.cpp | 725 ++ Marlin/src/lcd/extensible_ui/ui_api.h | 266 + Marlin/src/lcd/fontutils.cpp | 3 +- Marlin/src/lcd/fontutils.h | 7 +- Marlin/src/lcd/language/language_an.h | 17 +- Marlin/src/lcd/language/language_bg.h | 34 +- Marlin/src/lcd/language/language_ca.h | 17 +- Marlin/src/lcd/language/language_cz.h | 37 +- Marlin/src/lcd/language/language_da.h | 33 +- Marlin/src/lcd/language/language_de.h | 435 +- Marlin/src/lcd/language/language_el-gr.h | 17 +- Marlin/src/lcd/language/language_el.h | 17 +- Marlin/src/lcd/language/language_en.h | 186 +- Marlin/src/lcd/language/language_es.h | 19 +- Marlin/src/lcd/language/language_eu.h | 75 +- Marlin/src/lcd/language/language_fi.h | 33 +- Marlin/src/lcd/language/language_fr.h | 51 +- Marlin/src/lcd/language/language_gl.h | 33 +- Marlin/src/lcd/language/language_hr.h | 17 +- Marlin/src/lcd/language/language_it.h | 133 +- Marlin/src/lcd/language/language_jp-kana.h | 26 +- Marlin/src/lcd/language/language_ko_KR.h | 413 ++ Marlin/src/lcd/language/language_nl.h | 25 +- Marlin/src/lcd/language/language_pl.h | 26 +- Marlin/src/lcd/language/language_pt-br.h | 243 +- Marlin/src/lcd/language/language_pt.h | 33 +- Marlin/src/lcd/language/language_ru.h | 35 +- Marlin/src/lcd/language/language_sk.h | 98 +- Marlin/src/lcd/language/language_test.h | 5 +- Marlin/src/lcd/language/language_tr.h | 17 +- Marlin/src/lcd/language/language_uk.h | 15 +- Marlin/src/lcd/language/language_zh_CN.h | 37 +- Marlin/src/lcd/language/language_zh_TW.h | 37 +- Marlin/src/lcd/lcdprint.h | 23 +- Marlin/src/lcd/lcdprint_u8g.cpp | 65 - Marlin/src/lcd/malyanlcd.cpp | 29 +- Marlin/src/lcd/menu/menu.cpp | 454 ++ Marlin/src/lcd/menu/menu.h | 381 + Marlin/src/lcd/menu/menu_advanced.cpp | 644 ++ Marlin/src/lcd/menu/menu_bed_corners.cpp | 102 + Marlin/src/lcd/menu/menu_bed_leveling.cpp | 295 + Marlin/src/lcd/menu/menu_configuration.cpp | 382 + Marlin/src/lcd/menu/menu_custom.cpp | 87 + Marlin/src/lcd/menu/menu_delta_calibrate.cpp | 137 + Marlin/src/lcd/menu/menu_filament.cpp | 517 ++ Marlin/src/lcd/menu/menu_info.cpp | 198 + Marlin/src/lcd/menu/menu_job_recovery.cpp | 56 + Marlin/src/lcd/menu/menu_led.cpp | 83 + Marlin/src/lcd/menu/menu_main.cpp | 160 + Marlin/src/lcd/menu/menu_motion.cpp | 500 ++ Marlin/src/lcd/menu/menu_sdcard.cpp | 139 + Marlin/src/lcd/menu/menu_temperature.cpp | 389 + Marlin/src/lcd/menu/menu_tune.cpp | 208 + Marlin/src/lcd/menu/menu_ubl.cpp | 606 ++ Marlin/src/lcd/ultralcd.cpp | 6361 +++-------------- Marlin/src/lcd/ultralcd.h | 668 +- Marlin/src/lcd/ultralcd_common_HD44780.h | 199 - Marlin/src/lcd/ultralcd_impl_DOGM.h | 656 -- Marlin/src/libs/buzzer.cpp | 10 +- Marlin/src/libs/buzzer.h | 151 +- Marlin/src/libs/circularqueue.h | 6 +- Marlin/src/libs/duration_t.h | 6 +- Marlin/src/libs/hex_print_routines.h | 6 +- Marlin/src/libs/least_squares_fit.h | 6 +- Marlin/src/libs/nozzle.h | 6 +- Marlin/src/libs/point_t.h | 6 +- Marlin/src/libs/private_spi.h | 6 +- Marlin/src/libs/softspi.h | 1246 ++-- Marlin/src/libs/stopwatch.h | 16 +- Marlin/src/libs/vector_3.cpp | 41 +- Marlin/src/libs/vector_3.h | 30 +- Marlin/src/module/configuration_store.cpp | 2217 +++--- Marlin/src/module/configuration_store.h | 11 +- Marlin/src/module/delta.cpp | 2 +- Marlin/src/module/endstops.cpp | 59 +- Marlin/src/module/endstops.h | 8 +- Marlin/src/module/motion.cpp | 298 +- Marlin/src/module/motion.h | 59 +- Marlin/src/module/planner.cpp | 140 +- Marlin/src/module/planner.h | 104 +- Marlin/src/module/planner_bezier.h | 9 +- Marlin/src/module/printcounter.h | 6 +- Marlin/src/module/probe.cpp | 192 +- Marlin/src/module/probe.h | 6 +- Marlin/src/module/scara.cpp | 7 +- Marlin/src/module/servo.h | 9 +- Marlin/src/module/speed_lookuptable.h | 6 +- Marlin/src/module/stepper.cpp | 588 +- Marlin/src/module/stepper.h | 55 +- Marlin/src/module/stepper_indirection.cpp | 474 +- Marlin/src/module/stepper_indirection.h | 183 +- Marlin/src/module/temperature.cpp | 818 ++- Marlin/src/module/temperature.h | 143 +- .../src/module/thermistor/thermistor_1010.h | 24 +- .../src/module/thermistor/thermistor_1047.h | 12 +- Marlin/src/module/thermistor/thermistor_110.h | 12 +- Marlin/src/module/thermistor/thermistor_147.h | 12 +- Marlin/src/module/thermistor/thermistor_75.h | 99 +- Marlin/src/module/thermistor/thermistors.h | 12 +- Marlin/src/module/tool_change.cpp | 545 +- Marlin/src/module/tool_change.h | 30 +- Marlin/src/pins/pins.h | 270 +- Marlin/src/pins/pinsDebug.h | 6 +- Marlin/src/pins/pinsDebug_list.h | 51 +- Marlin/src/pins/pins_5DPRINT.h | 6 +- Marlin/src/pins/pins_ALLIGATOR_R2.h | 2 +- Marlin/src/pins/pins_ANET_10.h | 9 +- Marlin/src/pins/pins_ARCHIM1.h | 195 + Marlin/src/pins/pins_ARCHIM2.h | 147 +- Marlin/src/pins/pins_ARMED.h | 166 + Marlin/src/pins/pins_AZSMZ_MINI.h | 6 +- Marlin/src/pins/pins_AZTEEG_X3.h | 2 +- Marlin/src/pins/pins_AZTEEG_X3_PRO.h | 3 +- Marlin/src/pins/pins_AZTEEG_X5_GT.h | 23 +- Marlin/src/pins/pins_AZTEEG_X5_MINI_WIFI.h | 55 +- Marlin/src/pins/pins_BEAST.h | 3 +- Marlin/src/pins/pins_BIQU_BQ111_A4.h | 6 +- Marlin/src/pins/pins_BQ_ZUM_MEGA_3D.h | 44 +- Marlin/src/pins/pins_BRAINWAVE.h | 8 +- Marlin/src/pins/pins_BRAINWAVE_PRO.h | 8 +- Marlin/src/pins/pins_CHEAPTRONIC.h | 4 +- Marlin/src/pins/pins_CHEAPTRONICv2.h | 4 +- Marlin/src/pins/pins_CHITU3D.h | 3 +- Marlin/src/pins/pins_CNCONTROLS_11.h | 2 +- Marlin/src/pins/pins_CNCONTROLS_12.h | 4 +- Marlin/src/pins/pins_COHESION3D_MINI.h | 6 +- Marlin/src/pins/pins_COHESION3D_REMIX.h | 6 +- Marlin/src/pins/pins_DUE3DOM.h | 6 +- Marlin/src/pins/pins_DUE3DOM_MINI.h | 6 +- Marlin/src/pins/pins_EINSTART-S.h | 12 +- Marlin/src/pins/pins_EINSY_RAMBO.h | 4 +- Marlin/src/pins/pins_EINSY_RETRO.h | 4 +- Marlin/src/pins/pins_ELEFU_3.h | 2 +- Marlin/src/pins/pins_ESP32.h | 4 +- Marlin/src/pins/pins_FORMBOT_RAPTOR.h | 8 +- Marlin/src/pins/pins_FORMBOT_RAPTOR2.h | 191 + Marlin/src/pins/pins_FORMBOT_TREX2PLUS.h | 8 +- Marlin/src/pins/pins_FORMBOT_TREX3.h | 12 +- Marlin/src/pins/pins_FYSETC_F6_13.h | 20 +- Marlin/src/pins/pins_GEN3_MONOLITHIC.h | 2 +- Marlin/src/pins/pins_GEN3_PLUS.h | 4 +- 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 | 4 +- Marlin/src/pins/pins_GT2560_REV_A.h | 2 +- Marlin/src/pins/pins_GT2560_V3.h | 2 +- Marlin/src/pins/pins_GT2560_V3_MC2.h | 41 + Marlin/src/pins/pins_GTM32_PRO_VB.h | 157 +- Marlin/src/pins/pins_LEAPFROG.h | 4 +- Marlin/src/pins/pins_MALYAN_M200.h | 1 - Marlin/src/pins/pins_MEGACONTROLLER.h | 2 +- Marlin/src/pins/pins_MEGATRONICS.h | 4 +- Marlin/src/pins/pins_MEGATRONICS_2.h | 2 +- Marlin/src/pins/pins_MEGATRONICS_3.h | 2 +- Marlin/src/pins/pins_MELZI_CREALITY.h | 4 + Marlin/src/pins/pins_MIGHTYBOARD_REVE.h | 10 +- Marlin/src/pins/pins_MINIRAMBO.h | 8 +- Marlin/src/pins/pins_MINITRONICS.h | 4 +- Marlin/src/pins/pins_MKS_SBASE.h | 158 +- Marlin/src/pins/pins_MORPHEUS.h | 2 +- Marlin/src/pins/pins_OMCA.h | 6 +- Marlin/src/pins/pins_OMCA_A.h | 6 +- Marlin/src/pins/pins_PRINTRBOARD.h | 8 +- Marlin/src/pins/pins_PRINTRBOARD_REVF.h | 9 +- Marlin/src/pins/pins_RADDS.h | 18 +- Marlin/src/pins/pins_RAMBO.h | 2 +- Marlin/src/pins/pins_RAMPS.h | 10 +- Marlin/src/pins/pins_RAMPS4DUE.h | 6 +- Marlin/src/pins/pins_RAMPS_CREALITY.h | 43 + Marlin/src/pins/pins_RAMPS_DUO.h | 12 +- Marlin/src/pins/pins_RAMPS_ENDER_4.h | 6 + Marlin/src/pins/pins_RAMPS_FD_V1.h | 8 +- Marlin/src/pins/pins_RAMPS_FD_V2.h | 2 +- Marlin/src/pins/pins_RAMPS_OLD.h | 8 +- Marlin/src/pins/pins_RAMPS_PLUS.h | 6 +- Marlin/src/pins/pins_RAMPS_RE_ARM.h | 311 +- Marlin/src/pins/pins_RAMPS_SMART.h | 13 +- Marlin/src/pins/pins_REMRAM_V1.h | 132 + Marlin/src/pins/pins_RIGIDBOARD.h | 6 +- Marlin/src/pins/pins_RUMBA.h | 2 +- Marlin/src/pins/pins_RURAMPS4D_11.h | 21 +- Marlin/src/pins/pins_RURAMPS4D_13.h | 18 +- Marlin/src/pins/pins_SANGUINOLOLU_11.h | 15 +- Marlin/src/pins/pins_SAV_MKI.h | 6 +- Marlin/src/pins/pins_SCOOVO_X9H.h | 2 +- Marlin/src/pins/pins_SELENA_COMPACT.h | 8 +- Marlin/src/pins/pins_SETHI.h | 2 +- Marlin/src/pins/pins_SILVER_GATE.h | 6 +- Marlin/src/pins/pins_SMOOTHIEBOARD.h | 8 +- Marlin/src/pins/pins_STM32F1R.h | 2 +- Marlin/src/pins/pins_STM32F4.h | 4 +- Marlin/src/pins/pins_STM3R_MINI.h | 2 +- Marlin/src/pins/pins_TEENSY2.h | 8 +- Marlin/src/pins/pins_TEENSY31_32.h | 2 +- Marlin/src/pins/pins_TEENSY35_36.h | 13 +- Marlin/src/pins/pins_TEENSYLU.h | 8 +- Marlin/src/pins/pins_THE_BORG.h | 4 +- Marlin/src/pins/pins_TRIGORILLA_13.h | 4 +- Marlin/src/pins/pins_TRIGORILLA_14.h | 44 +- Marlin/src/pins/pins_ULTIMAIN_2.h | 2 +- Marlin/src/pins/pins_ULTIMAKER.h | 2 +- Marlin/src/pins/pins_ULTIMAKER_OLD.h | 2 +- Marlin/src/pins/pins_ULTRATRONICS_PRO.h | 9 +- Marlin/src/pins/sensitive_pins.h | 516 ++ Marlin/src/sd/Sd2Card.cpp | 20 +- Marlin/src/sd/Sd2Card.h | 8 +- Marlin/src/sd/SdBaseFile.h | 6 +- Marlin/src/sd/SdFatConfig.h | 7 +- Marlin/src/sd/SdFatStructs.h | 5 +- Marlin/src/sd/SdFatUtil.cpp | 1 + Marlin/src/sd/SdFatUtil.h | 7 +- Marlin/src/sd/SdFile.h | 5 +- Marlin/src/sd/SdInfo.h | 5 +- Marlin/src/sd/SdVolume.h | 13 +- Marlin/src/sd/cardreader.cpp | 283 +- Marlin/src/sd/cardreader.h | 225 +- Marlin/src/sd/usb_flashdrive/SOURCES.txt | 48 + .../sd/usb_flashdrive/Sd2Card_FlashDrive.cpp | 156 + .../sd/usb_flashdrive/Sd2Card_FlashDrive.h | 99 + Marlin/src/sd/usb_flashdrive/lib/Usb.cpp | 832 +++ Marlin/src/sd/usb_flashdrive/lib/Usb.h | 52 + Marlin/src/sd/usb_flashdrive/lib/UsbCore.h | 311 + Marlin/src/sd/usb_flashdrive/lib/address.h | 290 + .../sd/usb_flashdrive/lib/confdescparser.h | 217 + Marlin/src/sd/usb_flashdrive/lib/hexdump.h | 69 + Marlin/src/sd/usb_flashdrive/lib/macros.h | 86 + .../src/sd/usb_flashdrive/lib/masstorage.cpp | 1282 ++++ Marlin/src/sd/usb_flashdrive/lib/masstorage.h | 576 ++ Marlin/src/sd/usb_flashdrive/lib/max3421e.h | 235 + Marlin/src/sd/usb_flashdrive/lib/message.cpp | 130 + Marlin/src/sd/usb_flashdrive/lib/message.h | 85 + .../src/sd/usb_flashdrive/lib/parsetools.cpp | 81 + Marlin/src/sd/usb_flashdrive/lib/parsetools.h | 147 + Marlin/src/sd/usb_flashdrive/lib/printhex.h | 91 + Marlin/src/sd/usb_flashdrive/lib/settings.h | 233 + Marlin/src/sd/usb_flashdrive/lib/usb_ch9.h | 173 + .../usb-2.0-host-library-changes.patch | 187 + Marlin/src/sd/usb_flashdrive/usb_host.cpp | 213 + Marlin/src/sd/usb_flashdrive/usb_host.h | 58 + 792 files changed, 71140 insertions(+), 30224 deletions(-) create mode 100644 Marlin/src/HAL/HAL_LPC1768/DebugMonitor_LPC1768.cpp delete mode 100644 Marlin/src/HAL/HAL_LPC1768/HAL_temp.h delete mode 100644 Marlin/src/HAL/HAL_LPC1768/LPC1768_PWM.cpp delete mode 100644 Marlin/src/HAL/HAL_LPC1768/LPC1768_PWM.h delete mode 100644 Marlin/src/HAL/HAL_LPC1768/LPC1768_Servo.cpp delete mode 100644 Marlin/src/HAL/HAL_LPC1768/LPC1768_Servo.h create mode 100644 Marlin/src/HAL/HAL_LPC1768/MarlinSerial.cpp create mode 100644 Marlin/src/HAL/HAL_LPC1768/MarlinSerial.h rename Marlin/src/HAL/HAL_LPC1768/{servo_private.h => MarlinServo.h} (66%) delete mode 100644 Marlin/src/HAL/HAL_LPC1768/SoftwareSPI.cpp delete mode 100644 Marlin/src/HAL/HAL_LPC1768/SoftwareSPI.h delete mode 100644 Marlin/src/HAL/HAL_LPC1768/WInterrupts.cpp delete mode 100644 Marlin/src/HAL/HAL_LPC1768/arduino.cpp delete mode 100644 Marlin/src/HAL/HAL_LPC1768/debug_extra_script.py delete mode 100644 Marlin/src/HAL/HAL_LPC1768/include/Arduino.h delete mode 100644 Marlin/src/HAL/HAL_LPC1768/include/HardwareSerial.cpp delete mode 100644 Marlin/src/HAL/HAL_LPC1768/include/HardwareSerial.h delete mode 100644 Marlin/src/HAL/HAL_LPC1768/include/SoftwareSerial.cpp delete mode 100644 Marlin/src/HAL/HAL_LPC1768/include/SoftwareSerial.h delete mode 100644 Marlin/src/HAL/HAL_LPC1768/include/Wire.cpp delete mode 100644 Marlin/src/HAL/HAL_LPC1768/include/Wire.h delete mode 100644 Marlin/src/HAL/HAL_LPC1768/include/pinmapping.cpp delete mode 100644 Marlin/src/HAL/HAL_LPC1768/include/pinmapping.h delete mode 100644 Marlin/src/HAL/HAL_LPC1768/include/serial.h delete mode 100644 Marlin/src/HAL/HAL_LPC1768/lpc1768_flag_script.py rename Marlin/src/HAL/HAL_LPC1768/{ => u8g}/u8g_com_HAL_LPC1768_hw_spi.cpp (97%) rename Marlin/src/HAL/HAL_LPC1768/{ => u8g}/u8g_com_HAL_LPC1768_ssd_hw_i2c.cpp (97%) rename Marlin/src/HAL/HAL_LPC1768/{ => u8g}/u8g_com_HAL_LPC1768_ssd_sw_i2c.cpp under construction (98%) rename Marlin/src/HAL/HAL_LPC1768/{ => u8g}/u8g_com_HAL_LPC1768_st7920_hw_spi.cpp (97%) rename Marlin/src/HAL/HAL_LPC1768/{ => u8g}/u8g_com_HAL_LPC1768_st7920_sw_spi.cpp (97%) rename Marlin/src/HAL/HAL_LPC1768/{ => u8g}/u8g_com_HAL_LPC1768_sw_spi.cpp (97%) create mode 100644 Marlin/src/HAL/HAL_LPC1768/usb_serial.cpp create mode 100644 Marlin/src/HAL/HAL_LPC1768/win_usb_driver/lpc176x_usb_driver.inf create mode 100644 Marlin/src/HAL/HAL_STM32/HAL.cpp create mode 100644 Marlin/src/HAL/HAL_STM32/HAL.h create mode 100644 Marlin/src/HAL/HAL_STM32/HAL_Servo_STM32.cpp create mode 100644 Marlin/src/HAL/HAL_STM32/HAL_Servo_STM32.h create mode 100644 Marlin/src/HAL/HAL_STM32/HAL_spi_STM32.cpp create mode 100644 Marlin/src/HAL/HAL_STM32/HAL_timers_STM32.cpp create mode 100644 Marlin/src/HAL/HAL_STM32/HAL_timers_STM32.h create mode 100644 Marlin/src/HAL/HAL_STM32/README.md create mode 100644 Marlin/src/HAL/HAL_STM32/SanityCheck.h create mode 100644 Marlin/src/HAL/HAL_STM32/endstop_interrupts.h create mode 100644 Marlin/src/HAL/HAL_STM32/fastio_STM32.cpp create mode 100644 Marlin/src/HAL/HAL_STM32/fastio_STM32.h create mode 100644 Marlin/src/HAL/HAL_STM32/persistent_store_impl.cpp create mode 100644 Marlin/src/HAL/HAL_STM32/pinsDebug.h create mode 100644 Marlin/src/HAL/HAL_STM32/spi_pins.h create mode 100644 Marlin/src/HAL/HAL_STM32/watchdog_STM32.cpp create mode 100644 Marlin/src/HAL/HAL_STM32/watchdog_STM32.h create mode 100644 Marlin/src/HAL/shared/MarlinSerial.h create mode 100644 Marlin/src/config/examples/AnimationExample/_Bootscreen.h create mode 100644 Marlin/src/config/examples/ArmEd/Configuration.h create mode 100644 Marlin/src/config/examples/ArmEd/Configuration_adv.h create mode 100644 Marlin/src/config/examples/Geeetech/MeCreator2/Configuration.h create mode 100644 Marlin/src/config/examples/Geeetech/MeCreator2/Configuration_adv.h create mode 100644 Marlin/src/config/examples/UltiMachine/Archim1/Configuration.h create mode 100644 Marlin/src/config/examples/UltiMachine/Archim1/Configuration_adv.h create mode 100644 Marlin/src/config/examples/delta/Geeetech/Rostock 301/Configuration.h create mode 100644 Marlin/src/config/examples/delta/Geeetech/Rostock 301/Configuration_adv.h create mode 100644 Marlin/src/config/examples/delta/Tevo Little Monster/Configuration.h create mode 100644 Marlin/src/config/examples/delta/Tevo Little Monster/Configuration_adv.h rename Marlin/src/core/{types.h => millis_t.h} (89%) create mode 100644 Marlin/src/core/minmax.h create mode 100644 Marlin/src/feature/leds/printer_event_leds.cpp create mode 100644 Marlin/src/feature/leds/printer_event_leds.h create mode 100644 Marlin/src/gcode/calibrate/G34_M422.cpp create mode 100644 Marlin/src/gcode/config/M217.cpp create mode 100644 Marlin/src/gcode/feature/macro/M810-M819.cpp create mode 100644 Marlin/src/gcode/feature/powerloss/M1000.cpp create mode 100644 Marlin/src/gcode/feature/powerloss/M413.cpp create mode 100644 Marlin/src/gcode/feature/runout/M412.cpp create mode 100644 Marlin/src/gcode/motion/G80.cpp rename Marlin/src/gcode/sdcard/{M20-M30_M32-M34_M928.cpp => M20-M30_M32-M34_M524_M928.cpp} (82%) rename Marlin/src/lcd/{ => HD44780}/lcdprint_hd44780.cpp (88%) rename Marlin/src/lcd/{ultralcd_impl_HD44780.h => HD44780/ultralcd_HD44780.cpp} (55%) create mode 100644 Marlin/src/lcd/HD44780/ultralcd_HD44780.h create mode 100644 Marlin/src/lcd/dogm/dogm_Bootscreen.h create mode 100644 Marlin/src/lcd/dogm/dogm_Statusscreen.h delete mode 100644 Marlin/src/lcd/dogm/dogm_bitmaps.h rename Marlin/src/lcd/dogm/{dogm_font_data_6x9_marlin.h => fontdata/fontdata_6x9_marlin.h} (100%) rename Marlin/src/lcd/dogm/{dogm_font_data_ISO10646_1.h => fontdata/fontdata_ISO10646_1.h} (100%) rename Marlin/src/lcd/dogm/{language_data_an.h => fontdata/langdata_an.h} (100%) rename Marlin/src/lcd/dogm/{language_data_bg.h => fontdata/langdata_bg.h} (100%) rename Marlin/src/lcd/dogm/{language_data_ca.h => fontdata/langdata_ca.h} (100%) rename Marlin/src/lcd/dogm/{language_data_cz.h => fontdata/langdata_cz.h} (100%) rename Marlin/src/lcd/dogm/{language_data_da.h => fontdata/langdata_da.h} (100%) rename Marlin/src/lcd/dogm/{language_data_de.h => fontdata/langdata_de.h} (100%) rename Marlin/src/lcd/dogm/{language_data_el-gr.h => fontdata/langdata_el-gr.h} (100%) rename Marlin/src/lcd/dogm/{language_data_el.h => fontdata/langdata_el.h} (100%) rename Marlin/src/lcd/dogm/{language_data_en.h => fontdata/langdata_en.h} (100%) rename Marlin/src/lcd/dogm/{language_data_es.h => fontdata/langdata_es.h} (100%) rename Marlin/src/lcd/dogm/{language_data_eu.h => fontdata/langdata_eu.h} (100%) rename Marlin/src/lcd/dogm/{language_data_fi.h => fontdata/langdata_fi.h} (100%) rename Marlin/src/lcd/dogm/{language_data_fr.h => fontdata/langdata_fr.h} (100%) rename Marlin/src/lcd/dogm/{language_data_gl.h => fontdata/langdata_gl.h} (100%) rename Marlin/src/lcd/dogm/{language_data_hr.h => fontdata/langdata_hr.h} (100%) rename Marlin/src/lcd/dogm/{language_data_it.h => fontdata/langdata_it.h} (100%) rename Marlin/src/lcd/dogm/{language_data_jp-kana.h => fontdata/langdata_jp-kana.h} (100%) create mode 100644 Marlin/src/lcd/dogm/fontdata/langdata_ko_KR.h rename Marlin/src/lcd/dogm/{language_data_nl.h => fontdata/langdata_nl.h} (100%) rename Marlin/src/lcd/dogm/{language_data_pl.h => fontdata/langdata_pl.h} (100%) rename Marlin/src/lcd/dogm/{language_data_pt-br.h => fontdata/langdata_pt-br.h} (100%) rename Marlin/src/lcd/dogm/{language_data_pt.h => fontdata/langdata_pt.h} (100%) rename Marlin/src/lcd/dogm/{language_data_ru.h => fontdata/langdata_ru.h} (100%) rename Marlin/src/lcd/dogm/{language_data_sk.h => fontdata/langdata_sk.h} (100%) rename Marlin/src/lcd/dogm/{language_data_test.h => fontdata/langdata_test.h} (100%) rename Marlin/src/lcd/dogm/{language_data_tr.h => fontdata/langdata_tr.h} (100%) rename Marlin/src/lcd/dogm/{language_data_uk.h => fontdata/langdata_uk.h} (100%) rename Marlin/src/lcd/dogm/{language_data_zh_CN.h => fontdata/langdata_zh_CN.h} (100%) rename Marlin/src/lcd/dogm/{language_data_zh_TW.h => fontdata/langdata_zh_TW.h} (100%) create mode 100644 Marlin/src/lcd/dogm/lcdprint_u8g.cpp create mode 100644 Marlin/src/lcd/dogm/status_screen_DOGM.cpp delete mode 100644 Marlin/src/lcd/dogm/status_screen_DOGM.h create mode 100644 Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp delete mode 100644 Marlin/src/lcd/dogm/status_screen_lite_ST7920_class.h delete mode 100644 Marlin/src/lcd/dogm/status_screen_lite_ST7920_spi.h rename Marlin/src/lcd/{ => dogm}/u8g_fontutf8.cpp (95%) rename Marlin/src/lcd/{ => dogm}/u8g_fontutf8.h (53%) create mode 100644 Marlin/src/lcd/dogm/ultralcd_DOGM.cpp create mode 100644 Marlin/src/lcd/dogm/ultralcd_DOGM.h create mode 100644 Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.h create mode 100644 Marlin/src/lcd/extensible_ui/lib/example.cpp create mode 100644 Marlin/src/lcd/extensible_ui/ui_api.cpp create mode 100644 Marlin/src/lcd/extensible_ui/ui_api.h create mode 100644 Marlin/src/lcd/language/language_ko_KR.h delete mode 100644 Marlin/src/lcd/lcdprint_u8g.cpp create mode 100644 Marlin/src/lcd/menu/menu.cpp create mode 100644 Marlin/src/lcd/menu/menu.h create mode 100644 Marlin/src/lcd/menu/menu_advanced.cpp create mode 100644 Marlin/src/lcd/menu/menu_bed_corners.cpp create mode 100644 Marlin/src/lcd/menu/menu_bed_leveling.cpp create mode 100644 Marlin/src/lcd/menu/menu_configuration.cpp create mode 100644 Marlin/src/lcd/menu/menu_custom.cpp create mode 100644 Marlin/src/lcd/menu/menu_delta_calibrate.cpp create mode 100644 Marlin/src/lcd/menu/menu_filament.cpp create mode 100644 Marlin/src/lcd/menu/menu_info.cpp create mode 100644 Marlin/src/lcd/menu/menu_job_recovery.cpp create mode 100644 Marlin/src/lcd/menu/menu_led.cpp create mode 100644 Marlin/src/lcd/menu/menu_main.cpp create mode 100644 Marlin/src/lcd/menu/menu_motion.cpp create mode 100644 Marlin/src/lcd/menu/menu_sdcard.cpp create mode 100644 Marlin/src/lcd/menu/menu_temperature.cpp create mode 100644 Marlin/src/lcd/menu/menu_tune.cpp create mode 100644 Marlin/src/lcd/menu/menu_ubl.cpp delete mode 100644 Marlin/src/lcd/ultralcd_common_HD44780.h delete mode 100644 Marlin/src/lcd/ultralcd_impl_DOGM.h create mode 100644 Marlin/src/pins/pins_ARCHIM1.h create mode 100644 Marlin/src/pins/pins_ARMED.h create mode 100644 Marlin/src/pins/pins_FORMBOT_RAPTOR2.h create mode 100644 Marlin/src/pins/pins_GT2560_V3_MC2.h create mode 100644 Marlin/src/pins/pins_RAMPS_CREALITY.h create mode 100644 Marlin/src/pins/pins_REMRAM_V1.h create mode 100644 Marlin/src/pins/sensitive_pins.h create mode 100644 Marlin/src/sd/usb_flashdrive/SOURCES.txt create mode 100644 Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.cpp create mode 100644 Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.h create mode 100644 Marlin/src/sd/usb_flashdrive/lib/Usb.cpp create mode 100644 Marlin/src/sd/usb_flashdrive/lib/Usb.h create mode 100644 Marlin/src/sd/usb_flashdrive/lib/UsbCore.h create mode 100644 Marlin/src/sd/usb_flashdrive/lib/address.h create mode 100644 Marlin/src/sd/usb_flashdrive/lib/confdescparser.h create mode 100644 Marlin/src/sd/usb_flashdrive/lib/hexdump.h create mode 100644 Marlin/src/sd/usb_flashdrive/lib/macros.h create mode 100644 Marlin/src/sd/usb_flashdrive/lib/masstorage.cpp create mode 100644 Marlin/src/sd/usb_flashdrive/lib/masstorage.h create mode 100644 Marlin/src/sd/usb_flashdrive/lib/max3421e.h create mode 100644 Marlin/src/sd/usb_flashdrive/lib/message.cpp create mode 100644 Marlin/src/sd/usb_flashdrive/lib/message.h create mode 100644 Marlin/src/sd/usb_flashdrive/lib/parsetools.cpp create mode 100644 Marlin/src/sd/usb_flashdrive/lib/parsetools.h create mode 100644 Marlin/src/sd/usb_flashdrive/lib/printhex.h create mode 100644 Marlin/src/sd/usb_flashdrive/lib/settings.h create mode 100644 Marlin/src/sd/usb_flashdrive/lib/usb_ch9.h create mode 100644 Marlin/src/sd/usb_flashdrive/usb-2.0-host-library-changes.patch create mode 100644 Marlin/src/sd/usb_flashdrive/usb_host.cpp create mode 100644 Marlin/src/sd/usb_flashdrive/usb_host.h diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 0d9e9ce90f..d6c17f4df1 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -4,6 +4,10 @@ // CUSTOMIZE FOR YOUR MACHINE BELOW // CUSTOMIZE FOR YOUR MACHINE BELOW +// Enable this is you have a raptor 2. +// Selects pin file, runout sensor and stock TMC Drivers automatically +//#define RAPTOR2 + /** * Enable if you replace the stepper drivers with TMC 2208. Be sure to remove MS3 jumper * underneath the stepper driver! Plug and Play will result in Stealth Chop 2 Mode enabled @@ -14,7 +18,9 @@ //#define X_2208 //#define X_SpreadCycle //#define Y_2208 -//#define Y_SpreadCyclebed +//#define Y_SpreadCycle +//#define Z_2208 +//#define Z_SpreadCycle //#define E_2208 //#define E_SpreadCycle @@ -41,7 +47,13 @@ //ONLY MAKE CHANGES ABOVE FOR RELIABLE FUNCTION //ONLY MAKE CHANGES ABOVE FOR RELIABLE FUNCTION - +#if ENABLED(RAPTOR2) + #define X_2208 + #define Y_2208 + #define Z_2208 + #define E_2208 + #define RunoutSensor +#endif /** * Marlin 3D Printer Firmware * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] @@ -177,7 +189,11 @@ // The following define selects which electronics board you have. // Please choose the name from boards.h that matches your setup #ifndef MOTHERBOARD - #define MOTHERBOARD BOARD_FORMBOT_RAPTOR + #if ENABLED(RAPTOR2) + #define MOTHERBOARD BOARD_FORMBOT_RAPTOR2 + #else + #define MOTHERBOARD BOARD_FORMBOT_RAPTOR + #endif #endif // Optional custom name for your RepStrap or other custom machine @@ -490,9 +506,15 @@ //120V 250W silicone heater into 4mm borosilicate (MendelMax 1.5+) //from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10) - #define DEFAULT_bedKp 100.0 - #define DEFAULT_bedKi 15.0 - #define DEFAULT_bedKd 200.0 + #if(ENABLED(BED_AC)) + #define DEFAULT_bedKp 100.0 + #define DEFAULT_bedKi 15.0 + #define DEFAULT_bedKd 200.0 + #else + #define DEFAULT_bedKp 10.00 + #define DEFAULT_bedKi .023 + #define DEFAULT_bedKd 305.4 + #endif //120V 250W silicone heater into 4mm borosilicate (MendelMax 1.5+) //from pidautotune @@ -681,16 +703,25 @@ * X, Y, Z, E0 [, E1[, E2[, E3[, E4]]]] */ #if(ENABLED(Y_2208)) -#define DEFAULT_AXIS_STEPS_PER_UNIT { 80, 80, 1600, 96 } + #define Y_STEPSMM 80 #else -#define DEFAULT_AXIS_STEPS_PER_UNIT { 80, 160, 1600, 96 } + #define Y_STEPSMM 160 #endif + + #if(ENABLED(Z_2208)) + #define Z_STEPSMM 800 +#else + #define Z_STEPSMM 1600 +#endif + + #define DEFAULT_AXIS_STEPS_PER_UNIT { 80,Y_STEPSMM , Z_STEPSMM, 96 } + /** * Default Max Feed Rate (mm/s) * Override with M203 * X, Y, Z, E0 [, E1[, E2[, E3[, E4]]]] */ -#define DEFAULT_MAX_FEEDRATE { 250, 150, 5, 25 } +#define DEFAULT_MAX_FEEDRATE { 250, 120, 5, 25 } /** * Default Max Acceleration (change/s) change = mm/s @@ -950,27 +981,31 @@ // Invert the stepper direction. Change (or reverse the motor connector) if an axis goes the wrong way. #if(ENABLED(X_2208)) -#define INVERT_X_DIR true + #define INVERT_X_DIR true #else -#define INVERT_X_DIR false + #define INVERT_X_DIR false #endif - #if(ENABLED(Y_2208)) -#define INVERT_Y_DIR true +#if(ENABLED(Y_2208)) + #define INVERT_Y_DIR true #else -#define INVERT_Y_DIR false + #define INVERT_Y_DIR false +#endif +#if(ENABLED(Z_2208)) + #define INVERT_Z_DIR false +#else + #define INVERT_Z_DIR true #endif -#define INVERT_Z_DIR true // @section extruder // For direct drive extruder v9 set to true, for geared extruder set to false. #if(ENABLED(E_2208)) -#define INVERT_E0_DIR false -#define INVERT_E1_DIR false + #define INVERT_E0_DIR false + #define INVERT_E1_DIR true #else -#define INVERT_E0_DIR true -#define INVERT_E1_DIR true + #define INVERT_E0_DIR true + #define INVERT_E1_DIR false #endif #define INVERT_E2_DIR false #define INVERT_E3_DIR false @@ -1047,8 +1082,12 @@ #endif #if ENABLED(FILAMENT_RUNOUT_SENSOR) #define NUM_RUNOUT_SENSORS 1 // Number of sensors, up to one per extruder. Define a FIL_RUNOUT#_PIN for each. - #define FIL_RUNOUT_PIN 57 - #define FIL_RUNOUT_INVERTING true // set to true to invert the logic of the sensor. + #if DISABLED(RAPTOR2) + #define FIL_RUNOUT_PIN 57 + #define FIL_RUNOUT_INVERTING true // set to true to invert the logic of the sensor. + #else + #define FIL_RUNOUT_INVERTING false // set to true to invert the logic of the sensor. + #endif #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" @@ -1188,13 +1227,6 @@ #define GRID_MAX_POINTS_X 10 // Don't use more than 15 points per axis, implementation limited. #define GRID_MAX_POINTS_Y GRID_MAX_POINTS_X - #define PROBE_PT_1_X 50 // Probing points for 3-Point leveling of the mesh - #define PROBE_PT_1_Y 350 - #define PROBE_PT_2_X 50 - #define PROBE_PT_2_Y 50 - #define PROBE_PT_3_X 350 - #define PROBE_PT_3_Y 50 - #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 @@ -1220,12 +1252,12 @@ * Override if the automatically selected points are inadequate. */ #if ENABLED(AUTO_BED_LEVELING_3POINT) || ENABLED(AUTO_BED_LEVELING_UBL) - //#define PROBE_PT_1_X 15 - //#define PROBE_PT_1_Y 180 - //#define PROBE_PT_2_X 15 - //#define PROBE_PT_2_Y 20 - //#define PROBE_PT_3_X 170 - //#define PROBE_PT_3_Y 20 + #define PROBE_PT_1_X 50 // Probing points for 3-Point leveling of the mesh + #define PROBE_PT_1_Y 350 + #define PROBE_PT_2_X 50 + #define PROBE_PT_2_Y 50 + #define PROBE_PT_3_X 350 + #define PROBE_PT_3_Y 50 #endif /** @@ -1273,6 +1305,7 @@ // - If stepper drivers time out, it will need X and Y homing again before Z homing. // - Move the Z probe (or nozzle) to a defined XY point before Z Homing when homing all axes (G28). // - Prevent Z homing when the Z probe is outside bed area. +// #define Z_SAFE_HOMING #if ENABLED(Z_SAFE_HOMING) @@ -1506,7 +1539,7 @@ * * View the current statistics with M78. */ -//#define PRINTCOUNTER +#define PRINTCOUNTER //============================================================================= //============================= LCD and SD support ============================ @@ -2056,7 +2089,7 @@ * Set this manually if there are extra servos needing manual control. * Leave undefined or set to 0 to entirely disable the servo subsystem. */ -//#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command +#define NUM_SERVOS 1 // Servo index starts with 0 for M280 command // Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle. // 300ms is a good value but you can try less delay. diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index e7aa85e8c5..58f3fbc60b 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -237,7 +237,11 @@ * Multiple extruders can be assigned to the same pin in which case * the fan will turn on when any selected extruder is above the threshold. */ -#define E0_AUTO_FAN_PIN -1 +#if ENABLED(RAPTOR2) + #define E0_AUTO_FAN_PIN 9 +#else + #define E0_AUTO_FAN_PIN -1 +#endif #define E1_AUTO_FAN_PIN -1 #define E2_AUTO_FAN_PIN -1 #define E3_AUTO_FAN_PIN -1 @@ -776,7 +780,7 @@ * Mention @Sebastianv650 on GitHub to alert the author of any issues. */ #if(DISABLED(E_2208)) -#define LIN_ADVANCE + #define LIN_ADVANCE #endif #if ENABLED(LIN_ADVANCE) #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed @@ -787,10 +791,29 @@ #if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_UBL) // Override the mesh area if the automatic (max) area is too large - //#define MESH_MIN_X MESH_INSET - //#define MESH_MIN_Y MESH_INSET - //#define MESH_MAX_X X_BED_SIZE - (MESH_INSET) - //#define MESH_MAX_Y Y_BED_SIZE - (MESH_INSET) + #if( (X_PROBE_OFFSET_FROM_EXTRUDER + 15) > 0 ) + #define MESH_MIN_X (X_PROBE_OFFSET_FROM_EXTRUDER + 5) + #else + #define MESH_MIN_X 5 + #endif + + #if( (X_BED_SIZE + X_PROBE_OFFSET_FROM_EXTRUDER - 10) < X_BED_SIZE) + #define MESH_MAX_X (X_BED_SIZE + X_PROBE_OFFSET_FROM_EXTRUDER - 5) + #else + #define MESH_MAX_X (X_BED_SIZE - 10) + #endif + + #if ( (Y_PROBE_OFFSET_FROM_EXTRUDER + 10) > 10 ) + #define MESH_MIN_Y (Y_PROBE_OFFSET_FROM_EXTRUDER + 10) + #else + #define MESH_MIN_Y 20 + #endif + + #if( (Y_BED_SIZE + Y_PROBE_OFFSET_FROM_EXTRUDER - 10) < Y_BED_SIZE) + #define MESH_MAX_Y (Y_BED_SIZE + Y_PROBE_OFFSET_FROM_EXTRUDER - 10) + #else + #define MESH_MAX_Y (Y_BED_SIZE - 25) + #endif #endif /** @@ -979,7 +1002,7 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-lift #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) @@ -1021,7 +1044,7 @@ // 0 to disable start loading and skip to fast load only #define FILAMENT_CHANGE_FAST_LOAD_FEEDRATE 6 // (mm/s) Load filament feedrate. This can be pretty fast. #define FILAMENT_CHANGE_FAST_LOAD_ACCEL 25 // (mm/s^2) Lower acceleration may allow a faster feedrate. - #define FILAMENT_CHANGE_FAST_LOAD_LENGTH 5 // (mm) Load length of filament, from extruder gear to nozzle. + #define FILAMENT_CHANGE_FAST_LOAD_LENGTH 2 // (mm) Load length of filament, from extruder gear to nozzle. // For Bowden, the full length of the tube and nozzle. // For direct drive, the full length of the nozzle. //#define ADVANCED_PAUSE_CONTINUOUS_PURGE // Purge continuously up to the purge length until interrupted. @@ -1381,17 +1404,19 @@ * * See http://marlinfw.org/docs/configuration/laser_spindle.html for more config details. */ -//#define SPINDLE_LASER_ENABLE +#if ENABLED(RAPTOR2) + #define SPINDLE_LASER_ENABLE +#endif #if ENABLED(SPINDLE_LASER_ENABLE) - #define SPINDLE_LASER_ENABLE_INVERT false // set to "true" if the on/off function is reversed - #define SPINDLE_LASER_PWM true // set to true if your controller supports setting the speed/power + #define SPINDLE_LASER_ENABLE_INVERT true // set to "true" if the on/off function is reversed + #define SPINDLE_LASER_PWM false // set to true if your controller supports setting the speed/power #define SPINDLE_LASER_PWM_INVERT true // set to "true" if the speed/power goes up when you want it to go slower - #define SPINDLE_LASER_POWERUP_DELAY 5000 // delay in milliseconds to allow the spindle/laser to come up to speed/power - #define SPINDLE_LASER_POWERDOWN_DELAY 5000 // delay in milliseconds to allow the spindle to stop - #define SPINDLE_DIR_CHANGE true // set to true if your spindle controller supports changing spindle direction + #define SPINDLE_LASER_POWERUP_DELAY 1 // delay in milliseconds to allow the spindle/laser to come up to speed/power + #define SPINDLE_LASER_POWERDOWN_DELAY 1 // delay in milliseconds to allow the spindle to stop + #define SPINDLE_DIR_CHANGE false // set to true if your spindle controller supports changing spindle direction #define SPINDLE_INVERT_DIR false - #define SPINDLE_STOP_ON_DIR_CHANGE true // set to true if Marlin should stop the spindle before changing rotation direction + #define SPINDLE_STOP_ON_DIR_CHANGE false // set to true if Marlin should stop the spindle before changing rotation direction /** * The M3 & M4 commands use the following equation to convert PWM duty cycle to speed/power diff --git a/Marlin/Makefile b/Marlin/Makefile index da3897e807..349574c875 100644 --- a/Marlin/Makefile +++ b/Marlin/Makefile @@ -89,8 +89,8 @@ WIRE ?= 0 # this defines if U8GLIB is needed (may require RELOC_WORKAROUND) U8GLIB ?= 1 -# this defines whether to include the Trinamic TMC2630Stepper -TMC2630 ?= 1 +# this defines whether to include the Trinamic TMCStepper library +TMC ?= 1 ############ # Try to automatically determine whether RELOC_WORKAROUND is needed based @@ -103,7 +103,7 @@ CC_PATCHLEVEL:=$(shell $(CC) -dM -E - < /dev/null | grep __GNUC_PATCHLEVEL__ | c CC_VER:=$(shell echo $$(( $(CC_MAJ) * 10000 + $(CC_MIN) * 100 + $(CC_PATCHLEVEL) ))) ifeq ($(shell test $(CC_VER) -lt 40901 && echo 1),1) @echo This version of GCC is likely broken. Enabling relocation workaround. - RELOC_WORKAROUND = 1 + RELOC_WORKAROUND = 1 endif ############################################################################ @@ -195,7 +195,7 @@ else ifeq ($(HARDWARE_MOTHERBOARD),49) else ifeq ($(HARDWARE_MOTHERBOARD),7) # Ultimaker (Older electronics. Pre 1.5.4. This is rare) else ifeq ($(HARDWARE_MOTHERBOARD),71) -MCU ?= atmega1280 + MCU ?= atmega1280 # Azteeg X3 else ifeq ($(HARDWARE_MOTHERBOARD),67) # Azteeg X3 Pro @@ -265,9 +265,9 @@ else ifeq ($(HARDWARE_MOTHERBOARD),75) # else ifeq ($(HARDWARE_MOTHERBOARD),702) -MCU ?= atmega1281 + MCU ?= atmega1281 else ifeq ($(HARDWARE_MOTHERBOARD),25) -MCU ?= atmega1281 + MCU ?= atmega1281 # # Sanguinololu and Derivatives - ATmega644P, ATmega1284P @@ -275,44 +275,44 @@ MCU ?= atmega1281 # Sanguinololu < 1.2 else ifeq ($(HARDWARE_MOTHERBOARD),6) -HARDWARE_VARIANT ?= Sanguino -MCU ?= atmega644p + HARDWARE_VARIANT ?= Sanguino + MCU ?= atmega644p # Sanguinololu 1.2 and above else ifeq ($(HARDWARE_MOTHERBOARD),62) -HARDWARE_VARIANT ?= Sanguino -MCU ?= atmega644p + HARDWARE_VARIANT ?= Sanguino + MCU ?= atmega644p # Melzi else ifeq ($(HARDWARE_MOTHERBOARD),63) -HARDWARE_VARIANT ?= Sanguino -MCU ?= atmega644p + HARDWARE_VARIANT ?= Sanguino + MCU ?= atmega644p # Melzi with ATmega1284 (MaKr3d version) else ifeq ($(HARDWARE_MOTHERBOARD),66) -HARDWARE_VARIANT ?= Sanguino -MCU ?= atmega1284p + HARDWARE_VARIANT ?= Sanguino + MCU ?= atmega1284p # Melzi Creality3D board (for CR-10 etc) else ifeq ($(HARDWARE_MOTHERBOARD),89) -HARDWARE_VARIANT ?= Sanguino -MCU ?= atmega1284p + HARDWARE_VARIANT ?= Sanguino + MCU ?= atmega1284p # Melzi Malyan M150 board else ifeq ($(HARDWARE_MOTHERBOARD),92) -HARDWARE_VARIANT ?= Sanguino -MCU ?= atmega1284p + HARDWARE_VARIANT ?= Sanguino + MCU ?= atmega1284p # Tronxy X5S else ifeq ($(HARDWARE_MOTHERBOARD),505) -HARDWARE_VARIANT ?= Sanguino -MCU ?= atmega1284p + HARDWARE_VARIANT ?= Sanguino + MCU ?= atmega1284p # STB V1.1 else ifeq ($(HARDWARE_MOTHERBOARD),64) -HARDWARE_VARIANT ?= Sanguino -MCU ?= atmega1284p + HARDWARE_VARIANT ?= Sanguino + MCU ?= atmega1284p # Azteeg X1 else ifeq ($(HARDWARE_MOTHERBOARD),65) -HARDWARE_VARIANT ?= Sanguino -MCU ?= atmega1284p + HARDWARE_VARIANT ?= Sanguino + MCU ?= atmega1284p # Anet 1.0 (Melzi clone) else ifeq ($(HARDWARE_MOTHERBOARD),69) -HARDWARE_VARIANT ?= Sanguino -MCU ?= atmega1284p + HARDWARE_VARIANT ?= Sanguino + MCU ?= atmega1284p # # Other ATmega644P, ATmega644, ATmega1284P @@ -320,52 +320,52 @@ MCU ?= atmega1284p # Gen3 Monolithic Electronics else ifeq ($(HARDWARE_MOTHERBOARD),22) -HARDWARE_VARIANT ?= Sanguino -MCU ?= atmega644p + HARDWARE_VARIANT ?= Sanguino + MCU ?= atmega644p # Gen3+ else ifeq ($(HARDWARE_MOTHERBOARD),9) -HARDWARE_VARIANT ?= Sanguino -MCU ?= atmega644p + HARDWARE_VARIANT ?= Sanguino + MCU ?= atmega644p # Gen6 else ifeq ($(HARDWARE_MOTHERBOARD),5) -HARDWARE_VARIANT ?= Gen6 -MCU ?= atmega644p + HARDWARE_VARIANT ?= Gen6 + MCU ?= atmega644p # Gen6 deluxe else ifeq ($(HARDWARE_MOTHERBOARD),51) -HARDWARE_VARIANT ?= Gen6 -MCU ?= atmega644p + HARDWARE_VARIANT ?= Gen6 + MCU ?= atmega644p # Gen7 custom (Alfons3 Version) else ifeq ($(HARDWARE_MOTHERBOARD),10) -HARDWARE_VARIANT ?= Gen7 -MCU ?= atmega644 -F_CPU ?= 20000000 + HARDWARE_VARIANT ?= Gen7 + MCU ?= atmega644 + F_CPU ?= 20000000 # Gen7 v1.1, v1.2 else ifeq ($(HARDWARE_MOTHERBOARD),11) -HARDWARE_VARIANT ?= Gen7 -MCU ?= atmega644p -F_CPU ?= 20000000 + HARDWARE_VARIANT ?= Gen7 + MCU ?= atmega644p + F_CPU ?= 20000000 # Gen7 v1.3 else ifeq ($(HARDWARE_MOTHERBOARD),12) -HARDWARE_VARIANT ?= Gen7 -MCU ?= atmega644p -F_CPU ?= 20000000 + HARDWARE_VARIANT ?= Gen7 + MCU ?= atmega644p + F_CPU ?= 20000000 # Gen7 v1.4 else ifeq ($(HARDWARE_MOTHERBOARD),13) -HARDWARE_VARIANT ?= Gen7 -MCU ?= atmega1284p -F_CPU ?= 20000000 + HARDWARE_VARIANT ?= Gen7 + MCU ?= atmega1284p + F_CPU ?= 20000000 # Alpha OMCA board else ifeq ($(HARDWARE_MOTHERBOARD),90) -HARDWARE_VARIANT ?= SanguinoA -MCU ?= atmega644 + HARDWARE_VARIANT ?= SanguinoA + MCU ?= atmega644 # Final OMCA board else ifeq ($(HARDWARE_MOTHERBOARD),91) -HARDWARE_VARIANT ?= Sanguino -MCU ?= atmega644p + HARDWARE_VARIANT ?= Sanguino + MCU ?= atmega644p # Sethi 3D_1 else ifeq ($(HARDWARE_MOTHERBOARD),20) -HARDWARE_VARIANT ?= Sanguino -MCU ?= atmega644p + HARDWARE_VARIANT ?= Sanguino + MCU ?= atmega644p # # Teensyduino - AT90USB1286, AT90USB1286P @@ -373,37 +373,49 @@ MCU ?= atmega644p # Teensylu else ifeq ($(HARDWARE_MOTHERBOARD),8) -HARDWARE_VARIANT ?= Teensy -MCU ?= at90usb1286 + HARDWARE_VARIANT ?= Teensy + MCU ?= at90usb1286 # Printrboard (AT90USB1286) else ifeq ($(HARDWARE_MOTHERBOARD),81) -HARDWARE_VARIANT ?= Teensy -MCU ?= at90usb1286 + HARDWARE_VARIANT ?= Teensy + MCU ?= at90usb1286 # Printrboard Revision F (AT90USB1286) else ifeq ($(HARDWARE_MOTHERBOARD),811) -HARDWARE_VARIANT ?= Teensy -MCU ?= at90usb1286 + HARDWARE_VARIANT ?= Teensy + MCU ?= at90usb1286 # Brainwave (AT90USB646) else ifeq ($(HARDWARE_MOTHERBOARD),82) -HARDWARE_VARIANT ?= Teensy -MCU ?= at90usb646 + HARDWARE_VARIANT ?= Teensy + MCU ?= at90usb646 # Brainwave Pro (AT90USB1286) else ifeq ($(HARDWARE_MOTHERBOARD),83) -HARDWARE_VARIANT ?= Teensy -MCU ?= at90usb1286 + HARDWARE_VARIANT ?= Teensy + MCU ?= at90usb1286 # SAV Mk-I (AT90USB1286) else ifeq ($(HARDWARE_MOTHERBOARD),84) -HARDWARE_VARIANT ?= Teensy -MCU ?= at90usb1286 + HARDWARE_VARIANT ?= Teensy + MCU ?= at90usb1286 # Teensy++2.0 (AT90USB1286) else ifeq ($(HARDWARE_MOTHERBOARD),85) -HARDWARE_VARIANT ?= Teensy -MCU ?= at90usb1286 + HARDWARE_VARIANT ?= Teensy + MCU ?= at90usb1286 # 5DPrint D8 Driver Board else ifeq ($(HARDWARE_MOTHERBOARD),88) -HARDWARE_VARIANT ?= Teensy -MCU ?= at90usb1286 + HARDWARE_VARIANT ?= Teensy + MCU ?= at90usb1286 +# UltiMachine Archim1 (with DRV8825 drivers) +else ifeq ($(HARDWARE_MOTHERBOARD),1591) + HARDWARE_VARIANT ?= archim + MCPU = cortex-m3 + F_CPU = 84000000L + IS_MCU = 0 +# UltiMachine Archim2 (with TMC2130 drivers) +else ifeq ($(HARDWARE_MOTHERBOARD),1592) + HARDWARE_VARIANT ?= archim + MCPU = cortex-m3 + F_CPU = 84000000L + IS_MCU = 0 endif # Be sure to regenerate speed_lookuptable.h with create_speed_lookuptable.py @@ -411,9 +423,22 @@ endif # Set to 16Mhz if not yet set. F_CPU ?= 16000000 -# Set to arduino, ATmega2560 if not yet set. -HARDWARE_VARIANT ?= arduino -MCU ?= atmega2560 +# Set to microcontroller if IS_MCU not yet set +IS_MCU ?= 1 + +ifeq ($(IS_MCU),1) + # Set to arduino, ATmega2560 if not yet set. + HARDWARE_VARIANT ?= arduino + MCU ?= atmega2560 + + TOOL_PREFIX = avr + MCU_FLAGS = -mmcu=$(MCU) + SIZE_FLAGS = --mcu=$(MCU) -C +else + TOOL_PREFIX = arm-none-eabi + CPU_FLAGS = -mthumb -mcpu=$(MCPU) + SIZE_FLAGS = -A +endif # Arduino contained the main source code for the Arduino # Libraries, the "hardware variant" are for boards @@ -434,19 +459,19 @@ VPATH = . VPATH += $(BUILD_DIR) VPATH += $(HARDWARE_SRC) -# U8glib -VPATH += $(ARDUINO_USER_DIR)/libraries/U8glib -VPATH += $(ARDUINO_USER_DIR)/libraries/U8glib/clib - ifeq ($(HARDWARE_VARIANT), $(filter $(HARDWARE_VARIANT),arduino Teensy Sanguino)) VPATH += $(ARDUINO_INSTALL_DIR)/hardware/marlin/avr/libraries/LiquidCrystal/src VPATH += $(ARDUINO_INSTALL_DIR)/hardware/marlin/avr/libraries/SPI endif -VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/cores/arduino +ifeq ($(IS_MCU),1) + VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/cores/arduino + + VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SPI + VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SPI/src + VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SoftwareSerial/src +endif -VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SPI -VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SPI/src VPATH += $(ARDUINO_INSTALL_DIR)/libraries/LiquidCrystal/src ifeq ($(LIQUID_TWI2), 1) VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire @@ -462,71 +487,90 @@ VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Adafruit_NeoPixel endif ifeq ($(U8GLIB), 1) VPATH += $(ARDUINO_INSTALL_DIR)/libraries/U8glib -VPATH += $(ARDUINO_INSTALL_DIR)/libraries/U8glib/clib +VPATH += $(ARDUINO_INSTALL_DIR)/libraries/U8glib/csrc +VPATH += $(ARDUINO_INSTALL_DIR)/libraries/U8glib/cppsrc +VPATH += $(ARDUINO_INSTALL_DIR)/libraries/U8glib/fntsrc endif -ifeq ($(TMC2630), 1) -VPATH += $(ARDUINO_INSTALL_DIR)/libraries/TMC2130Stepper/src -VPATH += $(ARDUINO_INSTALL_DIR)/libraries/TMC2130Stepper/src/source +ifeq ($(TMC), 1) +VPATH += $(ARDUINO_INSTALL_DIR)/libraries/TMCStepper/src +VPATH += $(ARDUINO_INSTALL_DIR)/libraries/TMCStepper/src/source endif ifeq ($(HARDWARE_VARIANT), arduino) -HARDWARE_SUB_VARIANT ?= mega -VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/variants/$(HARDWARE_SUB_VARIANT) + HARDWARE_SUB_VARIANT ?= mega + VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/variants/$(HARDWARE_SUB_VARIANT) +else ifeq ($(HARDWARE_VARIANT), Sanguino) + VPATH += $(ARDUINO_INSTALL_DIR)/hardware/marlin/avr/variants/sanguino +else ifeq ($(HARDWARE_VARIANT), archim) + VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/system/libsam + VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/system/CMSIS/CMSIS/Include/ + VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/system/CMSIS/Device/ATMEL/ + VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/cores/arduino + VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/cores/arduino/avr + VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/cores/arduino/USB + VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/libraries/Wire/src + VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/libraries/SPI/src + VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/libraries/U8glib/src/clib + VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/variants/archim + LDSCRIPT = $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/variants/archim/linker_scripts/gcc/flash.ld + LDLIBS = $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/variants/archim/libsam_sam3x8e_gcc_rel.a else -ifeq ($(HARDWARE_VARIANT), Sanguino) -VPATH += $(ARDUINO_INSTALL_DIR)/hardware/marlin/avr/variants/sanguino -else -HARDWARE_SUB_VARIANT ?= standard -VPATH += $(ARDUINO_INSTALL_DIR)/hardware/$(HARDWARE_VARIANT)/variants/$(HARDWARE_SUB_VARIANT) -endif + HARDWARE_SUB_VARIANT ?= standard + VPATH += $(ARDUINO_INSTALL_DIR)/hardware/$(HARDWARE_VARIANT)/variants/$(HARDWARE_SUB_VARIANT) endif + LIB_SRC = wiring.c \ - wiring_analog.c wiring_digital.c \ - wiring_pulse.c \ - wiring_shift.c WInterrupts.c hooks.c + wiring_analog.c wiring_digital.c \ + wiring_shift.c WInterrupts.c hooks.c + +ifeq ($(HARDWARE_VARIANT), archim) + LIB_ASRC += wiring_pulse_asm.S +else + LIB_SRC += wiring_pulse.c +endif ifeq ($(HARDWARE_VARIANT), Teensy) -LIB_SRC = wiring.c -VPATH += $(ARDUINO_INSTALL_DIR)/hardware/teensy/cores/teensy + LIB_SRC = wiring.c + VPATH += $(ARDUINO_INSTALL_DIR)/hardware/teensy/cores/teensy endif -LIB_CXXSRC = WMath.cpp WString.cpp Print.cpp SPI.cpp Tone.cpp +LIB_CXXSRC = WMath.cpp WString.cpp Print.cpp SPI.cpp ifeq ($(NEOPIXEL), 1) -LIB_CXXSRC += Adafruit_NeoPixel.cpp + LIB_CXXSRC += Adafruit_NeoPixel.cpp endif ifeq ($(LIQUID_TWI2), 0) -LIB_CXXSRC += LiquidCrystal.cpp + LIB_CXXSRC += LiquidCrystal.cpp else -LIB_SRC += twi.c -LIB_CXXSRC += Wire.cpp LiquidTWI2.cpp + LIB_SRC += twi.c + LIB_CXXSRC += Wire.cpp LiquidTWI2.cpp endif ifeq ($(WIRE), 1) -LIB_SRC += twi.c -LIB_CXXSRC += Wire.cpp + LIB_SRC += twi.c + LIB_CXXSRC += Wire.cpp endif ifeq ($(U8GLIB), 1) -LIB_CXXSRC += U8glib.cpp -LIB_SRC += u8g_ll_api.c u8g_bitmap.c u8g_clip.c u8g_com_null.c u8g_delay.c u8g_page.c u8g_pb.c u8g_pb16h1.c u8g_rect.c u8g_state.c u8g_font.c u8g_font_data.c + LIB_CXXSRC += U8glib.cpp + LIB_SRC += u8g_ll_api.c u8g_bitmap.c u8g_clip.c u8g_com_null.c u8g_delay.c u8g_page.c u8g_pb.c u8g_pb16h1.c u8g_rect.c u8g_state.c u8g_font.c u8g_font_6x13.c u8g_font_04b_03.c u8g_font_5x8.c endif -ifeq ($(TMC2630), 1) -LIB_CXXSRC += TMC2130Stepper.cpp TMC2130Stepper_COOLCONF.cpp TMC2130Stepper_DRV_STATUS.cpp TMC2130Stepper_IHOLD_IRUN.cpp TMC2130Stepper_CHOPCONF.cpp TMC2130Stepper_GCONF.cpp TMC2130Stepper_PWMCONF.cpp SW_SPI.cpp +ifeq ($(TMC), 1) + LIB_CXXSRC += TMCStepper.cpp COOLCONF.cpp DRV_STATUS.cpp IHOLD_IRUN.cpp CHOPCONF.cpp GCONF.cpp PWMCONF.cpp DRV_CONF.cpp DRVCONF.cpp DRVCTRL.cpp DRVSTATUS.cpp ENCMODE.cpp RAMP_STAT.cpp SGCSCONF.cpp SHORT_CONF.cpp SMARTEN.cpp SW_MODE.cpp SW_SPI.cpp TMC2130Stepper.cpp TMC2208Stepper.cpp TMC2660Stepper.cpp TMC5130Stepper.cpp TMC5160Stepper.cpp endif ifeq ($(RELOC_WORKAROUND), 1) -LD_PREFIX=-nodefaultlibs -LD_SUFFIX=-lm -lgcc -lc -lgcc + LD_PREFIX=-nodefaultlibs + LD_SUFFIX=-lm -lgcc -lc -lgcc endif #Check for Arduino 1.0.0 or higher and use the correct source files for that version ifeq ($(shell [ $(ARDUINO_VERSION) -ge 100 ] && echo true), true) -LIB_CXXSRC += main.cpp + LIB_CXXSRC += main.cpp else -LIB_SRC += pins_arduino.c main.c + LIB_SRC += pins_arduino.c main.c endif FORMAT = ihex @@ -544,62 +588,81 @@ OPT = s DEFINES ?= # Program settings -CC = $(AVR_TOOLS_PATH)avr-gcc -CXX = $(AVR_TOOLS_PATH)avr-g++ -OBJCOPY = $(AVR_TOOLS_PATH)avr-objcopy -OBJDUMP = $(AVR_TOOLS_PATH)avr-objdump -AR = $(AVR_TOOLS_PATH)avr-ar -SIZE = $(AVR_TOOLS_PATH)avr-size -NM = $(AVR_TOOLS_PATH)avr-nm +CC = $(AVR_TOOLS_PATH)$(TOOL_PREFIX)-gcc +CXX = $(AVR_TOOLS_PATH)$(TOOL_PREFIX)-g++ +OBJCOPY = $(AVR_TOOLS_PATH)$(TOOL_PREFIX)-objcopy +OBJDUMP = $(AVR_TOOLS_PATH)$(TOOL_PREFIX)-objdump +AR = $(AVR_TOOLS_PATH)$(TOOL_PREFIX)-ar +SIZE = $(AVR_TOOLS_PATH)$(TOOL_PREFIX)-size +NM = $(AVR_TOOLS_PATH)$(TOOL_PREFIX)-nm AVRDUDE = avrdude REMOVE = rm -f MV = mv -f # Place -D or -U options here -CDEFS = -DF_CPU=$(F_CPU) ${addprefix -D , $(DEFINES)} +CDEFS = -DF_CPU=$(F_CPU) ${addprefix -D , $(DEFINES)} -DARDUINO=$(ARDUINO_VERSION) CXXDEFS = $(CDEFS) ifeq ($(HARDWARE_VARIANT), Teensy) -CDEFS += -DUSB_SERIAL -LIB_SRC += usb.c pins_teensy.c -LIB_CXXSRC += usb_api.cpp + CDEFS += -DUSB_SERIAL + LIB_SRC += usb.c pins_teensy.c + LIB_CXXSRC += usb_api.cpp + +else ifeq ($(HARDWARE_VARIANT), archim) + CDEFS += -DARDUINO_SAM_ARCHIM -DARDUINO_ARCH_SAM -D__SAM3X8E__ -DUSB_VID=0x27b1 -DUSB_PID=0x0001 -DUSBCON '-DUSB_MANUFACTURER="UltiMachine"' '-DUSB_PRODUCT="Archim"' + LIB_CXXSRC += variant.cpp IPAddress.cpp Reset.cpp RingBuffer.cpp Stream.cpp UARTClass.cpp USARTClass.cpp abi.cpp new.cpp watchdog.cpp CDC.cpp PluggableUSB.cpp USBCore.cpp + LIB_SRC += cortex_handlers.c iar_calls_sam3.c syscalls_sam3.c dtostrf.c itoa.c + + ifeq ($(U8GLIB), 1) + LIB_SRC += u8g_com_api.c u8g_pb32h1.c + endif endif # Add all the source directories as include directories too CINCS = ${addprefix -I ,${VPATH}} CXXINCS = ${addprefix -I ,${VPATH}} +# Silence warnings for library code (won't work for .h files, unfortunately) +LIBWARN = -w -Wno-packed-bitfield-compat + # Compiler flag to set the C/CPP Standard level. CSTANDARD = -std=gnu99 CXXSTANDARD = -std=gnu++11 CDEBUG = -g$(DEBUG) -CWARN = -Wall -Wstrict-prototypes -CTUNING = -w -fsigned-char -funsigned-bitfields -fpack-struct \ - -fshort-enums -ffunction-sections -fdata-sections -flto \ - -DARDUINO=$(ARDUINO_VERSION) +CWARN = -Wall -Wstrict-prototypes -Wno-packed-bitfield-compat -Wno-pragmas +CXXWARN = -Wall -Wno-packed-bitfield-compat -Wno-pragmas +CTUNING = -fsigned-char -funsigned-bitfields -fpack-struct -fno-exceptions \ + -fshort-enums -ffunction-sections -fdata-sections ifneq ($(HARDWARE_MOTHERBOARD),) -CTUNING += -DMOTHERBOARD=${HARDWARE_MOTHERBOARD} + CTUNING += -DMOTHERBOARD=${HARDWARE_MOTHERBOARD} endif #CEXTRA = -Wa,-adhlns=$(<:.c=.lst) -CEXTRA = -fno-use-cxa-atexit -fno-threadsafe-statics - -CFLAGS := $(CDEBUG) $(CDEFS) $(CINCS) -O$(OPT) $(CWARN) $(CEXTRA) $(CTUNING) $(CSTANDARD) -CXXFLAGS := $(CDEFS) $(CINCS) -O$(OPT) -Wall $(CEXTRA) $(CTUNING) $(CXXSTANDARD) +CXXEXTRA = -fno-use-cxa-atexit -fno-threadsafe-statics -fno-rtti +CFLAGS := $(CDEBUG) $(CDEFS) $(CINCS) -O$(OPT) $(CEXTRA) $(CTUNING) $(CSTANDARD) +CXXFLAGS := $(CDEFS) $(CINCS) -O$(OPT) $(CXXEXTRA) $(CTUNING) $(CXXSTANDARD) +ASFLAGS := $(CDEFS) #ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs -LDFLAGS = -lm - +ifeq ($(HARDWARE_VARIANT), archim) + LD_PREFIX = -Wl,--gc-sections,-Map,Marlin.ino.map,--cref,--check-sections,--entry=Reset_Handler,--unresolved-symbols=report-all,--warn-common,--warn-section-align + LD_SUFFIX = $(LDLIBS) + LDFLAGS = -lm -gcc -T$(LDSCRIPT) -u _sbrk -u link -u _close -u _fstat -u _isatty -u _lseek -u _read -u _write -u _exit -u kill -u _getpid +else + LD_PREFIX = -Wl,--gc-sections,--relax + LDFLAGS = -lm + CTUNING += -flto +endif # Programming support using avrdude. Settings and variables. AVRDUDE_PORT = $(UPLOAD_PORT) AVRDUDE_WRITE_FLASH = -Uflash:w:$(BUILD_DIR)/$(TARGET).hex:i ifeq ($(shell uname -s), Linux) -AVRDUDE_CONF = /etc/avrdude/avrdude.conf + AVRDUDE_CONF = /etc/avrdude/avrdude.conf else -AVRDUDE_CONF = $(ARDUINO_INSTALL_DIR)/hardware/tools/avr/etc/avrdude.conf + AVRDUDE_CONF = $(ARDUINO_INSTALL_DIR)/hardware/tools/avr/etc/avrdude.conf endif AVRDUDE_FLAGS = -D -C$(AVRDUDE_CONF) \ - -p$(MCU) -P$(AVRDUDE_PORT) -c$(AVRDUDE_PROGRAMMER) \ - -b$(UPLOAD_RATE) + -p$(MCU) -P$(AVRDUDE_PORT) -c$(AVRDUDE_PROGRAMMER) \ + -b$(UPLOAD_RATE) # Since Marlin 2.0, the source files may be distributed into several # different directories, so it is necessary to find them recursively @@ -619,17 +682,17 @@ LST = $(LIB_ASRC:.S=.lst) $(LIB_CXXSRC:.cpp=.lst) $(LIB_SRC:.c=.lst) # Combine all necessary flags and optional flags. # Add target processor to flags. -ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) -ALL_CXXFLAGS = -mmcu=$(MCU) $(CXXFLAGS) -ALL_ASFLAGS = -mmcu=$(MCU) -x assembler-with-cpp $(ASFLAGS) +ALL_CFLAGS = $(MCU_FLAGS) $(CPU_FLAGS) $(CFLAGS) -I. +ALL_CXXFLAGS = $(MCU_FLAGS) $(CPU_FLAGS) $(CXXFLAGS) +ALL_ASFLAGS = $(MCU_FLAGS) $(CPU_FLAGS) $(ASFLAGS) -x assembler-with-cpp # set V=1 (eg, "make V=1") to print the full commands etc. ifneq ($V,1) - Pecho=@echo - P=@ + Pecho=@echo + P=@ else - Pecho=@: - P= + Pecho=@: + P= endif # Create required build hierarchy if it does not exist @@ -639,9 +702,10 @@ $(shell mkdir -p $(dir $(OBJ))) # Default target. all: sizeafter -build: elf hex +build: elf hex bin elf: $(BUILD_DIR)/$(TARGET).elf +bin: $(BUILD_DIR)/$(TARGET).bin hex: $(BUILD_DIR)/$(TARGET).hex eep: $(BUILD_DIR)/$(TARGET).eep lss: $(BUILD_DIR)/$(TARGET).lss @@ -658,9 +722,9 @@ ifeq (${AVRDUDE_PROGRAMMER}, arduino) stty -hup < $(UPLOAD_PORT); true endif - # Display size of file. + # Display size of file. HEXSIZE = $(SIZE) --target=$(FORMAT) $(BUILD_DIR)/$(TARGET).hex -ELFSIZE = $(SIZE) --mcu=$(MCU) -C $(BUILD_DIR)/$(TARGET).elf; \ +ELFSIZE = $(SIZE) $(SIZE_FLAGS) $(BUILD_DIR)/$(TARGET).elf; \ $(SIZE) $(BUILD_DIR)/$(TARGET).elf sizebefore: $P if [ -f $(BUILD_DIR)/$(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(HEXSIZE); echo; fi @@ -671,10 +735,10 @@ sizeafter: build # Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB. COFFCONVERT=$(OBJCOPY) --debugging \ - --change-section-address .data-0x800000 \ - --change-section-address .bss-0x800000 \ - --change-section-address .noinit-0x800000 \ - --change-section-address .eeprom-0x810000 + --change-section-address .data-0x800000 \ + --change-section-address .bss-0x800000 \ + --change-section-address .noinit-0x800000 \ + --change-section-address .eeprom-0x810000 coff: $(BUILD_DIR)/$(TARGET).elf @@ -685,16 +749,20 @@ extcoff: $(TARGET).elf $(COFFCONVERT) -O coff-ext-avr $(BUILD_DIR)/$(TARGET).elf $(TARGET).cof -.SUFFIXES: .elf .hex .eep .lss .sym +.SUFFIXES: .elf .hex .eep .lss .sym .bin .PRECIOUS: .o .elf.hex: $(Pecho) " COPY $@" $P $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@ +.elf.bin: + $(Pecho) " COPY $@" + $P $(OBJCOPY) -O binary -R .eeprom $< $@ + .elf.eep: -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ - --change-section-lma .eeprom=0 -O $(FORMAT) $< $@ + --change-section-lma .eeprom=0 -O $(FORMAT) $< $@ # Create extended listing file from ELF output file. .elf.lss: @@ -704,32 +772,36 @@ extcoff: $(TARGET).elf .elf.sym: $(NM) -n $< > $@ - # Link: create ELF output file from library. + # Link: create ELF output file from library. $(BUILD_DIR)/$(TARGET).elf: $(OBJ) Configuration.h $(Pecho) " CXX $@" - $P $(CC) $(LD_PREFIX) $(ALL_CXXFLAGS) -Wl,--gc-sections,--relax -o $@ -L. $(OBJ) $(LDFLAGS) $(LD_SUFFIX) + $P $(CC) $(LD_PREFIX) $(ALL_CXXFLAGS) -o $@ -L. $(OBJ) $(LDFLAGS) $(LD_SUFFIX) # Object files that were found in "src" will be stored in $(BUILD_DIR) # in directories that mirror the structure of "src" $(BUILD_DIR)/%.o: %.c Configuration.h Configuration_adv.h $(MAKEFILE) $(Pecho) " CC $<" - $P $(CC) -MMD -c $(ALL_CFLAGS) $< -o $@ + $P $(CC) -MMD -c $(ALL_CFLAGS) $(CWARN) $< -o $@ $(BUILD_DIR)/%.o: %.cpp Configuration.h Configuration_adv.h $(MAKEFILE) $(Pecho) " CXX $<" - $P $(CXX) -MMD -c $(ALL_CXXFLAGS) $< -o $@ + $P $(CXX) -MMD -c $(ALL_CXXFLAGS) $(CXXWARN) $< -o $@ # Object files for Arduino libs will be created in $(BUILD_DIR)/arduino $(BUILD_DIR)/arduino/%.o: %.c Configuration.h Configuration_adv.h $(MAKEFILE) $(Pecho) " CC $<" - $P $(CC) -MMD -c $(ALL_CFLAGS) $< -o $@ + $P $(CC) -MMD -c $(ALL_CFLAGS) $(LIBWARN) $< -o $@ $(BUILD_DIR)/arduino/%.o: %.cpp Configuration.h Configuration_adv.h $(MAKEFILE) $(Pecho) " CXX $<" - $P $(CXX) -MMD -c $(ALL_CXXFLAGS) $< -o $@ + $P $(CXX) -MMD -c $(ALL_CXXFLAGS) $(LIBWARN) $< -o $@ + +$(BUILD_DIR)/arduino/%.o: %.S $(MAKEFILE) + $(Pecho) " CXX $<" + $P $(CXX) -MMD -c $(ALL_ASFLAGS) $< -o $@ # Target: clean project. clean: @@ -737,7 +809,7 @@ clean: $P rm -rf $(BUILD_DIR) -.PHONY: all build elf hex eep lss sym program coff extcoff clean depend sizebefore sizeafter +.PHONY: all build elf hex eep lss sym program coff extcoff clean depend sizebefore sizeafter # Automaticaly include the dependency files created by gcc -include ${patsubst %.o, %.d, ${OBJ}} diff --git a/Marlin/_Statusscreen.h b/Marlin/_Statusscreen.h index 6a06a49016..d0450837ab 100644 --- a/Marlin/_Statusscreen.h +++ b/Marlin/_Statusscreen.h @@ -30,431 +30,45 @@ * http://marlinfw.org/tools/u8glib/converter.html */ +// +// Status Screen Logo bitmap +// +#define STATUS_LOGO_Y 3 +#define STATUS_LOGO_WIDTH 24 -//============================================ - -#define STATUS_SCREENWIDTH 128 - -#define STATUS_SCREEN_HOTEND_TEXT_X(E) (41 + (E) * 20) - -#define STATUS_SCREEN_BED_TEXT_X (HOTENDS > 1 ? 81 : 73) - -#define FAN_ANIM_FRAMES 3 -#define STATUS_SCREEN_FAN_TEXT_X (FAN_ANIM_FRAMES == 3 ? 103 : 105) -#define STATUS_SCREEN_FAN_TEXT_Y (FAN_ANIM_FRAMES > 2 ? 28 : 27) - -//============================================ +const unsigned char status_logo_bmp[] PROGMEM = { + B11111111,B11111111,B11111111, + B10000000,B00000000,B00000001, + B10001110,B00000000,B11100001, + B10011111,B00000001,B11110001, + B10010011,B10000001,B00111001, + B10011111,B10000001,B11111001, + B10011111,B10000001,B11111001, + B10011111,B10111001,B11111001, + B10001111,B00101000,B11110001, + B10000000,B00111000,B00000001, + B10000000,B00000000,B00000001, + B10011111,B11111111,B11111001, + B10010001,B01110100,B10011001, + B10011011,B00000110,B10101001, + B10011011,B01010100,B10101001, + B10011011,B01010110,B10101001, + B10011011,B01010100,B10011001, + B10011111,B11111111,B11111001, + B11111111,B11111111,B11111111 +}; +// +// Use default bitmaps +// +#define STATUS_HOTEND_ANIM +#define STATUS_BED_ANIM #if HOTENDS < 2 - - #if FAN_ANIM_FRAMES <= 2 - - const unsigned char status_screen0_bmp[] PROGMEM = { - B11111111,B11111111,B11111111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B10000000,B00000000,B00000001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B00000000,B11111000, - B10001110,B00000000,B11100001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00111111,B00111000, - B10011111,B00000000,B11110001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B01111110,B00011000, - B10010011,B10000001,B00111001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B01111100,B00011000, - B10011111,B10000001,B11111001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101000,B01111100,B00001000, - B10011111,B10000001,B11111001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101100,B00111000,B00001000, - B10011111,B10111001,B11110001,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00101111,B00111001,B11001000, - B10001111,B00101000,B11110001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00101111,B11111111,B11101000, - B10000000,B00111000,B00000001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00101111,B11000111,B11101000, - B10000000,B00000000,B00000001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00101111,B11111111,B11101000, - B10011111,B11111111,B11111001,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00100111,B00111001,B11101000, - B10010001,B01110100,B10011001,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00100000,B00111000,B01101000, - B10011011,B00000110,B10101001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00100000,B01111100,B00101000, - B10011011,B01010100,B10101001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00110000,B01111100,B00011000, - B10011011,B01010110,B10101001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00110000,B11111100,B00011000, - B10011011,B01010100,B10011001,B00000000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111001,B11111000,B00111000, - B10011111,B11111111,B11111001,B00000000,B00000000,B00000111,B10000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00111110,B00000000,B11111000, - B11111111,B11111111,B11111111,B00000000,B00000000,B00000011,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00111111,B11111111,B11111000 -}; - const unsigned char status_screen1_bmp[] PROGMEM = { - B11111111,B11111111,B11111111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B10000000,B00000000,B00000001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B10000000,B11111000, - B10001110,B00000000,B11100001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111001,B10000000,B00111000, - B10011111,B00000000,B11110001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110111,B10000001,B11011000, - B10010011,B10000001,B00111001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110111,B11000011,B11011000, - B10011111,B10000001,B11111001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100111,B11000111,B11101000, - B10011111,B10000001,B11111001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100011,B11000111,B11111000, - B10011111,B10111001,B11110001,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00100001,B11111111,B10001000, - B10001111,B00101000,B11110001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00100000,B01101100,B00001000, - B10000000,B00111000,B00000001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00100000,B01101100,B00001000, - B10000000,B00000000,B00000001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00100000,B01101100,B00001000, - B10011111,B11111111,B11111001,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00100011,B11111111,B00001000, - B10010001,B01110100,B10011001,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00111111,B11000111,B10001000, - B10011011,B00000110,B10101001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00101111,B11000111,B11001000, - B10011011,B01010100,B10101001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00110111,B10000111,B11011000, - B10011011,B01010110,B10101001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00110111,B00000011,B11011000, - B10011011,B01010100,B10011001,B00000000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000011,B00111000, - B10011111,B11111111,B11111001,B00000000,B00000000,B00000111,B10000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00111110,B00000010,B11111000, - B11111111,B11111111,B11111111,B00000000,B00000000,B00000011,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00111111,B11111111,B11111000 -}; - - #elif FAN_ANIM_FRAMES == 3 - - -const unsigned char status_screen0_bmp[] PROGMEM = { - B11111111,B11111111,B11111111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B10000000,B00000000,B00000001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B00000000,B11111000, - B10001110,B00000000,B11100001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00111111,B00111000, - B10011111,B00000000,B11110001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B01111110,B00011000, - B10010011,B10000001,B00111001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B01111100,B00011000, - B10011111,B10000001,B11111001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101000,B01111100,B00001000, - B10011111,B10000001,B11111001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101100,B00111000,B00001000, - B10011111,B10111001,B11110001,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00101111,B00111001,B11001000, - B10001111,B00101000,B11110001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00101111,B11111111,B11101000, - B10000000,B00111000,B00000001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00101111,B11000111,B11101000, - B10000000,B00000000,B00000001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00101111,B11111111,B11101000, - B10011111,B11111111,B11111001,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00100111,B00111001,B11101000, - B10010001,B01110100,B10011001,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00100000,B00111000,B01101000, - B10011011,B00000110,B10101001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00100000,B01111100,B00101000, - B10011011,B01010100,B10101001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00110000,B01111100,B00011000, - B10011011,B01010110,B10101001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00110000,B11111100,B00011000, - B10011011,B01010100,B10011001,B00000000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111001,B11111000,B00111000, - B10011111,B11111111,B11111001,B00000000,B00000000,B00000111,B10000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00111110,B00000000,B11111000, - B11111111,B11111111,B11111111,B00000000,B00000000,B00000011,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00111111,B11111111,B11111000 -}; - - - const unsigned char status_screen1_bmp[] PROGMEM = { - B11111111,B11111111,B11111111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B10000000,B00000000,B00000001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B00000000,B11111000, - B10001110,B00000000,B11100001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00001111,B00111000, - B10011111,B00000000,B11110001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110100,B00011111,B11011000, - B10010011,B10000001,B00111001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110110,B00011111,B10011000, - B10011111,B10000001,B11111001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B00011111,B00001000, - B10011111,B10000001,B11111001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B10011110,B00001000, - B10011111,B10111001,B11110001,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00101111,B11111100,B00001000, - B10001111,B00101000,B11110001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00101111,B11011100,B00001000, - B10000000,B00111000,B00000001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00100111,B11101111,B11001000, - B10000000,B00000000,B00000001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00100000,B01110111,B11101000, - B10011111,B11111111,B11111001,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00100000,B01111111,B11101000, - B10010001,B01110100,B10011001,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00100000,B11110011,B11101000, - B10011011,B00000110,B10101001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00100001,B11110001,B11101000, - B10011011,B01010100,B10101001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00110011,B11110000,B11011000, - B10011011,B01010110,B10101001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00110111,B11110000,B01011000, - B10011011,B01010100,B10011001,B00000000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111001,B11100000,B00111000, - B10011111,B11111111,B11111001,B00000000,B00000000,B00000111,B10000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00111110,B00000000,B11111000, - B11111111,B11111111,B11111111,B00000000,B00000000,B00000011,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00111111,B11111111,B11111000 -}; - const unsigned char status_screen2_bmp[] PROGMEM = { - B11111111,B11111111,B11111111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B10000000,B00000000,B00000001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B10000000,B11111000, - B10001110,B00000000,B11100001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111001,B10000000,B00111000, - B10011111,B00000000,B11110001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110111,B10000001,B11011000, - B10010011,B10000001,B00111001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110111,B11000011,B11011000, - B10011111,B10000001,B11111001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100111,B11000111,B11101000, - B10011111,B10000001,B11111001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100011,B11000111,B11111000, - B10011111,B10111001,B11110001,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00100001,B11111111,B10001000, - B10001111,B00101000,B11110001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00100000,B01101100,B00001000, - B10000000,B00111000,B00000001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00100000,B01101100,B00001000, - B10000000,B00000000,B00000001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00100000,B01101100,B00001000, - B10011111,B11111111,B11111001,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00100011,B11111111,B00001000, - B10010001,B01110100,B10011001,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00111111,B11000111,B10001000, - B10011011,B00000110,B10101001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00101111,B11000111,B11001000, - B10011011,B01010100,B10101001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00110111,B10000111,B11011000, - B10011011,B01010110,B10101001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00110111,B00000011,B11011000, - B10011011,B01010100,B10011001,B00000000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000011,B00111000, - B10011111,B11111111,B11111001,B00000000,B00000000,B00000111,B10000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00111110,B00000010,B11111000, - B11111111,B11111111,B11111111,B00000000,B00000000,B00000011,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00111111,B11111111,B11111000 -}; - - #elif FAN_ANIM_FRAMES == 4 - -const unsigned char status_screen0_bmp[] PROGMEM = { - B11111111,B11111111,B11111111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B10000000,B00000000,B00000001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B00000000,B11111000, - B10001110,B00000000,B11100001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00111111,B00111000, - B10011111,B00000000,B11110001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B01111110,B00011000, - B10010011,B10000001,B00111001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B01111100,B00011000, - B10011111,B10000001,B11111001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101000,B01111100,B00001000, - B10011111,B10000001,B11111001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101100,B00111000,B00001000, - B10011111,B10111001,B11110001,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00101111,B00111001,B11001000, - B10001111,B00101000,B11110001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00101111,B11111111,B11101000, - B10000000,B00111000,B00000001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00101111,B11000111,B11101000, - B10000000,B00000000,B00000001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00101111,B11111111,B11101000, - B10011111,B11111111,B11111001,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00100111,B00111001,B11101000, - B10010001,B01110100,B10011001,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00100000,B00111000,B01101000, - B10011011,B00000110,B10101001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00100000,B01111100,B00101000, - B10011011,B01010100,B10101001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00110000,B01111100,B00011000, - B10011011,B01010110,B10101001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00110000,B11111100,B00011000, - B10011011,B01010100,B10011001,B00000000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111001,B11111000,B00111000, - B10011111,B11111111,B11111001,B00000000,B00000000,B00000111,B10000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00111110,B00000000,B11111000, - B11111111,B11111111,B11111111,B00000000,B00000000,B00000011,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00111111,B11111111,B11111000 -}; - -const unsigned char status_screen1_bmp[] PROGMEM = { - B11111111,B11111111,B11111111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B10000000,B00000000,B00000001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B00000000,B11111000, - B10001110,B00000000,B11100001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00001111,B00111000, - B10011111,B00000000,B11110001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110100,B00011111,B11011000, - B10010011,B10000001,B00111001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110110,B00011111,B10011000, - B10011111,B10000001,B11111001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B00011111,B00001000, - B10011111,B10000001,B11111001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B10011110,B00001000, - B10011111,B10111001,B11110001,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00101111,B11111100,B00001000, - B10001111,B00101000,B11110001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00101111,B11011100,B00001000, - B10000000,B00111000,B00000001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00100111,B11101111,B11001000, - B10000000,B00000000,B00000001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00100000,B01110111,B11101000, - B10011111,B11111111,B11111001,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00100000,B01111111,B11101000, - B10010001,B01110100,B10011001,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00100000,B11110011,B11101000, - B10011011,B00000110,B10101001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00100001,B11110001,B11101000, - B10011011,B01010100,B10101001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00110011,B11110000,B11011000, - B10011011,B01010110,B10101001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00110111,B11110000,B01011000, - B10011011,B01010100,B10011001,B00000000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111001,B11100000,B00111000, - B10011111,B11111111,B11111001,B00000000,B00000000,B00000111,B10000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00111110,B00000000,B11111000, - B11111111,B11111111,B11111111,B00000000,B00000000,B00000011,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00111111,B11111111,B11111000 -}; - -const unsigned char status_screen2_bmp[] PROGMEM = { - B11111111,B11111111,B11111111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B10000000,B00000000,B00000001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B10000000,B11111000, - B10001110,B00000000,B11100001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111001,B10000000,B00111000, - B10011111,B00000000,B11110001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110111,B10000001,B11011000, - B10010011,B10000001,B00111001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110111,B11000011,B11011000, - B10011111,B10000001,B11111001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100111,B11000111,B11101000, - B10011111,B10000001,B11111001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100011,B11000111,B11111000, - B10011111,B10111001,B11110001,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00100001,B11111111,B10001000, - B10001111,B00101000,B11110001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00100000,B01101100,B00001000, - B10000000,B00111000,B00000001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00100000,B01101100,B00001000, - B10000000,B00000000,B00000001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00100000,B01101100,B00001000, - B10011111,B11111111,B11111001,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00100011,B11111111,B00001000, - B10010001,B01110100,B10011001,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00111111,B11000111,B10001000, - B10011011,B00000110,B10101001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00101111,B11000111,B11001000, - B10011011,B01010100,B10101001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00110111,B10000111,B11011000, - B10011011,B01010110,B10101001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00110111,B00000011,B11011000, - B10011011,B01010100,B10011001,B00000000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000011,B00111000, - B10011111,B11111111,B11111001,B00000000,B00000000,B00000111,B10000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00111110,B00000010,B11111000, - B11111111,B11111111,B11111111,B00000000,B00000000,B00000011,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00111111,B11111111,B11111000 -}; - - -const unsigned char status_screen3_bmp[] PROGMEM = { - B11111111,B11111111,B11111111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B10000000,B00000000,B00000001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B00000000,B11111000, - B10001110,B00000000,B11100001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111001,B11110000,B00111000, - B10011111,B00000000,B11110001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110001,B11100000,B00011000, - B10010011,B10000001,B00111001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110001,B11100000,B00011000, - B10011111,B10000001,B11111001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100001,B11100001,B11101000, - B10011111,B10000001,B11111001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B11110011,B11101000, - B10011111,B10111001,B11110001,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00100000,B01111111,B11101000, - B10001111,B00101000,B11110001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00100000,B01110111,B11101000, - B10000000,B00111000,B00000001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00101000,B11101110,B00101000, - B10000000,B00000000,B00000001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00101111,B11011100,B00001000, - B10011111,B11111111,B11111001,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00101111,B11111100,B00001000, - B10010001,B01110100,B10011001,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00101111,B10011110,B00001000, - B10011011,B00000110,B10101001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00101111,B00001111,B00001000, - B10011011,B01010100,B10101001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00110000,B00001111,B00011000, - B10011011,B01010110,B10101001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00110000,B00001111,B00011000, - B10011011,B01010100,B10011001,B00000000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00011111,B00111000, - B10011111,B11111111,B11111001,B00000000,B00000000,B00000111,B10000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00111110,B00000000,B11111000, - B11111111,B11111111,B11111111,B00000000,B00000000,B00000011,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00111111,B11111111,B11111000 -}; - - - #endif - -#else // HOTENDS >= 2 - - #if FAN_ANIM_FRAMES <= 2 - - const unsigned char status_screen0_bmp[] PROGMEM = { - B00111101,B11110000,B00000010,B00111000,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11110000, - B01000100,B10001000,B00000110,B01000101,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B10000000,B10001000,B00000010,B01000101,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B11111100,B00110000, - B10000000,B11110000,B00000010,B01000100,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B11111100,B00010000, - B10000000,B10100011,B11110010,B01000100,B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B01111000,B00010000, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B00110000,B00010000, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101100,B00000000,B11010000, - B01000100,B10001000,B00000010,B01000101,B00010000,B00011111,B11100000,B00000001,B11111110,B00000000,B00001000,B00100000,B10000000,B00101110,B00110001,B11010000, - B00111001,B11001100,B00000111,B00111001,B11100000,B00111110,B11110000,B00000011,B11001111,B00000000,B00000100,B00010000,B01000000,B00101111,B01111011,B11010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00111100,B11110000,B00000011,B10110111,B00000000,B00000100,B00010000,B01000000,B00101111,B01111011,B11010000, - B00000000,B00111000,B01110000,B11100000,B00000000,B00111010,B11110000,B00000011,B11110111,B00000000,B00001000,B00100000,B10000000,B00101110,B00110001,B11010000, - B00000000,B01000100,B10001001,B00010000,B00000000,B00011110,B11100000,B00000001,B11101110,B00000000,B00010000,B01000001,B00000000,B00101100,B00000000,B11010000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00011110,B11100000,B00000001,B11011110,B00000000,B00100000,B10000010,B00000000,B00100000,B00110000,B00010000, - B00000000,B00011000,B10001001,B00010000,B00000000,B00111110,B11110000,B00000011,B10111111,B00000000,B00100000,B10000010,B00000000,B00100000,B01111000,B00010000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111110,B11110000,B00000011,B10000111,B00000000,B00010000,B01000001,B00000000,B00100000,B11111100,B00010000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111111,B11110000,B00000011,B11111111,B00000000,B00001000,B00100000,B10000000,B00110000,B11111100,B00110000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00001111,B11000000,B00000000,B11111100,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00000000,B01000100,B10001001,B00010000,B00000000,B00000111,B10000000,B00000000,B01111000,B00000000,B11111111,B11111111,B11000000,B00111111,B11111111,B11110000, - B00000000,B00111000,B01110000,B11100000,B00000000,B00000011,B00000000,B00000000,B00110000,B00000000,B11111111,B11111111,B11000000,B00000000,B00000000,B00000000 - }; - const unsigned char status_screen1_bmp[] PROGMEM = { - B00111101,B11110000,B00000010,B00111000,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11110000, - B01000100,B10001000,B00000110,B01000101,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B10000000,B10001000,B00000010,B01000101,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110011,B10000111,B00110000, - B10000000,B11110000,B00000010,B01000100,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100111,B10000111,B10010000, - B10000000,B10100011,B11110010,B01000100,B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B10000111,B11010000, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B10000111,B11010000, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B00000011,B11010000, - B01000100,B10001000,B00000010,B01000101,B00010000,B00011111,B11100000,B00000001,B11111110,B00000000,B00001000,B00100000,B10000000,B00100000,B00110000,B00010000, - B00111001,B11001100,B00000111,B00111001,B11100000,B00111110,B11110000,B00000011,B11001111,B00000000,B00000100,B00010000,B01000000,B00100000,B01111000,B00010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00111100,B11110000,B00000011,B10110111,B00000000,B00000100,B00010000,B01000000,B00100000,B01111000,B00010000, - B00000000,B00111000,B01110000,B11100000,B00000000,B00111010,B11110000,B00000011,B11110111,B00000000,B00001000,B00100000,B10000000,B00100000,B00110000,B00010000, - B00000000,B01000100,B10001001,B00010000,B00000000,B00011110,B11100000,B00000001,B11101110,B00000000,B00010000,B01000001,B00000000,B00101111,B00000011,B11010000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00011110,B11100000,B00000001,B11011110,B00000000,B00100000,B10000010,B00000000,B00101111,B10000111,B11010000, - B00000000,B00011000,B10001001,B00010000,B00000000,B00111110,B11110000,B00000011,B10111111,B00000000,B00100000,B10000010,B00000000,B00101111,B10000111,B11010000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111110,B11110000,B00000011,B10000111,B00000000,B00010000,B01000001,B00000000,B00100111,B10000111,B10010000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111111,B11110000,B00000011,B11111111,B00000000,B00001000,B00100000,B10000000,B00110011,B10000111,B00110000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00001111,B11000000,B00000000,B11111100,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00000000,B01000100,B10001001,B00010000,B00000000,B00000111,B10000000,B00000000,B01111000,B00000000,B11111111,B11111111,B11000000,B00111111,B11111111,B11110000, - B00000000,B00111000,B01110000,B11100000,B00000000,B00000011,B00000000,B00000000,B00110000,B00000000,B11111111,B11111111,B11000000,B00000000,B00000000,B00000000 - }; - - #elif FAN_ANIM_FRAMES == 3 - - const unsigned char status_screen0_bmp[] PROGMEM = { - B00111101,B11110000,B00000010,B00111000,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11111111,B11111111, - B01000100,B10001000,B00000110,B01000101,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11000000,B00011111, - B10000000,B10001000,B00000010,B01000101,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B00100000,B00100111, - B10000000,B11110000,B00000010,B01000100,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,B11110000,B01111011, - B10000000,B10100011,B11110010,B01000100,B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,B11110000,B01111011, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000101,B11111000,B11111101, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000100,B11111000,B11111001, - B01000100,B10001000,B00000010,B01000101,B00010000,B00011111,B11100000,B00000001,B11111110,B00000000,B00001000,B00100000,B10000000,B00000100,B00111111,B11100001, - B00111001,B11001100,B00000111,B00111001,B11100000,B00111110,B11110000,B00000011,B11001111,B00000000,B00000100,B00010000,B01000000,B00000100,B00001111,B10000001, - B00000000,B00000000,B00000000,B00000000,B00000000,B00111100,B11110000,B00000011,B10110111,B00000000,B00000100,B00010000,B01000000,B00000100,B00001111,B10000001, - B00000000,B00111000,B01110000,B11100000,B00000000,B00111010,B11110000,B00000011,B11110111,B00000000,B00001000,B00100000,B10000000,B00000100,B00001111,B10000001, - B00000000,B01000100,B10001001,B00010000,B00000000,B00011110,B11100000,B00000001,B11101110,B00000000,B00010000,B01000001,B00000000,B00000100,B00111111,B11100001, - B00000000,B00000100,B10001001,B00010000,B00000000,B00011110,B11100000,B00000001,B11011110,B00000000,B00100000,B10000010,B00000000,B00000100,B11111000,B11111001, - B00000000,B00011000,B10001001,B00010000,B00000000,B00111110,B11110000,B00000011,B10111111,B00000000,B00100000,B10000010,B00000000,B00000101,B11111000,B11111101, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111110,B11110000,B00000011,B10000111,B00000000,B00010000,B01000001,B00000000,B00000110,B11110000,B01111011, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111111,B11110000,B00000011,B11111111,B00000000,B00001000,B00100000,B10000000,B00000110,B11110000,B01111011, - B00000000,B00000100,B10001001,B00010000,B00000000,B00001111,B11000000,B00000000,B11111100,B00000000,B00000000,B00000000,B00000000,B00000111,B00100000,B00100111, - B00000000,B01000100,B10001001,B00010000,B00000000,B00000111,B10000000,B00000000,B01111000,B00000000,B11111111,B11111111,B11000000,B00000111,B11000000,B00011111, - B00000000,B00111000,B01110000,B11100000,B00000000,B00000011,B00000000,B00000000,B00110000,B00000000,B11111111,B11111111,B11000000,B00000111,B11111111,B11111111 - }; - const unsigned char status_screen1_bmp[] PROGMEM = { - B00111101,B11110000,B00000010,B00111000,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11111111,B11111111, - B01000100,B10001000,B00000110,B01000101,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11000110,B00011111, - B10000000,B10001000,B00000010,B01000101,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B00111110,B00000111, - B10000000,B11110000,B00000010,B01000100,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,B00111110,B00000011, - B10000000,B10100011,B11110010,B01000100,B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,B00011110,B00000011, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000100,B00011110,B00001101, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000100,B00000110,B00111101, - B01000100,B10001000,B00000010,B01000101,B00010000,B00011111,B11100000,B00000001,B11111110,B00000000,B00001000,B00100000,B10000000,B00000100,B00000111,B00111101, - B00111001,B11001100,B00000111,B00111001,B11100000,B00111110,B11110000,B00000011,B11001111,B00000000,B00000100,B00010000,B01000000,B00000100,B00001111,B11111111, - B00000000,B00000000,B00000000,B00000000,B00000000,B00111100,B11110000,B00000011,B10110111,B00000000,B00000100,B00010000,B01000000,B00000111,B11111111,B11111111, - B00000000,B00111000,B01110000,B11100000,B00000000,B00111010,B11110000,B00000011,B11110111,B00000000,B00001000,B00100000,B10000000,B00000111,B11111111,B10000001, - B00000000,B01000100,B10001001,B00010000,B00000000,B00011110,B11100000,B00000001,B11101110,B00000000,B00010000,B01000001,B00000000,B00000101,B11100111,B00000001, - B00000000,B00000100,B10001001,B00010000,B00000000,B00011110,B11100000,B00000001,B11011110,B00000000,B00100000,B10000010,B00000000,B00000101,B11000011,B00000001, - B00000000,B00011000,B10001001,B00010000,B00000000,B00111110,B11110000,B00000011,B10111111,B00000000,B00100000,B10000010,B00000000,B00000101,B10000011,B11000001, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111110,B11110000,B00000011,B10000111,B00000000,B00010000,B01000001,B00000000,B00000110,B00000011,B11000011, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111111,B11110000,B00000011,B11111111,B00000000,B00001000,B00100000,B10000000,B00000110,B00000011,B11100011, - B00000000,B00000100,B10001001,B00010000,B00000000,B00001111,B11000000,B00000000,B11111100,B00000000,B00000000,B00000000,B00000000,B00000111,B00000011,B11100111, - B00000000,B01000100,B10001001,B00010000,B00000000,B00000111,B10000000,B00000000,B01111000,B00000000,B11111111,B11111111,B11000000,B00000111,B11000011,B00011111, - B00000000,B00111000,B01110000,B11100000,B00000000,B00000011,B00000000,B00000000,B00110000,B00000000,B11111111,B11111111,B11000000,B00000111,B11111111,B11111111 - }; - const unsigned char status_screen2_bmp[] PROGMEM = { - B00111101,B11110000,B00000010,B00111000,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11111111,B11111111, - B01000100,B10001000,B00000110,B01000101,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11000011,B00011111, - B10000000,B10001000,B00000010,B01000101,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B00000011,B11100111, - B10000000,B11110000,B00000010,B01000100,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,B00000011,B11110011, - B10000000,B10100011,B11110010,B01000100,B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,B10000011,B11100011, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000101,B11000011,B11000001, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000101,B11100011,B10000001, - B01000100,B10001000,B00000010,B01000101,B00010000,B00011111,B11100000,B00000001,B11111110,B00000000,B00001000,B00100000,B10000000,B00000101,B11110111,B00000001, - B00111001,B11001100,B00000111,B00111001,B11100000,B00111110,B11110000,B00000011,B11001111,B00000000,B00000100,B00010000,B01000000,B00000111,B11111111,B10000001, - B00000000,B00000000,B00000000,B00000000,B00000000,B00111100,B11110000,B00000011,B10110111,B00000000,B00000100,B00010000,B01000000,B00000111,B11111111,B11111111, - B00000000,B00111000,B01110000,B11100000,B00000000,B00111010,B11110000,B00000011,B11110111,B00000000,B00001000,B00100000,B10000000,B00000100,B00001111,B11111111, - B00000000,B01000100,B10001001,B00010000,B00000000,B00011110,B11100000,B00000001,B11101110,B00000000,B00010000,B01000001,B00000000,B00000100,B00000111,B01111101, - B00000000,B00000100,B10001001,B00010000,B00000000,B00011110,B11100000,B00000001,B11011110,B00000000,B00100000,B10000010,B00000000,B00000100,B00001110,B00111101, - B00000000,B00011000,B10001001,B00010000,B00000000,B00111110,B11110000,B00000011,B10111111,B00000000,B00100000,B10000010,B00000000,B00000100,B00011110,B00011101, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111110,B11110000,B00000011,B10000111,B00000000,B00010000,B01000001,B00000000,B00000110,B00111110,B00001011, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111111,B11110000,B00000011,B11111111,B00000000,B00001000,B00100000,B10000000,B00000110,B01111110,B00000011, - B00000000,B00000100,B10001001,B00010000,B00000000,B00001111,B11000000,B00000000,B11111100,B00000000,B00000000,B00000000,B00000000,B00000111,B00111110,B00000111, - B00000000,B01000100,B10001001,B00010000,B00000000,B00000111,B10000000,B00000000,B01111000,B00000000,B11111111,B11111111,B11000000,B00000111,B11000110,B00011111, - B00000000,B00111000,B01110000,B11100000,B00000000,B00000011,B00000000,B00000000,B00110000,B00000000,B11111111,B11111111,B11000000,B00000111,B11111111,B11111111 - }; - - #elif FAN_ANIM_FRAMES == 4 - - const unsigned char status_screen0_bmp[] PROGMEM = { - B00111101,B11110000,B00000010,B00111000,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B01000100,B10001000,B00000110,B01000101,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B00000000,B11111000, - B10000000,B10001000,B00000010,B01000101,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00111111,B00111000, - B10000000,B11110000,B00000010,B01000100,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B01111110,B00011000, - B10000000,B10100011,B11110010,B01000100,B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B01111100,B00011000, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101000,B01111100,B00001000, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101100,B00111000,B00001000, - B01000100,B10001000,B00000010,B01000101,B00010000,B00011111,B11100000,B00000001,B11111110,B00000000,B00001000,B00100000,B10000000,B00101111,B00111001,B11001000, - B00111001,B11001100,B00000111,B00111001,B11100000,B00111110,B11110000,B00000011,B11001111,B00000000,B00000100,B00010000,B01000000,B00101111,B11111111,B11101000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00111100,B11110000,B00000011,B10110111,B00000000,B00000100,B00010000,B01000000,B00101111,B11000111,B11101000, - B00000000,B00111000,B01110000,B11100000,B00000000,B00111010,B11110000,B00000011,B11110111,B00000000,B00001000,B00100000,B10000000,B00101111,B11111111,B11101000, - B00000000,B01000100,B10001001,B00010000,B00000000,B00011110,B11100000,B00000001,B11101110,B00000000,B00010000,B01000001,B00000000,B00100111,B00111001,B11101000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00011110,B11100000,B00000001,B11011110,B00000000,B00100000,B10000010,B00000000,B00100000,B00111000,B01101000, - B00000000,B00011000,B10001001,B00010000,B00000000,B00111110,B11110000,B00000011,B10111111,B00000000,B00100000,B10000010,B00000000,B00100000,B01111100,B00101000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111110,B11110000,B00000011,B10000111,B00000000,B00010000,B01000001,B00000000,B00110000,B01111100,B00011000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111111,B11110000,B00000011,B11111111,B00000000,B00001000,B00100000,B10000000,B00110000,B11111100,B00011000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00001111,B11000000,B00000000,B11111100,B00000000,B00000000,B00000000,B00000000,B00111001,B11111000,B00111000, - B00000000,B01000100,B10001001,B00010000,B00000000,B00000111,B10000000,B00000000,B01111000,B00000000,B11111111,B11111111,B11000000,B00111110,B00000000,B11111000, - B00000000,B00111000,B01110000,B11100000,B00000000,B00000011,B00000000,B00000000,B00110000,B00000000,B11111111,B11111111,B11000000,B00111111,B11111111,B11111000 - }; - const unsigned char status_screen1_bmp[] PROGMEM = { - B00111101,B11110000,B00000010,B00111000,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B01000100,B10001000,B00000110,B01000101,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B00000000,B11111000, - B10000000,B10001000,B00000010,B01000101,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00001111,B00111000, - B10000000,B11110000,B00000010,B01000100,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110100,B00011111,B11011000, - B10000000,B10100011,B11110010,B01000100,B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110110,B00011111,B10011000, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B00011111,B00001000, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B10011110,B00001000, - B01000100,B10001000,B00000010,B01000101,B00010000,B00011111,B11100000,B00000001,B11111110,B00000000,B00001000,B00100000,B10000000,B00101111,B11111100,B00001000, - B00111001,B11001100,B00000111,B00111001,B11100000,B00111110,B11110000,B00000011,B11001111,B00000000,B00000100,B00010000,B01000000,B00101111,B11011100,B00001000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00111100,B11110000,B00000011,B10110111,B00000000,B00000100,B00010000,B01000000,B00100111,B11101111,B11001000, - B00000000,B00111000,B01110000,B11100000,B00000000,B00111010,B11110000,B00000011,B11110111,B00000000,B00001000,B00100000,B10000000,B00100000,B01110111,B11101000, - B00000000,B01000100,B10001001,B00010000,B00000000,B00011110,B11100000,B00000001,B11101110,B00000000,B00010000,B01000001,B00000000,B00100000,B01111111,B11101000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00011110,B11100000,B00000001,B11011110,B00000000,B00100000,B10000010,B00000000,B00100000,B11110011,B11101000, - B00000000,B00011000,B10001001,B00010000,B00000000,B00111110,B11110000,B00000011,B10111111,B00000000,B00100000,B10000010,B00000000,B00100001,B11110001,B11101000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111110,B11110000,B00000011,B10000111,B00000000,B00010000,B01000001,B00000000,B00110011,B11110000,B11011000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111111,B11110000,B00000011,B11111111,B00000000,B00001000,B00100000,B10000000,B00110111,B11110000,B01011000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00001111,B11000000,B00000000,B11111100,B00000000,B00000000,B00000000,B00000000,B00111001,B11100000,B00111000, - B00000000,B01000100,B10001001,B00010000,B00000000,B00000111,B10000000,B00000000,B01111000,B00000000,B11111111,B11111111,B11000000,B00111110,B00000000,B11111000, - B00000000,B00111000,B01110000,B11100000,B00000000,B00000011,B00000000,B00000000,B00110000,B00000000,B11111111,B11111111,B11000000,B00111111,B11111111,B11111000 - }; - const unsigned char status_screen2_bmp[] PROGMEM = { - B00111101,B11110000,B00000010,B00111000,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B01000100,B10001000,B00000110,B01000101,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B10000000,B11111000, - B10000000,B10001000,B00000010,B01000101,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111001,B10000000,B00111000, - B10000000,B11110000,B00000010,B01000100,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110111,B10000001,B11011000, - B10000000,B10100011,B11110010,B01000100,B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110111,B11000011,B11011000, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100111,B11000111,B11101000, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100011,B11000111,B11111000, - B01000100,B10001000,B00000010,B01000101,B00010000,B00011111,B11100000,B00000001,B11111110,B00000000,B00001000,B00100000,B10000000,B00100001,B11111111,B10001000, - B00111001,B11001100,B00000111,B00111001,B11100000,B00111110,B11110000,B00000011,B11001111,B00000000,B00000100,B00010000,B01000000,B00100000,B01101100,B00001000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00111100,B11110000,B00000011,B10110111,B00000000,B00000100,B00010000,B01000000,B00100000,B01101100,B00001000, - B00000000,B00111000,B01110000,B11100000,B00000000,B00111010,B11110000,B00000011,B11110111,B00000000,B00001000,B00100000,B10000000,B00100000,B01101100,B00001000, - B00000000,B01000100,B10001001,B00010000,B00000000,B00011110,B11100000,B00000001,B11101110,B00000000,B00010000,B01000001,B00000000,B00100011,B11111111,B00001000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00011110,B11100000,B00000001,B11011110,B00000000,B00100000,B10000010,B00000000,B00111111,B11000111,B10001000, - B00000000,B00011000,B10001001,B00010000,B00000000,B00111110,B11110000,B00000011,B10111111,B00000000,B00100000,B10000010,B00000000,B00101111,B11000111,B11001000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111110,B11110000,B00000011,B10000111,B00000000,B00010000,B01000001,B00000000,B00110111,B10000111,B11011000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111111,B11110000,B00000011,B11111111,B00000000,B00001000,B00100000,B10000000,B00110111,B00000011,B11011000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00001111,B11000000,B00000000,B11111100,B00000000,B00000000,B00000000,B00000000,B00111000,B00000011,B00111000, - B00000000,B01000100,B10001001,B00010000,B00000000,B00000111,B10000000,B00000000,B01111000,B00000000,B11111111,B11111111,B11000000,B00111110,B00000010,B11111000, - B00000000,B00111000,B01110000,B11100000,B00000000,B00000011,B00000000,B00000000,B00110000,B00000000,B11111111,B11111111,B11000000,B00111111,B11111111,B11111000 - }; - const unsigned char status_screen3_bmp[] PROGMEM = { - B00111101,B11110000,B00000010,B00111000,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B01000100,B10001000,B00000110,B01000101,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B00000000,B11111000, - B10000000,B10001000,B00000010,B01000101,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111001,B11110000,B00111000, - B10000000,B11110000,B00000010,B01000100,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110001,B11100000,B00011000, - B10000000,B10100011,B11110010,B01000100,B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110001,B11100000,B00011000, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100001,B11100001,B11101000, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B11110011,B11101000, - B01000100,B10001000,B00000010,B01000101,B00010000,B00011111,B11100000,B00000001,B11111110,B00000000,B00001000,B00100000,B10000000,B00100000,B01111111,B11101000, - B00111001,B11001100,B00000111,B00111001,B11100000,B00111110,B11110000,B00000011,B11001111,B00000000,B00000100,B00010000,B01000000,B00100000,B01110111,B11101000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00111100,B11110000,B00000011,B10110111,B00000000,B00000100,B00010000,B01000000,B00101000,B11101110,B00101000, - B00000000,B00111000,B01110000,B11100000,B00000000,B00111010,B11110000,B00000011,B11110111,B00000000,B00001000,B00100000,B10000000,B00101111,B11011100,B00001000, - B00000000,B01000100,B10001001,B00010000,B00000000,B00011110,B11100000,B00000001,B11101110,B00000000,B00010000,B01000001,B00000000,B00101111,B11111100,B00001000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00011110,B11100000,B00000001,B11011110,B00000000,B00100000,B10000010,B00000000,B00101111,B10011110,B00001000, - B00000000,B00011000,B10001001,B00010000,B00000000,B00111110,B11110000,B00000011,B10111111,B00000000,B00100000,B10000010,B00000000,B00101111,B00001111,B00001000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111110,B11110000,B00000011,B10000111,B00000000,B00010000,B01000001,B00000000,B00110000,B00001111,B00011000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111111,B11110000,B00000011,B11111111,B00000000,B00001000,B00100000,B10000000,B00110000,B00001111,B00011000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00001111,B11000000,B00000000,B11111100,B00000000,B00000000,B00000000,B00000000,B00111000,B00011111,B00111000, - B00000000,B01000100,B10001001,B00010000,B00000000,B00000111,B10000000,B00000000,B01111000,B00000000,B11111111,B11111111,B11000000,B00111110,B00000000,B11111000, - B00000000,B00111000,B01110000,B11100000,B00000000,B00000011,B00000000,B00000000,B00110000,B00000000,B11111111,B11111111,B11000000,B00111111,B11111111,B11111000 - }; - - #endif - -#endif // HOTENDS >= 2 + #define STATUS_LOGO_X 8 + #define STATUS_HEATERS_X 40 + #define STATUS_BED_X 72 +#else + #define STATUS_LOGO_X 0 + #define STATUS_HEATERS_X 32 + #define STATUS_BED_X 80 +#endif diff --git a/Marlin/src/HAL/HAL_AVR/HAL.h b/Marlin/src/HAL/HAL_AVR/HAL.h index 5a7f41ed2d..2992ebe0e3 100644 --- a/Marlin/src/HAL/HAL_AVR/HAL.h +++ b/Marlin/src/HAL/HAL_AVR/HAL.h @@ -16,9 +16,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - -#ifndef _HAL_AVR_H_ -#define _HAL_AVR_H_ +#pragma once // -------------------------------------------------------------------------- // Includes @@ -79,16 +77,32 @@ typedef int8_t pin_t; //extern uint8_t MCUSR; -#define NUM_SERIAL 1 - +// Serial ports #ifdef USBCON #if ENABLED(BLUETOOTH) #define MYSERIAL0 bluetoothSerial #else #define MYSERIAL0 Serial #endif + #define NUM_SERIAL 1 #else - #define MYSERIAL0 customizedSerial + #if !WITHIN(SERIAL_PORT, -1, 3) + #error "SERIAL_PORT must be from -1 to 3" + #endif + + #define MYSERIAL0 customizedSerial1 + + #ifdef SERIAL_PORT_2 + #if !WITHIN(SERIAL_PORT_2, -1, 3) + #error "SERIAL_PORT_2 must be from -1 to 3" + #elif SERIAL_PORT_2 == SERIAL_PORT + #error "SERIAL_PORT_2 must be different than SERIAL_PORT" + #endif + #define NUM_SERIAL 2 + #define MYSERIAL1 customizedSerial2 + #else + #define NUM_SERIAL 1 + #endif #endif // -------------------------------------------------------------------------- @@ -358,5 +372,3 @@ inline void HAL_adc_init(void) { // AVR compatibility #define strtof strtod - -#endif // _HAL_AVR_H_ diff --git a/Marlin/src/HAL/HAL_AVR/MarlinSerial.cpp b/Marlin/src/HAL/HAL_AVR/MarlinSerial.cpp index ece2497766..36134f7b89 100644 --- a/Marlin/src/HAL/HAL_AVR/MarlinSerial.cpp +++ b/Marlin/src/HAL/HAL_AVR/MarlinSerial.cpp @@ -29,6 +29,7 @@ * Modified 14 February 2016 by Andreas Hardtung (added tx buffer) * Modified 01 October 2017 by Eduardo José Tagle (added XON/XOFF) * Modified 10 June 2018 by Eduardo José Tagle (See #10991) + * Templatized 01 October 2018 by Eduardo José Tagle to allow multiple instances */ #ifdef __AVR__ @@ -42,62 +43,26 @@ #include "MarlinSerial.h" #include "../../Marlin.h" - struct ring_buffer_r { - unsigned char buffer[RX_BUFFER_SIZE]; - volatile ring_buffer_pos_t head, tail; - }; - - #if TX_BUFFER_SIZE > 0 - struct ring_buffer_t { - unsigned char buffer[TX_BUFFER_SIZE]; - volatile uint8_t head, tail; - }; - #endif - - #if UART_PRESENT(SERIAL_PORT) - ring_buffer_r rx_buffer = { { 0 }, 0, 0 }; - #if TX_BUFFER_SIZE > 0 - ring_buffer_t tx_buffer = { { 0 }, 0, 0 }; - #endif - static bool _written; - #endif - - #if ENABLED(SERIAL_XON_XOFF) - constexpr uint8_t XON_XOFF_CHAR_SENT = 0x80, // XON / XOFF Character was sent - XON_XOFF_CHAR_MASK = 0x1F; // XON / XOFF character to send - // XON / XOFF character definitions - constexpr uint8_t XON_CHAR = 17, XOFF_CHAR = 19; - uint8_t xon_xoff_state = XON_XOFF_CHAR_SENT | XON_CHAR; - #endif - - #if ENABLED(SERIAL_STATS_DROPPED_RX) - uint8_t rx_dropped_bytes = 0; - #endif - - #if ENABLED(SERIAL_STATS_RX_BUFFER_OVERRUNS) - uint8_t rx_buffer_overruns = 0; - #endif - - #if ENABLED(SERIAL_STATS_RX_FRAMING_ERRORS) - uint8_t rx_framing_errors = 0; - #endif - - #if ENABLED(SERIAL_STATS_MAX_RX_QUEUED) - ring_buffer_pos_t rx_max_enqueued = 0; - #endif + template typename MarlinSerial::ring_buffer_r MarlinSerial::rx_buffer = { 0, 0, { 0 } }; + template typename MarlinSerial::ring_buffer_t MarlinSerial::tx_buffer = { 0 }; + template bool MarlinSerial::_written = false; + template uint8_t MarlinSerial::xon_xoff_state = MarlinSerial::XON_XOFF_CHAR_SENT | MarlinSerial::XON_CHAR; + template uint8_t MarlinSerial::rx_dropped_bytes = 0; + template uint8_t MarlinSerial::rx_buffer_overruns = 0; + template uint8_t MarlinSerial::rx_framing_errors = 0; + template typename MarlinSerial::ring_buffer_pos_t MarlinSerial::rx_max_enqueued = 0; // A SW memory barrier, to ensure GCC does not overoptimize loops #define sw_barrier() asm volatile("": : :"memory"); - #if ENABLED(EMERGENCY_PARSER) - #include "../../feature/emergency_parser.h" - #endif + #include "../../feature/emergency_parser.h" // "Atomically" read the RX head index value without disabling interrupts: // This MUST be called with RX interrupts enabled, and CAN'T be called // from the RX ISR itself! - FORCE_INLINE ring_buffer_pos_t atomic_read_rx_head() { - #if RX_BUFFER_SIZE > 256 + template + FORCE_INLINE typename MarlinSerial::ring_buffer_pos_t MarlinSerial::atomic_read_rx_head() { + if (Cfg::RX_SIZE > 256) { // Keep reading until 2 consecutive reads return the same value, // meaning there was no update in-between caused by an interrupt. // This works because serial RX interrupts happen at a slower rate @@ -111,23 +76,25 @@ sw_barrier(); } while (vold != vnew); return vnew; - #else + } + else { // With an 8bit index, reads are always atomic. No need for special handling return rx_buffer.head; - #endif + } } - #if RX_BUFFER_SIZE > 256 - static volatile bool rx_tail_value_not_stable = false; - static volatile uint16_t rx_tail_value_backup = 0; - #endif + template + volatile bool MarlinSerial::rx_tail_value_not_stable = false; + template + volatile uint16_t MarlinSerial::rx_tail_value_backup = 0; // Set RX tail index, taking into account the RX ISR could interrupt // the write to this variable in the middle - So a backup strategy // is used to ensure reads of the correct values. // -Must NOT be called from the RX ISR - - FORCE_INLINE void atomic_set_rx_tail(ring_buffer_pos_t value) { - #if RX_BUFFER_SIZE > 256 + template + FORCE_INLINE void MarlinSerial::atomic_set_rx_tail(typename MarlinSerial::ring_buffer_pos_t value) { + if (Cfg::RX_SIZE > 256) { // Store the new value in the backup rx_tail_value_backup = value; sw_barrier(); @@ -140,29 +107,29 @@ // Signal the new value is completely stored into the value rx_tail_value_not_stable = false; sw_barrier(); - #else + } + else rx_buffer.tail = value; - #endif } // Get the RX tail index, taking into account the read could be // interrupting in the middle of the update of that index value // -Called from the RX ISR - - FORCE_INLINE ring_buffer_pos_t atomic_read_rx_tail() { - #if RX_BUFFER_SIZE > 256 + template + FORCE_INLINE typename MarlinSerial::ring_buffer_pos_t MarlinSerial::atomic_read_rx_tail() { + if (Cfg::RX_SIZE > 256) { // If the true index is being modified, return the backup value if (rx_tail_value_not_stable) return rx_tail_value_backup; - #endif + } // The true index is stable, return it return rx_buffer.tail; } // (called with RX interrupts disabled) - FORCE_INLINE void store_rxd_char() { + template + FORCE_INLINE void MarlinSerial::store_rxd_char() { - #if ENABLED(EMERGENCY_PARSER) - static EmergencyParser::State emergency_state; // = EP_RESET - #endif + static EmergencyParser::State emergency_state; // = EP_RESET // Get the tail - Nothing can alter its value while this ISR is executing, but there's // a chance that this ISR interrupted the main process while it was updating the index. @@ -173,27 +140,17 @@ ring_buffer_pos_t h = rx_buffer.head; // Get the next element - ring_buffer_pos_t i = (ring_buffer_pos_t)(h + 1) & (ring_buffer_pos_t)(RX_BUFFER_SIZE - 1); + ring_buffer_pos_t i = (ring_buffer_pos_t)(h + 1) & (ring_buffer_pos_t)(Cfg::RX_SIZE - 1); - // This must read the M_UCSRxA register before reading the received byte to detect error causes - #if ENABLED(SERIAL_STATS_DROPPED_RX) - if (TEST(M_UCSRxA, M_DORx) && !++rx_dropped_bytes) --rx_dropped_bytes; - #endif - - #if ENABLED(SERIAL_STATS_RX_BUFFER_OVERRUNS) - if (TEST(M_UCSRxA, M_DORx) && !++rx_buffer_overruns) --rx_buffer_overruns; - #endif - - #if ENABLED(SERIAL_STATS_RX_FRAMING_ERRORS) - if (TEST(M_UCSRxA, M_FEx) && !++rx_framing_errors) --rx_framing_errors; - #endif + // This must read the R_UCSRA register before reading the received byte to detect error causes + if (Cfg::DROPPED_RX && B_DOR && !++rx_dropped_bytes) --rx_dropped_bytes; + if (Cfg::RX_OVERRUNS && B_DOR && !++rx_buffer_overruns) --rx_buffer_overruns; + if (Cfg::RX_FRAMING_ERRORS && B_FE && !++rx_framing_errors) --rx_framing_errors; // Read the character from the USART - uint8_t c = M_UDRx; + uint8_t c = R_UDR; - #if ENABLED(EMERGENCY_PARSER) - emergency_parser.update(emergency_state, c); - #endif + if (Cfg::EMERGENCYPARSER) emergency_parser.update(emergency_state, c); // If the character is to be stored at the index just before the tail // (such that the head would advance to the current tail), the RX FIFO is @@ -202,29 +159,28 @@ rx_buffer.buffer[h] = c; h = i; } - #if ENABLED(SERIAL_STATS_DROPPED_RX) - else if (!++rx_dropped_bytes) --rx_dropped_bytes; - #endif + else if (Cfg::DROPPED_RX && !++rx_dropped_bytes) + --rx_dropped_bytes; - #if ENABLED(SERIAL_STATS_MAX_RX_QUEUED) + if (Cfg::MAX_RX_QUEUED) { // Calculate count of bytes stored into the RX buffer - const ring_buffer_pos_t rx_count = (ring_buffer_pos_t)(h - t) & (ring_buffer_pos_t)(RX_BUFFER_SIZE - 1); + const ring_buffer_pos_t rx_count = (ring_buffer_pos_t)(h - t) & (ring_buffer_pos_t)(Cfg::RX_SIZE - 1); // Keep track of the maximum count of enqueued bytes NOLESS(rx_max_enqueued, rx_count); - #endif + } - #if ENABLED(SERIAL_XON_XOFF) + if (Cfg::XONOFF) { // If the last char that was sent was an XON if ((xon_xoff_state & XON_XOFF_CHAR_MASK) == XON_CHAR) { // Bytes stored into the RX buffer - const ring_buffer_pos_t rx_count = (ring_buffer_pos_t)(h - t) & (ring_buffer_pos_t)(RX_BUFFER_SIZE - 1); + const ring_buffer_pos_t rx_count = (ring_buffer_pos_t)(h - t) & (ring_buffer_pos_t)(Cfg::RX_SIZE - 1); // If over 12.5% of RX buffer capacity, send XOFF before running out of // RX buffer space .. 325 bytes @ 250kbits/s needed to let the host react // and stop sending bytes. This translates to 13mS propagation time. - if (rx_count >= (RX_BUFFER_SIZE) / 8) { + if (rx_count >= (Cfg::RX_SIZE) / 8) { // At this point, definitely no TX interrupt was executing, since the TX ISR can't be preempted. // Don't enable the TX interrupt here as a means to trigger the XOFF char, because if it happens @@ -238,19 +194,17 @@ // Wait until the TX register becomes empty and send it - Here there could be a problem // - While waiting for the TX register to empty, the RX register could receive a new // character. This must also handle that situation! - while (!TEST(M_UCSRxA, M_UDREx)) { + while (!B_UDRE) { - if (TEST(M_UCSRxA,M_RXCx)) { + if (B_RXC) { // A char arrived while waiting for the TX buffer to be empty - Receive and process it! - i = (ring_buffer_pos_t)(h + 1) & (ring_buffer_pos_t)(RX_BUFFER_SIZE - 1); + i = (ring_buffer_pos_t)(h + 1) & (ring_buffer_pos_t)(Cfg::RX_SIZE - 1); // Read the character from the USART - c = M_UDRx; + c = R_UDR; - #if ENABLED(EMERGENCY_PARSER) - emergency_parser.update(emergency_state, c); - #endif + if (Cfg::EMERGENCYPARSER) emergency_parser.update(emergency_state, c); // If the character is to be stored at the index just before the tail // (such that the head would advance to the current tail), the FIFO is @@ -259,19 +213,18 @@ rx_buffer.buffer[h] = c; h = i; } - #if ENABLED(SERIAL_STATS_DROPPED_RX) - else if (!++rx_dropped_bytes) --rx_dropped_bytes; - #endif + else if (Cfg::DROPPED_RX && !++rx_dropped_bytes) + --rx_dropped_bytes; } sw_barrier(); } - M_UDRx = XOFF_CHAR; + R_UDR = XOFF_CHAR; // Clear the TXC bit -- "can be cleared by writing a one to its bit // location". This makes sure flush() won't return until the bytes // actually got written - SBI(M_UCSRxA, M_TXCx); + B_TXC = 1; // At this point there could be a race condition between the write() function // and this sending of the XOFF char. This interrupt could happen between the @@ -280,19 +233,18 @@ // sure the write() function will succeed is to wait for the XOFF char to be // completely sent. Since an extra character could be received during the wait // it must also be handled! - while (!TEST(M_UCSRxA, M_UDREx)) { + while (!B_UDRE) { - if (TEST(M_UCSRxA,M_RXCx)) { + if (B_RXC) { // A char arrived while waiting for the TX buffer to be empty - Receive and process it! - i = (ring_buffer_pos_t)(h + 1) & (ring_buffer_pos_t)(RX_BUFFER_SIZE - 1); + i = (ring_buffer_pos_t)(h + 1) & (ring_buffer_pos_t)(Cfg::RX_SIZE - 1); // Read the character from the USART - c = M_UDRx; + c = R_UDR; - #if ENABLED(EMERGENCY_PARSER) + if (Cfg::EMERGENCYPARSER) emergency_parser.update(emergency_state, c); - #endif // If the character is to be stored at the index just before the tail // (such that the head would advance to the current tail), the FIFO is @@ -301,9 +253,8 @@ rx_buffer.buffer[h] = c; h = i; } - #if ENABLED(SERIAL_STATS_DROPPED_RX) - else if (!++rx_dropped_bytes) --rx_dropped_bytes; - #endif + else if (Cfg::DROPPED_RX && !++rx_dropped_bytes) + --rx_dropped_bytes; } sw_barrier(); } @@ -312,78 +263,68 @@ // have any issues writing to the UART TX register if it needs to! } } - #endif // SERIAL_XON_XOFF + } // Store the new head value - The main loop will retry until the value is stable rx_buffer.head = h; } - #if TX_BUFFER_SIZE > 0 - - // (called with TX irqs disabled) - FORCE_INLINE void _tx_udr_empty_irq(void) { - + // (called with TX irqs disabled) + template + FORCE_INLINE void MarlinSerial::_tx_udr_empty_irq(void) { + if (Cfg::TX_SIZE > 0) { // Read positions uint8_t t = tx_buffer.tail; const uint8_t h = tx_buffer.head; - #if ENABLED(SERIAL_XON_XOFF) + if (Cfg::XONOFF) { // If an XON char is pending to be sent, do it now if (xon_xoff_state == XON_CHAR) { // Send the character - M_UDRx = XON_CHAR; + R_UDR = XON_CHAR; // clear the TXC bit -- "can be cleared by writing a one to its bit // location". This makes sure flush() won't return until the bytes // actually got written - SBI(M_UCSRxA, M_TXCx); + B_TXC = 1; // Remember we sent it. xon_xoff_state = XON_CHAR | XON_XOFF_CHAR_SENT; // If nothing else to transmit, just disable TX interrupts. - if (h == t) CBI(M_UCSRxB, M_UDRIEx); // (Non-atomic, could be reenabled by the main program, but eventually this will succeed) + if (h == t) B_UDRIE = 0; // (Non-atomic, could be reenabled by the main program, but eventually this will succeed) return; } - #endif + } // If nothing to transmit, just disable TX interrupts. This could // happen as the result of the non atomicity of the disabling of RX // interrupts that could end reenabling TX interrupts as a side effect. if (h == t) { - CBI(M_UCSRxB, M_UDRIEx); // (Non-atomic, could be reenabled by the main program, but eventually this will succeed) + B_UDRIE = 0; // (Non-atomic, could be reenabled by the main program, but eventually this will succeed) return; } // There is something to TX, Send the next byte const uint8_t c = tx_buffer.buffer[t]; - t = (t + 1) & (TX_BUFFER_SIZE - 1); - M_UDRx = c; + t = (t + 1) & (Cfg::TX_SIZE - 1); + R_UDR = c; tx_buffer.tail = t; // Clear the TXC bit (by writing a one to its bit location). // Ensures flush() won't return until the bytes are actually written/ - SBI(M_UCSRxA, M_TXCx); + B_TXC = 1; // Disable interrupts if there is nothing to transmit following this byte - if (h == t) CBI(M_UCSRxB, M_UDRIEx); // (Non-atomic, could be reenabled by the main program, but eventually this will succeed) + if (h == t) B_UDRIE = 0; // (Non-atomic, could be reenabled by the main program, but eventually this will succeed) } - - #ifdef M_USARTx_UDRE_vect - ISR(M_USARTx_UDRE_vect) { _tx_udr_empty_irq(); } - #endif - - #endif // TX_BUFFER_SIZE - - #ifdef M_USARTx_RX_vect - ISR(M_USARTx_RX_vect) { store_rxd_char(); } - #endif + } // Public Methods - - void MarlinSerial::begin(const long baud) { + template + void MarlinSerial::begin(const long baud) { uint16_t baud_setting; bool useU2X = true; @@ -394,41 +335,41 @@ if (baud == 57600) useU2X = false; #endif + R_UCSRA = 0; if (useU2X) { - M_UCSRxA = _BV(M_U2Xx); + B_U2X = 1; baud_setting = (F_CPU / 4 / baud - 1) / 2; } - else { - M_UCSRxA = 0; + else baud_setting = (F_CPU / 8 / baud - 1) / 2; - } // assign the baud_setting, a.k.a. ubbr (USART Baud Rate Register) - M_UBRRxH = baud_setting >> 8; - M_UBRRxL = baud_setting; + R_UBRRH = baud_setting >> 8; + R_UBRRL = baud_setting; - SBI(M_UCSRxB, M_RXENx); - SBI(M_UCSRxB, M_TXENx); - SBI(M_UCSRxB, M_RXCIEx); - #if TX_BUFFER_SIZE > 0 - CBI(M_UCSRxB, M_UDRIEx); - #endif + B_RXEN = 1; + B_TXEN = 1; + B_RXCIE = 1; + if (Cfg::TX_SIZE > 0) B_UDRIE = 0; _written = false; } - void MarlinSerial::end() { - CBI(M_UCSRxB, M_RXENx); - CBI(M_UCSRxB, M_TXENx); - CBI(M_UCSRxB, M_RXCIEx); - CBI(M_UCSRxB, M_UDRIEx); + template + void MarlinSerial::end() { + B_RXEN = 0; + B_TXEN = 0; + B_RXCIE = 0; + B_UDRIE = 0; } - int MarlinSerial::peek(void) { + template + int MarlinSerial::peek(void) { const ring_buffer_pos_t h = atomic_read_rx_head(), t = rx_buffer.tail; return h == t ? -1 : rx_buffer.buffer[t]; } - int MarlinSerial::read(void) { + template + int MarlinSerial::read(void) { const ring_buffer_pos_t h = atomic_read_rx_head(); // Read the tail. Main thread owns it, so it is safe to directly read it @@ -439,42 +380,45 @@ // Get the next char const int v = rx_buffer.buffer[t]; - t = (ring_buffer_pos_t)(t + 1) & (RX_BUFFER_SIZE - 1); + t = (ring_buffer_pos_t)(t + 1) & (Cfg::RX_SIZE - 1); // Advance tail - Making sure the RX ISR will always get an stable value, even // if it interrupts the writing of the value of that variable in the middle. atomic_set_rx_tail(t); - #if ENABLED(SERIAL_XON_XOFF) + if (Cfg::XONOFF) { // If the XOFF char was sent, or about to be sent... if ((xon_xoff_state & XON_XOFF_CHAR_MASK) == XOFF_CHAR) { // Get count of bytes in the RX buffer - const ring_buffer_pos_t rx_count = (ring_buffer_pos_t)(h - t) & (ring_buffer_pos_t)(RX_BUFFER_SIZE - 1); - if (rx_count < (RX_BUFFER_SIZE) / 10) { - #if TX_BUFFER_SIZE > 0 + const ring_buffer_pos_t rx_count = (ring_buffer_pos_t)(h - t) & (ring_buffer_pos_t)(Cfg::RX_SIZE - 1); + if (rx_count < (Cfg::RX_SIZE) / 10) { + if (Cfg::TX_SIZE > 0) { // Signal we want an XON character to be sent. xon_xoff_state = XON_CHAR; // Enable TX ISR. Non atomic, but it will eventually enable them - SBI(M_UCSRxB, M_UDRIEx); - #else + B_UDRIE = 1; + } + else { // If not using TX interrupts, we must send the XON char now xon_xoff_state = XON_CHAR | XON_XOFF_CHAR_SENT; - while (!TEST(M_UCSRxA, M_UDREx)) sw_barrier(); - M_UDRx = XON_CHAR; - #endif + while (!B_UDRE) sw_barrier(); + R_UDR = XON_CHAR; + } } } - #endif + } return v; } - ring_buffer_pos_t MarlinSerial::available(void) { + template + typename MarlinSerial::ring_buffer_pos_t MarlinSerial::available(void) { const ring_buffer_pos_t h = atomic_read_rx_head(), t = rx_buffer.tail; - return (ring_buffer_pos_t)(RX_BUFFER_SIZE + h - t) & (RX_BUFFER_SIZE - 1); + return (ring_buffer_pos_t)(Cfg::RX_SIZE + h - t) & (Cfg::RX_SIZE - 1); } - void MarlinSerial::flush(void) { + template + void MarlinSerial::flush(void) { // Set the tail to the head: // - Read the RX head index in a safe way. (See atomic_read_rx_head.) @@ -482,26 +426,36 @@ // if it interrupts the writing of the value of that variable in the middle. atomic_set_rx_tail(atomic_read_rx_head()); - #if ENABLED(SERIAL_XON_XOFF) + if (Cfg::XONOFF) { // If the XOFF char was sent, or about to be sent... if ((xon_xoff_state & XON_XOFF_CHAR_MASK) == XOFF_CHAR) { - #if TX_BUFFER_SIZE > 0 + if (Cfg::TX_SIZE > 0) { // Signal we want an XON character to be sent. xon_xoff_state = XON_CHAR; // Enable TX ISR. Non atomic, but it will eventually enable it. - SBI(M_UCSRxB, M_UDRIEx); - #else + B_UDRIE = 1; + } + else { // If not using TX interrupts, we must send the XON char now xon_xoff_state = XON_CHAR | XON_XOFF_CHAR_SENT; - while (!TEST(M_UCSRxA, M_UDREx)) sw_barrier(); - M_UDRx = XON_CHAR; - #endif + while (!B_UDRE) sw_barrier(); + R_UDR = XON_CHAR; + } } - #endif + } } - #if TX_BUFFER_SIZE > 0 - void MarlinSerial::write(const uint8_t c) { + template + void MarlinSerial::write(const uint8_t c) { + if (Cfg::TX_SIZE == 0) { + + _written = true; + while (!B_UDRE) sw_barrier(); + R_UDR = c; + + } + else { + _written = true; // If the TX interrupts are disabled and the data register @@ -511,17 +465,17 @@ // interrupt overhead becomes a slowdown. // Yes, there is a race condition between the sending of the // XOFF char at the RX ISR, but it is properly handled there - if (!TEST(M_UCSRxB, M_UDRIEx) && TEST(M_UCSRxA, M_UDREx)) { - M_UDRx = c; + if (!B_UDRIE && B_UDRE) { + R_UDR = c; // clear the TXC bit -- "can be cleared by writing a one to its bit // location". This makes sure flush() won't return until the bytes // actually got written - SBI(M_UCSRxA, M_TXCx); + B_TXC = 1; return; } - const uint8_t i = (tx_buffer.head + 1) & (TX_BUFFER_SIZE - 1); + const uint8_t i = (tx_buffer.head + 1) & (Cfg::TX_SIZE - 1); // If global interrupts are disabled (as the result of being called from an ISR)... if (!ISRS_ENABLED()) { @@ -530,7 +484,7 @@ while (i == tx_buffer.tail) { // If we can transmit another byte, do it. - if (TEST(M_UCSRxA, M_UDREx)) _tx_udr_empty_irq(); + if (B_UDRE) _tx_udr_empty_irq(); // Make sure compiler rereads tx_buffer.tail sw_barrier(); @@ -538,7 +492,7 @@ } else { // Interrupts are enabled, just wait until there is space - while (i == tx_buffer.tail) { sw_barrier(); } + while (i == tx_buffer.tail) sw_barrier(); } // Store new char. head is always safe to move @@ -546,10 +500,27 @@ tx_buffer.head = i; // Enable TX ISR - Non atomic, but it will eventually enable TX ISR - SBI(M_UCSRxB, M_UDRIEx); + B_UDRIE = 1; } + } + + template + void MarlinSerial::flushTX(void) { + + if (Cfg::TX_SIZE == 0) { + // No bytes written, no need to flush. This special case is needed since there's + // no way to force the TXC (transmit complete) bit to 1 during initialization. + if (!_written) return; + + // Wait until everything was transmitted + while (!B_TXC) sw_barrier(); + + // At this point nothing is queued anymore (DRIE is disabled) and + // the hardware finished transmission (TXC is set). + + } + else { - void MarlinSerial::flushTX(void) { // No bytes written, no need to flush. This special case is needed since there's // no way to force the TXC (transmit complete) bit to 1 during initialization. if (!_written) return; @@ -558,11 +529,10 @@ if (!ISRS_ENABLED()) { // Wait until everything was transmitted - We must do polling, as interrupts are disabled - while (tx_buffer.head != tx_buffer.tail || !TEST(M_UCSRxA, M_TXCx)) { + while (tx_buffer.head != tx_buffer.tail || !B_TXC) { // If there is more space, send an extra character - if (TEST(M_UCSRxA, M_UDREx)) - _tx_udr_empty_irq(); + if (B_UDRE) _tx_udr_empty_irq(); sw_barrier(); } @@ -570,55 +540,40 @@ } else { // Wait until everything was transmitted - while (tx_buffer.head != tx_buffer.tail || !TEST(M_UCSRxA, M_TXCx)) sw_barrier(); + while (tx_buffer.head != tx_buffer.tail || !B_TXC) sw_barrier(); } // At this point nothing is queued anymore (DRIE is disabled) and // the hardware finished transmission (TXC is set). } - - #else // TX_BUFFER_SIZE == 0 - - void MarlinSerial::write(const uint8_t c) { - _written = true; - while (!TEST(M_UCSRxA, M_UDREx)) sw_barrier(); - M_UDRx = c; - } - - void MarlinSerial::flushTX(void) { - // No bytes written, no need to flush. This special case is needed since there's - // no way to force the TXC (transmit complete) bit to 1 during initialization. - if (!_written) return; - - // Wait until everything was transmitted - while (!TEST(M_UCSRxA, M_TXCx)) sw_barrier(); - - // At this point nothing is queued anymore (DRIE is disabled) and - // the hardware finished transmission (TXC is set). - } - #endif // TX_BUFFER_SIZE == 0 + } /** * Imports from print.h */ - void MarlinSerial::print(char c, int base) { + template + void MarlinSerial::print(char c, int base) { print((long)c, base); } - void MarlinSerial::print(unsigned char b, int base) { + template + void MarlinSerial::print(unsigned char b, int base) { print((unsigned long)b, base); } - void MarlinSerial::print(int n, int base) { + template + void MarlinSerial::print(int n, int base) { print((long)n, base); } - void MarlinSerial::print(unsigned int n, int base) { + template + void MarlinSerial::print(unsigned int n, int base) { print((unsigned long)n, base); } - void MarlinSerial::print(long n, int base) { + template + void MarlinSerial::print(long n, int base) { if (base == 0) write(n); else if (base == 10) { if (n < 0) { print('-'); n = -n; } @@ -628,68 +583,81 @@ printNumber(n, base); } - void MarlinSerial::print(unsigned long n, int base) { + template + void MarlinSerial::print(unsigned long n, int base) { if (base == 0) write(n); else printNumber(n, base); } - void MarlinSerial::print(double n, int digits) { + template + void MarlinSerial::print(double n, int digits) { printFloat(n, digits); } - void MarlinSerial::println(void) { + template + void MarlinSerial::println(void) { print('\r'); print('\n'); } - void MarlinSerial::println(const String& s) { + template + void MarlinSerial::println(const String& s) { print(s); println(); } - void MarlinSerial::println(const char c[]) { + template + void MarlinSerial::println(const char c[]) { print(c); println(); } - void MarlinSerial::println(char c, int base) { + template + void MarlinSerial::println(char c, int base) { print(c, base); println(); } - void MarlinSerial::println(unsigned char b, int base) { + template + void MarlinSerial::println(unsigned char b, int base) { print(b, base); println(); } - void MarlinSerial::println(int n, int base) { + template + void MarlinSerial::println(int n, int base) { print(n, base); println(); } - void MarlinSerial::println(unsigned int n, int base) { + template + void MarlinSerial::println(unsigned int n, int base) { print(n, base); println(); } - void MarlinSerial::println(long n, int base) { + template + void MarlinSerial::println(long n, int base) { print(n, base); println(); } - void MarlinSerial::println(unsigned long n, int base) { + template + void MarlinSerial::println(unsigned long n, int base) { print(n, base); println(); } - void MarlinSerial::println(double n, int digits) { + template + void MarlinSerial::println(double n, int digits) { print(n, digits); println(); } // Private Methods - void MarlinSerial::printNumber(unsigned long n, uint8_t base) { + template + void MarlinSerial::printNumber(unsigned long n, uint8_t base) { if (n) { unsigned char buf[8 * sizeof(long)]; // Enough space for base 2 int8_t i = 0; @@ -704,7 +672,8 @@ print('0'); } - void MarlinSerial::printFloat(double number, uint8_t digits) { + template + void MarlinSerial::printFloat(double number, uint8_t digits) { // Handle negative numbers if (number < 0.0) { print('-'); @@ -713,9 +682,7 @@ // Round correctly so that print(1.999, 2) prints as "2.00" double rounding = 0.5; - for (uint8_t i = 0; i < digits; ++i) - rounding *= 0.1; - + for (uint8_t i = 0; i < digits; ++i) rounding *= 0.1; number += rounding; // Extract the integer part of the number and print it @@ -736,8 +703,39 @@ } } + // Hookup ISR handlers + ISR(SERIAL_REGNAME(USART,SERIAL_PORT,_RX_vect)) { + MarlinSerial>::store_rxd_char(); + } + + ISR(SERIAL_REGNAME(USART,SERIAL_PORT,_UDRE_vect)) { + MarlinSerial>::_tx_udr_empty_irq(); + } + // Preinstantiate - MarlinSerial customizedSerial; + template class MarlinSerial>; + + // Instantiate + MarlinSerial> customizedSerial1; + + #ifdef SERIAL_PORT_2 + + // Hookup ISR handlers + ISR(SERIAL_REGNAME(USART,SERIAL_PORT_2,_RX_vect)) { + MarlinSerial>::store_rxd_char(); + } + + ISR(SERIAL_REGNAME(USART,SERIAL_PORT_2,_UDRE_vect)) { + MarlinSerial>::_tx_udr_empty_irq(); + } + + // Preinstantiate + template class MarlinSerial>; + + // Instantiate + MarlinSerial> customizedSerial2; + + #endif #endif // !USBCON && (UBRRH || UBRR0H || UBRR1H || UBRR2H || UBRR3H) diff --git a/Marlin/src/HAL/HAL_AVR/MarlinSerial.h b/Marlin/src/HAL/HAL_AVR/MarlinSerial.h index 8c2b3f3186..132097eb49 100644 --- a/Marlin/src/HAL/HAL_AVR/MarlinSerial.h +++ b/Marlin/src/HAL/HAL_AVR/MarlinSerial.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * MarlinSerial.h - Hardware serial library for Wiring @@ -27,12 +28,10 @@ * Modified 28 September 2010 by Mark Sproul * Modified 14 February 2016 by Andreas Hardtung (added tx buffer) * Modified 01 October 2017 by Eduardo José Tagle (added XON/XOFF) + * Templatized 01 October 2018 by Eduardo José Tagle to allow multiple instances */ -#ifndef _MARLINSERIAL_H_ -#define _MARLINSERIAL_H_ - -#include "../../inc/MarlinConfigPre.h" +#include "../shared/MarlinSerial.h" #include @@ -40,73 +39,173 @@ #define SERIAL_PORT 0 #endif -// The presence of the UBRRH register is used to detect a UART. -#define UART_PRESENT(port) ((port == 0 && (defined(UBRRH) || defined(UBRR0H))) || \ - (port == 1 && defined(UBRR1H)) || (port == 2 && defined(UBRR2H)) || \ - (port == 3 && defined(UBRR3H))) - -// These are macros to build serial port register names for the selected SERIAL_PORT (C preprocessor -// requires two levels of indirection to expand macro values properly) -#define SERIAL_REGNAME(registerbase,number,suffix) SERIAL_REGNAME_INTERNAL(registerbase,number,suffix) -#if SERIAL_PORT == 0 && (!defined(UBRR0H) || !defined(UDR0)) // use un-numbered registers if necessary - #define SERIAL_REGNAME_INTERNAL(registerbase,number,suffix) registerbase##suffix -#else - #define SERIAL_REGNAME_INTERNAL(registerbase,number,suffix) registerbase##number##suffix -#endif - -// Registers used by MarlinSerial class (expanded depending on selected serial port) -#define M_UCSRxA SERIAL_REGNAME(UCSR,SERIAL_PORT,A) // defines M_UCSRxA to be UCSRnA where n is the serial port number -#define M_UCSRxB SERIAL_REGNAME(UCSR,SERIAL_PORT,B) -#define M_RXENx SERIAL_REGNAME(RXEN,SERIAL_PORT,) -#define M_TXENx SERIAL_REGNAME(TXEN,SERIAL_PORT,) -#define M_TXCx SERIAL_REGNAME(TXC,SERIAL_PORT,) -#define M_RXCIEx SERIAL_REGNAME(RXCIE,SERIAL_PORT,) -#define M_UDREx SERIAL_REGNAME(UDRE,SERIAL_PORT,) -#define M_FEx SERIAL_REGNAME(FE,SERIAL_PORT,) -#define M_DORx SERIAL_REGNAME(DOR,SERIAL_PORT,) -#define M_UPEx SERIAL_REGNAME(UPE,SERIAL_PORT,) -#define M_UDRIEx SERIAL_REGNAME(UDRIE,SERIAL_PORT,) -#define M_UDRx SERIAL_REGNAME(UDR,SERIAL_PORT,) -#define M_UBRRxH SERIAL_REGNAME(UBRR,SERIAL_PORT,H) -#define M_UBRRxL SERIAL_REGNAME(UBRR,SERIAL_PORT,L) -#define M_RXCx SERIAL_REGNAME(RXC,SERIAL_PORT,) -#define M_USARTx_RX_vect SERIAL_REGNAME(USART,SERIAL_PORT,_RX_vect) -#define M_U2Xx SERIAL_REGNAME(U2X,SERIAL_PORT,) -#define M_USARTx_UDRE_vect SERIAL_REGNAME(USART,SERIAL_PORT,_UDRE_vect) - -#define DEC 10 -#define HEX 16 -#define OCT 8 -#define BIN 2 -#define BYTE 0 - #ifndef USBCON - // We're using a ring buffer (I think), in which rx_buffer_head is the index of the - // location to which to write the next incoming character and rx_buffer_tail is the - // index of the location from which to read. - #if RX_BUFFER_SIZE > 256 - typedef uint16_t ring_buffer_pos_t; + + // The presence of the UBRRH register is used to detect a UART. + #define UART_PRESENT(port) ((port == 0 && (defined(UBRRH) || defined(UBRR0H))) || \ + (port == 1 && defined(UBRR1H)) || (port == 2 && defined(UBRR2H)) || \ + (port == 3 && defined(UBRR3H))) + + // These are macros to build serial port register names for the selected SERIAL_PORT (C preprocessor + // requires two levels of indirection to expand macro values properly) + #define SERIAL_REGNAME(registerbase,number,suffix) SERIAL_REGNAME_INTERNAL(registerbase,number,suffix) + #if SERIAL_PORT == 0 && (!defined(UBRR0H) || !defined(UDR0)) // use un-numbered registers if necessary + #define SERIAL_REGNAME_INTERNAL(registerbase,number,suffix) registerbase##suffix #else - typedef uint8_t ring_buffer_pos_t; + #define SERIAL_REGNAME_INTERNAL(registerbase,number,suffix) registerbase##number##suffix #endif - #if ENABLED(SERIAL_STATS_DROPPED_RX) - extern uint8_t rx_dropped_bytes; + // Registers used by MarlinSerial class (expanded depending on selected serial port) + + // Templated 8bit register (generic) + #define UART_REGISTER_DECL_BASE(registerbase, suffix) \ + template struct R_##registerbase##x##suffix {} + + // Templated 8bit register (specialization for each port) + #define UART_REGISTER_DECL(port, registerbase, suffix) \ + template<> struct R_##registerbase##x##suffix { \ + constexpr R_##registerbase##x##suffix(int) {} \ + FORCE_INLINE void operator=(uint8_t newVal) const { SERIAL_REGNAME(registerbase,port,suffix) = newVal; } \ + FORCE_INLINE operator uint8_t() const { return SERIAL_REGNAME(registerbase,port,suffix); } \ + } + + // Templated 1bit register (generic) + #define UART_BIT_DECL_BASE(registerbase, suffix, bit) \ + templatestruct B_##bit##x {} + + // Templated 1bit register (specialization for each port) + #define UART_BIT_DECL(port, registerbase, suffix, bit) \ + template<> struct B_##bit##x { \ + constexpr B_##bit##x(int) {} \ + FORCE_INLINE void operator=(int newVal) const { \ + if (newVal) \ + SBI(SERIAL_REGNAME(registerbase,port,suffix),SERIAL_REGNAME(bit,port,)); \ + else \ + CBI(SERIAL_REGNAME(registerbase,port,suffix),SERIAL_REGNAME(bit,port,)); \ + } \ + FORCE_INLINE operator bool() const { return TEST(SERIAL_REGNAME(registerbase,port,suffix),SERIAL_REGNAME(bit,port,)); } \ + } + + #define UART_DECL_BASE() \ + UART_REGISTER_DECL_BASE(UCSR,A);\ + UART_REGISTER_DECL_BASE(UDR,);\ + UART_REGISTER_DECL_BASE(UBRR,H);\ + UART_REGISTER_DECL_BASE(UBRR,L);\ + UART_BIT_DECL_BASE(UCSR,B,RXEN);\ + UART_BIT_DECL_BASE(UCSR,B,TXEN);\ + UART_BIT_DECL_BASE(UCSR,A,TXC);\ + UART_BIT_DECL_BASE(UCSR,B,RXCIE);\ + UART_BIT_DECL_BASE(UCSR,A,UDRE);\ + UART_BIT_DECL_BASE(UCSR,A,FE);\ + UART_BIT_DECL_BASE(UCSR,A,DOR);\ + UART_BIT_DECL_BASE(UCSR,B,UDRIE);\ + UART_BIT_DECL_BASE(UCSR,A,RXC);\ + UART_BIT_DECL_BASE(UCSR,A,U2X) + + #define UART_DECL(port) \ + UART_REGISTER_DECL(port,UCSR,A);\ + UART_REGISTER_DECL(port,UDR,);\ + UART_REGISTER_DECL(port,UBRR,H);\ + UART_REGISTER_DECL(port,UBRR,L);\ + UART_BIT_DECL(port,UCSR,B,RXEN);\ + UART_BIT_DECL(port,UCSR,B,TXEN);\ + UART_BIT_DECL(port,UCSR,A,TXC);\ + UART_BIT_DECL(port,UCSR,B,RXCIE);\ + UART_BIT_DECL(port,UCSR,A,UDRE);\ + UART_BIT_DECL(port,UCSR,A,FE);\ + UART_BIT_DECL(port,UCSR,A,DOR);\ + UART_BIT_DECL(port,UCSR,B,UDRIE);\ + UART_BIT_DECL(port,UCSR,A,RXC);\ + UART_BIT_DECL(port,UCSR,A,U2X) + + // Declare empty templates + UART_DECL_BASE(); + + // And all the specializations for each possible serial port + #if UART_PRESENT(0) + UART_DECL(0); + #endif + #if UART_PRESENT(1) + UART_DECL(1); + #endif + #if UART_PRESENT(2) + UART_DECL(2); + #endif + #if UART_PRESENT(3) + UART_DECL(3); #endif - #if ENABLED(SERIAL_STATS_RX_BUFFER_OVERRUNS) - extern uint8_t rx_buffer_overruns; - #endif + #define DEC 10 + #define HEX 16 + #define OCT 8 + #define BIN 2 + #define BYTE 0 - #if ENABLED(SERIAL_STATS_RX_FRAMING_ERRORS) - extern uint8_t rx_framing_errors; - #endif - - #if ENABLED(SERIAL_STATS_MAX_RX_QUEUED) - extern ring_buffer_pos_t rx_max_enqueued; - #endif + // Templated type selector + template struct TypeSelector { typedef T type;} ; + template struct TypeSelector { typedef F type; }; + template class MarlinSerial { + protected: + // Registers + static constexpr R_UCSRxA R_UCSRA = 0; + static constexpr R_UDRx R_UDR = 0; + static constexpr R_UBRRxH R_UBRRH = 0; + static constexpr R_UBRRxL R_UBRRL = 0; + + // Bits + static constexpr B_RXENx B_RXEN = 0; + static constexpr B_TXENx B_TXEN = 0; + static constexpr B_TXCx B_TXC = 0; + static constexpr B_RXCIEx B_RXCIE = 0; + static constexpr B_UDREx B_UDRE = 0; + static constexpr B_FEx B_FE = 0; + static constexpr B_DORx B_DOR = 0; + static constexpr B_UDRIEx B_UDRIE = 0; + static constexpr B_RXCx B_RXC = 0; + static constexpr B_U2Xx B_U2X = 0; + + // Base size of type on buffer size + typedef typename TypeSelector<(Cfg::RX_SIZE>256), uint16_t, uint8_t>::type ring_buffer_pos_t; + + struct ring_buffer_r { + volatile ring_buffer_pos_t head, tail; + unsigned char buffer[Cfg::RX_SIZE]; + }; + + struct ring_buffer_t { + volatile uint8_t head, tail; + unsigned char buffer[Cfg::TX_SIZE]; + }; + + static ring_buffer_r rx_buffer; + static ring_buffer_t tx_buffer; + static bool _written; + + static constexpr uint8_t XON_XOFF_CHAR_SENT = 0x80, // XON / XOFF Character was sent + XON_XOFF_CHAR_MASK = 0x1F; // XON / XOFF character to send + + // XON / XOFF character definitions + static constexpr uint8_t XON_CHAR = 17, XOFF_CHAR = 19; + static uint8_t xon_xoff_state, + rx_dropped_bytes, + rx_buffer_overruns, + rx_framing_errors; + static ring_buffer_pos_t rx_max_enqueued; + + static FORCE_INLINE ring_buffer_pos_t atomic_read_rx_head(); + + static volatile bool rx_tail_value_not_stable; + static volatile uint16_t rx_tail_value_backup; + + static FORCE_INLINE void atomic_set_rx_tail(ring_buffer_pos_t value); + static FORCE_INLINE ring_buffer_pos_t atomic_read_rx_tail(); + + public: + + FORCE_INLINE static void store_rxd_char(); + FORCE_INLINE static void _tx_udr_empty_irq(void); public: MarlinSerial() {}; @@ -119,21 +218,10 @@ static void write(const uint8_t c); static void flushTX(void); - #if ENABLED(SERIAL_STATS_DROPPED_RX) - FORCE_INLINE static uint32_t dropped() { return rx_dropped_bytes; } - #endif - - #if ENABLED(SERIAL_STATS_RX_BUFFER_OVERRUNS) - FORCE_INLINE static uint32_t buffer_overruns() { return rx_buffer_overruns; } - #endif - - #if ENABLED(SERIAL_STATS_RX_FRAMING_ERRORS) - FORCE_INLINE static uint32_t framing_errors() { return rx_framing_errors; } - #endif - - #if ENABLED(SERIAL_STATS_MAX_RX_QUEUED) - FORCE_INLINE static ring_buffer_pos_t rxMaxEnqueued() { return rx_max_enqueued; } - #endif + FORCE_INLINE static uint8_t dropped() { return Cfg::DROPPED_RX ? rx_dropped_bytes : 0; } + FORCE_INLINE static uint8_t buffer_overruns() { return Cfg::RX_OVERRUNS ? rx_buffer_overruns : 0; } + FORCE_INLINE static uint8_t framing_errors() { return Cfg::RX_FRAMING_ERRORS ? rx_framing_errors : 0; } + FORCE_INLINE static ring_buffer_pos_t rxMaxEnqueued() { return Cfg::MAX_RX_QUEUED ? rx_max_enqueued : 0; } FORCE_INLINE static void write(const char* str) { while (*str) write(*str++); } FORCE_INLINE static void write(const uint8_t* buffer, size_t size) { while (size--) write(*buffer++); } @@ -165,7 +253,25 @@ static void printFloat(double, uint8_t); }; - extern MarlinSerial customizedSerial; + template + struct MarlinSerialCfg { + static constexpr int PORT = serial; + static constexpr unsigned int RX_SIZE = RX_BUFFER_SIZE; + static constexpr unsigned int TX_SIZE = TX_BUFFER_SIZE; + static constexpr bool XONOFF = bSERIAL_XON_XOFF; + static constexpr bool EMERGENCYPARSER = bEMERGENCY_PARSER; + static constexpr bool DROPPED_RX = bSERIAL_STATS_DROPPED_RX; + static constexpr bool RX_OVERRUNS = bSERIAL_STATS_RX_BUFFER_OVERRUNS; + static constexpr bool RX_FRAMING_ERRORS = bSERIAL_STATS_RX_FRAMING_ERRORS; + static constexpr bool MAX_RX_QUEUED = bSERIAL_STATS_MAX_RX_QUEUED; + }; + extern MarlinSerial> customizedSerial1; + + #ifdef SERIAL_PORT_2 + + extern MarlinSerial> customizedSerial2; + + #endif #endif // !USBCON @@ -173,5 +279,3 @@ #if defined(USBCON) && ENABLED(BLUETOOTH) extern HardwareSerial bluetoothSerial; #endif - -#endif // _MARLINSERIAL_H_ diff --git a/Marlin/src/HAL/HAL_AVR/SanityCheck.h b/Marlin/src/HAL/HAL_AVR/SanityCheck.h index a61472cc44..4485b8f39b 100644 --- a/Marlin/src/HAL/HAL_AVR/SanityCheck.h +++ b/Marlin/src/HAL/HAL_AVR/SanityCheck.h @@ -19,9 +19,7 @@ * along with this program. If not, see . * */ - -#ifndef _SANITYCHECK_AVR_8_BIT_H_ -#define _SANITYCHECK_AVR_8_BIT_H_ +#pragma once /** * Test AVR specific configuration values for errors at compile-time. @@ -81,11 +79,11 @@ #elif PIN_EXISTS(E5_AUTO_FAN) && SPINDLE_LASER_PWM_PIN == E5_AUTO_FAN_PIN #error "SPINDLE_LASER_PWM_PIN is used by E5_AUTO_FAN_PIN." #elif PIN_EXISTS(FAN) && SPINDLE_LASER_PWM_PIN == FAN_PIN - #error "SPINDLE_LASER_PWM_PIN is used FAN_PIN." + #error "SPINDLE_LASER_PWM_PIN is used by FAN_PIN." #elif PIN_EXISTS(FAN1) && SPINDLE_LASER_PWM_PIN == FAN1_PIN - #error "SPINDLE_LASER_PWM_PIN is used FAN1_PIN." + #error "SPINDLE_LASER_PWM_PIN is used by FAN1_PIN." #elif PIN_EXISTS(FAN2) && SPINDLE_LASER_PWM_PIN == FAN2_PIN - #error "SPINDLE_LASER_PWM_PIN is used FAN2_PIN." + #error "SPINDLE_LASER_PWM_PIN is used by FAN2_PIN." #elif PIN_EXISTS(CONTROLLERFAN) && SPINDLE_LASER_PWM_PIN == CONTROLLERFAN_PIN #error "SPINDLE_LASER_PWM_PIN is used by CONTROLLERFAN_PIN." #elif PIN_EXISTS(MOTOR_CURRENT_PWM_XY) && SPINDLE_LASER_PWM_PIN == MOTOR_CURRENT_PWM_XY_PIN @@ -116,5 +114,3 @@ || defined(E4_HARDWARE_SERIAL) ) #error "Select hardware UART for TMC2208 to use both TMC2208 and ENDSTOP_INTERRUPTS_FEATURE." #endif - -#endif // _SANITYCHECK_AVR_8_BIT_H_ diff --git a/Marlin/src/HAL/HAL_AVR/ServoTimers.h b/Marlin/src/HAL/HAL_AVR/ServoTimers.h index 4af997f1ef..c7c4587adc 100644 --- a/Marlin/src/HAL/HAL_AVR/ServoTimers.h +++ b/Marlin/src/HAL/HAL_AVR/ServoTimers.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * ServoTimers.h - Interrupt driven Servo library for Arduino using 16 bit timers- Version 2 @@ -39,9 +40,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef _SERVOTIMERS_H_ -#define _SERVOTIMERS_H_ - /** * Defines for 16 bit timers used with Servo library * @@ -91,5 +89,3 @@ typedef enum { #endif _Nbr_16timers } timer16_Sequence_t; - -#endif // _SERVOTIMERS_H_ diff --git a/Marlin/src/HAL/HAL_AVR/endstop_interrupts.h b/Marlin/src/HAL/HAL_AVR/endstop_interrupts.h index 13b3f16e3b..791c9812af 100644 --- a/Marlin/src/HAL/HAL_AVR/endstop_interrupts.h +++ b/Marlin/src/HAL/HAL_AVR/endstop_interrupts.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Endstop Interrupts @@ -35,9 +36,6 @@ * (Located in Marlin/buildroot/share/pin_interrupt_test/pin_interrupt_test.ino) */ -#ifndef _ENDSTOP_INTERRUPTS_H_ -#define _ENDSTOP_INTERRUPTS_H_ - #include "../../core/macros.h" #include #include "../../module/endstops.h" @@ -85,22 +83,21 @@ void pciSetup(const int8_t pin) { SBI(PCICR, digitalPinToPCICRbit(pin)); // enable interrupt for the group } - // Handlers for pin change interrupts #ifdef PCINT0_vect ISR(PCINT0_vect) { endstop_ISR(); } #endif #ifdef PCINT1_vect - ISR(PCINT1_vect) { endstop_ISR(); } + ISR(PCINT1_vect, ISR_ALIASOF(PCINT0_vect)); #endif #ifdef PCINT2_vect - ISR(PCINT2_vect) { endstop_ISR(); } + ISR(PCINT2_vect, ISR_ALIASOF(PCINT0_vect)); #endif #ifdef PCINT3_vect - ISR(PCINT3_vect) { endstop_ISR(); } + ISR(PCINT3_vect, ISR_ALIASOF(PCINT0_vect)); #endif void setup_endstop_interrupts( void ) { @@ -257,5 +254,3 @@ void setup_endstop_interrupts( void ) { // If we arrive here without raising an assertion, each pin has either an EXT-interrupt or a PCI. } - -#endif // _ENDSTOP_INTERRUPTS_H_ diff --git a/Marlin/src/HAL/HAL_AVR/fastio_1280.h b/Marlin/src/HAL/HAL_AVR/fastio_1280.h index 1c65f2bde7..601c515f7f 100644 --- a/Marlin/src/HAL/HAL_AVR/fastio_1280.h +++ b/Marlin/src/HAL/HAL_AVR/fastio_1280.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Pin mapping for the 1280 and 2560 @@ -28,9 +29,6 @@ * Logical Pin : 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx */ -#ifndef _FASTIO_1280_H_ -#define _FASTIO_1280_H_ - #include "fastio_AVR.h" // change for your board @@ -1111,5 +1109,3 @@ #define PL7_WPORT PORTL #define PL7_DDR DDRL #define PL7_PWM NULL - -#endif // _FASTIO_1280_H_ diff --git a/Marlin/src/HAL/HAL_AVR/fastio_1281.h b/Marlin/src/HAL/HAL_AVR/fastio_1281.h index 94ab6b7553..274bc6285b 100644 --- a/Marlin/src/HAL/HAL_AVR/fastio_1281.h +++ b/Marlin/src/HAL/HAL_AVR/fastio_1281.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Pin mapping for the 1281 and 2561 @@ -27,9 +28,6 @@ * Port: A0 A1 A2 A3 A4 A5 A6 A7 B0 B1 B2 B3 B4 B5 B6 B7 C0 C1 C2 C3 C4 C5 C6 C7 D0 D1 D2 D3 D4 D5 D6 D7 E0 E1 E2 E3 E4 E5 E6 E7 F0 F1 F2 F3 F4 F5 F6 F7 G0 G1 G2 G3 G4 G5 */ -#ifndef _FASTIO_1281_H_ -#define _FASTIO_1281_H_ - #include "fastio_AVR.h" // change for your board @@ -715,5 +713,3 @@ #define PG5_WPORT PORTG #define PG5_DDR DDRG #define PG5_PWM &OCR0B - -#endif // _FASTIO_1281_H_ diff --git a/Marlin/src/HAL/HAL_AVR/fastio_168.h b/Marlin/src/HAL/HAL_AVR/fastio_168.h index 33492d15dc..36187bc698 100644 --- a/Marlin/src/HAL/HAL_AVR/fastio_168.h +++ b/Marlin/src/HAL/HAL_AVR/fastio_168.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Pin mapping for the 168, 328, and 328P @@ -27,9 +28,6 @@ * Port: B0 B1 B2 B3 B4 B5 C0 C1 C2 C3 C4 C5 C6 C7 D0 D1 D2 D3 D4 D5 D6 D7 */ -#ifndef _FASTIO_168_H_ -#define _FASTIO_168_H_ - #include "fastio_AVR.h" #define DEBUG_LED AIO5 @@ -357,5 +355,3 @@ #define PD7_WPORT PORTD #define PD7_DDR DDRD #define PD7_PWM NULL - -#endif // _FASTIO_168_H_ diff --git a/Marlin/src/HAL/HAL_AVR/fastio_644.h b/Marlin/src/HAL/HAL_AVR/fastio_644.h index 171172023b..1ad7573801 100644 --- a/Marlin/src/HAL/HAL_AVR/fastio_644.h +++ b/Marlin/src/HAL/HAL_AVR/fastio_644.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Pin mapping for the 644, 644p, 644pa, and 1284p @@ -53,9 +54,6 @@ * +--------+ */ -#ifndef _FASTIO_644_H_ -#define _FASTIO_644_H_ - #include "fastio_AVR.h" #define DEBUG_LED DIO0 @@ -552,5 +550,3 @@ #define PD7_WPORT PORTD #define PD7_DDR DDRD #define PD7_PWM OCR2A - -#endif // _FASTIO_644_H_ diff --git a/Marlin/src/HAL/HAL_AVR/fastio_AT90USB.h b/Marlin/src/HAL/HAL_AVR/fastio_AT90USB.h index 6043292960..70cfcf39b7 100644 --- a/Marlin/src/HAL/HAL_AVR/fastio_AT90USB.h +++ b/Marlin/src/HAL/HAL_AVR/fastio_AT90USB.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Pin mapping (Teensy) for AT90USB646, 647, 1286, and 1287 @@ -28,9 +29,6 @@ * The logical pins 46 and 47 are not supported by Teensyduino, but are supported below as E2 and E3 */ -#ifndef _FASTIO_AT90USB_H_ -#define _FASTIO_AT90USB_H_ - #include "fastio_AVR.h" // change for your board @@ -697,5 +695,3 @@ #define TIMER3A 5 #define TIMER3B 4 #define TIMER3C 3 - -#endif // _FASTIO_AT90USB_H_ diff --git a/Marlin/src/HAL/HAL_AVR/fastio_AVR.h b/Marlin/src/HAL/HAL_AVR/fastio_AVR.h index a4e3c5d74d..448438c87e 100644 --- a/Marlin/src/HAL/HAL_AVR/fastio_AVR.h +++ b/Marlin/src/HAL/HAL_AVR/fastio_AVR.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Fast I/O Routines for AVR @@ -26,9 +27,6 @@ * Contributed by Triffid_Hunter and modified by Kliment, thinkyhead, Bob-the-Kuhn, et.al. */ -#ifndef _FASTIO_ARDUINO_H_ -#define _FASTIO_ARDUINO_H_ - #include #include "../../core/macros.h" @@ -312,5 +310,3 @@ enum ClockSource2 : char { // finally - the macro that tells us if a pin is an available hardware PWM #define USEABLE_HARDWARE_PWM(p) (PWM_PINS(p) && !PWM_CHK(p)) - -#endif // _FASTIO_ARDUINO_H_ diff --git a/Marlin/src/HAL/HAL_AVR/math_AVR.h b/Marlin/src/HAL/HAL_AVR/math_AVR.h index 6348ed8bbf..64c9c7998e 100644 --- a/Marlin/src/HAL/HAL_AVR/math_AVR.h +++ b/Marlin/src/HAL/HAL_AVR/math_AVR.h @@ -19,9 +19,7 @@ * along with this program. If not, see . * */ - -#ifndef _MATH_AVR_H_ -#define _MATH_AVR_H_ +#pragma once /** * Optimized math functions for AVR @@ -38,9 +36,9 @@ // D C B A is longIn2 // static FORCE_INLINE uint16_t MultiU24X32toH16(uint32_t longIn1, uint32_t longIn2) { - register uint8_t tmp1; - register uint8_t tmp2; - register uint16_t intRes; + uint8_t tmp1; + uint8_t tmp2; + uint16_t intRes; __asm__ __volatile__( A("clr %[tmp1]") A("mul %A[longIn1], %B[longIn2]") @@ -92,8 +90,8 @@ static FORCE_INLINE uint16_t MultiU24X32toH16(uint32_t longIn1, uint32_t longIn2 // r26 to store 0 // r27 to store the byte 1 of the 24 bit result static FORCE_INLINE uint16_t MultiU16X8toH16(uint8_t charIn1, uint16_t intIn2) { - register uint8_t tmp; - register uint16_t intRes; + uint8_t tmp; + uint16_t intRes; __asm__ __volatile__ ( A("clr %[tmp]") A("mul %[charIn1], %B[intIn2]") @@ -113,5 +111,3 @@ static FORCE_INLINE uint16_t MultiU16X8toH16(uint8_t charIn1, uint16_t intIn2) { ); return intRes; } - -#endif // _MATH_AVR_H_ diff --git a/Marlin/src/HAL/HAL_AVR/persistent_store_eeprom.cpp b/Marlin/src/HAL/HAL_AVR/persistent_store_eeprom.cpp index 1593b1829c..99b18001ad 100644 --- a/Marlin/src/HAL/HAL_AVR/persistent_store_eeprom.cpp +++ b/Marlin/src/HAL/HAL_AVR/persistent_store_eeprom.cpp @@ -23,7 +23,7 @@ #include "../../inc/MarlinConfig.h" -#if ENABLED(EEPROM_SETTINGS) +#if ENABLED(EEPROM_SETTINGS) || ENABLED(SD_FIRMWARE_UPDATE) #include "../shared/persistent_store_api.h" @@ -53,7 +53,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) { do { - uint8_t c = eeprom_read_byte((unsigned char*)pos); + uint8_t c = eeprom_read_byte((uint8_t*)pos); if (writing) *value = c; crc16(crc, &c, 1); pos++; @@ -64,5 +64,5 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t size_t PersistentStore::capacity() { return E2END + 1; } -#endif // EEPROM_SETTINGS +#endif // EEPROM_SETTINGS || SD_FIRMWARE_UPDATE #endif // __AVR__ diff --git a/Marlin/src/HAL/HAL_AVR/pinsDebug.h b/Marlin/src/HAL/HAL_AVR/pinsDebug.h index ea35f881e5..9c0bebbdd4 100644 --- a/Marlin/src/HAL/HAL_AVR/pinsDebug.h +++ b/Marlin/src/HAL/HAL_AVR/pinsDebug.h @@ -19,14 +19,12 @@ * along with this program. If not, see . * */ +#pragma once /** * PWM print routines for Atmel 8 bit AVR CPUs */ -#ifndef _PINSDEBUG_AVR_8_BIT_ -#define _PINSDEBUG_AVR_8_BIT_ - #include "../../inc/MarlinConfig.h" #define NUMBER_PINS_TOTAL NUM_DIGITAL_PINS @@ -406,5 +404,3 @@ static void pwm_details(uint8_t pin) { #endif #define PRINT_PIN(p) do {sprintf_P(buffer, PSTR("%3d "), p); SERIAL_ECHO(buffer);} while (0) - -#endif // _PINSDEBUG_AVR_8_BIT_ diff --git a/Marlin/src/HAL/HAL_AVR/pinsDebug_Teensyduino.h b/Marlin/src/HAL/HAL_AVR/pinsDebug_Teensyduino.h index 840e2a22e9..8da9570743 100644 --- a/Marlin/src/HAL/HAL_AVR/pinsDebug_Teensyduino.h +++ b/Marlin/src/HAL/HAL_AVR/pinsDebug_Teensyduino.h @@ -19,9 +19,7 @@ * along with this program. If not, see . * */ - -#ifndef _PINSDEBUG_TEENSYSUINO_H_ -#define _PINSDEBUG_TEENSYSUINO_H_ +#pragma once // // some of the pin mapping functions of the Teensduino extension to the Arduino IDE @@ -111,5 +109,3 @@ const uint8_t PROGMEM digital_pin_to_port_PGM[] = { // disable the PWMs so we can use it as is // portModeRegister(pin) is OK - -#endif // _PINSDEBUG_TEENSYSUINO_H_ diff --git a/Marlin/src/HAL/HAL_AVR/pinsDebug_plus_70.h b/Marlin/src/HAL/HAL_AVR/pinsDebug_plus_70.h index 5a0f840140..99f83a03a4 100644 --- a/Marlin/src/HAL/HAL_AVR/pinsDebug_plus_70.h +++ b/Marlin/src/HAL/HAL_AVR/pinsDebug_plus_70.h @@ -20,14 +20,12 @@ * along with this program. If not, see . * */ +#pragma once /** * Structures for 2560 family boards that use more than 70 pins */ -#ifndef _PINSDEBUG_PLUS_70_H_ -#define _PINSDEBUG_PLUS_70_H_ - #undef NUM_DIGITAL_PINS #if MB(BQ_ZUM_MEGA_3D) #define NUM_DIGITAL_PINS 85 @@ -336,6 +334,3 @@ const uint8_t PROGMEM digital_pin_to_timer_PGM_plus_70[] = { * PCINT14 J5 76 * PCINT15 J6 77 */ - - -#endif // _PINSDEBUG_PLUS_70_H_ diff --git a/Marlin/src/HAL/HAL_AVR/spi_pins.h b/Marlin/src/HAL/HAL_AVR/spi_pins.h index d4838956e7..d3d2412416 100644 --- a/Marlin/src/HAL/HAL_AVR/spi_pins.h +++ b/Marlin/src/HAL/HAL_AVR/spi_pins.h @@ -19,9 +19,7 @@ * along with this program. If not, see . * */ - -#ifndef _SPI_PINS_H_ -#define _SPI_PINS_H_ +#pragma once /** * Define SPI Pins: SCK, MISO, MOSI, SS @@ -65,6 +63,3 @@ #ifndef SS_PIN #define SS_PIN AVR_SS_PIN #endif - - -#endif // _SPI_PINS_H_ diff --git a/Marlin/src/HAL/HAL_AVR/watchdog_AVR.cpp b/Marlin/src/HAL/HAL_AVR/watchdog_AVR.cpp index 6af106439a..8845fa04ac 100644 --- a/Marlin/src/HAL/HAL_AVR/watchdog_AVR.cpp +++ b/Marlin/src/HAL/HAL_AVR/watchdog_AVR.cpp @@ -63,9 +63,8 @@ void watchdog_init() { ISR(WDT_vect) { sei(); // With the interrupt driven serial we need to allow interrupts. SERIAL_ERROR_START(); - SERIAL_ERRORLNPGM("Watchdog barked, please turn off the printer."); - kill(PSTR("ERR:Watchdog")); //kill blocks //up to 16 characters so it fits on a 16x2 display - while (1); //wait for user or serial reset + SERIAL_ERRORLNPGM(MSG_WATCHDOG_FIRED); + minkill(); // interrupt-safe final kill and infinite loop } #endif // WATCHDOG_RESET_MANUAL diff --git a/Marlin/src/HAL/HAL_AVR/watchdog_AVR.h b/Marlin/src/HAL/HAL_AVR/watchdog_AVR.h index 90c6185cb6..ac55c9aebd 100644 --- a/Marlin/src/HAL/HAL_AVR/watchdog_AVR.h +++ b/Marlin/src/HAL/HAL_AVR/watchdog_AVR.h @@ -19,9 +19,7 @@ * along with this program. If not, see . * */ - -#ifndef _WATCHDOG_AVR_H_ -#define _WATCHDOG_AVR_H_ +#pragma once #include @@ -31,5 +29,3 @@ void watchdog_init(); // Reset watchdog. MUST be called at least every 4 seconds after the // first watchdog_init or AVR will go into emergency procedures. inline void watchdog_reset() { wdt_reset(); } - -#endif // _WATCHDOG_AVR_H_ diff --git a/Marlin/src/HAL/HAL_DUE/DebugMonitor_Due.cpp b/Marlin/src/HAL/HAL_DUE/DebugMonitor_Due.cpp index f12f0df7fb..40407f7f5d 100644 --- a/Marlin/src/HAL/HAL_DUE/DebugMonitor_Due.cpp +++ b/Marlin/src/HAL/HAL_DUE/DebugMonitor_Due.cpp @@ -145,8 +145,8 @@ static const UnwindCallbacks UnwCallbacks = { UnwReadW, UnwReadH, UnwReadB - #if defined(UNW_DEBUG) - ,UnwPrintf + #ifdef UNW_DEBUG + , UnwPrintf #endif }; diff --git a/Marlin/src/HAL/HAL_DUE/HAL.cpp b/Marlin/src/HAL/HAL_DUE/HAL.cpp index 9d932d94db..cc2db0eb26 100644 --- a/Marlin/src/HAL/HAL_DUE/HAL.cpp +++ b/Marlin/src/HAL/HAL_DUE/HAL.cpp @@ -29,6 +29,7 @@ // Includes // -------------------------------------------------------------------------- +#include "../../inc/MarlinConfig.h" #include "HAL.h" #include diff --git a/Marlin/src/HAL/HAL_DUE/HAL.h b/Marlin/src/HAL/HAL_DUE/HAL.h index b5d1d4580f..57d3160ca4 100644 --- a/Marlin/src/HAL/HAL_DUE/HAL.h +++ b/Marlin/src/HAL/HAL_DUE/HAL.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Description: HAL for Arduino Due and compatible (SAM3X8E) @@ -26,9 +27,6 @@ * For ARDUINO_ARCH_SAM */ -#ifndef _HAL_DUE_H -#define _HAL_DUE_H - #define CPU_32_BIT #include @@ -41,9 +39,25 @@ #include "watchdog_Due.h" #include "HAL_timers_Due.h" -#define NUM_SERIAL 1 -// Required before the include or compilation fails -#define MYSERIAL0 customizedSerial +// Serial ports +#if !WITHIN(SERIAL_PORT, -1, 3) + #error "SERIAL_PORT must be from -1 to 3" +#endif + +// MYSERIAL0 required before MarlinSerial includes! +#define MYSERIAL0 customizedSerial1 + +#ifdef SERIAL_PORT_2 + #if !WITHIN(SERIAL_PORT_2, -1, 3) + #error "SERIAL_PORT_2 must be from -1 to 3" + #elif SERIAL_PORT_2 == SERIAL_PORT + #error "SERIAL_PORT_2 must be different than SERIAL_PORT" + #endif + #define NUM_SERIAL 2 + #define MYSERIAL1 customizedSerial2 +#else + #define NUM_SERIAL 1 +#endif #include "MarlinSerial_Due.h" #include "MarlinSerialUSB_Due.h" @@ -108,8 +122,8 @@ uint8_t spiRec(uint32_t chan); // // EEPROM // -void eeprom_write_byte(unsigned char *pos, unsigned char value); -unsigned char eeprom_read_byte(unsigned char *pos); +void eeprom_write_byte(uint8_t *pos, unsigned char value); +uint8_t eeprom_read_byte(uint8_t *pos); void eeprom_read_block (void *__dst, const void *__src, size_t __n); void eeprom_update_block (const void *__src, void *__dst, size_t __n); @@ -173,5 +187,3 @@ char *dtostrf (double __val, signed char __width, unsigned char __prec, char *__ #ifdef __cplusplus } #endif - -#endif // _HAL_DUE_H diff --git a/Marlin/src/HAL/HAL_DUE/HAL_spi_Due.cpp b/Marlin/src/HAL/HAL_DUE/HAL_spi_Due.cpp index a45306e316..b127f1a990 100644 --- a/Marlin/src/HAL/HAL_DUE/HAL_spi_Due.cpp +++ b/Marlin/src/HAL/HAL_DUE/HAL_spi_Due.cpp @@ -78,11 +78,11 @@ // run at ~8 .. ~10Mhz - Tx version (Rx data discarded) static uint8_t spiTransferTx0(uint8_t bout) { // using Mode 0 - register uint32_t MOSI_PORT_PLUS30 = ((uint32_t) PORT(MOSI_PIN)) + 0x30; /* SODR of port */ - register uint32_t MOSI_MASK = PIN_MASK(MOSI_PIN); - register uint32_t SCK_PORT_PLUS30 = ((uint32_t) PORT(SCK_PIN)) + 0x30; /* SODR of port */ - register uint32_t SCK_MASK = PIN_MASK(SCK_PIN); - register uint32_t idx = 0; + uint32_t MOSI_PORT_PLUS30 = ((uint32_t) PORT(MOSI_PIN)) + 0x30; /* SODR of port */ + uint32_t MOSI_MASK = PIN_MASK(MOSI_PIN); + uint32_t SCK_PORT_PLUS30 = ((uint32_t) PORT(SCK_PIN)) + 0x30; /* SODR of port */ + uint32_t SCK_MASK = PIN_MASK(SCK_PIN); + uint32_t idx = 0; /* Negate bout, as the assembler requires a negated value */ bout = ~bout; @@ -161,11 +161,11 @@ // run at ~8 .. ~10Mhz - Rx version (Tx line not altered) static uint8_t spiTransferRx0(uint8_t bout) { // using Mode 0 - register uint32_t bin = 0; - register uint32_t work = 0; - register uint32_t BITBAND_MISO_PORT = BITBAND_ADDRESS( ((uint32_t)PORT(MISO_PIN))+0x3C, PIN_SHIFT(MISO_PIN)); /* PDSR of port in bitband area */ - register uint32_t SCK_PORT_PLUS30 = ((uint32_t) PORT(SCK_PIN)) + 0x30; /* SODR of port */ - register uint32_t SCK_MASK = PIN_MASK(SCK_PIN); + uint32_t bin = 0; + uint32_t work = 0; + uint32_t BITBAND_MISO_PORT = BITBAND_ADDRESS( ((uint32_t)PORT(MISO_PIN))+0x3C, PIN_SHIFT(MISO_PIN)); /* PDSR of port in bitband area */ + uint32_t SCK_PORT_PLUS30 = ((uint32_t) PORT(SCK_PIN)) + 0x30; /* SODR of port */ + uint32_t SCK_MASK = PIN_MASK(SCK_PIN); UNUSED(bout); /* The software SPI routine */ @@ -281,12 +281,12 @@ // Block transfers run at ~8 .. ~10Mhz - Tx version (Rx data discarded) static void spiTxBlock0(const uint8_t* ptr, uint32_t todo) { - register uint32_t MOSI_PORT_PLUS30 = ((uint32_t) PORT(MOSI_PIN)) + 0x30; /* SODR of port */ - register uint32_t MOSI_MASK = PIN_MASK(MOSI_PIN); - register uint32_t SCK_PORT_PLUS30 = ((uint32_t) PORT(SCK_PIN)) + 0x30; /* SODR of port */ - register uint32_t SCK_MASK = PIN_MASK(SCK_PIN); - register uint32_t work = 0; - register uint32_t txval = 0; + uint32_t MOSI_PORT_PLUS30 = ((uint32_t) PORT(MOSI_PIN)) + 0x30; /* SODR of port */ + uint32_t MOSI_MASK = PIN_MASK(MOSI_PIN); + uint32_t SCK_PORT_PLUS30 = ((uint32_t) PORT(SCK_PIN)) + 0x30; /* SODR of port */ + uint32_t SCK_MASK = PIN_MASK(SCK_PIN); + uint32_t work = 0; + uint32_t txval = 0; /* The software SPI routine */ __asm__ __volatile__( @@ -360,11 +360,11 @@ } static void spiRxBlock0(uint8_t* ptr, uint32_t todo) { - register uint32_t bin = 0; - register uint32_t work = 0; - register uint32_t BITBAND_MISO_PORT = BITBAND_ADDRESS( ((uint32_t)PORT(MISO_PIN))+0x3C, PIN_SHIFT(MISO_PIN)); /* PDSR of port in bitband area */ - register uint32_t SCK_PORT_PLUS30 = ((uint32_t) PORT(SCK_PIN)) + 0x30; /* SODR of port */ - register uint32_t SCK_MASK = PIN_MASK(SCK_PIN); + uint32_t bin = 0; + uint32_t work = 0; + uint32_t BITBAND_MISO_PORT = BITBAND_ADDRESS( ((uint32_t)PORT(MISO_PIN))+0x3C, PIN_SHIFT(MISO_PIN)); /* PDSR of port in bitband area */ + uint32_t SCK_PORT_PLUS30 = ((uint32_t) PORT(SCK_PIN)) + 0x30; /* SODR of port */ + uint32_t SCK_MASK = PIN_MASK(SCK_PIN); /* The software SPI routine */ __asm__ __volatile__( @@ -581,84 +581,124 @@ // -------------------------------------------------------------------------- // hardware SPI // -------------------------------------------------------------------------- - // 8.4 MHz, 4 MHz, 2 MHz, 1 MHz, 0.5 MHz, 0.329 MHz, 0.329 MHz - int spiDueDividors[] = { 10, 21, 42, 84, 168, 255, 255 }; - bool spiInitMaded = false; - - void spiBegin() { - if (spiInitMaded == false) { - // Configure SPI pins - PIO_Configure( - g_APinDescription[SCK_PIN].pPort, - g_APinDescription[SCK_PIN].ulPinType, - g_APinDescription[SCK_PIN].ulPin, - g_APinDescription[SCK_PIN].ulPinConfiguration); - PIO_Configure( - g_APinDescription[MOSI_PIN].pPort, - g_APinDescription[MOSI_PIN].ulPinType, - g_APinDescription[MOSI_PIN].ulPin, - g_APinDescription[MOSI_PIN].ulPinConfiguration); - PIO_Configure( - g_APinDescription[MISO_PIN].pPort, - g_APinDescription[MISO_PIN].ulPinType, - g_APinDescription[MISO_PIN].ulPin, - g_APinDescription[MISO_PIN].ulPinConfiguration); - - // set master mode, peripheral select, fault detection - SPI_Configure(SPI0, ID_SPI0, SPI_MR_MSTR | SPI_MR_MODFDIS | SPI_MR_PS); - SPI_Enable(SPI0); - - #if MB(ALLIGATOR) - SET_OUTPUT(DAC0_SYNC); - #if EXTRUDERS > 1 - SET_OUTPUT(DAC1_SYNC); - WRITE(DAC1_SYNC, HIGH); - #endif - SET_OUTPUT(SPI_EEPROM1_CS); - SET_OUTPUT(SPI_EEPROM2_CS); - SET_OUTPUT(SPI_FLASH_CS); - WRITE(DAC0_SYNC, HIGH); - WRITE(SPI_EEPROM1_CS, HIGH ); - WRITE(SPI_EEPROM2_CS, HIGH ); - WRITE(SPI_FLASH_CS, HIGH ); - WRITE(SS_PIN, HIGH ); - #endif // MB(ALLIGATOR) - - OUT_WRITE(SDSS,0); - - PIO_Configure( - g_APinDescription[SPI_PIN].pPort, - g_APinDescription[SPI_PIN].ulPinType, - g_APinDescription[SPI_PIN].ulPin, - g_APinDescription[SPI_PIN].ulPinConfiguration); - - spiInit(1); - spiInitMaded = true; - } - } + static bool spiInitialized = false; void spiInit(uint8_t spiRate) { - if (spiInitMaded == false) { - if (spiRate > 6) spiRate = 1; + if (spiInitialized) return; - #if MB(ALLIGATOR) - // Set SPI mode 1, clock, select not active after transfer, with delay between transfers - SPI_ConfigureNPCS(SPI0, SPI_CHAN_DAC, - SPI_CSR_CSAAT | SPI_CSR_SCBR(spiDueDividors[spiRate]) | - SPI_CSR_DLYBCT(1)); - // Set SPI mode 0, clock, select not active after transfer, with delay between transfers - SPI_ConfigureNPCS(SPI0, SPI_CHAN_EEPROM1, SPI_CSR_NCPHA | - SPI_CSR_CSAAT | SPI_CSR_SCBR(spiDueDividors[spiRate]) | - SPI_CSR_DLYBCT(1)); - #endif//MB(ALLIGATOR) + // 8.4 MHz, 4 MHz, 2 MHz, 1 MHz, 0.5 MHz, 0.329 MHz, 0.329 MHz + constexpr int spiDivider[] = { 10, 21, 42, 84, 168, 255, 255 }; + if (spiRate > 6) spiRate = 1; - // Set SPI mode 0, clock, select not active after transfer, with delay between transfers - SPI_ConfigureNPCS(SPI0, SPI_CHAN, SPI_CSR_NCPHA | - SPI_CSR_CSAAT | SPI_CSR_SCBR(spiDueDividors[spiRate]) | - SPI_CSR_DLYBCT(1)); - SPI_Enable(SPI0); - spiInitMaded = true; + // Set SPI mode 1, clock, select not active after transfer, with delay between transfers + SPI_ConfigureNPCS(SPI0, SPI_CHAN_DAC, + SPI_CSR_CSAAT | SPI_CSR_SCBR(spiDivider[spiRate]) | + SPI_CSR_DLYBCT(1)); + // Set SPI mode 0, clock, select not active after transfer, with delay between transfers + SPI_ConfigureNPCS(SPI0, SPI_CHAN_EEPROM1, SPI_CSR_NCPHA | + SPI_CSR_CSAAT | SPI_CSR_SCBR(spiDivider[spiRate]) | + SPI_CSR_DLYBCT(1)); + + // Set SPI mode 0, clock, select not active after transfer, with delay between transfers + SPI_ConfigureNPCS(SPI0, SPI_CHAN, SPI_CSR_NCPHA | + SPI_CSR_CSAAT | SPI_CSR_SCBR(spiDivider[spiRate]) | + SPI_CSR_DLYBCT(1)); + SPI_Enable(SPI0); + spiInitialized = true; + } + + void spiBegin() { + if (spiInitialized) return; + + // Configure SPI pins + PIO_Configure( + g_APinDescription[SCK_PIN].pPort, + g_APinDescription[SCK_PIN].ulPinType, + g_APinDescription[SCK_PIN].ulPin, + g_APinDescription[SCK_PIN].ulPinConfiguration); + PIO_Configure( + g_APinDescription[MOSI_PIN].pPort, + g_APinDescription[MOSI_PIN].ulPinType, + g_APinDescription[MOSI_PIN].ulPin, + g_APinDescription[MOSI_PIN].ulPinConfiguration); + PIO_Configure( + g_APinDescription[MISO_PIN].pPort, + g_APinDescription[MISO_PIN].ulPinType, + g_APinDescription[MISO_PIN].ulPin, + g_APinDescription[MISO_PIN].ulPinConfiguration); + + // set master mode, peripheral select, fault detection + SPI_Configure(SPI0, ID_SPI0, SPI_MR_MSTR | SPI_MR_MODFDIS | SPI_MR_PS); + SPI_Enable(SPI0); + + SET_OUTPUT(DAC0_SYNC); + #if EXTRUDERS > 1 + SET_OUTPUT(DAC1_SYNC); + WRITE(DAC1_SYNC, HIGH); + #endif + SET_OUTPUT(SPI_EEPROM1_CS); + SET_OUTPUT(SPI_EEPROM2_CS); + SET_OUTPUT(SPI_FLASH_CS); + WRITE(DAC0_SYNC, HIGH); + WRITE(SPI_EEPROM1_CS, HIGH ); + WRITE(SPI_EEPROM2_CS, HIGH ); + WRITE(SPI_FLASH_CS, HIGH ); + WRITE(SS_PIN, HIGH ); + + OUT_WRITE(SDSS,0); + + PIO_Configure( + g_APinDescription[SPI_PIN].pPort, + g_APinDescription[SPI_PIN].ulPinType, + g_APinDescription[SPI_PIN].ulPin, + g_APinDescription[SPI_PIN].ulPinConfiguration); + + spiInit(1); + } + + // Read single byte from SPI + uint8_t spiRec() { + // write dummy byte with address and end transmission flag + SPI0->SPI_TDR = 0x000000FF | SPI_PCS(SPI_CHAN) | SPI_TDR_LASTXFER; + // wait for transmit register empty + while ((SPI0->SPI_SR & SPI_SR_TDRE) == 0); + + // wait for receive register + while ((SPI0->SPI_SR & SPI_SR_RDRF) == 0); + // get byte from receive register + //DELAY_US(1U); + return SPI0->SPI_RDR; + } + + uint8_t spiRec(uint32_t chan) { + uint8_t spirec_tmp; + // wait for transmit register empty + while ((SPI0->SPI_SR & SPI_SR_TDRE) == 0); + while ((SPI0->SPI_SR & SPI_SR_RDRF) == 1) + spirec_tmp = SPI0->SPI_RDR; + UNUSED(spirec_tmp); + + // write dummy byte with address and end transmission flag + SPI0->SPI_TDR = 0x000000FF | SPI_PCS(chan) | SPI_TDR_LASTXFER; + + // wait for receive register + while ((SPI0->SPI_SR & SPI_SR_RDRF) == 0); + // get byte from receive register + return SPI0->SPI_RDR; + } + + // Read from SPI into buffer + void spiRead(uint8_t* buf, uint16_t nbyte) { + if (nbyte-- == 0) return; + + for (int i = 0; i < nbyte; i++) { + //while ((SPI0->SPI_SR & SPI_SR_TDRE) == 0); + SPI0->SPI_TDR = 0x000000FF | SPI_PCS(SPI_CHAN); + while ((SPI0->SPI_SR & SPI_SR_RDRF) == 0); + buf[i] = SPI0->SPI_RDR; + //DELAY_US(1U); } + buf[nbyte] = spiRec(); } // Write single byte to SPI @@ -714,51 +754,6 @@ spiSend(chan, buf[n - 1]); } - // Read single byte from SPI - uint8_t spiRec() { - // write dummy byte with address and end transmission flag - SPI0->SPI_TDR = 0x000000FF | SPI_PCS(SPI_CHAN) | SPI_TDR_LASTXFER; - // wait for transmit register empty - while ((SPI0->SPI_SR & SPI_SR_TDRE) == 0); - - // wait for receive register - while ((SPI0->SPI_SR & SPI_SR_RDRF) == 0); - // get byte from receive register - //DELAY_US(1U); - return SPI0->SPI_RDR; - } - - uint8_t spiRec(uint32_t chan) { - uint8_t spirec_tmp; - // wait for transmit register empty - while ((SPI0->SPI_SR & SPI_SR_TDRE) == 0); - while ((SPI0->SPI_SR & SPI_SR_RDRF) == 1) - spirec_tmp = SPI0->SPI_RDR; - UNUSED(spirec_tmp); - - // write dummy byte with address and end transmission flag - SPI0->SPI_TDR = 0x000000FF | SPI_PCS(chan) | SPI_TDR_LASTXFER; - - // wait for receive register - while ((SPI0->SPI_SR & SPI_SR_RDRF) == 0); - // get byte from receive register - return SPI0->SPI_RDR; - } - - // Read from SPI into buffer - void spiRead(uint8_t* buf, uint16_t nbyte) { - if (nbyte-- == 0) return; - - for (int i = 0; i < nbyte; i++) { - //while ((SPI0->SPI_SR & SPI_SR_TDRE) == 0); - SPI0->SPI_TDR = 0x000000FF | SPI_PCS(SPI_CHAN); - while ((SPI0->SPI_SR & SPI_SR_RDRF) == 0); - buf[i] = SPI0->SPI_RDR; - //DELAY_US(1U); - } - buf[nbyte] = spiRec(); - } - // Write from buffer to SPI void spiSendBlock(uint8_t token, const uint8_t* buf) { SPI0->SPI_TDR = (uint32_t)token | SPI_PCS(SPI_CHAN); @@ -780,7 +775,7 @@ // TODO: to be implemented } - #else // U8G compatible hardware SPI + #else // U8G compatible hardware SPI #define SPI_MODE_0_DUE_HW 2 // DUE CPHA control bit is inverted #define SPI_MODE_1_DUE_HW 3 @@ -789,7 +784,7 @@ void spiInit(uint8_t spiRate=6) { // Default to slowest rate if not specified) // 8.4 MHz, 4 MHz, 2 MHz, 1 MHz, 0.5 MHz, 0.329 MHz, 0.329 MHz - int spiDueDividors[] = { 10, 21, 42, 84, 168, 255, 255 }; + constexpr int spiDivider[] = { 10, 21, 42, 84, 168, 255, 255 }; if (spiRate > 6) spiRate = 1; // Enable PIOA and SPI0 @@ -809,7 +804,11 @@ // Master mode, no fault detection, PCS bits in data written to TDR select CSR register SPI0->SPI_MR = SPI_MR_MSTR | SPI_MR_PS | SPI_MR_MODFDIS; // SPI mode 0, 8 Bit data transfer, baud rate - SPI0->SPI_CSR[3] = SPI_CSR_SCBR(spiDueDividors[spiRate]) | SPI_CSR_CSAAT | SPI_MODE_0_DUE_HW; // use same CSR as TMC2130 + SPI0->SPI_CSR[3] = SPI_CSR_SCBR(spiDivider[spiRate]) | SPI_CSR_CSAAT | SPI_MODE_0_DUE_HW; // use same CSR as TMC2130 + } + + void spiBegin() { + spiInit(); } static uint8_t spiTransfer(uint8_t data) { @@ -828,10 +827,6 @@ return SPI0->SPI_RDR; } - void spiBegin() { - spiInit(); - } - uint8_t spiRec() { uint8_t data = spiTransfer(0xFF); return data; diff --git a/Marlin/src/HAL/HAL_DUE/HAL_timers_Due.cpp b/Marlin/src/HAL/HAL_DUE/HAL_timers_Due.cpp index eb23692b44..f5f74c0ce2 100644 --- a/Marlin/src/HAL/HAL_DUE/HAL_timers_Due.cpp +++ b/Marlin/src/HAL/HAL_DUE/HAL_timers_Due.cpp @@ -31,7 +31,7 @@ // -------------------------------------------------------------------------- // Includes // -------------------------------------------------------------------------- - +#include "../../inc/MarlinConfig.h" #include "HAL.h" #include "HAL_timers_Due.h" diff --git a/Marlin/src/HAL/HAL_DUE/HAL_timers_Due.h b/Marlin/src/HAL/HAL_DUE/HAL_timers_Due.h index dd342f5471..46b7aaf5a4 100644 --- a/Marlin/src/HAL/HAL_DUE/HAL_timers_Due.h +++ b/Marlin/src/HAL/HAL_DUE/HAL_timers_Due.h @@ -18,6 +18,7 @@ * along with this program. If not, see . * */ +#pragma once /** * HAL for Arduino Due and compatible (SAM3X8E) @@ -25,9 +26,6 @@ * For ARDUINO_ARCH_SAM */ -#ifndef _HAL_TIMERS_DUE_H -#define _HAL_TIMERS_DUE_H - // -------------------------------------------------------------------------- // Includes // -------------------------------------------------------------------------- @@ -120,5 +118,3 @@ FORCE_INLINE static void HAL_timer_isr_prologue(const uint8_t timer_num) { } #define HAL_timer_isr_epilogue(TIMER_NUM) - -#endif // _HAL_TIMERS_DUE_H diff --git a/Marlin/src/HAL/HAL_DUE/InterruptVectors_Due.cpp b/Marlin/src/HAL/HAL_DUE/InterruptVectors_Due.cpp index 9b226a60da..97aefc98d1 100644 --- a/Marlin/src/HAL/HAL_DUE/InterruptVectors_Due.cpp +++ b/Marlin/src/HAL/HAL_DUE/InterruptVectors_Due.cpp @@ -32,6 +32,7 @@ */ #ifdef ARDUINO_ARCH_SAM +#include "../../inc/MarlinConfig.h" #include "HAL.h" #include "InterruptVectors_Due.h" diff --git a/Marlin/src/HAL/HAL_DUE/InterruptVectors_Due.h b/Marlin/src/HAL/HAL_DUE/InterruptVectors_Due.h index efc63de25d..a9be8e0b31 100644 --- a/Marlin/src/HAL/HAL_DUE/InterruptVectors_Due.h +++ b/Marlin/src/HAL/HAL_DUE/InterruptVectors_Due.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * InterruptVectors_Due.h @@ -35,11 +36,6 @@ * Copyright (c) 2017 Eduardo José Tagle. All right reserved */ -#ifndef INTERRUPTVECTORS_DUE_H -#define INTERRUPTVECTORS_DUE_H - -#include "../../inc/MarlinConfig.h" - #ifdef ARDUINO_ARCH_SAM // ISR handler type @@ -49,4 +45,3 @@ typedef void (*pfnISR_Handler)(void); pfnISR_Handler install_isr(IRQn_Type irq, pfnISR_Handler newHandler); #endif // ARDUINO_ARCH_SAM -#endif // INTERRUPTVECTORS_DUE_H diff --git a/Marlin/src/HAL/HAL_DUE/MarlinSerialUSB_Due.cpp b/Marlin/src/HAL/HAL_DUE/MarlinSerialUSB_Due.cpp index eed4c73999..b176f9d0d9 100644 --- a/Marlin/src/HAL/HAL_DUE/MarlinSerialUSB_Due.cpp +++ b/Marlin/src/HAL/HAL_DUE/MarlinSerialUSB_Due.cpp @@ -143,8 +143,8 @@ void MarlinSerialUSB::write(const uint8_t c) { } /** -* Imports from print.h -*/ + * Imports from print.h + */ void MarlinSerialUSB::print(char c, int base) { print((long)c, base); @@ -285,7 +285,7 @@ void MarlinSerialUSB::printFloat(double number, uint8_t digits) { } // Preinstantiate -MarlinSerialUSB customizedSerial; +MarlinSerialUSB customizedSerial1; #endif // SERIAL_PORT == -1 diff --git a/Marlin/src/HAL/HAL_DUE/MarlinSerialUSB_Due.h b/Marlin/src/HAL/HAL_DUE/MarlinSerialUSB_Due.h index bfa2ccedc0..fbba508506 100644 --- a/Marlin/src/HAL/HAL_DUE/MarlinSerialUSB_Due.h +++ b/Marlin/src/HAL/HAL_DUE/MarlinSerialUSB_Due.h @@ -19,15 +19,13 @@ * along with this program. If not, see . * */ +#pragma once /** * MarlinSerialUSB_Due.h - Hardware Serial over USB (CDC) library for Arduino DUE * Copyright (c) 2017 Eduardo José Tagle. All right reserved */ -#ifndef MARLINSERIALUSB_DUE_H -#define MARLINSERIALUSB_DUE_H - #include "../../inc/MarlinConfig.h" #if SERIAL_PORT == -1 @@ -52,11 +50,11 @@ public: static void write(const uint8_t c); #if ENABLED(SERIAL_STATS_DROPPED_RX) - FORCE_INLINE static uint32_t dropped() { return 0; } + FORCE_INLINE static uint32_t dropped() { return 0; } #endif #if ENABLED(SERIAL_STATS_MAX_RX_QUEUED) - FORCE_INLINE static int rxMaxEnqueued() { return 0; } + FORCE_INLINE static int rxMaxEnqueued() { return 0; } #endif FORCE_INLINE static void write(const char* str) { while (*str) write(*str++); } @@ -89,7 +87,6 @@ private: static void printFloat(double, uint8_t); }; -extern MarlinSerialUSB customizedSerial; +extern MarlinSerialUSB customizedSerial1; #endif // SERIAL_PORT == -1 -#endif // MARLINSERIAL_DUE_H diff --git a/Marlin/src/HAL/HAL_DUE/MarlinSerial_Due.cpp b/Marlin/src/HAL/HAL_DUE/MarlinSerial_Due.cpp index 0ff98e62ff..ef72c38270 100644 --- a/Marlin/src/HAL/HAL_DUE/MarlinSerial_Due.cpp +++ b/Marlin/src/HAL/HAL_DUE/MarlinSerial_Due.cpp @@ -33,671 +33,619 @@ #include "InterruptVectors_Due.h" #include "../../Marlin.h" -// If not using the USB port as serial port -#if SERIAL_PORT >= 0 +template typename MarlinSerial::ring_buffer_r MarlinSerial::rx_buffer = { 0, 0, { 0 } }; +template typename MarlinSerial::ring_buffer_t MarlinSerial::tx_buffer = { 0 }; +template bool MarlinSerial::_written = false; +template uint8_t MarlinSerial::xon_xoff_state = MarlinSerial::XON_XOFF_CHAR_SENT | MarlinSerial::XON_CHAR; +template uint8_t MarlinSerial::rx_dropped_bytes = 0; +template uint8_t MarlinSerial::rx_buffer_overruns = 0; +template uint8_t MarlinSerial::rx_framing_errors = 0; +template typename MarlinSerial::ring_buffer_pos_t MarlinSerial::rx_max_enqueued = 0; - // Based on selected port, use the proper configuration - #if SERIAL_PORT == 0 - #define HWUART UART - #define HWUART_IRQ UART_IRQn - #define HWUART_IRQ_ID ID_UART - #elif SERIAL_PORT == 1 - #define HWUART ((Uart*)USART0) - #define HWUART_IRQ USART0_IRQn - #define HWUART_IRQ_ID ID_USART0 - #elif SERIAL_PORT == 2 - #define HWUART ((Uart*)USART1) - #define HWUART_IRQ USART1_IRQn - #define HWUART_IRQ_ID ID_USART1 - #elif SERIAL_PORT == 3 - #define HWUART ((Uart*)USART2) - #define HWUART_IRQ USART2_IRQn - #define HWUART_IRQ_ID ID_USART2 - #elif SERIAL_PORT == 4 - #define HWUART ((Uart*)USART3) - #define HWUART_IRQ USART3_IRQn - #define HWUART_IRQ_ID ID_USART3 - #endif +// A SW memory barrier, to ensure GCC does not overoptimize loops +#define sw_barrier() asm volatile("": : :"memory"); - struct ring_buffer_r { - unsigned char buffer[RX_BUFFER_SIZE]; - volatile ring_buffer_pos_t head, tail; - }; +#include "../../feature/emergency_parser.h" - #if TX_BUFFER_SIZE > 0 - struct ring_buffer_t { - unsigned char buffer[TX_BUFFER_SIZE]; - volatile uint8_t head, tail; - }; - #endif +// (called with RX interrupts disabled) +template +FORCE_INLINE void MarlinSerial::store_rxd_char() { - ring_buffer_r rx_buffer = { { 0 }, 0, 0 }; - #if TX_BUFFER_SIZE > 0 - ring_buffer_t tx_buffer = { { 0 }, 0, 0 }; - #endif - static bool _written; + static EmergencyParser::State emergency_state; // = EP_RESET - #if ENABLED(SERIAL_XON_XOFF) - constexpr uint8_t XON_XOFF_CHAR_SENT = 0x80, // XON / XOFF Character was sent - XON_XOFF_CHAR_MASK = 0x1F; // XON / XOFF character to send - // XON / XOFF character definitions - constexpr uint8_t XON_CHAR = 17, XOFF_CHAR = 19; - uint8_t xon_xoff_state = XON_XOFF_CHAR_SENT | XON_CHAR; + // Get the tail - Nothing can alter its value while we are at this ISR + const ring_buffer_pos_t t = rx_buffer.tail; - // Validate that RX buffer size is at least 4096 bytes- According to several experiments, on - // the original Arduino Due that uses a ATmega16U2 as USB to serial bridge, due to the introduced - // latencies, at least 2959 bytes of RX buffering (when transmitting at 250kbits/s) are required - // to avoid overflows. + // Get the head pointer + ring_buffer_pos_t h = rx_buffer.head; - #if RX_BUFFER_SIZE < 4096 - #error Arduino DUE requires at least 4096 bytes of RX buffer to avoid buffer overflows when using XON/XOFF handshake - #endif - #endif + // Get the next element + ring_buffer_pos_t i = (ring_buffer_pos_t)(h + 1) & (ring_buffer_pos_t)(Cfg::RX_SIZE - 1); - #if ENABLED(SERIAL_STATS_DROPPED_RX) - uint8_t rx_dropped_bytes = 0; - #endif + // Read the character from the USART + uint8_t c = HWUART->UART_RHR; - #if ENABLED(SERIAL_STATS_RX_BUFFER_OVERRUNS) - uint8_t rx_buffer_overruns = 0; - #endif + if (Cfg::EMERGENCYPARSER) emergency_parser.update(emergency_state, c); - #if ENABLED(SERIAL_STATS_RX_FRAMING_ERRORS) - uint8_t rx_framing_errors = 0; - #endif + // If the character is to be stored at the index just before the tail + // (such that the head would advance to the current tail), the RX FIFO is + // full, so don't write the character or advance the head. + if (i != t) { + rx_buffer.buffer[h] = c; + h = i; + } + else if (Cfg::DROPPED_RX && !++rx_dropped_bytes) + --rx_dropped_bytes; - #if ENABLED(SERIAL_STATS_MAX_RX_QUEUED) - ring_buffer_pos_t rx_max_enqueued = 0; - #endif + const ring_buffer_pos_t rx_count = (ring_buffer_pos_t)(h - t) & (ring_buffer_pos_t)(Cfg::RX_SIZE - 1); + // Calculate count of bytes stored into the RX buffer - // A SW memory barrier, to ensure GCC does not overoptimize loops - #define sw_barrier() asm volatile("": : :"memory"); + // Keep track of the maximum count of enqueued bytes + if (Cfg::MAX_RX_QUEUED) NOLESS(rx_max_enqueued, rx_count); - #if ENABLED(EMERGENCY_PARSER) - #include "../../feature/emergency_parser.h" - #endif + if (Cfg::XONOFF) { + // If the last char that was sent was an XON + if ((xon_xoff_state & XON_XOFF_CHAR_MASK) == XON_CHAR) { - // (called with RX interrupts disabled) - FORCE_INLINE void store_rxd_char() { + // Bytes stored into the RX buffer + const ring_buffer_pos_t rx_count = (ring_buffer_pos_t)(h - t) & (ring_buffer_pos_t)(Cfg::RX_SIZE - 1); - #if ENABLED(EMERGENCY_PARSER) - static EmergencyParser::State emergency_state; // = EP_RESET - #endif + // If over 12.5% of RX buffer capacity, send XOFF before running out of + // RX buffer space .. 325 bytes @ 250kbits/s needed to let the host react + // and stop sending bytes. This translates to 13mS propagation time. + if (rx_count >= (Cfg::RX_SIZE) / 8) { - // Get the tail - Nothing can alter its value while we are at this ISR - const ring_buffer_pos_t t = rx_buffer.tail; + // At this point, definitely no TX interrupt was executing, since the TX isr can't be preempted. + // Don't enable the TX interrupt here as a means to trigger the XOFF char, because if it happens + // to be in the middle of trying to disable the RX interrupt in the main program, eventually the + // enabling of the TX interrupt could be undone. The ONLY reliable thing this can do to ensure + // the sending of the XOFF char is to send it HERE AND NOW. - // Get the head pointer - ring_buffer_pos_t h = rx_buffer.head; + // About to send the XOFF char + xon_xoff_state = XOFF_CHAR | XON_XOFF_CHAR_SENT; - // Get the next element - ring_buffer_pos_t i = (ring_buffer_pos_t)(h + 1) & (ring_buffer_pos_t)(RX_BUFFER_SIZE - 1); + // Wait until the TX register becomes empty and send it - Here there could be a problem + // - While waiting for the TX register to empty, the RX register could receive a new + // character. This must also handle that situation! + uint32_t status; + while (!((status = HWUART->UART_SR) & UART_SR_TXRDY)) { - // Read the character from the USART - uint8_t c = HWUART->UART_RHR; + if (status & UART_SR_RXRDY) { + // We received a char while waiting for the TX buffer to be empty - Receive and process it! - #if ENABLED(EMERGENCY_PARSER) - emergency_parser.update(emergency_state, c); - #endif + i = (ring_buffer_pos_t)(h + 1) & (ring_buffer_pos_t)(Cfg::RX_SIZE - 1); - // If the character is to be stored at the index just before the tail - // (such that the head would advance to the current tail), the RX FIFO is - // full, so don't write the character or advance the head. - if (i != t) { - rx_buffer.buffer[h] = c; - h = i; - } - #if ENABLED(SERIAL_STATS_DROPPED_RX) - else if (!++rx_dropped_bytes) --rx_dropped_bytes; - #endif + // Read the character from the USART + c = HWUART->UART_RHR; - #if ENABLED(SERIAL_STATS_MAX_RX_QUEUED) - const ring_buffer_pos_t rx_count = (ring_buffer_pos_t)(h - t) & (ring_buffer_pos_t)(RX_BUFFER_SIZE - 1); - // Calculate count of bytes stored into the RX buffer + if (Cfg::EMERGENCYPARSER) emergency_parser.update(emergency_state, c); - // Keep track of the maximum count of enqueued bytes - NOLESS(rx_max_enqueued, rx_count); - #endif - - #if ENABLED(SERIAL_XON_XOFF) - // If the last char that was sent was an XON - if ((xon_xoff_state & XON_XOFF_CHAR_MASK) == XON_CHAR) { - - // Bytes stored into the RX buffer - const ring_buffer_pos_t rx_count = (ring_buffer_pos_t)(h - t) & (ring_buffer_pos_t)(RX_BUFFER_SIZE - 1); - - // If over 12.5% of RX buffer capacity, send XOFF before running out of - // RX buffer space .. 325 bytes @ 250kbits/s needed to let the host react - // and stop sending bytes. This translates to 13mS propagation time. - if (rx_count >= (RX_BUFFER_SIZE) / 8) { - - // At this point, definitely no TX interrupt was executing, since the TX isr can't be preempted. - // Don't enable the TX interrupt here as a means to trigger the XOFF char, because if it happens - // to be in the middle of trying to disable the RX interrupt in the main program, eventually the - // enabling of the TX interrupt could be undone. The ONLY reliable thing this can do to ensure - // the sending of the XOFF char is to send it HERE AND NOW. - - // About to send the XOFF char - xon_xoff_state = XOFF_CHAR | XON_XOFF_CHAR_SENT; - - // Wait until the TX register becomes empty and send it - Here there could be a problem - // - While waiting for the TX register to empty, the RX register could receive a new - // character. This must also handle that situation! - uint32_t status; - while (!((status = HWUART->UART_SR) & UART_SR_TXRDY)) { - - if (status & UART_SR_RXRDY) { - // We received a char while waiting for the TX buffer to be empty - Receive and process it! - - i = (ring_buffer_pos_t)(h + 1) & (ring_buffer_pos_t)(RX_BUFFER_SIZE - 1); - - // Read the character from the USART - c = HWUART->UART_RHR; - - #if ENABLED(EMERGENCY_PARSER) - emergency_parser.update(emergency_state, c); - #endif - - // If the character is to be stored at the index just before the tail - // (such that the head would advance to the current tail), the FIFO is - // full, so don't write the character or advance the head. - if (i != t) { - rx_buffer.buffer[h] = c; - h = i; - } - #if ENABLED(SERIAL_STATS_DROPPED_RX) - else if (!++rx_dropped_bytes) --rx_dropped_bytes; - #endif + // If the character is to be stored at the index just before the tail + // (such that the head would advance to the current tail), the FIFO is + // full, so don't write the character or advance the head. + if (i != t) { + rx_buffer.buffer[h] = c; + h = i; } - sw_barrier(); + else if (Cfg::DROPPED_RX && !++rx_dropped_bytes) + --rx_dropped_bytes; } - - HWUART->UART_THR = XOFF_CHAR; - - // At this point there could be a race condition between the write() function - // and this sending of the XOFF char. This interrupt could happen between the - // wait to be empty TX buffer loop and the actual write of the character. Since - // the TX buffer is full because it's sending the XOFF char, the only way to be - // sure the write() function will succeed is to wait for the XOFF char to be - // completely sent. Since an extra character could be received during the wait - // it must also be handled! - while (!((status = HWUART->UART_SR) & UART_SR_TXRDY)) { - - if (status & UART_SR_RXRDY) { - // A char arrived while waiting for the TX buffer to be empty - Receive and process it! - - i = (ring_buffer_pos_t)(h + 1) & (ring_buffer_pos_t)(RX_BUFFER_SIZE - 1); - - // Read the character from the USART - c = HWUART->UART_RHR; - - #if ENABLED(EMERGENCY_PARSER) - emergency_parser.update(emergency_state, c); - #endif - - // If the character is to be stored at the index just before the tail - // (such that the head would advance to the current tail), the FIFO is - // full, so don't write the character or advance the head. - if (i != t) { - rx_buffer.buffer[h] = c; - h = i; - } - #if ENABLED(SERIAL_STATS_DROPPED_RX) - else if (!++rx_dropped_bytes) --rx_dropped_bytes; - #endif - } - sw_barrier(); - } - - // At this point everything is ready. The write() function won't - // have any issues writing to the UART TX register if it needs to! + sw_barrier(); } - } - #endif // SERIAL_XON_XOFF - // Store the new head value - rx_buffer.head = h; + HWUART->UART_THR = XOFF_CHAR; + + // At this point there could be a race condition between the write() function + // and this sending of the XOFF char. This interrupt could happen between the + // wait to be empty TX buffer loop and the actual write of the character. Since + // the TX buffer is full because it's sending the XOFF char, the only way to be + // sure the write() function will succeed is to wait for the XOFF char to be + // completely sent. Since an extra character could be received during the wait + // it must also be handled! + while (!((status = HWUART->UART_SR) & UART_SR_TXRDY)) { + + if (status & UART_SR_RXRDY) { + // A char arrived while waiting for the TX buffer to be empty - Receive and process it! + + i = (ring_buffer_pos_t)(h + 1) & (ring_buffer_pos_t)(Cfg::RX_SIZE - 1); + + // Read the character from the USART + c = HWUART->UART_RHR; + + if (Cfg::EMERGENCYPARSER) emergency_parser.update(emergency_state, c); + + // If the character is to be stored at the index just before the tail + // (such that the head would advance to the current tail), the FIFO is + // full, so don't write the character or advance the head. + if (i != t) { + rx_buffer.buffer[h] = c; + h = i; + } + else if (Cfg::DROPPED_RX && !++rx_dropped_bytes) + --rx_dropped_bytes; + } + sw_barrier(); + } + + // At this point everything is ready. The write() function won't + // have any issues writing to the UART TX register if it needs to! + } + } } - #if TX_BUFFER_SIZE > 0 + // Store the new head value + rx_buffer.head = h; +} - FORCE_INLINE void _tx_thr_empty_irq(void) { - // Read positions - uint8_t t = tx_buffer.tail; - const uint8_t h = tx_buffer.head; +template +FORCE_INLINE void MarlinSerial::_tx_thr_empty_irq(void) { + if (Cfg::TX_SIZE > 0) { + // Read positions + uint8_t t = tx_buffer.tail; + const uint8_t h = tx_buffer.head; - #if ENABLED(SERIAL_XON_XOFF) - // If an XON char is pending to be sent, do it now - if (xon_xoff_state == XON_CHAR) { + if (Cfg::XONOFF) { + // If an XON char is pending to be sent, do it now + if (xon_xoff_state == XON_CHAR) { - // Send the character - HWUART->UART_THR = XON_CHAR; + // Send the character + HWUART->UART_THR = XON_CHAR; - // Remember we sent it. - xon_xoff_state = XON_CHAR | XON_XOFF_CHAR_SENT; + // Remember we sent it. + xon_xoff_state = XON_CHAR | XON_XOFF_CHAR_SENT; - // If nothing else to transmit, just disable TX interrupts. - if (h == t) HWUART->UART_IDR = UART_IDR_TXRDY; + // If nothing else to transmit, just disable TX interrupts. + if (h == t) HWUART->UART_IDR = UART_IDR_TXRDY; - return; - } - #endif - - // If nothing to transmit, just disable TX interrupts. This could - // happen as the result of the non atomicity of the disabling of RX - // interrupts that could end reenabling TX interrupts as a side effect. - if (h == t) { - HWUART->UART_IDR = UART_IDR_TXRDY; return; } - - // There is something to TX, Send the next byte - const uint8_t c = tx_buffer.buffer[t]; - t = (t + 1) & (TX_BUFFER_SIZE - 1); - HWUART->UART_THR = c; - tx_buffer.tail = t; - - // Disable interrupts if there is nothing to transmit following this byte - if (h == t) HWUART->UART_IDR = UART_IDR_TXRDY; } - #endif // TX_BUFFER_SIZE > 0 - - static void UART_ISR(void) { - const uint32_t status = HWUART->UART_SR; - - // Data received? - if (status & UART_SR_RXRDY) store_rxd_char(); - - #if TX_BUFFER_SIZE > 0 - // Something to send, and TX interrupts are enabled (meaning something to send)? - if ((status & UART_SR_TXRDY) && (HWUART->UART_IMR & UART_IMR_TXRDY)) _tx_thr_empty_irq(); - #endif - - // Acknowledge errors - if ((status & UART_SR_OVRE) || (status & UART_SR_FRAME)) { - - #if ENABLED(SERIAL_STATS_DROPPED_RX) - if (status & UART_SR_OVRE && !++rx_dropped_bytes) --rx_dropped_bytes; - #endif - - #if ENABLED(SERIAL_STATS_RX_BUFFER_OVERRUNS) - if (status & UART_SR_OVRE && !++rx_buffer_overruns) --rx_buffer_overruns; - #endif - - #if ENABLED(SERIAL_STATS_RX_FRAMING_ERRORS) - if (status & UART_SR_FRAME && !++rx_framing_errors) --rx_framing_errors; - #endif - - // TODO: error reporting outside ISR - HWUART->UART_CR = UART_CR_RSTSTA; + // If nothing to transmit, just disable TX interrupts. This could + // happen as the result of the non atomicity of the disabling of RX + // interrupts that could end reenabling TX interrupts as a side effect. + if (h == t) { + HWUART->UART_IDR = UART_IDR_TXRDY; + return; } + + // There is something to TX, Send the next byte + const uint8_t c = tx_buffer.buffer[t]; + t = (t + 1) & (Cfg::TX_SIZE - 1); + HWUART->UART_THR = c; + tx_buffer.tail = t; + + // Disable interrupts if there is nothing to transmit following this byte + if (h == t) HWUART->UART_IDR = UART_IDR_TXRDY; + } +} + +template +void MarlinSerial::UART_ISR(void) { + const uint32_t status = HWUART->UART_SR; + + // Data received? + if (status & UART_SR_RXRDY) store_rxd_char(); + + if (Cfg::TX_SIZE > 0) { + // Something to send, and TX interrupts are enabled (meaning something to send)? + if ((status & UART_SR_TXRDY) && (HWUART->UART_IMR & UART_IMR_TXRDY)) _tx_thr_empty_irq(); } - // Public Methods + // Acknowledge errors + if ((status & UART_SR_OVRE) || (status & UART_SR_FRAME)) { + if (Cfg::DROPPED_RX && (status & UART_SR_OVRE) && !++rx_dropped_bytes) --rx_dropped_bytes; + if (Cfg::RX_OVERRUNS && (status & UART_SR_OVRE) && !++rx_buffer_overruns) --rx_buffer_overruns; + if (Cfg::RX_FRAMING_ERRORS && (status & UART_SR_FRAME) && !++rx_framing_errors) --rx_framing_errors; - void MarlinSerial::begin(const long baud_setting) { - - // Disable UART interrupt in NVIC - NVIC_DisableIRQ( HWUART_IRQ ); - - // We NEED memory barriers to ensure Interrupts are actually disabled! - // ( https://dzone.com/articles/nvic-disabling-interrupts-on-arm-cortex-m-and-the ) - __DSB(); - __ISB(); - - // Disable clock - pmc_disable_periph_clk( HWUART_IRQ_ID ); - - // Configure PMC - pmc_enable_periph_clk( HWUART_IRQ_ID ); - - // Disable PDC channel - HWUART->UART_PTCR = UART_PTCR_RXTDIS | UART_PTCR_TXTDIS; - - // Reset and disable receiver and transmitter - HWUART->UART_CR = UART_CR_RSTRX | UART_CR_RSTTX | UART_CR_RXDIS | UART_CR_TXDIS; - - // Configure mode: 8bit, No parity, 1 bit stop - HWUART->UART_MR = UART_MR_CHMODE_NORMAL | US_MR_CHRL_8_BIT | US_MR_NBSTOP_1_BIT | UART_MR_PAR_NO; - - // Configure baudrate (asynchronous, no oversampling) - HWUART->UART_BRGR = (SystemCoreClock / (baud_setting << 4)); - - // Configure interrupts - HWUART->UART_IDR = 0xFFFFFFFF; - HWUART->UART_IER = UART_IER_RXRDY | UART_IER_OVRE | UART_IER_FRAME; - - // Install interrupt handler - install_isr(HWUART_IRQ, UART_ISR); - - // Configure priority. We need a very high priority to avoid losing characters - // and we need to be able to preempt the Stepper ISR and everything else! - // (this could probably be fixed by using DMA with the Serial port) - NVIC_SetPriority(HWUART_IRQ, 1); - - // Enable UART interrupt in NVIC - NVIC_EnableIRQ(HWUART_IRQ); - - // Enable receiver and transmitter - HWUART->UART_CR = UART_CR_RXEN | UART_CR_TXEN; - - #if TX_BUFFER_SIZE > 0 - _written = false; - #endif + // TODO: error reporting outside ISR + HWUART->UART_CR = UART_CR_RSTSTA; } +} - void MarlinSerial::end() { - // Disable UART interrupt in NVIC - NVIC_DisableIRQ( HWUART_IRQ ); +// Public Methods +template +void MarlinSerial::begin(const long baud_setting) { - // We NEED memory barriers to ensure Interrupts are actually disabled! - // ( https://dzone.com/articles/nvic-disabling-interrupts-on-arm-cortex-m-and-the ) - __DSB(); - __ISB(); + // Disable UART interrupt in NVIC + NVIC_DisableIRQ( HWUART_IRQ ); - pmc_disable_periph_clk( HWUART_IRQ_ID ); - } + // We NEED memory barriers to ensure Interrupts are actually disabled! + // ( https://dzone.com/articles/nvic-disabling-interrupts-on-arm-cortex-m-and-the ) + __DSB(); + __ISB(); - int MarlinSerial::peek(void) { - const int v = rx_buffer.head == rx_buffer.tail ? -1 : rx_buffer.buffer[rx_buffer.tail]; - return v; - } + // Disable clock + pmc_disable_periph_clk( HWUART_IRQ_ID ); - int MarlinSerial::read(void) { + // Configure PMC + pmc_enable_periph_clk( HWUART_IRQ_ID ); - const ring_buffer_pos_t h = rx_buffer.head; - ring_buffer_pos_t t = rx_buffer.tail; + // Disable PDC channel + HWUART->UART_PTCR = UART_PTCR_RXTDIS | UART_PTCR_TXTDIS; - if (h == t) return -1; + // Reset and disable receiver and transmitter + HWUART->UART_CR = UART_CR_RSTRX | UART_CR_RSTTX | UART_CR_RXDIS | UART_CR_TXDIS; - int v = rx_buffer.buffer[t]; - t = (ring_buffer_pos_t)(t + 1) & (RX_BUFFER_SIZE - 1); + // Configure mode: 8bit, No parity, 1 bit stop + HWUART->UART_MR = UART_MR_CHMODE_NORMAL | US_MR_CHRL_8_BIT | US_MR_NBSTOP_1_BIT | UART_MR_PAR_NO; - // Advance tail - rx_buffer.tail = t; + // Configure baudrate (asynchronous, no oversampling) + HWUART->UART_BRGR = (SystemCoreClock / (baud_setting << 4)); - #if ENABLED(SERIAL_XON_XOFF) - // If the XOFF char was sent, or about to be sent... - if ((xon_xoff_state & XON_XOFF_CHAR_MASK) == XOFF_CHAR) { - // Get count of bytes in the RX buffer - const ring_buffer_pos_t rx_count = (ring_buffer_pos_t)(h - t) & (ring_buffer_pos_t)(RX_BUFFER_SIZE - 1); - // When below 10% of RX buffer capacity, send XON before running out of RX buffer bytes - if (rx_count < (RX_BUFFER_SIZE) / 10) { - #if TX_BUFFER_SIZE > 0 - // Signal we want an XON character to be sent. - xon_xoff_state = XON_CHAR; - // Enable TX isr. - HWUART->UART_IER = UART_IER_TXRDY; - #else - // If not using TX interrupts, we must send the XON char now - xon_xoff_state = XON_CHAR | XON_XOFF_CHAR_SENT; - while (!(HWUART->UART_SR & UART_SR_TXRDY)) sw_barrier(); - HWUART->UART_THR = XON_CHAR; - #endif - } - } - #endif + // Configure interrupts + HWUART->UART_IDR = 0xFFFFFFFF; + HWUART->UART_IER = UART_IER_RXRDY | UART_IER_OVRE | UART_IER_FRAME; - return v; - } + // Install interrupt handler + install_isr(HWUART_IRQ, UART_ISR); - ring_buffer_pos_t MarlinSerial::available(void) { - const ring_buffer_pos_t h = rx_buffer.head, t = rx_buffer.tail; - return (ring_buffer_pos_t)(RX_BUFFER_SIZE + h - t) & (RX_BUFFER_SIZE - 1); - } + // Configure priority. We need a very high priority to avoid losing characters + // and we need to be able to preempt the Stepper ISR and everything else! + // (this could probably be fixed by using DMA with the Serial port) + NVIC_SetPriority(HWUART_IRQ, 1); - void MarlinSerial::flush(void) { - rx_buffer.tail = rx_buffer.head; + // Enable UART interrupt in NVIC + NVIC_EnableIRQ(HWUART_IRQ); - #if ENABLED(SERIAL_XON_XOFF) - if ((xon_xoff_state & XON_XOFF_CHAR_MASK) == XOFF_CHAR) { - #if TX_BUFFER_SIZE > 0 + // Enable receiver and transmitter + HWUART->UART_CR = UART_CR_RXEN | UART_CR_TXEN; + + if (Cfg::TX_SIZE > 0) _written = false; +} + +template +void MarlinSerial::end() { + // Disable UART interrupt in NVIC + NVIC_DisableIRQ( HWUART_IRQ ); + + // We NEED memory barriers to ensure Interrupts are actually disabled! + // ( https://dzone.com/articles/nvic-disabling-interrupts-on-arm-cortex-m-and-the ) + __DSB(); + __ISB(); + + pmc_disable_periph_clk( HWUART_IRQ_ID ); +} + +template +int MarlinSerial::peek(void) { + const int v = rx_buffer.head == rx_buffer.tail ? -1 : rx_buffer.buffer[rx_buffer.tail]; + return v; +} + +template +int MarlinSerial::read(void) { + + const ring_buffer_pos_t h = rx_buffer.head; + ring_buffer_pos_t t = rx_buffer.tail; + + if (h == t) return -1; + + int v = rx_buffer.buffer[t]; + t = (ring_buffer_pos_t)(t + 1) & (Cfg::RX_SIZE - 1); + + // Advance tail + rx_buffer.tail = t; + + if (Cfg::XONOFF) { + // If the XOFF char was sent, or about to be sent... + if ((xon_xoff_state & XON_XOFF_CHAR_MASK) == XOFF_CHAR) { + // Get count of bytes in the RX buffer + const ring_buffer_pos_t rx_count = (ring_buffer_pos_t)(h - t) & (ring_buffer_pos_t)(Cfg::RX_SIZE - 1); + // When below 10% of RX buffer capacity, send XON before running out of RX buffer bytes + if (rx_count < (Cfg::RX_SIZE) / 10) { + if (Cfg::TX_SIZE > 0) { // Signal we want an XON character to be sent. xon_xoff_state = XON_CHAR; // Enable TX isr. HWUART->UART_IER = UART_IER_TXRDY; - #else + } + else { // If not using TX interrupts, we must send the XON char now xon_xoff_state = XON_CHAR | XON_XOFF_CHAR_SENT; while (!(HWUART->UART_SR & UART_SR_TXRDY)) sw_barrier(); HWUART->UART_THR = XON_CHAR; - #endif + } } - #endif + } } - #if TX_BUFFER_SIZE > 0 - void MarlinSerial::write(const uint8_t c) { - _written = true; + return v; +} - // If the TX interrupts are disabled and the data register - // is empty, just write the byte to the data register and - // be done. This shortcut helps significantly improve the - // effective datarate at high (>500kbit/s) bitrates, where - // interrupt overhead becomes a slowdown. - // Yes, there is a race condition between the sending of the - // XOFF char at the RX isr, but it is properly handled there - if (!(HWUART->UART_IMR & UART_IMR_TXRDY) && (HWUART->UART_SR & UART_SR_TXRDY)) { - HWUART->UART_THR = c; - return; - } +template +typename MarlinSerial::ring_buffer_pos_t MarlinSerial::available(void) { + const ring_buffer_pos_t h = rx_buffer.head, t = rx_buffer.tail; + return (ring_buffer_pos_t)(Cfg::RX_SIZE + h - t) & (Cfg::RX_SIZE - 1); +} - const uint8_t i = (tx_buffer.head + 1) & (TX_BUFFER_SIZE - 1); +template +void MarlinSerial::flush(void) { + rx_buffer.tail = rx_buffer.head; - // If global interrupts are disabled (as the result of being called from an ISR)... - if (!ISRS_ENABLED()) { - - // Make room by polling if it is possible to transmit, and do so! - while (i == tx_buffer.tail) { - // If we can transmit another byte, do it. - if (HWUART->UART_SR & UART_SR_TXRDY) _tx_thr_empty_irq(); - // Make sure compiler rereads tx_buffer.tail - sw_barrier(); - } + if (Cfg::XONOFF) { + if ((xon_xoff_state & XON_XOFF_CHAR_MASK) == XOFF_CHAR) { + if (Cfg::TX_SIZE > 0) { + // Signal we want an XON character to be sent. + xon_xoff_state = XON_CHAR; + // Enable TX isr. + HWUART->UART_IER = UART_IER_TXRDY; } else { - // Interrupts are enabled, just wait until there is space - while (i == tx_buffer.tail) sw_barrier(); + // If not using TX interrupts, we must send the XON char now + xon_xoff_state = XON_CHAR | XON_XOFF_CHAR_SENT; + while (!(HWUART->UART_SR & UART_SR_TXRDY)) sw_barrier(); + HWUART->UART_THR = XON_CHAR; } - - // Store new char. head is always safe to move - tx_buffer.buffer[tx_buffer.head] = c; - tx_buffer.head = i; - - // Enable TX isr - Non atomic, but it will eventually enable TX isr - HWUART->UART_IER = UART_IER_TXRDY; } + } +} - void MarlinSerial::flushTX(void) { - // TX +template +void MarlinSerial::write(const uint8_t c) { + _written = true; - // If we have never written a byte, no need to flush. This special - // case is needed since there is no way to force the TXC (transmit - // complete) bit to 1 during initialization - if (!_written) return; + if (Cfg::TX_SIZE == 0) { + while (!(HWUART->UART_SR & UART_SR_TXRDY)) sw_barrier(); + HWUART->UART_THR = c; + } + else { - // If global interrupts are disabled (as the result of being called from an ISR)... - if (!ISRS_ENABLED()) { - - // Wait until everything was transmitted - We must do polling, as interrupts are disabled - while (tx_buffer.head != tx_buffer.tail || !(HWUART->UART_SR & UART_SR_TXEMPTY)) { - // If there is more space, send an extra character - if (HWUART->UART_SR & UART_SR_TXRDY) _tx_thr_empty_irq(); - sw_barrier(); - } - - } - else { - // Wait until everything was transmitted - while (tx_buffer.head != tx_buffer.tail || !(HWUART->UART_SR & UART_SR_TXEMPTY)) sw_barrier(); - } - - // At this point nothing is queued anymore (DRIE is disabled) and - // the hardware finished transmission (TXC is set). - } - - #else // TX_BUFFER_SIZE == 0 - - void MarlinSerial::write(const uint8_t c) { - _written = true; - while (!(HWUART->UART_SR & UART_SR_TXRDY)) sw_barrier(); + // If the TX interrupts are disabled and the data register + // is empty, just write the byte to the data register and + // be done. This shortcut helps significantly improve the + // effective datarate at high (>500kbit/s) bitrates, where + // interrupt overhead becomes a slowdown. + // Yes, there is a race condition between the sending of the + // XOFF char at the RX isr, but it is properly handled there + if (!(HWUART->UART_IMR & UART_IMR_TXRDY) && (HWUART->UART_SR & UART_SR_TXRDY)) { HWUART->UART_THR = c; + return; } - void MarlinSerial::flushTX(void) { - // TX + const uint8_t i = (tx_buffer.head + 1) & (Cfg::TX_SIZE - 1); - // No bytes written, no need to flush. This special case is needed since there's - // no way to force the TXC (transmit complete) bit to 1 during initialization. - if (!_written) return; + // If global interrupts are disabled (as the result of being called from an ISR)... + if (!ISRS_ENABLED()) { + // Make room by polling if it is possible to transmit, and do so! + while (i == tx_buffer.tail) { + // If we can transmit another byte, do it. + if (HWUART->UART_SR & UART_SR_TXRDY) _tx_thr_empty_irq(); + // Make sure compiler rereads tx_buffer.tail + sw_barrier(); + } + } + else { + // Interrupts are enabled, just wait until there is space + while (i == tx_buffer.tail) sw_barrier(); + } + + // Store new char. head is always safe to move + tx_buffer.buffer[tx_buffer.head] = c; + tx_buffer.head = i; + + // Enable TX isr - Non atomic, but it will eventually enable TX isr + HWUART->UART_IER = UART_IER_TXRDY; + } +} + +template +void MarlinSerial::flushTX(void) { + // TX + + if (Cfg::TX_SIZE == 0) { + // No bytes written, no need to flush. This special case is needed since there's + // no way to force the TXC (transmit complete) bit to 1 during initialization. + if (!_written) return; + + // Wait until everything was transmitted + while (!(HWUART->UART_SR & UART_SR_TXEMPTY)) sw_barrier(); + + // At this point nothing is queued anymore (DRIE is disabled) and + // the hardware finished transmission (TXC is set). + + } + else { + // If we have never written a byte, no need to flush. This special + // case is needed since there is no way to force the TXC (transmit + // complete) bit to 1 during initialization + if (!_written) return; + + // If global interrupts are disabled (as the result of being called from an ISR)... + if (!ISRS_ENABLED()) { + + // Wait until everything was transmitted - We must do polling, as interrupts are disabled + while (tx_buffer.head != tx_buffer.tail || !(HWUART->UART_SR & UART_SR_TXEMPTY)) { + // If there is more space, send an extra character + if (HWUART->UART_SR & UART_SR_TXRDY) _tx_thr_empty_irq(); + sw_barrier(); + } + + } + else { // Wait until everything was transmitted - while (!(HWUART->UART_SR & UART_SR_TXEMPTY)) sw_barrier(); - - // At this point nothing is queued anymore (DRIE is disabled) and - // the hardware finished transmission (TXC is set). - } - #endif // TX_BUFFER_SIZE == 0 - - /** - * Imports from print.h - */ - - void MarlinSerial::print(char c, int base) { - print((long)c, base); - } - - void MarlinSerial::print(unsigned char b, int base) { - print((unsigned long)b, base); - } - - void MarlinSerial::print(int n, int base) { - print((long)n, base); - } - - void MarlinSerial::print(unsigned int n, int base) { - print((unsigned long)n, base); - } - - void MarlinSerial::print(long n, int base) { - if (base == 0) write(n); - else if (base == 10) { - if (n < 0) { print('-'); n = -n; } - printNumber(n, 10); - } - else - printNumber(n, base); - } - - void MarlinSerial::print(unsigned long n, int base) { - if (base == 0) write(n); - else printNumber(n, base); - } - - void MarlinSerial::print(double n, int digits) { - printFloat(n, digits); - } - - void MarlinSerial::println(void) { - print('\r'); - print('\n'); - } - - void MarlinSerial::println(const String& s) { - print(s); - println(); - } - - void MarlinSerial::println(const char c[]) { - print(c); - println(); - } - - void MarlinSerial::println(char c, int base) { - print(c, base); - println(); - } - - void MarlinSerial::println(unsigned char b, int base) { - print(b, base); - println(); - } - - void MarlinSerial::println(int n, int base) { - print(n, base); - println(); - } - - void MarlinSerial::println(unsigned int n, int base) { - print(n, base); - println(); - } - - void MarlinSerial::println(long n, int base) { - print(n, base); - println(); - } - - void MarlinSerial::println(unsigned long n, int base) { - print(n, base); - println(); - } - - void MarlinSerial::println(double n, int digits) { - print(n, digits); - println(); - } - - // Private Methods - - void MarlinSerial::printNumber(unsigned long n, uint8_t base) { - if (n) { - unsigned char buf[8 * sizeof(long)]; // Enough space for base 2 - int8_t i = 0; - while (n) { - buf[i++] = n % base; - n /= base; - } - while (i--) - print((char)(buf[i] + (buf[i] < 10 ? '0' : 'A' - 10))); - } - else - print('0'); - } - - void MarlinSerial::printFloat(double number, uint8_t digits) { - // Handle negative numbers - if (number < 0.0) { - print('-'); - number = -number; + while (tx_buffer.head != tx_buffer.tail || !(HWUART->UART_SR & UART_SR_TXEMPTY)) sw_barrier(); } - // Round correctly so that print(1.999, 2) prints as "2.00" - double rounding = 0.5; - for (uint8_t i = 0; i < digits; ++i) rounding *= 0.1; - number += rounding; + // At this point nothing is queued anymore (DRIE is disabled) and + // the hardware finished transmission (TXC is set). + } +} - // Extract the integer part of the number and print it - unsigned long int_part = (unsigned long)number; - double remainder = number - (double)int_part; - print(int_part); +/** + * Imports from print.h + */ - // Print the decimal point, but only if there are digits beyond - if (digits) { - print('.'); - // Extract digits from the remainder one at a time - while (digits--) { - remainder *= 10.0; - int toPrint = int(remainder); - print(toPrint); - remainder -= toPrint; - } +template +void MarlinSerial::print(char c, int base) { + print((long)c, base); +} + +template +void MarlinSerial::print(unsigned char b, int base) { + print((unsigned long)b, base); +} + +template +void MarlinSerial::print(int n, int base) { + print((long)n, base); +} + +template +void MarlinSerial::print(unsigned int n, int base) { + print((unsigned long)n, base); +} + +template +void MarlinSerial::print(long n, int base) { + if (base == 0) write(n); + else if (base == 10) { + if (n < 0) { print('-'); n = -n; } + printNumber(n, 10); + } + else + printNumber(n, base); +} + +template +void MarlinSerial::print(unsigned long n, int base) { + if (base == 0) write(n); + else printNumber(n, base); +} + +template +void MarlinSerial::print(double n, int digits) { + printFloat(n, digits); +} + +template +void MarlinSerial::println(void) { + print('\r'); + print('\n'); +} + +template +void MarlinSerial::println(const String& s) { + print(s); + println(); +} + +template +void MarlinSerial::println(const char c[]) { + print(c); + println(); +} + +template +void MarlinSerial::println(char c, int base) { + print(c, base); + println(); +} + +template +void MarlinSerial::println(unsigned char b, int base) { + print(b, base); + println(); +} + +template +void MarlinSerial::println(int n, int base) { + print(n, base); + println(); +} + +template +void MarlinSerial::println(unsigned int n, int base) { + print(n, base); + println(); +} + +template +void MarlinSerial::println(long n, int base) { + print(n, base); + println(); +} + +template +void MarlinSerial::println(unsigned long n, int base) { + print(n, base); + println(); +} + +template +void MarlinSerial::println(double n, int digits) { + print(n, digits); + println(); +} + +// Private Methods +template +void MarlinSerial::printNumber(unsigned long n, uint8_t base) { + if (n) { + unsigned char buf[8 * sizeof(long)]; // Enough space for base 2 + int8_t i = 0; + while (n) { + buf[i++] = n % base; + n /= base; + } + while (i--) + print((char)(buf[i] + (buf[i] < 10 ? '0' : 'A' - 10))); + } + else + print('0'); +} + +template +void MarlinSerial::printFloat(double number, uint8_t digits) { + // Handle negative numbers + if (number < 0.0) { + print('-'); + number = -number; + } + + // Round correctly so that print(1.999, 2) prints as "2.00" + double rounding = 0.5; + for (uint8_t i = 0; i < digits; ++i) rounding *= 0.1; + number += rounding; + + // Extract the integer part of the number and print it + unsigned long int_part = (unsigned long)number; + double remainder = number - (double)int_part; + print(int_part); + + // Print the decimal point, but only if there are digits beyond + if (digits) { + print('.'); + // Extract digits from the remainder one at a time + while (digits--) { + remainder *= 10.0; + int toPrint = int(remainder); + print(toPrint); + remainder -= toPrint; } } +} + +// If not using the USB port as serial port +#if SERIAL_PORT >= 0 // Preinstantiate - MarlinSerial customizedSerial; + template class MarlinSerial>; + + // Instantiate + MarlinSerial> customizedSerial1; + +#endif + +#ifdef SERIAL_PORT_2 + + // Preinstantiate + template class MarlinSerial>; + + // Instantiate + MarlinSerial> customizedSerial2; + #endif #endif // ARDUINO_ARCH_SAM diff --git a/Marlin/src/HAL/HAL_DUE/MarlinSerial_Due.h b/Marlin/src/HAL/HAL_DUE/MarlinSerial_Due.h index 2f5a07f515..1fe0d236ee 100644 --- a/Marlin/src/HAL/HAL_DUE/MarlinSerial_Due.h +++ b/Marlin/src/HAL/HAL_DUE/MarlinSerial_Due.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * MarlinSerial_Due.h - Hardware serial library for Arduino DUE @@ -26,12 +27,7 @@ * Based on MarlinSerial for AVR, copyright (c) 2006 Nicholas Zambetti. All right reserved. */ -#ifndef MARLINSERIAL_DUE_H -#define MARLINSERIAL_DUE_H - -#include "../../inc/MarlinConfig.h" - -#if SERIAL_PORT >= 0 +#include "../shared/MarlinSerial.h" #include @@ -60,29 +56,60 @@ // #error "TX_BUFFER_SIZE must be 0, a power of 2 greater than 1, and no greater than 256." //#endif -#if RX_BUFFER_SIZE > 256 - typedef uint16_t ring_buffer_pos_t; -#else - typedef uint8_t ring_buffer_pos_t; -#endif +// Templated type selector +template struct TypeSelector { typedef T type;} ; +template struct TypeSelector { typedef F type; }; -#if ENABLED(SERIAL_STATS_DROPPED_RX) - extern uint8_t rx_dropped_bytes; -#endif - -#if ENABLED(SERIAL_STATS_RX_BUFFER_OVERRUNS) - extern uint8_t rx_buffer_overruns; -#endif - -#if ENABLED(SERIAL_STATS_RX_FRAMING_ERRORS) - extern uint8_t rx_framing_errors; -#endif - -#if ENABLED(SERIAL_STATS_MAX_RX_QUEUED) - extern ring_buffer_pos_t rx_max_enqueued; -#endif +// Templated structure wrapper +template struct StructWrapper { + constexpr StructWrapper(int) {} + FORCE_INLINE S* operator->() const { return (S*)addr; } +}; +template class MarlinSerial { +protected: + // Information for all supported UARTs + static constexpr uint32_t BASES[] = {0x400E0800U, 0x40098000U, 0x4009C000U, 0x400A0000U, 0x400A4000U}; + static constexpr IRQn_Type IRQS[] = { UART_IRQn, USART0_IRQn, USART1_IRQn, USART2_IRQn, USART3_IRQn}; + static constexpr int IRQ_IDS[] = { ID_UART, ID_USART0, ID_USART1, ID_USART2, ID_USART3}; + + // Alias for shorter code + static constexpr StructWrapper HWUART = 0; + static constexpr IRQn_Type HWUART_IRQ = IRQS[Cfg::PORT]; + static constexpr int HWUART_IRQ_ID = IRQ_IDS[Cfg::PORT]; + + // Base size of type on buffer size + typedef typename TypeSelector<(Cfg::RX_SIZE>256), uint16_t, uint8_t>::type ring_buffer_pos_t; + + struct ring_buffer_r { + volatile ring_buffer_pos_t head, tail; + unsigned char buffer[Cfg::RX_SIZE]; + }; + + struct ring_buffer_t { + volatile uint8_t head, tail; + unsigned char buffer[Cfg::TX_SIZE]; + }; + + static ring_buffer_r rx_buffer; + static ring_buffer_t tx_buffer; + static bool _written; + + static constexpr uint8_t XON_XOFF_CHAR_SENT = 0x80, // XON / XOFF Character was sent + XON_XOFF_CHAR_MASK = 0x1F; // XON / XOFF character to send + + // XON / XOFF character definitions + static constexpr uint8_t XON_CHAR = 17, XOFF_CHAR = 19; + static uint8_t xon_xoff_state, + rx_dropped_bytes, + rx_buffer_overruns, + rx_framing_errors; + static ring_buffer_pos_t rx_max_enqueued; + + FORCE_INLINE static void store_rxd_char(); + FORCE_INLINE static void _tx_thr_empty_irq(void); + static void UART_ISR(void); public: MarlinSerial() {}; @@ -95,21 +122,10 @@ public: static void write(const uint8_t c); static void flushTX(void); - #if ENABLED(SERIAL_STATS_DROPPED_RX) - FORCE_INLINE static uint32_t dropped() { return rx_dropped_bytes; } - #endif - - #if ENABLED(SERIAL_STATS_RX_BUFFER_OVERRUNS) - FORCE_INLINE static uint32_t buffer_overruns() { return rx_buffer_overruns; } - #endif - - #if ENABLED(SERIAL_STATS_RX_FRAMING_ERRORS) - FORCE_INLINE static uint32_t framing_errors() { return rx_framing_errors; } - #endif - - #if ENABLED(SERIAL_STATS_MAX_RX_QUEUED) - FORCE_INLINE static ring_buffer_pos_t rxMaxEnqueued() { return rx_max_enqueued; } - #endif + FORCE_INLINE static uint8_t dropped() { return Cfg::DROPPED_RX ? rx_dropped_bytes : 0; } + FORCE_INLINE static uint8_t buffer_overruns() { return Cfg::RX_OVERRUNS ? rx_buffer_overruns : 0; } + FORCE_INLINE static uint8_t framing_errors() { return Cfg::RX_FRAMING_ERRORS ? rx_framing_errors : 0; } + FORCE_INLINE static ring_buffer_pos_t rxMaxEnqueued() { return Cfg::MAX_RX_QUEUED ? rx_max_enqueued : 0; } FORCE_INLINE static void write(const char* str) { while (*str) write(*str++); } FORCE_INLINE static void write(const uint8_t* buffer, size_t size) { while (size--) write(*buffer++); } @@ -141,8 +157,28 @@ private: static void printFloat(double, uint8_t); }; -extern MarlinSerial customizedSerial; +// Serial port configuration +template +struct MarlinSerialCfg { + static constexpr int PORT = serial; + static constexpr unsigned int RX_SIZE = RX_BUFFER_SIZE; + static constexpr unsigned int TX_SIZE = TX_BUFFER_SIZE; + static constexpr bool XONOFF = bSERIAL_XON_XOFF; + static constexpr bool EMERGENCYPARSER = bEMERGENCY_PARSER; + static constexpr bool DROPPED_RX = bSERIAL_STATS_DROPPED_RX; + static constexpr bool RX_OVERRUNS = bSERIAL_STATS_RX_BUFFER_OVERRUNS; + static constexpr bool RX_FRAMING_ERRORS = bSERIAL_STATS_RX_FRAMING_ERRORS; + static constexpr bool MAX_RX_QUEUED = bSERIAL_STATS_MAX_RX_QUEUED; +}; + +#if SERIAL_PORT >= 0 + + extern MarlinSerial> customizedSerial1; #endif // SERIAL_PORT >= 0 -#endif // MARLINSERIAL_DUE_H +#ifdef SERIAL_PORT_2 + + extern MarlinSerial> customizedSerial2; + +#endif diff --git a/Marlin/src/HAL/HAL_DUE/Servo_Due.cpp b/Marlin/src/HAL/HAL_DUE/Servo_Due.cpp index d2207d91aa..db1b3e39ba 100644 --- a/Marlin/src/HAL/HAL_DUE/Servo_Due.cpp +++ b/Marlin/src/HAL/HAL_DUE/Servo_Due.cpp @@ -76,14 +76,14 @@ void Servo_Handler(timer16_Sequence_t timer, Tc *tc, uint8_t channel) { tc->TC_CHANNEL[channel].TC_SR; if (Channel[timer] < 0) tc->TC_CHANNEL[channel].TC_CCR |= TC_CCR_SWTRG; // channel set to -1 indicated that refresh interval completed so reset the timer - else if (SERVO_INDEX(timer,Channel[timer]) < ServoCount && SERVO(timer,Channel[timer]).Pin.isActive) - digitalWrite(SERVO(timer,Channel[timer]).Pin.nbr, LOW); // pulse this channel low if activated + else if (SERVO_INDEX(timer, Channel[timer]) < ServoCount && SERVO(timer, Channel[timer]).Pin.isActive) + digitalWrite(SERVO(timer, Channel[timer]).Pin.nbr, LOW); // pulse this channel low if activated Channel[timer]++; // increment to the next channel if (SERVO_INDEX(timer, Channel[timer]) < ServoCount && Channel[timer] < SERVOS_PER_TIMER) { tc->TC_CHANNEL[channel].TC_RA = tc->TC_CHANNEL[channel].TC_CV + SERVO(timer,Channel[timer]).ticks; if (SERVO(timer,Channel[timer]).Pin.isActive) // check if activated - digitalWrite( SERVO(timer,Channel[timer]).Pin.nbr,HIGH); // its an active channel so pulse it high + digitalWrite(SERVO(timer, Channel[timer]).Pin.nbr, HIGH); // its an active channel so pulse it high } else { // finished all channels so wait for the refresh period to expire before starting over diff --git a/Marlin/src/HAL/HAL_DUE/Tone.cpp b/Marlin/src/HAL/HAL_DUE/Tone.cpp index 55c03f5e58..ff522fa3ab 100644 --- a/Marlin/src/HAL/HAL_DUE/Tone.cpp +++ b/Marlin/src/HAL/HAL_DUE/Tone.cpp @@ -27,6 +27,7 @@ #ifdef ARDUINO_ARCH_SAM +#include "../../inc/MarlinConfig.h" #include "HAL.h" #include "HAL_timers_Due.h" diff --git a/Marlin/src/HAL/HAL_DUE/endstop_interrupts.h b/Marlin/src/HAL/HAL_DUE/endstop_interrupts.h index a5c0df61bf..d026abfea6 100644 --- a/Marlin/src/HAL/HAL_DUE/endstop_interrupts.h +++ b/Marlin/src/HAL/HAL_DUE/endstop_interrupts.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Endstop Interrupts @@ -34,9 +35,6 @@ * (Located in Marlin/buildroot/share/pin_interrupt_test/pin_interrupt_test.ino) */ -#ifndef _ENDSTOP_INTERRUPTS_H_ -#define _ENDSTOP_INTERRUPTS_H_ - #include "../../module/endstops.h" // One ISR for all EXT-Interrupts @@ -82,5 +80,3 @@ void setup_endstop_interrupts(void) { attachInterrupt(digitalPinToInterrupt(Z_MIN_PROBE_PIN), endstop_ISR, CHANGE); #endif } - -#endif //_ENDSTOP_INTERRUPTS_H_ diff --git a/Marlin/src/HAL/HAL_DUE/fastio_Due.h b/Marlin/src/HAL/HAL_DUE/fastio_Due.h index bb25f45174..cb713122e7 100644 --- a/Marlin/src/HAL/HAL_DUE/fastio_Due.h +++ b/Marlin/src/HAL/HAL_DUE/fastio_Due.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Fast I/O Routines for SAM3X8E @@ -36,9 +37,6 @@ * leads to less efficient compiled code!! */ -#ifndef _FASTIO_DUE_H -#define _FASTIO_DUE_H - #include /** @@ -47,7 +45,7 @@ // Due has 12 PWMs assigned to logical pins 2-13. // 6, 7, 8 & 9 come from the PWM controller. The others come from the timers. -#define USEABLE_HARDWARE_PWM(p) ((2 <= p) && (p <= 13)) +#define USEABLE_HARDWARE_PWM(p) WITHIN(p, 2, 13) #ifndef MASK #define MASK(PIN) (1 << PIN) @@ -467,6 +465,9 @@ #define DIO107_PIN 10 #define DIO107_WPORT PIOB + + #define DIO108_PIN 9 + #define DIO108_WPORT PIOB #else #define DIO92_PIN 5 #define DIO92_WPORT PIOA @@ -495,5 +496,3 @@ #define DIO100_PIN 11 #define DIO100_WPORT PIOC #endif - -#endif // _FASTIO_DUE_H diff --git a/Marlin/src/HAL/HAL_DUE/persistent_store_eeprom.cpp b/Marlin/src/HAL/HAL_DUE/persistent_store_eeprom.cpp index fa611111d0..e7ff4f9c81 100644 --- a/Marlin/src/HAL/HAL_DUE/persistent_store_eeprom.cpp +++ b/Marlin/src/HAL/HAL_DUE/persistent_store_eeprom.cpp @@ -67,7 +67,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) { do { - uint8_t c = eeprom_read_byte((unsigned char*)pos); + uint8_t c = eeprom_read_byte((uint8_t*)pos); if (writing) *value = c; crc16(crc, &c, 1); pos++; diff --git a/Marlin/src/HAL/HAL_DUE/spi_pins.h b/Marlin/src/HAL/HAL_DUE/spi_pins.h index d0eb711df2..8f4f987155 100644 --- a/Marlin/src/HAL/HAL_DUE/spi_pins.h +++ b/Marlin/src/HAL/HAL_DUE/spi_pins.h @@ -19,9 +19,7 @@ * along with this program. If not, see . * */ - -#ifndef SPI_PINS_H_ -#define SPI_PINS_H_ +#pragma once /** * Define SPI Pins: SCK, MISO, MOSI, SS @@ -48,12 +46,16 @@ #else // defaults #define DUE_SOFTWARE_SPI - #define SCK_PIN 52 - #define MISO_PIN 50 - #define MOSI_PIN 51 + #ifndef SCK_PIN + #define SCK_PIN 52 + #endif + #ifndef MISO_PIN + #define MISO_PIN 50 + #endif + #ifndef MOSI_PIN + #define MOSI_PIN 51 + #endif #endif /* A.28, A.29, B.21, C.26, C.29 */ #define SS_PIN SDSS - -#endif /* SPI_PINS_H_ */ diff --git a/Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_shared_hw_spi.cpp b/Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_shared_hw_spi.cpp index 0dab3bb412..c62f6a06ec 100644 --- a/Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_shared_hw_spi.cpp +++ b/Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_shared_hw_spi.cpp @@ -60,7 +60,7 @@ #include "../../inc/MarlinConfigPre.h" -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD #include @@ -94,10 +94,8 @@ void u8g_SetPILevel_DUE_hw_spi(u8g_t *u8g, uint8_t pin_index, uint8_t level) { else port->PIO_CODR = mask; } -uint8_t u8g_com_HAL_DUE_shared_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) -{ - switch(msg) - { +uint8_t u8g_com_HAL_DUE_shared_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) { + switch(msg) { case U8G_COM_MSG_STOP: break; @@ -156,6 +154,6 @@ uint8_t u8g_com_HAL_DUE_shared_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_va return 1; } -#endif // DOGLCD +#endif // HAS_GRAPHICAL_LCD -#endif //__SAM3X8E__ +#endif //__SAM3X8E__ diff --git a/Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_st7920_sw_spi.cpp b/Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_st7920_sw_spi.cpp index 243033e68b..968f63241c 100644 --- a/Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_st7920_sw_spi.cpp +++ b/Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_st7920_sw_spi.cpp @@ -57,7 +57,7 @@ #include "../../inc/MarlinConfigPre.h" -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD #include #include @@ -180,6 +180,6 @@ uint8_t u8g_com_HAL_DUE_ST7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_va return 1; } -#endif // DOGLCD +#endif // HAS_GRAPHICAL_LCD #endif // ARDUINO_ARCH_SAM diff --git a/Marlin/src/HAL/HAL_DUE/usb/arduino_due_x.h b/Marlin/src/HAL/HAL_DUE/usb/arduino_due_x.h index c1434228cd..7355f74f6d 100644 --- a/Marlin/src/HAL/HAL_DUE/usb/arduino_due_x.h +++ b/Marlin/src/HAL/HAL_DUE/usb/arduino_due_x.h @@ -40,15 +40,12 @@ * \asf_license_stop * */ -/* +#pragma once + +/** * Support and FAQ: visit Atmel Support */ -#ifndef ARDUINO_DUE_X_H_INCLUDED -#define ARDUINO_DUE_X_H_INCLUDED - -/* ------------------------------------------------------------------------ */ - /** * \page arduino_due_x_opfreq "Arduino Due/X - Operating frequencies" * This page lists several definition related to the board operating frequency @@ -98,6 +95,3 @@ /*! Active level of the USB_VBOF output pin. */ #define USB_VBOF_ACTIVE_LEVEL LOW /* ------------------------------------------------------------------------ */ - - -#endif /* ARDUINO_DUE_X_H_INCLUDED */ diff --git a/Marlin/src/HAL/HAL_DUE/usb/compiler.h b/Marlin/src/HAL/HAL_DUE/usb/compiler.h index 43895381a2..d9ecd3f0fe 100644 --- a/Marlin/src/HAL/HAL_DUE/usb/compiler.h +++ b/Marlin/src/HAL/HAL_DUE/usb/compiler.h @@ -105,7 +105,7 @@ * \brief Marking \a v as a unused parameter or value. */ #ifndef UNUSED -#define UNUSED(x) (void) (x) + #define UNUSED(x) ((void)(x)) #endif /** diff --git a/Marlin/src/HAL/HAL_DUE/usb/conf_usb.h b/Marlin/src/HAL/HAL_DUE/usb/conf_usb.h index 604fd2019b..6934494e57 100644 --- a/Marlin/src/HAL/HAL_DUE/usb/conf_usb.h +++ b/Marlin/src/HAL/HAL_DUE/usb/conf_usb.h @@ -49,10 +49,10 @@ #undef UNUSED /* To avoid a macro clash as macros.h already defines it */ #include "../../../core/macros.h" /* For ENABLED()/DISABLED() */ +#include "../../../core/boards.h" /* For MB() */ #include "../../../../Configuration.h" /* For CUSTOM_MACHINE_NAME definition - We just need the name, no C++ allowed! */ #include "compiler.h" - /** * USB Device Configuration * @{ @@ -89,7 +89,11 @@ //#define USB_DEVICE_LOW_SPEED //! To define a Full speed device -//#define USB_DEVICE_FULL_SPEED +//#define USB_DEVICE_FULL_SPEED + +#if MB(ARCHIM1) + #define USB_DEVICE_FULL_SPEED +#endif //! To authorize the High speed #ifndef USB_DEVICE_FULL_SPEED diff --git a/Marlin/src/HAL/HAL_DUE/usb/sd_mmc_spi_mem.cpp b/Marlin/src/HAL/HAL_DUE/usb/sd_mmc_spi_mem.cpp index 4de46104e2..cdb81b2489 100644 --- a/Marlin/src/HAL/HAL_DUE/usb/sd_mmc_spi_mem.cpp +++ b/Marlin/src/HAL/HAL_DUE/usb/sd_mmc_spi_mem.cpp @@ -19,15 +19,17 @@ void sd_mmc_spi_mem_init(void) { } Ctrl_status sd_mmc_spi_test_unit_ready(void) { - if (!IS_SD_INSERTED || IS_SD_PRINTING || IS_SD_FILE_OPEN || !card.cardOK) + if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.flag.cardOK) return CTRL_NO_PRESENT; return CTRL_GOOD; } +// NOTE: This function is defined as returning the address of the last block +// in the card, which is cardSize() - 1 Ctrl_status sd_mmc_spi_read_capacity(uint32_t *nb_sector) { - if (!IS_SD_INSERTED || IS_SD_PRINTING || IS_SD_FILE_OPEN || !card.cardOK) + if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.flag.cardOK) return CTRL_NO_PRESENT; - *nb_sector = card.getSd2Card().cardSize(); + *nb_sector = card.getSd2Card().cardSize() - 1; return CTRL_GOOD; } @@ -40,7 +42,7 @@ bool sd_mmc_spi_wr_protect(void) { } bool sd_mmc_spi_removal(void) { - if (!IS_SD_INSERTED || IS_SD_PRINTING || IS_SD_FILE_OPEN || !card.cardOK) + if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.flag.cardOK) return true; return false; } @@ -59,7 +61,7 @@ uint8_t sector_buf[SD_MMC_BLOCK_SIZE]; // #define DEBUG_MMC Ctrl_status sd_mmc_spi_usb_read_10(uint32_t addr, uint16_t nb_sector) { - if (!IS_SD_INSERTED || IS_SD_PRINTING || IS_SD_FILE_OPEN || !card.cardOK) + if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.flag.cardOK) return CTRL_NO_PRESENT; #ifdef DEBUG_MMC @@ -93,7 +95,7 @@ Ctrl_status sd_mmc_spi_usb_read_10(uint32_t addr, uint16_t nb_sector) { } Ctrl_status sd_mmc_spi_usb_write_10(uint32_t addr, uint16_t nb_sector) { - if (!IS_SD_INSERTED || IS_SD_PRINTING || IS_SD_FILE_OPEN || !card.cardOK) + if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.flag.cardOK) return CTRL_NO_PRESENT; #ifdef DEBUG_MMC diff --git a/Marlin/src/HAL/HAL_DUE/watchdog_Due.h b/Marlin/src/HAL/HAL_DUE/watchdog_Due.h index 57120309a3..c75875e2ea 100644 --- a/Marlin/src/HAL/HAL_DUE/watchdog_Due.h +++ b/Marlin/src/HAL/HAL_DUE/watchdog_Due.h @@ -19,9 +19,7 @@ * along with this program. If not, see . * */ - -#ifndef WATCHDOG_DUE_H -#define WATCHDOG_DUE_H +#pragma once // Arduino Due core now has watchdog support @@ -33,5 +31,3 @@ void watchdog_init(); // Reset watchdog. MUST be called at least every 4 seconds after the // first watchdog_init or AVR will go into emergency procedures. inline void watchdog_reset() { watchdogReset(); } - -#endif // WATCHDOG_DUE_H diff --git a/Marlin/src/HAL/HAL_ESP32/HAL.h b/Marlin/src/HAL/HAL_ESP32/HAL.h index 106299295a..a9f9afbffc 100644 --- a/Marlin/src/HAL/HAL_ESP32/HAL.h +++ b/Marlin/src/HAL/HAL_ESP32/HAL.h @@ -16,14 +16,12 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#pragma once /** * Description: HAL for Espressif ESP32 WiFi */ -#ifndef _HAL_ESP32_H -#define _HAL_ESP32_H - #define CPU_32_BIT // -------------------------------------------------------------------------- @@ -98,8 +96,8 @@ int freeMemory(void); void analogWrite(int pin, int value); // EEPROM -void eeprom_write_byte(unsigned char *pos, unsigned char value); -unsigned char eeprom_read_byte(unsigned char *pos); +void eeprom_write_byte(uint8_t *pos, unsigned char value); +uint8_t eeprom_read_byte(uint8_t *pos); void eeprom_read_block (void *__dst, const void *__src, size_t __n); void eeprom_update_block (const void *__src, void *__dst, size_t __n); @@ -123,5 +121,3 @@ void HAL_adc_start_conversion (uint8_t adc_pin); #define HAL_INIT 1 void HAL_idletask(void); void HAL_init(void); - -#endif // _HAL_ESP32_H diff --git a/Marlin/src/HAL/HAL_ESP32/HAL_timers_ESP32.h b/Marlin/src/HAL/HAL_ESP32/HAL_timers_ESP32.h index a2d0c0b6db..e8afd83bb8 100644 --- a/Marlin/src/HAL/HAL_ESP32/HAL_timers_ESP32.h +++ b/Marlin/src/HAL/HAL_ESP32/HAL_timers_ESP32.h @@ -19,9 +19,7 @@ * along with this program. If not, see . * */ - -#ifndef _HAL_TIMERS_ESP32_H -#define _HAL_TIMERS_ESP32_H +#pragma once // -------------------------------------------------------------------------- // Includes @@ -104,5 +102,3 @@ bool HAL_timer_interrupt_enabled(const uint8_t timer_num); #define HAL_timer_isr_prologue(TIMER_NUM) #define HAL_timer_isr_epilogue(TIMER_NUM) - -#endif // _HAL_TIMERS_ESP32_H diff --git a/Marlin/src/HAL/HAL_ESP32/endstop_interrupts.h b/Marlin/src/HAL/HAL_ESP32/endstop_interrupts.h index bcc32db19a..9a325f30a7 100644 --- a/Marlin/src/HAL/HAL_ESP32/endstop_interrupts.h +++ b/Marlin/src/HAL/HAL_ESP32/endstop_interrupts.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Endstop Interrupts @@ -34,9 +35,6 @@ * (Located in Marlin/buildroot/share/pin_interrupt_test/pin_interrupt_test.ino) */ -#ifndef _ENDSTOP_INTERRUPTS_H_ -#define _ENDSTOP_INTERRUPTS_H_ - #include "../../module/endstops.h" // One ISR for all EXT-Interrupts @@ -77,5 +75,3 @@ void setup_endstop_interrupts(void) { attachInterrupt(digitalPinToInterrupt(Z_MIN_PROBE_PIN), endstop_ISR, CHANGE); #endif } - -#endif //_ENDSTOP_INTERRUPTS_H_ diff --git a/Marlin/src/HAL/HAL_ESP32/fastio_ESP32.h b/Marlin/src/HAL/HAL_ESP32/fastio_ESP32.h index 5f609c4f0c..8459a151cc 100644 --- a/Marlin/src/HAL/HAL_ESP32/fastio_ESP32.h +++ b/Marlin/src/HAL/HAL_ESP32/fastio_ESP32.h @@ -19,9 +19,7 @@ * along with this program. If not, see . * */ - -#ifndef _FASTIO_ESP32_H -#define _FASTIO_ESP32_H +#pragma once /** * Utility functions @@ -64,9 +62,3 @@ // TWI (I2C) #define SCL 5 #define SDA 4 - -// -// pins -// - -#endif // _FASTIO_ESP32_H diff --git a/Marlin/src/HAL/HAL_ESP32/ota.h b/Marlin/src/HAL/HAL_ESP32/ota.h index 4af2a74cab..0fa33b532e 100644 --- a/Marlin/src/HAL/HAL_ESP32/ota.h +++ b/Marlin/src/HAL/HAL_ESP32/ota.h @@ -16,11 +16,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - -#ifndef _HAL_OTA_H -#define _HAL_OTA_H +#pragma once void OTA_init(); void OTA_handle(); - -#endif diff --git a/Marlin/src/HAL/HAL_ESP32/spi_pins.h b/Marlin/src/HAL/HAL_ESP32/spi_pins.h index ecd58b9100..48e20a0442 100644 --- a/Marlin/src/HAL/HAL_ESP32/spi_pins.h +++ b/Marlin/src/HAL/HAL_ESP32/spi_pins.h @@ -16,13 +16,9 @@ * along with this program. If not, see . * */ - -#ifndef SPI_PINS_H_ -#define SPI_PINS_H_ +#pragma once #define SS_PIN 5 #define SCK_PIN 18 #define MISO_PIN 19 #define MOSI_PIN 23 - -#endif // SPI_PINS_H_ diff --git a/Marlin/src/HAL/HAL_ESP32/watchdog_ESP32.h b/Marlin/src/HAL/HAL_ESP32/watchdog_ESP32.h index 39f0287275..df80ebc84c 100644 --- a/Marlin/src/HAL/HAL_ESP32/watchdog_ESP32.h +++ b/Marlin/src/HAL/HAL_ESP32/watchdog_ESP32.h @@ -19,14 +19,10 @@ * along with this program. If not, see . * */ - -#ifndef WATCHDOG_ESP32_H -#define WATCHDOG_ESP32_H +#pragma once // Initialize watchdog with a 4 second interrupt time void watchdog_init(); // Reset watchdog. -inline void watchdog_reset() {}; - -#endif // WATCHDOG_ESP32_H +inline void watchdog_reset() { } diff --git a/Marlin/src/HAL/HAL_LPC1768/DebugMonitor_LPC1768.cpp b/Marlin/src/HAL/HAL_LPC1768/DebugMonitor_LPC1768.cpp new file mode 100644 index 0000000000..c992925bf0 --- /dev/null +++ b/Marlin/src/HAL/HAL_LPC1768/DebugMonitor_LPC1768.cpp @@ -0,0 +1,318 @@ +/** + * 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 . + * + */ + +#ifdef TARGET_LPC1768 + +#include "../../core/macros.h" +#include "../../core/serial.h" +#include + +#include "../shared/backtrace/unwinder.h" +#include "../shared/backtrace/unwmemaccess.h" +#include "watchdog.h" +#include + + +// Debug monitor that dumps to the Programming port all status when +// an exception or WDT timeout happens - And then resets the board + +// All the Monitor routines must run with interrupts disabled and +// under an ISR execution context. That is why we cannot reuse the +// Serial interrupt routines or any C runtime, as we don't know the +// state we are when running them + +// A SW memory barrier, to ensure GCC does not overoptimize loops +#define sw_barrier() __asm__ volatile("": : :"memory"); + +// (re)initialize UART0 as a monitor output to 250000,n,8,1 +static void TXBegin(void) { +} + +// Send character through UART with no interrupts +static void TX(char c) { + _DBC(c); +} + +// Send String through UART +static void TX(const char* s) { + while (*s) TX(*s++); +} + +static void TXDigit(uint32_t d) { + if (d < 10) TX((char)(d+'0')); + else if (d < 16) TX((char)(d+'A'-10)); + else TX('?'); +} + +// Send Hex number thru UART +static void TXHex(uint32_t v) { + TX("0x"); + for (uint8_t i = 0; i < 8; i++, v <<= 4) + TXDigit((v >> 28) & 0xF); +} + +// Send Decimal number thru UART +static void TXDec(uint32_t v) { + if (!v) { + TX('0'); + return; + } + + char nbrs[14]; + char *p = &nbrs[0]; + while (v != 0) { + *p++ = '0' + (v % 10); + v /= 10; + } + do { + p--; + TX(*p); + } while (p != &nbrs[0]); +} + +// Dump a backtrace entry +static bool UnwReportOut(void* ctx, const UnwReport* bte) { + int* p = (int*)ctx; + + (*p)++; + TX('#'); TXDec(*p); TX(" : "); + TX(bte->name?bte->name:"unknown"); TX('@'); TXHex(bte->function); + TX('+'); TXDec(bte->address - bte->function); + TX(" PC:");TXHex(bte->address); TX('\n'); + return true; +} + +#ifdef UNW_DEBUG + void UnwPrintf(const char* format, ...) { + char dest[256]; + va_list argptr; + va_start(argptr, format); + vsprintf(dest, format, argptr); + va_end(argptr); + TX(&dest[0]); + } +#endif + +/* Table of function pointers for passing to the unwinder */ +static const UnwindCallbacks UnwCallbacks = { + UnwReportOut, + UnwReadW, + UnwReadH, + UnwReadB + #ifdef UNW_DEBUG + ,UnwPrintf + #endif +}; + + +/** + * HardFaultHandler_C: + * This is called from the HardFault_HandlerAsm with a pointer the Fault stack + * as the parameter. We can then read the values from the stack and place them + * into local variables for ease of reading. + * We then read the various Fault Status and Address Registers to help decode + * cause of the fault. + * The function ends with a BKPT instruction to force control back into the debugger + */ +extern "C" +void HardFault_HandlerC(unsigned long *sp, unsigned long lr, unsigned long cause) { + + static const char* causestr[] = { + "NMI","Hard","Mem","Bus","Usage","Debug","WDT","RSTC" + }; + + UnwindFrame btf; + + // Dump report to the Programming port (interrupts are DISABLED) + TXBegin(); + TX("\n\n## Software Fault detected ##\n"); + TX("Cause: "); TX(causestr[cause]); TX('\n'); + + TX("R0 : "); TXHex(((unsigned long)sp[0])); TX('\n'); + TX("R1 : "); TXHex(((unsigned long)sp[1])); TX('\n'); + TX("R2 : "); TXHex(((unsigned long)sp[2])); TX('\n'); + TX("R3 : "); TXHex(((unsigned long)sp[3])); TX('\n'); + TX("R12 : "); TXHex(((unsigned long)sp[4])); TX('\n'); + TX("LR : "); TXHex(((unsigned long)sp[5])); TX('\n'); + TX("PC : "); TXHex(((unsigned long)sp[6])); TX('\n'); + TX("PSR : "); TXHex(((unsigned long)sp[7])); TX('\n'); + + // Configurable Fault Status Register + // Consists of MMSR, BFSR and UFSR + TX("CFSR : "); TXHex((*((volatile unsigned long *)(0xE000ED28)))); TX('\n'); + + // Hard Fault Status Register + TX("HFSR : "); TXHex((*((volatile unsigned long *)(0xE000ED2C)))); TX('\n'); + + // Debug Fault Status Register + TX("DFSR : "); TXHex((*((volatile unsigned long *)(0xE000ED30)))); TX('\n'); + + // Auxiliary Fault Status Register + TX("AFSR : "); TXHex((*((volatile unsigned long *)(0xE000ED3C)))); TX('\n'); + + // Read the Fault Address Registers. These may not contain valid values. + // Check BFARVALID/MMARVALID to see if they are valid values + // MemManage Fault Address Register + TX("MMAR : "); TXHex((*((volatile unsigned long *)(0xE000ED34)))); TX('\n'); + + // Bus Fault Address Register + TX("BFAR : "); TXHex((*((volatile unsigned long *)(0xE000ED38)))); TX('\n'); + + TX("ExcLR: "); TXHex(lr); TX('\n'); + TX("ExcSP: "); TXHex((unsigned long)sp); TX('\n'); + + btf.sp = ((unsigned long)sp) + 8*4; // The original stack pointer + btf.fp = btf.sp; + btf.lr = ((unsigned long)sp[5]); + btf.pc = ((unsigned long)sp[6]) | 1; // Force Thumb, as CORTEX only support it + + // Perform a backtrace + TX("\nBacktrace:\n\n"); + int ctr = 0; + UnwindStart(&btf, &UnwCallbacks, &ctr); + + // Disable all NVIC interrupts + NVIC->ICER[0] = 0xFFFFFFFF; + NVIC->ICER[1] = 0xFFFFFFFF; + + // Relocate VTOR table to default position + SCB->VTOR = 0; + + // Clear cause of reset to prevent entering smoothie bootstrap + HAL_clear_reset_source(); + // Restart watchdog + //WDT_Restart(WDT); + watchdog_init(); + + // Reset controller + NVIC_SystemReset(); + + while(1) { watchdog_init(); } +} + +extern "C" { +__attribute__((naked)) void NMI_Handler(void) { + __asm__ __volatile__ ( + ".syntax unified" "\n\t" + A("tst lr, #4") + A("ite eq") + A("mrseq r0, msp") + A("mrsne r0, psp") + A("mov r1,lr") + A("mov r2,#0") + A("b HardFault_HandlerC") + ); +} + +__attribute__((naked)) void HardFault_Handler(void) { + __asm__ __volatile__ ( + ".syntax unified" "\n\t" + A("tst lr, #4") + A("ite eq") + A("mrseq r0, msp") + A("mrsne r0, psp") + A("mov r1,lr") + A("mov r2,#1") + A("b HardFault_HandlerC") + ); +} + +__attribute__((naked)) void MemManage_Handler(void) { + __asm__ __volatile__ ( + ".syntax unified" "\n\t" + A("tst lr, #4") + A("ite eq") + A("mrseq r0, msp") + A("mrsne r0, psp") + A("mov r1,lr") + A("mov r2,#2") + A("b HardFault_HandlerC") + ); +} + +__attribute__((naked)) void BusFault_Handler(void) { + __asm__ __volatile__ ( + ".syntax unified" "\n\t" + A("tst lr, #4") + A("ite eq") + A("mrseq r0, msp") + A("mrsne r0, psp") + A("mov r1,lr") + A("mov r2,#3") + A("b HardFault_HandlerC") + ); +} + +__attribute__((naked)) void UsageFault_Handler(void) { + __asm__ __volatile__ ( + ".syntax unified" "\n\t" + A("tst lr, #4") + A("ite eq") + A("mrseq r0, msp") + A("mrsne r0, psp") + A("mov r1,lr") + A("mov r2,#4") + A("b HardFault_HandlerC") + ); +} + +__attribute__((naked)) void DebugMon_Handler(void) { + __asm__ __volatile__ ( + ".syntax unified" "\n\t" + A("tst lr, #4") + A("ite eq") + A("mrseq r0, msp") + A("mrsne r0, psp") + A("mov r1,lr") + A("mov r2,#5") + A("b HardFault_HandlerC") + ); +} + +/* This is NOT an exception, it is an interrupt handler - Nevertheless, the framing is the same */ +__attribute__((naked)) void WDT_IRQHandler(void) { + __asm__ __volatile__ ( + ".syntax unified" "\n\t" + A("tst lr, #4") + A("ite eq") + A("mrseq r0, msp") + A("mrsne r0, psp") + A("mov r1,lr") + A("mov r2,#6") + A("b HardFault_HandlerC") + ); +} + +__attribute__((naked)) void RSTC_Handler(void) { + __asm__ __volatile__ ( + ".syntax unified" "\n\t" + A("tst lr, #4") + A("ite eq") + A("mrseq r0, msp") + A("mrsne r0, psp") + A("mov r1,lr") + A("mov r2,#7") + A("b HardFault_HandlerC") + ); +} +} +#endif // TARGET_LPC1768 diff --git a/Marlin/src/HAL/HAL_LPC1768/HAL.cpp b/Marlin/src/HAL/HAL_LPC1768/HAL.cpp index aec9b4ce73..020a1660b3 100644 --- a/Marlin/src/HAL/HAL_LPC1768/HAL.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/HAL.cpp @@ -22,8 +22,7 @@ #include "../../inc/MarlinConfig.h" #include "../shared/Delay.h" - -HalSerial usb_serial; +#include "../../../gcode/parser.h" // U8glib required functions extern "C" void u8g_xMicroDelay(uint16_t val) { @@ -51,231 +50,11 @@ int freeMemory() { return result; } -// -------------------------------------------------------------------------- -// ADC -// -------------------------------------------------------------------------- - -#define ADC_DONE 0x80000000 -#define ADC_OVERRUN 0x40000000 - -void HAL_adc_init(void) { - LPC_SC->PCONP |= (1 << 12); // Enable CLOCK for internal ADC controller - LPC_SC->PCLKSEL0 &= ~(0x3 << 24); - LPC_SC->PCLKSEL0 |= (0x1 << 24); // 0: 25MHz, 1: 100MHz, 2: 50MHz, 3: 12.5MHZ to ADC clock divider - LPC_ADC->ADCR = (0 << 0) // SEL: 0 = no channels selected - | (0xFF << 8) // select slowest clock for A/D conversion 150 - 190 uS for a complete conversion - | (0 << 16) // BURST: 0 = software control - | (0 << 17) // CLKS: not applicable - | (1 << 21) // PDN: 1 = operational - | (0 << 24) // START: 0 = no start - | (0 << 27); // EDGE: not applicable -} - -// externals need to make the call to KILL compile -#include "../../core/language.h" - -extern void kill(const char*); -extern const char errormagic[]; - -void HAL_adc_enable_channel(int ch) { - pin_t pin = analogInputToDigitalPin(ch); - - if (pin == -1) { - SERIAL_PRINTF("%sINVALID ANALOG PORT:%d\n", errormagic, ch); - kill(MSG_KILLED); - } - - int8_t pin_port = LPC1768_PIN_PORT(pin), - pin_port_pin = LPC1768_PIN_PIN(pin), - pinsel_start_bit = pin_port_pin > 15 ? 2 * (pin_port_pin - 16) : 2 * pin_port_pin; - uint8_t pin_sel_register = (pin_port == 0 && pin_port_pin <= 15) ? 0 : - pin_port == 0 ? 1 : - pin_port == 1 ? 3 : 10; - - switch (pin_sel_register) { - case 1: - LPC_PINCON->PINSEL1 &= ~(0x3 << pinsel_start_bit); - LPC_PINCON->PINSEL1 |= (0x1 << pinsel_start_bit); - break; - case 3: - LPC_PINCON->PINSEL3 &= ~(0x3 << pinsel_start_bit); - LPC_PINCON->PINSEL3 |= (0x3 << pinsel_start_bit); - break; - case 0: - LPC_PINCON->PINSEL0 &= ~(0x3 << pinsel_start_bit); - LPC_PINCON->PINSEL0 |= (0x2 << pinsel_start_bit); - break; - }; -} - -void HAL_adc_start_conversion(const uint8_t ch) { - if (analogInputToDigitalPin(ch) == -1) { - SERIAL_PRINTF("HAL: HAL_adc_start_conversion: invalid channel %d\n", ch); - return; - } - - LPC_ADC->ADCR &= ~0xFF; // Reset - SBI(LPC_ADC->ADCR, ch); // Select Channel - SBI(LPC_ADC->ADCR, 24); // Start conversion -} - -bool HAL_adc_finished(void) { - return LPC_ADC->ADGDR & ADC_DONE; -} - -// possible config options if something similar is extended to more platforms. -#define ADC_USE_MEDIAN_FILTER // Filter out erroneous readings -#define ADC_MEDIAN_FILTER_SIZE 23 // Higher values increase step delay (phase shift), - // (ADC_MEDIAN_FILTER_SIZE + 1) / 2 sample step delay (12 samples @ 500Hz: 24ms phase shift) - // Memory usage per ADC channel (bytes): (6 * ADC_MEDIAN_FILTER_SIZE) + 16 - // 8 * ((6 * 23) + 16 ) = 1232 Bytes for 8 channels - -#define ADC_USE_LOWPASS_FILTER // Filter out high frequency noise -#define ADC_LOWPASS_K_VALUE 6 // Higher values increase rise time - // Rise time sample delays for 100% signal convergence on full range step - // (1 : 13, 2 : 32, 3 : 67, 4 : 139, 5 : 281, 6 : 565, 7 : 1135, 8 : 2273) - // K = 6, 565 samples, 500Hz sample rate, 1.13s convergence on full range step - // Memory usage per ADC channel (bytes): 4 (32 Bytes for 8 channels) - - -// Sourced from https://embeddedgurus.com/stack-overflow/tag/median-filter/ -struct MedianFilter { - #define STOPPER 0 // Smaller than any datum - struct Pair { - Pair *point; // Pointers forming list linked in sorted order - uint16_t value; // Values to sort - }; - - Pair buffer[ADC_MEDIAN_FILTER_SIZE] = {}; // Buffer of nwidth pairs - Pair *datpoint = buffer; // Pointer into circular buffer of data - Pair small = {NULL, STOPPER}; // Chain stopper - Pair big = {&small, 0}; // Pointer to head (largest) of linked list. - - uint16_t update(uint16_t datum) { - Pair *successor; // Pointer to successor of replaced data item - Pair *scan; // Pointer used to scan down the sorted list - Pair *scanold; // Previous value of scan - Pair *median; // Pointer to median - uint16_t i; - - if (datum == STOPPER) { - datum = STOPPER + 1; // No stoppers allowed. - } - - if ( (++datpoint - buffer) >= (ADC_MEDIAN_FILTER_SIZE)) { - datpoint = buffer; // Increment and wrap data in pointer. - } - - datpoint->value = datum; // Copy in new datum - successor = datpoint->point; // Save pointer to old value's successor - median = &big; // Median initially to first in chain - scanold = NULL; // Scanold initially null. - scan = &big; // Points to pointer to first (largest) datum in chain - - // Handle chain-out of first item in chain as special case - if (scan->point == datpoint) { - scan->point = successor; - } - scanold = scan; // Save this pointer and - scan = scan->point ; // step down chain - - // Loop through the chain, normal loop exit via break. - for (i = 0 ; i < ADC_MEDIAN_FILTER_SIZE; ++i) { - // Handle odd-numbered item in chain - if (scan->point == datpoint) { - scan->point = successor; // Chain out the old datum - } - - if (scan->value < datum) { // If datum is larger than scanned value - datpoint->point = scanold->point; // Chain it in here - scanold->point = datpoint; // Mark it chained in - datum = STOPPER; - } - - // Step median pointer down chain after doing odd-numbered element - median = median->point; // Step median pointer - if (scan == &small) { - break; // Break at end of chain - } - scanold = scan; // Save this pointer and - scan = scan->point; // step down chain - - // Handle even-numbered item in chain. - if (scan->point == datpoint) { - scan->point = successor; - } - - if (scan->value < datum) { - datpoint->point = scanold->point; - scanold->point = datpoint; - datum = STOPPER; - } - - if (scan == &small) { - break; - } - - scanold = scan; - scan = scan->point; - } - return median->value; - } -}; - -struct LowpassFilter { - uint32_t data_delay = 0; - uint16_t update(const uint16_t value) { - data_delay -= (data_delay >> (ADC_LOWPASS_K_VALUE)) - value; - return (uint16_t)(data_delay >> (ADC_LOWPASS_K_VALUE)); - } -}; - -uint16_t HAL_adc_get_result(void) { - uint32_t adgdr = LPC_ADC->ADGDR; - CBI(LPC_ADC->ADCR, 24); // Stop conversion - - if (adgdr & ADC_OVERRUN) return 0; - uint16_t data = (adgdr >> 4) & 0xFFF; // copy the 12bit data value - uint8_t adc_channel = (adgdr >> 24) & 0x7; // copy the 3bit used channel - - #ifdef ADC_USE_MEDIAN_FILTER - static MedianFilter median_filter[NUM_ANALOG_INPUTS]; - data = median_filter[adc_channel].update(data); - #endif - - #ifdef ADC_USE_LOWPASS_FILTER - static LowpassFilter lowpass_filter[NUM_ANALOG_INPUTS]; - data = lowpass_filter[adc_channel].update(data); - #endif - - return ((data >> 2) & 0x3FF); // return 10bit value as Marlin expects -} - -#define SBIT_CNTEN 0 -#define SBIT_PWMEN 2 -#define SBIT_PWMMR0R 1 - -#define PWM_1 0 //P2_00 (0-1 Bits of PINSEL4) -#define PWM_2 2 //P2_01 (2-3 Bits of PINSEL4) -#define PWM_3 4 //P2_02 (4-5 Bits of PINSEL4) -#define PWM_4 6 //P2_03 (6-7 Bits of PINSEL4) -#define PWM_5 8 //P2_04 (8-9 Bits of PINSEL4) -#define PWM_6 10 //P2_05 (10-11 Bits of PINSEL4) - -void HAL_pwm_init(void) { - LPC_PINCON->PINSEL4 = _BV(PWM_5) | _BV(PWM_6); - - LPC_PWM1->TCR = _BV(SBIT_CNTEN) | _BV(SBIT_PWMEN); - LPC_PWM1->PR = 0x0; // No prescalar - LPC_PWM1->MCR = _BV(SBIT_PWMMR0R); // Reset on PWMMR0, reset TC if it matches MR0 - LPC_PWM1->MR0 = 255; // set PWM cycle(Ton+Toff)=255) - LPC_PWM1->MR5 = 0; // Set 50% Duty Cycle for the channels - LPC_PWM1->MR6 = 0; - - // Trigger the latch Enable Bits to load the new Match Values MR0, MR5, MR6 - LPC_PWM1->LER = _BV(0) | _BV(5) | _BV(6); - // Enable the PWM output pins for PWM_5-PWM_6(P2_04 - P2_05) - LPC_PWM1->PCR = _BV(13) | _BV(14); +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; } #endif // TARGET_LPC1768 diff --git a/Marlin/src/HAL/HAL_LPC1768/HAL.h b/Marlin/src/HAL/HAL_LPC1768/HAL.h index 1447b45d6e..689105f109 100644 --- a/Marlin/src/HAL/HAL_LPC1768/HAL.h +++ b/Marlin/src/HAL/HAL_LPC1768/HAL.h @@ -19,52 +19,35 @@ * along with this program. If not, see . * */ +#pragma once /** * HAL_LPC1768/HAL.h * Hardware Abstraction Layer for NXP LPC1768 */ -#ifndef _HAL_LPC1768_H_ -#define _HAL_LPC1768_H_ - #define CPU_32_BIT +#define HAL_INIT -// -------------------------------------------------------------------------- -// Includes -// -------------------------------------------------------------------------- +void HAL_init(); #include #include - -#undef min -#undef max - #include -void _printf (const char *format, ...); -void _putc(uint8_t c); -uint8_t _getc(); - -extern "C" volatile uint32_t _millis; - -//arduino: Print.h -#define DEC 10 -#define HEX 16 -#define OCT 8 -#define BIN 2 -//arduino: binary.h (weird defines) -#define B01 1 -#define B10 2 +extern "C" volatile millis_t _millis; #include #include +#include #include "../shared/math_32bit.h" #include "../shared/HAL_SPI.h" #include "fastio.h" +#include #include "watchdog.h" #include "HAL_timers.h" +#include "MarlinSerial.h" // // Default graphical display delays @@ -79,32 +62,20 @@ extern "C" volatile uint32_t _millis; #define ST7920_DELAY_3 DELAY_NS(750) #endif -// -// Arduino-style serial ports -// -#include "serial.h" -#include "HardwareSerial.h" - -extern HalSerial usb_serial; - #if !WITHIN(SERIAL_PORT, -1, 3) #error "SERIAL_PORT must be from -1 to 3" #endif #if SERIAL_PORT == -1 - #define MYSERIAL0 usb_serial + #define MYSERIAL0 UsbSerial #elif SERIAL_PORT == 0 - extern HardwareSerial Serial; - #define MYSERIAL0 Serial + #define MYSERIAL0 MSerial #elif SERIAL_PORT == 1 - extern HardwareSerial Serial1; - #define MYSERIAL0 Serial1 + #define MYSERIAL0 MSerial1 #elif SERIAL_PORT == 2 - extern HardwareSerial Serial2; - #define MYSERIAL0 Serial2 + #define MYSERIAL0 MSerial2 #elif SERIAL_PORT == 3 - #define MYSERIAL0 Serial3 - extern HardwareSerial Serial3; + #define MYSERIAL0 MSerial3 #endif #ifdef SERIAL_PORT_2 @@ -115,19 +86,15 @@ extern HalSerial usb_serial; #endif #define NUM_SERIAL 2 #if SERIAL_PORT_2 == -1 - #define MYSERIAL1 usb_serial + #define MYSERIAL1 UsbSerial #elif SERIAL_PORT_2 == 0 - extern HardwareSerial Serial; - #define MYSERIAL1 Serial + #define MYSERIAL1 MSerial #elif SERIAL_PORT_2 == 1 - extern HardwareSerial Serial1; - #define MYSERIAL1 Serial1 + #define MYSERIAL1 MSerial1 #elif SERIAL_PORT_2 == 2 - extern HardwareSerial Serial2; - #define MYSERIAL1 Serial2 + #define MYSERIAL1 MSerial2 #elif SERIAL_PORT_2 == 3 - extern HardwareSerial Serial3; - #define MYSERIAL1 Serial3 + #define MYSERIAL1 MSerial3 #endif #else #define NUM_SERIAL 1 @@ -159,17 +126,31 @@ void spiSend(uint32_t chan, const uint8_t* buf, size_t n); uint8_t spiRec(uint32_t chan); // -// ADC +// ADC API // -#define HAL_ANALOG_SELECT(pin) HAL_adc_enable_channel(pin) -#define HAL_START_ADC(pin) HAL_adc_start_conversion(pin) -#define HAL_READ_ADC() HAL_adc_get_result() -#define HAL_ADC_READY() HAL_adc_finished() -void HAL_adc_init(void); -void HAL_adc_enable_channel(int pin); -void HAL_adc_start_conversion(const uint8_t adc_pin); -uint16_t HAL_adc_get_result(void); -bool HAL_adc_finished(void); +#define ADC_MEDIAN_FILTER_SIZE (23) // Higher values increase step delay (phase shift), + // (ADC_MEDIAN_FILTER_SIZE + 1) / 2 sample step delay (12 samples @ 500Hz: 24ms phase shift) + // Memory usage per ADC channel (bytes): (6 * ADC_MEDIAN_FILTER_SIZE) + 16 + // 8 * ((6 * 23) + 16 ) = 1232 Bytes for 8 channels -#endif // _HAL_LPC1768_H_ +#define ADC_LOWPASS_K_VALUE (6) // Higher values increase rise time + // Rise time sample delays for 100% signal convergence on full range step + // (1 : 13, 2 : 32, 3 : 67, 4 : 139, 5 : 281, 6 : 565, 7 : 1135, 8 : 2273) + // K = 6, 565 samples, 500Hz sample rate, 1.13s convergence on full range step + // Memory usage per ADC channel (bytes): 4 (32 Bytes for 8 channels) + +using FilteredADC = LPC176x::ADC; +#define HAL_adc_init() FilteredADC::init() +#define HAL_ANALOG_SELECT(pin) FilteredADC::enable_channel(pin) +#define HAL_START_ADC(pin) FilteredADC::start_conversion(pin) +#define HAL_READ_ADC() FilteredADC::get_result() +#define HAL_ADC_READY() FilteredADC::finished_conversion() + +// Parse a G-code word into a pin index +int16_t PARSED_PIN_INDEX(const char code, const int16_t dval); +// P0.6 thru P0.9 are for the onboard SD card +#define HAL_SENSITIVE_PINS P0_06, P0_07, P0_08, P0_09 + +#define HAL_IDLETASK 1 +void HAL_idletask(void); diff --git a/Marlin/src/HAL/HAL_LPC1768/HAL_spi.cpp b/Marlin/src/HAL/HAL_LPC1768/HAL_spi.cpp index c8fe029d39..2765bb553a 100644 --- a/Marlin/src/HAL/HAL_LPC1768/HAL_spi.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/HAL_spi.cpp @@ -49,7 +49,6 @@ #ifdef TARGET_LPC1768 #include "../../inc/MarlinConfig.h" - // -------------------------------------------------------------------------- // Includes // -------------------------------------------------------------------------- @@ -59,7 +58,6 @@ // -------------------------------------------------------------------------- // Public functions // -------------------------------------------------------------------------- - #if ENABLED(LPC_SOFTWARE_SPI) #include "SoftwareSPI.h" @@ -127,8 +125,25 @@ #include #include - void spiBegin() { // setup SCK, MOSI & MISO pins for SSP0 + // decide which HW SPI device to use + #ifndef LPC_HW_SPI_DEV + #if (SCK_PIN == P0_07 && MISO_PIN == P0_08 && MOSI_PIN == P0_09) + #define LPC_HW_SPI_DEV 1 + #else + #if (SCK_PIN == P0_15 && MISO_PIN == P0_17 && MOSI_PIN == P0_18) + #define LPC_HW_SPI_DEV 0 + #else + #error "Invalid pins selected for hardware SPI" + #endif + #endif + #endif + #if (LPC_HW_SPI_DEV == 0) + #define LPC_SSPn LPC_SSP0 + #else + #define LPC_SSPn LPC_SSP1 + #endif + void spiBegin() { // setup SCK, MOSI & MISO pins for SSP0 PINSEL_CFG_Type PinCfg; // data structure to hold init values PinCfg.Funcnum = 2; PinCfg.OpenDrain = 0; @@ -147,10 +162,13 @@ PinCfg.Portnum = LPC1768_PIN_PORT(MOSI_PIN); PINSEL_ConfigPin(&PinCfg); SET_OUTPUT(MOSI_PIN); + // divide PCLK by 2 for SSP0 + CLKPWR_SetPCLKDiv(LPC_HW_SPI_DEV == 0 ? CLKPWR_PCLKSEL_SSP0 : CLKPWR_PCLKSEL_SSP1, CLKPWR_PCLKSEL_CCLK_DIV_2); + spiInit(0); + SSP_Cmd(LPC_SSPn, ENABLE); // start SSP running } void spiInit(uint8_t spiRate) { - SSP_Cmd(LPC_SSP0, DISABLE); // Disable SSP0 before changing rate // table to convert Marlin spiRates (0-5 plus default) into bit rates uint32_t Marlin_speed[7]; // CPSR is always 2 Marlin_speed[0] = 8333333; //(SCR: 2) desired: 8,000,000 actual: 8,333,333 +4.2% SPI_FULL_SPEED @@ -160,33 +178,32 @@ Marlin_speed[4] = 500000; //(SCR: 49) desired: 500,000 actual: 500,000 SPI_SPEED_5 Marlin_speed[5] = 250000; //(SCR: 99) desired: 250,000 actual: 250,000 SPI_SPEED_6 Marlin_speed[6] = 125000; //(SCR:199) desired: 125,000 actual: 125,000 Default from HAL.h - - // divide PCLK by 2 for SSP0 - CLKPWR_SetPCLKDiv(CLKPWR_PCLKSEL_SSP0, CLKPWR_PCLKSEL_CCLK_DIV_2); - // setup for SPI mode SSP_CFG_Type HW_SPI_init; // data structure to hold init values SSP_ConfigStructInit(&HW_SPI_init); // set values for SPI mode HW_SPI_init.ClockRate = Marlin_speed[MIN(spiRate, 6)]; // put in the specified bit rate - SSP_Init(LPC_SSP0, &HW_SPI_init); // puts the values into the proper bits in the SSP0 registers + HW_SPI_init.Mode |= SSP_CR1_SSP_EN; + SSP_Init(LPC_SSPn, &HW_SPI_init); // puts the values into the proper bits in the SSP0 registers + } - SSP_Cmd(LPC_SSP0, ENABLE); // start SSP0 running + + static uint8_t doio(uint8_t b) { + /* send and receive a single byte */ + SSP_SendData(LPC_SSPn, b & 0x00FF); + while (SSP_GetStatus(LPC_SSPn, SSP_STAT_BUSY)); // wait for it to finish + return SSP_ReceiveData(LPC_SSPn) & 0x00FF; } void spiSend(uint8_t b) { - while (!SSP_GetStatus(LPC_SSP0, SSP_STAT_TXFIFO_NOTFULL)); // wait for room in the buffer - SSP_SendData(LPC_SSP0, b & 0x00FF); - while (SSP_GetStatus(LPC_SSP0, SSP_STAT_BUSY)); // wait for it to finish + doio(b); } void spiSend(const uint8_t* buf, size_t n) { if (n == 0) return; for (uint16_t i = 0; i < n; i++) { - while (!SSP_GetStatus(LPC_SSP0, SSP_STAT_TXFIFO_NOTFULL)); // wait for room in the buffer - SSP_SendData(LPC_SSP0, buf[i] & 0x00FF); + doio(buf[i]); } - while (SSP_GetStatus(LPC_SSP0, SSP_STAT_BUSY)); // wait for it to finish } void spiSend(uint32_t chan, byte b) { @@ -195,17 +212,9 @@ void spiSend(uint32_t chan, const uint8_t* buf, size_t n) { } - static uint8_t get_one_byte() { - // send a dummy byte so can clock in receive data - SSP_SendData(LPC_SSP0,0x00FF); - while (SSP_GetStatus(LPC_SSP0, SSP_STAT_BUSY)); // wait for it to finish - return SSP_ReceiveData(LPC_SSP0) & 0x00FF; - } - // Read single byte from SPI uint8_t spiRec() { - while (SSP_GetStatus(LPC_SSP0, SSP_STAT_RXFIFO_NOTEMPTY) || SSP_GetStatus(LPC_SSP0, SSP_STAT_BUSY)) SSP_ReceiveData(LPC_SSP0); //flush the receive buffer - return get_one_byte(); + return doio(0xff); } uint8_t spiRec(uint32_t chan) { @@ -214,22 +223,25 @@ // Read from SPI into buffer void spiRead(uint8_t*buf, uint16_t nbyte) { - while (SSP_GetStatus(LPC_SSP0, SSP_STAT_RXFIFO_NOTEMPTY) || SSP_GetStatus(LPC_SSP0, SSP_STAT_BUSY)) SSP_ReceiveData(LPC_SSP0); //flush the receive buffer if (nbyte == 0) return; for (int i = 0; i < nbyte; i++) { - buf[i] = get_one_byte(); + buf[i] = doio(0xff); } } static uint8_t spiTransfer(uint8_t b) { - while (SSP_GetStatus(LPC_SSP0, SSP_STAT_RXFIFO_NOTEMPTY) || SSP_GetStatus(LPC_SSP0, SSP_STAT_BUSY)) SSP_ReceiveData(LPC_SSP0); //flush the receive buffer - SSP_SendData(LPC_SSP0, b); // send the byte - while (SSP_GetStatus(LPC_SSP0, SSP_STAT_BUSY)); // wait for it to finish - return SSP_ReceiveData(LPC_SSP0) & 0x00FF; + return doio(b); } // Write from buffer to SPI void spiSendBlock(uint8_t token, const uint8_t* buf) { + uint8_t response; + response = spiTransfer(token); + + for (uint16_t i = 0; i < 512; i++) { + response = spiTransfer(buf[i]); + } + UNUSED(response); } /** Begin SPI transaction, set clock, bit order, data mode */ @@ -270,4 +282,3 @@ uint16_t SPIClass::transfer16(uint16_t data) { SPIClass SPI; #endif // TARGET_LPC1768 - diff --git a/Marlin/src/HAL/HAL_LPC1768/HAL_temp.h b/Marlin/src/HAL/HAL_LPC1768/HAL_temp.h deleted file mode 100644 index 20d2cf8d05..0000000000 --- a/Marlin/src/HAL/HAL_LPC1768/HAL_temp.h +++ /dev/null @@ -1 +0,0 @@ -// blank file needed until I get platformio to update it's copy of U8Glib-HAL \ No newline at end of file diff --git a/Marlin/src/HAL/HAL_LPC1768/HAL_timers.h b/Marlin/src/HAL/HAL_LPC1768/HAL_timers.h index 4257028fc6..360a0f5c21 100644 --- a/Marlin/src/HAL/HAL_LPC1768/HAL_timers.h +++ b/Marlin/src/HAL/HAL_LPC1768/HAL_timers.h @@ -18,16 +18,13 @@ * along with this program. If not, see . * */ +#pragma once /** - * HAL for Arduino Due and compatible (SAM3X8E) * - * For ARDUINO_ARCH_SAM + * HAL For LPC1768 */ -#ifndef _HAL_TIMERS_H -#define _HAL_TIMERS_H - // -------------------------------------------------------------------------- // Includes // -------------------------------------------------------------------------- @@ -167,5 +164,3 @@ FORCE_INLINE static void HAL_timer_isr_prologue(const uint8_t timer_num) { } #define HAL_timer_isr_epilogue(TIMER_NUM) - -#endif // _HAL_TIMERS_H diff --git a/Marlin/src/HAL/HAL_LPC1768/LPC1768_PWM.cpp b/Marlin/src/HAL/HAL_LPC1768/LPC1768_PWM.cpp deleted file mode 100644 index b27d8e1f31..0000000000 --- a/Marlin/src/HAL/HAL_LPC1768/LPC1768_PWM.cpp +++ /dev/null @@ -1,576 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * Copyright (C) 2017 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 . - * - */ - -/** - * The class Servo uses the PWM class to implement its functions - * - * All PWMs use the same repetition rate - 20mS because that's the normal servo rate - */ - -/** - * This is a hybrid system. - * - * The PWM1 module is used to directly control the Servo 0, 1 & 3 pins and D9 & D10 pins. This keeps - * the pulse width jitter to under a microsecond. - * - * For all other pins a timer is used to generate interrupts. The ISR - * routine does the actual setting/clearing of pins. The upside is that any pin can - * have a PWM channel assigned to it. The downside is that there is more pulse width - * jitter. The jitter depends on what else is happening in the system and what ISRs - * pre-empt the PWM ISR. - */ - -/** - * The data structures are set up to minimize the computation done by the ISR which - * minimizes ISR execution time. Execution times are 5-14µs depending on how full the - * ISR table is. 14uS is for a 20 element ISR table. - * - * Two tables are used. One table contains the data used by the ISR to update/control - * the PWM pins. The other is used as an aid when updating the ISR table. - * - * See the end of this file for details on the hardware/firmware interaction - */ - -/** - * Directly controlled PWM pins ( - * NA means not being used as a directly controlled PWM pin - * - * Re-ARM MKS Sbase - * PWM1.1 P1_18 SERVO3_PIN NA(no connection) - * PWM1.1 P2_00 NA(E0_STEP_PIN) NA(X stepper) - * PWM1.2 P1_20 SERVO0_PIN NA(no connection) - * PWM1.2 P2_01 NA(X_STEP_PIN) NA(Y stepper) - * PWM1.3 P1_21 SERVO1_PIN NA(no connection) - * PWM1.3 P2_02 NA(Y_STEP_PIN) NA(Z stepper) - * PWM1.4 P1_23 NA(SDSS(SSEL0)) SERVO0_PIN - * PWM1.4 P2_03 NA(Z_STEP_PIN) NA(E0 stepper) - * PWM1.5 P1_24 NA(X_MIN_PIN) NA(X_MIN_pin) - * PWM1.5 P2_04 RAMPS_D9_PIN FAN_PIN - * PWM1.6 P1_26 NA(Y_MIN_PIN) NA(Y_MIN_pin) - * PWM1.6 P2_05 RAMPS_D10_PIN HEATER_BED_PIN - */ - -#ifdef TARGET_LPC1768 - -#include "../../inc/MarlinConfig.h" -#include -#include "LPC1768_PWM.h" -#include - -#define NUM_ISR_PWMS 20 - -#define HAL_PWM_TIMER LPC_TIM3 -#define HAL_PWM_TIMER_ISR extern "C" void TIMER3_IRQHandler(void) -#define HAL_PWM_TIMER_IRQn TIMER3_IRQn - -#define LPC_PORT_OFFSET (0x0020) -#define LPC_PIN(pin) (1UL << pin) -#define LPC_GPIO(port) ((volatile LPC_GPIO_TypeDef *)(LPC_GPIO0_BASE + LPC_PORT_OFFSET * port)) - -typedef struct { // holds all data needed to control/init one of the PWM channels - bool active_flag; // THIS TABLE ENTRY IS ACTIVELY TOGGLING A PIN - pin_t pin; - volatile uint32_t* set_register; - volatile uint32_t* clr_register; - uint32_t write_mask; // USED BY SET/CLEAR COMMANDS - uint32_t microseconds; // value written to MR register - uint32_t min; // lower value limit checked by WRITE routine before writing to the MR register - uint32_t max; // upper value limit checked by WRITE routine before writing to the MR register - uint8_t servo_index; // 0 - MAX_SERVO -1 : servo index, 0xFF : PWM channel -} PWM_map; - -PWM_map PWM1_map_A[NUM_ISR_PWMS]; // compiler will initialize to all zeros -PWM_map PWM1_map_B[NUM_ISR_PWMS]; // compiler will initialize to all zeros - -PWM_map *active_table = PWM1_map_A; -PWM_map *work_table = PWM1_map_B; -PWM_map *temp_table; - -#define P1_18_PWM_channel 1 // servo 3 -#define P1_20_PWM_channel 2 // servo 0 -#define P1_21_PWM_channel 3 // servo 1 -#define P1_23_PWM_channel 4 // servo 0 for MKS Sbase -#define P2_04_PWM_channel 5 // D9 -#define P2_05_PWM_channel 6 // D10 - -typedef struct { - uint32_t min; - uint32_t max; - bool assigned; -} table_direct; - -table_direct direct_table[6]; // compiler will initialize to all zeros - -/** - * Prescale register and MR0 register values - * - * 100MHz PCLK 50MHz PCLK 25MHz PCLK 12.5MHz PCLK - * ----------------- ----------------- ----------------- ----------------- - * desired prescale MR0 prescale MR0 prescale MR0 prescale MR0 resolution - * prescale register register register register register register register register in degrees - * freq value value value value value value value value - * - * 8 11.5 159,999 5.25 159,999 2.13 159,999 0.5625 159,999 0.023 - * 4 24 79,999 11.5 79,999 5.25 79,999 2.125 79,999 0.045 - * 2 49 39,999 24 39,999 11.5 39,999 5.25 39,999 0.090 - * 1 99 19,999 49 19,999 24 19,999 11.5 19,999 0.180 - * 0.5 199 9,999 99 9,999 49 9,999 24 9,999 0.360 - * 0.25 399 4,999 199 4,999 99 4,999 49 4,999 0.720 - * 0.125 799 2,499 399 2,499 199 2,499 99 2,499 1.440 - * - * The desired prescale frequency column comes from an input in the range of 544 - 2400 microseconds - * and the desire to just shift the input left or right as needed. - * - * A resolution of 0.2 degrees seems reasonable so a prescale frequency output of 1MHz is being used. - * It also means we don't need to scale the input. - * - * The PCLK is set to 25MHz because that's the slowest one that gives whole numbers for prescale and - * MR0 registers. - * - * Final settings: - * PCLKSEL0: 0x0 - * PWM1PR: 0x018 (24) - * PWM1MR0: 0x04E1F (19,999) - * - */ - -void LPC1768_PWM_init(void) { - - ///// directly controlled PWM pins (interrupts not used for these) - - #define SBIT_CNTEN 0 // PWM1 counter & pre-scaler enable/disable - #define SBIT_CNTRST 1 // reset counters to known state - #define SBIT_PWMEN 3 // 1 - PWM, 0 - timer - #define SBIT_PWMMR0R 1 - #define PCPWM1 6 - #define PCLK_PWM1 12 - - SBI(LPC_SC->PCONP, PCPWM1); // Enable PWM1 controller (enabled on power up) - LPC_SC->PCLKSEL0 &= ~(0x3 << PCLK_PWM1); - LPC_SC->PCLKSEL0 |= (LPC_PWM1_PCLKSEL0 << PCLK_PWM1); - - uint32_t PR = (CLKPWR_GetPCLK(CLKPWR_PCLKSEL_PWM1) / 1000000) - 1; // Prescalar to create 1 MHz output - - LPC_PWM1->MR0 = LPC_PWM1_MR0; // TC resets every 19,999 + 1 cycles - sets PWM cycle(Ton+Toff) to 20 mS - // MR0 must be set before TCR enables the PWM - LPC_PWM1->TCR = _BV(SBIT_CNTEN) | _BV(SBIT_CNTRST) | _BV(SBIT_PWMEN); // Enable counters, reset counters, set mode to PWM - CBI(LPC_PWM1->TCR, SBIT_CNTRST); // Take counters out of reset - LPC_PWM1->PR = PR; - LPC_PWM1->MCR = _BV(SBIT_PWMMR0R) | _BV(0); // Reset TC if it matches MR0, disable all interrupts except for MR0 - LPC_PWM1->CTCR = 0; // Disable counter mode (enable PWM mode) - LPC_PWM1->LER = 0x07F; // Set the latch Enable Bits to load the new Match Values for MR0 - MR6 - LPC_PWM1->PCR = 0; // Single edge mode for all channels, PWM1 control of outputs off - - //// interrupt controlled PWM setup - - LPC_SC->PCONP |= 1 << 23; // power on timer3 - HAL_PWM_TIMER->PR = PR; - HAL_PWM_TIMER->MCR = 0x0B; // Interrupt on MR0 & MR1, reset on MR0 - HAL_PWM_TIMER->MR0 = LPC_PWM1_MR0; - HAL_PWM_TIMER->MR1 = 0; - HAL_PWM_TIMER->TCR = _BV(0); // enable - NVIC_EnableIRQ(HAL_PWM_TIMER_IRQn); - NVIC_SetPriority(HAL_PWM_TIMER_IRQn, NVIC_EncodePriority(0, 4, 0)); -} - - -bool ISR_table_update = false; // flag to tell the ISR that the tables need to be updated & swapped -uint8_t ISR_index = 0; // index used by ISR to skip already actioned entries -#define COPY_ACTIVE_TABLE for (uint8_t i = 0; i < NUM_ISR_PWMS ; i++) work_table[i] = active_table[i] -uint32_t first_MR1_value = LPC_PWM1_MR0 + 1; - -void LPC1768_PWM_sort(void) { - - for (uint8_t i = NUM_ISR_PWMS; --i;) { // (bubble) sort table by microseconds - bool didSwap = false; - PWM_map temp; - for (uint16_t j = 0; j < i; ++j) { - if (work_table[j].microseconds > work_table[j + 1].microseconds) { - temp = work_table[j + 1]; - work_table[j + 1] = work_table[j]; - work_table[j] = temp; - didSwap = true; - } - } - if (!didSwap) break; - } -} - -bool LPC1768_PWM_attach_pin(pin_t pin, uint32_t min /* = 1 */, uint32_t max /* = (LPC_PWM1_MR0 - 1) */, uint8_t servo_index /* = 0xFF */) { - - pin = GET_PIN_MAP_PIN(GET_PIN_MAP_INDEX(pin & 0xFF)); // Sometimes the upper byte is garbled - -//// direct control PWM code - switch (pin) { - case P1_23: // MKS Sbase Servo 0, PWM1 channel 4 (J3-8 PWM1.4) - direct_table[P1_23_PWM_channel - 1].min = min; - direct_table[P1_23_PWM_channel - 1].max = MIN(max, LPC_PWM1_MR0 - MR0_MARGIN); - direct_table[P1_23_PWM_channel - 1].assigned = true; - return true; - case P1_20: // Servo 0, PWM1 channel 2 (Pin 11 P1.20 PWM1.2) - direct_table[P1_20_PWM_channel - 1].min = min; - direct_table[P1_20_PWM_channel - 1].max = MIN(max, LPC_PWM1_MR0 - MR0_MARGIN); - direct_table[P1_20_PWM_channel - 1].assigned = true; - return true; - case P1_21: // Servo 1, PWM1 channel 3 (Pin 6 P1.21 PWM1.3) - direct_table[P1_21_PWM_channel - 1].min = min; - direct_table[P1_21_PWM_channel - 1].max = MIN(max, LPC_PWM1_MR0 - MR0_MARGIN); - direct_table[P1_21_PWM_channel - 1].assigned = true; - return true; - case P1_18: // Servo 3, PWM1 channel 1 (Pin 4 P1.18 PWM1.1) - direct_table[P1_18_PWM_channel - 1].min = min; - direct_table[P1_18_PWM_channel - 1].max = MIN(max, LPC_PWM1_MR0 - MR0_MARGIN); - direct_table[P1_18_PWM_channel - 1].assigned = true; - return true; - case P2_04: // D9 FET, PWM1 channel 5 (Pin 9 P2_04 PWM1.5) - direct_table[P2_04_PWM_channel - 1].min = min; - direct_table[P2_04_PWM_channel - 1].max = MIN(max, LPC_PWM1_MR0 - MR0_MARGIN); - direct_table[P2_04_PWM_channel - 1].assigned = true; - return true; - case P2_05: // D10 FET, PWM1 channel 6 (Pin 10 P2_05 PWM1.6) - direct_table[P2_05_PWM_channel - 1].min = min; - direct_table[P2_05_PWM_channel - 1].max = MIN(max, LPC_PWM1_MR0 - MR0_MARGIN); - direct_table[P2_05_PWM_channel - 1].assigned = true; - return true; - } - -//// interrupt controlled PWM code - NVIC_DisableIRQ(HAL_PWM_TIMER_IRQn); // make it safe to update the active table - // OK to update the active table because the - // ISR doesn't use any of the changed items - - // We NEED memory barriers to ensure Interrupts are actually disabled! - // ( https://dzone.com/articles/nvic-disabling-interrupts-on-arm-cortex-m-and-the ) - __DSB(); - __ISB(); - - if (ISR_table_update) //use work table if that's the newest - temp_table = work_table; - else - temp_table = active_table; - - uint8_t slot = 0; - for (uint8_t i = 0; i < NUM_ISR_PWMS; i++) // see if already in table - if (temp_table[i].pin == pin) { - NVIC_EnableIRQ(HAL_PWM_TIMER_IRQn); // re-enable PWM interrupts - return 1; - } - - for (uint8_t i = 1; (i < NUM_ISR_PWMS + 1) && !slot; i++) // find empty slot - if ( !(temp_table[i - 1].set_register)) { slot = i; break; } // any item that can't be zero when active or just attached is OK - - if (!slot) { - NVIC_EnableIRQ(HAL_PWM_TIMER_IRQn); // re-enable PWM interrupts - return 0; - } - - slot--; // turn it into array index - - temp_table[slot].pin = pin; // init slot - temp_table[slot].set_register = &LPC_GPIO(LPC1768_PIN_PORT(pin))->FIOSET; - temp_table[slot].clr_register = &LPC_GPIO(LPC1768_PIN_PORT(pin))->FIOCLR; - temp_table[slot].write_mask = LPC_PIN(LPC1768_PIN_PIN(pin)); - temp_table[slot].min = min; - temp_table[slot].max = max; // different max for ISR PWMs than for direct PWMs - temp_table[slot].servo_index = servo_index; - temp_table[slot].active_flag = false; - - NVIC_EnableIRQ(HAL_PWM_TIMER_IRQn); // re-enable PWM interrupts - - return 1; -} - - -bool LPC1768_PWM_detach_pin(pin_t pin) { - - pin = GET_PIN_MAP_PIN(GET_PIN_MAP_INDEX(pin & 0xFF)); - -//// direct control PWM code - switch (pin) { - case P1_23: // MKS Sbase Servo 0, PWM1 channel 4 (J3-8 PWM1.4) - if (!direct_table[P1_23_PWM_channel - 1].assigned) return false; - CBI(LPC_PWM1->PCR, 8 + P1_23_PWM_channel); // disable PWM1 module control of this pin - LPC_PINCON->PINSEL3 &= ~(0x3 << 14); // return pin to general purpose I/O - direct_table[P1_23_PWM_channel - 1].assigned = false; - return true; - case P1_20: // Servo 0, PWM1 channel 2 (Pin 11 P1.20 PWM1.2) - if (!direct_table[P1_20_PWM_channel - 1].assigned) return false; - CBI(LPC_PWM1->PCR, 8 + P1_20_PWM_channel); // disable PWM1 module control of this pin - LPC_PINCON->PINSEL3 &= ~(0x3 << 8); // return pin to general purpose I/O - direct_table[P1_20_PWM_channel - 1].assigned = false; - return true; - case P1_21: // Servo 1, PWM1 channel 3 (Pin 6 P1.21 PWM1.3) - if (!direct_table[P1_21_PWM_channel - 1].assigned) return false; - CBI(LPC_PWM1->PCR, 8 + P1_21_PWM_channel); // disable PWM1 module control of this pin - LPC_PINCON->PINSEL3 &= ~(0x3 << 10); // return pin to general purpose I/O - direct_table[P1_21_PWM_channel - 1].assigned = false; - return true; - case P1_18: // Servo 3, PWM1 channel 1 (Pin 4 P1.18 PWM1.1) - if (!direct_table[P1_18_PWM_channel - 1].assigned) return false; - CBI(LPC_PWM1->PCR, 8 + P1_18_PWM_channel); // disable PWM1 module control of this pin - LPC_PINCON->PINSEL3 &= ~(0x3 << 4); // return pin to general purpose I/O - direct_table[P1_18_PWM_channel - 1].assigned = false; - return true; - case P2_04: // D9 FET, PWM1 channel 5 (Pin 9 P2_04 PWM1.5) - if (!direct_table[P2_04_PWM_channel - 1].assigned) return false; - CBI(LPC_PWM1->PCR, 8 + P2_04_PWM_channel); // disable PWM1 module control of this pin - LPC_PINCON->PINSEL4 &= ~(0x3 << 10); // return pin to general purpose I/O - direct_table[P2_04_PWM_channel - 1].assigned = false; - return true; - case P2_05: // D10 FET, PWM1 channel 6 (Pin 10 P2_05 PWM1.6) - if (!direct_table[P2_05_PWM_channel - 1].assigned) return false; - CBI(LPC_PWM1->PCR, 8 + P2_05_PWM_channel); // disable PWM1 module control of this pin - LPC_PINCON->PINSEL4 &= ~(0x3 << 4); // return pin to general purpose I/O - direct_table[P2_05_PWM_channel - 1].assigned = false; - return true; - } - -//// interrupt controlled PWM code - NVIC_DisableIRQ(HAL_PWM_TIMER_IRQn); - - // We NEED memory barriers to ensure Interrupts are actually disabled! - // ( https://dzone.com/articles/nvic-disabling-interrupts-on-arm-cortex-m-and-the ) - __DSB(); - __ISB(); - - if (ISR_table_update) { - ISR_table_update = false; // don't update yet - have another update to do - NVIC_EnableIRQ(HAL_PWM_TIMER_IRQn); // re-enable PWM interrupts - } - else { - NVIC_EnableIRQ(HAL_PWM_TIMER_IRQn); // re-enable PWM interrupts - COPY_ACTIVE_TABLE; // copy active table into work table - } - - uint8_t slot = 0xFF; - for (uint8_t i = 0; i < NUM_ISR_PWMS; i++) { // find slot - if (work_table[i].pin == pin) { - slot = i; - break; - } - } - if (slot == 0xFF) // return error if pin not found - return false; - - work_table[slot] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; - - LPC1768_PWM_sort(); // sort table by microseconds - ISR_table_update = true; - return true; -} - -// value is 0-20,000 microseconds (0% to 100% duty cycle) -// servo routine provides values in the 544 - 2400 range -bool LPC1768_PWM_write(pin_t pin, uint32_t value) { - - pin = GET_PIN_MAP_PIN(GET_PIN_MAP_INDEX(pin & 0xFF)); - -//// direct control PWM code - switch (pin) { - case P1_23: // MKS Sbase Servo 0, PWM1 channel 4 (J3-8 PWM1.4) - if (!direct_table[P1_23_PWM_channel - 1].assigned) return false; - LPC_PWM1->PCR |= _BV(8 + P1_23_PWM_channel); // enable PWM1 module control of this pin - LPC_PINCON->PINSEL3 = 0x2 << 14; // must set pin function AFTER setting PCR - // load the new time value - LPC_PWM1->MR4 = MAX(MIN(value, direct_table[P1_23_PWM_channel - 1].max), direct_table[P1_23_PWM_channel - 1].min); - LPC_PWM1->LER = 0x1 << P1_23_PWM_channel; // Set the latch Enable Bit to load the new Match Value on the next MR0 - return true; - case P1_20: // Servo 0, PWM1 channel 2 (Pin 11 P1.20 PWM1.2) - if (!direct_table[P1_20_PWM_channel - 1].assigned) return false; - LPC_PWM1->PCR |= _BV(8 + P1_20_PWM_channel); // enable PWM1 module control of this pin - LPC_PINCON->PINSEL3 |= 0x2 << 8; // must set pin function AFTER setting PCR - // load the new time value - LPC_PWM1->MR2 = MAX(MIN(value, direct_table[P1_20_PWM_channel - 1].max), direct_table[P1_20_PWM_channel - 1].min); - LPC_PWM1->LER = 0x1 << P1_20_PWM_channel; // Set the latch Enable Bit to load the new Match Value on the next MR0 - return true; - case P1_21: // Servo 1, PWM1 channel 3 (Pin 6 P1.21 PWM1.3) - if (!direct_table[P1_21_PWM_channel - 1].assigned) return false; - LPC_PWM1->PCR |= _BV(8 + P1_21_PWM_channel); // enable PWM1 module control of this pin - LPC_PINCON->PINSEL3 |= 0x2 << 10; // must set pin function AFTER setting PCR - // load the new time value - LPC_PWM1->MR3 = MAX(MIN(value, direct_table[P1_21_PWM_channel - 1].max), direct_table[P1_21_PWM_channel - 1].min); - LPC_PWM1->LER = 0x1 << P1_21_PWM_channel; // Set the latch Enable Bit to load the new Match Value on the next MR0 - return true; - case P1_18: // Servo 3, PWM1 channel 1 (Pin 4 P1.18 PWM1.1) - if (!direct_table[P1_18_PWM_channel - 1].assigned) return false; - LPC_PWM1->PCR |= _BV(8 + P1_18_PWM_channel); // enable PWM1 module control of this pin - LPC_PINCON->PINSEL3 |= 0x2 << 4; // must set pin function AFTER setting PCR - // load the new time value - LPC_PWM1->MR1 = MAX(MIN(value, direct_table[P1_18_PWM_channel - 1].max), direct_table[P1_18_PWM_channel - 1].min); - LPC_PWM1->LER = 0x1 << P1_18_PWM_channel; // Set the latch Enable Bit to load the new Match Value on the next MR0 - return true; - case P2_04: // D9 FET, PWM1 channel 5 (Pin 9 P2_04 PWM1.5) - if (!direct_table[P2_04_PWM_channel - 1].assigned) return false; - LPC_PWM1->PCR |= _BV(8 + P2_04_PWM_channel); // enable PWM1 module control of this pin - LPC_PINCON->PINSEL4 |= 0x1 << 8; // must set pin function AFTER setting PCR - // load the new time value - LPC_PWM1->MR5 = MAX(MIN(value, direct_table[P2_04_PWM_channel - 1].max), direct_table[P2_04_PWM_channel - 1].min); - LPC_PWM1->LER = 0x1 << P2_04_PWM_channel; // Set the latch Enable Bit to load the new Match Value on the next MR0 - return true; - case P2_05: // D10 FET, PWM1 channel 6 (Pin 10 P2_05 PWM1.6) - if (!direct_table[P2_05_PWM_channel - 1].assigned) return false; - LPC_PWM1->PCR |= _BV(8 + P2_05_PWM_channel); // enable PWM1 module control of this pin - LPC_PINCON->PINSEL4 |= 0x1 << 10; // must set pin function AFTER setting PCR - // load the new time value - LPC_PWM1->MR6 = MAX(MIN(value, direct_table[P2_05_PWM_channel - 1].max), direct_table[P2_05_PWM_channel - 1].min); - LPC_PWM1->LER = 0x1 << P2_05_PWM_channel; // Set the latch Enable Bit to load the new Match Value on the next MR0 - return true; - } - -//// interrupt controlled PWM code - NVIC_DisableIRQ(HAL_PWM_TIMER_IRQn); - - // We NEED memory barriers to ensure Interrupts are actually disabled! - // ( https://dzone.com/articles/nvic-disabling-interrupts-on-arm-cortex-m-and-the ) - __DSB(); - __ISB(); - - if (!ISR_table_update) // use the most up to date table - COPY_ACTIVE_TABLE; // copy active table into work table - - uint8_t slot = 0xFF; - for (uint8_t i = 0; i < NUM_ISR_PWMS; i++) // find slot - if (work_table[i].pin == pin) { slot = i; break; } - if (slot == 0xFF) { // return error if pin not found - NVIC_EnableIRQ(HAL_PWM_TIMER_IRQn); - return false; - } - - work_table[slot].microseconds = MAX(MIN(value, work_table[slot].max), work_table[slot].min);; - work_table[slot].active_flag = true; - - LPC1768_PWM_sort(); // sort table by microseconds - ISR_table_update = true; - - NVIC_EnableIRQ(HAL_PWM_TIMER_IRQn); // re-enable PWM interrupts - return 1; -} - - -bool useable_hardware_PWM(pin_t pin) { - - pin = GET_PIN_MAP_PIN(GET_PIN_MAP_INDEX(pin & 0xFF)); - - NVIC_DisableIRQ(HAL_PWM_TIMER_IRQn); - - // We NEED memory barriers to ensure Interrupts are actually disabled! - // ( https://dzone.com/articles/nvic-disabling-interrupts-on-arm-cortex-m-and-the ) - __DSB(); - __ISB(); - - bool return_flag = false; - for (uint8_t i = 0; i < NUM_ISR_PWMS; i++) // see if it's already setup - if (active_table[i].pin == pin) return_flag = true; - for (uint8_t i = 0; i < NUM_ISR_PWMS; i++) // see if there is an empty slot - if (!active_table[i].set_register) return_flag = true; - NVIC_EnableIRQ(HAL_PWM_TIMER_IRQn); // re-enable PWM interrupts - return return_flag; -} - - -//////////////////////////////////////////////////////////////////////////////// - - -#define PWM_LPC1768_ISR_SAFETY_FACTOR 5 // amount of time needed to guarantee MR1 count will be above TC -volatile bool in_PWM_isr = false; - -HAL_PWM_TIMER_ISR { - bool first_active_entry = true; - uint32_t next_MR1_val; - - if (in_PWM_isr) goto exit_PWM_ISR; // prevent re-entering this ISR - in_PWM_isr = true; - - if (HAL_PWM_TIMER->IR & 0x01) { // MR0 interrupt - next_MR1_val = first_MR1_value; // only used if have a blank ISR table - if (ISR_table_update) { // new values have been loaded so swap tables - temp_table = active_table; - active_table = work_table; - work_table = temp_table; - ISR_table_update = false; - } - } - HAL_PWM_TIMER->IR = 0x3F; // clear all interrupts - - for (uint8_t i = 0; i < NUM_ISR_PWMS; i++) { - if (active_table[i].active_flag) { - if (first_active_entry) { - first_active_entry = false; - next_MR1_val = active_table[i].microseconds; - } - if (HAL_PWM_TIMER->TC < active_table[i].microseconds) { - *active_table[i].set_register = active_table[i].write_mask; // set pin high - } - else { - *active_table[i].clr_register = active_table[i].write_mask; // set pin low - next_MR1_val = (i == NUM_ISR_PWMS -1) - ? LPC_PWM1_MR0 + 1 // done with table, wait for MR0 - : active_table[i + 1].microseconds; // set next MR1 interrupt? - } - } - } - if (first_active_entry) next_MR1_val = LPC_PWM1_MR0 + 1; // empty table so disable MR1 interrupt - HAL_PWM_TIMER->MR1 = MAX(next_MR1_val, HAL_PWM_TIMER->TC + PWM_LPC1768_ISR_SAFETY_FACTOR); // set next - in_PWM_isr = false; - - exit_PWM_ISR: - return; -} -#endif - - -///////////////////////////////////////////////////////////////// -///////////////// HARDWARE FIRMWARE INTERACTION //////////////// -///////////////////////////////////////////////////////////////// - -/** - * There are two distinct systems used for PWMs: - * directly controlled pins - * ISR controlled pins. - * - * The two systems are independent of each other. The use the same counter frequency so there's no - * translation needed when setting the time values. The init, attach, detach and write routines all - * start with the direct pin code which is followed by the ISR pin code. - * - * The PMW1 module handles the directly controlled pins. Each directly controlled pin is associated - * with a match register (MR1 - MR6). When the associated MR equals the module's TIMER/COUNTER (TC) - * then the pins is set to low. The MR0 register controls the repetition rate. When the TC equals - * MR0 then the TC is reset and ALL directly controlled pins are set high. The resulting pulse widths - * are almost immune to system loading and ISRs. No PWM1 interrupts are used. - * - * The ISR controlled pins use the TIMER/COUNTER, MR0 and MR1 registers from one timer. MR0 controls - * period of the controls the repetition rate. When the TC equals MR0 then the TC is reset and an - * interrupt is generated. When the TC equals MR1 then an interrupt is generated. - * - * Each interrupt does the following: - * 1) Swaps the tables if it's a MR0 interrupt and the swap flag is set. It then clears the swap flag. - * 2) Scans the entire ISR table (it's been sorted low to high time) - * a. If its the first active entry then it grabs the time as a tentative time for MR1 - * b. If active and TC is less than the time then it sets the pin high - * c. If active and TC is more than the time it sets the pin high - * d. On every entry that sets a pin low it grabs the NEXT entry's time for use as the next MR1. - * This results in MR1 being set to the time in the first active entry that does NOT set a - * pin low. - * e. If it's setting the last entry's pin low then it sets MR1 to a value bigger than MR0 - * f. If no value has been grabbed for the next MR1 then it's an empty table and MR1 is set to a - * value greater than MR0 - */ diff --git a/Marlin/src/HAL/HAL_LPC1768/LPC1768_PWM.h b/Marlin/src/HAL/HAL_LPC1768/LPC1768_PWM.h deleted file mode 100644 index 6c1a2480b8..0000000000 --- a/Marlin/src/HAL/HAL_LPC1768/LPC1768_PWM.h +++ /dev/null @@ -1,79 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * Copyright (C) 2017 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 . - * - */ - -/** - * The class Servo uses the PWM class to implement its functions - * - * All PWMs use the same repetition rate - 20mS because that's the normal servo rate - */ - -/** - * This is a hybrid system. - * - * The PWM1 module is used to directly control the Servo 0, 1 & 3 pins. This keeps - * the pulse width jitter to under a microsecond. - * - * For all other pins the PWM1 module is used to generate interrupts. The ISR - * routine does the actual setting/clearing of pins. The upside is that any pin can - * have a PWM channel assigned to it. The downside is that there is more pulse width - * jitter. The jitter depends on what else is happening in the system and what ISRs - * prempt the PWM ISR. Writing to the SD card can add 20 microseconds to the pulse - * width. - */ - -/** - * The data structures are setup to minimize the computation done by the ISR which - * minimizes ISR execution time. Execution times are 2.2 - 3.7 microseconds. - * - * Two tables are used. active_table is used by the ISR. Changes to the table are - * are done by copying the active_table into the work_table, updating the work_table - * and then swapping the two tables. Swapping is done by manipulating pointers. - * - * Immediately after the swap the ISR uses the work_table until the start of the - * next 20mS cycle. During this transition the "work_table" is actually the table - * that was being used before the swap. The "active_table" contains the data that - * will start being used at the start of the next 20mS period. This keeps the pins - * well behaved during the transition. - * - * The ISR's priority is set to the maximum otherwise other ISRs can cause considerable - * jitter in the PWM high time. - * - * See the end of this file for details on the hardware/firmware interaction - */ - -#ifndef _LPC1768_PWM_H_ -#define _LPC1768_PWM_H_ - -#include -#include - -#define LPC_PWM1_MR0 19999 // base repetition rate minus one count - 20mS -#define LPC_PWM1_PCLKSEL0 CLKPWR_PCLKSEL_CCLK_DIV_4 // select clock divider for prescaler - defaults to 4 on power up -#define MR0_MARGIN 200 // if channel value too close to MR0 the system locks up - -void LPC1768_PWM_init(void); -bool LPC1768_PWM_attach_pin(pin_t pin, uint32_t min=1, uint32_t max=(LPC_PWM1_MR0 - (MR0_MARGIN)), uint8_t servo_index=0xFF); -bool LPC1768_PWM_write(pin_t pin, uint32_t value); -bool LPC1768_PWM_detach_pin(pin_t pin); -bool useable_hardware_PWM(pin_t pin); - -#endif // _LPC1768_PWM_H_ diff --git a/Marlin/src/HAL/HAL_LPC1768/LPC1768_Servo.cpp b/Marlin/src/HAL/HAL_LPC1768/LPC1768_Servo.cpp deleted file mode 100644 index 4997c5e4bc..0000000000 --- a/Marlin/src/HAL/HAL_LPC1768/LPC1768_Servo.cpp +++ /dev/null @@ -1,163 +0,0 @@ -/** - * 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 . - * - */ - -/** - * Based on servo.cpp - Interrupt driven Servo library for Arduino using 16 bit - * timers- Version 2 Copyright (c) 2009 Michael Margolis. All right reserved. - */ - -/** - * A servo is activated by creating an instance of the Servo class passing the desired pin to the attach() method. - * The servos are pulsed in the background using the value most recently written using the write() method - * - * Note that analogWrite of PWM on pins associated with the timer are disabled when the first servo is attached. - * Timers are seized as needed in groups of 12 servos - 24 servos use two timers, 48 servos will use four. - * - * The methods are: - * - * Servo - Class for manipulating servo motors connected to Arduino pins. - * - * attach(pin) - Attach a servo motor to an i/o pin. - * attach(pin, min, max) - Attach to a pin, setting min and max values in microseconds - * Default min is 544, max is 2400 - * - * write() - Set the servo angle in degrees. (Invalid angles —over MIN_PULSE_WIDTH— are treated as µs.) - * writeMicroseconds() - Set the servo pulse width in microseconds. - * move(pin, angle) - Sequence of attach(pin), write(angle), safe_delay(servo_delay[servoIndex]). - * With DEACTIVATE_SERVOS_AFTER_MOVE it detaches after servo_delay[servoIndex]. - * read() - Get the last-written servo pulse width as an angle between 0 and 180. - * readMicroseconds() - Get the last-written servo pulse width in microseconds. - * attached() - Return true if a servo is attached. - * detach() - Stop an attached servo from pulsing its i/o pin. - * - */ - -/** - * The only time that this library wants physical movement is when a WRITE - * command is issued. Before that all the attach & detach activity is solely - * within the data base. - * - * The PWM output is inactive until the first WRITE. After that it stays active - * unless DEACTIVATE_SERVOS_AFTER_MOVE is enabled and a MOVE command was issued. - */ - -#ifdef TARGET_LPC1768 - -#include "../../inc/MarlinConfig.h" - -#if HAS_SERVOS - - #include "LPC1768_PWM.h" - #include "LPC1768_Servo.h" - #include "servo_private.h" - - ServoInfo_t servo_info[MAX_SERVOS]; // static array of servo info structures - uint8_t ServoCount = 0; // the total number of attached servos - - #define US_TO_PULSE_WIDTH(p) p - #define PULSE_WIDTH_TO_US(p) p - #define TRIM_DURATION 0 - #define SERVO_MIN() MIN_PULSE_WIDTH // minimum value in uS for this servo - #define SERVO_MAX() MAX_PULSE_WIDTH // maximum value in uS for this servo - - Servo::Servo() { - if (ServoCount < MAX_SERVOS) { - this->servoIndex = ServoCount++; // assign a servo index to this instance - servo_info[this->servoIndex].pulse_width = US_TO_PULSE_WIDTH(DEFAULT_PULSE_WIDTH); // store default values - 12 Aug 2009 - } - else - this->servoIndex = INVALID_SERVO; // too many servos - } - - int8_t Servo::attach(const int pin) { - return this->attach(pin, MIN_PULSE_WIDTH, MAX_PULSE_WIDTH); - } - - int8_t Servo::attach(const int pin, const int min, const int max) { - - if (this->servoIndex >= MAX_SERVOS) return -1; - - if (pin > 0) servo_info[this->servoIndex].Pin.nbr = pin; // only assign a pin value if the pin info is - // greater than zero. This way the init routine can - // assign the pin and the MOVE command only needs the value. - - this->min = MIN_PULSE_WIDTH; //resolution of min/max is 1 uS - this->max = MAX_PULSE_WIDTH; - - servo_info[this->servoIndex].Pin.isActive = true; - - return this->servoIndex; - } - - void Servo::detach() { - servo_info[this->servoIndex].Pin.isActive = false; - } - - void Servo::write(int value) { - if (value < MIN_PULSE_WIDTH) { // treat values less than 544 as angles in degrees (valid values in microseconds are handled as microseconds) - value = map(constrain(value, 0, 180), 0, 180, SERVO_MIN(), SERVO_MAX()); - // odd - this sets zero degrees to 544 and 180 degrees to 2400 microseconds but the literature says - // zero degrees should be 500 microseconds and 180 should be 2500 - } - this->writeMicroseconds(value); - } - - void Servo::writeMicroseconds(int value) { - // calculate and store the values for the given channel - byte channel = this->servoIndex; - if (channel < MAX_SERVOS) { // ensure channel is valid - // ensure pulse width is valid - value = constrain(value, SERVO_MIN(), SERVO_MAX()) - (TRIM_DURATION); - value = US_TO_PULSE_WIDTH(value); // convert to pulse_width after compensating for interrupt overhead - 12 Aug 2009 - - servo_info[channel].pulse_width = value; - LPC1768_PWM_attach_pin(servo_info[this->servoIndex].Pin.nbr, MIN_PULSE_WIDTH, MAX_PULSE_WIDTH, this->servoIndex); - LPC1768_PWM_write(servo_info[this->servoIndex].Pin.nbr, value); - - } - } - - // return the value as degrees - int Servo::read() { return map(this->readMicroseconds() + 1, SERVO_MIN(), SERVO_MAX(), 0, 180); } - - int Servo::readMicroseconds() { - return (this->servoIndex == INVALID_SERVO) ? 0 : PULSE_WIDTH_TO_US(servo_info[this->servoIndex].pulse_width) + TRIM_DURATION; - } - - bool Servo::attached() { return servo_info[this->servoIndex].Pin.isActive; } - - void Servo::move(const int value) { - constexpr uint16_t servo_delay[] = SERVO_DELAY; - static_assert(COUNT(servo_delay) == NUM_SERVOS, "SERVO_DELAY must be an array NUM_SERVOS long."); - if (this->attach(0) >= 0) { // notice the pin number is zero here - this->write(value); - safe_delay(servo_delay[this->servoIndex]); - #if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE) - this->detach(); - LPC1768_PWM_detach_pin(servo_info[this->servoIndex].Pin.nbr); // shut down the PWM signal - LPC1768_PWM_attach_pin(servo_info[this->servoIndex].Pin.nbr, MIN_PULSE_WIDTH, MAX_PULSE_WIDTH, this->servoIndex); // make sure no one else steals the slot - #endif - } - } - -#endif // HAS_SERVOS -#endif // TARGET_LPC1768 diff --git a/Marlin/src/HAL/HAL_LPC1768/LPC1768_Servo.h b/Marlin/src/HAL/HAL_LPC1768/LPC1768_Servo.h deleted file mode 100644 index f0d6f048a5..0000000000 --- a/Marlin/src/HAL/HAL_LPC1768/LPC1768_Servo.h +++ /dev/null @@ -1,62 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * Copyright (C) 2017 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 . - * - */ - -/** - * The class Servo uses the PWM class to implement its functions - * - * The PWM1 module is only used to generate interrups at specified times. It - * is NOT used to directly toggle pins. The ISR writes to the pin assigned to - * that interrupt - * - * All PWMs use the same repetition rate - 20mS because that's the normal servo rate - * - */ - -#ifndef LPC1768_SERVO_H -#define LPC1768_SERVO_H - -#include - - class Servo { - public: - Servo(); - int8_t attach(const int pin); // attach the given pin to the next free channel, set pinMode, return channel number (-1 on fail) - int8_t attach(const int pin, const int min, const int max); // as above but also sets min and max values for writes. - void detach(); - void write(int value); // if value is < 200 it is treated as an angle, otherwise as pulse width in microseconds - void writeMicroseconds(int value); // write pulse width in microseconds - void move(const int value); // attach the servo, then move to value - // if value is < 200 it is treated as an angle, otherwise as pulse width in microseconds - // if DEACTIVATE_SERVOS_AFTER_MOVE wait SERVO_DELAY, then detach - int read(); // returns current pulse width as an angle between 0 and 180 degrees - int readMicroseconds(); // returns current pulse width in microseconds for this servo (was read_us() in first release) - bool attached(); // return true if this servo is attached, otherwise false - - private: - uint8_t servoIndex; // index into the channel data for this servo - int min; - int max; - }; - - #define HAL_SERVO_LIB Servo - -#endif // LPC1768_SERVO_H diff --git a/Marlin/src/HAL/HAL_LPC1768/MarlinSerial.cpp b/Marlin/src/HAL/HAL_LPC1768/MarlinSerial.cpp new file mode 100644 index 0000000000..248e9007f1 --- /dev/null +++ b/Marlin/src/HAL/HAL_LPC1768/MarlinSerial.cpp @@ -0,0 +1,56 @@ +/** + * 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 . + * + */ + +#ifdef TARGET_LPC1768 + +#include "../../inc/MarlinConfigPre.h" +#include "MarlinSerial.h" + +#if (defined(SERIAL_PORT) && SERIAL_PORT == 0) || (defined(SERIAL_PORT_2) && SERIAL_PORT_2 == 0) + MarlinSerial MSerial(LPC_UART0); + extern "C" void UART0_IRQHandler(void) { + MSerial.IRQHandler(); + } +#endif + +#if (defined(SERIAL_PORT) && SERIAL_PORT == 1) || (defined(SERIAL_PORT_2) && SERIAL_PORT_2 == 1) + MarlinSerial MSerial1((LPC_UART_TypeDef *) LPC_UART1); + extern "C" void UART1_IRQHandler(void) { + MSerial1.IRQHandler(); + } +#endif + +#if (defined(SERIAL_PORT) && SERIAL_PORT == 2) || (defined(SERIAL_PORT_2) && SERIAL_PORT_2 == 2) + MarlinSerial MSerial2(LPC_UART2); + extern "C" void UART2_IRQHandler(void) { + MSerial2.IRQHandler(); + } +#endif + +#if (defined(SERIAL_PORT) && SERIAL_PORT == 3) || (defined(SERIAL_PORT_2) && SERIAL_PORT_2 == 3) + MarlinSerial MSerial3(LPC_UART3); + extern "C" void UART3_IRQHandler(void) { + MSerial3.IRQHandler(); + } +#endif + +#endif // TARGET_LPC1768 diff --git a/Marlin/src/HAL/HAL_LPC1768/MarlinSerial.h b/Marlin/src/HAL/HAL_LPC1768/MarlinSerial.h new file mode 100644 index 0000000000..7f95be3569 --- /dev/null +++ b/Marlin/src/HAL/HAL_LPC1768/MarlinSerial.h @@ -0,0 +1,67 @@ +/** + * 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 . + * + */ +#pragma once + +#include +#include + +#include "../../inc/MarlinConfigPre.h" +#if ENABLED(EMERGENCY_PARSER) + #include "../../feature/emergency_parser.h" +#endif + +#ifndef SERIAL_PORT + #define SERIAL_PORT 0 +#endif +#ifndef RX_BUFFER_SIZE + #define RX_BUFFER_SIZE 128 +#endif +#ifndef TX_BUFFER_SIZE + #define TX_BUFFER_SIZE 32 +#endif + +class MarlinSerial : public HardwareSerial { +public: + MarlinSerial(LPC_UART_TypeDef *UARTx) : + HardwareSerial(UARTx) + #if ENABLED(EMERGENCY_PARSER) + , emergency_state(EmergencyParser::State::EP_RESET) + #endif + { + } + + #if ENABLED(EMERGENCY_PARSER) + bool recv_callback(const char c) override { + emergency_parser.update(emergency_state, c); + return true; // do not discard character + } + #endif + + #if ENABLED(EMERGENCY_PARSER) + EmergencyParser::State emergency_state; + #endif +}; + +extern MarlinSerial MSerial; +extern MarlinSerial MSerial1; +extern MarlinSerial MSerial2; +extern MarlinSerial MSerial3; diff --git a/Marlin/src/HAL/HAL_LPC1768/servo_private.h b/Marlin/src/HAL/HAL_LPC1768/MarlinServo.h similarity index 66% rename from Marlin/src/HAL/HAL_LPC1768/servo_private.h rename to Marlin/src/HAL/HAL_LPC1768/MarlinServo.h index 451c487d73..c535ea6ff5 100644 --- a/Marlin/src/HAL/HAL_LPC1768/servo_private.h +++ b/Marlin/src/HAL/HAL_LPC1768/MarlinServo.h @@ -38,6 +38,7 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#pragma once /** * Based on "servo.h - Interrupt driven Servo library for Arduino using 16 bit timers - @@ -47,38 +48,23 @@ * */ -#ifndef SERVO_PRIVATE_H -#define SERVO_PRIVATE_H +#include -#include +class MarlinServo: public Servo { + public: + void move(const int value) { + constexpr uint16_t servo_delay[] = SERVO_DELAY; + static_assert(COUNT(servo_delay) == NUM_SERVOS, "SERVO_DELAY must be an array NUM_SERVOS long."); -// Macros -//values in microseconds -#define MIN_PULSE_WIDTH 544 // the shortest pulse sent to a servo -#define MAX_PULSE_WIDTH 2400 // the longest pulse sent to a servo -#define DEFAULT_PULSE_WIDTH 1500 // default pulse width when servo is attached -#define REFRESH_INTERVAL 20000 // minimum time to refresh servos in microseconds + if (this->attach(servo_info[this->servoIndex].Pin.nbr) >= 0) { // try to reattach + this->write(value); + safe_delay(servo_delay[this->servoIndex]); // delay to allow servo to reach position + #if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE) + this->detach(); + #endif + } -#define MAX_SERVOS 4 + } +}; -#define INVALID_SERVO 255 // flag indicating an invalid servo index - - -// Types - -typedef struct { - uint8_t nbr : 8 ; // a pin number from 0 to 254 (255 signals invalid pin) - uint8_t isActive : 1 ; // true if this channel is enabled, pin not pulsed if false -} ServoPin_t; - -typedef struct { - ServoPin_t Pin; - unsigned int pulse_width; // pulse width in microseconds -} ServoInfo_t; - -// Global variables - -extern uint8_t ServoCount; -extern ServoInfo_t servo_info[MAX_SERVOS]; - -#endif // SERVO_PRIVATE_H +#define HAL_SERVO_LIB MarlinServo diff --git a/Marlin/src/HAL/HAL_LPC1768/SanityCheck.h b/Marlin/src/HAL/HAL_LPC1768/SanityCheck.h index 16299696a1..f18efe60ec 100644 --- a/Marlin/src/HAL/HAL_LPC1768/SanityCheck.h +++ b/Marlin/src/HAL/HAL_LPC1768/SanityCheck.h @@ -74,3 +74,11 @@ || MB(RAMPS_14_RE_ARM_SF)) #error "Re-ARM with REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER and TMC2130 require TMC_USE_SW_SPI" #endif + +#if 1 < (ENABLED(LPC_SD_CUSTOM_CABLE) + ENABLED(LPC_SD_LCD) + ENABLED(LPC_SD_ONBOARD)) + #error "Enable only one of LPC_SD_CUSTOM_CABLE, LPC_SD_LCD, or LPC_SD_ONBOARD." +#endif + +#if 1 < (ENABLED(USB_SD_DISABLED) + ENABLED(USB_SD_ONBOARD)) + #error "Enable only one of USB_SD_DISABLED or USB_SD_ONBOARD." +#endif diff --git a/Marlin/src/HAL/HAL_LPC1768/SoftwareSPI.cpp b/Marlin/src/HAL/HAL_LPC1768/SoftwareSPI.cpp deleted file mode 100644 index 546a1d50f1..0000000000 --- a/Marlin/src/HAL/HAL_LPC1768/SoftwareSPI.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * Copyright (C) 2016, 2017 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 . - * - */ - -/** - * Software SPI functions originally from Arduino Sd2Card Library - * Copyright (C) 2009 by William Greiman - */ - -/** - * For TARGET_LPC1768 - */ - -#ifdef TARGET_LPC1768 - -#include "../../inc/MarlinConfig.h" - -// -------------------------------------------------------------------------- -// Software SPI -// -------------------------------------------------------------------------- - -/** - * This software SPI runs at multiple rates. The SD software provides an index - * (spiRate) of 0-6. The mapping is: - * 0 - about 5 MHz peak (6 MHz on LPC1769) - * 1-2 - about 2 MHz peak - * 3 - about 1 MHz peak - * 4 - about 500 kHz peak - * 5 - about 250 kHz peak - * 6 - about 125 kHz peak - */ - -uint8_t swSpiTransfer(uint8_t b, const uint8_t spi_speed, const pin_t sck_pin, const pin_t miso_pin, const pin_t mosi_pin) { - for (uint8_t i = 0; i < 8; i++) { - if (spi_speed == 0) { - WRITE(mosi_pin, !!(b & 0x80)); - WRITE(sck_pin, HIGH); - b <<= 1; - if (miso_pin >= 0 && READ(miso_pin)) b |= 1; - WRITE(sck_pin, LOW); - } - else { - const uint8_t state = (b & 0x80) ? HIGH : LOW; - for (uint8_t j = 0; j < spi_speed; j++) - WRITE(mosi_pin, state); - - for (uint8_t j = 0; j < spi_speed + (miso_pin >= 0 ? 0 : 1); j++) - WRITE(sck_pin, HIGH); - - b <<= 1; - if (miso_pin >= 0 && READ(miso_pin)) b |= 1; - - for (uint8_t j = 0; j < spi_speed; j++) - WRITE(sck_pin, LOW); - } - } - return b; -} - -void swSpiBegin(const pin_t sck_pin, const pin_t miso_pin, const pin_t mosi_pin) { - SET_OUTPUT(sck_pin); - if (VALID_PIN(miso_pin)) SET_INPUT(miso_pin); - SET_OUTPUT(mosi_pin); -} - -uint8_t swSpiInit(const uint8_t spiRate, const pin_t sck_pin, const pin_t mosi_pin) { - WRITE(mosi_pin, HIGH); - WRITE(sck_pin, LOW); - return (SystemCoreClock == 120000000 ? 44 : 38) / POW(2, 6 - MIN(spiRate, 6)); -} - -#endif // TARGET_LPC1768 diff --git a/Marlin/src/HAL/HAL_LPC1768/SoftwareSPI.h b/Marlin/src/HAL/HAL_LPC1768/SoftwareSPI.h deleted file mode 100644 index 49136e2aa3..0000000000 --- a/Marlin/src/HAL/HAL_LPC1768/SoftwareSPI.h +++ /dev/null @@ -1,50 +0,0 @@ -/** - * 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 . - * - */ - -#ifndef _SOFTWARE_SPI_H_ -#define _SOFTWARE_SPI_H_ - -#include - -// -------------------------------------------------------------------------- -// Software SPI -// -------------------------------------------------------------------------- - -/** - * This software SPI runs at multiple rates. The SD software provides an index - * (spiRate) of 0-6. The mapping is: - * 0 - about 5 MHz peak (6 MHz on LPC1769) - * 1-2 - about 2 MHz peak - * 3 - about 1 MHz peak - * 4 - about 500 kHz peak - * 5 - about 250 kHz peak - * 6 - about 125 kHz peak - */ - -void swSpiBegin(const pin_t sck_pin, const pin_t miso_pin, const pin_t mosi_pin); - -// Returns the spi_speed value to be passed to swSpiTransfer -uint8_t swSpiInit(const uint8_t spiRate, const pin_t sck_pin, const pin_t mosi_pin); - -uint8_t swSpiTransfer(uint8_t b, const uint8_t spi_speed, const pin_t sck_pin, const pin_t miso_pin, const pin_t mosi_pin); - -#endif // _SOFTWARE_SPI_H_ diff --git a/Marlin/src/HAL/HAL_LPC1768/WInterrupts.cpp b/Marlin/src/HAL/HAL_LPC1768/WInterrupts.cpp deleted file mode 100644 index a92a61a8fd..0000000000 --- a/Marlin/src/HAL/HAL_LPC1768/WInterrupts.cpp +++ /dev/null @@ -1,162 +0,0 @@ -/** - * Copyright (c) 2011-2012 Arduino. All right reserved. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifdef TARGET_LPC1768 - -#include "../../inc/MarlinConfig.h" - -#define GNUM 31 - -typedef void (*interruptCB)(void); - -static interruptCB callbacksP0[GNUM] = {}; -static interruptCB callbacksP2[GNUM] = {}; - -extern "C" void GpioEnableInt(const uint32_t port, const uint32_t pin, const uint32_t mode); -extern "C" void GpioDisableInt(const uint32_t port, const uint32_t pin); - - -static void __initialize() { - NVIC_SetPriority(EINT3_IRQn, NVIC_EncodePriority(0, 1, 0)); - NVIC_EnableIRQ(EINT3_IRQn); -} - -void attachInterrupt(const pin_t pin, void (*callback)(void), uint32_t mode) { - static int enabled = 0; - - if (!INTERRUPT_PIN(pin)) return; - - if (!enabled) { - __initialize(); - ++enabled; - } - - uint8_t myport = LPC1768_PIN_PORT(pin), - mypin = LPC1768_PIN_PIN(pin); - - if (myport == 0) - callbacksP0[mypin] = callback; - else - callbacksP2[mypin] = callback; - - // Enable interrupt - GpioEnableInt(myport,mypin,mode); -} - -void detachInterrupt(const pin_t pin) { - if (!INTERRUPT_PIN(pin)) return; - - const uint8_t myport = LPC1768_PIN_PORT(pin), - mypin = LPC1768_PIN_PIN(pin); - - // Disable interrupt - GpioDisableInt(myport, mypin); - - // unset callback - if (myport == 0) - callbacksP0[mypin] = 0; - else //if (myport == 2 ) - callbacksP2[mypin] = 0; -} - - -extern "C" void GpioEnableInt(uint32_t port, uint32_t pin, uint32_t mode) { - //pin here is the processor pin, not logical pin - if (port == 0) { - LPC_GPIOINT->IO0IntClr = _BV(pin); - if (mode == RISING) { - SBI(LPC_GPIOINT->IO0IntEnR, pin); - CBI(LPC_GPIOINT->IO0IntEnF, pin); - } - else if (mode == FALLING) { - SBI(LPC_GPIOINT->IO0IntEnF, pin); - CBI(LPC_GPIOINT->IO0IntEnR, pin); - } - else if (mode == CHANGE) { - SBI(LPC_GPIOINT->IO0IntEnR, pin); - SBI(LPC_GPIOINT->IO0IntEnF, pin); - } - } - else { - LPC_GPIOINT->IO2IntClr = _BV(pin); - if (mode == RISING) { - SBI(LPC_GPIOINT->IO2IntEnR, pin); - CBI(LPC_GPIOINT->IO2IntEnF, pin); - } - else if (mode == FALLING) { - SBI(LPC_GPIOINT->IO2IntEnF, pin); - CBI(LPC_GPIOINT->IO2IntEnR, pin); - } - else if (mode == CHANGE) { - SBI(LPC_GPIOINT->IO2IntEnR, pin); - SBI(LPC_GPIOINT->IO2IntEnF, pin); - } - } -} - -extern "C" void GpioDisableInt(const uint32_t port, const uint32_t pin) { - if (port == 0) { - CBI(LPC_GPIOINT->IO0IntEnR, pin); - CBI(LPC_GPIOINT->IO0IntEnF, pin); - LPC_GPIOINT->IO0IntClr = _BV(pin); - } - else { - CBI(LPC_GPIOINT->IO2IntEnR, pin); - CBI(LPC_GPIOINT->IO2IntEnF, pin); - LPC_GPIOINT->IO2IntClr = _BV(pin); - } -} - -extern "C" void EINT3_IRQHandler(void) { - // Read in all current interrupt registers. We do this once as the - // GPIO interrupt registers are on the APB bus, and this is slow. - uint32_t rise0 = LPC_GPIOINT->IO0IntStatR, - fall0 = LPC_GPIOINT->IO0IntStatF, - rise2 = LPC_GPIOINT->IO2IntStatR, - fall2 = LPC_GPIOINT->IO2IntStatF; - - // Clear the interrupts ASAP - LPC_GPIOINT->IO0IntClr = LPC_GPIOINT->IO2IntClr = 0xFFFFFFFF; - NVIC_ClearPendingIRQ(EINT3_IRQn); - - while (rise0 > 0) { // If multiple pins changes happened continue as long as there are interrupts pending - const uint8_t bitloc = 31 - __CLZ(rise0); // CLZ returns number of leading zeros, 31 minus that is location of first pending interrupt - if (callbacksP0[bitloc] != NULL) callbacksP0[bitloc](); - rise0 -= _BV(bitloc); - } - - while (fall0 > 0) { - const uint8_t bitloc = 31 - __CLZ(fall0); - if (callbacksP0[bitloc] != NULL) callbacksP0[bitloc](); - fall0 -= _BV(bitloc); - } - - while(rise2 > 0) { - const uint8_t bitloc = 31 - __CLZ(rise2); - if (callbacksP2[bitloc] != NULL) callbacksP2[bitloc](); - rise2 -= _BV(bitloc); - } - - while (fall2 > 0) { - const uint8_t bitloc = 31 - __CLZ(fall2); - if (callbacksP2[bitloc] != NULL) callbacksP2[bitloc](); - fall2 -= _BV(bitloc); - } -} - -#endif // TARGET_LPC1768 diff --git a/Marlin/src/HAL/HAL_LPC1768/arduino.cpp b/Marlin/src/HAL/HAL_LPC1768/arduino.cpp deleted file mode 100644 index 92efd3495a..0000000000 --- a/Marlin/src/HAL/HAL_LPC1768/arduino.cpp +++ /dev/null @@ -1,179 +0,0 @@ -/** - * 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 . - * - */ - -#ifdef TARGET_LPC1768 - -#include "LPC1768_PWM.h" -#include - -#include "../../inc/MarlinConfig.h" -#include "../shared/Delay.h" - -// Interrupts -void cli(void) { __disable_irq(); } // Disable -void sei(void) { __enable_irq(); } // Enable - -// Time functions -void _delay_ms(const int delay_ms) { - delay(delay_ms); -} - -uint32_t millis() { - return _millis; -} - -// This is required for some Arduino libraries we are using -void delayMicroseconds(uint32_t us) { - DELAY_US(us); -} - -extern "C" void delay(const int msec) { - volatile millis_t end = _millis + msec; - SysTick->VAL = SysTick->LOAD; // reset systick counter so next systick is in exactly 1ms - // this could extend the time between systicks by upto 1ms - while PENDING(_millis, end) __WFE(); -} - -// IO functions -// As defined by Arduino INPUT(0x0), OUTPUT(0x1), INPUT_PULLUP(0x2) -void pinMode(const pin_t pin, const uint8_t mode) { - if (!VALID_PIN(pin)) return; - - PINSEL_CFG_Type config = { LPC1768_PIN_PORT(pin), - LPC1768_PIN_PIN(pin), - PINSEL_FUNC_0, - PINSEL_PINMODE_TRISTATE, - PINSEL_PINMODE_NORMAL }; - switch (mode) { - case INPUT: - LPC_GPIO(LPC1768_PIN_PORT(pin))->FIODIR &= ~LPC_PIN(LPC1768_PIN_PIN(pin)); - break; - case OUTPUT: - LPC_GPIO(LPC1768_PIN_PORT(pin))->FIODIR |= LPC_PIN(LPC1768_PIN_PIN(pin)); - break; - case INPUT_PULLUP: - LPC_GPIO(LPC1768_PIN_PORT(pin))->FIODIR &= ~LPC_PIN(LPC1768_PIN_PIN(pin)); - config.Pinmode = PINSEL_PINMODE_PULLUP; - break; - case INPUT_PULLDOWN: - LPC_GPIO(LPC1768_PIN_PORT(pin))->FIODIR &= ~LPC_PIN(LPC1768_PIN_PIN(pin)); - config.Pinmode = PINSEL_PINMODE_PULLDOWN; - break; - default: return; - } - PINSEL_ConfigPin(&config); -} - -void digitalWrite(pin_t pin, uint8_t pin_status) { - if (!VALID_PIN(pin)) return; - - if (pin_status) - LPC_GPIO(LPC1768_PIN_PORT(pin))->FIOSET = LPC_PIN(LPC1768_PIN_PIN(pin)); - else - LPC_GPIO(LPC1768_PIN_PORT(pin))->FIOCLR = LPC_PIN(LPC1768_PIN_PIN(pin)); - - pinMode(pin, OUTPUT); // Set pin mode on every write (Arduino version does this) - - /** - * Must be done AFTER the output state is set. Doing this before will cause a - * 2uS glitch if writing a "1". - * - * When the Port Direction bit is written to a "1" the output is immediately set - * to the value of the FIOPIN bit which is "0" because of power up defaults. - */ -} - -bool digitalRead(pin_t pin) { - if (!VALID_PIN(pin)) return false; - - return LPC_GPIO(LPC1768_PIN_PORT(pin))->FIOPIN & LPC_PIN(LPC1768_PIN_PIN(pin)) ? 1 : 0; -} - -void analogWrite(pin_t pin, int pwm_value) { // 1 - 254: pwm_value, 0: LOW, 255: HIGH - if (!VALID_PIN(pin)) return; - - #define MR0_MARGIN 200 // if channel value too close to MR0 the system locks up - - static bool out_of_PWM_slots = false; - - uint value = MAX(MIN(pwm_value, 255), 0); - if (value == 0 || value == 255) { // treat as digital pin - LPC1768_PWM_detach_pin(pin); // turn off PWM - digitalWrite(pin, value); - } - else { - if (LPC1768_PWM_attach_pin(pin, 1, LPC_PWM1->MR0, 0xFF)) - LPC1768_PWM_write(pin, map(value, 0, 255, 1, LPC_PWM1->MR0)); // map 1-254 onto PWM range - else { // out of PWM channels - if (!out_of_PWM_slots) SERIAL_ECHOPGM(".\nWARNING - OUT OF PWM CHANNELS\n.\n"); //only warn once - out_of_PWM_slots = true; - digitalWrite(pin, value); // treat as a digital pin if out of channels - } - } -} - -extern bool HAL_adc_finished(); - -uint16_t analogRead(pin_t adc_pin) { - HAL_adc_start_conversion(adc_pin); - while (!HAL_adc_finished()); // Wait for conversion to finish - return HAL_adc_get_result(); -} - -// ************************** -// Persistent Config Storage -// ************************** - -void eeprom_write_byte(unsigned char *pos, unsigned char value) { - -} - -unsigned char eeprom_read_byte(uint8_t * pos) { return '\0'; } - -void eeprom_read_block(void *__dst, const void *__src, size_t __n) { } - -void eeprom_update_block(const void *__src, void *__dst, size_t __n) { } - -char *dtostrf (double __val, signed char __width, unsigned char __prec, char *__s) { - char format_string[20]; - snprintf(format_string, 20, "%%%d.%df", __width, __prec); - sprintf(__s, format_string, __val); - return __s; -} - -int32_t random(int32_t max) { - return rand() % max; -} - -int32_t random(int32_t min, int32_t max) { - return min + rand() % (max - min); -} - -void randomSeed(uint32_t value) { - srand(value); -} - -int map(uint16_t x, uint16_t in_min, uint16_t in_max, uint16_t out_min, uint16_t out_max) { - return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; -} - -#endif // TARGET_LPC1768 diff --git a/Marlin/src/HAL/HAL_LPC1768/debug_extra_script.py b/Marlin/src/HAL/HAL_LPC1768/debug_extra_script.py deleted file mode 100644 index ae53adea0a..0000000000 --- a/Marlin/src/HAL/HAL_LPC1768/debug_extra_script.py +++ /dev/null @@ -1,21 +0,0 @@ -Import("env") - -env.AddPostAction( - "$BUILD_DIR/firmware.hex", - env.VerboseAction(" ".join([ - "sed", "-i.bak", - "s/:10040000FFFFFFFFFFFFFFFFFFFFFFFFDEF9FFFF23/:10040000FFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFD/", - "$BUILD_DIR/firmware.hex" - ]), "Fixing $BUILD_DIR/firmware.hex secure flash flags")) -env.AddPreAction( - "upload", - env.VerboseAction(" ".join([ - "echo", - "'h\\nloadfile $BUILD_DIR/firmware.hex\\nr\\nq\\n'", - ">$BUILD_DIR/aux.jlink" - ]), "Creating auxiliary files")) - -env.Replace( - UPLOADHEXCMD= - 'JLinkExe -device MK20DX256xxx7 -speed 4000 -if swd -autoconnect 1 -CommanderScript $BUILD_DIR/aux.jlink -SkipProgOnCRCMatch = 1 -VerifyDownload = 1' -) diff --git a/Marlin/src/HAL/HAL_LPC1768/endstop_interrupts.h b/Marlin/src/HAL/HAL_LPC1768/endstop_interrupts.h index 2dfed2f884..3d0b472d1e 100644 --- a/Marlin/src/HAL/HAL_LPC1768/endstop_interrupts.h +++ b/Marlin/src/HAL/HAL_LPC1768/endstop_interrupts.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Endstop Interrupts @@ -34,9 +35,6 @@ * (Located in Marlin/buildroot/share/pin_interrupt_test/pin_interrupt_test.ino) */ -#ifndef _ENDSTOP_INTERRUPTS_H_ -#define _ENDSTOP_INTERRUPTS_H_ - #include "../../module/endstops.h" // One ISR for all EXT-Interrupts @@ -92,9 +90,15 @@ void setup_endstop_interrupts(void) { attachInterrupt(digitalPinToInterrupt(Z2_MIN_PIN), endstop_ISR, CHANGE); #endif #if HAS_Z3_MAX + #if !LPC1768_PIN_INTERRUPT_M(Z3_MIN_PIN) + #error "Z3_MIN_PIN is not an INTERRUPT capable pin." + #endif attachInterrupt(digitalPinToInterrupt(Z3_MAX_PIN), endstop_ISR, CHANGE); #endif #if HAS_Z3_MIN + #if !LPC1768_PIN_INTERRUPT_M(Z3_MIN_PIN) + #error "Z3_MIN_PIN is not an INTERRUPT capable pin." + #endif attachInterrupt(digitalPinToInterrupt(Z3_MIN_PIN), endstop_ISR, CHANGE); #endif #if HAS_Z_MIN_PROBE_PIN @@ -104,5 +108,3 @@ void setup_endstop_interrupts(void) { attachInterrupt(digitalPinToInterrupt(Z_MIN_PROBE_PIN), endstop_ISR, CHANGE); #endif } - -#endif //_ENDSTOP_INTERRUPTS_H_ diff --git a/Marlin/src/HAL/HAL_LPC1768/fastio.h b/Marlin/src/HAL/HAL_LPC1768/fastio.h index 5f55f73c86..75ea85acc2 100644 --- a/Marlin/src/HAL/HAL_LPC1768/fastio.h +++ b/Marlin/src/HAL/HAL_LPC1768/fastio.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Fast I/O Routines for LPC1768/9 @@ -32,30 +33,23 @@ * For TARGET LPC1768 */ -#ifndef _FASTIO_LPC1768_H -#define _FASTIO_LPC1768_H - -#include #include -#include -bool useable_hardware_PWM(pin_t pin); -#define USEABLE_HARDWARE_PWM(pin) useable_hardware_PWM(pin) +#define USEABLE_HARDWARE_PWM(pin) TRUE // all pins are PWM capable -#define LPC_PORT_OFFSET (0x0020) -#define LPC_PIN(pin) (1UL << pin) -#define LPC_GPIO(port) ((volatile LPC_GPIO_TypeDef *)(LPC_GPIO0_BASE + LPC_PORT_OFFSET * port)) +#define LPC_PIN(pin) gpio_pin(pin) +#define LPC_GPIO(port) gpio_port(port) -#define SET_DIR_INPUT(IO) (LPC_GPIO(LPC1768_PIN_PORT(IO))->FIODIR &= ~LPC_PIN(LPC1768_PIN_PIN(IO))) -#define SET_DIR_OUTPUT(IO) (LPC_GPIO(LPC1768_PIN_PORT(IO))->FIODIR |= LPC_PIN(LPC1768_PIN_PIN(IO))) +#define SET_DIR_INPUT(IO) gpio_set_input(IO) +#define SET_DIR_OUTPUT(IO) gpio_set_output(IO) -#define SET_MODE(IO, mode) (pin_mode((LPC1768_PIN_PORT(IO), LPC1768_PIN_PIN(IO)), mode)) +#define SET_MODE(IO, mode) pinMode(IO, mode) -#define WRITE_PIN_SET(IO) (LPC_GPIO(LPC1768_PIN_PORT(IO))->FIOSET = LPC_PIN(LPC1768_PIN_PIN(IO))) -#define WRITE_PIN_CLR(IO) (LPC_GPIO(LPC1768_PIN_PORT(IO))->FIOCLR = LPC_PIN(LPC1768_PIN_PIN(IO))) +#define WRITE_PIN_SET(IO) gpio_set(IO) +#define WRITE_PIN_CLR(IO) gpio_clear(IO) -#define READ_PIN(IO) ((LPC_GPIO(LPC1768_PIN_PORT(IO))->FIOPIN & LPC_PIN(LPC1768_PIN_PIN(IO))) ? 1 : 0) -#define WRITE_PIN(IO,V) ((V) ? WRITE_PIN_SET(IO) : WRITE_PIN_CLR(IO)) +#define READ_PIN(IO) gpio_get(IO) +#define WRITE_PIN(IO,V) gpio_set(IO, V) /** * Magic I/O routines @@ -89,10 +83,10 @@ bool useable_hardware_PWM(pin_t pin); #define _PULLDOWN(IO,V) pinMode(IO, (V) ? INPUT_PULLDOWN : INPUT) /// check if pin is an input -#define _GET_INPUT(IO) (LPC_GPIO(LPC1768_PIN_PORT(IO))->FIODIR & LPC_PIN(LPC1768_PIN_PIN(IO)) != 0) +#define _GET_INPUT(IO) (!gpio_get_dir(IO)) /// check if pin is an output -#define _GET_OUTPUT(IO) (LPC_GPIO(LPC1768_PIN_PORT(IO))->FIODIR & LPC_PIN(LPC1768_PIN_PIN(IO)) == 0) +#define _GET_OUTPUT(IO) (gpio_get_dir(IO)) /// check if pin is a timer /// all gpio pins are pwm capable, either interrupt or hardware pwm controlled @@ -127,5 +121,3 @@ bool useable_hardware_PWM(pin_t pin); // Shorthand #define OUT_WRITE(IO,V) do{ SET_OUTPUT(IO); WRITE(IO,V); }while(0) - -#endif // _FASTIO_LPC1768_H diff --git a/Marlin/src/HAL/HAL_LPC1768/include/Arduino.h b/Marlin/src/HAL/HAL_LPC1768/include/Arduino.h deleted file mode 100644 index aebc76a6ea..0000000000 --- a/Marlin/src/HAL/HAL_LPC1768/include/Arduino.h +++ /dev/null @@ -1,125 +0,0 @@ -/** - * 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 . - * - */ - -#ifndef __ARDUINO_H__ -#define __ARDUINO_H__ -#include -#include -#include - -#include - -#define HIGH 0x01 -#define LOW 0x00 - -#define INPUT 0x00 -#define OUTPUT 0x01 -#define INPUT_PULLUP 0x02 -#define INPUT_PULLDOWN 0x03 - -#define LSBFIRST 0 -#define MSBFIRST 1 - -#define CHANGE 0x02 -#define FALLING 0x03 -#define RISING 0x04 - -typedef uint8_t byte; -#define PROGMEM -#define PSTR(v) (v) -#define PGM_P const char * - -// Used for libraries, preprocessor, and constants -#define min(a,b) ((a)<(b)?(a):(b)) -#define max(a,b) ((a)>(b)?(a):(b)) -#define abs(x) ((x)>0?(x):-(x)) - -#ifndef isnan - #define isnan std::isnan -#endif -#ifndef isinf - #define isinf std::isinf -#endif - -#define sq(v) ((v) * (v)) -#define square(v) sq(v) -#define constrain(value, arg_min, arg_max) ((value) < (arg_min) ? (arg_min) :((value) > (arg_max) ? (arg_max) : (value))) - -//Interrupts -void cli(void); // Disable -void sei(void); // Enable -void attachInterrupt(const pin_t pin, void (*callback)(void), uint32_t mode); -void detachInterrupt(const pin_t pin); -extern "C" void GpioEnableInt(uint32_t port, uint32_t pin, uint32_t mode); -extern "C" void GpioDisableInt(uint32_t port, uint32_t pin); - -// Program Memory -#define pgm_read_ptr(addr) (*((void**)(addr))) -#define pgm_read_byte_near(addr) (*((uint8_t*)(addr))) -#define pgm_read_float_near(addr) (*((float*)(addr))) -#define pgm_read_word_near(addr) (*((uint16_t*)(addr))) -#define pgm_read_dword_near(addr) (*((uint32_t*)(addr))) -#define pgm_read_byte(addr) pgm_read_byte_near(addr) -#define pgm_read_float(addr) pgm_read_float_near(addr) -#define pgm_read_word(addr) pgm_read_word_near(addr) -#define pgm_read_dword(addr) pgm_read_dword_near(addr) - -#define memcpy_P memcpy -#define sprintf_P sprintf -#define strstr_P strstr -#define strncpy_P strncpy -#define vsnprintf_P vsnprintf -#define strcpy_P strcpy -#define snprintf_P snprintf -#define strlen_P strlen -#define strchr_P strchr - -// Time functions -extern "C" { - void delay(const int milis); -} -void _delay_ms(const int delay); -void delayMicroseconds(unsigned long); -uint32_t millis(); - -//IO functions -void pinMode(const pin_t, const uint8_t); -void digitalWrite(pin_t, uint8_t); -bool digitalRead(pin_t); -void analogWrite(pin_t, int); -uint16_t analogRead(pin_t); - -// EEPROM -void eeprom_write_byte(unsigned char *pos, unsigned char value); -unsigned char eeprom_read_byte(unsigned char *pos); -void eeprom_read_block (void *__dst, const void *__src, size_t __n); -void eeprom_update_block (const void *__src, void *__dst, size_t __n); - -int32_t random(int32_t); -int32_t random(int32_t, int32_t); -void randomSeed(uint32_t); - -char *dtostrf (double __val, signed char __width, unsigned char __prec, char *__s); - -int map(uint16_t x, uint16_t in_min, uint16_t in_max, uint16_t out_min, uint16_t out_max); - -#endif // __ARDUINO_DEF_H__ diff --git a/Marlin/src/HAL/HAL_LPC1768/include/HardwareSerial.cpp b/Marlin/src/HAL/HAL_LPC1768/include/HardwareSerial.cpp deleted file mode 100644 index 152b045d55..0000000000 --- a/Marlin/src/HAL/HAL_LPC1768/include/HardwareSerial.cpp +++ /dev/null @@ -1,335 +0,0 @@ -/** - * 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 . - * - */ - -#ifdef TARGET_LPC1768 - -#include "HardwareSerial.h" - -#if SERIAL_PORT == 0 || SERIAL_PORT_2 == 0 - HardwareSerial Serial = HardwareSerial(LPC_UART0); -#elif SERIAL_PORT == 1 || SERIAL_PORT_2 == 1 - HardwareSerial Serial1 = HardwareSerial((LPC_UART_TypeDef *) LPC_UART1); -#elif SERIAL_PORT == 2 || SERIAL_PORT_2 == 2 - HardwareSerial Serial2 = HardwareSerial(LPC_UART2); -#elif SERIAL_PORT == 3 || SERIAL_PORT_2 == 3 - HardwareSerial Serial3 = HardwareSerial(LPC_UART3); -#endif - -void HardwareSerial::begin(uint32_t baudrate) { - - UART_CFG_Type UARTConfigStruct; - PINSEL_CFG_Type PinCfg; - UART_FIFO_CFG_Type FIFOConfig; - - if (Baudrate == baudrate) return; // No need to re-initialize - - if (UARTx == LPC_UART0) { - // Initialize UART0 pin connect - PinCfg.Funcnum = 1; - PinCfg.OpenDrain = 0; - PinCfg.Pinmode = 0; - PinCfg.Pinnum = 2; - PinCfg.Portnum = 0; - PINSEL_ConfigPin(&PinCfg); - PinCfg.Pinnum = 3; - PINSEL_ConfigPin(&PinCfg); - } else if ((LPC_UART1_TypeDef *) UARTx == LPC_UART1) { - // Initialize UART1 pin connect - PinCfg.Funcnum = 1; - PinCfg.OpenDrain = 0; - PinCfg.Pinmode = 0; - PinCfg.Pinnum = 15; - PinCfg.Portnum = 0; - PINSEL_ConfigPin(&PinCfg); - PinCfg.Pinnum = 16; - PINSEL_ConfigPin(&PinCfg); - } else if (UARTx == LPC_UART2) { - // Initialize UART2 pin connect - PinCfg.Funcnum = 1; - PinCfg.OpenDrain = 0; - PinCfg.Pinmode = 0; - PinCfg.Pinnum = 10; - PinCfg.Portnum = 0; - PINSEL_ConfigPin(&PinCfg); - PinCfg.Pinnum = 11; - PINSEL_ConfigPin(&PinCfg); - } else if (UARTx == LPC_UART3) { - // Initialize UART2 pin connect - PinCfg.Funcnum = 1; - PinCfg.OpenDrain = 0; - PinCfg.Pinmode = 0; - PinCfg.Pinnum = 0; - PinCfg.Portnum = 0; - PINSEL_ConfigPin(&PinCfg); - PinCfg.Pinnum = 1; - PINSEL_ConfigPin(&PinCfg); - } - - /* Initialize UART Configuration parameter structure to default state: - * Baudrate = 9600bps - * 8 data bit - * 1 Stop bit - * None parity - */ - UART_ConfigStructInit(&UARTConfigStruct); - - // Re-configure baudrate - UARTConfigStruct.Baud_rate = baudrate; - - // Initialize eripheral with given to corresponding parameter - UART_Init(UARTx, &UARTConfigStruct); - - // Enable and reset the TX and RX FIFOs - UART_FIFOConfigStructInit(&FIFOConfig); - UART_FIFOConfig(UARTx, &FIFOConfig); - - // Enable UART Transmit - UART_TxCmd(UARTx, ENABLE); - - // Configure Interrupts - UART_IntConfig(UARTx, UART_INTCFG_RBR, ENABLE); - UART_IntConfig(UARTx, UART_INTCFG_RLS, ENABLE); - - // Set proper priority and enable interrupts - if (UARTx == LPC_UART0) { - NVIC_SetPriority(UART0_IRQn, NVIC_EncodePriority(0, 3, 0)); - NVIC_EnableIRQ(UART0_IRQn); - } - else if ((LPC_UART1_TypeDef *) UARTx == LPC_UART1) { - NVIC_SetPriority(UART1_IRQn, NVIC_EncodePriority(0, 3, 0)); - NVIC_EnableIRQ(UART1_IRQn); - } - else if (UARTx == LPC_UART2) { - NVIC_SetPriority(UART2_IRQn, NVIC_EncodePriority(0, 3, 0)); - NVIC_EnableIRQ(UART2_IRQn); - } - else if (UARTx == LPC_UART3) { - NVIC_SetPriority(UART3_IRQn, NVIC_EncodePriority(0, 3, 0)); - NVIC_EnableIRQ(UART3_IRQn); - } - - RxQueueWritePos = RxQueueReadPos = 0; - #if TX_BUFFER_SIZE > 0 - TxQueueWritePos = TxQueueReadPos = 0; - #endif - - // Save the configured baudrate - Baudrate = baudrate; -} - -int16_t HardwareSerial::peek() { - int16_t byte = -1; - - // Temporarily lock out UART receive interrupts during this read so the UART receive - // interrupt won't cause problems with the index values - UART_IntConfig(UARTx, UART_INTCFG_RBR, DISABLE); - - if (RxQueueReadPos != RxQueueWritePos) - byte = RxBuffer[RxQueueReadPos]; - - // Re-enable UART interrupts - UART_IntConfig(UARTx, UART_INTCFG_RBR, ENABLE); - - return byte; -} - -int16_t HardwareSerial::read() { - int16_t byte = -1; - - // Temporarily lock out UART receive interrupts during this read so the UART receive - // interrupt won't cause problems with the index values - UART_IntConfig(UARTx, UART_INTCFG_RBR, DISABLE); - - if (RxQueueReadPos != RxQueueWritePos) { - byte = RxBuffer[RxQueueReadPos]; - RxQueueReadPos = (RxQueueReadPos + 1) % RX_BUFFER_SIZE; - } - - // Re-enable UART interrupts - UART_IntConfig(UARTx, UART_INTCFG_RBR, ENABLE); - - return byte; -} - -size_t HardwareSerial::write(uint8_t send) { -#if TX_BUFFER_SIZE > 0 - size_t bytes = 0; - uint32_t fifolvl = 0; - - // If the Tx Buffer is full, wait for space to clear - if ((TxQueueWritePos+1) % TX_BUFFER_SIZE == TxQueueReadPos) flushTX(); - - // Temporarily lock out UART transmit interrupts during this read so the UART transmit interrupt won't - // cause problems with the index values - UART_IntConfig(UARTx, UART_INTCFG_THRE, DISABLE); - - // LPC17xx.h incorrectly defines FIFOLVL as a uint8_t, when it's actually a 32-bit register - if ((LPC_UART1_TypeDef *) UARTx == LPC_UART1) { - fifolvl = *(reinterpret_cast(&((LPC_UART1_TypeDef *) UARTx)->FIFOLVL)); - } else fifolvl = *(reinterpret_cast(&UARTx->FIFOLVL)); - - // If the queue is empty and there's space in the FIFO, immediately send the byte - if (TxQueueWritePos == TxQueueReadPos && fifolvl < UART_TX_FIFO_SIZE) { - bytes = UART_Send(UARTx, &send, 1, BLOCKING); - } - // Otherwiise, write the byte to the transmit buffer - else if ((TxQueueWritePos+1) % TX_BUFFER_SIZE != TxQueueReadPos) { - TxBuffer[TxQueueWritePos] = send; - TxQueueWritePos = (TxQueueWritePos+1) % TX_BUFFER_SIZE; - bytes++; - } - - // Re-enable the TX Interrupt - UART_IntConfig(UARTx, UART_INTCFG_THRE, ENABLE); - - return bytes; -#else - return UART_Send(UARTx, &send, 1, BLOCKING); -#endif -} - -#if TX_BUFFER_SIZE > 0 - void HardwareSerial::flushTX() { - // Wait for the tx buffer and FIFO to drain - while (TxQueueWritePos != TxQueueReadPos && UART_CheckBusy(UARTx) == SET); - } -#endif - -size_t HardwareSerial::available() { - return (RxQueueWritePos + RX_BUFFER_SIZE - RxQueueReadPos) % RX_BUFFER_SIZE; -} - -void HardwareSerial::flush() { - RxQueueWritePos = 0; - RxQueueReadPos = 0; -} - -size_t HardwareSerial::printf(const char *format, ...) { - char RxBuffer[256]; - va_list vArgs; - va_start(vArgs, format); - int length = vsnprintf(RxBuffer, 256, format, vArgs); - va_end(vArgs); - if (length > 0 && length < 256) { - for (size_t i = 0; i < (size_t)length; ++i) - write(RxBuffer[i]); - } - return length; -} - -void HardwareSerial::IRQHandler() { - uint32_t IIRValue; - uint8_t LSRValue, byte; - - IIRValue = UART_GetIntId(UARTx); - IIRValue &= UART_IIR_INTID_MASK; // check bit 1~3, interrupt identification - - // Receive Line Status - if (IIRValue == UART_IIR_INTID_RLS) { - LSRValue = UART_GetLineStatus(UARTx); - - // Receive Line Status - if (LSRValue & (UART_LSR_OE | UART_LSR_PE | UART_LSR_FE | UART_LSR_RXFE | UART_LSR_BI)) { - // There are errors or break interrupt - // Read LSR will clear the interrupt - Status = LSRValue; - byte = UART_ReceiveByte(UARTx); // Dummy read on RX to clear interrupt, then bail out - return; - } - } - - // Receive Data Available - if (IIRValue == UART_IIR_INTID_RDA) { - // Clear the FIFO - while (UART_Receive(UARTx, &byte, 1, NONE_BLOCKING)) { - #if ENABLED(EMERGENCY_PARSER) - emergency_parser.update(emergency_state, byte); - #endif - if ((RxQueueWritePos + 1) % RX_BUFFER_SIZE != RxQueueReadPos) { - RxBuffer[RxQueueWritePos] = byte; - RxQueueWritePos = (RxQueueWritePos + 1) % RX_BUFFER_SIZE; - } else - break; - } - // Character timeout indicator - } else if (IIRValue == UART_IIR_INTID_CTI) { - // Character Time-out indicator - Status |= 0x100; // Bit 9 as the CTI error - } - - #if TX_BUFFER_SIZE > 0 - if (IIRValue == UART_IIR_INTID_THRE) { - // Disable THRE interrupt - UART_IntConfig(UARTx, UART_INTCFG_THRE, DISABLE); - - // Wait for FIFO buffer empty - while (UART_CheckBusy(UARTx) == SET); - - // Transfer up to UART_TX_FIFO_SIZE bytes of data - for (int i = 0; i < UART_TX_FIFO_SIZE && TxQueueWritePos != TxQueueReadPos; i++) { - // Move a piece of data into the transmit FIFO - if (UART_Send(UARTx, &TxBuffer[TxQueueReadPos], 1, NONE_BLOCKING)) { - TxQueueReadPos = (TxQueueReadPos+1) % TX_BUFFER_SIZE; - } else break; - } - - // If there is no more data to send, disable the transmit interrupt - else enable it or keep it enabled - if (TxQueueWritePos == TxQueueReadPos) { - UART_IntConfig(UARTx, UART_INTCFG_THRE, DISABLE); - } else UART_IntConfig(UARTx, UART_INTCFG_THRE, ENABLE); - } - #endif -} - -#ifdef __cplusplus -extern "C" { -#endif - -void UART0_IRQHandler(void) { - #if SERIAL_PORT == 0 || SERIAL_PORT_2 == 0 - Serial.IRQHandler(); - #endif -} - -void UART1_IRQHandler(void) { - #if SERIAL_PORT == 1 || SERIAL_PORT_2 == 1 - Serial1.IRQHandler(); - #endif -} - -void UART2_IRQHandler(void) { - #if SERIAL_PORT == 2 || SERIAL_PORT_2 == 2 - Serial2.IRQHandler(); - #endif -} - -void UART3_IRQHandler(void) { - #if SERIAL_PORT == 3 || SERIAL_PORT_2 == 3 - Serial3.IRQHandler(); - #endif -} - -#ifdef __cplusplus -} -#endif - -#endif // TARGET_LPC1768 diff --git a/Marlin/src/HAL/HAL_LPC1768/include/HardwareSerial.h b/Marlin/src/HAL/HAL_LPC1768/include/HardwareSerial.h deleted file mode 100644 index f3bd2f6b42..0000000000 --- a/Marlin/src/HAL/HAL_LPC1768/include/HardwareSerial.h +++ /dev/null @@ -1,91 +0,0 @@ -/** - * 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 . - * - */ - -#ifndef HARDWARE_SERIAL_H_ -#define HARDWARE_SERIAL_H_ - -#include "../../../inc/MarlinConfigPre.h" -#if ENABLED(EMERGENCY_PARSER) - #include "../../../feature/emergency_parser.h" -#endif - -#include -#include -#include - -extern "C" { - #include - #include "lpc17xx_pinsel.h" -} - -class HardwareSerial : public Stream { -private: - LPC_UART_TypeDef *UARTx; - - uint32_t Baudrate; - uint32_t Status; - uint8_t RxBuffer[RX_BUFFER_SIZE]; - uint32_t RxQueueWritePos; - uint32_t RxQueueReadPos; - #if TX_BUFFER_SIZE > 0 - uint8_t TxBuffer[TX_BUFFER_SIZE]; - uint32_t TxQueueWritePos; - uint32_t TxQueueReadPos; - #endif - #if ENABLED(EMERGENCY_PARSER) - EmergencyParser::State emergency_state; - #endif - -public: - HardwareSerial(LPC_UART_TypeDef *UARTx) - : UARTx(UARTx) - , Baudrate(0) - , RxQueueWritePos(0) - , RxQueueReadPos(0) - #if TX_BUFFER_SIZE > 0 - , TxQueueWritePos(0) - , TxQueueReadPos(0) - #endif - #if ENABLED(EMERGENCY_PARSER) - , emergency_state(EmergencyParser::State::EP_RESET) - #endif - { - } - - void begin(uint32_t baudrate); - int16_t peek(); - int16_t read(); - size_t write(uint8_t send); - #if TX_BUFFER_SIZE > 0 - void flushTX(); - #endif - size_t available(); - void flush(); - size_t printf(const char *format, ...); - - operator bool() { return true; } - - void IRQHandler(); - -}; - -#endif // MARLIN_SRC_HAL_HAL_SERIAL_H_ diff --git a/Marlin/src/HAL/HAL_LPC1768/include/SoftwareSerial.cpp b/Marlin/src/HAL/HAL_LPC1768/include/SoftwareSerial.cpp deleted file mode 100644 index 1d469dab3a..0000000000 --- a/Marlin/src/HAL/HAL_LPC1768/include/SoftwareSerial.cpp +++ /dev/null @@ -1,329 +0,0 @@ -/* - * SoftwareSerial.cpp (formerly NewSoftSerial.cpp) - * - * Multi-instance software serial library for Arduino/Wiring - * -- Interrupt-driven receive and other improvements by ladyada - * (http://ladyada.net) - * -- Tuning, circular buffer, derivation from class Print/Stream, - * multi-instance support, porting to 8MHz processors, - * various optimizations, PROGMEM delay tables, inverse logic and - * direct port writing by Mikal Hart (http://www.arduiniana.org) - * -- Pin change interrupt macros by Paul Stoffregen (http://www.pjrc.com) - * -- 20MHz processor support by Garrett Mace (http://www.macetech.com) - * -- ATmega1280/2560 support by Brett Hagman (http://www.roguerobotics.com/) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - * The latest version of this library can always be found at - * http://arduiniana.org. - */ - -#ifdef TARGET_LPC1768 - -// -// Includes -// -//#include -#include "../../../inc/MarlinConfig.h" -#include "../../shared/Delay.h" -#include -#include -#include -#include -#include "../fastio.h" -#include "SoftwareSerial.h" - -void GpioEnableInt(uint32_t port, uint32_t pin, uint32_t mode); -void GpioDisableInt(uint32_t port, uint32_t pin); -// -// Statics -// -SoftwareSerial *SoftwareSerial::active_object = 0; -unsigned char SoftwareSerial::_receive_buffer[_SS_MAX_RX_BUFF]; -volatile uint8_t SoftwareSerial::_receive_buffer_tail = 0; -volatile uint8_t SoftwareSerial::_receive_buffer_head = 0; - -typedef struct _DELAY_TABLE { - long baud; - uint16_t rx_delay_centering; - uint16_t rx_delay_intrabit; - uint16_t rx_delay_stopbit; - uint16_t tx_delay; -} DELAY_TABLE; - -// rough delay estimation -static const DELAY_TABLE table[] = { - //baud |rxcenter|rxintra |rxstop |tx { 250000, 2, 4, 4, 4, }, //Done but not good due to instruction cycle error { 115200, 4, 8, 8, 8, }, //Done but not good due to instruction cycle error - //{ 74880, 69, 139, 62, 162, }, // estimation - //{ 57600, 100, 185, 1, 208, }, // Done but not good due to instruction cycle error - //{ 38400, 13, 26, 26, 26, }, // Done - //{ 19200, 26, 52, 52, 52, }, // Done { 9600, 52, 104, 104, 104, }, // Done - //{ 4800, 104, 208, 208, 208, }, - //{ 2400, 208, 417, 417, 417, }, - //{ 1200, 416, 833, 833, 833,}, -}; - -// -// Private methods -// - -inline void SoftwareSerial::tunedDelay(const uint32_t count) { - DELAY_US(count); -} - -// This function sets the current object as the "listening" -// one and returns true if it replaces another -bool SoftwareSerial::listen() { - if (!_rx_delay_stopbit) - return false; - - if (active_object != this) { - if (active_object) - active_object->stopListening(); - - _buffer_overflow = false; - _receive_buffer_head = _receive_buffer_tail = 0; - active_object = this; - - setRxIntMsk(true); - return true; - } - - return false; -} - -// Stop listening. Returns true if we were actually listening. -bool SoftwareSerial::stopListening() { - if (active_object == this) { - setRxIntMsk(false); - active_object = NULL; - return true; - } - return false; -} - -// -// The receive routine called by the interrupt handler -// -void SoftwareSerial::recv() { - uint8_t d = 0; - - // If RX line is high, then we don't see any start bit - // so interrupt is probably not for us - if (_inverse_logic ? rx_pin_read() : !rx_pin_read()) { - // Disable further interrupts during reception, this prevents - // triggering another interrupt directly after we return, which can - // cause problems at higher baudrates. - setRxIntMsk(false);//__disable_irq();// - - // Wait approximately 1/2 of a bit width to "center" the sample - tunedDelay(_rx_delay_centering); - // Read each of the 8 bits - for (uint8_t i=8; i > 0; --i) { - tunedDelay(_rx_delay_intrabit); - d >>= 1; - if (rx_pin_read()) d |= 0x80; - } - - if (_inverse_logic) d = ~d; - - // if buffer full, set the overflow flag and return - uint8_t next = (_receive_buffer_tail + 1) % _SS_MAX_RX_BUFF; - if (next != _receive_buffer_head) { - // save new data in buffer: tail points to where byte goes - _receive_buffer[_receive_buffer_tail] = d; // save new byte - _receive_buffer_tail = next; - } - else { - _buffer_overflow = true; - } - tunedDelay(_rx_delay_stopbit); - // Re-enable interrupts when we're sure to be inside the stop bit - setRxIntMsk(true); //__enable_irq();// - } -} - -uint32_t SoftwareSerial::rx_pin_read() { - return digitalRead(_receivePin); -} - -// -// Interrupt handling -// - -/* static */ -inline void SoftwareSerial::handle_interrupt() { - if (active_object) - active_object->recv(); -} -extern "C" void intWrapper() { - SoftwareSerial::handle_interrupt(); -} -// -// Constructor -// -SoftwareSerial::SoftwareSerial(pin_t receivePin, pin_t transmitPin, bool inverse_logic /* = false */) : - _rx_delay_centering(0), - _rx_delay_intrabit(0), - _rx_delay_stopbit(0), - _tx_delay(0), - _buffer_overflow(false), - _inverse_logic(inverse_logic) { - setTX(transmitPin); - setRX(receivePin); -} - -// -// Destructor -// -SoftwareSerial::~SoftwareSerial() { - end(); -} - -void SoftwareSerial::setTX(pin_t tx) { - // First write, then set output. If we do this the other way around, - // the pin would be output low for a short while before switching to - // output hihg. Now, it is input with pullup for a short while, which - // is fine. With inverse logic, either order is fine. - - digitalWrite(tx, _inverse_logic ? LOW : HIGH); - pinMode(tx,OUTPUT); - _transmitPin = tx; -} - -void SoftwareSerial::setRX(pin_t rx) { - pinMode(rx, INPUT_PULLUP); // pullup for normal logic! - //if (!_inverse_logic) - // digitalWrite(rx, HIGH); - _receivePin = rx; - _receivePort = LPC1768_PIN_PORT(rx); - _receivePortPin = LPC1768_PIN_PIN(rx); - /* GPIO_T * rxPort = digitalPinToPort(rx); - _receivePortRegister = portInputRegister(rxPort); - _receiveBitMask = digitalPinToBitMask(rx);*/ -} - -// -// Public methods -// - -void SoftwareSerial::begin(long speed) { - _rx_delay_centering = _rx_delay_intrabit = _rx_delay_stopbit = _tx_delay = 0; - - for(uint8_t i = 0; i < sizeof(table)/sizeof(table[0]); ++i) { - long baud = table[i].baud; - if (baud == speed) { - _rx_delay_centering = table[i].rx_delay_centering; - _rx_delay_intrabit = table[i].rx_delay_intrabit; - _rx_delay_stopbit = table[i].rx_delay_stopbit; - _tx_delay = table[i].tx_delay; - break; - } - } - - attachInterrupt(_receivePin, intWrapper, CHANGE); //this->handle_interrupt, CHANGE); - - listen(); - tunedDelay(_tx_delay); - -} - -void SoftwareSerial::setRxIntMsk(bool enable) { - if (enable) - GpioEnableInt(_receivePort,_receivePin,CHANGE); - else - GpioDisableInt(_receivePort,_receivePin); -} - -void SoftwareSerial::end() { - stopListening(); -} - - -// Read data from buffer -int16_t SoftwareSerial::read() { - if (!isListening()) return -1; - - // Empty buffer? - if (_receive_buffer_head == _receive_buffer_tail) return -1; - - // Read from "head" - uint8_t d = _receive_buffer[_receive_buffer_head]; // grab next byte - _receive_buffer_head = (_receive_buffer_head + 1) % _SS_MAX_RX_BUFF; - return d; -} - -size_t SoftwareSerial::available() { - if (!isListening()) return 0; - - return (_receive_buffer_tail + _SS_MAX_RX_BUFF - _receive_buffer_head) % _SS_MAX_RX_BUFF; -} - -size_t SoftwareSerial::write(uint8_t b) { - // By declaring these as local variables, the compiler will put them - // in registers _before_ disabling interrupts and entering the - // critical timing sections below, which makes it a lot easier to - // verify the cycle timings - - bool inv = _inverse_logic; - uint16_t delay = _tx_delay; - - if (inv) b = ~b; - - cli(); // turn off interrupts for a clean txmit - - // Write the start bit - digitalWrite(_transmitPin, !!inv); - - tunedDelay(delay); - - // Write each of the 8 bits - for (uint8_t i = 8; i > 0; --i) { - digitalWrite(_transmitPin, b & 1); // send 1 //(GPIO_Desc[_transmitPin].P)->DOUT |= GPIO_Desc[_transmitPin].bit; - // send 0 //(GPIO_Desc[_transmitPin].P)->DOUT &= ~GPIO_Desc[_transmitPin].bit; - tunedDelay(delay); - b >>= 1; - } - - // restore pin to natural state - digitalWrite(_transmitPin, !inv); - - sei(); // turn interrupts back on - tunedDelay(delay); - - return 1; -} - -void SoftwareSerial::flush() { - if (!isListening()) return; - - cli(); - _receive_buffer_head = _receive_buffer_tail = 0; - sei(); -} - -int16_t SoftwareSerial::peek() { - if (!isListening()) - return -1; - - // Empty buffer? - if (_receive_buffer_head == _receive_buffer_tail) - return -1; - - // Read from "head" - return _receive_buffer[_receive_buffer_head]; -} - -#endif // TARGET_LPC1768 diff --git a/Marlin/src/HAL/HAL_LPC1768/include/SoftwareSerial.h b/Marlin/src/HAL/HAL_LPC1768/include/SoftwareSerial.h deleted file mode 100644 index f208e14b05..0000000000 --- a/Marlin/src/HAL/HAL_LPC1768/include/SoftwareSerial.h +++ /dev/null @@ -1,120 +0,0 @@ -/* - * SoftwareSerial.h (formerly NewSoftSerial.h) - * - * Multi-instance software serial library for Arduino/Wiring - * -- Interrupt-driven receive and other improvements by ladyada - * (http://ladyada.net) - * -- Tuning, circular buffer, derivation from class Print/Stream, - * multi-instance support, porting to 8MHz processors, - * various optimizations, PROGMEM delay tables, inverse logic and - * direct port writing by Mikal Hart (http://www.arduiniana.org) - * -- Pin change interrupt macros by Paul Stoffregen (http://www.pjrc.com) - * -- 20MHz processor support by Garrett Mace (http://www.macetech.com) - * -- ATmega1280/2560 support by Brett Hagman (http://www.roguerobotics.com/) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - * The latest version of this library can always be found at - * http://arduiniana.org. - */ - -#ifndef SOFTWARESERIAL_H -#define SOFTWARESERIAL_H - -#include -#include -//#include "serial.h" -#include -#include - -/****************************************************************************** -* Definitions -******************************************************************************/ - -#define _SS_MAX_RX_BUFF 64 // RX buffer size - -class SoftwareSerial : public Stream -{ -private: - // per object data - pin_t _receivePin; - pin_t _transmitPin; -// uint32_t _receiveBitMask; // for rx interrupts - uint32_t _receivePort; - uint32_t _receivePortPin; - - - // Expressed as 4-cycle delays (must never be 0!) - uint16_t _rx_delay_centering; - uint16_t _rx_delay_intrabit; - uint16_t _rx_delay_stopbit; - uint16_t _tx_delay; - - uint16_t _buffer_overflow:1; - uint16_t _inverse_logic:1; - - // static data - static unsigned char _receive_buffer[_SS_MAX_RX_BUFF]; - static volatile uint8_t _receive_buffer_tail; - static volatile uint8_t _receive_buffer_head; - static SoftwareSerial *active_object; - - // private methods - void recv(); - uint32_t rx_pin_read(); - void tx_pin_write(uint8_t pin_state); - void setTX(pin_t transmitPin); - void setRX(pin_t receivePin); - void setRxIntMsk(bool enable); - - // private static method for timing - static inline void tunedDelay(uint32_t delay); - -public: - // public methods - - SoftwareSerial(pin_t receivePin, pin_t transmitPin, bool inverse_logic = false); - ~SoftwareSerial(); - void begin(long speed); - bool listen(); - void end(); - bool isListening() { return this == active_object; } - bool stopListening(); - bool overflow() { bool ret = _buffer_overflow; if (ret) _buffer_overflow = false; return ret; } - int16_t peek(); - - virtual size_t write(uint8_t byte); - virtual int16_t read(); - virtual size_t available(); - virtual void flush(); - operator bool() { return true; } - - using Print::write; - //using HalSerial::write; - - // public only for easy access by interrupt handlers - static inline void handle_interrupt() __attribute__((__always_inline__)); -}; - -// Arduino 0012 workaround -#undef int -#undef char -#undef long -#undef byte -#undef float -#undef abs -#undef round - -#endif // SOFTWARESERIAL_H diff --git a/Marlin/src/HAL/HAL_LPC1768/include/Wire.cpp b/Marlin/src/HAL/HAL_LPC1768/include/Wire.cpp deleted file mode 100644 index 28e1fa9b56..0000000000 --- a/Marlin/src/HAL/HAL_LPC1768/include/Wire.cpp +++ /dev/null @@ -1,219 +0,0 @@ -/* - TwoWire.cpp - TWI/I2C library for Wiring & Arduino - Copyright (c) 2006 Nicholas Zambetti. All right reserved. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -#ifdef TARGET_LPC1768 - -extern "C" { - #include - #include - #include - #include - #include - #include -} - -#include - -#define USEDI2CDEV_M 1 - -#if (USEDI2CDEV_M == 0) - #define I2CDEV_M LPC_I2C0 -#elif (USEDI2CDEV_M == 1) - #define I2CDEV_M LPC_I2C1 -#elif (USEDI2CDEV_M == 2) - #define I2CDEV_M LPC_I2C2 -#else - #error "Master I2C device not defined!" -#endif - -// Initialize Class Variables ////////////////////////////////////////////////// - -uint8_t TwoWire::rxBuffer[BUFFER_LENGTH]; -uint8_t TwoWire::rxBufferIndex = 0; -uint8_t TwoWire::rxBufferLength = 0; - -uint8_t TwoWire::txAddress = 0; -uint8_t TwoWire::txBuffer[BUFFER_LENGTH]; -uint8_t TwoWire::txBufferIndex = 0; -uint8_t TwoWire::txBufferLength = 0; - -uint8_t TwoWire::transmitting = 0; - -// Constructors //////////////////////////////////////////////////////////////// - -TwoWire::TwoWire() { -} - -// Public Methods ////////////////////////////////////////////////////////////// - -void TwoWire::begin(void) { - rxBufferIndex = 0; - rxBufferLength = 0; - - txBufferIndex = 0; - txBufferLength = 0; - - /* - * Init I2C pin connect - */ - PINSEL_CFG_Type PinCfg; - PinCfg.OpenDrain = 0; - PinCfg.Pinmode = 0; - - #if USEDI2CDEV_M == 0 - PinCfg.Funcnum = 1; - PinCfg.Pinnum = 27; - PinCfg.Portnum = 0; - PINSEL_ConfigPin(&PinCfg); // SDA0 / D57 AUX-1 - PinCfg.Pinnum = 28; - PINSEL_ConfigPin(&PinCfg); // SCL0 / D58 AUX-1 - #endif - - #if USEDI2CDEV_M == 1 - PinCfg.Funcnum = 3; - PinCfg.Pinnum = 0; - PinCfg.Portnum = 0; - PINSEL_ConfigPin(&PinCfg); // SDA1 / D20 SCA - PinCfg.Pinnum = 1; - PINSEL_ConfigPin(&PinCfg); // SCL1 / D21 SCL - #endif - - #if USEDI2CDEV_M == 2 - PinCfg.Funcnum = 2; - PinCfg.Pinnum = 10; - PinCfg.Portnum = 0; - PINSEL_ConfigPin(&PinCfg); // SDA2 / D38 X_ENABLE_PIN - PinCfg.Pinnum = 11; - PINSEL_ConfigPin(&PinCfg); // SCL2 / D55 X_DIR_PIN - #endif - - // Initialize I2C peripheral - I2C_Init(I2CDEV_M, 100000); - - // Enable Master I2C operation - I2C_Cmd(I2CDEV_M, I2C_MASTER_MODE, ENABLE); -} - -uint8_t TwoWire::requestFrom(uint8_t address, uint8_t quantity) { - // clamp to buffer length - if (quantity > BUFFER_LENGTH) - quantity = BUFFER_LENGTH; - - // perform blocking read into buffer - I2C_M_SETUP_Type transferMCfg; - transferMCfg.sl_addr7bit = address >> 1; // not sure about the right shift - transferMCfg.tx_data = NULL; - transferMCfg.tx_length = 0; - transferMCfg.rx_data = rxBuffer; - transferMCfg.rx_length = quantity; - transferMCfg.retransmissions_max = 3; - I2C_MasterTransferData(I2CDEV_M, &transferMCfg, I2C_TRANSFER_POLLING); - - // set rx buffer iterator vars - rxBufferIndex = 0; - rxBufferLength = transferMCfg.rx_count; - - return transferMCfg.rx_count; -} - -uint8_t TwoWire::requestFrom(int address, int quantity) { - return requestFrom((uint8_t)address, (uint8_t)quantity); -} - -void TwoWire::beginTransmission(uint8_t address) { - // indicate that we are transmitting - transmitting = 1; - // set address of targeted slave - txAddress = address; - // reset tx buffer iterator vars - txBufferIndex = 0; - txBufferLength = 0; -} - -void TwoWire::beginTransmission(int address) { - beginTransmission((uint8_t)address); -} - -uint8_t TwoWire::endTransmission(void) { - // transmit buffer (blocking) - I2C_M_SETUP_Type transferMCfg; - transferMCfg.sl_addr7bit = txAddress >> 1; // not sure about the right shift - transferMCfg.tx_data = txBuffer; - transferMCfg.tx_length = txBufferLength; - transferMCfg.rx_data = NULL; - transferMCfg.rx_length = 0; - transferMCfg.retransmissions_max = 3; - Status status = I2C_MasterTransferData(I2CDEV_M, &transferMCfg, I2C_TRANSFER_POLLING); - - // reset tx buffer iterator vars - txBufferIndex = 0; - txBufferLength = 0; - - // indicate that we are done transmitting - transmitting = 0; - - return status == SUCCESS ? 0 : 4; -} - -// must be called after beginTransmission(address) -size_t TwoWire::write(uint8_t data) { - if (transmitting) { - // don't bother if buffer is full - if (txBufferLength >= BUFFER_LENGTH) return 0; - - // put byte in tx buffer - txBuffer[txBufferIndex++] = data; - - // update amount in buffer - txBufferLength = txBufferIndex; - } - - return 1; -} - -// must be called after beginTransmission(address) -size_t TwoWire::write(const uint8_t *data, size_t quantity) { - size_t sent = 0; - if (transmitting) - for (sent = 0; sent < quantity; ++sent) - if (!write(data[sent])) break; - - return sent; -} - -// Must be called after requestFrom(address, numBytes) -int TwoWire::available(void) { - return rxBufferLength - rxBufferIndex; -} - -// Must be called after requestFrom(address, numBytes) -int TwoWire::read(void) { - return rxBufferIndex < rxBufferLength ? rxBuffer[rxBufferIndex++] : -1; -} - -// Must be called after requestFrom(address, numBytes) -int TwoWire::peek(void) { - return rxBufferIndex < rxBufferLength ? rxBuffer[rxBufferIndex] : -1; -} - -// Preinstantiate Objects ////////////////////////////////////////////////////// - -TwoWire Wire = TwoWire(); - -#endif // TARGET_LPC1768 \ No newline at end of file diff --git a/Marlin/src/HAL/HAL_LPC1768/include/Wire.h b/Marlin/src/HAL/HAL_LPC1768/include/Wire.h deleted file mode 100644 index b833d699e4..0000000000 --- a/Marlin/src/HAL/HAL_LPC1768/include/Wire.h +++ /dev/null @@ -1,67 +0,0 @@ -/** - * TwoWire.h - TWI/I2C library for Arduino & Wiring - * Copyright (c) 2006 Nicholas Zambetti. All right reserved. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - * Modified 2012 by Todd Krein (todd@krein.org) to implement repeated starts - */ - -#ifndef _TWOWIRE_H_ -#define _TWOWIRE_H_ - -#include - -#define BUFFER_LENGTH 32 - -class TwoWire { - private: - static uint8_t rxBuffer[]; - static uint8_t rxBufferIndex; - static uint8_t rxBufferLength; - - static uint8_t txAddress; - static uint8_t txBuffer[]; - static uint8_t txBufferIndex; - static uint8_t txBufferLength; - - static uint8_t transmitting; - - public: - TwoWire(); - void begin(); - void beginTransmission(uint8_t); - void beginTransmission(int); - uint8_t endTransmission(void); - uint8_t endTransmission(uint8_t); - - uint8_t requestFrom(uint8_t, uint8_t); - uint8_t requestFrom(int, int); - - virtual size_t write(uint8_t); - virtual size_t write(const uint8_t *, size_t); - virtual int available(void); - virtual int read(void); - virtual int peek(void); - - inline size_t write(unsigned long n) { return write((uint8_t)n); } - inline size_t write(long n) { return write((uint8_t)n); } - inline size_t write(unsigned int n) { return write((uint8_t)n); } - inline size_t write(int n) { return write((uint8_t)n); } -}; - -extern TwoWire Wire; - -#endif // _TWOWIRE_H_ diff --git a/Marlin/src/HAL/HAL_LPC1768/include/digipot_mcp4451_I2C_routines.h b/Marlin/src/HAL/HAL_LPC1768/include/digipot_mcp4451_I2C_routines.h index e44e155a40..ac547b08b1 100644 --- a/Marlin/src/HAL/HAL_LPC1768/include/digipot_mcp4451_I2C_routines.h +++ b/Marlin/src/HAL/HAL_LPC1768/include/digipot_mcp4451_I2C_routines.h @@ -19,13 +19,11 @@ * along with this program. If not, see . * */ +#pragma once // adapted from I2C/master/master.c example // https://www-users.cs.york.ac.uk/~pcc/MCP/HAPR-Course-web/CMSIS/examples/html/master_8c_source.html -#ifndef _DIGIPOT_MCP4451_I2C_ROUTINES_H_ -#define _DIGIPOT_MCP4451_I2C_ROUTINES_H_ - #define USEDI2CDEV_M 1 // use I2C1 controller #if USEDI2CDEV_M == 0 @@ -53,5 +51,3 @@ uint8_t digipot_mcp4451_send_byte(uint8_t data); #ifdef __cplusplus } #endif - -#endif // _DIGIPOT_MCP4451_I2C_ROUTINES_H_ diff --git a/Marlin/src/HAL/HAL_LPC1768/include/pinmapping.cpp b/Marlin/src/HAL/HAL_LPC1768/include/pinmapping.cpp deleted file mode 100644 index f05fa00ace..0000000000 --- a/Marlin/src/HAL/HAL_LPC1768/include/pinmapping.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/** - * 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 . - * - */ - -#ifdef TARGET_LPC1768 - -#include - -#include "../../../gcode/parser.h" - -// Get the digital pin for an analog index -pin_t analogInputToDigitalPin(const int8_t p) { - return (WITHIN(p, 0, NUM_ANALOG_INPUTS) ? adc_pin_table[p] : P_NC); -} - -// Return the index of a pin number -// The pin number given here is in the form ppp:nnnnn -int16_t GET_PIN_MAP_INDEX(const pin_t pin) { - const uint16_t index = (LPC1768_PIN_PORT(pin) << 5) | LPC1768_PIN_PIN(pin); - return (index < NUM_DIGITAL_PINS && pin_map[index] != P_NC) ? index : -1; -} - -// Test whether the pin is valid -bool VALID_PIN(const pin_t p) { - const int16_t ind = GET_PIN_MAP_INDEX(p); - return ind >= 0 && pin_map[ind] >= 0; -} - -// Get the analog index for a digital pin -int8_t DIGITAL_PIN_TO_ANALOG_PIN(const pin_t p) { - return (VALID_PIN(p) ? LPC1768_PIN_ADC(p) : -1); -} - -// Test whether the pin is PWM -bool PWM_PIN(const pin_t p) { - return VALID_PIN(p) && LPC1768_PIN_PWM(p); -} - -// Test whether the pin is interruptable -bool INTERRUPT_PIN(const pin_t p) { - return VALID_PIN(p) && LPC1768_PIN_INTERRUPT(p); -} - -// Get the pin number at the given index -pin_t GET_PIN_MAP_PIN(const int16_t ind) { - return WITHIN(ind, 0, NUM_DIGITAL_PINS - 1) ? pin_map[ind] : P_NC; -} - -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; -} - -#endif // TARGET_LPC1768 diff --git a/Marlin/src/HAL/HAL_LPC1768/include/pinmapping.h b/Marlin/src/HAL/HAL_LPC1768/include/pinmapping.h deleted file mode 100644 index de727b8bde..0000000000 --- a/Marlin/src/HAL/HAL_LPC1768/include/pinmapping.h +++ /dev/null @@ -1,294 +0,0 @@ -/** - * 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 . - * - */ - -#ifndef _PINMAPPING_H_ -#define _PINMAPPING_H_ - -#include "../../../inc/MarlinConfigPre.h" - -#include - -typedef int16_t pin_t; - -#define PORT_0 000 -#define PORT_1 001 -#define PORT_2 010 -#define PORT_3 011 -#define PORT_4 100 - -#define PORT_(p) PORT_##p -#define PORT(p) PORT_(p) - -#define PIN_0 00000 -#define PIN_1 00001 -#define PIN_2 00010 -#define PIN_3 00011 -#define PIN_4 00100 -#define PIN_5 00101 -#define PIN_6 00110 -#define PIN_7 00111 -#define PIN_8 01000 -#define PIN_9 01001 -#define PIN_10 01010 -#define PIN_11 01011 -#define PIN_12 01100 -#define PIN_13 01101 -#define PIN_14 01110 -#define PIN_15 01111 -#define PIN_16 10000 -#define PIN_17 10001 -#define PIN_18 10010 -#define PIN_19 10011 -#define PIN_20 10100 -#define PIN_21 10101 -#define PIN_22 10110 -#define PIN_23 10111 -#define PIN_24 11000 -#define PIN_25 11001 -#define PIN_26 11010 -#define PIN_27 11011 -#define PIN_28 11100 -#define PIN_29 11101 -#define PIN_30 11110 -#define PIN_31 11111 - -#define PIN_(p) PIN_##p -#define PIN(p) PIN_(p) - -#define ADC_NONE 0000 -#define ADC_CHAN_0 0001 -#define ADC_CHAN_1 0010 -#define ADC_CHAN_2 0011 -#define ADC_CHAN_3 0100 -#define ADC_CHAN_4 0101 -#define ADC_CHAN_5 0110 -#define ADC_CHAN_6 0111 -#define ADC_CHAN_7 1000 - -#define ADC_CHAN_(c) ADC_CHAN_##c -#define ADC_CHAN(p) ADC_CHAN_(p) - -#define BOOL_0 0 -#define BOOL_1 1 -#define BOOL_(b) BOOL_##b - -#define INTERRUPT(b) BOOL_(b) -#define PWM(b) BOOL_(b) - -// Combine elements into pin bits: 0b00AAAAWIPPPNNNNN -#define LPC1768_PIN_(port, pin, int, pwm, adc) 0b00##adc##pwm##int##port##pin -#define LPC1768_PIN(port, pin, int, pwm, adc) LPC1768_PIN_(port, pin, int, pwm, adc) - -constexpr uint8_t LPC1768_PIN_PORT(const pin_t pin) { return ((uint8_t)((pin >> 5) & 0b111)); } -constexpr uint8_t LPC1768_PIN_PIN(const pin_t pin) { return ((uint8_t)(pin & 0b11111)); } -constexpr bool LPC1768_PIN_INTERRUPT(const pin_t pin) { return (((pin >> 8) & 0b1) != 0); } -constexpr bool LPC1768_PIN_PWM(const pin_t pin) { return (((pin >> 9) & 0b1) != 0); } -constexpr int8_t LPC1768_PIN_ADC(const pin_t pin) { return (int8_t)((pin >> 10) & 0b1111) - 1; } - -// ****************** -// Runtime pinmapping -// ****************** -#define P_NC -1 - -#if SERIAL_PORT != 3 && SERIAL_PORT_2 != 3 - #define P0_00 LPC1768_PIN(PORT(0), PIN( 0), INTERRUPT(1), PWM(0), ADC_NONE) - #define P0_01 LPC1768_PIN(PORT(0), PIN( 1), INTERRUPT(1), PWM(0), ADC_NONE) -#endif -#if SERIAL_PORT != 0 && SERIAL_PORT_2 != 0 - #define P0_02 LPC1768_PIN(PORT(0), PIN( 2), INTERRUPT(1), PWM(0), ADC_CHAN(7)) - #define P0_03 LPC1768_PIN(PORT(0), PIN( 3), INTERRUPT(1), PWM(0), ADC_CHAN(6)) -#endif -#define P0_04 LPC1768_PIN(PORT(0), PIN( 4), INTERRUPT(1), PWM(0), ADC_NONE) -#define P0_05 LPC1768_PIN(PORT(0), PIN( 5), INTERRUPT(1), PWM(0), ADC_NONE) -#define P0_06 LPC1768_PIN(PORT(0), PIN( 6), INTERRUPT(1), PWM(0), ADC_NONE) -#define P0_07 LPC1768_PIN(PORT(0), PIN( 7), INTERRUPT(1), PWM(0), ADC_NONE) -#define P0_08 LPC1768_PIN(PORT(0), PIN( 8), INTERRUPT(1), PWM(0), ADC_NONE) -#define P0_09 LPC1768_PIN(PORT(0), PIN( 9), INTERRUPT(1), PWM(0), ADC_NONE) -#if SERIAL_PORT != 2 && SERIAL_PORT_2 != 2 - #define P0_10 LPC1768_PIN(PORT(0), PIN(10), INTERRUPT(1), PWM(0), ADC_NONE) - #define P0_11 LPC1768_PIN(PORT(0), PIN(11), INTERRUPT(1), PWM(0), ADC_NONE) -#endif -#if SERIAL_PORT != 1 && SERIAL_PORT_2 != 1 - #define P0_15 LPC1768_PIN(PORT(0), PIN(15), INTERRUPT(1), PWM(0), ADC_NONE) - #define P0_16 LPC1768_PIN(PORT(0), PIN(16), INTERRUPT(1), PWM(0), ADC_NONE) -#endif -#define P0_17 LPC1768_PIN(PORT(0), PIN(17), INTERRUPT(1), PWM(0), ADC_NONE) -#define P0_18 LPC1768_PIN(PORT(0), PIN(18), INTERRUPT(1), PWM(0), ADC_NONE) -#define P0_19 LPC1768_PIN(PORT(0), PIN(19), INTERRUPT(1), PWM(0), ADC_NONE) -#define P0_20 LPC1768_PIN(PORT(0), PIN(20), INTERRUPT(1), PWM(0), ADC_NONE) -#define P0_21 LPC1768_PIN(PORT(0), PIN(21), INTERRUPT(1), PWM(0), ADC_NONE) -#define P0_22 LPC1768_PIN(PORT(0), PIN(22), INTERRUPT(1), PWM(0), ADC_NONE) -#define P0_23 LPC1768_PIN(PORT(0), PIN(23), INTERRUPT(1), PWM(0), ADC_CHAN(0)) -#define P0_24 LPC1768_PIN(PORT(0), PIN(24), INTERRUPT(1), PWM(0), ADC_CHAN(1)) -#define P0_25 LPC1768_PIN(PORT(0), PIN(25), INTERRUPT(1), PWM(0), ADC_CHAN(2)) -#define P0_26 LPC1768_PIN(PORT(0), PIN(26), INTERRUPT(1), PWM(0), ADC_CHAN(3)) -#define P0_27 LPC1768_PIN(PORT(0), PIN(27), INTERRUPT(1), PWM(0), ADC_NONE) -#define P0_28 LPC1768_PIN(PORT(0), PIN(28), INTERRUPT(1), PWM(0), ADC_NONE) -#if SERIAL_PORT != -1 && SERIAL_PORT_2 != -1 - #define P0_29 LPC1768_PIN(PORT(0), PIN(29), INTERRUPT(1), PWM(0), ADC_NONE) - #define P0_30 LPC1768_PIN(PORT(0), PIN(30), INTERRUPT(1), PWM(0), ADC_NONE) -#endif -#define P1_00 LPC1768_PIN(PORT(1), PIN( 0), INTERRUPT(0), PWM(0), ADC_NONE) -#define P1_01 LPC1768_PIN(PORT(1), PIN( 1), INTERRUPT(0), PWM(0), ADC_NONE) -#define P1_04 LPC1768_PIN(PORT(1), PIN( 4), INTERRUPT(0), PWM(0), ADC_NONE) -#define P1_08 LPC1768_PIN(PORT(1), PIN( 8), INTERRUPT(0), PWM(0), ADC_NONE) -#define P1_09 LPC1768_PIN(PORT(1), PIN( 9), INTERRUPT(0), PWM(0), ADC_NONE) -#define P1_10 LPC1768_PIN(PORT(1), PIN(10), INTERRUPT(0), PWM(0), ADC_NONE) -#define P1_14 LPC1768_PIN(PORT(1), PIN(14), INTERRUPT(0), PWM(0), ADC_NONE) -#define P1_15 LPC1768_PIN(PORT(1), PIN(15), INTERRUPT(0), PWM(0), ADC_NONE) -#define P1_16 LPC1768_PIN(PORT(1), PIN(16), INTERRUPT(0), PWM(0), ADC_NONE) -#define P1_17 LPC1768_PIN(PORT(1), PIN(17), INTERRUPT(0), PWM(0), ADC_NONE) -#define P1_18 LPC1768_PIN(PORT(1), PIN(18), INTERRUPT(0), PWM(1), ADC_NONE) -#define P1_19 LPC1768_PIN(PORT(1), PIN(19), INTERRUPT(0), PWM(0), ADC_NONE) -#define P1_20 LPC1768_PIN(PORT(1), PIN(20), INTERRUPT(0), PWM(1), ADC_NONE) -#define P1_21 LPC1768_PIN(PORT(1), PIN(21), INTERRUPT(0), PWM(1), ADC_NONE) -#define P1_22 LPC1768_PIN(PORT(1), PIN(22), INTERRUPT(0), PWM(0), ADC_NONE) -#define P1_23 LPC1768_PIN(PORT(1), PIN(23), INTERRUPT(0), PWM(1), ADC_NONE) -#define P1_24 LPC1768_PIN(PORT(1), PIN(24), INTERRUPT(0), PWM(1), ADC_NONE) -#define P1_25 LPC1768_PIN(PORT(1), PIN(25), INTERRUPT(0), PWM(0), ADC_NONE) -#define P1_26 LPC1768_PIN(PORT(1), PIN(26), INTERRUPT(0), PWM(1), ADC_NONE) -#define P1_27 LPC1768_PIN(PORT(1), PIN(27), INTERRUPT(0), PWM(0), ADC_NONE) -#define P1_28 LPC1768_PIN(PORT(1), PIN(28), INTERRUPT(0), PWM(0), ADC_NONE) -#define P1_29 LPC1768_PIN(PORT(1), PIN(29), INTERRUPT(0), PWM(0), ADC_NONE) -#define P1_30 LPC1768_PIN(PORT(1), PIN(30), INTERRUPT(0), PWM(0), ADC_CHAN(4)) -#define P1_31 LPC1768_PIN(PORT(1), PIN(31), INTERRUPT(0), PWM(0), ADC_CHAN(5)) -#define P2_00 LPC1768_PIN(PORT(2), PIN( 0), INTERRUPT(1), PWM(1), ADC_NONE) -#define P2_01 LPC1768_PIN(PORT(2), PIN( 1), INTERRUPT(1), PWM(1), ADC_NONE) -#define P2_02 LPC1768_PIN(PORT(2), PIN( 2), INTERRUPT(1), PWM(1), ADC_NONE) -#define P2_03 LPC1768_PIN(PORT(2), PIN( 3), INTERRUPT(1), PWM(1), ADC_NONE) -#define P2_04 LPC1768_PIN(PORT(2), PIN( 4), INTERRUPT(1), PWM(1), ADC_NONE) -#define P2_05 LPC1768_PIN(PORT(2), PIN( 5), INTERRUPT(1), PWM(1), ADC_NONE) -#define P2_06 LPC1768_PIN(PORT(2), PIN( 6), INTERRUPT(1), PWM(0), ADC_NONE) -#define P2_07 LPC1768_PIN(PORT(2), PIN( 7), INTERRUPT(1), PWM(0), ADC_NONE) -#define P2_08 LPC1768_PIN(PORT(2), PIN( 8), INTERRUPT(1), PWM(0), ADC_NONE) -#define P2_09 LPC1768_PIN(PORT(2), PIN( 9), INTERRUPT(1), PWM(0), ADC_NONE) -#define P2_10 LPC1768_PIN(PORT(2), PIN(10), INTERRUPT(1), PWM(0), ADC_NONE) -#define P2_11 LPC1768_PIN(PORT(2), PIN(11), INTERRUPT(1), PWM(0), ADC_NONE) -#define P2_12 LPC1768_PIN(PORT(2), PIN(12), INTERRUPT(1), PWM(0), ADC_NONE) -#define P2_13 LPC1768_PIN(PORT(2), PIN(13), INTERRUPT(1), PWM(0), ADC_NONE) -#define P3_25 LPC1768_PIN(PORT(3), PIN(25), INTERRUPT(0), PWM(1), ADC_NONE) -#define P3_26 LPC1768_PIN(PORT(3), PIN(26), INTERRUPT(0), PWM(1), ADC_NONE) -#define P4_28 LPC1768_PIN(PORT(4), PIN(28), INTERRUPT(0), PWM(0), ADC_NONE) -#define P4_29 LPC1768_PIN(PORT(4), PIN(29), INTERRUPT(0), PWM(0), ADC_NONE) - -// Pin index for M43 and M226 -constexpr pin_t pin_map[] = { - #if SERIAL_PORT != 3 && SERIAL_PORT_2 != 3 - P0_00, P0_01, - #else - P_NC, P_NC, - #endif - #if SERIAL_PORT != 0 && SERIAL_PORT_2 != 0 - P0_02, P0_03, - #else - P_NC, P_NC, - #endif - P0_04, P0_05, P0_06, P0_07, - P0_08, P0_09, - #if SERIAL_PORT != 2 && SERIAL_PORT_2 != 2 - P0_10, P0_11, - #else - P_NC, P_NC, - #endif - P_NC, P_NC, P_NC, - #if SERIAL_PORT != 1 && SERIAL_PORT_2 != 1 - P0_15, - P0_16, - #else - P_NC, - P_NC, - #endif - P0_17, P0_18, P0_19, P0_20, P0_21, P0_22, P0_23, - P0_24, P0_25, P0_26, P0_27, P0_28, - #if SERIAL_PORT != -1 && SERIAL_PORT_2 != -1 - P0_29, P0_30, - #else - P_NC, P_NC, - #endif - P_NC, - - P1_00, P1_01, P_NC, P_NC, P1_04, P_NC, P_NC, P_NC, - P1_08, P1_09, P1_10, P_NC, P_NC, P_NC, P1_14, P1_15, - P1_16, P1_17, P1_18, P1_19, P1_20, P1_21, P1_22, P1_23, - P1_24, P1_25, P1_26, P1_27, P1_28, P1_29, P1_30, P1_31, - - P2_00, P2_01, P2_02, P2_03, P2_04, P2_05, P2_06, P2_07, - P2_08, P2_09, P2_10, P2_11, P2_12, P2_13, P_NC, P_NC, - P_NC, P_NC, P_NC, P_NC, P_NC, P_NC, P_NC, P_NC, - P_NC, P_NC, P_NC, P_NC, P_NC, P_NC, P_NC, P_NC, - - P_NC, P_NC, P_NC, P_NC, P_NC, P_NC, P_NC, P_NC, - P_NC, P_NC, P_NC, P_NC, P_NC, P_NC, P_NC, P_NC, - P_NC, P_NC, P_NC, P_NC, P_NC, P_NC, P_NC, P_NC, - P_NC, P3_25, P3_26, P_NC, P_NC, P_NC, P_NC, P_NC, - - P_NC, P_NC, P_NC, P_NC, P_NC, P_NC, P_NC, P_NC, - P_NC, P_NC, P_NC, P_NC, P_NC, P_NC, P_NC, P_NC, - P_NC, P_NC, P_NC, P_NC, P_NC, P_NC, P_NC, P_NC, - P_NC, P_NC, P_NC, P_NC, P4_28, P4_29, P_NC, P_NC -}; - -constexpr uint8_t NUM_DIGITAL_PINS = COUNT(pin_map); - -constexpr pin_t adc_pin_table[] = { - P0_23, P0_24, P0_25, P0_26, P1_30, P1_31, - #if SERIAL_PORT != 0 && SERIAL_PORT_2 != 0 - P0_03, P0_02 - #endif -}; - -#if SERIAL_PORT != 0 && SERIAL_PORT_2 != 0 - #define NUM_ANALOG_INPUTS 8 -#else - #define NUM_ANALOG_INPUTS 6 -#endif - -// P0.6 thru P0.9 are for the onboard SD card -#define HAL_SENSITIVE_PINS P0_06, P0_07, P0_08, P0_09 - -// Get the digital pin for an analog index -pin_t analogInputToDigitalPin(const int8_t p); -#define digitalPinToInterrupt(pin) (pin) -// Return the index of a pin number -// The pin number given here is in the form ppp:nnnnn -int16_t GET_PIN_MAP_INDEX(const pin_t pin); - -// Test whether the pin is valid -bool VALID_PIN(const pin_t p); - -// Get the analog index for a digital pin -int8_t DIGITAL_PIN_TO_ANALOG_PIN(const pin_t p); - -// Test whether the pin is PWM -bool PWM_PIN(const pin_t p); - -// Test whether the pin is interruptable -bool INTERRUPT_PIN(const pin_t p); -#define LPC1768_PIN_INTERRUPT_M(pin) (((pin >> 8) & 0b1) != 0) - -// Get the pin number at the given index -pin_t GET_PIN_MAP_PIN(const int16_t ind); - -// Parse a G-code word into a pin index -int16_t PARSED_PIN_INDEX(const char code, const int16_t dval); - -#endif // _PINMAPPING_H_ diff --git a/Marlin/src/HAL/HAL_LPC1768/include/serial.h b/Marlin/src/HAL/HAL_LPC1768/include/serial.h deleted file mode 100644 index 3fe8a8cb1d..0000000000 --- a/Marlin/src/HAL/HAL_LPC1768/include/serial.h +++ /dev/null @@ -1,161 +0,0 @@ -/** - * 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 . - * - */ - -#ifndef _HAL_SERIAL_H_ -#define _HAL_SERIAL_H_ - -#include "../../../inc/MarlinConfigPre.h" -#if ENABLED(EMERGENCY_PARSER) - #include "../../../feature/emergency_parser.h" -#endif - -#include -#include -#include - -/** - * Generic RingBuffer - * T type of the buffer array - * S size of the buffer (must be power of 2) - */ - -template class RingBuffer { -public: - RingBuffer() {index_read = index_write = 0;} - - uint32_t available() {return mask(index_write - index_read);} - uint32_t free() {return buffer_size - available();} - bool empty() {return index_read == index_write;} - bool full() {return next(index_write) == index_read;} - void clear() {index_read = index_write = 0;} - - bool peek(T *const value) { - if (value == nullptr || empty()) return false; - *value = buffer[index_read]; - return true; - } - - uint32_t read(T *const value) { - if (value == nullptr || empty()) return 0; - *value = buffer[index_read]; - index_read = next(index_read); - return 1; - } - - uint32_t write(T value) { - uint32_t next_head = next(index_write); - if (next_head == index_read) return 0; // buffer full - buffer[index_write] = value; - index_write = next_head; - return 1; - } - -private: - inline uint32_t mask(uint32_t val) { - return val & buffer_mask; - } - - inline uint32_t next(uint32_t val) { - return mask(val + 1); - } - - static const uint32_t buffer_size = S; - static const uint32_t buffer_mask = buffer_size - 1; - T buffer[buffer_size]; - volatile uint32_t index_write; - volatile uint32_t index_read; -}; - -/** - * Serial Interface Class - * Data is injected directly into, and consumed from, the fifo buffers - */ - -class HalSerial: public Print { -public: - - #if ENABLED(EMERGENCY_PARSER) - EmergencyParser::State emergency_state; - #endif - - HalSerial() : host_connected(false) { } - virtual ~HalSerial() { } - - operator bool() { return host_connected; } - - void begin(int32_t baud) { } - - int16_t peek() { - uint8_t value; - return receive_buffer.peek(&value) ? value : -1; - } - - int16_t read() { - uint8_t value; - return receive_buffer.read(&value) ? value : -1; - } - - size_t write(const uint8_t c) { - if (!host_connected) return 0; // Do not fill buffer when host disconnected - while (transmit_buffer.write(c) == 0) { // Block until there is free room in buffer - if (!host_connected) return 0; // Break infinite loop on host disconect - } - return 1; - } - - size_t available() { - return (size_t)receive_buffer.available(); - } - - void flush() { - receive_buffer.clear(); - } - - uint8_t availableForWrite(void) { - return transmit_buffer.free() > 255 ? 255 : (uint8_t)transmit_buffer.free(); - } - - void flushTX(void) { - while (transmit_buffer.available() && host_connected) { /* nada */} - } - - size_t printf(const char *format, ...) { - static char buffer[256]; - va_list vArgs; - va_start(vArgs, format); - int length = vsnprintf((char *) buffer, 256, (char const *) format, vArgs); - va_end(vArgs); - size_t i = 0; - if (length > 0 && length < 256) { - while (i < (size_t)length && host_connected) { - i += transmit_buffer.write(buffer[i]); - } - } - return i; - } - - RingBuffer receive_buffer; - RingBuffer transmit_buffer; - volatile bool host_connected; -}; - -#endif // _HAL_SERIAL_H_ diff --git a/Marlin/src/HAL/HAL_LPC1768/lpc1768_flag_script.py b/Marlin/src/HAL/HAL_LPC1768/lpc1768_flag_script.py deleted file mode 100644 index 44ded586fe..0000000000 --- a/Marlin/src/HAL/HAL_LPC1768/lpc1768_flag_script.py +++ /dev/null @@ -1,60 +0,0 @@ -from __future__ import print_function -import sys - -#dynamic build flags for generic compile options -if __name__ == "__main__": - args = " ".join([ "-std=gnu11", - "-std=gnu++11", - "-Os", - "-mcpu=cortex-m3", - "-mthumb", - - "-fsigned-char", - "-fno-move-loop-invariants", - "-fno-strict-aliasing", - "-fsingle-precision-constant", - - "--specs=nano.specs", - "--specs=nosys.specs", - - # For external libraries - "-IMarlin/src/HAL/HAL_LPC1768/include", - - # For MarlinFirmware/U8glib-HAL - "-IMarlin/src/HAL/HAL_LPC1768/u8g", - "-DU8G_HAL_LINKS", - - "-MMD", - "-MP", - "-DTARGET_LPC1768" - ]) - - for i in range(1, len(sys.argv)): - args += " " + sys.argv[i] - - print(args) - -# extra script for linker options -else: - from SCons.Script import DefaultEnvironment - env = DefaultEnvironment() - env.Append( - ARFLAGS=["rcs"], - - ASFLAGS=["-x", "assembler-with-cpp"], - - CXXFLAGS=[ - "-fabi-version=0", - "-fno-use-cxa-atexit", - "-fno-threadsafe-statics" - ], - LINKFLAGS=[ - "-Wl,-Tframeworks/CMSIS/LPC1768/system/LPC1768.ld,--gc-sections", - "-Os", - "-mcpu=cortex-m3", - "-mthumb", - "--specs=nano.specs", - "--specs=nosys.specs", - "-u_printf_float" - ], - ) diff --git a/Marlin/src/HAL/HAL_LPC1768/main.cpp b/Marlin/src/HAL/HAL_LPC1768/main.cpp index 399120dac7..c4aea39660 100644 --- a/Marlin/src/HAL/HAL_LPC1768/main.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/main.cpp @@ -1,15 +1,5 @@ #ifdef TARGET_LPC1768 -// --------------------- -// Userspace entry point -// --------------------- -extern void setup(); -extern void loop(); - -extern "C" { - #include -} - #include #include #include @@ -17,84 +7,78 @@ extern "C" { #include #include #include +#include +#include extern "C" { #include - #include - #include } +#include "../../sd/cardreader.h" #include "../../inc/MarlinConfig.h" #include "HAL.h" -#include "fastio.h" #include "HAL_timers.h" -#include -#include -#include -#include "serial.h" -#include "LPC1768_PWM.h" - -static __INLINE uint32_t SysTick_Config(uint32_t ticks) { - if (ticks > SysTick_LOAD_RELOAD_Msk) return 1; - - SysTick->LOAD = (ticks & SysTick_LOAD_RELOAD_Msk) - 1; // Set reload register - SysTick->VAL = 0; // Load the SysTick Counter Value - SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | - SysTick_CTRL_TICKINT_Msk | - SysTick_CTRL_ENABLE_Msk; // Enable SysTick IRQ and SysTick Timer - - NVIC_SetPriority(SysTick_IRQn, NVIC_EncodePriority(0, 0, 0)); // Set Priority for Cortex-M3 System Interrupts - return 0; -} - -extern "C" { - extern int isLPC1769(); - extern void disk_timerproc(void); - volatile uint32_t _millis; - - void SysTick_Handler(void) { - ++_millis; - disk_timerproc(); - } - - // Runs after clock init and before global static constructors - void SystemPostInit() { - _millis = 0; // Initialize the millisecond counter value - SysTick_Config(SystemCoreClock / 1000); // Start millisecond global counter - - // Runs before setup() to configure LED_PIN and used to indicate successful bootloader execution - #if PIN_EXISTS(LED) - SET_DIR_OUTPUT(LED_PIN); - WRITE_PIN_CLR(LED_PIN); - - // MKS_SBASE has 3 other LEDs the bootloader uses during flashing. Clear them. - SET_DIR_OUTPUT(P1_19); - WRITE_PIN_CLR(P1_19); - SET_DIR_OUTPUT(P1_20); - WRITE_PIN_CLR(P1_20); - SET_DIR_OUTPUT(P1_21); - WRITE_PIN_CLR(P1_21); - - for (uint8_t i = 6; i--;) { - TOGGLE(LED_PIN); - delay(100); - } - #endif - } -} extern uint32_t MSC_SD_Init(uint8_t pdrv); +extern "C" int isLPC1769(); +extern "C" void disk_timerproc(void); -int main(void) { +void SysTick_Callback() { + disk_timerproc(); +} - (void)MSC_SD_Init(0); +void HAL_init() { + + // Support the 4 LEDs some LPC176x boards have + #if PIN_EXISTS(LED) + SET_DIR_OUTPUT(LED_PIN); + WRITE_PIN_CLR(LED_PIN); + #if PIN_EXISTS(LED2) + SET_DIR_OUTPUT(LED2_PIN); + WRITE_PIN_CLR(LED2_PIN); + #if PIN_EXISTS(LED3) + SET_DIR_OUTPUT(LED3_PIN); + WRITE_PIN_CLR(LED3_PIN); + #if PIN_EXISTS(LED4) + SET_DIR_OUTPUT(LED4_PIN); + WRITE_PIN_CLR(LED4_PIN); + #endif + #endif + #endif + + // Flash status LED 3 times to indicate Marlin has started booting + for (uint8_t i = 0; i < 6; ++i) { + TOGGLE(LED_PIN); + delay(100); + } + #endif + + //debug_frmwrk_init(); + //_DBG("\n\nDebug running\n"); + // Initialise the SD card chip select pins as soon as possible + #if PIN_EXISTS(SS) + WRITE(SS_PIN, HIGH); + SET_OUTPUT(SS_PIN); + #endif + + #if defined(ONBOARD_SD_CS) && ONBOARD_SD_CS > -1 + WRITE(ONBOARD_SD_CS, HIGH); + SET_OUTPUT(ONBOARD_SD_CS); + #endif USB_Init(); // USB Initialization - USB_Connect(TRUE); // USB Connect + USB_Connect(FALSE); // USB clear connection + delay(1000); // Give OS time to notice + USB_Connect(TRUE); - const uint32_t usb_timeout = millis() + 2000; + #if DISABLED(USB_SD_DISABLED) + MSC_SD_Init(0); // Enable USB SD card access + #endif + + const millis_t usb_timeout = millis() + 2000; while (!USB_Configuration && PENDING(millis(), usb_timeout)) { delay(50); + HAL_idletask(); #if PIN_EXISTS(LED) TOGGLE(LED_PIN); // Flash quickly during USB initialization #endif @@ -110,11 +94,25 @@ int main(void) { #endif HAL_timer_init(); +} - LPC1768_PWM_init(); - - setup(); - for (;;) loop(); +// HAL idle task +void HAL_idletask(void) { + #if ENABLED(SDSUPPORT) && ENABLED(SHARED_SD_CARD) + // If Marlin is using the SD card we need to lock it to prevent access from + // a PC via USB. + // Other HALs use IS_SD_PRINTING() and IS_SD_FILE_OPEN() to check for access but + // this will not reliably detect delete operations. To be safe we will lock + // the disk if Marlin has it mounted. Unfortuately there is currently no way + // to unmount the disk from the LCD menu. + // if (IS_SD_PRINTING() || IS_SD_FILE_OPEN()) + if (card.flag.cardOK) + MSC_Aquire_Lock(); + else + MSC_Release_Lock(); + #endif + // Perform USB stack housekeeping + MSC_RunDeferredCommands(); } #endif // TARGET_LPC1768 diff --git a/Marlin/src/HAL/HAL_LPC1768/persistent_store_api.h b/Marlin/src/HAL/HAL_LPC1768/persistent_store_api.h index 9f6d626491..fb659b396c 100644 --- a/Marlin/src/HAL/HAL_LPC1768/persistent_store_api.h +++ b/Marlin/src/HAL/HAL_LPC1768/persistent_store_api.h @@ -21,4 +21,4 @@ */ #include "../shared/persistent_store_api.h" -//#define FLASH_EEPROM +#define FLASH_EEPROM diff --git a/Marlin/src/HAL/HAL_LPC1768/persistent_store_flash.cpp b/Marlin/src/HAL/HAL_LPC1768/persistent_store_flash.cpp index daffddf079..e08da20904 100644 --- a/Marlin/src/HAL/HAL_LPC1768/persistent_store_flash.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/persistent_store_flash.cpp @@ -57,7 +57,7 @@ extern "C" { #define EEPROM_ERASE (0xff) #define SLOT_ADDRESS(sector, slot) (((uint8_t *)SECTOR_START(sector)) + slot * EEPROM_SIZE) -static uint8_t ram_eeprom[EEPROM_SIZE]; +static uint8_t ram_eeprom[EEPROM_SIZE] __attribute__((aligned(4))) = {0}; static bool eeprom_dirty = false; static int current_slot = 0; @@ -69,20 +69,15 @@ bool PersistentStore::access_start() { __disable_irq(); status = BlankCheckSector(EEPROM_SECTOR, EEPROM_SECTOR, &first_nblank_loc, &first_nblank_val); __enable_irq(); - SERIAL_PROTOCOLLNPAIR("Blank check status: ", status); + if (status == CMD_SUCCESS) { // sector is blank so nothing stored yet - SERIAL_PROTOCOLLNPGM("FLASH empty"); for (int i = 0; i < EEPROM_SIZE; i++) ram_eeprom[i] = EEPROM_ERASE; current_slot = EEPROM_SLOTS; - } - else { + } else { // current slot is the first non blank one current_slot = first_nblank_loc / EEPROM_SIZE; - SERIAL_PROTOCOLLNPAIR("Flash slot: ", current_slot); uint8_t *eeprom_data = SLOT_ADDRESS(EEPROM_SECTOR, current_slot); - SERIAL_PROTOCOLLNPAIR("Address: ", (int)eeprom_data); - // load current settings for (int i = 0; i < EEPROM_SIZE; i++) ram_eeprom[i] = eeprom_data[i]; } @@ -97,18 +92,16 @@ bool PersistentStore::access_finish() { if (--current_slot < 0) { // all slots have been used, erase everything and start again __disable_irq(); - PrepareSector(EEPROM_SECTOR, EEPROM_SECTOR); status = EraseSector(EEPROM_SECTOR, EEPROM_SECTOR); __enable_irq(); - SERIAL_PROTOCOLLNPAIR("Erase status: ", status); + current_slot = EEPROM_SLOTS - 1; } - SERIAL_PROTOCOLLNPAIR("Writing data to: ", current_slot); + __disable_irq(); - PrepareSector(EEPROM_SECTOR, EEPROM_SECTOR); status = CopyRAM2Flash(SLOT_ADDRESS(EEPROM_SECTOR, current_slot), ram_eeprom, IAP_WRITE_4096); __enable_irq(); - SERIAL_PROTOCOLLNPAIR("CopyRAM2Flash status: ", status); + if (status != CMD_SUCCESS) return false; eeprom_dirty = false; } @@ -116,7 +109,7 @@ bool PersistentStore::access_finish() { } bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) { - for (int i = 0; i < size; i++) ram_eeprom[pos + i] = value[i]; + for (size_t i = 0; i < size; i++) ram_eeprom[pos + i] = value[i]; eeprom_dirty = true; crc16(crc, value, size); pos += size; @@ -125,7 +118,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) { const uint8_t * const buff = writing ? &value[0] : &ram_eeprom[pos]; - if (writing) for (int i = 0; i < size; i++) value[i] = ram_eeprom[pos + i]; + if (writing) for (size_t i = 0; i < size; i++) value[i] = ram_eeprom[pos + i]; crc16(crc, buff, size); pos += size; return false; // return true for any error diff --git a/Marlin/src/HAL/HAL_LPC1768/persistent_store_sdcard.cpp b/Marlin/src/HAL/HAL_LPC1768/persistent_store_sdcard.cpp index 490f16e07b..5731333ed2 100644 --- a/Marlin/src/HAL/HAL_LPC1768/persistent_store_sdcard.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/persistent_store_sdcard.cpp @@ -79,7 +79,7 @@ bool PersistentStore::access_finish() { // This extra chit-chat goes away soon, but is helpful for now // to see errors that are happening in read_data / write_data static void debug_rw(const bool write, int &pos, const uint8_t *value, const size_t size, const FRESULT s, const size_t total=0) { - const char * const rw_str = write ? PSTR("write") : PSTR("read"); + PGM_P const rw_str = write ? PSTR("write") : PSTR("read"); SERIAL_PROTOCOLCHAR(' '); serialprintPGM(rw_str); SERIAL_PROTOCOLPAIR("_data(", pos); diff --git a/Marlin/src/HAL/HAL_LPC1768/spi_pins.h b/Marlin/src/HAL/HAL_LPC1768/spi_pins.h index 841a3f845f..0ea045a150 100644 --- a/Marlin/src/HAL/HAL_LPC1768/spi_pins.h +++ b/Marlin/src/HAL/HAL_LPC1768/spi_pins.h @@ -19,13 +19,11 @@ * along with this program. If not, see . * */ - -#ifndef SPI_PINS_LPC1768_H -#define SPI_PINS_LPC1768_H +#pragma once #include "src/core/macros.h" -#if ENABLED(SDSUPPORT) && ENABLED(DOGLCD) && (LCD_PINS_D4 == SCK_PIN || LCD_PINS_ENABLE == MOSI_PIN || DOGLCD_SCK == SCK_PIN || DOGLCD_MOSI == MOSI_PIN) +#if ENABLED(SDSUPPORT) && HAS_GRAPHICAL_LCD && (LCD_PINS_D4 == SCK_PIN || LCD_PINS_ENABLE == MOSI_PIN || DOGLCD_SCK == SCK_PIN || DOGLCD_MOSI == MOSI_PIN) #define LPC_SOFTWARE_SPI // If the SD card and LCD adapter share the same SPI pins, then software SPI is currently // needed due to the speed and mode requred for communicating with each device being different. // This requirement can be removed if the SPI access to these devices is updated to use @@ -50,8 +48,7 @@ #ifndef SS_PIN #define SS_PIN P1_23 #endif -#ifndef SDSS +#if !defined(SDSS) || SDSS == P_NC // gets defaulted in pins.h + #undef SDSS #define SDSS SS_PIN #endif - -#endif // SPI_PINS_LPC1768_H diff --git a/Marlin/src/HAL/HAL_LPC1768/u8g/HAL_LCD_I2C_routines.c b/Marlin/src/HAL/HAL_LPC1768/u8g/HAL_LCD_I2C_routines.c index 80bf5fc633..12e8b45990 100644 --- a/Marlin/src/HAL/HAL_LPC1768/u8g/HAL_LCD_I2C_routines.c +++ b/Marlin/src/HAL/HAL_LPC1768/u8g/HAL_LCD_I2C_routines.c @@ -33,6 +33,8 @@ #include #include +#include "../../../core/millis_t.h" + ////////////////////////////////////////////////////////////////////////////////////// // These two routines are exact copies of the lpc17xx_i2c.c routines. Couldn't link to @@ -149,14 +151,14 @@ void u8g_i2c_init(uint8_t clock_option) { u8g_i2c_start(0); // send slave address and write bit } -volatile extern uint32_t _millis; +volatile extern millis_t _millis; uint8_t u8g_i2c_send_byte(uint8_t data) { #define I2C_TIMEOUT 3 LPC_I2C1->I2DAT = data & I2C_I2DAT_BITMASK; // transmit data LPC_I2C1->I2CONSET = I2C_I2CONSET_AA; LPC_I2C1->I2CONCLR = I2C_I2CONCLR_SIC; - uint32_t timeout = _millis + I2C_TIMEOUT; - while ((I2C_status != I2C_I2STAT_M_TX_DAT_ACK) && (I2C_status != I2C_I2STAT_M_TX_DAT_NACK) && (timeout > _millis)); // wait for xmit to finish + const millis_t timeout = _millis + I2C_TIMEOUT; + while ((I2C_status != I2C_I2STAT_M_TX_DAT_ACK) && (I2C_status != I2C_I2STAT_M_TX_DAT_NACK) && PENDING(_millis, timeout)); // wait for xmit to finish // had hangs with SH1106 so added time out - have seen temporary screen corruption when this happens return 1; } diff --git a/Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_hw_spi.cpp b/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_hw_spi.cpp similarity index 97% rename from Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_hw_spi.cpp rename to Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_hw_spi.cpp index 9cd913f743..554f945892 100644 --- a/Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_hw_spi.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_hw_spi.cpp @@ -55,9 +55,9 @@ #ifdef TARGET_LPC1768 -#include "../../inc/MarlinConfigPre.h" +#include "../../../inc/MarlinConfigPre.h" -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD //#include #include @@ -132,6 +132,6 @@ uint8_t u8g_com_HAL_LPC1768_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, return 1; } -#endif // DOGLCD +#endif // HAS_GRAPHICAL_LCD #endif // TARGET_LPC1768 diff --git a/Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_ssd_hw_i2c.cpp b/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_ssd_hw_i2c.cpp similarity index 97% rename from Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_ssd_hw_i2c.cpp rename to Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_ssd_hw_i2c.cpp index 06399d3947..cf6284bdf2 100644 --- a/Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_ssd_hw_i2c.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_ssd_hw_i2c.cpp @@ -77,9 +77,9 @@ #ifdef TARGET_LPC1768 -#include "../../inc/MarlinConfigPre.h" +#include "../../../inc/MarlinConfigPre.h" -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD #include @@ -156,7 +156,7 @@ uint8_t u8g_com_HAL_LPC1768_ssd_hw_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_v return 0; } - register uint8_t *ptr = (uint8_t *)arg_ptr; + uint8_t *ptr = (uint8_t *)arg_ptr; while (arg_val > 0) { if (u8g_i2c_send_byte(*ptr++) == 0) { u8g_i2c_stop(); @@ -175,7 +175,7 @@ uint8_t u8g_com_HAL_LPC1768_ssd_hw_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_v return 0; } - register uint8_t *ptr = (uint8_t *)arg_ptr; + uint8_t *ptr = (uint8_t *)arg_ptr; while (arg_val > 0) { if (u8g_i2c_send_byte(u8g_pgm_read(ptr)) == 0) return 0; @@ -198,6 +198,6 @@ uint8_t u8g_com_HAL_LPC1768_ssd_hw_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_v return 1; } -#endif // DOGLCD +#endif // HAS_GRAPHICAL_LCD #endif // TARGET_LPC1768 diff --git a/Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_ssd_sw_i2c.cpp under construction b/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_ssd_sw_i2c.cpp under construction similarity index 98% rename from Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_ssd_sw_i2c.cpp under construction rename to Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_ssd_sw_i2c.cpp under construction index 80c8da7239..80eeb50a8c 100644 --- a/Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_ssd_sw_i2c.cpp under construction +++ b/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_ssd_sw_i2c.cpp under construction @@ -63,7 +63,7 @@ #include "../../inc/MarlinConfigPre.h" -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD #include @@ -214,7 +214,7 @@ uint8_t u8g_com_HAL_LPC1768_ssd_sw_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_v if (u8g_com_ssd_I2C_start_sequence_sw(u8g) == 0) return u8g_i2c_stop_sw(), 0; - register uint8_t *ptr = (uint8_t *)arg_ptr; + uint8_t *ptr = (uint8_t *)arg_ptr; while (arg_val > 0) { if (u8g_i2c_send_byte_sw(*ptr++) == 0) return u8g_i2c_stop_sw(), 0; @@ -229,7 +229,7 @@ uint8_t u8g_com_HAL_LPC1768_ssd_sw_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_v if (u8g_com_ssd_I2C_start_sequence_sw(u8g) == 0) return u8g_i2c_stop_sw(), 0; - register uint8_t *ptr = (uint8_t *)arg_ptr; + uint8_t *ptr = (uint8_t *)arg_ptr; while (arg_val > 0) { if (u8g_i2c_send_byte_sw(u8g_pgm_read(ptr)) == 0) return 0; ptr++; @@ -249,6 +249,6 @@ uint8_t u8g_com_HAL_LPC1768_ssd_sw_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_v return 1; } -#endif // DOGLCD +#endif // HAS_GRAPHICAL_LCD #endif // TARGET_LPC1768 diff --git a/Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_st7920_hw_spi.cpp b/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_st7920_hw_spi.cpp similarity index 97% rename from Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_st7920_hw_spi.cpp rename to Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_st7920_hw_spi.cpp index 6b036ba5ea..9139f1b8d8 100644 --- a/Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_st7920_hw_spi.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_st7920_hw_spi.cpp @@ -55,13 +55,13 @@ #ifdef TARGET_LPC1768 -#include "../../inc/MarlinConfigPre.h" +#include "../../../inc/MarlinConfigPre.h" -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD //#include #include -#include "../shared/Delay.h" +#include "../../shared/Delay.h" #define SPI_FULL_SPEED 0 #define SPI_HALF_SPEED 1 @@ -148,6 +148,6 @@ uint8_t u8g_com_HAL_LPC1768_ST7920_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t ar return 1; } -#endif // DOGLCD +#endif // HAS_GRAPHICAL_LCD #endif // TARGET_LPC1768 diff --git a/Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_st7920_sw_spi.cpp b/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_st7920_sw_spi.cpp similarity index 97% rename from Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_st7920_sw_spi.cpp rename to Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_st7920_sw_spi.cpp index a189b9126d..652ad54393 100644 --- a/Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_st7920_sw_spi.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_st7920_sw_spi.cpp @@ -55,14 +55,15 @@ #ifdef TARGET_LPC1768 -#include "../../inc/MarlinConfigPre.h" +#include "../../../inc/MarlinConfigPre.h" -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD #include #include "SoftwareSPI.h" -#include "../shared/Delay.h" +#include "../../shared/Delay.h" +#undef SPI_SPEED #define SPI_SPEED 3 // About 1 MHz static pin_t SCK_pin_ST7920_HAL, MOSI_pin_ST7920_HAL_HAL; @@ -150,6 +151,6 @@ uint8_t u8g_com_HAL_LPC1768_ST7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t ar return 1; } -#endif // DOGLCD +#endif // HAS_GRAPHICAL_LCD #endif // TARGET_LPC1768 diff --git a/Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_sw_spi.cpp b/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_sw_spi.cpp similarity index 97% rename from Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_sw_spi.cpp rename to Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_sw_spi.cpp index 533ebda37c..a00c45b305 100644 --- a/Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_sw_spi.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_sw_spi.cpp @@ -55,13 +55,14 @@ #ifdef TARGET_LPC1768 -#include "../../inc/MarlinConfigPre.h" +#include "../../../inc/MarlinConfigPre.h" -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD #include #include "SoftwareSPI.h" +#undef SPI_SPEED #define SPI_SPEED 2 // About 2 MHz static uint8_t SPI_speed = 0; @@ -124,6 +125,6 @@ uint8_t u8g_com_HAL_LPC1768_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, return 1; } -#endif // DOGLCD +#endif // HAS_GRAPHICAL_LCD #endif // TARGET_LPC1768 diff --git a/Marlin/src/HAL/HAL_LPC1768/usb_serial.cpp b/Marlin/src/HAL/HAL_LPC1768/usb_serial.cpp new file mode 100644 index 0000000000..d143bae709 --- /dev/null +++ b/Marlin/src/HAL/HAL_LPC1768/usb_serial.cpp @@ -0,0 +1,13 @@ +#ifdef TARGET_LPC1768 +#include "../../inc/MarlinConfigPre.h" + +#if ENABLED(EMERGENCY_PARSER) + #include "../../feature/emergency_parser.h" + EmergencyParser::State emergency_state; + bool CDC_RecvCallback(const char buffer) { + emergency_parser.update(emergency_state, buffer); + return true; + } +#endif // ENABLED(EMERGENCY_PARSER) + +#endif // TARGET_LPC1768 diff --git a/Marlin/src/HAL/HAL_LPC1768/watchdog.cpp b/Marlin/src/HAL/HAL_LPC1768/watchdog.cpp index 589e05ebd6..913735636f 100644 --- a/Marlin/src/HAL/HAL_LPC1768/watchdog.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/watchdog.cpp @@ -30,7 +30,29 @@ #include "watchdog.h" void watchdog_init(void) { - WDT_Init(WDT_CLKSRC_IRC, WDT_MODE_RESET); + #if ENABLED(WATCHDOG_RESET_MANUAL) + // We enable the watchdog timer, but only for the interrupt. + + // Configure WDT to only trigger an interrupt + // Disable WDT interrupt (just in case, to avoid triggering it!) + NVIC_DisableIRQ(WDT_IRQn); + + // We NEED memory barriers to ensure Interrupts are actually disabled! + // ( https://dzone.com/articles/nvic-disabling-interrupts-on-arm-cortex-m-and-the ) + __DSB(); + __ISB(); + + // Configure WDT to only trigger an interrupt + // Initialize WDT with the given parameters + WDT_Init(WDT_CLKSRC_IRC, WDT_MODE_INT_ONLY); + + // Configure and enable WDT interrupt. + NVIC_ClearPendingIRQ(WDT_IRQn); + NVIC_SetPriority(WDT_IRQn, 0); // Use highest priority, so we detect all kinds of lockups + NVIC_EnableIRQ(WDT_IRQn); + #else + WDT_Init(WDT_CLKSRC_IRC, WDT_MODE_RESET); + #endif WDT_Start(WDT_TIMEOUT); } @@ -45,14 +67,16 @@ uint8_t HAL_get_reset_source(void) { void watchdog_reset() { WDT_Feed(); - #if PIN_EXISTS(LED) - TOGGLE(LED_PIN); // heart beat indicator + #if DISABLED(PINS_DEBUGGING) && PIN_EXISTS(LED) + TOGGLE(LED_PIN); // heartbeat indicator #endif } #else + void HAL_clear_reset_source(void) {} uint8_t HAL_get_reset_source(void) { return RST_POWER_ON; } + #endif // USE_WATCHDOG #endif // TARGET_LPC1768 diff --git a/Marlin/src/HAL/HAL_LPC1768/watchdog.h b/Marlin/src/HAL/HAL_LPC1768/watchdog.h index 90147bd702..f185a99cdd 100644 --- a/Marlin/src/HAL/HAL_LPC1768/watchdog.h +++ b/Marlin/src/HAL/HAL_LPC1768/watchdog.h @@ -19,9 +19,7 @@ * along with this program. If not, see . * */ - -#ifndef WATCHDOG_LPC1768_H -#define WATCHDOG_LPC1768_H +#pragma once #define RST_POWER_ON 1 #define RST_EXTERNAL 2 @@ -34,5 +32,3 @@ void watchdog_init(void); void watchdog_reset(void); void HAL_clear_reset_source(void); uint8_t HAL_get_reset_source(void); - -#endif /* WATCHDOG_H */ diff --git a/Marlin/src/HAL/HAL_LPC1768/win_usb_driver/lpc176x_usb_driver.inf b/Marlin/src/HAL/HAL_LPC1768/win_usb_driver/lpc176x_usb_driver.inf new file mode 100644 index 0000000000..4732eb8552 --- /dev/null +++ b/Marlin/src/HAL/HAL_LPC1768/win_usb_driver/lpc176x_usb_driver.inf @@ -0,0 +1,36 @@ +[Version] +Signature="$Windows NT$" +Class=Ports +ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318} +Provider=%PROVIDER% +DriverVer =04/14/2008, 5.1.2600.5512 + +[Manufacturer] +%PROVIDER%=DeviceList,ntamd64 + + +[DeviceList] +%DESCRIPTION%=LPC1768USB, USB\VID_1D50&PID_6029&MI_00 + +[DeviceList.ntamd64] +%DESCRIPTION%=LPC1768USB, USB\VID_1D50&PID_6029&MI_00 + + +[LPC1768USB] +include=mdmcpq.inf +CopyFiles=FakeModemCopyFileSection +AddReg=LowerFilterAddReg,SerialPropPageAddReg + +[LPC1768USB.Services] +include=mdmcpq.inf +AddService=usbser, 0x00000002, LowerFilter_Service_Inst + +[SerialPropPageAddReg] +HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider" + + +[Strings] +PROVIDER = "marlinfw.org" +DRIVER.SVC = "Marlin USB Driver" +DESCRIPTION= "Marlin USB Serial" +COMPOSITE = "Marlin USB VCOM" \ No newline at end of file diff --git a/Marlin/src/HAL/HAL_STM32/HAL.cpp b/Marlin/src/HAL/HAL_STM32/HAL.cpp new file mode 100644 index 0000000000..1bddf77f48 --- /dev/null +++ b/Marlin/src/HAL/HAL_STM32/HAL.cpp @@ -0,0 +1,146 @@ +/** + * Marlin 3D Printer Firmware + * + * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com + * Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com + * Copyright (c) 2017 Victor Perez + * + * 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 . + * + */ + +#ifdef ARDUINO_ARCH_STM32 + +// -------------------------------------------------------------------------- +// Includes +// -------------------------------------------------------------------------- + +#include "HAL.h" + +#include "../../inc/MarlinConfig.h" +#include "../shared/Delay.h" + +#if ENABLED(EEPROM_EMULATED_WITH_SRAM) + #if STM32F7xx + #include "stm32f7xx_ll_pwr.h" + #else + #error "EEPROM_EMULATED_WITH_SRAM is currently only supported for STM32F7xx" + #endif +#endif // EEPROM_EMULATED_WITH_SRAM + +// -------------------------------------------------------------------------- +// Externals +// -------------------------------------------------------------------------- + +// -------------------------------------------------------------------------- +// Local defines +// -------------------------------------------------------------------------- + +// -------------------------------------------------------------------------- +// Types +// -------------------------------------------------------------------------- + +// -------------------------------------------------------------------------- +// Variables +// -------------------------------------------------------------------------- + +// -------------------------------------------------------------------------- +// Public Variables +// -------------------------------------------------------------------------- + +uint16_t HAL_adc_result; + +// -------------------------------------------------------------------------- +// Private Variables +// -------------------------------------------------------------------------- + +// -------------------------------------------------------------------------- +// Function prototypes +// -------------------------------------------------------------------------- + +// -------------------------------------------------------------------------- +// Private functions +// -------------------------------------------------------------------------- + +// -------------------------------------------------------------------------- +// Public functions +// -------------------------------------------------------------------------- + + +// Needed for DELAY_NS() / DELAY_US() on CORTEX-M7 +#if (defined(__arm__) || defined(__thumb__)) && __CORTEX_M == 7 + // HAL pre-initialization task + // Force the preinit function to run between the premain() and main() function + // of the STM32 arduino core + __attribute__((constructor (102))) + void HAL_preinit() { + enableCycleCounter(); + } +#endif + +// HAL initialization task +void HAL_init(void) { + FastIO_init(); + + #if ENABLED(SDSUPPORT) + OUT_WRITE(SDSS, HIGH); // Try to set SDSS inactive before any other SPI users start up + #endif + + #if PIN_EXISTS(LED) + OUT_WRITE(LED_PIN, LOW); + #endif + + #if ENABLED(EEPROM_EMULATED_WITH_SRAM) + // Enable access to backup SRAM + __HAL_RCC_PWR_CLK_ENABLE(); + HAL_PWR_EnableBkUpAccess(); + __HAL_RCC_BKPSRAM_CLK_ENABLE(); + + // Enable backup regulator + LL_PWR_EnableBkUpRegulator(); + // Wait until backup regulator is initialized + while (!LL_PWR_IsActiveFlag_BRR()); + #endif // EEPROM_EMULATED_SRAM +} + +void HAL_clear_reset_source(void) { __HAL_RCC_CLEAR_RESET_FLAGS(); } + +uint8_t HAL_get_reset_source (void) { + if (__HAL_RCC_GET_FLAG(RCC_FLAG_IWDGRST) != RESET) return RST_WATCHDOG; + if (__HAL_RCC_GET_FLAG(RCC_FLAG_SFTRST) != RESET) return RST_SOFTWARE; + if (__HAL_RCC_GET_FLAG(RCC_FLAG_PINRST) != RESET) return RST_EXTERNAL; + if (__HAL_RCC_GET_FLAG(RCC_FLAG_PORRST) != RESET) return RST_POWER_ON; + return 0; +} + +void _delay_ms(const int delay_ms) { delay(delay_ms); } + +extern "C" { + extern unsigned int _ebss; // end of bss section +} + +// -------------------------------------------------------------------------- +// ADC +// -------------------------------------------------------------------------- + +void HAL_adc_start_conversion(const uint8_t adc_pin) { + HAL_adc_result = analogRead(adc_pin); +} + +uint16_t HAL_adc_get_result(void) { + return HAL_adc_result; +} + +#endif // ARDUINO_ARCH_STM32 diff --git a/Marlin/src/HAL/HAL_STM32/HAL.h b/Marlin/src/HAL/HAL_STM32/HAL.h new file mode 100644 index 0000000000..9542d8c404 --- /dev/null +++ b/Marlin/src/HAL/HAL_STM32/HAL.h @@ -0,0 +1,220 @@ +/** + * Marlin 3D Printer Firmware + * + * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com + * Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com + * Copyright (c) 2017 Victor Perez + * + * 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 + +#define CPU_32_BIT + +#ifndef vsnprintf_P + #define vsnprintf_P vsnprintf +#endif + +// -------------------------------------------------------------------------- +// Includes +// -------------------------------------------------------------------------- + +#include + +#include "Arduino.h" + +#ifdef USBCON + #include +#endif + +#include "../../inc/MarlinConfigPre.h" +#include "../shared/math_32bit.h" +#include "../shared/HAL_SPI.h" +#include "fastio_STM32.h" +#include "watchdog_STM32.h" + +#include "HAL_timers_STM32.h" + +// -------------------------------------------------------------------------- +// Defines +// -------------------------------------------------------------------------- + +#if SERIAL_PORT == 0 + #error "Serial port 0 does not exist" +#endif + +#if !WITHIN(SERIAL_PORT, -1, 6) + #error "SERIAL_PORT must be from -1 to 6" +#endif +#if SERIAL_PORT == -1 + #define MYSERIAL0 SerialUSB +#elif SERIAL_PORT == 1 + #define MYSERIAL0 Serial1 +#elif SERIAL_PORT == 2 + #define MYSERIAL0 Serial2 +#elif SERIAL_PORT == 3 + #define MYSERIAL0 Serial3 +#elif SERIAL_PORT == 4 + #define MYSERIAL0 Serial4 +#elif SERIAL_PORT == 5 + #define MYSERIAL0 Serial5 +#elif SERIAL_PORT == 6 + #define MYSERIAL0 Serial6 +#endif + +#ifdef SERIAL_PORT_2 + #if SERIAL_PORT_2 == 0 + #error "Serial port 0 does not exist" + #endif + + #if !WITHIN(SERIAL_PORT_2, -1, 6) + #error "SERIAL_PORT_2 must be from -1 to 6" + #elif SERIAL_PORT_2 == SERIAL_PORT + #error "SERIAL_PORT_2 must be different than SERIAL_PORT" + #endif + #define NUM_SERIAL 2 + #if SERIAL_PORT_2 == -1 + #define MYSERIAL1 SerialUSB + #elif SERIAL_PORT_2 == 1 + #define MYSERIAL1 Serial1 + #elif SERIAL_PORT_2 == 2 + #define MYSERIAL1 Serial2 + #elif SERIAL_PORT_2 == 3 + #define MYSERIAL1 Serial3 + #elif SERIAL_PORT_2 == 4 + #define MYSERIAL1 Serial4 + #elif SERIAL_PORT_2 == 5 + #define MYSERIAL1 Serial5 + #elif SERIAL_PORT_2 == 6 + #define MYSERIAL1 Serial6 + #endif +#else + #define NUM_SERIAL 1 +#endif + +#define _BV(b) (1 << (b)) + +/** + * TODO: review this to return 1 for pins that are not analog input + */ +#ifndef analogInputToDigitalPin + #define analogInputToDigitalPin(p) (p) +#endif + +#define CRITICAL_SECTION_START uint32_t primask = __get_PRIMASK(); __disable_irq() +#define CRITICAL_SECTION_END if (!primask) __enable_irq() +#define ISRS_ENABLED() (!__get_PRIMASK()) +#define ENABLE_ISRS() __enable_irq() +#define DISABLE_ISRS() __disable_irq() +#define cli() __disable_irq() +#define sei() __enable_irq() + +// On AVR this is in math.h? +#define square(x) ((x)*(x)) + +#ifndef strncpy_P + #define strncpy_P(dest, src, num) strncpy((dest), (src), (num)) +#endif + +// Fix bug in pgm_read_ptr +#undef pgm_read_ptr +#define pgm_read_ptr(addr) (*(addr)) + +#define RST_POWER_ON 1 +#define RST_EXTERNAL 2 +#define RST_BROWN_OUT 4 +#define RST_WATCHDOG 8 +#define RST_JTAG 16 +#define RST_SOFTWARE 32 +#define RST_BACKUP 64 + +// -------------------------------------------------------------------------- +// Types +// -------------------------------------------------------------------------- + +typedef int8_t pin_t; + +#define HAL_SERVO_LIB libServo + +// -------------------------------------------------------------------------- +// Public Variables +// -------------------------------------------------------------------------- + +/** result of last ADC conversion */ +extern uint16_t HAL_adc_result; + +// -------------------------------------------------------------------------- +// Public functions +// -------------------------------------------------------------------------- + +// Memory related +#define __bss_end __bss_end__ + +// Enable hooks into setup for HAL +#define HAL_INIT 1 +void HAL_init(void); + +/** clear reset reason */ +void HAL_clear_reset_source (void); + +/** reset reason */ +uint8_t HAL_get_reset_source (void); + +void _delay_ms(const int delay); + +extern "C" char* _sbrk(int incr); + +static int freeMemory() { + volatile char top; + return &top - reinterpret_cast(_sbrk(0)); +} + +// SPI: Extended functions which take a channel number (hardware SPI only) +/** Write single byte to specified SPI channel */ +void spiSend(uint32_t chan, byte b); +/** Write buffer to specified SPI channel */ +void spiSend(uint32_t chan, const uint8_t* buf, size_t n); +/** Read single byte from specified SPI channel */ +uint8_t spiRec(uint32_t chan); + + +// EEPROM + +/** + * Wire library should work for i2c eeproms. + */ +void eeprom_write_byte(uint8_t *pos, unsigned char value); +uint8_t eeprom_read_byte(uint8_t *pos); +void eeprom_read_block (void *__dst, const void *__src, size_t __n); +void eeprom_update_block (const void *__src, void *__dst, size_t __n); + +// ADC + +#define HAL_ANALOG_SELECT(pin) pinMode(pin, INPUT) + +inline void HAL_adc_init(void) {} + +#define HAL_START_ADC(pin) HAL_adc_start_conversion(pin) +#define HAL_READ_ADC() HAL_adc_result +#define HAL_ADC_READY() true + +void HAL_adc_start_conversion(const uint8_t adc_pin); + +uint16_t HAL_adc_get_result(void); + +#define GET_PIN_MAP_PIN(index) index +#define GET_PIN_MAP_INDEX(pin) pin +#define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval) diff --git a/Marlin/src/HAL/HAL_STM32/HAL_Servo_STM32.cpp b/Marlin/src/HAL/HAL_STM32/HAL_Servo_STM32.cpp new file mode 100644 index 0000000000..2b08ab3144 --- /dev/null +++ b/Marlin/src/HAL/HAL_STM32/HAL_Servo_STM32.cpp @@ -0,0 +1,57 @@ +/** + * 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 + * Copyright (C) 2017 Victor Perez + * + * 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 . + * + */ +#ifdef ARDUINO_ARCH_STM32 + +#include "../../inc/MarlinConfig.h" + +#if HAS_SERVOS + +#include "HAL_Servo_STM32.h" + +uint8_t servoPin[MAX_SERVOS] = { 0 }; + +int8_t libServo::attach(const int pin) { + if (this->servoIndex >= MAX_SERVOS) return -1; + if (pin > 0) servoPin[this->servoIndex] = pin; + return Servo::attach(servoPin[this->servoIndex]); +} + +int8_t libServo::attach(const int pin, const int min, const int max) { + if (pin > 0) servoPin[this->servoIndex] = pin; + return Servo::attach(servoPin[this->servoIndex], min, max); +} + +void libServo::move(const int value) { + constexpr uint16_t servo_delay[] = SERVO_DELAY; + static_assert(COUNT(servo_delay) == NUM_SERVOS, "SERVO_DELAY must be an array NUM_SERVOS long."); + if (this->attach(0) >= 0) { + this->write(value); + safe_delay(servo_delay[this->servoIndex]); + #if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE) + this->detach(); + #endif + } +} +#endif // HAS_SERVOS + +#endif // ARDUINO_ARCH_STM32 diff --git a/Marlin/src/HAL/HAL_STM32/HAL_Servo_STM32.h b/Marlin/src/HAL/HAL_STM32/HAL_Servo_STM32.h new file mode 100644 index 0000000000..0aa93ba9f5 --- /dev/null +++ b/Marlin/src/HAL/HAL_STM32/HAL_Servo_STM32.h @@ -0,0 +1,36 @@ +/** + * 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 + * Copyright (C) 2017 Victor Perez + * + * 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 + +// Inherit and expand on the official library +class libServo : public Servo { + public: + int8_t attach(const int pin); + int8_t attach(const int pin, const int min, const int max); + void move(const int value); + private: + uint16_t min_ticks, max_ticks; + uint8_t servoIndex; // index into the channel data for this servo +}; diff --git a/Marlin/src/HAL/HAL_STM32/HAL_spi_STM32.cpp b/Marlin/src/HAL/HAL_STM32/HAL_spi_STM32.cpp new file mode 100644 index 0000000000..597305fa06 --- /dev/null +++ b/Marlin/src/HAL/HAL_STM32/HAL_spi_STM32.cpp @@ -0,0 +1,155 @@ +/** + * 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 + * Copyright (C) 2017 Victor Perez + * + * 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 . + * + */ +#ifdef ARDUINO_ARCH_STM32 + +// -------------------------------------------------------------------------- +// Includes +// -------------------------------------------------------------------------- + +#include "../../inc/MarlinConfig.h" + +#include + +// -------------------------------------------------------------------------- +// Public Variables +// -------------------------------------------------------------------------- + +static SPISettings spiConfig; + +// -------------------------------------------------------------------------- +// Public functions +// -------------------------------------------------------------------------- + +#if ENABLED(SOFTWARE_SPI) + // -------------------------------------------------------------------------- + // Software SPI + // -------------------------------------------------------------------------- + #error "Software SPI not supported for STM32. Use Hardware SPI." + +#else + +// -------------------------------------------------------------------------- +// Hardware SPI +// -------------------------------------------------------------------------- + +/** + * VGPV SPI speed start and PCLK2/2, by default 108/2 = 54Mhz + */ + +/** + * @brief Begin SPI port setup + * + * @return Nothing + * + * @details Only configures SS pin since stm32duino creates and initialize the SPI object + */ +void spiBegin(void) { + #if !PIN_EXISTS(SS) + #error "SS_PIN not defined!" + #endif + + SET_OUTPUT(SS_PIN); + WRITE(SS_PIN, HIGH); +} + +/** Configure SPI for specified SPI speed */ +void spiInit(uint8_t spiRate) { + // Use datarates Marlin uses + uint32_t clock; + switch (spiRate) { + case SPI_FULL_SPEED: clock = 20000000; break; // 13.9mhz=20000000 6.75mhz=10000000 3.38mhz=5000000 .833mhz=1000000 + case SPI_HALF_SPEED: clock = 5000000; break; + case SPI_QUARTER_SPEED: clock = 2500000; break; + case SPI_EIGHTH_SPEED: clock = 1250000; break; + case SPI_SPEED_5: clock = 625000; break; + case SPI_SPEED_6: clock = 300000; break; + default: + clock = 4000000; // Default from the SPI library + } + spiConfig = SPISettings(clock, MSBFIRST, SPI_MODE0); + SPI.begin(); +} + +/** + * @brief Receives a single byte from the SPI port. + * + * @return Byte received + * + * @details + */ +uint8_t spiRec(void) { + SPI.beginTransaction(spiConfig); + uint8_t returnByte = SPI.transfer(0xFF); + SPI.endTransaction(); + return returnByte; +} + +/** + * @brief Receives a number of bytes from the SPI port to a buffer + * + * @param buf Pointer to starting address of buffer to write to. + * @param nbyte Number of bytes to receive. + * @return Nothing + * + * @details Uses DMA + */ +void spiRead(uint8_t* buf, uint16_t nbyte) { + if (nbyte == 0) return; + SPI.beginTransaction(spiConfig); + for (int i = 0; i < nbyte; i++) { + buf[i] = SPI.transfer(0xFF); + } + SPI.endTransaction(); +} + +/** + * @brief Sends a single byte on SPI port + * + * @param b Byte to send + * + * @details + */ +void spiSend(uint8_t b) { + SPI.beginTransaction(spiConfig); + SPI.transfer(b); + SPI.endTransaction(); +} + +/** + * @brief Write token and then write from 512 byte buffer to SPI (for SD card) + * + * @param buf Pointer with buffer start address + * @return Nothing + * + * @details Use DMA + */ +void spiSendBlock(uint8_t token, const uint8_t* buf) { + SPI.beginTransaction(spiConfig); + SPI.transfer(token); + SPI.transfer((uint8_t*)buf, (uint8_t*)0, 512); + SPI.endTransaction(); +} + +#endif // SOFTWARE_SPI + +#endif // ARDUINO_ARCH_STM32 diff --git a/Marlin/src/HAL/HAL_STM32/HAL_timers_STM32.cpp b/Marlin/src/HAL/HAL_STM32/HAL_timers_STM32.cpp new file mode 100644 index 0000000000..23a1e3bf15 --- /dev/null +++ b/Marlin/src/HAL/HAL_STM32/HAL_timers_STM32.cpp @@ -0,0 +1,117 @@ +/** + * Marlin 3D Printer Firmware + * + * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com + * Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com + * + * 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 . + * + */ +#ifdef ARDUINO_ARCH_STM32 + +// -------------------------------------------------------------------------- +// Includes +// -------------------------------------------------------------------------- + +#include "HAL.h" + +#include "HAL_timers_STM32.h" + +// -------------------------------------------------------------------------- +// Externals +// -------------------------------------------------------------------------- + +// -------------------------------------------------------------------------- +// Local defines +// -------------------------------------------------------------------------- + +#define NUM_HARDWARE_TIMERS 2 + +//#define PRESCALER 1 +// -------------------------------------------------------------------------- +// Types +// -------------------------------------------------------------------------- + +// -------------------------------------------------------------------------- +// Public Variables +// -------------------------------------------------------------------------- + +// -------------------------------------------------------------------------- +// Private Variables +// -------------------------------------------------------------------------- + +stm32f4_timer_t TimerHandle[NUM_HARDWARE_TIMERS]; + +// -------------------------------------------------------------------------- +// Function prototypes +// -------------------------------------------------------------------------- + +// -------------------------------------------------------------------------- +// Private functions +// -------------------------------------------------------------------------- + +// -------------------------------------------------------------------------- +// Public functions +// -------------------------------------------------------------------------- + +bool timers_initialized[NUM_HARDWARE_TIMERS] = { false }; + +void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) { + + if (!timers_initialized[timer_num]) { + uint32_t step_prescaler = STEPPER_TIMER_PRESCALE - 1, + temp_prescaler = TEMP_TIMER_PRESCALE - 1; + switch (timer_num) { + case STEP_TIMER_NUM: + // STEPPER TIMER - use a 32bit timer if possible + TimerHandle[timer_num].timer = STEP_TIMER_DEV; + TimerHandle[timer_num].irqHandle = Step_Handler; + TimerHandleInit(&TimerHandle[timer_num], (((HAL_TIMER_RATE) / step_prescaler) / frequency) - 1, step_prescaler); + HAL_NVIC_SetPriority(STEP_TIMER_IRQ_NAME, STEP_TIMER_IRQ_PRIO, 0); + break; + + case TEMP_TIMER_NUM: + // TEMP TIMER - any available 16bit Timer + TimerHandle[timer_num].timer = TEMP_TIMER_DEV; + TimerHandle[timer_num].irqHandle = Temp_Handler; + TimerHandleInit(&TimerHandle[timer_num], (((HAL_TIMER_RATE) / temp_prescaler) / frequency) - 1, temp_prescaler); + HAL_NVIC_SetPriority(TEMP_TIMER_IRQ_NAME, TEMP_TIMER_IRQ_PRIO, 0); + break; + } + timers_initialized[timer_num] = true; + } +} + +void HAL_timer_enable_interrupt(const uint8_t timer_num) { + const IRQn_Type IRQ_Id = IRQn_Type(getTimerIrq(TimerHandle[timer_num].timer)); + HAL_NVIC_EnableIRQ(IRQ_Id); +} + +void HAL_timer_disable_interrupt(const uint8_t timer_num) { + const IRQn_Type IRQ_Id = IRQn_Type(getTimerIrq(TimerHandle[timer_num].timer)); + HAL_NVIC_DisableIRQ(IRQ_Id); + + // We NEED memory barriers to ensure Interrupts are actually disabled! + // ( https://dzone.com/articles/nvic-disabling-interrupts-on-arm-cortex-m-and-the ) + __DSB(); + __ISB(); +} + +bool HAL_timer_interrupt_enabled(const uint8_t timer_num) { + const uint32_t IRQ_Id = getTimerIrq(TimerHandle[timer_num].timer); + return NVIC->ISER[IRQ_Id >> 5] & _BV32(IRQ_Id & 0x1F); +} + +#endif // ARDUINO_ARCH_STM32 diff --git a/Marlin/src/HAL/HAL_STM32/HAL_timers_STM32.h b/Marlin/src/HAL/HAL_STM32/HAL_timers_STM32.h new file mode 100644 index 0000000000..4c353b478a --- /dev/null +++ b/Marlin/src/HAL/HAL_STM32/HAL_timers_STM32.h @@ -0,0 +1,178 @@ +/** + * Marlin 3D Printer Firmware + * + * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com + * Copyright (c) 2017 Victor Perez + * + * 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 + +// -------------------------------------------------------------------------- +// Includes +// -------------------------------------------------------------------------- + +#include + +// -------------------------------------------------------------------------- +// Defines +// -------------------------------------------------------------------------- + +#define FORCE_INLINE __attribute__((always_inline)) inline + +#define hal_timer_t uint32_t +#define HAL_TIMER_TYPE_MAX 0xFFFFFFFF // Timers can be 16 or 32 bit + +#ifdef STM32F0xx + + #define HAL_TIMER_RATE (F_CPU) // frequency of timer peripherals + + #ifndef STEP_TIMER + #define STEP_TIMER 16 + #endif + + #ifndef TEMP_TIMER + #define TEMP_TIMER 17 + #endif + +#elif defined STM32F1xx + + #define HAL_TIMER_RATE (F_CPU) // frequency of timer peripherals + + #ifndef STEP_TIMER + #define STEP_TIMER 4 + #endif + + #ifndef TEMP_TIMER + #define TEMP_TIMER 2 + #endif + +#elif defined STM32F4xx + + #define HAL_TIMER_RATE (F_CPU/2) // frequency of timer peripherals + + #ifndef STEP_TIMER + #define STEP_TIMER 5 + #endif + + #ifndef TEMP_TIMER + #define TEMP_TIMER 7 + #endif + +#elif defined STM32F7xx + + #define HAL_TIMER_RATE (F_CPU/2) // frequency of timer peripherals + + #ifndef STEP_TIMER + #define STEP_TIMER 5 + #endif + + #ifndef TEMP_TIMER + #define TEMP_TIMER 7 + #endif + +#endif + +#ifndef STEP_TIMER_IRQ_PRIO + #define STEP_TIMER_IRQ_PRIO 1 +#endif + +#ifndef TEMP_TIMER_IRQ_PRIO + #define TEMP_TIMER_IRQ_PRIO 2 +#endif + +#define STEP_TIMER_NUM 0 // index of timer to use for stepper +#define TEMP_TIMER_NUM 1 // index of timer to use for temperature +#define PULSE_TIMER_NUM STEP_TIMER_NUM + +#define TEMP_TIMER_RATE 72000 // 72 Khz +#define TEMP_TIMER_PRESCALE ((HAL_TIMER_RATE)/(TEMP_TIMER_RATE)) +#define TEMP_TIMER_FREQUENCY 1000 + +#define STEPPER_TIMER_RATE 2000000 // 2 Mhz +#define STEPPER_TIMER_PRESCALE ((HAL_TIMER_RATE)/(STEPPER_TIMER_RATE)) +#define STEPPER_TIMER_TICKS_PER_US ((STEPPER_TIMER_RATE) / 1000000) // stepper timer ticks per µs + +#define PULSE_TIMER_RATE STEPPER_TIMER_RATE +#define PULSE_TIMER_PRESCALE STEPPER_TIMER_PRESCALE +#define PULSE_TIMER_TICKS_PER_US STEPPER_TIMER_TICKS_PER_US + +#define __TIMER_DEV(X) TIM##X +#define _TIMER_DEV(X) __TIMER_DEV(X) +#define STEP_TIMER_DEV _TIMER_DEV(STEP_TIMER) +#define TEMP_TIMER_DEV _TIMER_DEV(TEMP_TIMER) + +#define __TIMER_CALLBACK(X) TIM##X##_IRQHandler +#define _TIMER_CALLBACK(X) __TIMER_CALLBACK(X) + +#define STEP_TIMER_CALLBACK _TIMER_CALLBACK(STEP_TIMER) +#define TEMP_TIMER_CALLBACK _TIMER_CALLBACK(TEMP_TIMER) + +#define __TIMER_IRQ_NAME(X) TIM##X##_IRQn +#define _TIMER_IRQ_NAME(X) __TIMER_IRQ_NAME(X) + +#define STEP_TIMER_IRQ_NAME _TIMER_IRQ_NAME(STEP_TIMER) +#define TEMP_TIMER_IRQ_NAME _TIMER_IRQ_NAME(TEMP_TIMER) + +#define ENABLE_STEPPER_DRIVER_INTERRUPT() HAL_timer_enable_interrupt(STEP_TIMER_NUM) +#define DISABLE_STEPPER_DRIVER_INTERRUPT() HAL_timer_disable_interrupt(STEP_TIMER_NUM) +#define STEPPER_ISR_ENABLED() HAL_timer_interrupt_enabled(STEP_TIMER_NUM) + +#define ENABLE_TEMPERATURE_INTERRUPT() HAL_timer_enable_interrupt(TEMP_TIMER_NUM) +#define DISABLE_TEMPERATURE_INTERRUPT() HAL_timer_disable_interrupt(TEMP_TIMER_NUM) + +extern void Step_Handler(stimer_t *htim); +extern void Temp_Handler(stimer_t *htim); +#define HAL_STEP_TIMER_ISR void Step_Handler(stimer_t *htim) +#define HAL_TEMP_TIMER_ISR void Temp_Handler(stimer_t *htim) + +// -------------------------------------------------------------------------- +// Types +// -------------------------------------------------------------------------- + +typedef stimer_t stm32f4_timer_t; + +// -------------------------------------------------------------------------- +// Public Variables +// -------------------------------------------------------------------------- + +extern stm32f4_timer_t TimerHandle[]; + +// -------------------------------------------------------------------------- +// Public functions +// -------------------------------------------------------------------------- + +void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency); +void HAL_timer_enable_interrupt(const uint8_t timer_num); +void HAL_timer_disable_interrupt(const uint8_t timer_num); +bool HAL_timer_interrupt_enabled(const uint8_t timer_num); + +FORCE_INLINE static uint32_t HAL_timer_get_count(const uint8_t timer_num) { + return __HAL_TIM_GET_COUNTER(&TimerHandle[timer_num].handle); +} + +FORCE_INLINE static void HAL_timer_set_compare(const uint8_t timer_num, const uint32_t compare) { + __HAL_TIM_SET_AUTORELOAD(&TimerHandle[timer_num].handle, compare); + if (HAL_timer_get_count(timer_num) >= compare) + TimerHandle[timer_num].handle.Instance->EGR |= TIM_EGR_UG; // Generate an immediate update interrupt +} + +FORCE_INLINE static hal_timer_t HAL_timer_get_compare(const uint8_t timer_num) { + return __HAL_TIM_GET_AUTORELOAD(&TimerHandle[timer_num].handle); +} + +#define HAL_timer_isr_prologue(TIMER_NUM) +#define HAL_timer_isr_epilogue(TIMER_NUM) diff --git a/Marlin/src/HAL/HAL_STM32/README.md b/Marlin/src/HAL/HAL_STM32/README.md new file mode 100644 index 0000000000..7680df6654 --- /dev/null +++ b/Marlin/src/HAL/HAL_STM32/README.md @@ -0,0 +1,11 @@ +# Generic STM32 HAL based on the stm32duino core + +This HAL is intended to act as the generic STM32 HAL for all STM32 chips (The whole F, H and L family). + +Currently it supports: + * STM32F0xx + * STM32F1xx + * STM32F4xx + * STM32F7xx + +Targeting the official [Arduino STM32 Core](https://github.com/stm32duino/Arduino_Core_STM32). diff --git a/Marlin/src/HAL/HAL_STM32/SanityCheck.h b/Marlin/src/HAL/HAL_STM32/SanityCheck.h new file mode 100644 index 0000000000..f434a51cbb --- /dev/null +++ b/Marlin/src/HAL/HAL_STM32/SanityCheck.h @@ -0,0 +1,71 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2016, 2017 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 + +/** + * 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." + #elif SPINDLE_DIR_CHANGE && !PIN_EXISTS(SPINDLE_DIR) + #error "SPINDLE_DIR_PIN not defined." + #elif ENABLED(SPINDLE_LASER_PWM) && PIN_EXISTS(SPINDLE_LASER_PWM) + #if !PWM_PIN(SPINDLE_LASER_PWM_PIN) + #error "SPINDLE_LASER_PWM_PIN not assigned to a PWM pin." + #elif !(SPINDLE_LASER_PWM_PIN == 4 || SPINDLE_LASER_PWM_PIN == 6 || SPINDLE_LASER_PWM_PIN == 11) + #error "SPINDLE_LASER_PWM_PIN must use SERVO0, SERVO1 or SERVO3 connector" + #elif SPINDLE_LASER_POWERUP_DELAY < 1 + #error "SPINDLE_LASER_POWERUP_DELAY must be greater than 0." + #elif SPINDLE_LASER_POWERDOWN_DELAY < 1 + #error "SPINDLE_LASER_POWERDOWN_DELAY must be greater than 0." + #elif !defined(SPINDLE_LASER_PWM_INVERT) + #error "SPINDLE_LASER_PWM_INVERT missing." + #elif !defined(SPEED_POWER_SLOPE) || !defined(SPEED_POWER_INTERCEPT) || !defined(SPEED_POWER_MIN) || !defined(SPEED_POWER_MAX) + #error "SPINDLE_LASER_PWM equation constant(s) missing." + #elif PIN_EXISTS(CASE_LIGHT) && SPINDLE_LASER_PWM_PIN == CASE_LIGHT_PIN + #error "SPINDLE_LASER_PWM_PIN is used by CASE_LIGHT_PIN." + #elif PIN_EXISTS(E0_AUTO_FAN) && SPINDLE_LASER_PWM_PIN == E0_AUTO_FAN_PIN + #error "SPINDLE_LASER_PWM_PIN is used by E0_AUTO_FAN_PIN." + #elif PIN_EXISTS(E1_AUTO_FAN) && SPINDLE_LASER_PWM_PIN == E1_AUTO_FAN_PIN + #error "SPINDLE_LASER_PWM_PIN is used by E1_AUTO_FAN_PIN." + #elif PIN_EXISTS(E2_AUTO_FAN) && SPINDLE_LASER_PWM_PIN == E2_AUTO_FAN_PIN + #error "SPINDLE_LASER_PWM_PIN is used by E2_AUTO_FAN_PIN." + #elif PIN_EXISTS(E3_AUTO_FAN) && SPINDLE_LASER_PWM_PIN == E3_AUTO_FAN_PIN + #error "SPINDLE_LASER_PWM_PIN is used by E3_AUTO_FAN_PIN." + #elif PIN_EXISTS(E4_AUTO_FAN) && SPINDLE_LASER_PWM_PIN == E4_AUTO_FAN_PIN + #error "SPINDLE_LASER_PWM_PIN is used by E4_AUTO_FAN_PIN." + #elif PIN_EXISTS(FAN) && SPINDLE_LASER_PWM_PIN == FAN_PIN + #error "SPINDLE_LASER_PWM_PIN is used FAN_PIN." + #elif PIN_EXISTS(FAN1) && SPINDLE_LASER_PWM_PIN == FAN1_PIN + #error "SPINDLE_LASER_PWM_PIN is used FAN1_PIN." + #elif PIN_EXISTS(FAN2) && SPINDLE_LASER_PWM_PIN == FAN2_PIN + #error "SPINDLE_LASER_PWM_PIN is used FAN2_PIN." + #elif PIN_EXISTS(CONTROLLERFAN) && SPINDLE_LASER_PWM_PIN == CONTROLLERFAN_PIN + #error "SPINDLE_LASER_PWM_PIN is used by CONTROLLERFAN_PIN." + #endif + #endif +#endif // SPINDLE_LASER_ENABLE + +#if ENABLED(EMERGENCY_PARSER) + #error "EMERGENCY_PARSER is not yet implemented for STM32. Disable EMERGENCY_PARSER to continue." +#endif diff --git a/Marlin/src/HAL/HAL_STM32/endstop_interrupts.h b/Marlin/src/HAL/HAL_STM32/endstop_interrupts.h new file mode 100644 index 0000000000..e4a243b43e --- /dev/null +++ b/Marlin/src/HAL/HAL_STM32/endstop_interrupts.h @@ -0,0 +1,64 @@ +/** + * 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 + * Copyright (C) 2017 Victor Perez + * + * 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 "../../module/endstops.h" + +// One ISR for all EXT-Interrupts +void endstop_ISR(void) { endstops.update(); } + +void setup_endstop_interrupts(void) { + #if HAS_X_MAX + attachInterrupt(X_MAX_PIN, endstop_ISR, CHANGE); + #endif + #if HAS_X_MIN + attachInterrupt(X_MIN_PIN, endstop_ISR, CHANGE); + #endif + #if HAS_Y_MAX + attachInterrupt(Y_MAX_PIN, endstop_ISR, CHANGE); + #endif + #if HAS_Y_MIN + attachInterrupt(Y_MIN_PIN, endstop_ISR, CHANGE); + #endif + #if HAS_Z_MAX + attachInterrupt(Z_MAX_PIN, endstop_ISR, CHANGE); + #endif + #if HAS_Z_MIN + attachInterrupt(Z_MIN_PIN, endstop_ISR, CHANGE); + #endif + #if HAS_Z2_MAX + attachInterrupt(Z2_MAX_PIN, endstop_ISR, CHANGE); + #endif + #if HAS_Z2_MIN + attachInterrupt(Z2_MIN_PIN, endstop_ISR, CHANGE); + #endif + #if HAS_Z3_MAX + attachInterrupt(Z3_MAX_PIN, endstop_ISR, CHANGE); + #endif + #if HAS_Z3_MIN + attachInterrupt(Z3_MIN_PIN, endstop_ISR, CHANGE); + #endif + #if HAS_Z_MIN_PROBE_PIN + attachInterrupt(Z_MIN_PROBE_PIN, endstop_ISR, CHANGE); + #endif +} diff --git a/Marlin/src/HAL/HAL_STM32/fastio_STM32.cpp b/Marlin/src/HAL/HAL_STM32/fastio_STM32.cpp new file mode 100644 index 0000000000..e1824ed181 --- /dev/null +++ b/Marlin/src/HAL/HAL_STM32/fastio_STM32.cpp @@ -0,0 +1,34 @@ +/** + * 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 + * Copyright (C) 2017 Victor Perez + * + * 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 . + * + */ +#ifdef ARDUINO_ARCH_STM32 + +#include "../../inc/MarlinConfig.h" + +GPIO_TypeDef* FastIOPortMap[LastPort + 1]; + +void FastIO_init() { + for (uint8_t i = 0; i < NUM_DIGITAL_PINS; i++) + FastIOPortMap[STM_PORT(digitalPin[i])] = get_GPIO_Port(STM_PORT(digitalPin[i])); +} + +#endif diff --git a/Marlin/src/HAL/HAL_STM32/fastio_STM32.h b/Marlin/src/HAL/HAL_STM32/fastio_STM32.h new file mode 100644 index 0000000000..be45dab925 --- /dev/null +++ b/Marlin/src/HAL/HAL_STM32/fastio_STM32.h @@ -0,0 +1,82 @@ +/** + * 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 + * Copyright (C) 2017 Victor Perez + * + * 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 + +/** + * Fast I/O interfaces for STM32 + * These use GPIO register access for fast port manipulation. + */ + +// -------------------------------------------------------------------------- +// Public Variables +// -------------------------------------------------------------------------- + +extern GPIO_TypeDef * FastIOPortMap[]; + +// -------------------------------------------------------------------------- +// Public functions +// -------------------------------------------------------------------------- + +void FastIO_init(); // Must be called before using fast io macros + +// -------------------------------------------------------------------------- +// Defines +// -------------------------------------------------------------------------- + +#define _BV(b) (1 << (b)) +#define _BV32(b) (1UL << (b)) + +#if defined(STM32F0xx) || defined(STM32F1xx) || defined(STM32F3xx) || defined(STM32L0xx) || defined(STM32L4xx) + #define _WRITE(IO, V) do { \ + if (V) FastIOPortMap[STM_PORT(digitalPin[IO])]->BSRR = _BV32(STM_PIN(digitalPin[IO])) ; \ + else FastIOPortMap[STM_PORT(digitalPin[IO])]->BRR = _BV32(STM_PIN(digitalPin[IO])) ; \ + } while(0) +#else + #define _WRITE(IO, V) (FastIOPortMap[STM_PORT(digitalPin[IO])]->BSRR = _BV32(STM_PIN(digitalPin[IO]) + (V ? 0 : 16))) +#endif + +#define _READ(IO) bool(READ_BIT(FastIOPortMap[STM_PORT(digitalPin[IO])]->IDR, _BV32(STM_PIN(digitalPin[IO])))) +#define _TOGGLE(IO) (FastIOPortMap[STM_PORT(digitalPin[IO])]->ODR ^= _BV32(STM_PIN(digitalPin[IO]))) + +#define _GET_MODE(IO) +#define _SET_MODE(IO,M) pinMode(IO, M) +#define _SET_OUTPUT(IO) pinMode(IO, OUTPUT) /*!< Output Push Pull Mode & GPIO_NOPULL */ + +#define WRITE_VAR(IO,V) _WRITE(IO,V) +#define WRITE(IO,V) _WRITE(IO,V) +#define READ(IO) _READ(IO) +#define TOGGLE(IO) _TOGGLE(IO) + +#define OUT_WRITE(IO,V) do{ _SET_OUTPUT(IO); WRITE(IO,V); }while(0) + +#define SET_INPUT(IO) _SET_MODE(IO, INPUT) /*!< Input Floating Mode */ +#define SET_INPUT_PULLUP(IO) _SET_MODE(IO, INPUT_PULLUP) /*!< Input with Pull-up activation */ +#define SET_INPUT_PULLDOWN(IO) _SET_MODE(IO, INPUT_PULLDOWN) /*!< Input with Pull-down activation */ +#define SET_OUTPUT(IO) OUT_WRITE(IO, LOW) + +#define GET_INPUT(IO) +#define GET_OUTPUT(IO) +#define GET_TIMER(IO) + +#define PWM_PIN(p) digitalPinHasPWM(p) +#define USEABLE_HARDWARE_PWM(p) PWM_PIN(p) diff --git a/Marlin/src/HAL/HAL_STM32/persistent_store_impl.cpp b/Marlin/src/HAL/HAL_STM32/persistent_store_impl.cpp new file mode 100644 index 0000000000..31715ac664 --- /dev/null +++ b/Marlin/src/HAL/HAL_STM32/persistent_store_impl.cpp @@ -0,0 +1,119 @@ +/** + * Marlin 3D Printer Firmware + * + * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com + * Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com + * Copyright (c) 2016 Victor Perez victor_pv@hotmail.com + * + * 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 . + * + */ +#ifdef ARDUINO_ARCH_STM32 + +#include "../../inc/MarlinConfig.h" + +#if ENABLED(EEPROM_SETTINGS) + +#include "../shared/persistent_store_api.h" + +#if DISABLED(EEPROM_EMULATED_WITH_SRAM) && DISABLED(SPI_EEPROM) && DISABLED(I2C_EEPROM) + #include + static bool eeprom_data_written = false; +#endif + +bool PersistentStore::access_start() { + #if DISABLED(EEPROM_EMULATED_WITH_SRAM) && DISABLED(SPI_EEPROM) && DISABLED(I2C_EEPROM) + eeprom_buffer_fill(); + #endif + return true; +} + +bool PersistentStore::access_finish() { + #if DISABLED(EEPROM_EMULATED_WITH_SRAM) && DISABLED(SPI_EEPROM) && DISABLED(I2C_EEPROM) + if (eeprom_data_written) { + eeprom_buffer_flush(); + eeprom_data_written = false; + } + #endif + return true; +} + +bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) { + while (size--) { + uint8_t v = *value; + + // Save to either external EEPROM, program flash or Backup SRAM + #if ENABLED(SPI_EEPROM) || ENABLED(I2C_EEPROM) + // EEPROM has only ~100,000 write cycles, + // so only write bytes that have changed! + uint8_t * const p = (uint8_t * const)pos; + if (v != eeprom_read_byte(p)) { + eeprom_write_byte(p, v); + if (eeprom_read_byte(p) != v) { + SERIAL_ECHO_START(); + SERIAL_ECHOLNPGM(MSG_ERR_EEPROM_WRITE); + return true; + } + } + #elif DISABLED(EEPROM_EMULATED_WITH_SRAM) + eeprom_buffered_write_byte(pos, v); + #else + *(__IO uint8_t *)(BKPSRAM_BASE + (uint8_t * const)pos) = v; + #endif + + crc16(crc, &v, 1); + pos++; + value++; + }; + #if DISABLED(EEPROM_EMULATED_WITH_SRAM) && DISABLED(SPI_EEPROM) && DISABLED(I2C_EEPROM) + eeprom_data_written = true; + #endif + + return false; +} + +bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing) { + do { + // Read from either external EEPROM, program flash or Backup SRAM + const uint8_t c = ( + #if ENABLED(SPI_EEPROM) || ENABLED(I2C_EEPROM) + eeprom_read_byte((uint8_t*)pos) + #elif DISABLED(EEPROM_EMULATED_WITH_SRAM) + eeprom_buffered_read_byte(pos) + #else + (*(__IO uint8_t *)(BKPSRAM_BASE + ((uint8_t*)pos))) + #endif + ); + + if (writing) *value = c; + crc16(crc, &c, 1); + pos++; + value++; + } while (--size); + return false; +} + +size_t PersistentStore::capacity() { + #if ENABLED(SPI_EEPROM) || ENABLED(I2C_EEPROM) + return E2END + 1; + #elif DISABLED(EEPROM_EMULATED_WITH_SRAM) + return E2END + 1; + #else + return 4096; // 4kB + #endif +} + +#endif // EEPROM_SETTINGS +#endif // ARDUINO_ARCH_STM32 diff --git a/Marlin/src/HAL/HAL_STM32/pinsDebug.h b/Marlin/src/HAL/HAL_STM32/pinsDebug.h new file mode 100644 index 0000000000..ac8b005754 --- /dev/null +++ b/Marlin/src/HAL/HAL_STM32/pinsDebug.h @@ -0,0 +1 @@ +#error "Debug pins is not yet supported for STM32!" diff --git a/Marlin/src/HAL/HAL_STM32/spi_pins.h b/Marlin/src/HAL/HAL_STM32/spi_pins.h new file mode 100644 index 0000000000..1136a78c22 --- /dev/null +++ b/Marlin/src/HAL/HAL_STM32/spi_pins.h @@ -0,0 +1,35 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * 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 + +/** + * Define SPI Pins: SCK, MISO, MOSI, SS + */ +#ifndef SCK_PIN + #define SCK_PIN PIN_SPI_SCK +#endif +#ifndef MISO_PIN + #define MISO_PIN PIN_SPI_MISO +#endif +#ifndef MOSI_PIN + #define MOSI_PIN PIN_SPI_MOSI +#endif +#ifndef SS_PIN + #define SS_PIN PIN_SPI_SS +#endif diff --git a/Marlin/src/HAL/HAL_STM32/watchdog_STM32.cpp b/Marlin/src/HAL/HAL_STM32/watchdog_STM32.cpp new file mode 100644 index 0000000000..7b049f1551 --- /dev/null +++ b/Marlin/src/HAL/HAL_STM32/watchdog_STM32.cpp @@ -0,0 +1,42 @@ +/** + * 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 . + * + */ + +#ifdef ARDUINO_ARCH_STM32 + +#include "../../inc/MarlinConfig.h" + +#if ENABLED(USE_WATCHDOG) + + #include "watchdog_STM32.h" + #include + + void watchdog_init() { IWatchdog.begin(4000000); } // 4 sec timeout + + void watchdog_reset() { + IWatchdog.reload(); + #if PIN_EXISTS(LED) + TOGGLE(LED_PIN); // heartbeat indicator + #endif + } + +#endif // USE_WATCHDOG +#endif // ARDUINO_ARCH_STM32 diff --git a/Marlin/src/HAL/HAL_STM32/watchdog_STM32.h b/Marlin/src/HAL/HAL_STM32/watchdog_STM32.h new file mode 100644 index 0000000000..e860d16793 --- /dev/null +++ b/Marlin/src/HAL/HAL_STM32/watchdog_STM32.h @@ -0,0 +1,25 @@ +/** + * 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 . + * + */ +#pragma once + +void watchdog_init(); +void watchdog_reset(); diff --git a/Marlin/src/HAL/HAL_STM32F1/HAL.h b/Marlin/src/HAL/HAL_STM32F1/HAL.h index dcb9b260e0..e3c81ecb5b 100644 --- a/Marlin/src/HAL/HAL_STM32F1/HAL.h +++ b/Marlin/src/HAL/HAL_STM32F1/HAL.h @@ -20,16 +20,13 @@ * along with this program. If not, see . * */ +#pragma once /** * HAL for stm32duino.com based on Libmaple and compatible (STM32F1) */ -#ifndef _HAL_STM32F1_H -#define _HAL_STM32F1_H - #define CPU_32_BIT -#undef DEBUG_NONE #ifndef vsnprintf_P #define vsnprintf_P vsnprintf @@ -43,15 +40,6 @@ #include #include -// -------------------------------------------------------------------------- -// Undefine DEBUG_ settings -// -------------------------------------------------------------------------- - - -#undef DEBUG_NONE -#undef DEBUG_FAULT -#undef DEBUG_ALL - // -------------------------------------------------------------------------- // Includes // -------------------------------------------------------------------------- @@ -212,8 +200,8 @@ uint8_t spiRec(uint32_t chan); * TODO: Write all this eeprom stuff. Can emulate eeprom in flash as last resort. * Wire library should work for i2c eeproms. */ -void eeprom_write_byte(unsigned char *pos, unsigned char value); -unsigned char eeprom_read_byte(unsigned char *pos); +void eeprom_write_byte(uint8_t *pos, unsigned char value); +uint8_t eeprom_read_byte(uint8_t *pos); void eeprom_read_block (void *__dst, const void *__src, size_t __n); void eeprom_update_block (const void *__src, void *__dst, size_t __n); @@ -249,6 +237,5 @@ void HAL_enable_AdcFreerun(void); #define GET_PIN_MAP_INDEX(pin) pin #define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval) -#define JTAG_DISABLE() afio_cfg_debug_ports(AFIO_DEBUG_NONE) - -#endif // _HAL_STM32F1_H +#define JTAG_DISABLE() afio_cfg_debug_ports(AFIO_DEBUG_SW_ONLY) +#define JTAGSWD_DISABLE() afio_cfg_debug_ports(AFIO_DEBUG_NONE) diff --git a/Marlin/src/HAL/HAL_STM32F1/HAL_Servo_Stm32f1.h b/Marlin/src/HAL/HAL_STM32F1/HAL_Servo_Stm32f1.h index 778269361f..668378388c 100644 --- a/Marlin/src/HAL/HAL_STM32F1/HAL_Servo_Stm32f1.h +++ b/Marlin/src/HAL/HAL_STM32F1/HAL_Servo_Stm32f1.h @@ -20,9 +20,7 @@ * along with this program. If not, see . * */ - -#ifndef HAL_SERVO_STM32F1_H -#define HAL_SERVO_STM32F1_H +#pragma once // Pin number of unattached pins #define NOT_ATTACHED (-1) @@ -53,5 +51,3 @@ class libServo { int32_t minAngle; int32_t maxAngle; }; - -#endif // HAL_SERVO_STM32F1_H diff --git a/Marlin/src/HAL/HAL_STM32F1/HAL_timers_Stm32f1.h b/Marlin/src/HAL/HAL_STM32F1/HAL_timers_Stm32f1.h index 98542f8374..9610bb5533 100644 --- a/Marlin/src/HAL/HAL_STM32F1/HAL_timers_Stm32f1.h +++ b/Marlin/src/HAL/HAL_STM32F1/HAL_timers_Stm32f1.h @@ -19,14 +19,12 @@ * along with this program. If not, see . * */ +#pragma once /** * HAL for stm32duino.com based on Libmaple and compatible (STM32F1) */ -#ifndef _HAL_TIMERS_STM32F1_H -#define _HAL_TIMERS_STM32F1_H - // -------------------------------------------------------------------------- // Includes // -------------------------------------------------------------------------- @@ -167,5 +165,3 @@ FORCE_INLINE static void HAL_timer_isr_prologue(const uint8_t timer_num) { } #define HAL_timer_isr_epilogue(TIMER_NUM) - -#endif // _HAL_TIMERS_STM32F1_H diff --git a/Marlin/src/HAL/HAL_STM32F1/README.md b/Marlin/src/HAL/HAL_STM32F1/README.md index a28000f030..7defdc8749 100644 --- a/Marlin/src/HAL/HAL_STM32F1/README.md +++ b/Marlin/src/HAL/HAL_STM32F1/README.md @@ -13,13 +13,6 @@ After these lines: #endif <> -Add the following 3 lines: -<> -#undef DEBUG_NONE -#undef DEBUG_FAULT -#undef DEBUG_ALL -<> - ### Main developers: Victorpv xC000005 @@ -30,5 +23,3 @@ https://github.com/victorpv/Marlin/tree/bugfix-2.0.x PRs should only be sent to Marlin bugfix-2.0.x branch once tested in printing so not to introduce new bugs. For testing/dev, you can submit to the above branch - - diff --git a/Marlin/src/HAL/HAL_STM32F1/endstop_interrupts.h b/Marlin/src/HAL/HAL_STM32F1/endstop_interrupts.h index 1ffc330d89..50d0127968 100644 --- a/Marlin/src/HAL/HAL_STM32F1/endstop_interrupts.h +++ b/Marlin/src/HAL/HAL_STM32F1/endstop_interrupts.h @@ -20,6 +20,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Endstop interrupts for Libmaple STM32F1 based targets. @@ -46,9 +47,6 @@ * (Located in Marlin/buildroot/share/pin_interrupt_test/pin_interrupt_test.ino) */ -#ifndef _ENDSTOP_INTERRUPTS_H_ -#define _ENDSTOP_INTERRUPTS_H_ - #include "../../module/endstops.h" // One ISR for all EXT-Interrupts @@ -89,5 +87,3 @@ void setup_endstop_interrupts(void) { attachInterrupt(Z_MIN_PROBE_PIN, endstop_ISR, CHANGE); #endif } - -#endif //_ENDSTOP_INTERRUPTS_H_ diff --git a/Marlin/src/HAL/HAL_STM32F1/fastio_Stm32f1.h b/Marlin/src/HAL/HAL_STM32F1/fastio_Stm32f1.h index d6683e36ee..237ffb0b35 100644 --- a/Marlin/src/HAL/HAL_STM32F1/fastio_Stm32f1.h +++ b/Marlin/src/HAL/HAL_STM32F1/fastio_Stm32f1.h @@ -20,15 +20,13 @@ * along with this program. If not, see . * */ +#pragma once /** * Fast I/O interfaces for STM32F1 * These use GPIO functions instead of Direct Port Manipulation, as on AVR. */ -#ifndef _FASTIO_STM32F1_H -#define _FASTIO_STM32F1_H - #include #define READ(IO) (PIN_MAP[IO].gpio_device->regs->IDR & (1U << PIN_MAP[IO].gpio_bit) ? HIGH : LOW) @@ -50,9 +48,5 @@ #define GET_OUTPUT(IO) (_GET_MODE(IO) == GPIO_OUTPUT_PP) #define GET_TIMER(IO) (PIN_MAP[IO].timer_device != NULL) -/** - * TODO: Write a macro to test if PIN is PWM or not. - */ -#define PWM_PIN(p) true - -#endif // _FASTIO_STM32F1_H +#define PWM_PIN(p) true +#define USEABLE_HARDWARE_PWM(p) PWM_PIN(p) diff --git a/Marlin/src/HAL/HAL_STM32F1/persistent_store_sdcard.cpp b/Marlin/src/HAL/HAL_STM32F1/persistent_store_sdcard.cpp index 349abba246..757d62fd59 100644 --- a/Marlin/src/HAL/HAL_STM32F1/persistent_store_sdcard.cpp +++ b/Marlin/src/HAL/HAL_STM32F1/persistent_store_sdcard.cpp @@ -41,7 +41,7 @@ char HAL_STM32F1_eeprom_content[HAL_STM32F1_EEPROM_SIZE]; char eeprom_filename[] = "eeprom.dat"; bool PersistentStore::access_start() { - if (!card.cardOK) return false; + if (!card.flag.cardOK) return false; int16_t bytes_read = 0; constexpr char eeprom_zero = 0xFF; card.openFile(eeprom_filename, true); @@ -54,7 +54,7 @@ bool PersistentStore::access_start() { } bool PersistentStore::access_finish() { - if (!card.cardOK) return false; + if (!card.flag.cardOK) return false; card.openFile(eeprom_filename, true); int16_t bytes_written = card.write(HAL_STM32F1_eeprom_content, HAL_STM32F1_EEPROM_SIZE); card.closefile(); diff --git a/Marlin/src/HAL/HAL_STM32F1/spi_pins.h b/Marlin/src/HAL/HAL_STM32F1/spi_pins.h index f834cea3c2..b2fc2c345d 100644 --- a/Marlin/src/HAL/HAL_STM32F1/spi_pins.h +++ b/Marlin/src/HAL/HAL_STM32F1/spi_pins.h @@ -16,14 +16,12 @@ * along with this program. If not, see . * */ +#pragma once /** * HAL for stm32duino.com based on Libmaple and compatible (STM32F1) */ -#ifndef SPI_PINS_H_ -#define SPI_PINS_H_ - /** * Define SPI Pins: SCK, MISO, MOSI, SS * @@ -33,5 +31,3 @@ #define MISO_PIN PA6 #define MOSI_PIN PA7 #define SS_PIN PA4 - -#endif // SPI_PINS_H_ diff --git a/Marlin/src/HAL/HAL_STM32F1/watchdog_Stm32f1.h b/Marlin/src/HAL/HAL_STM32F1/watchdog_Stm32f1.h index f307950c76..d34efdc0a2 100644 --- a/Marlin/src/HAL/HAL_STM32F1/watchdog_Stm32f1.h +++ b/Marlin/src/HAL/HAL_STM32F1/watchdog_Stm32f1.h @@ -19,14 +19,12 @@ * along with this program. If not, see . * */ +#pragma once /** * HAL for stm32duino.com based on Libmaple and compatible (STM32F1) */ -#ifndef WATCHDOG_STM32F1_H -#define WATCHDOG_STM32F1_H - #include #include "../../inc/MarlinConfig.h" @@ -51,5 +49,3 @@ inline void watchdog_reset() { #endif iwdg_feed(); } - -#endif // WATCHDOG_STM32F1_H diff --git a/Marlin/src/HAL/HAL_STM32F4/EEPROM_Emul/eeprom_emul.cpp b/Marlin/src/HAL/HAL_STM32F4/EEPROM_Emul/eeprom_emul.cpp index 7be880ace0..c13d428187 100644 --- a/Marlin/src/HAL/HAL_STM32F4/EEPROM_Emul/eeprom_emul.cpp +++ b/Marlin/src/HAL/HAL_STM32F4/EEPROM_Emul/eeprom_emul.cpp @@ -47,7 +47,7 @@ /** @addtogroup EEPROM_Emulation * @{ */ -#if defined(STM32F4) || defined(STM32F4xx) +#if defined(STM32GENERIC) && (defined(STM32F4) || defined(STM32F4xx)) /* Includes ------------------------------------------------------------------*/ #include "eeprom_emul.h" @@ -103,12 +103,10 @@ uint16_t EE_Initialize(void) { case ERASED: if (PageStatus1 == VALID_PAGE) { /* Page0 erased, Page1 valid */ /* Erase Page0 */ - if(!EE_VerifyPageFullyErased(PAGE0_BASE_ADDRESS)) { + if (!EE_VerifyPageFullyErased(PAGE0_BASE_ADDRESS)) { FlashStatus = HAL_FLASHEx_Erase(&pEraseInit, &SectorError); /* If erase operation was failed, a Flash error code is returned */ - if (FlashStatus != HAL_OK) { - return FlashStatus; - } + if (FlashStatus != HAL_OK) return FlashStatus; } } else if (PageStatus1 == RECEIVE_DATA) { /* Page0 erased, Page1 receive */ diff --git a/Marlin/src/HAL/HAL_STM32F4/EEPROM_Emul/eeprom_emul.h b/Marlin/src/HAL/HAL_STM32F4/EEPROM_Emul/eeprom_emul.h index a7e3e0f012..a3e93503d8 100644 --- a/Marlin/src/HAL/HAL_STM32F4/EEPROM_Emul/eeprom_emul.h +++ b/Marlin/src/HAL/HAL_STM32F4/EEPROM_Emul/eeprom_emul.h @@ -45,10 +45,7 @@ * ****************************************************************************** */ - -/* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef __EEEPROM_EMUL_H -#define __EEEPROM_EMUL_H +#pragma once // -------------------------------------------------------------------------- // Includes @@ -112,6 +109,4 @@ uint16_t EE_Initialize(void); uint16_t EE_ReadVariable(uint16_t VirtAddress, uint16_t* Data); uint16_t EE_WriteVariable(uint16_t VirtAddress, uint16_t Data); -#endif /* __EEEPROM_H */ - /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/Marlin/src/HAL/HAL_STM32F4/EmulatedEeprom.cpp b/Marlin/src/HAL/HAL_STM32F4/EmulatedEeprom.cpp index 19853171fe..7d45ef18d0 100644 --- a/Marlin/src/HAL/HAL_STM32F4/EmulatedEeprom.cpp +++ b/Marlin/src/HAL/HAL_STM32F4/EmulatedEeprom.cpp @@ -17,7 +17,7 @@ * */ -#if defined(STM32F4) || defined(STM32F4xx) +#if defined(STM32GENERIC) && (defined(STM32F4) || defined(STM32F4xx)) /** * Description: functions for I2C connected external EEPROM. @@ -96,7 +96,7 @@ void eeprom_init() { } } -void eeprom_write_byte(unsigned char *pos, unsigned char value) { +void eeprom_write_byte(uint8_t *pos, unsigned char value) { uint16_t eeprom_address = (unsigned) pos; eeprom_init(); @@ -110,7 +110,7 @@ void eeprom_write_byte(unsigned char *pos, unsigned char value) { HAL_FLASH_Lock(); } -unsigned char eeprom_read_byte(unsigned char *pos) { +uint8_t eeprom_read_byte(uint8_t *pos) { uint16_t data = 0xFF; uint16_t eeprom_address = (unsigned)pos; @@ -140,4 +140,3 @@ void eeprom_update_block(const void *__src, void *__dst, size_t __n) { #endif // ENABLED(EEPROM_SETTINGS) && DISABLED(I2C_EEPROM) && DISABLED(SPI_EEPROM) #endif // STM32F4 || STM32F4xx - diff --git a/Marlin/src/HAL/HAL_STM32F4/HAL.cpp b/Marlin/src/HAL/HAL_STM32F4/HAL.cpp index c79af5859a..56823ccc83 100644 --- a/Marlin/src/HAL/HAL_STM32F4/HAL.cpp +++ b/Marlin/src/HAL/HAL_STM32F4/HAL.cpp @@ -21,7 +21,7 @@ * */ -#if defined(STM32F4) || defined(STM32F4xx) +#if defined(STM32GENERIC) && (defined(STM32F4) || defined(STM32F4xx)) // -------------------------------------------------------------------------- // Includes diff --git a/Marlin/src/HAL/HAL_STM32F4/HAL.h b/Marlin/src/HAL/HAL_STM32F4/HAL.h index 6d51f6e776..2b2dd09ba2 100644 --- a/Marlin/src/HAL/HAL_STM32F4/HAL.h +++ b/Marlin/src/HAL/HAL_STM32F4/HAL.h @@ -20,12 +20,9 @@ * along with this program. If not, see . * */ - -#ifndef _HAL_STM32F4_H -#define _HAL_STM32F4_H +#pragma once #define CPU_32_BIT -#undef DEBUG_NONE #ifndef vsnprintf_P #define vsnprintf_P vsnprintf @@ -110,6 +107,7 @@ #define NUM_SERIAL 1 #endif +#undef _BV #define _BV(b) (1 << (b)) /** @@ -211,8 +209,8 @@ uint8_t spiRec(uint32_t chan); * TODO: Write all this eeprom stuff. Can emulate eeprom in flash as last resort. * Wire library should work for i2c eeproms. */ -void eeprom_write_byte(unsigned char *pos, unsigned char value); -unsigned char eeprom_read_byte(unsigned char *pos); +void eeprom_write_byte(uint8_t *pos, unsigned char value); +uint8_t eeprom_read_byte(uint8_t *pos); void eeprom_read_block (void *__dst, const void *__src, size_t __n); void eeprom_update_block (const void *__src, void *__dst, size_t __n); @@ -248,6 +246,5 @@ void HAL_enable_AdcFreerun(void); #define GET_PIN_MAP_INDEX(pin) pin #define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval) -#define JTAG_DISABLE() afio_cfg_debug_ports(AFIO_DEBUG_NONE) - -#endif // _HAL_STM32F4_H +#define JTAG_DISABLE() afio_cfg_debug_ports(AFIO_DEBUG_SW_ONLY) +#define JTAGSWD_DISABLE() afio_cfg_debug_ports(AFIO_DEBUG_NONE) diff --git a/Marlin/src/HAL/HAL_STM32F4/HAL_Servo_STM32F4.cpp b/Marlin/src/HAL/HAL_STM32F4/HAL_Servo_STM32F4.cpp index 2877e88d54..9d9c722e58 100644 --- a/Marlin/src/HAL/HAL_STM32F4/HAL_Servo_STM32F4.cpp +++ b/Marlin/src/HAL/HAL_STM32F4/HAL_Servo_STM32F4.cpp @@ -21,7 +21,7 @@ * */ -#if defined(STM32F4) || defined(STM32F4xx) +#if defined(STM32GENERIC) && (defined(STM32F4) || defined(STM32F4xx)) #include "../../inc/MarlinConfig.h" diff --git a/Marlin/src/HAL/HAL_STM32F4/HAL_Servo_STM32F4.h b/Marlin/src/HAL/HAL_STM32F4/HAL_Servo_STM32F4.h index b68910387c..5daf90ab8d 100644 --- a/Marlin/src/HAL/HAL_STM32F4/HAL_Servo_STM32F4.h +++ b/Marlin/src/HAL/HAL_STM32F4/HAL_Servo_STM32F4.h @@ -20,22 +20,18 @@ * along with this program. If not, see . * */ - -#ifndef HAL_SERVO_STM32F4_H -#define HAL_SERVO_STM32F4_H +#pragma once #include // Inherit and expand on the official library class libServo : public Servo { -public: + public: int8_t attach(const int pin); int8_t attach(const int pin, const int min, const int max); void move(const int value); -private: + private: uint16_t min_ticks; uint16_t max_ticks; uint8_t servoIndex; // index into the channel data for this servo }; - -#endif // HAL_SERVO_STM32F4_H diff --git a/Marlin/src/HAL/HAL_STM32F4/HAL_spi_STM32F4.cpp b/Marlin/src/HAL/HAL_STM32F4/HAL_spi_STM32F4.cpp index 5e3ff4d9d9..34582c30ad 100644 --- a/Marlin/src/HAL/HAL_STM32F4/HAL_spi_STM32F4.cpp +++ b/Marlin/src/HAL/HAL_STM32F4/HAL_spi_STM32F4.cpp @@ -30,7 +30,7 @@ * Adapted to the STM32F4 HAL */ -#if defined(STM32F4) || defined(STM32F4xx) +#if defined(STM32GENERIC) && (defined(STM32F4) || defined(STM32F4xx)) // -------------------------------------------------------------------------- // Includes diff --git a/Marlin/src/HAL/HAL_STM32F4/HAL_timers_STM32F4.cpp b/Marlin/src/HAL/HAL_STM32F4/HAL_timers_STM32F4.cpp index 64da993ef8..6a23090a24 100644 --- a/Marlin/src/HAL/HAL_STM32F4/HAL_timers_STM32F4.cpp +++ b/Marlin/src/HAL/HAL_STM32F4/HAL_timers_STM32F4.cpp @@ -20,7 +20,7 @@ * */ -#if defined(STM32F4) || defined(STM32F4xx) +#if defined(STM32GENERIC) && (defined(STM32F4) || defined(STM32F4xx)) // -------------------------------------------------------------------------- // Includes @@ -91,7 +91,7 @@ void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) { TimerHandle[timer_num].irqHandle = TC5_Handler; TimerHandleInit(&TimerHandle[timer_num], (((HAL_TIMER_RATE) / step_prescaler) / frequency) - 1, step_prescaler); #endif - HAL_NVIC_SetPriority(STEP_TIMER_IRQ_ID, 6, 0); + HAL_NVIC_SetPriority(STEP_TIMER_IRQ_ID, 1, 0); break; case TEMP_TIMER_NUM: diff --git a/Marlin/src/HAL/HAL_STM32F4/HAL_timers_STM32F4.h b/Marlin/src/HAL/HAL_STM32F4/HAL_timers_STM32F4.h index 83081ed756..d2c1156542 100644 --- a/Marlin/src/HAL/HAL_STM32F4/HAL_timers_STM32F4.h +++ b/Marlin/src/HAL/HAL_STM32F4/HAL_timers_STM32F4.h @@ -19,9 +19,7 @@ * along with this program. If not, see . * */ - -#ifndef _HAL_TIMERS_STM32F4_H -#define _HAL_TIMERS_STM32F4_H +#pragma once // -------------------------------------------------------------------------- // Includes @@ -130,5 +128,3 @@ FORCE_INLINE static hal_timer_t HAL_timer_get_compare(const uint8_t timer_num) { #endif #define HAL_timer_isr_epilogue(TIMER_NUM) - -#endif // _HAL_TIMERS_STM32F4_H diff --git a/Marlin/src/HAL/HAL_STM32F4/endstop_interrupts.h b/Marlin/src/HAL/HAL_STM32F4/endstop_interrupts.h index e207b720aa..e4a243b43e 100644 --- a/Marlin/src/HAL/HAL_STM32F4/endstop_interrupts.h +++ b/Marlin/src/HAL/HAL_STM32F4/endstop_interrupts.h @@ -20,9 +20,7 @@ * along with this program. If not, see . * */ - -#ifndef _ENDSTOP_INTERRUPTS_H_ -#define _ENDSTOP_INTERRUPTS_H_ +#pragma once #include "../../module/endstops.h" @@ -64,5 +62,3 @@ void setup_endstop_interrupts(void) { attachInterrupt(Z_MIN_PROBE_PIN, endstop_ISR, CHANGE); #endif } - -#endif //_ENDSTOP_INTERRUPTS_H_ diff --git a/Marlin/src/HAL/HAL_STM32F4/fastio_STM32F4.h b/Marlin/src/HAL/HAL_STM32F4/fastio_STM32F4.h index e185344dc2..61de5306cc 100644 --- a/Marlin/src/HAL/HAL_STM32F4/fastio_STM32F4.h +++ b/Marlin/src/HAL/HAL_STM32F4/fastio_STM32F4.h @@ -20,19 +20,16 @@ * along with this program. If not, see . * */ +#pragma once /** * Fast I/O interfaces for STM32F4 * These use GPIO functions instead of Direct Port Manipulation, as on AVR. */ -#ifndef _FASTIO_STM32F4_H -#define _FASTIO_STM32F4_H - +#undef _BV #define _BV(b) (1 << (b)) -#define USEABLE_HARDWARE_PWM(p) true - #define READ(IO) digitalRead(IO) #define WRITE(IO,V) digitalWrite(IO,V) #define WRITE_VAR(IO,V) WRITE(IO,V) @@ -54,6 +51,12 @@ #define GET_OUTPUT(IO) #define GET_TIMER(IO) +#define PWM_PIN(p) true +#define USEABLE_HARDWARE_PWM(p) PWM_PIN(p) + +// +// Pins Definitions +// #define PORTA 0 #define PORTB 1 #define PORTC 2 @@ -146,5 +149,3 @@ #define PE13 _STM32_PIN(E, 13) #define PE14 _STM32_PIN(E, 14) #define PE15 _STM32_PIN(E, 15) - -#endif // _FASTIO_STM32F4_H diff --git a/Marlin/src/HAL/HAL_STM32F4/persistent_store_eeprom.cpp b/Marlin/src/HAL/HAL_STM32F4/persistent_store_eeprom.cpp index 194cd21bc6..648c297687 100644 --- a/Marlin/src/HAL/HAL_STM32F4/persistent_store_eeprom.cpp +++ b/Marlin/src/HAL/HAL_STM32F4/persistent_store_eeprom.cpp @@ -21,7 +21,7 @@ * */ -#if defined(STM32F4) || defined(STM32F4xx) +#if defined(STM32GENERIC) && (defined(STM32F4) || defined(STM32F4xx)) #include "../shared/persistent_store_api.h" @@ -55,7 +55,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing) { do { - uint8_t c = eeprom_read_byte((unsigned char*)pos); + uint8_t c = eeprom_read_byte((uint8_t*)pos); if (writing) *value = c; crc16(crc, &c, 1); pos++; diff --git a/Marlin/src/HAL/HAL_STM32F4/spi_pins.h b/Marlin/src/HAL/HAL_STM32F4/spi_pins.h index f178ac8107..577b36aeb8 100644 --- a/Marlin/src/HAL/HAL_STM32F4/spi_pins.h +++ b/Marlin/src/HAL/HAL_STM32F4/spi_pins.h @@ -1,41 +1,35 @@ /** -* Marlin 3D Printer Firmware -* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] -* -* 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 . -* -*/ - -#ifndef SPI_PINS_H_ -#define SPI_PINS_H_ - + * Marlin 3D Printer Firmware + * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * 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 /** * Define SPI Pins: SCK, MISO, MOSI, SS - * */ #ifndef SCK_PIN - #define SCK_PIN PA5 + #define SCK_PIN PA5 #endif #ifndef MISO_PIN - #define MISO_PIN PA6 + #define MISO_PIN PA6 #endif #ifndef MOSI_PIN - #define MOSI_PIN PA7 + #define MOSI_PIN PA7 #endif #ifndef SS_PIN - #define SS_PIN PA8 + #define SS_PIN PA8 #endif - -#endif // SPI_PINS_H_ diff --git a/Marlin/src/HAL/HAL_STM32F4/watchdog_STM32F4.cpp b/Marlin/src/HAL/HAL_STM32F4/watchdog_STM32F4.cpp index f5dd6bdfae..dd4d4391c6 100644 --- a/Marlin/src/HAL/HAL_STM32F4/watchdog_STM32F4.cpp +++ b/Marlin/src/HAL/HAL_STM32F4/watchdog_STM32F4.cpp @@ -20,7 +20,7 @@ * */ -#if defined(STM32F4) || defined(STM32F4xx) +#if defined(STM32GENERIC) && (defined(STM32F4) || defined(STM32F4xx)) #include "../../inc/MarlinConfig.h" @@ -46,9 +46,9 @@ //Error_Handler(); } else { - #if PIN_EXISTS(LED) - TOGGLE(LED_PIN); // heart beat indicator - #endif + #if PIN_EXISTS(LED) + TOGGLE(LED_PIN); // heartbeat indicator + #endif } } diff --git a/Marlin/src/HAL/HAL_STM32F4/watchdog_STM32F4.h b/Marlin/src/HAL/HAL_STM32F4/watchdog_STM32F4.h index 89295a78e1..cff0cf469b 100644 --- a/Marlin/src/HAL/HAL_STM32F4/watchdog_STM32F4.h +++ b/Marlin/src/HAL/HAL_STM32F4/watchdog_STM32F4.h @@ -19,15 +19,9 @@ * along with this program. If not, see . * */ - -#ifndef WATCHDOG_STM32F4_H -#define WATCHDOG_STM32F4_H - -#include "../../inc/MarlinConfig.h" +#pragma once extern IWDG_HandleTypeDef hiwdg; void watchdog_init(); void watchdog_reset(); - -#endif // WATCHDOG_STM32F1_H diff --git a/Marlin/src/HAL/HAL_STM32F7/EEPROM_Emul/eeprom_emul.cpp b/Marlin/src/HAL/HAL_STM32F7/EEPROM_Emul/eeprom_emul.cpp index d28577758c..10b3219e9a 100644 --- a/Marlin/src/HAL/HAL_STM32F7/EEPROM_Emul/eeprom_emul.cpp +++ b/Marlin/src/HAL/HAL_STM32F7/EEPROM_Emul/eeprom_emul.cpp @@ -103,12 +103,10 @@ uint16_t EE_Initialize(void) { case ERASED: if (PageStatus1 == VALID_PAGE) { /* Page0 erased, Page1 valid */ /* Erase Page0 */ - if(!EE_VerifyPageFullyErased(PAGE0_BASE_ADDRESS)) { + if (!EE_VerifyPageFullyErased(PAGE0_BASE_ADDRESS)) { FlashStatus = HAL_FLASHEx_Erase(&pEraseInit, &SectorError); /* If erase operation was failed, a Flash error code is returned */ - if (FlashStatus != HAL_OK) { - return FlashStatus; - } + if (FlashStatus != HAL_OK) return FlashStatus; } } else if (PageStatus1 == RECEIVE_DATA) { /* Page0 erased, Page1 receive */ diff --git a/Marlin/src/HAL/HAL_STM32F7/EEPROM_Emul/eeprom_emul.h b/Marlin/src/HAL/HAL_STM32F7/EEPROM_Emul/eeprom_emul.h index 8a45608ed9..441ff1bae1 100644 --- a/Marlin/src/HAL/HAL_STM32F7/EEPROM_Emul/eeprom_emul.h +++ b/Marlin/src/HAL/HAL_STM32F7/EEPROM_Emul/eeprom_emul.h @@ -45,10 +45,7 @@ * ****************************************************************************** */ - -/* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef __EEEPROM_EMUL_H -#define __EEEPROM_EMUL_H +#pragma once // -------------------------------------------------------------------------- // Includes @@ -113,6 +110,4 @@ uint16_t EE_Initialize(void); uint16_t EE_ReadVariable(uint16_t VirtAddress, uint16_t* Data); uint16_t EE_WriteVariable(uint16_t VirtAddress, uint16_t Data); -#endif /* __EEEPROM_H */ - /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/Marlin/src/HAL/HAL_STM32F7/EmulatedEeprom.cpp b/Marlin/src/HAL/HAL_STM32F7/EmulatedEeprom.cpp index 0a7f5193f0..1da5fb486b 100644 --- a/Marlin/src/HAL/HAL_STM32F7/EmulatedEeprom.cpp +++ b/Marlin/src/HAL/HAL_STM32F7/EmulatedEeprom.cpp @@ -94,7 +94,7 @@ void eeprom_init() { } } -void eeprom_write_byte(unsigned char *pos, unsigned char value) { +void eeprom_write_byte(uint8_t *pos, unsigned char value) { uint16_t eeprom_address = (unsigned) pos; eeprom_init(); @@ -108,7 +108,7 @@ void eeprom_write_byte(unsigned char *pos, unsigned char value) { HAL_FLASH_Lock(); } -unsigned char eeprom_read_byte(unsigned char *pos) { +uint8_t eeprom_read_byte(uint8_t *pos) { uint16_t data = 0xFF; uint16_t eeprom_address = (unsigned)pos; @@ -137,4 +137,3 @@ void eeprom_update_block(const void *__src, void *__dst, size_t __n) { } #endif // STM32F7 - diff --git a/Marlin/src/HAL/HAL_STM32F7/HAL.cpp b/Marlin/src/HAL/HAL_STM32F7/HAL.cpp index a5c4f39429..87d3a5f30a 100644 --- a/Marlin/src/HAL/HAL_STM32F7/HAL.cpp +++ b/Marlin/src/HAL/HAL_STM32F7/HAL.cpp @@ -21,7 +21,6 @@ * */ - #ifdef STM32F7 // -------------------------------------------------------------------------- diff --git a/Marlin/src/HAL/HAL_STM32F7/HAL.h b/Marlin/src/HAL/HAL_STM32F7/HAL.h index 2eb8f89b79..060e2584a2 100644 --- a/Marlin/src/HAL/HAL_STM32F7/HAL.h +++ b/Marlin/src/HAL/HAL_STM32F7/HAL.h @@ -20,12 +20,9 @@ * along with this program. If not, see . * */ - -#ifndef _HAL_STM32F7_H -#define _HAL_STM32F7_H +#pragma once #define CPU_32_BIT -#undef DEBUG_NONE #ifndef vsnprintf_P #define vsnprintf_P vsnprintf @@ -153,8 +150,6 @@ extern uint16_t HAL_adc_result; // Public functions // -------------------------------------------------------------------------- - - // Memory related #define __bss_end __bss_end__ @@ -200,8 +195,8 @@ uint8_t spiRec(uint32_t chan); * TODO: Write all this eeprom stuff. Can emulate eeprom in flash as last resort. * Wire library should work for i2c eeproms. */ -void eeprom_write_byte(unsigned char *pos, unsigned char value); -unsigned char eeprom_read_byte(unsigned char *pos); +void eeprom_write_byte(uint8_t *pos, unsigned char value); +uint8_t eeprom_read_byte(uint8_t *pos); void eeprom_read_block (void *__dst, const void *__src, size_t __n); void eeprom_update_block (const void *__src, void *__dst, size_t __n); @@ -236,5 +231,3 @@ void HAL_enable_AdcFreerun(void); #define GET_PIN_MAP_PIN(index) index #define GET_PIN_MAP_INDEX(pin) pin #define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval) - -#endif // _HAL_STM32F7_H diff --git a/Marlin/src/HAL/HAL_STM32F7/HAL_Servo_STM32F7.h b/Marlin/src/HAL/HAL_STM32F7/HAL_Servo_STM32F7.h index 14ba0528b0..f3a776365f 100644 --- a/Marlin/src/HAL/HAL_STM32F7/HAL_Servo_STM32F7.h +++ b/Marlin/src/HAL/HAL_STM32F7/HAL_Servo_STM32F7.h @@ -20,9 +20,7 @@ * along with this program. If not, see . * */ - -#ifndef HAL_SERVO_STM32F7_H -#define HAL_SERVO_STM32F7_H +#pragma once #include <../../libraries/Servo/src/Servo.h> @@ -37,5 +35,3 @@ private: uint16_t max_ticks; uint8_t servoIndex; // index into the channel data for this servo }; - -#endif // HAL_SERVO_STM32F7_H diff --git a/Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.cpp b/Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.cpp index 3d48f5c291..7949af0c55 100644 --- a/Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.cpp +++ b/Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.cpp @@ -85,8 +85,8 @@ void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) { timerConfig[0].IRQ_Id = TIM5_IRQn; timerConfig[0].callback = (uint32_t)TC5_Handler; HAL_NVIC_SetPriority(timerConfig[0].IRQ_Id, 1, 0); - pinMode(STEPPER_ENABLE_PIN,OUTPUT); - digitalWrite(STEPPER_ENABLE_PIN,LOW); + SET_OUTPUT(STEPPER_ENABLE_PIN); + WRITE(STEPPER_ENABLE_PIN); break; case TEMP_TIMER_NUM: //TEMP TIMER TIM7 // any available 16bit Timer (1 already used for PWM) diff --git a/Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.h b/Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.h index 92f0215fce..b5f8cb24bc 100644 --- a/Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.h +++ b/Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.h @@ -19,9 +19,7 @@ * along with this program. If not, see . * */ - -#ifndef _HAL_TIMERS_STM32F7_H -#define _HAL_TIMERS_STM32F7_H +#pragma once // -------------------------------------------------------------------------- // Includes @@ -101,5 +99,3 @@ hal_timer_t HAL_timer_get_compare(const uint8_t timer_num); uint32_t HAL_timer_get_count(const uint8_t timer_num); void HAL_timer_isr_prologue(const uint8_t timer_num); #define HAL_timer_isr_epilogue(TIMER_NUM) - -#endif // _HAL_TIMERS_STM32F7_H diff --git a/Marlin/src/HAL/HAL_STM32F7/TMC2660.cpp b/Marlin/src/HAL/HAL_STM32F7/TMC2660.cpp index 8b2c0900e5..e01a0b42ed 100644 --- a/Marlin/src/HAL/HAL_STM32F7/TMC2660.cpp +++ b/Marlin/src/HAL/HAL_STM32F7/TMC2660.cpp @@ -94,7 +94,7 @@ #define STALL_GUARD_CONFIG_PATTERN 0x17F00ul #define STALL_GUARD_VALUE_PATTERN 0x7F00ul -//definitions for the input from the TCM260 +//definitions for the input from the TMC2660 #define STATUS_STALL_GUARD_STATUS 0x1ul #define STATUS_OVER_TEMPERATURE_SHUTDOWN 0x2ul #define STATUS_OVER_TEMPERATURE_WARNING 0x4ul @@ -190,7 +190,7 @@ void TMC26XStepper::start() { pinMode(step_pin, OUTPUT); pinMode(dir_pin, OUTPUT); pinMode(cs_pin, OUTPUT); - //pinMode(STEPPER_ENABLE_PIN, OUTPUT); + //SET_OUTPUT(STEPPER_ENABLE_PIN); digitalWrite(step_pin, LOW); digitalWrite(dir_pin, LOW); digitalWrite(cs_pin, HIGH); @@ -887,7 +887,7 @@ inline void TMC26XStepper::send262(uint32_t datagram) { //} //select the TMC driver - digitalWrite(cs_pin,LOW); + digitalWrite(cs_pin, LOW); //ensure that only valid bist are set (0-19) //datagram &=REGISTER_BIT_PATTERN; @@ -916,7 +916,7 @@ inline void TMC26XStepper::send262(uint32_t datagram) { #endif //deselect the TMC chip - digitalWrite(cs_pin,HIGH); + digitalWrite(cs_pin, HIGH); //restore the previous SPI mode if neccessary //if the mode is not correct set it to mode 3 diff --git a/Marlin/src/HAL/HAL_STM32F7/TMC2660.h b/Marlin/src/HAL/HAL_STM32F7/TMC2660.h index 095a73f1ac..9a26b32048 100644 --- a/Marlin/src/HAL/HAL_STM32F7/TMC2660.h +++ b/Marlin/src/HAL/HAL_STM32F7/TMC2660.h @@ -24,23 +24,20 @@ * THE SOFTWARE. * */ +#pragma once -#include "../../inc/MarlinConfig.h" - -// ensure this library description is only included once -#ifndef _TMC26XSTEPPER_H_ -#define _TMC26XSTEPPER_H_ +#include //! return value for TMC26XStepper.getOverTemperature() if there is a overtemperature situation in the TMC chip /*! - * This warning indicates that the TCM chip is too warm. + * This warning indicates that the TMC chip is too warm. * It is still working but some parameters may be inferior. * You should do something against it. */ #define TMC26X_OVERTEMPERATURE_PREWARING 1 //! return value for TMC26XStepper.getOverTemperature() if there is a overtemperature shutdown in the TMC chip /*! - * This warning indicates that the TCM chip is too warm to operate and has shut down to prevent damage. + * This warning indicates that the TMC chip is too warm to operate and has shut down to prevent damage. * It will stop working until it cools down again. * If you encouter this situation you must do something against it. Like reducing the current or improving the PCB layout * and/or heat management. @@ -115,7 +112,7 @@ class TMC26XStepper { * * Keep in mind that you must also call TMC26XStepper.start() in order to configure the stepper driver for use. * - * By default the Constant Off Time chopper is used, see TCM262Stepper.setConstantOffTimeChopper() for details. + * By default the Constant Off Time chopper is used, see TMC26XStepper.setConstantOffTimeChopper() for details. * This should work on most motors (YMMV). You may want to configure and use the Spread Cycle Chopper, see setSpreadCycleChopper(). * * By default a microstepping of 1/32th is used to provide a smooth motor run, while still giving a good progression per step. @@ -601,5 +598,3 @@ class TMC26XStepper { // SPI sender inline void send262(uint32_t datagram); }; - -#endif // _TMC26XSTEPPER_H_ diff --git a/Marlin/src/HAL/HAL_STM32F7/endstop_interrupts.h b/Marlin/src/HAL/HAL_STM32F7/endstop_interrupts.h index c96d713db4..e4a243b43e 100644 --- a/Marlin/src/HAL/HAL_STM32F7/endstop_interrupts.h +++ b/Marlin/src/HAL/HAL_STM32F7/endstop_interrupts.h @@ -20,11 +20,7 @@ * along with this program. If not, see . * */ - - - -#ifndef _ENDSTOP_INTERRUPTS_H_ -#define _ENDSTOP_INTERRUPTS_H_ +#pragma once #include "../../module/endstops.h" @@ -66,5 +62,3 @@ void setup_endstop_interrupts(void) { attachInterrupt(Z_MIN_PROBE_PIN, endstop_ISR, CHANGE); #endif } - -#endif //_ENDSTOP_INTERRUPTS_H_ diff --git a/Marlin/src/HAL/HAL_STM32F7/fastio_STM32F7.h b/Marlin/src/HAL/HAL_STM32F7/fastio_STM32F7.h index 2d82530b89..08f244c791 100644 --- a/Marlin/src/HAL/HAL_STM32F7/fastio_STM32F7.h +++ b/Marlin/src/HAL/HAL_STM32F7/fastio_STM32F7.h @@ -20,15 +20,13 @@ * along with this program. If not, see . * */ +#pragma once /** * Fast I/O interfaces for STM32F7 * These use GPIO functions instead of Direct Port Manipulation, as on AVR. */ -#ifndef _FASTIO_STM32F7_H -#define _FASTIO_STM32F7_H - #define _BV(b) (1 << (b)) #define READ(IO) digitalRead(IO) @@ -52,6 +50,12 @@ #define GET_OUTPUT(IO) #define GET_TIMER(IO) +#define PWM_PIN(p) true +#define USEABLE_HARDWARE_PWM(p) PWM_PIN(p) + +// +// Pins Definitions +// #define PORTA 0 #define PORTB 1 #define PORTC 2 @@ -180,5 +184,3 @@ #define PG13 _STM32_PIN(G, 13) #define PG14 _STM32_PIN(G, 14) #define PG15 _STM32_PIN(G, 15) - -#endif // _FASTIO_STM32F7_H diff --git a/Marlin/src/HAL/HAL_STM32F7/persistent_store_eeprom.cpp b/Marlin/src/HAL/HAL_STM32F7/persistent_store_eeprom.cpp index bd08ad7f0b..50bf09a9a3 100644 --- a/Marlin/src/HAL/HAL_STM32F7/persistent_store_eeprom.cpp +++ b/Marlin/src/HAL/HAL_STM32F7/persistent_store_eeprom.cpp @@ -55,7 +55,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc) { do { - uint8_t c = eeprom_read_byte((unsigned char*)pos); + uint8_t c = eeprom_read_byte((uint8_t*)pos); *value = c; crc16(crc, &c, 1); pos++; diff --git a/Marlin/src/HAL/HAL_STM32F7/spi_pins.h b/Marlin/src/HAL/HAL_STM32F7/spi_pins.h index 2d1e96ec59..9301f4dd8c 100644 --- a/Marlin/src/HAL/HAL_STM32F7/spi_pins.h +++ b/Marlin/src/HAL/HAL_STM32F7/spi_pins.h @@ -1,32 +1,27 @@ /** -* Marlin 3D Printer Firmware -* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] -* -* 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 . -* -*/ - -#ifndef SPI_PINS_H_ -#define SPI_PINS_H_ + * Marlin 3D Printer Firmware + * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * 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 /** * Define SPI Pins: SCK, MISO, MOSI, SS - * */ #define SCK_PIN PA5 #define MISO_PIN PA6 #define MOSI_PIN PA7 #define SS_PIN PA8 - -#endif // SPI_PINS_H_ diff --git a/Marlin/src/HAL/HAL_STM32F7/watchdog_STM32F7.h b/Marlin/src/HAL/HAL_STM32F7/watchdog_STM32F7.h index 977f0f9b7e..cff0cf469b 100644 --- a/Marlin/src/HAL/HAL_STM32F7/watchdog_STM32F7.h +++ b/Marlin/src/HAL/HAL_STM32F7/watchdog_STM32F7.h @@ -19,15 +19,9 @@ * along with this program. If not, see . * */ - -#ifndef WATCHDOG_STM32F7_H -#define WATCHDOG_STM32F7_H - -#include "../../inc/MarlinConfig.h" +#pragma once extern IWDG_HandleTypeDef hiwdg; void watchdog_init(); void watchdog_reset(); - -#endif // WATCHDOG_STM32F1_H diff --git a/Marlin/src/HAL/HAL_TEENSY31_32/HAL.cpp b/Marlin/src/HAL/HAL_TEENSY31_32/HAL.cpp index fa5cdd8d1a..db757b17ef 100644 --- a/Marlin/src/HAL/HAL_TEENSY31_32/HAL.cpp +++ b/Marlin/src/HAL/HAL_TEENSY31_32/HAL.cpp @@ -26,7 +26,7 @@ #ifdef __MK20DX256__ #include "HAL.h" -#include "../Delay.h" +#include "../shared/Delay.h" #include diff --git a/Marlin/src/HAL/HAL_TEENSY31_32/HAL_spi_Teensy.cpp b/Marlin/src/HAL/HAL_TEENSY31_32/HAL_spi_Teensy.cpp index 4c57f02436..ab7176aee6 100644 --- a/Marlin/src/HAL/HAL_TEENSY31_32/HAL_spi_Teensy.cpp +++ b/Marlin/src/HAL/HAL_TEENSY31_32/HAL_spi_Teensy.cpp @@ -33,7 +33,7 @@ static SPISettings spiConfig; * Standard SPI functions */ -// Initialise SPI bus +// Initialize SPI bus void spiBegin(void) { #if !PIN_EXISTS(SS) #error "SS_PIN not defined!" diff --git a/Marlin/src/HAL/HAL_TEENSY31_32/persistent_store_impl.cpp b/Marlin/src/HAL/HAL_TEENSY31_32/persistent_store_impl.cpp index ac59212300..71908bc1cd 100644 --- a/Marlin/src/HAL/HAL_TEENSY31_32/persistent_store_impl.cpp +++ b/Marlin/src/HAL/HAL_TEENSY31_32/persistent_store_impl.cpp @@ -35,7 +35,7 @@ bool write_data(int &pos, const uint8_t *value, uint16_t size, uint16_t *crc) { bool read_data(int &pos, uint8_t* value, uint16_t size, uint16_t *crc, const bool writing/*=true*/) { do { - uint8_t c = eeprom_read_byte((unsigned char*)pos); + uint8_t c = eeprom_read_byte((uint8_t*)pos); if (writing) *value = c; crc16(crc, &c, 1); pos++; diff --git a/Marlin/src/HAL/HAL_TEENSY35_36/HAL.cpp b/Marlin/src/HAL/HAL_TEENSY35_36/HAL.cpp index 4f7f67a3bb..dba27279ae 100644 --- a/Marlin/src/HAL/HAL_TEENSY35_36/HAL.cpp +++ b/Marlin/src/HAL/HAL_TEENSY35_36/HAL.cpp @@ -18,7 +18,6 @@ along with this program. If not, see . ****************************************************************************/ - /** * Description: HAL for Teensy35 (MK64FX512) */ @@ -30,7 +29,7 @@ #include -uint16_t HAL_adc_result; +uint16_t HAL_adc_result, HAL_adc_select; static const uint8_t pin2sc1a[] = { 5, 14, 8, 9, 13, 12, 6, 7, 15, 4, 3, 19+128, 14+128, 15+128, // 0-13 -> A0-A13 @@ -59,6 +58,7 @@ static const uint8_t pin2sc1a[] = { void HAL_adc_init() { analog_init(); while (ADC0_SC3 & ADC_SC3_CAL) {}; // Wait for calibration to finish + while (ADC1_SC3 & ADC_SC3_CAL) {}; // Wait for calibration to finish NVIC_ENABLE_IRQ(IRQ_FTM1); } @@ -91,8 +91,28 @@ extern "C" { } } -void HAL_adc_start_conversion(const uint8_t adc_pin) { ADC0_SC1A = pin2sc1a[adc_pin]; } +void HAL_adc_start_conversion(const uint8_t adc_pin) { + uint16_t pin = pin2sc1a[adc_pin]; + if (pin == 0xFF) { + // Digital only + HAL_adc_select = -1; + } + else if (pin & 0x80) { + HAL_adc_select = 1; + ADC1_SC1A = pin & 0x7F; + } + else { + HAL_adc_select = 0; + ADC0_SC1A = pin; + } +} -uint16_t HAL_adc_get_result(void) { return ADC0_RA; } +uint16_t HAL_adc_get_result(void) { + switch (HAL_adc_select) { + case 0: return ADC0_RA; + case 1: return ADC1_RA; + } + return 0; +} #endif // __MK64FX512__ || __MK66FX1M0__ diff --git a/Marlin/src/HAL/HAL_TEENSY35_36/HAL.h b/Marlin/src/HAL/HAL_TEENSY35_36/HAL.h index b60a5d28ad..4cbf8bfec9 100644 --- a/Marlin/src/HAL/HAL_TEENSY35_36/HAL.h +++ b/Marlin/src/HAL/HAL_TEENSY35_36/HAL.h @@ -19,14 +19,12 @@ * along with this program. If not, see . * */ +#pragma once /** * Description: HAL for Teensy 3.5 and Teensy 3.6 */ -#ifndef _HAL_TEENSY_H -#define _HAL_TEENSY_H - #define CPU_32_BIT // -------------------------------------------------------------------------- @@ -167,9 +165,3 @@ uint16_t HAL_adc_get_result(void); #define GET_PIN_MAP_PIN(index) index #define GET_PIN_MAP_INDEX(pin) pin #define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval) - -// -------------------------------------------------------------------------- -// -// -------------------------------------------------------------------------- - -#endif // _HAL_TEENSY_H diff --git a/Marlin/src/HAL/HAL_TEENSY35_36/HAL_Servo_Teensy.h b/Marlin/src/HAL/HAL_TEENSY35_36/HAL_Servo_Teensy.h index 78b2092051..e53b5c6796 100644 --- a/Marlin/src/HAL/HAL_TEENSY35_36/HAL_Servo_Teensy.h +++ b/Marlin/src/HAL/HAL_TEENSY35_36/HAL_Servo_Teensy.h @@ -1,5 +1,25 @@ -#ifndef _HAL_SERVO_TEENSY_H_ -#define _HAL_SERVO_TEENSY_H_ +/** + * 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 . + * + */ +#pragma once #include @@ -14,5 +34,3 @@ class libServo : public Servo { uint16_t max_ticks; uint8_t servoIndex; // index into the channel data for this servo }; - -#endif // _HAL_SERVO_TEENSY_H_ diff --git a/Marlin/src/HAL/HAL_TEENSY35_36/HAL_timers_Teensy.h b/Marlin/src/HAL/HAL_TEENSY35_36/HAL_timers_Teensy.h index b44c310156..29b157c156 100644 --- a/Marlin/src/HAL/HAL_TEENSY35_36/HAL_timers_Teensy.h +++ b/Marlin/src/HAL/HAL_TEENSY35_36/HAL_timers_Teensy.h @@ -1,23 +1,23 @@ -/* ************************************************************************** - - Marlin 3D Printer Firmware - Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com - Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com - - 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 . -****************************************************************************/ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com + * Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com + * + * 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 /** * Description: HAL for @@ -25,9 +25,6 @@ * Teensy3.6 (__MK66FX1M0__) */ -#ifndef _HAL_TIMERS_TEENSY_H -#define _HAL_TIMERS_TEENSY_H - // -------------------------------------------------------------------------- // Includes // -------------------------------------------------------------------------- @@ -108,5 +105,3 @@ bool HAL_timer_interrupt_enabled(const uint8_t timer_num); void HAL_timer_isr_prologue(const uint8_t timer_num); #define HAL_timer_isr_epilogue(TIMER_NUM) - -#endif // _HAL_TIMERS_TEENSY_H diff --git a/Marlin/src/HAL/HAL_TEENSY35_36/endstop_interrupts.h b/Marlin/src/HAL/HAL_TEENSY35_36/endstop_interrupts.h index d3f9d102bc..79a19fdbea 100644 --- a/Marlin/src/HAL/HAL_TEENSY35_36/endstop_interrupts.h +++ b/Marlin/src/HAL/HAL_TEENSY35_36/endstop_interrupts.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Endstop Interrupts @@ -34,9 +35,6 @@ * (Located in Marlin/buildroot/share/pin_interrupt_test/pin_interrupt_test.ino) */ -#ifndef _ENDSTOP_INTERRUPTS_H_ -#define _ENDSTOP_INTERRUPTS_H_ - #include "../../module/endstops.h" // One ISR for all EXT-Interrupts @@ -81,5 +79,3 @@ void setup_endstop_interrupts( void ) { attachInterrupt(digitalPinToInterrupt(Z_MIN_PROBE_PIN), endstop_ISR, CHANGE); #endif } - -#endif //_ENDSTOP_INTERRUPTS_H_ diff --git a/Marlin/src/HAL/HAL_TEENSY35_36/fastio_Teensy.h b/Marlin/src/HAL/HAL_TEENSY35_36/fastio_Teensy.h index 4d31310d8d..43a4c5a786 100644 --- a/Marlin/src/HAL/HAL_TEENSY35_36/fastio_Teensy.h +++ b/Marlin/src/HAL/HAL_TEENSY35_36/fastio_Teensy.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Fast I/O Routines for Teensy 3.5 and Teensy 3.6 @@ -26,9 +27,6 @@ * Contributed by Triffid_Hunter and modified by Kliment, thinkyhead, Bob-the-Kuhn, et.al. */ -#ifndef _FASTIO_TEENSY_H -#define _FASTIO_TEENSY_H - #ifndef MASK #define MASK(PIN) (1 << PIN) #endif @@ -91,5 +89,3 @@ */ #define DIO0_PIN 8 - -#endif /* _FASTIO_TEENSY_H */ diff --git a/Marlin/src/HAL/HAL_TEENSY35_36/persistent_store_eeprom.cpp b/Marlin/src/HAL/HAL_TEENSY35_36/persistent_store_eeprom.cpp index 46e88e04a5..7a1fa0e44c 100644 --- a/Marlin/src/HAL/HAL_TEENSY35_36/persistent_store_eeprom.cpp +++ b/Marlin/src/HAL/HAL_TEENSY35_36/persistent_store_eeprom.cpp @@ -56,7 +56,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) { do { - uint8_t c = eeprom_read_byte((unsigned char*)pos); + uint8_t c = eeprom_read_byte((uint8_t*)pos); if (writing) *value = c; crc16(crc, &c, 1); pos++; diff --git a/Marlin/src/HAL/HAL_TEENSY35_36/persistent_store_impl.cpp b/Marlin/src/HAL/HAL_TEENSY35_36/persistent_store_impl.cpp index 009cdaa504..c0c9dc2684 100644 --- a/Marlin/src/HAL/HAL_TEENSY35_36/persistent_store_impl.cpp +++ b/Marlin/src/HAL/HAL_TEENSY35_36/persistent_store_impl.cpp @@ -35,7 +35,7 @@ bool write_data(int &pos, const uint8_t *value, uint16_t size, uint16_t *crc) { bool read_data(int &pos, uint8_t* value, uint16_t size, uint16_t *crc, const bool writing/*=true*/) { do { - uint8_t c = eeprom_read_byte((unsigned char*)pos); + uint8_t c = eeprom_read_byte((uint8_t*)pos); if (writing) *value = c; crc16(crc, &c, 1); pos++; diff --git a/Marlin/src/HAL/HAL_TEENSY35_36/pinsDebug.h b/Marlin/src/HAL/HAL_TEENSY35_36/pinsDebug.h index f94f55c1d2..2d41821700 100644 --- a/Marlin/src/HAL/HAL_TEENSY35_36/pinsDebug.h +++ b/Marlin/src/HAL/HAL_TEENSY35_36/pinsDebug.h @@ -45,7 +45,7 @@ #define FTM3_CH5_PIN 36 #define FTM3_CH6_PIN 37 #define FTM3_CH7_PIN 38 -#if defined(__MK66FX1M0__) // Teensy3.6 +#ifdef __MK66FX1M0__ // Teensy3.6 #define TPM1_CH0_PIN 16 #define TPM1_CH1_PIN 17 #endif diff --git a/Marlin/src/HAL/HAL_TEENSY35_36/spi_pins.h b/Marlin/src/HAL/HAL_TEENSY35_36/spi_pins.h index ecbc690e4d..fb4cbc140b 100644 --- a/Marlin/src/HAL/HAL_TEENSY35_36/spi_pins.h +++ b/Marlin/src/HAL/HAL_TEENSY35_36/spi_pins.h @@ -19,13 +19,9 @@ * along with this program. If not, see . * */ - -#ifndef SPI_PINS_H_ -#define SPI_PINS_H_ +#pragma once #define SCK_PIN 13 #define MISO_PIN 12 #define MOSI_PIN 11 -#define SS_PIN 20 //SDSS // A.28, A.29, B.21, C.26, C.29 - -#endif /* SPI_PINS_H_ */ +#define SS_PIN 20 // SDSS // A.28, A.29, B.21, C.26, C.29 diff --git a/Marlin/src/HAL/HAL_TEENSY35_36/watchdog_Teensy.h b/Marlin/src/HAL/HAL_TEENSY35_36/watchdog_Teensy.h index ca05dd225a..69c422e160 100644 --- a/Marlin/src/HAL/HAL_TEENSY35_36/watchdog_Teensy.h +++ b/Marlin/src/HAL/HAL_TEENSY35_36/watchdog_Teensy.h @@ -19,13 +19,7 @@ * along with this program. If not, see . * */ - -#ifndef WATCHDOG_TEENSY_H -#define WATCHDOG_TEENSY_H - -#include "HAL.h" - -// Arduino Due core now has watchdog support +#pragma once void watchdog_init(); @@ -34,5 +28,3 @@ inline void watchdog_reset() { WDOG_REFRESH = 0xA602; WDOG_REFRESH = 0xB480; } - -#endif // WATCHDOG_TEENSY_H diff --git a/Marlin/src/HAL/platforms.h b/Marlin/src/HAL/platforms.h index 49efe490d7..c1e0e9f8e6 100644 --- a/Marlin/src/HAL/platforms.h +++ b/Marlin/src/HAL/platforms.h @@ -1,7 +1,25 @@ -#ifndef _HAL_PLATFORMS_H_ -#define _HAL_PLATFORMS_H_ - -#ifndef HAL_PLATFORM +/** + * 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 . + * + */ +#pragma once #ifdef __AVR__ #define HAL_PLATFORM HAL_AVR @@ -15,20 +33,18 @@ #define HAL_PLATFORM HAL_LPC1768 #elif defined(__STM32F1__) || defined(TARGET_STM32F1) #define HAL_PLATFORM HAL_STM32F1 -#elif defined(STM32F4) || defined(STM32F4xx) +#elif defined(STM32GENERIC) && defined(STM32F4) #define HAL_PLATFORM HAL_STM32F4 -#elif defined(STM32F7) +#elif defined(STM32GENERIC) && defined(STM32F7) #define HAL_PLATFORM HAL_STM32F7 +#elif defined(ARDUINO_ARCH_STM32) + #define HAL_PLATFORM HAL_STM32 #elif defined(ARDUINO_ARCH_ESP32) #define HAL_PLATFORM HAL_ESP32 #else #error "Unsupported Platform!" #endif -#endif // HAL_PLATFORM - #define XSTR_(M) #M #define XSTR(M) XSTR_(M) #define HAL_PATH(PATH, NAME) XSTR(PATH/HAL_PLATFORM/NAME) - -#endif // _HAL_PLATFORMS_H_ diff --git a/Marlin/src/HAL/shared/Delay.h b/Marlin/src/HAL/shared/Delay.h index 04771a2e03..9e25cbd511 100644 --- a/Marlin/src/HAL/shared/Delay.h +++ b/Marlin/src/HAL/shared/Delay.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Busy wait delay cycles routines: @@ -28,57 +29,81 @@ * DELAY_US(count): Delay execution in microseconds */ -#ifndef MARLIN_DELAY_H -#define MARLIN_DELAY_H - #include "../../core/macros.h" +#include "../../core/millis_t.h" #if defined(__arm__) || defined(__thumb__) - // https://blueprints.launchpad.net/gcc-arm-embedded/+spec/delay-cycles + #if __CORTEX_M == 7 - #define nop() __asm__ __volatile__("nop;\n\t":::) + // Cortex-M7 can use the cycle counter of the DWT unit + // http://www.anthonyvh.com/2017/05/18/cortex_m-cycle_counter/ - FORCE_INLINE static void __delay_4cycles(uint32_t cy) { // +1 cycle - #if ARCH_PIPELINE_RELOAD_CYCLES < 2 - #define EXTRA_NOP_CYCLES A("nop") - #else - #define EXTRA_NOP_CYCLES "" - #endif + FORCE_INLINE static void enableCycleCounter() { + CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk; - __asm__ __volatile__( - A(".syntax unified") // is to prevent CM0,CM1 non-unified syntax - L("1") - A("subs %[cnt],#1") - EXTRA_NOP_CYCLES - A("bne 1b") - : [cnt]"+r"(cy) // output: +r means input+output - : // input: - : "cc" // clobbers: - ); - } + // Unlock DWT. + DWT->LAR = 0xC5ACCE55; - // Delay in cycles - FORCE_INLINE static void DELAY_CYCLES(uint32_t x) { - - if (__builtin_constant_p(x)) { - #define MAXNOPS 4 - - if (x <= (MAXNOPS)) { - switch (x) { case 4: nop(); case 3: nop(); case 2: nop(); case 1: nop(); } - } - else { // because of +1 cycle inside delay_4cycles - const uint32_t rem = (x - 1) % (MAXNOPS); - switch (rem) { case 3: nop(); case 2: nop(); case 1: nop(); } - if ((x = (x - 1) / (MAXNOPS))) - __delay_4cycles(x); // if need more then 4 nop loop is more optimal - } - #undef MAXNOPS + DWT->CYCCNT = 0; + DWT->CTRL |= DWT_CTRL_CYCCNTENA_Msk; } - else if ((x >>= 2)) - __delay_4cycles(x); - } - #undef nop + + FORCE_INLINE volatile uint32_t getCycleCount() { return DWT->CYCCNT; } + + FORCE_INLINE static void DELAY_CYCLES(const uint32_t x) { + const uint32_t endCycles = getCycleCount() + x; + while (PENDING(getCycleCount(), endCycles)) { } + } + + #else + + // https://blueprints.launchpad.net/gcc-arm-embedded/+spec/delay-cycles + + #define nop() __asm__ __volatile__("nop;\n\t":::) + + FORCE_INLINE static void __delay_4cycles(uint32_t cy) { // +1 cycle + #if ARCH_PIPELINE_RELOAD_CYCLES < 2 + #define EXTRA_NOP_CYCLES A("nop") + #else + #define EXTRA_NOP_CYCLES "" + #endif + + __asm__ __volatile__( + A(".syntax unified") // is to prevent CM0,CM1 non-unified syntax + L("1") + A("subs %[cnt],#1") + EXTRA_NOP_CYCLES + A("bne 1b") + : [cnt]"+r"(cy) // output: +r means input+output + : // input: + : "cc" // clobbers: + ); + } + + // Delay in cycles + FORCE_INLINE static void DELAY_CYCLES(uint32_t x) { + + if (__builtin_constant_p(x)) { + #define MAXNOPS 4 + + if (x <= (MAXNOPS)) { + switch (x) { case 4: nop(); case 3: nop(); case 2: nop(); case 1: nop(); } + } + else { // because of +1 cycle inside delay_4cycles + const uint32_t rem = (x - 1) % (MAXNOPS); + switch (rem) { case 3: nop(); case 2: nop(); case 1: nop(); } + if ((x = (x - 1) / (MAXNOPS))) + __delay_4cycles(x); // if need more then 4 nop loop is more optimal + } + #undef MAXNOPS + } + else if ((x >>= 2)) + __delay_4cycles(x); + } + #undef nop + + #endif #elif defined(__AVR__) @@ -140,9 +165,7 @@ #endif // Delay in nanoseconds -#define DELAY_NS(x) DELAY_CYCLES( (x) * (F_CPU/1000000L) / 1000L ) +#define DELAY_NS(x) DELAY_CYCLES( (x) * (F_CPU / 1000000UL) / 1000UL ) // Delay in microseconds -#define DELAY_US(x) DELAY_CYCLES( (x) * (F_CPU/1000000L) ) - -#endif // MARLIN_DELAY_H +#define DELAY_US(x) DELAY_CYCLES( (x) * (F_CPU / 1000000UL) ) diff --git a/Marlin/src/HAL/shared/HAL_SPI.h b/Marlin/src/HAL/shared/HAL_SPI.h index 388b9f9cfb..cc2304fc57 100644 --- a/Marlin/src/HAL/shared/HAL_SPI.h +++ b/Marlin/src/HAL/shared/HAL_SPI.h @@ -19,15 +19,13 @@ * along with this program. If not, see . * */ +#pragma once /** * HAL/HAL_SPI.h * Core Marlin definitions for SPI, implemented in the HALs */ -#ifndef _HAL_SPI_H_ -#define _HAL_SPI_H_ - #include /** @@ -78,5 +76,3 @@ void spiRead(uint8_t* buf, uint16_t nbyte); void spiSendBlock(uint8_t token, const uint8_t* buf); /** Begin SPI transaction, set clock, bit order, data mode */ void spiBeginTransaction(uint32_t spiClock, uint8_t bitOrder, uint8_t dataMode); - -#endif // _HAL_SPI_H_ diff --git a/Marlin/src/HAL/shared/I2cEeprom.cpp b/Marlin/src/HAL/shared/I2cEeprom.cpp index a73cefa2d3..02a201c9ef 100644 --- a/Marlin/src/HAL/shared/I2cEeprom.cpp +++ b/Marlin/src/HAL/shared/I2cEeprom.cpp @@ -82,7 +82,7 @@ static void eeprom_init(void) { } } -void eeprom_write_byte(unsigned char *pos, unsigned char value) { +void eeprom_write_byte(uint8_t *pos, unsigned char value) { unsigned eeprom_address = (unsigned) pos; eeprom_init(); @@ -128,8 +128,7 @@ void eeprom_update_block(const void *pos, void* eeprom_address, size_t n) { } -unsigned char eeprom_read_byte(unsigned char *pos) { - byte data = 0xFF; +uint8_t eeprom_read_byte(uint8_t *pos) { unsigned eeprom_address = (unsigned)pos; eeprom_init(); @@ -155,5 +154,4 @@ void eeprom_read_block(void* pos, const void* eeprom_address, size_t n) { if (Wire.available()) *((uint8_t*)pos + c) = Wire.read(); } - -#endif // ENABLED(I2C_EEPROM) +#endif // I2C_EEPROM diff --git a/Marlin/src/HAL/shared/MarlinSerial.h b/Marlin/src/HAL/shared/MarlinSerial.h new file mode 100644 index 0000000000..10d55e92db --- /dev/null +++ b/Marlin/src/HAL/shared/MarlinSerial.h @@ -0,0 +1,60 @@ +/** + * 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 . + * + */ +#pragma once + +/** + * HAL/shared/MarlinSerial.h + */ + +#include "../../inc/MarlinConfigPre.h" + +constexpr bool + bSERIAL_XON_XOFF = (false + #if ENABLED(SERIAL_XON_XOFF) + || true + #endif + ), + bEMERGENCY_PARSER = (false + #if ENABLED(EMERGENCY_PARSER) + || true + #endif + ), + bSERIAL_STATS_DROPPED_RX = (false + #if ENABLED(SERIAL_STATS_DROPPED_RX) + || true + #endif + ), + bSERIAL_STATS_RX_BUFFER_OVERRUNS = (false + #if ENABLED(SERIAL_STATS_RX_BUFFER_OVERRUNS) + || true + #endif + ), + bSERIAL_STATS_RX_FRAMING_ERRORS = (false + #if ENABLED(SERIAL_STATS_RX_FRAMING_ERRORS) + || true + #endif + ), + bSERIAL_STATS_MAX_RX_QUEUED = (false + #if ENABLED(SERIAL_STATS_MAX_RX_QUEUED) + || true + #endif + ); diff --git a/Marlin/src/HAL/shared/backtrace/backtrace.h b/Marlin/src/HAL/shared/backtrace/backtrace.h index c2761b9f5a..37a567189c 100644 --- a/Marlin/src/HAL/shared/backtrace/backtrace.h +++ b/Marlin/src/HAL/shared/backtrace/backtrace.h @@ -19,11 +19,7 @@ * along with this program. If not, see . * */ - -#ifndef _BACKTRACE_H_ -#define _BACKTRACE_H_ +#pragma once // Perform a backtrace to the serial port void backtrace(void); - -#endif \ No newline at end of file diff --git a/Marlin/src/HAL/shared/backtrace/unwarm.cpp b/Marlin/src/HAL/shared/backtrace/unwarm.cpp index 13079817ba..e1740fc248 100644 --- a/Marlin/src/HAL/shared/backtrace/unwarm.cpp +++ b/Marlin/src/HAL/shared/backtrace/unwarm.cpp @@ -23,7 +23,7 @@ #include "unwarm.h" #include "unwarmmem.h" -#if defined(UNW_DEBUG) +#ifdef UNW_DEBUG /** * Printf wrapper. diff --git a/Marlin/src/HAL/shared/backtrace/unwarm.h b/Marlin/src/HAL/shared/backtrace/unwarm.h index 8ecdeba8a5..9594ed95d7 100644 --- a/Marlin/src/HAL/shared/backtrace/unwarm.h +++ b/Marlin/src/HAL/shared/backtrace/unwarm.h @@ -11,8 +11,7 @@ * File Description: Internal interface between the ARM unwinding sub-modules. **************************************************************************/ -#ifndef UNWARM_H -#define UNWARM_H +#pragma once #include "unwinder.h" @@ -107,7 +106,7 @@ typedef struct { #define M_IsOriginValid(v) (((v) & 0x7F) ? true : false) #define M_Origin2Str(v) ((v) ? "VALID" : "INVALID") -#if defined(UNW_DEBUG) +#ifdef UNW_DEBUG #define UnwPrintd1(a) state->cb->printf(a) #define UnwPrintd2(a,b) state->cb->printf(a,b) #define UnwPrintd3(a,b,c) state->cb->printf(a,b,c) @@ -139,5 +138,3 @@ bool UnwReportRetAddr(UnwState * const state, uint32_t addr); bool UnwMemWriteRegister(UnwState * const state, const uint32_t addr, const RegData * const reg); bool UnwMemReadRegister(UnwState * const state, const uint32_t addr, RegData * const reg); void UnwMemHashGC(UnwState * const state); - -#endif // UNWARM_H diff --git a/Marlin/src/HAL/shared/backtrace/unwarm_arm.cpp b/Marlin/src/HAL/shared/backtrace/unwarm_arm.cpp index 09528885f7..be43b22392 100644 --- a/Marlin/src/HAL/shared/backtrace/unwarm_arm.cpp +++ b/Marlin/src/HAL/shared/backtrace/unwarm_arm.cpp @@ -142,7 +142,7 @@ UnwResult UnwStartArm(UnwState * const state) { /* MRS */ else if ((instr & 0xFFBF0FFF) == 0xE10F0000) { -#if defined(UNW_DEBUG) +#ifdef UNW_DEBUG bool R = (instr & 0x00400000) ? true : false; #endif uint8_t rd = (instr & 0x0000F000) >> 12; @@ -154,7 +154,7 @@ UnwResult UnwStartArm(UnwState * const state) { } /* MSR */ else if ((instr & 0xFFB0F000) == 0xE120F000) { -#if defined(UNW_DEBUG) +#ifdef UNW_DEBUG bool R = (instr & 0x00400000) ? true : false; UnwPrintd2("MSR %s_?, ???", R ? "SPSR" : "CPSR"); @@ -172,7 +172,7 @@ UnwResult UnwStartArm(UnwState * const state) { else if (isDataProc(instr)) { bool I = (instr & 0x02000000) ? true : false; uint8_t opcode = (instr & 0x01E00000) >> 21; -#if defined(UNW_DEBUG) +#ifdef UNW_DEBUG bool S = (instr & 0x00100000) ? true : false; #endif uint8_t rn = (instr & 0x000F0000) >> 16; @@ -220,7 +220,7 @@ UnwResult UnwStartArm(UnwState * const state) { uint8_t regShift = (operand2 & 0x0010) ? true : false; uint8_t shiftType = (operand2 & 0x0060) >> 5; uint32_t shiftDist; -#if defined(UNW_DEBUG) +#ifdef UNW_DEBUG const char * const shiftMnu[4] = { "LSL", "LSR", "ASR", "ROR" }; #endif UnwPrintd2("r%d ", rm); @@ -453,7 +453,7 @@ UnwResult UnwStartArm(UnwState * const state) { bool addrValid = M_IsOriginValid(state->regData[baseReg].o); int8_t r; -#if defined(UNW_DEBUG) +#ifdef UNW_DEBUG /* Display the instruction */ if (L) { UnwPrintd6("LDM%c%c r%d%s, {reglist}%s\n", P ? 'E' : 'F', U ? 'D' : 'A', baseReg, W ? "!" : "", S ? "^" : ""); diff --git a/Marlin/src/HAL/shared/backtrace/unwarm_thumb.cpp b/Marlin/src/HAL/shared/backtrace/unwarm_thumb.cpp index a4afbeaf8d..29efb13096 100644 --- a/Marlin/src/HAL/shared/backtrace/unwarm_thumb.cpp +++ b/Marlin/src/HAL/shared/backtrace/unwarm_thumb.cpp @@ -680,7 +680,7 @@ UnwResult UnwStartThumb(UnwState * const state) { uint8_t rs = (instr & 0x0038) >> 3; uint8_t rd = (instr & 0x0007); -#if defined(UNW_DEBUG) +#ifdef UNW_DEBUG static const char * const mnu[16] = { "AND", "EOR", "LSL", "LSR", "ASR", "ADC", "SBC", "ROR", diff --git a/Marlin/src/HAL/shared/backtrace/unwarmbytab.h b/Marlin/src/HAL/shared/backtrace/unwarmbytab.h index 527d3a6c72..77a1c82dbd 100644 --- a/Marlin/src/HAL/shared/backtrace/unwarmbytab.h +++ b/Marlin/src/HAL/shared/backtrace/unwarmbytab.h @@ -12,8 +12,7 @@ * File Description: Interface to the memory tracking sub-system. **************************************************************************/ -#ifndef UNWARMBYTAB_H -#define UNWARMBYTAB_H +#pragma once #include "unwarm.h" @@ -30,5 +29,3 @@ typedef struct { } UnwTabEntry; UnwResult UnwindByTableStart(UnwindFrame* frame, const UnwindCallbacks *cb, void *data); - -#endif // UNWARMBYTAB_H diff --git a/Marlin/src/HAL/shared/backtrace/unwarmmem.cpp b/Marlin/src/HAL/shared/backtrace/unwarmmem.cpp index 7453fdb8db..b836841713 100644 --- a/Marlin/src/HAL/shared/backtrace/unwarmmem.cpp +++ b/Marlin/src/HAL/shared/backtrace/unwarmmem.cpp @@ -90,7 +90,7 @@ bool UnwMemHashWrite(MemData * const memData, uint32_t addr, uint32_t val, bool M_SetIdxUsed(memData->tracked, i); } else { - #if defined(UNW_DEBUG) + #ifdef UNW_DEBUG memData->v[i] = 0xDEADBEEF; #endif M_ClrIdxUsed(memData->tracked, i); diff --git a/Marlin/src/HAL/shared/backtrace/unwarmmem.h b/Marlin/src/HAL/shared/backtrace/unwarmmem.h index f30846b34c..588618b34f 100644 --- a/Marlin/src/HAL/shared/backtrace/unwarmmem.h +++ b/Marlin/src/HAL/shared/backtrace/unwarmmem.h @@ -12,14 +12,10 @@ * File Description: Interface to the memory tracking sub-system. **************************************************************************/ -#ifndef UNWARMMEM_H -#define UNWARMMEM_H +#pragma once #include "unwarm.h" bool UnwMemHashRead(MemData * const memData, uint32_t addr, uint32_t * const data, bool * const tracked); bool UnwMemHashWrite(MemData * const memData, uint32_t addr, uint32_t val, bool valValid); void UnwMemHashGC(UnwState * const state); - -#endif - diff --git a/Marlin/src/HAL/shared/backtrace/unwinder.cpp b/Marlin/src/HAL/shared/backtrace/unwinder.cpp index 9c30016165..7c5af02cdb 100644 --- a/Marlin/src/HAL/shared/backtrace/unwinder.cpp +++ b/Marlin/src/HAL/shared/backtrace/unwinder.cpp @@ -57,5 +57,3 @@ UnwResult UnwindStart(UnwindFrame* frame, const UnwindCallbacks *cb, void *data) } } #endif - - diff --git a/Marlin/src/HAL/shared/backtrace/unwinder.h b/Marlin/src/HAL/shared/backtrace/unwinder.h index 29132d0b5b..604854ad0f 100644 --- a/Marlin/src/HAL/shared/backtrace/unwinder.h +++ b/Marlin/src/HAL/shared/backtrace/unwinder.h @@ -13,8 +13,7 @@ * Interface to the ARM stack unwinding module. **************************************************************************/ -#ifndef UNWINDER_H -#define UNWINDER_H +#pragma once #include @@ -171,5 +170,3 @@ typedef struct { * get function names in the traceback. Otherwise, you will not. */ UnwResult UnwindStart(UnwindFrame* frame, const UnwindCallbacks *cb, void *data); - -#endif /* UNWINDER_H */ diff --git a/Marlin/src/HAL/shared/backtrace/unwmemaccess.cpp b/Marlin/src/HAL/shared/backtrace/unwmemaccess.cpp index 784987172e..179bc1417b 100644 --- a/Marlin/src/HAL/shared/backtrace/unwmemaccess.cpp +++ b/Marlin/src/HAL/shared/backtrace/unwmemaccess.cpp @@ -15,6 +15,7 @@ #if defined(__arm__) || defined(__thumb__) #include "unwmemaccess.h" +#include "../../../inc/MarlinConfig.h" /* Validate address */ @@ -73,7 +74,7 @@ #define END_FLASH_ADDR 0x08080000 #endif -#ifdef STM32F7 +#if MB(THE_BORG) // For STM32F765 in BORG // SRAM (0x20000000 - 0x20080000) (512kb) // FLASH (0x08000000 - 0x08100000) (1024kb) @@ -84,6 +85,17 @@ #define END_FLASH_ADDR 0x08100000 #endif +#if MB(REMRAM_V1) +// For STM32F765VI in RemRam v1 +// SRAM (0x20000000 - 0x20080000) (512kb) +// FLASH (0x08000000 - 0x08200000) (2048kb) +// +#define START_SRAM_ADDR 0x20000000 +#define END_SRAM_ADDR 0x20080000 +#define START_FLASH_ADDR 0x08000000 +#define END_FLASH_ADDR 0x08200000 +#endif + #ifdef __MK20DX256__ // For MK20DX256 in TEENSY 3.1 or TEENSY 3.2 // SRAM (0x1FFF8000 - 0x20008000) (64kb) @@ -155,4 +167,3 @@ bool UnwReadB(const uint32_t a, uint8_t *v) { } #endif - diff --git a/Marlin/src/HAL/shared/backtrace/unwmemaccess.h b/Marlin/src/HAL/shared/backtrace/unwmemaccess.h index 5405f3a673..fe42bd9485 100644 --- a/Marlin/src/HAL/shared/backtrace/unwmemaccess.h +++ b/Marlin/src/HAL/shared/backtrace/unwmemaccess.h @@ -12,8 +12,7 @@ * File Description: Utility functions to access memory **************************************************************************/ -#ifndef UNWMEMACCESS_H -#define UNWMEMACCESS_H +#pragma once #include "unwarm.h" #include @@ -21,6 +20,3 @@ bool UnwReadW(const uint32_t a, uint32_t *v); bool UnwReadH(const uint32_t a, uint16_t *v); bool UnwReadB(const uint32_t a, uint8_t *v); - -#endif - diff --git a/Marlin/src/HAL/shared/math_32bit.h b/Marlin/src/HAL/shared/math_32bit.h index 472dfc3b56..5ce51b62ab 100644 --- a/Marlin/src/HAL/shared/math_32bit.h +++ b/Marlin/src/HAL/shared/math_32bit.h @@ -19,9 +19,7 @@ * along with this program. If not, see . * */ - -#ifndef MATH_32BIT_H -#define MATH_32BIT_H +#pragma once #include "../../core/macros.h" @@ -31,5 +29,3 @@ static FORCE_INLINE uint32_t MultiU32X24toH32(uint32_t longIn1, uint32_t longIn2) { return ((uint64_t)longIn1 * longIn2 + 0x00800000) >> 24; } - -#endif // MATH_32BIT_H diff --git a/Marlin/src/HAL/shared/persistent_store_api.cpp b/Marlin/src/HAL/shared/persistent_store_api.cpp index 50adc12631..230a70e85b 100644 --- a/Marlin/src/HAL/shared/persistent_store_api.cpp +++ b/Marlin/src/HAL/shared/persistent_store_api.cpp @@ -22,7 +22,7 @@ */ #include "../../inc/MarlinConfigPre.h" -#if ENABLED(EEPROM_SETTINGS) +#if ENABLED(EEPROM_SETTINGS) || ENABLED(SD_FIRMWARE_UPDATE) #include "persistent_store_api.h" PersistentStore persistentStore; diff --git a/Marlin/src/HAL/shared/servo.cpp b/Marlin/src/HAL/shared/servo.cpp index 82b7b9ade6..7d15d76b1a 100644 --- a/Marlin/src/HAL/shared/servo.cpp +++ b/Marlin/src/HAL/shared/servo.cpp @@ -53,7 +53,7 @@ #include "../../inc/MarlinConfig.h" -#if HAS_SERVOS && !(IS_32BIT_TEENSY || defined(TARGET_LPC1768) || defined(STM32F1) || defined(STM32F1xx) || defined(STM32F4) || defined(STM32F4xx)) +#if HAS_SERVOS && !(IS_32BIT_TEENSY || defined(TARGET_LPC1768) || defined(STM32F1) || defined(STM32F1xx) || defined(STM32F4) || defined(STM32F4xx) || defined(STM32F7xx)) //#include #include "servo.h" diff --git a/Marlin/src/HAL/shared/servo.h b/Marlin/src/HAL/shared/servo.h index b838a99056..93a10aaf67 100644 --- a/Marlin/src/HAL/shared/servo.h +++ b/Marlin/src/HAL/shared/servo.h @@ -73,11 +73,13 @@ #elif IS_TEENSY35 || IS_TEENSY36 #include "../HAL_TEENSY35_36/HAL_Servo_Teensy.h" #elif defined(TARGET_LPC1768) - #include "../HAL_LPC1768/LPC1768_Servo.h" -#elif defined(STM32F1) || defined(STM32F1xx) + #include "../HAL_LPC1768/MarlinServo.h" +#elif defined(__STM32F1__) || defined(TARGET_STM32F1) #include "../HAL_STM32F1/HAL_Servo_STM32F1.h" -#elif defined(STM32F4) || defined(STM32F4xx) +#elif defined(STM32GENERIC) && defined(STM32F4) #include "../HAL_STM32F4/HAL_Servo_STM32F4.h" +#elif defined(ARDUINO_ARCH_STM32) + #include "../HAL_STM32/HAL_Servo_STM32.h" #else #include diff --git a/Marlin/src/HAL/shared/servo_private.h b/Marlin/src/HAL/shared/servo_private.h index 2dcc9eb98f..522e4594ff 100644 --- a/Marlin/src/HAL/shared/servo_private.h +++ b/Marlin/src/HAL/shared/servo_private.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * servo_private.h - Interrupt driven Servo library for Arduino using 16 bit timers- Version 2 @@ -39,9 +40,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef SERVO_PRIVATE_H -#define SERVO_PRIVATE_H - #include // Architecture specific include @@ -98,5 +96,3 @@ extern ServoInfo_t servo_info[MAX_SERVOS]; extern void initISR(timer16_Sequence_t timer); extern void finISR(timer16_Sequence_t timer); - -#endif // SERVO_PRIVATE_H diff --git a/Marlin/src/Marlin.cpp b/Marlin/src/Marlin.cpp index 6d787fac48..50957517b5 100644 --- a/Marlin/src/Marlin.cpp +++ b/Marlin/src/Marlin.cpp @@ -42,6 +42,8 @@ #include "module/printcounter.h" // PrintCounter or Stopwatch #include "feature/closedloop.h" +#include "HAL/shared/Delay.h" + #ifdef ARDUINO #include #endif @@ -152,32 +154,24 @@ #include "feature/controllerfan.h" #endif -bool Running = true; +#if ENABLED(EXTENSIBLE_UI) + #include "lcd/extensible_ui/ui_api.h" +#endif -/** - * axis_homed - * Flags that each linear axis was homed. - * XYZ on cartesian, ABC on delta, ABZ on SCARA. - * - * axis_known_position - * Flags that the position is known in each linear axis. Set when homed. - * Cleared whenever a stepper powers off, potentially losing its position. - */ -uint8_t axis_homed, axis_known_position; // = 0 +bool Running = true; #if ENABLED(TEMPERATURE_UNITS_SUPPORT) TempUnit input_temp_units = TEMPUNIT_C; #endif #if FAN_COUNT > 0 - int16_t fanSpeeds[FAN_COUNT] = { 0 }; + uint8_t fan_speed[FAN_COUNT] = { 0 }; #if ENABLED(EXTRA_FAN_SPEED) - int16_t old_fanSpeeds[FAN_COUNT], - new_fanSpeeds[FAN_COUNT]; + uint8_t old_fan_speed[FAN_COUNT], new_fan_speed[FAN_COUNT]; #endif #if ENABLED(PROBING_FANS_OFF) bool fans_paused; // = false; - int16_t paused_fanSpeeds[FAN_COUNT] = { 0 }; + uint8_t paused_fan_speed[FAN_COUNT] = { 0 }; #endif #endif @@ -197,9 +191,9 @@ volatile bool wait_for_heatup = true; millis_t max_inactive_time, // = 0 stepper_inactive_time = (DEFAULT_STEPPER_DEACTIVE_TIME) * 1000UL; -#ifdef CHDK - millis_t chdkHigh; // = 0; - bool chdkActive; // = false; +#if PIN_EXISTS(CHDK) + extern bool chdk_active; + extern millis_t chdk_timeout; #endif #if ENABLED(I2C_POSITION_ENCODERS) @@ -256,6 +250,9 @@ void setup_powerhold() { /** * Sensitive pin test for M42, M226 */ + +#include "pins/sensitive_pins.h" + bool pin_is_protected(const pin_t pin) { static const pin_t sensitive_pins[] PROGMEM = SENSITIVE_PINS; for (uint8_t i = 0; i < COUNT(sensitive_pins); i++) { @@ -326,7 +323,7 @@ void disable_all_steppers() { * - Keep the command buffer full * - Check for maximum inactive time between commands * - Check for maximum inactive time between stepper commands - * - Check if pin CHDK needs to go LOW + * - Check if CHDK_PIN needs to go LOW * - Check for KILL button held down * - Check for HOME button held down * - Check if cooling fan needs to be switched on @@ -345,7 +342,7 @@ void manage_inactivity(const bool ignore_stepper_queue/*=false*/) { if (max_inactive_time && ELAPSED(ms, gcode.previous_move_ms + max_inactive_time)) { SERIAL_ERROR_START(); SERIAL_ECHOLNPAIR(MSG_KILL_INACTIVE_TIME, parser.command_ptr); - kill(PSTR(MSG_KILLED)); + kill(); } // Prevent steppers timing-out in the middle of M600 @@ -371,16 +368,19 @@ void manage_inactivity(const bool ignore_stepper_queue/*=false*/) { #if ENABLED(DISABLE_INACTIVE_E) disable_e_steppers(); #endif - #if ENABLED(AUTO_BED_LEVELING_UBL) && ENABLED(ULTIPANEL) // Only needed with an LCD - if (ubl.lcd_map_control) ubl.lcd_map_control = defer_return_to_status = false; + #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 } } - #ifdef CHDK // Check if pin should be set to LOW after M240 set it to HIGH - if (chdkActive && ELAPSED(ms, chdkHigh + CHDK_DELAY)) { - chdkActive = false; - WRITE(CHDK, LOW); + #if PIN_EXISTS(CHDK) // Check if pin should be set to LOW (after M240 set it HIGH) + if (chdk_active && ELAPSED(ms, chdk_timeout)) { + chdk_active = false; + WRITE(CHDK_PIN, LOW); } #endif @@ -402,7 +402,7 @@ void manage_inactivity(const bool ignore_stepper_queue/*=false*/) { if (killCount >= KILL_DELAY) { SERIAL_ERROR_START(); SERIAL_ERRORLNPGM(MSG_KILL_BUTTON); - kill(PSTR(MSG_KILLED)); + kill(); } #endif @@ -411,7 +411,7 @@ void manage_inactivity(const bool ignore_stepper_queue/*=false*/) { // --------------------------------------------------------- static int homeDebounceCount = 0; // poor man's debouncing count const int HOME_DEBOUNCE_DELAY = 2500; - if (!IS_SD_PRINTING && !READ(HOME_PIN)) { + if (!IS_SD_PRINTING() && !READ(HOME_PIN)) { if (!homeDebounceCount) { enqueue_and_echo_commands_P(PSTR("G28")); LCD_MESSAGEPGM(MSG_AUTO_HOME); @@ -549,7 +549,7 @@ void idle( max7219.idle_tasks(); #endif - lcd_update(); + ui.update(); #if ENABLED(HOST_KEEPALIVE_FEATURE) gcode.host_keepalive(); @@ -593,35 +593,47 @@ void idle( #endif } #endif + + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + Sd2Card::idle(); + #endif } /** * Kill all activity and lock the machine. * After this the machine will need to be reset. */ -void kill(const char* lcd_msg) { +void kill(PGM_P const lcd_msg/*=NULL*/) { + thermalManager.disable_all_heaters(); + SERIAL_ERROR_START(); SERIAL_ERRORLNPGM(MSG_ERR_KILLED); - thermalManager.disable_all_heaters(); - disable_all_steppers(); - - #if ENABLED(ULTRA_LCD) - kill_screen(lcd_msg); + #if HAS_SPI_LCD || ENABLED(EXTENSIBLE_UI) + ui.kill_screen(lcd_msg ? lcd_msg : PSTR(MSG_KILLED)); #else UNUSED(lcd_msg); #endif - _delay_ms(600); // Wait a short time (allows messages to get out before shutting down. - cli(); // Stop interrupts - - _delay_ms(250); //Wait to ensure all interrupts routines stopped - thermalManager.disable_all_heaters(); //turn off heaters again - #ifdef ACTION_ON_KILL SERIAL_ECHOLNPGM("//action:" ACTION_ON_KILL); #endif + minkill(); +} + +void minkill() { + + // Wait a short time (allows messages to get out before shutting down. + for (int i = 1000; i--;) DELAY_US(600); + + cli(); // Stop interrupts + + // Wait to ensure all interrupts stopped + for (int i = 1000; i--;) DELAY_US(250); + + thermalManager.disable_all_heaters(); // turn off heaters again + #if HAS_POWER_SWITCH PSU_OFF(); #endif @@ -643,6 +655,7 @@ void kill(const char* lcd_msg) { */ void stop() { thermalManager.disable_all_heaters(); // 'unpause' taken care of in here + print_job_timer.stop(); #if ENABLED(PROBING_FANS_OFF) if (fans_paused) fans_pause(false); // put things back the way they were @@ -686,7 +699,16 @@ void setup() { max7219.init(); #endif - #if ENABLED(DISABLE_JTAG) + #if ENABLED(DISABLE_DEBUG) + // Disable any hardware debug to free up pins for IO + #ifdef JTAGSWD_DISABLE + JTAGSWD_DISABLE(); + #elif defined(JTAG_DISABLE) + JTAG_DISABLE(); + #else + #error "DISABLE_DEBUG is not supported for the selected MCU/Board" + #endif + #elif ENABLED(DISABLE_JTAG) // Disable JTAG to free up pins for IO #ifdef JTAG_DISABLE JTAG_DISABLE(); @@ -726,7 +748,10 @@ void setup() { SERIAL_PROTOCOLLNPGM("start"); SERIAL_ECHO_START(); - #if HAS_DRIVER(TMC2130) + #if TMC_HAS_SPI + #if DISABLED(TMC_USE_SW_SPI) + SPI.begin(); + #endif tmc_init_cs_pins(); #endif #if HAS_DRIVER(TMC2208) @@ -820,7 +845,7 @@ void setup() { #endif #if ENABLED(USE_CONTROLLER_FAN) - SET_OUTPUT(CONTROLLER_FAN_PIN); //Set pin used for driver cooling fan + SET_OUTPUT(CONTROLLER_FAN_PIN); #endif #if HAS_STEPPER_RESET @@ -836,7 +861,7 @@ void setup() { #endif #if (ENABLED(Z_PROBE_SLED) || ENABLED(SOLENOID_PROBE)) && HAS_SOLENOID_1 - OUT_WRITE(SOL1_PIN, LOW); // turn it off + OUT_WRITE(SOL1_PIN, LOW); // OFF #endif #if HAS_HOME @@ -844,11 +869,11 @@ void setup() { #endif #if PIN_EXISTS(STAT_LED_RED) - OUT_WRITE(STAT_LED_RED_PIN, LOW); // turn it off + OUT_WRITE(STAT_LED_RED_PIN, LOW); // OFF #endif #if PIN_EXISTS(STAT_LED_BLUE) - OUT_WRITE(STAT_LED_BLUE_PIN, LOW); // turn it off + OUT_WRITE(STAT_LED_BLUE_PIN, LOW); // OFF #endif #if HAS_COLOR_LEDS @@ -874,15 +899,15 @@ void setup() { fanmux_init(); #endif - lcd_init(); - lcd_reset_status(); + ui.init(); + ui.reset_status(); #if ENABLED(SHOW_BOOTSCREEN) - lcd_bootscreen(); + ui.show_bootscreen(); #endif - #if ENABLED(MIXING_EXTRUDER) && MIXING_VIRTUAL_TOOLS > 1 - mixing_tools_init(); + #if ENABLED(MIXING_EXTRUDER) + mixer.init(); #endif #if ENABLED(BLTOUCH) @@ -899,11 +924,11 @@ void setup() { #endif #if DO_SWITCH_EXTRUDER - move_extruder_servo(0); // Initialize extruder servo + move_extruder_servo(0); // Initialize extruder servo #endif #if ENABLED(SWITCHING_NOZZLE) - move_nozzle_servo(0); // Initialize nozzle servo + move_nozzle_servo(0); // Initialize nozzle servo #endif #if ENABLED(PARKING_EXTRUDER) @@ -911,11 +936,11 @@ void setup() { #endif #if ENABLED(POWER_LOSS_RECOVERY) - check_print_job_recovery(); + recovery.check(); #endif - #if ENABLED(USE_WATCHDOG) // Reinit watchdog after HAL_get_reset_source call - watchdog_init(); + #if ENABLED(USE_WATCHDOG) + watchdog_init(); // Reinit watchdog after HAL_get_reset_source call #endif #if ENABLED(EXTERNAL_CLOSED_LOOP_CONTROLLER) @@ -941,11 +966,8 @@ void loop() { #if ENABLED(SDSUPPORT) card.checkautostart(); - #endif - #if ENABLED(SDSUPPORT) && ENABLED(ULTIPANEL) - if (abort_sd_printing) { - abort_sd_printing = false; + if (card.flag.abort_sd_printing) { card.stopSDPrint( #if SD_RESORT true @@ -955,15 +977,13 @@ void loop() { quickstop_stepper(); print_job_timer.stop(); thermalManager.disable_all_heaters(); - #if FAN_COUNT > 0 - for (uint8_t i = 0; i < FAN_COUNT; i++) fanSpeeds[i] = 0; - #endif + zero_fan_speeds(); wait_for_heatup = false; #if ENABLED(POWER_LOSS_RECOVERY) card.removeJobRecoveryFile(); #endif } - #endif // SDSUPPORT && ULTIPANEL + #endif // SDSUPPORT if (commands_in_queue < BUFSIZE) get_available_commands(); advance_command_queue(); diff --git a/Marlin/src/Marlin.h b/Marlin/src/Marlin.h index a233b44a30..1025d677c9 100644 --- a/Marlin/src/Marlin.h +++ b/Marlin/src/Marlin.h @@ -19,8 +19,7 @@ * along with this program. If not, see . * */ -#ifndef __MARLIN_H__ -#define __MARLIN_H__ +#pragma once #include "inc/MarlinConfig.h" @@ -180,7 +179,8 @@ void disable_e_stepper(const uint8_t e); void disable_e_steppers(); void disable_all_steppers(); -void kill(const char*); +void kill(PGM_P const lcd_msg=NULL); +void minkill(); void quickstop_stepper(); @@ -188,12 +188,6 @@ extern bool Running; inline bool IsRunning() { return Running; } inline bool IsStopped() { return !Running; } -extern uint8_t axis_homed, axis_known_position; - -constexpr uint8_t xyz_bits = _BV(X_AXIS) | _BV(Y_AXIS) | _BV(Z_AXIS); -FORCE_INLINE bool all_axes_homed() { return (axis_homed & xyz_bits) == xyz_bits; } -FORCE_INLINE bool all_axes_known() { return (axis_known_position & xyz_bits) == xyz_bits; } - extern volatile bool wait_for_heatup; #if HAS_RESUME_CONTINUE @@ -208,19 +202,24 @@ extern volatile bool wait_for_heatup; extern millis_t max_inactive_time, stepper_inactive_time; #if FAN_COUNT > 0 - extern int16_t fanSpeeds[FAN_COUNT]; + extern uint8_t fan_speed[FAN_COUNT]; #if ENABLED(EXTRA_FAN_SPEED) - extern int16_t old_fanSpeeds[FAN_COUNT], - new_fanSpeeds[FAN_COUNT]; + extern uint8_t old_fan_speed[FAN_COUNT], new_fan_speed[FAN_COUNT]; #endif #if ENABLED(PROBING_FANS_OFF) extern bool fans_paused; - extern int16_t paused_fanSpeeds[FAN_COUNT]; + extern uint8_t paused_fan_speed[FAN_COUNT]; #endif #endif +inline void zero_fan_speeds() { + #if FAN_COUNT > 0 + LOOP_L_N(i, FAN_COUNT) fan_speed[i] = 0; + #endif +} + #if ENABLED(USE_CONTROLLER_FAN) - extern uint8_t controllerFanSpeed; + extern uint8_t controllerfan_speed; #endif #if HAS_POWER_SWITCH @@ -242,5 +241,3 @@ void protected_pin_err(); #if HAS_SUICIDE inline void suicide() { OUT_WRITE(SUICIDE_PIN, LOW); } #endif - -#endif // __MARLIN_H__ diff --git a/Marlin/src/config/default/Configuration.h b/Marlin/src/config/default/Configuration.h index ff0cebbf74..09ad249b42 100644 --- a/Marlin/src/config/default/Configuration.h +++ b/Marlin/src/config/default/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -772,6 +770,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -859,6 +864,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -879,8 +885,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -905,7 +911,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -972,6 +978,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1141,8 +1159,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1297,10 +1316,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 180 #define PREHEAT_1_TEMP_BED 70 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 110 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -1429,10 +1450,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1460,6 +1481,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1824,6 +1852,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1980,5 +2017,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/default/Configuration_adv.h b/Marlin/src/config/default/Configuration_adv.h index b6d0d67278..0ee9c854e4 100644 --- a/Marlin/src/config/default/Configuration_adv.h +++ b/Marlin/src/config/default/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -30,8 +31,6 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -176,8 +175,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -245,7 +244,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -385,10 +384,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -413,6 +408,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -464,7 +480,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -482,6 +498,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] @@ -535,15 +562,15 @@ //=============================Additional Features=========================== //=========================================================================== -#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu //#define LCD_INFO_MENU @@ -559,7 +586,7 @@ // Add an 'M73' G-code to set the current percentage //#define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -568,7 +595,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -597,7 +624,7 @@ #define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -683,6 +710,43 @@ */ //#define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -697,7 +761,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar //#define DOGM_SD_PERCENT @@ -767,16 +831,25 @@ */ //#define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. + + //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -978,6 +1051,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -1003,21 +1085,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -//#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1258,11 +1361,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1271,10 +1374,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1414,6 +1525,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1556,6 +1676,33 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ @@ -1569,10 +1716,10 @@ #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "Preheat for PLA" + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "Preheat for ABS" + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) #define USER_DESC_4 "Heat Bed/Home/Level" @@ -1737,5 +1884,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration.h b/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration.h index 4e8faa156d..df5e48e91a 100644 --- a/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration.h +++ b/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -792,6 +790,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -879,6 +884,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -899,8 +905,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -925,7 +931,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -992,6 +998,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1161,8 +1179,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1317,10 +1336,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 180 #define PREHEAT_1_TEMP_BED 70 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 230 #define PREHEAT_2_TEMP_BED 110 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -1449,10 +1470,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1480,6 +1501,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1844,6 +1872,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -2000,5 +2037,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h b/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h index 1ca3273cb8..54824f6277 100644 --- a/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h +++ b/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -30,8 +31,6 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -176,8 +175,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -245,7 +244,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -385,10 +384,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -413,6 +408,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -464,7 +480,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -482,6 +498,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 4, 16, 16, 16 } // [1,2,4,8,16] @@ -535,15 +562,15 @@ //=============================Additional Features=========================== //=========================================================================== -#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu //#define LCD_INFO_MENU @@ -559,7 +586,7 @@ // Add an 'M73' G-code to set the current percentage //#define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -568,7 +595,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -597,7 +624,7 @@ #define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -683,6 +710,43 @@ */ //#define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -697,7 +761,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar //#define DOGM_SD_PERCENT @@ -767,16 +831,24 @@ */ //#define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. + + //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -978,6 +1050,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -1003,21 +1084,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -//#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1258,11 +1360,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1271,10 +1373,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1414,6 +1524,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1556,6 +1675,33 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ @@ -1569,10 +1715,10 @@ #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "Preheat for PLA" + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "Preheat for ABS" + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) #define USER_DESC_4 "Heat Bed/Home/Level" @@ -1737,5 +1883,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/examples/AliExpress/CL-260/Configuration.h b/Marlin/src/config/examples/AliExpress/CL-260/Configuration.h index fbdbc2cd71..350fa70e2d 100644 --- a/Marlin/src/config/examples/AliExpress/CL-260/Configuration.h +++ b/Marlin/src/config/examples/AliExpress/CL-260/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -772,6 +770,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -859,6 +864,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -879,8 +885,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -905,7 +911,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -972,6 +978,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1141,8 +1159,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1297,10 +1316,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 180 #define PREHEAT_1_TEMP_BED 70 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 110 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -1429,10 +1450,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1460,6 +1481,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1824,6 +1852,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1980,5 +2017,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/Anet/A2/Configuration.h b/Marlin/src/config/examples/Anet/A2/Configuration.h index a6345844d0..cef7791da4 100644 --- a/Marlin/src/config/examples/Anet/A2/Configuration.h +++ b/Marlin/src/config/examples/Anet/A2/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -138,7 +137,7 @@ // Optional custom name for your RepStrap or other custom machine // Displayed in the LCD "Ready" message -//#define CUSTOM_MACHINE_NAME "3D Printer" +#define CUSTOM_MACHINE_NAME "Anet A2" // Define this to set a unique identifier for this printer, (Used by some programs to differentiate between machines) // You can use an online service to generate a random UUID. (eg http://www.uuidgenerator.net/version4) @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -772,6 +770,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -859,6 +864,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -879,8 +885,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -905,7 +911,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -972,6 +978,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1141,8 +1159,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1297,10 +1316,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 200 #define PREHEAT_1_TEMP_BED 60 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 230 #define PREHEAT_2_TEMP_BED 100 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -1429,10 +1450,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1460,6 +1481,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1826,6 +1854,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1982,5 +2019,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/Anet/A2/Configuration_adv.h b/Marlin/src/config/examples/Anet/A2/Configuration_adv.h index a9f7fe63bf..0239947907 100644 --- a/Marlin/src/config/examples/Anet/A2/Configuration_adv.h +++ b/Marlin/src/config/examples/Anet/A2/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -30,8 +31,6 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -176,8 +175,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -245,7 +244,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -385,10 +384,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -413,6 +408,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -464,7 +480,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -482,6 +498,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] @@ -535,15 +562,15 @@ //=============================Additional Features=========================== //=========================================================================== -#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu //#define LCD_INFO_MENU @@ -559,7 +586,7 @@ // Add an 'M73' G-code to set the current percentage //#define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -568,7 +595,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -597,7 +624,7 @@ #define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -683,6 +710,43 @@ */ //#define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -697,7 +761,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar //#define DOGM_SD_PERCENT @@ -767,16 +831,24 @@ */ #define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. + + //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -978,6 +1050,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -1003,21 +1084,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -//#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1258,11 +1360,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1271,10 +1373,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1414,6 +1524,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1556,6 +1675,33 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ @@ -1569,10 +1715,10 @@ #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "Preheat for PLA" + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "Preheat for ABS" + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) #define USER_DESC_4 "Heat Bed/Home/Level" @@ -1737,5 +1883,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/examples/Anet/A2plus/Configuration.h b/Marlin/src/config/examples/Anet/A2plus/Configuration.h index 561b688ba7..e4ea1c1ff4 100644 --- a/Marlin/src/config/examples/Anet/A2plus/Configuration.h +++ b/Marlin/src/config/examples/Anet/A2plus/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -138,7 +137,7 @@ // Optional custom name for your RepStrap or other custom machine // Displayed in the LCD "Ready" message -//#define CUSTOM_MACHINE_NAME "3D Printer" +#define CUSTOM_MACHINE_NAME "Anet A2+" // Define this to set a unique identifier for this printer, (Used by some programs to differentiate between machines) // You can use an online service to generate a random UUID. (eg http://www.uuidgenerator.net/version4) @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -772,6 +770,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -859,6 +864,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -879,8 +885,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -905,7 +911,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -972,6 +978,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1141,8 +1159,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1297,10 +1316,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 200 #define PREHEAT_1_TEMP_BED 60 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 230 #define PREHEAT_2_TEMP_BED 100 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -1429,10 +1450,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1460,6 +1481,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1826,6 +1854,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1982,5 +2019,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/Anet/A2plus/Configuration_adv.h b/Marlin/src/config/examples/Anet/A2plus/Configuration_adv.h index a9f7fe63bf..0239947907 100644 --- a/Marlin/src/config/examples/Anet/A2plus/Configuration_adv.h +++ b/Marlin/src/config/examples/Anet/A2plus/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -30,8 +31,6 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -176,8 +175,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -245,7 +244,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -385,10 +384,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -413,6 +408,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -464,7 +480,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -482,6 +498,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] @@ -535,15 +562,15 @@ //=============================Additional Features=========================== //=========================================================================== -#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu //#define LCD_INFO_MENU @@ -559,7 +586,7 @@ // Add an 'M73' G-code to set the current percentage //#define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -568,7 +595,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -597,7 +624,7 @@ #define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -683,6 +710,43 @@ */ //#define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -697,7 +761,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar //#define DOGM_SD_PERCENT @@ -767,16 +831,24 @@ */ #define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. + + //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -978,6 +1050,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -1003,21 +1084,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -//#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1258,11 +1360,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1271,10 +1373,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1414,6 +1524,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1556,6 +1675,33 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ @@ -1569,10 +1715,10 @@ #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "Preheat for PLA" + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "Preheat for ABS" + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) #define USER_DESC_4 "Heat Bed/Home/Level" @@ -1737,5 +1883,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/examples/Anet/A6/Configuration.h b/Marlin/src/config/examples/Anet/A6/Configuration.h index 562e673a13..88ad69adcb 100644 --- a/Marlin/src/config/examples/Anet/A6/Configuration.h +++ b/Marlin/src/config/examples/Anet/A6/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -138,7 +137,7 @@ // Optional custom name for your RepStrap or other custom machine // Displayed in the LCD "Ready" message -//#define CUSTOM_MACHINE_NAME "3D Printer" +#define CUSTOM_MACHINE_NAME "Anet A6" // Define this to set a unique identifier for this printer, (Used by some programs to differentiate between machines) // You can use an online service to generate a random UUID. (eg http://www.uuidgenerator.net/version4) @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -820,6 +818,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -935,7 +940,8 @@ #if ENABLED(PROBING_HEATERS_OFF) //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif -#define PROBING_FANS_OFF // Turn fans off when probing +#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -956,8 +962,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -985,7 +991,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -1087,6 +1093,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1280,8 +1298,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1450,10 +1469,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 200 #define PREHEAT_1_TEMP_BED 50 #define PREHEAT_1_FAN_SPEED 0 // ANET A6 Default is 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 230 #define PREHEAT_2_TEMP_BED 70 #define PREHEAT_2_FAN_SPEED 0 // ANET A6 Default is 255 @@ -1582,10 +1603,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1613,6 +1634,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1979,6 +2007,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -2135,5 +2172,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/Anet/A6/Configuration_adv.h b/Marlin/src/config/examples/Anet/A6/Configuration_adv.h index 935323f175..6a409bde90 100644 --- a/Marlin/src/config/examples/Anet/A6/Configuration_adv.h +++ b/Marlin/src/config/examples/Anet/A6/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -30,8 +31,6 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -176,8 +175,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -245,7 +244,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -360,7 +359,6 @@ * X1 is the left carriage, X2 the right. They park and home at opposite ends of the X axis. * By default the X2 stepper is assigned to the first unused E plug on the board. */ -//#define DUAL_X_CARRIAGE #if ENABLED(DUAL_X_CARRIAGE) #define X1_MIN_POS X_MIN_POS // set minimum to ensure first x-carriage doesn't hit the parked second X-carriage #define X1_MAX_POS X_BED_SIZE // set maximum to ensure first x-carriage doesn't hit the parked second X-carriage @@ -385,10 +383,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -413,6 +407,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -464,7 +479,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -482,6 +497,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] @@ -535,15 +561,15 @@ //=============================Additional Features=========================== //=========================================================================== -#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu //#define LCD_INFO_MENU @@ -559,7 +585,7 @@ // Add an 'M73' G-code to set the current percentage //#define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -568,7 +594,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -597,7 +623,7 @@ //#define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -683,6 +709,43 @@ */ //#define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -697,7 +760,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar //#define DOGM_SD_PERCENT @@ -767,16 +830,24 @@ */ #define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. + + //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -978,6 +1049,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -1003,21 +1083,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -//#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1258,11 +1359,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1271,10 +1372,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1414,6 +1523,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1556,6 +1674,33 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ @@ -1569,10 +1714,10 @@ #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "Preheat for PLA" + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "Preheat for ABS" + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) #define USER_DESC_4 "Heat Bed/Home/Level" @@ -1737,5 +1882,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/examples/Anet/A8/Configuration.h b/Marlin/src/config/examples/Anet/A8/Configuration.h index 54ac8737f1..3b729240a1 100644 --- a/Marlin/src/config/examples/Anet/A8/Configuration.h +++ b/Marlin/src/config/examples/Anet/A8/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -138,7 +137,7 @@ // Optional custom name for your RepStrap or other custom machine // Displayed in the LCD "Ready" message -//#define CUSTOM_MACHINE_NAME "3D Printer" +#define CUSTOM_MACHINE_NAME "Anet A8" // Define this to set a unique identifier for this printer, (Used by some programs to differentiate between machines) // You can use an online service to generate a random UUID. (eg http://www.uuidgenerator.net/version4) @@ -204,7 +203,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -221,7 +220,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -779,6 +777,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -866,6 +871,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -886,8 +892,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -912,7 +918,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -979,6 +985,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1148,8 +1166,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1304,10 +1323,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 190 #define PREHEAT_1_TEMP_BED 60 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 90 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -1436,10 +1457,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1467,6 +1488,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1833,6 +1861,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1989,5 +2026,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/Anet/A8/Configuration_adv.h b/Marlin/src/config/examples/Anet/A8/Configuration_adv.h index fbfb258491..4112b095d2 100644 --- a/Marlin/src/config/examples/Anet/A8/Configuration_adv.h +++ b/Marlin/src/config/examples/Anet/A8/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -30,8 +31,6 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -176,8 +175,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -245,7 +244,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -282,7 +281,7 @@ // If you want endstops to stay on (by default) even when not homing // enable this option. Override at any time with M120, M121. -#define ENDSTOPS_ALWAYS_ON_DEFAULT +//#define ENDSTOPS_ALWAYS_ON_DEFAULT // @section extras @@ -385,10 +384,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -413,6 +408,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -464,7 +480,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -482,6 +498,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] @@ -535,15 +562,15 @@ //=============================Additional Features=========================== //=========================================================================== -#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu //#define LCD_INFO_MENU @@ -559,7 +586,7 @@ // Add an 'M73' G-code to set the current percentage //#define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -568,7 +595,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -597,7 +624,7 @@ //#define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -683,6 +710,43 @@ */ //#define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -697,7 +761,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar //#define DOGM_SD_PERCENT @@ -767,16 +831,24 @@ */ #define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. + + //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -978,6 +1050,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -1003,21 +1084,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -//#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1258,11 +1360,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1271,10 +1373,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1414,6 +1524,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1556,6 +1675,33 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ @@ -1569,10 +1715,10 @@ #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "Preheat for PLA" + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "Preheat for ABS" + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) #define USER_DESC_4 "Heat Bed/Home/Level" @@ -1737,5 +1883,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/examples/AnimationExample/_Bootscreen.h b/Marlin/src/config/examples/AnimationExample/_Bootscreen.h new file mode 100644 index 0000000000..6a69735626 --- /dev/null +++ b/Marlin/src/config/examples/AnimationExample/_Bootscreen.h @@ -0,0 +1,339 @@ +/** + * 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 . + * + */ + +/** + * Animated boot screen example + */ + +#define ANIMATED_BOOTSCREEN +#define CUSTOM_BOOTSCREEN_FRAME_TIME 100 // (ms) + +#define CUSTOM_BOOTSCREEN_BMPWIDTH 128 +#define CUSTOM_BOOTSCREEN_TIMEOUT 2500 // (ms) + +const unsigned char custom_start_bmp[] PROGMEM = { + B00011111,B11111111,B11111111,B11111111,B11111111,B11001111,B11111111,B11111111,B11111111,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00001000,B00000000,B00000000,B00000000,B00000000,B11011000,B00000000,B00000000,B00000001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00001000,B00000000,B00000000,B00000000,B00000000,B10010000,B00000000,B00000000,B00000011,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000100,B00000000,B00000000,B00000000,B00000001,B10100000,B00000000,B00000000,B00000010,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000110,B00000000,B00000000,B00000000,B00000001,B01100000,B00000000,B00000000,B00000100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000010,B00000000,B00000000,B00000000,B00000010,B01000000,B00000000,B00000000,B00000100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000001,B11111111,B10000000,B01111111,B11111110,B11000000,B00000000,B00000000,B00001000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B11111111,B11000000,B01111111,B00001000,B10000001,B11100000,B00111000,B00011000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00100000,B01000000,B00000001,B00000011,B01000000,B01011000,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B11111111,B10110000,B00100111,B11111001,B00000010,B01000000,B10010000,B00100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B01000000,B11010000,B00110110,B00001101,B10000110,B10000000,B10100000,B00100010,B00010000,B00000010,B10000000,B11110000,B00000000,B00000000,B00000000, + B00000000,B01100000,B01001000,B00010010,B00000100,B10000101,B10000001,B00100000,B01000011,B00110000,B00000010,B00000000,B00111000,B00000000,B00000000,B00000000, + B00000000,B00100000,B00101000,B00001011,B00000010,B11001001,B00000011,B01000000,B11000011,B00110011,B10011010,B10111000,B00011000,B10001000,B00100010,B00000000, + B00000000,B00110000,B00100100,B00001001,B00000011,B01001011,B00000010,B11000000,B10000011,B00110000,B10010010,B10100100,B00011000,B01110000,B00011100,B00000000, + B00000000,B00010000,B00010110,B00000100,B10000001,B00110010,B00000110,B10000001,B10000010,B11010011,B10010010,B10100100,B00110000,B00100000,B00001000,B00000000, + B00000000,B00001000,B00011010,B00000110,B10000001,B10110100,B00000101,B10000001,B00000010,B11010100,B10010010,B10100100,B01110000,B01110000,B00011100,B00000000, + B00000000,B00001100,B00001011,B00000010,B01000000,B10000100,B00001001,B00000010,B00000010,B00010011,B10010010,B10100100,B11111010,B10001010,B10100010,B00000000, + B00000000,B00000100,B00001101,B00000011,B01100000,B01001000,B00001010,B00000110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000110,B00000100,B10000001,B00100000,B01111000,B00010010,B00000100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000010,B00000010,B10000000,B10110000,B00110000,B00110100,B00001100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000001,B00000010,B01000000,B10010000,B00000000,B00101100,B00001000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000001,B00000001,B01100000,B01001000,B00000000,B01001000,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B10000001,B10100000,B01101000,B00000000,B01011000,B00010001,B11110000,B00000000,B00000000,B00010000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B11000000,B10110000,B00100100,B00000000,B10010000,B00100000,B01000000,B00000000,B00000000,B00010000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B01000000,B11010000,B00110110,B00000001,B10100000,B01100000,B01000011,B00110111,B00011100,B11110011,B10000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B01100000,B01001000,B00010010,B00000001,B01100000,B01000000,B01000100,B10100100,B10000101,B10010100,B01000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00100000,B00101100,B00001011,B00000001,B01000000,B11000000,B01000100,B10100100,B10011101,B00010100,B01000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00010000,B00110100,B00001001,B00000001,B01000000,B10000000,B01000100,B10100100,B10100101,B00010100,B01000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00011000,B00010110,B00000100,B10000001,B00100001,B00000000,B01000011,B00100100,B10011100,B11110011,B10000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00001000,B00011010,B00000110,B10000001,B10100011,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00001100,B00001001,B00000010,B01000000,B10010010,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000100,B00000101,B00000011,B01100000,B01011110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000010,B00000100,B10000001,B00100000,B01101100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000010,B00000010,B11000000,B10110000,B00100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000001,B00000011,B01000000,B10010000,B00110000,B11110000,B10010000,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000001,B10000001,B01100000,B01011000,B00010000,B10000000,B10000100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B10000001,B10100000,B11010000,B00110000,B10000111,B10011110,B10111001,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B11000000,B10010000,B10010000,B00100000,B11101100,B10010100,B11000101,B00100000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B01000000,B01011001,B00100000,B01000000,B10001000,B10010100,B11000101,B00100000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00100000,B01001011,B01100000,B01000000,B10001100,B10010100,B11000101,B00100000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00110000,B00101110,B01000000,B10000000,B11110111,B10010110,B10111001,B00100000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00010000,B00110110,B11000001,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00011000,B00010000,B10000001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00001000,B00001001,B00000011,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00001100,B00001001,B00000010,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000100,B00000110,B00000110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000010,B00000110,B00000100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000011,B00000000,B00001000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000001,B00000000,B00001000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000001,B10000000,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B10000000,B00110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B01000000,B00100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B01000000,B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00100000,B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00110000,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00011001,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00001110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000 +}; + +#if ENABLED(ANIMATED_BOOTSCREEN) + + const unsigned char custom_start_bmp1[] PROGMEM = { + B11111001,B11111111,B11111111,B11111111,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00011011,B00000000,B00000000,B00000000,B00100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00010010,B00000000,B00000000,B00000000,B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00110100,B00000000,B00000000,B00000000,B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00101100,B00000000,B00000000,B00000000,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B01001000,B00000000,B00000000,B00000000,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B11011000,B00000000,B00000000,B00000001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00010000,B00111100,B00000111,B00000011,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00100000,B01101000,B00001011,B00000010,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00100000,B01001000,B00010010,B00000100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B10110000,B11010000,B00010100,B00000100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B10010000,B10110000,B00100100,B00001000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B01011001,B00100000,B01101000,B00011000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B01101001,B01100000,B01011000,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00100110,B01000000,B11010000,B00110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00110110,B10000000,B10110000,B00100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00010000,B10000001,B00100000,B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00001001,B00000001,B01000000,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00001111,B00000010,B01000000,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000110,B00000110,B10000001,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000101,B10000001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00001001,B00000010,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00001011,B00000010,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B10000000,B00010010,B00000100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B11000000,B00110100,B00001100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B01000000,B00101100,B00001000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B01100000,B00101000,B00011000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00100000,B00101000,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B10010000,B00100100,B00100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B11010000,B00110100,B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B01001000,B00010010,B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B01101100,B00001011,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00100100,B00001101,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00010110,B00000100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00010010,B00000110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00001011,B00000010,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00011010,B00000110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00010010,B00000100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00100100,B00001000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B01101100,B00001000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B11001000,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B11011000,B00110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00010000,B00100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00100000,B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00100000,B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B11000000,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B11000000,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000010,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00001100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00001000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000 + }; + + const unsigned char custom_start_bmp2[] PROGMEM = { + B00011111,B11111111,B11111111,B11111111,B11111111,B11001111,B11111111,B11111111,B11111111,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00001000,B00000000,B00000000,B00000000,B00000000,B11011000,B00000000,B00000000,B00000001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00001000,B00000000,B00000000,B00000000,B00000000,B10010000,B00000000,B00000000,B00000011,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000100,B00000000,B00000000,B00000000,B00000001,B10100000,B00000000,B00000000,B00000010,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000110,B00000000,B00000000,B00000000,B00000001,B01100000,B00000000,B00000000,B00000100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000010,B00000000,B00000000,B00000000,B00000010,B01000000,B00000000,B00000000,B00000100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000001,B11111111,B10000000,B01111111,B11111110,B11000000,B00000000,B00000000,B00001000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B11111111,B11000000,B01111111,B00001000,B10000001,B11100000,B00111000,B00011000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00100000,B01000000,B00000001,B00000011,B01000000,B01011000,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B11111111,B10110000,B00100111,B11111001,B00000010,B01000000,B10010000,B00100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B01000000,B11010000,B00110110,B00001101,B10000110,B10000000,B10100000,B00100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B01100000,B01001000,B00010010,B00000100,B10000101,B10000001,B00100000,B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00100000,B00101000,B00001011,B00000010,B11001001,B00000011,B01000000,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00110000,B00100100,B00001001,B00000011,B01001011,B00000010,B11000000,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00010000,B00010110,B00000100,B10000001,B00110010,B00000110,B10000001,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00001000,B00011010,B00000110,B10000001,B10110100,B00000101,B10000001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00001100,B00001011,B00000010,B01000000,B10000100,B00001001,B00000010,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000100,B00001101,B00000011,B01100000,B01001000,B00001010,B00000110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000110,B00000100,B10000001,B00100000,B01111000,B00010010,B00000100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000010,B00000010,B10000000,B10110000,B00110000,B00110100,B00001100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000001,B00000010,B01000000,B10010000,B00000000,B00101100,B00001000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000001,B00000001,B01100000,B01001000,B00000000,B01001000,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B10000001,B10100000,B01101000,B00000000,B01011000,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B11000000,B10110000,B00100100,B00000000,B10010000,B00100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B01000000,B11010000,B00110110,B00000001,B10100000,B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B01100000,B01001000,B00010010,B00000001,B01100000,B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00100000,B00101100,B00001011,B00000001,B01000000,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00010000,B00110100,B00001001,B00000001,B01000000,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00011000,B00010110,B00000100,B10000001,B00100001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00001000,B00011010,B00000110,B10000001,B10100011,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00001100,B00001001,B00000010,B01000000,B10010010,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000100,B00000101,B00000011,B01100000,B01011110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000010,B00000100,B10000001,B00100000,B01101100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000010,B00000010,B11000000,B10110000,B00100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000001,B00000011,B01000000,B10010000,B00110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000001,B10000001,B01100000,B01011000,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B10000001,B10100000,B11010000,B00110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B11000000,B10010000,B10010000,B00100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B01000000,B01011001,B00100000,B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00100000,B01001011,B01100000,B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00110000,B00101110,B01000000,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00010000,B00110110,B11000001,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00011000,B00010000,B10000001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00001000,B00001001,B00000011,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00001100,B00001001,B00000010,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000100,B00000110,B00000110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000010,B00000110,B00000100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000011,B00000000,B00001000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000001,B00000000,B00001000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000001,B10000000,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B10000000,B00110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B01000000,B00100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B01000000,B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00100000,B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00110000,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00011001,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00001110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000 + }; + + const unsigned char custom_start_bmp3[] PROGMEM = { + B00011111,B11111111,B11111111,B11111111,B11111111,B11001111,B11111111,B11111111,B11111111,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00001000,B00000000,B00000000,B00000000,B00000000,B11011000,B00000000,B00000000,B00000001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00001000,B00000000,B00000000,B00000000,B00000000,B10010000,B00000000,B00000000,B00000011,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000100,B00000000,B00000000,B00000000,B00000001,B10100000,B00000000,B00000000,B00000010,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000110,B00000000,B00000000,B00000000,B00000001,B01100000,B00000000,B00000000,B00000100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000010,B00000000,B00000000,B00000000,B00000010,B01000000,B00000000,B00000000,B00000100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000001,B11111111,B10000000,B01111111,B11111110,B11000000,B00000000,B00000000,B00001000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B11111111,B11000000,B01111111,B00001000,B10000001,B11100000,B00111000,B00011000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00100000,B01000000,B00000001,B00000011,B01000000,B01011000,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B11111111,B10110000,B00100111,B11111001,B00000010,B01000000,B10010000,B00100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B01000000,B11010000,B00110110,B00001101,B10000110,B10000000,B10100000,B00100010,B00010000,B00000010,B10000000,B11110000,B00000000,B00000000,B00000000, + B00000000,B01100000,B01001000,B00010010,B00000100,B10000101,B10000001,B00100000,B01000011,B00110000,B00000010,B00000000,B00111000,B00000000,B00000000,B00000000, + B00000000,B00100000,B00101000,B00001011,B00000010,B11001001,B00000011,B01000000,B11000011,B00110011,B10011010,B10111000,B00011000,B10001000,B00100010,B00000000, + B00000000,B00110000,B00100100,B00001001,B00000011,B01001011,B00000010,B11000000,B10000011,B00110000,B10010010,B10100100,B00011000,B01110000,B00011100,B00000000, + B00000000,B00010000,B00010110,B00000100,B10000001,B00110010,B00000110,B10000001,B10000010,B11010011,B10010010,B10100100,B00110000,B00100000,B00001000,B00000000, + B00000000,B00001000,B00011010,B00000110,B10000001,B10110100,B00000101,B10000001,B00000010,B11010100,B10010010,B10100100,B01110000,B01110000,B00011100,B00000000, + B00000000,B00001100,B00001011,B00000010,B01000000,B10000100,B00001001,B00000010,B00000010,B00010011,B10010010,B10100100,B11111010,B10001010,B10100010,B00000000, + B00000000,B00000100,B00001101,B00000011,B01100000,B01001000,B00001010,B00000110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000110,B00000100,B10000001,B00100000,B01111000,B00010010,B00000100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000010,B00000010,B10000000,B10110000,B00110000,B00110100,B00001100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000001,B00000010,B01000000,B10010000,B00000000,B00101100,B00001000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000001,B00000001,B01100000,B01001000,B00000000,B01001000,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B10000001,B10100000,B01101000,B00000000,B01011000,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B11000000,B10110000,B00100100,B00000000,B10010000,B00100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B01000000,B11010000,B00110110,B00000001,B10100000,B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B01100000,B01001000,B00010010,B00000001,B01100000,B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00100000,B00101100,B00001011,B00000001,B01000000,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00010000,B00110100,B00001001,B00000001,B01000000,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00011000,B00010110,B00000100,B10000001,B00100001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00001000,B00011010,B00000110,B10000001,B10100011,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00001100,B00001001,B00000010,B01000000,B10010010,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000100,B00000101,B00000011,B01100000,B01011110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000010,B00000100,B10000001,B00100000,B01101100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000010,B00000010,B11000000,B10110000,B00100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000001,B00000011,B01000000,B10010000,B00110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000001,B10000001,B01100000,B01011000,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B10000001,B10100000,B11010000,B00110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B11000000,B10010000,B10010000,B00100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B01000000,B01011001,B00100000,B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00100000,B01001011,B01100000,B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00110000,B00101110,B01000000,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00010000,B00110110,B11000001,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00011000,B00010000,B10000001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00001000,B00001001,B00000011,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00001100,B00001001,B00000010,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000100,B00000110,B00000110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000010,B00000110,B00000100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000011,B00000000,B00001000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000001,B00000000,B00001000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000001,B10000000,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B10000000,B00110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B01000000,B00100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B01000000,B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00100000,B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00110000,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00011001,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00001110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000 + }; + + const unsigned char custom_start_bmp4[] PROGMEM = { + B00011111,B11111111,B11111111,B11111111,B11111111,B11001111,B11111111,B11111111,B11111111,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00001000,B00000000,B00000000,B00000000,B00000000,B11011000,B00000000,B00000000,B00000001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00001000,B00000000,B00000000,B00000000,B00000000,B10010000,B00000000,B00000000,B00000011,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000100,B00000000,B00000000,B00000000,B00000001,B10100000,B00000000,B00000000,B00000010,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000110,B00000000,B00000000,B00000000,B00000001,B01100000,B00000000,B00000000,B00000100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000010,B00000000,B00000000,B00000000,B00000010,B01000000,B00000000,B00000000,B00000100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000001,B11111111,B10000000,B01111111,B11111110,B11000000,B00000000,B00000000,B00001000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B11111111,B11000000,B01111111,B00001000,B10000001,B11100000,B00111000,B00011000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00100000,B01000000,B00000001,B00000011,B01000000,B01011000,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B11111111,B10110000,B00100111,B11111001,B00000010,B01000000,B10010000,B00100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B01000000,B11010000,B00110110,B00001101,B10000110,B10000000,B10100000,B00100010,B00010000,B00000010,B10000000,B11110000,B00000000,B00000000,B00000000, + B00000000,B01100000,B01001000,B00010010,B00000100,B10000101,B10000001,B00100000,B01000011,B00110000,B00000010,B00000000,B00111000,B00000000,B00000000,B00000000, + B00000000,B00100000,B00101000,B00001011,B00000010,B11001001,B00000011,B01000000,B11000011,B00110011,B10011010,B10111000,B00011000,B10001000,B00100010,B00000000, + B00000000,B00110000,B00100100,B00001001,B00000011,B01001011,B00000010,B11000000,B10000011,B00110000,B10010010,B10100100,B00011000,B01110000,B00011100,B00000000, + B00000000,B00010000,B00010110,B00000100,B10000001,B00110010,B00000110,B10000001,B10000010,B11010011,B10010010,B10100100,B00110000,B00100000,B00001000,B00000000, + B00000000,B00001000,B00011010,B00000110,B10000001,B10110100,B00000101,B10000001,B00000010,B11010100,B10010010,B10100100,B01110000,B01110000,B00011100,B00000000, + B00000000,B00001100,B00001011,B00000010,B01000000,B10000100,B00001001,B00000010,B00000010,B00010011,B10010010,B10100100,B11111010,B10001010,B10100010,B00000000, + B00000000,B00000100,B00001101,B00000011,B01100000,B01001000,B00001010,B00000110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000110,B00000100,B10000001,B00100000,B01111000,B00010010,B00000100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000010,B00000010,B10000000,B10110000,B00110000,B00110100,B00001100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000001,B00000010,B01000000,B10010000,B00000000,B00101100,B00001000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000001,B00000001,B01100000,B01001000,B00000000,B01001000,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B10000001,B10100000,B01101000,B00000000,B01011000,B00010001,B11110000,B00000000,B00000000,B00010000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B11000000,B10110000,B00100100,B00000000,B10010000,B00100000,B01000000,B00000000,B00000000,B00010000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B01000000,B11010000,B00110110,B00000001,B10100000,B01100000,B01000011,B00110111,B00011100,B11110011,B10000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B01100000,B01001000,B00010010,B00000001,B01100000,B01000000,B01000100,B10100100,B10000101,B10010010,B01000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00100000,B00101100,B00001011,B00000001,B01000000,B11000000,B01000100,B10100100,B10011101,B00010100,B01000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00010000,B00110100,B00001001,B00000001,B01000000,B10000000,B01000100,B10100100,B10100101,B00010010,B01000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00011000,B00010110,B00000100,B10000001,B00100001,B00000000,B01000011,B00100100,B10011100,B11110011,B10000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00001000,B00011010,B00000110,B10000001,B10100011,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00001100,B00001001,B00000010,B01000000,B10010010,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000100,B00000101,B00000011,B01100000,B01011110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000010,B00000100,B10000001,B00100000,B01101100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000010,B00000010,B11000000,B10110000,B00100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000001,B00000011,B01000000,B10010000,B00110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000001,B10000001,B01100000,B01011000,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B10000001,B10100000,B11010000,B00110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B11000000,B10010000,B10010000,B00100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B01000000,B01011001,B00100000,B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00100000,B01001011,B01100000,B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00110000,B00101110,B01000000,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00010000,B00110110,B11000001,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00011000,B00010000,B10000001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00001000,B00001001,B00000011,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00001100,B00001001,B00000010,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000100,B00000110,B00000110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000010,B00000110,B00000100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000011,B00000000,B00001000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000001,B00000000,B00001000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000001,B10000000,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B10000000,B00110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B01000000,B00100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B01000000,B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00100000,B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00110000,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00011001,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00001110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000 + }; + + const unsigned char * const custom_bootscreen_animation[] PROGMEM = { + custom_start_bmp1, custom_start_bmp2, custom_start_bmp3, custom_start_bmp4, custom_start_bmp + }; + +#endif diff --git a/Marlin/src/config/examples/ArmEd/Configuration.h b/Marlin/src/config/examples/ArmEd/Configuration.h new file mode 100644 index 0000000000..cdf74682f6 --- /dev/null +++ b/Marlin/src/config/examples/ArmEd/Configuration.h @@ -0,0 +1,2031 @@ +/** + * 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 . + * + */ +#pragma once + +/** + * Configuration.h + * + * Basic settings such as: + * + * - Type of electronics + * - Type of temperature sensor + * - Printer geometry + * - Endstop configuration + * - LCD controller + * - Extra features + * + * Advanced settings can be found in Configuration_adv.h + * + */ +#define CONFIGURATION_H_VERSION 020000 + +//=========================================================================== +//============================= Getting Started ============================= +//=========================================================================== + +/** + * Here are some standard links for getting your machine calibrated: + * + * http://reprap.org/wiki/Calibration + * http://youtu.be/wAL9d7FgInk + * http://calculator.josefprusa.cz + * http://reprap.org/wiki/Triffid_Hunter%27s_Calibration_Guide + * http://www.thingiverse.com/thing:5573 + * https://sites.google.com/site/repraplogphase/calibration-of-your-reprap + * http://www.thingiverse.com/thing:298812 + */ + +//=========================================================================== +//============================= DELTA Printer =============================== +//=========================================================================== +// For a Delta printer start with one of the configuration files in the +// config/examples/delta directory and customize for your machine. +// + +//=========================================================================== +//============================= SCARA Printer =============================== +//=========================================================================== +// For a SCARA printer start with the configuration files in +// config/examples/SCARA and customize for your machine. +// + +// @section info + +// User-specified version info of this build to display in [Pronterface, etc] terminal window during +// startup. Implementation of an idea by Prof Braino to inform user that any changes made to this +// build by the user have been successfully uploaded into firmware. +#define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes. +#define SHOW_BOOTSCREEN +#define STRING_SPLASH_LINE1 SHORT_BUILD_VERSION // will be shown during bootup in line 1 +#define STRING_SPLASH_LINE2 WEBSITE_URL // will be shown during bootup in line 2 + +/** + * *** VENDORS PLEASE READ *** + * + * Marlin allows you to add a custom boot image for Graphical LCDs. + * With this option Marlin will first show your custom screen followed + * by the standard Marlin logo with version number and web URL. + * + * We encourage you to take advantage of this new feature and we also + * respectfully request that you retain the unmodified Marlin boot screen. + */ + +// Enable to show the bitmap in Marlin/_Bootscreen.h on startup. +//#define SHOW_CUSTOM_BOOTSCREEN + +// Enable to show the bitmap in Marlin/_Statusscreen.h on the status screen. +//#define CUSTOM_STATUS_SCREEN_IMAGE + +// @section machine + +/** + * Select the serial port on the board to use for communication with the host. + * This allows the connection of wireless adapters (for instance) to non-default port pins. + * Note: The first serial port (-1 or 0) will always be used by the Arduino bootloader. + * + * :[-1, 0, 1, 2, 3, 4, 5, 6, 7] + */ +#define SERIAL_PORT -1 + +/** + * Select a secondary serial port on the board to use for communication with the host. + * This allows the connection of wireless adapters (for instance) to non-default port pins. + * Serial port -1 is the USB emulated serial port, if available. + * + * :[-1, 0, 1, 2, 3, 4, 5, 6, 7] + */ +// #define SERIAL_PORT_2 3 + +/** + * This setting determines the communication speed of the printer. + * + * 250000 works in most cases, but you might try a lower speed if + * you commonly experience drop-outs during host printing. + * You may try up to 1000000 to speed up SD file transfer. + * + * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000] + */ +#define BAUDRATE 250000 + +// Enable the Bluetooth serial interface on AT90USB devices +//#define BLUETOOTH + +// The following define selects which electronics board you have. +// Please choose the name from boards.h that matches your setup +#ifndef MOTHERBOARD + #define MOTHERBOARD BOARD_ARMED +#endif + +// Optional custom name for your RepStrap or other custom machine +// Displayed in the LCD "Ready" message +//#define CUSTOM_MACHINE_NAME "3D Printer" + +// Define this to set a unique identifier for this printer, (Used by some programs to differentiate between machines) +// You can use an online service to generate a random UUID. (eg http://www.uuidgenerator.net/version4) +//#define MACHINE_UUID "00000000-0000-0000-0000-000000000000" + +// @section extruder + +// This defines the number of extruders +// :[1, 2, 3, 4, 5, 6] +#define EXTRUDERS 1 + +// Generally expected filament diameter (1.75, 2.85, 3.0, ...). Used for Volumetric, Filament Width Sensor, etc. +#define DEFAULT_NOMINAL_FILAMENT_DIA 1.75 + +// For Cyclops or any "multi-extruder" that shares a single nozzle. +//#define SINGLENOZZLE +#if ENABLED(SINGLENOZZLE) + // Parameters for filament retract / prime on toolchange + #define SINGLENOZZLE_SWAP_LENGTH 12 // (mm) + #define SINGLENOZZLE_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define SINGLENOZZLE_SWAP_PRIME_SPEED 3600 // (mm/m) + //#define SINGLENOZZLE_SWAP_PARK + #if ENABLED(SINGLENOZZLE_SWAP_PARK) + #define SINGLENOZZLE_TOOLCHANGE_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define SINGLENOZZLE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif + +/** + * Průša MK2 Single Nozzle Multi-Material Multiplexer, and variants. + * + * This device allows one stepper driver on a control board to drive + * two to eight stepper motors, one at a time, in a manner suitable + * for extruders. + * + * This option only allows the multiplexer to switch on tool-change. + * Additional options to configure custom E moves are pending. + */ +//#define MK2_MULTIPLEXER +#if ENABLED(MK2_MULTIPLEXER) + // Override the default DIO selector pins here, if needed. + // Some pins files may provide defaults for these pins. + //#define E_MUX0_PIN 40 // Always Required + //#define E_MUX1_PIN 42 // Needed for 3 to 8 inputs + //#define E_MUX2_PIN 44 // Needed for 5 to 8 inputs +#endif + +// A dual extruder that uses a single stepper motor +//#define SWITCHING_EXTRUDER +#if ENABLED(SWITCHING_EXTRUDER) + #define SWITCHING_EXTRUDER_SERVO_NR 0 + #define SWITCHING_EXTRUDER_SERVO_ANGLES { 0, 90 } // Angles for E0, E1[, E2, E3] + #if EXTRUDERS > 3 + #define SWITCHING_EXTRUDER_E23_SERVO_NR 1 + #endif +#endif + +// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +//#define SWITCHING_NOZZLE +#if ENABLED(SWITCHING_NOZZLE) + #define SWITCHING_NOZZLE_SERVO_NR 0 + #define SWITCHING_NOZZLE_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 +#endif + +/** + * Two separate X-carriages with extruders that connect to a moving part + * via a magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + */ +//#define PARKING_EXTRUDER +#if ENABLED(PARKING_EXTRUDER) + #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage + #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil + #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders + #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 +#endif + +/** + * Switching Toolhead + * + * Support for swappable and dockable toolheads, such as + * the E3D Tool Changer. Toolheads are locked with a servo. + */ +//#define SWITCHING_TOOLHEAD +#if ENABLED(SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_SERVO_NR 2 // Index of the servo connector + #define SWITCHING_TOOLHEAD_SERVO_ANGLES { 0, 180 } // (degrees) Angles for Lock, Unlock + #define SWITCHING_TOOLHEAD_Y_POS 235 // (mm) Y position of the toolhead dock + #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis + #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders +#endif + +/** + * "Mixing Extruder" + * - Adds G-codes M163 and M164 to set and "commit" the current mix factors. + * - Extends the stepping routines to move multiple steppers in proportion to the mix. + * - Optional support for Repetier Firmware's 'M164 S' supporting virtual tools. + * - This implementation supports up to two mixing extruders. + * - Enable DIRECT_MIXING_IN_G1 for M165 and mixing in G1 (from Pia Taubert's reference implementation). + */ +//#define MIXING_EXTRUDER +#if ENABLED(MIXING_EXTRUDER) + #define MIXING_STEPPERS 2 // Number of steppers in your mixing extruder + #define MIXING_VIRTUAL_TOOLS 16 // Use the Virtual Tool method with M163 and M164 + //#define DIRECT_MIXING_IN_G1 // Allow ABCDHI mix factors in G1 movement commands +#endif + +// Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing). +// The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder). +// For the other hotends it is their distance from the extruder 0 hotend. +//#define HOTEND_OFFSET_X {0.0, 20.00} // (mm) relative X-offset for each nozzle +//#define HOTEND_OFFSET_Y {0.0, 5.00} // (mm) relative Y-offset for each nozzle +//#define HOTEND_OFFSET_Z {0.0, 0.00} // (mm) relative Z-offset for each nozzle + +// @section machine + +/** + * Select your power supply here. Use 0 if you haven't connected the PS_ON_PIN + * + * 0 = No Power Switch + * 1 = ATX + * 2 = X-Box 360 203Watts (the blue wire connected to PS_ON and the red wire to VCC) + * + * :{ 0:'No power switch', 1:'ATX', 2:'X-Box 360' } + */ +#define POWER_SUPPLY 0 + +#if POWER_SUPPLY > 0 + // Enable this option to leave the PSU off at startup. + // Power to steppers and heaters will need to be turned on with M80. + //#define PS_DEFAULT_OFF + + //#define AUTO_POWER_CONTROL // Enable automatic control of the PS_ON pin + #if ENABLED(AUTO_POWER_CONTROL) + #define AUTO_POWER_FANS // Turn on PSU if fans need power + #define AUTO_POWER_E_FANS + #define AUTO_POWER_CONTROLLERFAN + #define POWER_TIMEOUT 30 + #endif + +#endif + +// @section temperature + +//=========================================================================== +//============================= Thermal Settings ============================ +//=========================================================================== + +/** + * --NORMAL IS 4.7kohm PULLUP!-- 1kohm pullup can be used on hotend sensor, using correct resistor and table + * + * Temperature sensors available: + * + * -4 : thermocouple with AD8495 + * -3 : thermocouple with MAX31855 (only for sensor 0) + * -2 : thermocouple with MAX6675 (only for sensor 0) + * -1 : thermocouple with AD595 + * 0 : not used + * 1 : 100k thermistor - best choice for EPCOS 100k (4.7k pullup) + * 2 : 200k thermistor - ATC Semitec 204GT-2 (4.7k pullup) + * 3 : Mendel-parts thermistor (4.7k pullup) + * 4 : 10k thermistor !! do not use it for a hotend. It gives bad resolution at high temp. !! + * 5 : 100K thermistor - ATC Semitec 104GT-2/104NT-4-R025H42G (Used in ParCan & J-Head) (4.7k pullup) + * 501 : 100K Zonestar (Tronxy X3A) Thermistor + * 6 : 100k EPCOS - Not as accurate as table 1 (created using a fluke thermocouple) (4.7k pullup) + * 7 : 100k Honeywell thermistor 135-104LAG-J01 (4.7k pullup) + * 71 : 100k Honeywell thermistor 135-104LAF-J01 (4.7k pullup) + * 8 : 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) + * 9 : 100k GE Sensing AL03006-58.2K-97-G1 (4.7k pullup) + * 10 : 100k RS thermistor 198-961 (4.7k pullup) + * 11 : 100k beta 3950 1% thermistor (4.7k pullup) + * 12 : 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed) + * 13 : 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE" + * 15 : 100k thermistor calibration for JGAurora A5 hotend + * 20 : the PT100 circuit found in the Ultimainboard V2.x + * 60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950 + * 66 : 4.7M High Temperature thermistor from Dyze Design + * 70 : the 100K thermistor found in the bq Hephestos 2 + * 75 : 100k Generic Silicon Heat Pad with NTC 100K MGB18-104F39050L32 thermistor + * + * 1k ohm pullup tables - This is atypical, and requires changing out the 4.7k pullup for 1k. + * (but gives greater accuracy and more stable PID) + * 51 : 100k thermistor - EPCOS (1k pullup) + * 52 : 200k thermistor - ATC Semitec 204GT-2 (1k pullup) + * 55 : 100k thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (1k pullup) + * + * 1047 : Pt1000 with 4k7 pullup + * 1010 : Pt1000 with 1k pullup (non standard) + * 147 : Pt100 with 4k7 pullup + * 110 : Pt100 with 1k pullup (non standard) + * + * Use these for Testing or Development purposes. NEVER for production machine. + * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. + * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. + * + * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + */ +#define TEMP_SENSOR_0 5 +#define TEMP_SENSOR_1 0 +#define TEMP_SENSOR_2 0 +#define TEMP_SENSOR_3 0 +#define TEMP_SENSOR_4 0 +#define TEMP_SENSOR_5 0 +#define TEMP_SENSOR_BED 13 +#define TEMP_SENSOR_CHAMBER 0 + +// Dummy thermistor constant temperature readings, for use with 998 and 999 +#define DUMMY_THERMISTOR_998_VALUE 25 +#define DUMMY_THERMISTOR_999_VALUE 100 + +// Use temp sensor 1 as a redundant sensor with sensor 0. If the readings +// from the two sensors differ too much the print will be aborted. +//#define TEMP_SENSOR_1_AS_REDUNDANT +#define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 + +// Extruder temperature must be close to target for this long before M109 returns success +#define TEMP_RESIDENCY_TIME 10 // (seconds) +#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one +#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. + +// Bed temperature must be close to target for this long before M190 returns success +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) +#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one +#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. + +// The minimal temperature defines the temperature below which the heater will not be enabled It is used +// to check that the wiring to the thermistor is not broken. +// Otherwise this would lead to the heater being powered on all the time. +#define HEATER_0_MINTEMP 5 +#define HEATER_1_MINTEMP 5 +#define HEATER_2_MINTEMP 5 +#define HEATER_3_MINTEMP 5 +#define HEATER_4_MINTEMP 5 +#define HEATER_5_MINTEMP 5 +#define BED_MINTEMP 5 + +// When temperature exceeds max temp, your heater will be switched off. +// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! +// You should use MINTEMP for thermistor short/failure protection. +#define HEATER_0_MAXTEMP 275 +#define HEATER_1_MAXTEMP 275 +#define HEATER_2_MAXTEMP 275 +#define HEATER_3_MAXTEMP 275 +#define HEATER_4_MAXTEMP 275 +#define HEATER_5_MAXTEMP 275 +#define BED_MAXTEMP 150 + +//=========================================================================== +//============================= PID Settings ================================ +//=========================================================================== +// PID Tuning Guide here: http://reprap.org/wiki/PID_Tuning + +// Comment the following line to disable PID and enable bang-bang. +#define PIDTEMP +#define BANG_MAX 255 // Limits current to nozzle while in bang-bang mode; 255=full current +#define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current +#define PID_K1 0.95 // Smoothing factor within any PID loop +#if ENABLED(PIDTEMP) + //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. + //#define PID_DEBUG // Sends debug data to the serial port. + //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX + //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders) + // Set/get with gcode: M301 E[extruder number, 0-2] + #define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature + // is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max. + + // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it + + // Armed + #define DEFAULT_Kp 23.41 + #define DEFAULT_Ki 2.57 + #define DEFAULT_Kd 53.37 + + // MakerGear + //#define DEFAULT_Kp 7.0 + //#define DEFAULT_Ki 0.1 + //#define DEFAULT_Kd 12 + + // Mendel Parts V9 on 12V + //#define DEFAULT_Kp 63.0 + //#define DEFAULT_Ki 2.25 + //#define DEFAULT_Kd 440 + +#endif // PIDTEMP + +//=========================================================================== +//============================= PID > Bed Temperature Control =============== +//=========================================================================== + +/** + * PID Bed Heating + * + * If this option is enabled set PID constants below. + * If this option is disabled, bang-bang will be used and BED_LIMIT_SWITCHING will enable hysteresis. + * + * The PID frequency will be the same as the extruder PWM. + * If PID_dT is the default, and correct for the hardware/configuration, that means 7.689Hz, + * which is fine for driving a square wave into a resistive load and does not significantly + * impact FET heating. This also works fine on a Fotek SSR-10DA Solid State Relay into a 250W + * heater. If your configuration is significantly different than this and you don't understand + * the issues involved, don't use bed PID until someone else verifies that your hardware works. + */ +//#define PIDTEMPBED + +//#define BED_LIMIT_SWITCHING + +/** + * Max Bed Power + * Applies to all forms of bed control (PID, bang-bang, and bang-bang with hysteresis). + * When set to any value below 255, enables a form of PWM to the bed that acts like a divider + * so don't use it unless you are OK with PWM on your bed. (See the comment on enabling PIDTEMPBED) + */ +#define MAX_BED_POWER 255 // limits duty cycle to bed; 255=full current + +#if ENABLED(PIDTEMPBED) + + //#define PID_BED_DEBUG // Sends debug data to the serial port. + + //120V 250W silicone heater into 4mm borosilicate (MendelMax 1.5+) + //from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10) + #define DEFAULT_bedKp 144.87 + #define DEFAULT_bedKi 27.00 + #define DEFAULT_bedKd 194.30 + + + //120V 250W silicone heater into 4mm borosilicate (MendelMax 1.5+) + //from pidautotune + //#define DEFAULT_bedKp 97.1 + //#define DEFAULT_bedKi 1.41 + //#define DEFAULT_bedKd 1675.16 + + // FIND YOUR OWN: "M303 E-1 C8 S90" to run autotune on the bed at 90 degreesC for 8 cycles. +#endif // PIDTEMPBED + +// @section extruder + +/** + * Prevent extrusion if the temperature is below EXTRUDE_MINTEMP. + * Add M302 to set the minimum extrusion temperature and/or turn + * cold extrusion prevention on and off. + * + * *** IT IS HIGHLY RECOMMENDED TO LEAVE THIS OPTION ENABLED! *** + */ +#define PREVENT_COLD_EXTRUSION +#define EXTRUDE_MINTEMP 170 + +/** + * Prevent a single extrusion longer than EXTRUDE_MAXLENGTH. + * Note: For Bowden Extruders make this large enough to allow load/unload. + */ +#define PREVENT_LENGTHY_EXTRUDE +#define EXTRUDE_MAXLENGTH 200 + +//=========================================================================== +//======================== Thermal Runaway Protection ======================= +//=========================================================================== + +/** + * Thermal Protection provides additional protection to your printer from damage + * and fire. Marlin always includes safe min and max temperature ranges which + * protect against a broken or disconnected thermistor wire. + * + * The issue: If a thermistor falls out, it will report the much lower + * temperature of the air in the room, and the the firmware will keep + * the heater on. + * + * If you get "Thermal Runaway" or "Heating failed" errors the + * details can be tuned in Configuration_adv.h + */ + +#define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders +#define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed + +//=========================================================================== +//============================= Mechanical Settings ========================= +//=========================================================================== + +// @section machine + +// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics +// either in the usual order or reversed +//#define COREXY +//#define COREXZ +//#define COREYZ +//#define COREYX +//#define COREZX +//#define COREZY + +//=========================================================================== +//============================== Endstop Settings =========================== +//=========================================================================== + +// @section homing + +// Specify here all the endstop connectors that are connected to any endstop or probe. +// Almost all printers will be using one per axis. Probes will use one or more of the +// extra connectors. Leave undefined any used for non-endstop and non-probe purposes. +#define USE_XMIN_PLUG +#define USE_YMIN_PLUG +#define USE_ZMIN_PLUG +//#define USE_XMAX_PLUG +//#define USE_YMAX_PLUG +//#define USE_ZMAX_PLUG + +// Enable pullup for all endstops to prevent a floating state +#define ENDSTOPPULLUPS +#if DISABLED(ENDSTOPPULLUPS) + // Disable ENDSTOPPULLUPS to set pullups individually + //#define ENDSTOPPULLUP_XMAX + //#define ENDSTOPPULLUP_YMAX + //#define ENDSTOPPULLUP_ZMAX + //#define ENDSTOPPULLUP_XMIN + //#define ENDSTOPPULLUP_YMIN + //#define ENDSTOPPULLUP_ZMIN + //#define ENDSTOPPULLUP_ZMIN_PROBE +#endif + +// Enable pulldown for all endstops to prevent a floating state +//#define ENDSTOPPULLDOWNS +#if DISABLED(ENDSTOPPULLDOWNS) + // Disable ENDSTOPPULLDOWNS to set pulldowns individually + //#define ENDSTOPPULLDOWN_XMAX + //#define ENDSTOPPULLDOWN_YMAX + //#define ENDSTOPPULLDOWN_ZMAX + //#define ENDSTOPPULLDOWN_XMIN + //#define ENDSTOPPULLDOWN_YMIN + //#define ENDSTOPPULLDOWN_ZMIN + //#define ENDSTOPPULLDOWN_ZMIN_PROBE +#endif + +// Mechanical endstop with COM to ground and NC to Signal uses "false" here (most common setup). +#define X_MIN_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. +#define Y_MIN_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. +#define Z_MIN_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. +#define X_MAX_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. +#define Y_MAX_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. +#define Z_MAX_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. +#define Z_MIN_PROBE_ENDSTOP_INVERTING false // set to true to invert the logic of the probe. + +/** + * Stepper Drivers + * + * These settings allow Marlin to tune stepper driver timing and enable advanced options for + * stepper drivers that support them. You may also override timing options in Configuration_adv.h. + * + * A4988 is assumed for unspecified drivers. + * + * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, + * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, + * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, + * TMC5130, TMC5130_STANDALONE + * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + */ +//#define X_DRIVER_TYPE A4988 +//#define Y_DRIVER_TYPE A4988 +//#define Z_DRIVER_TYPE A4988 +//#define X2_DRIVER_TYPE A4988 +//#define Y2_DRIVER_TYPE A4988 +//#define Z2_DRIVER_TYPE A4988 +//#define Z3_DRIVER_TYPE A4988 +//#define E0_DRIVER_TYPE A4988 +//#define E1_DRIVER_TYPE A4988 +//#define E2_DRIVER_TYPE A4988 +//#define E3_DRIVER_TYPE A4988 +//#define E4_DRIVER_TYPE A4988 +//#define E5_DRIVER_TYPE A4988 + +// Enable this feature if all enabled endstop pins are interrupt-capable. +// This will remove the need to poll the interrupt pins, saving many CPU cycles. +//#define ENDSTOP_INTERRUPTS_FEATURE + +/** + * Endstop Noise Threshold + * + * Enable if your probe or endstops falsely trigger due to noise. + * + * - Higher values may affect repeatability or accuracy of some bed probes. + * - To fix noise install a 100nF ceramic capacitor inline with the switch. + * - This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, which already have the 100nF capacitor. + * + * :[2,3,4,5,6,7] + */ +//#define ENDSTOP_NOISE_THRESHOLD 2 + +//============================================================================= +//============================== Movement Settings ============================ +//============================================================================= +// @section motion + +/** + * Default Settings + * + * These settings can be reset by M502 + * + * Note that if EEPROM is enabled, saved values will override these. + */ + +/** + * With this option each E stepper can have its own factors for the + * following movement settings. If fewer factors are given than the + * total number of extruders, the last value applies to the rest. + */ +//#define DISTINCT_E_FACTORS + +/** + * Default Axis Steps Per Unit (steps/mm) + * Override with M92 + * X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]] + */ +#define DEFAULT_AXIS_STEPS_PER_UNIT { 100, 100, 400, 156.84 } + +/** + * Default Max Feed Rate (mm/s) + * Override with M203 + * X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]] + */ +#define DEFAULT_MAX_FEEDRATE { 300, 300, 20, 120 } + +/** + * Default Max Acceleration (change/s) change = mm/s + * (Maximum start speed for accelerated moves) + * Override with M201 + * X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]] + */ +#define DEFAULT_MAX_ACCELERATION { 1000, 1000, 1000, 5000 } + +/** + * Default Acceleration (change/s) change = mm/s + * Override with M204 + * + * M204 P Acceleration + * M204 R Retract Acceleration + * M204 T Travel Acceleration + */ +#define DEFAULT_ACCELERATION 1000 // X, Y, Z and E acceleration for printing moves +#define DEFAULT_RETRACT_ACCELERATION 1000 // E acceleration for retracts +#define DEFAULT_TRAVEL_ACCELERATION 1000 // X, Y, Z acceleration for travel (non printing) moves + +/** + * Default Jerk (mm/s) + * Override with M205 X Y Z E + * + * "Jerk" specifies the minimum speed change that requires acceleration. + * When changing speed and direction, if the difference is less than the + * value set here, it may happen instantaneously. + */ +#define DEFAULT_XJERK 8.0 +#define DEFAULT_YJERK 8.0 +#define DEFAULT_ZJERK 0.4 +#define DEFAULT_EJERK 1.5 + +/** + * S-Curve Acceleration + * + * This option eliminates vibration during printing by fitting a Bézier + * curve to move acceleration, producing much smoother direction changes. + * + * See https://github.com/synthetos/TinyG/wiki/Jerk-Controlled-Motion-Explained + */ +//#define S_CURVE_ACCELERATION + +//=========================================================================== +//============================= Z Probe Options ============================= +//=========================================================================== +// @section probes + +// +// See http://marlinfw.org/docs/configuration/probes.html +// + +/** + * Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN + * + * Enable this option for a probe connected to the Z Min endstop pin. + */ +#define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN + +/** + * Z_MIN_PROBE_ENDSTOP + * + * Enable this option for a probe connected to any pin except Z-Min. + * (By default Marlin assumes the Z-Max endstop pin.) + * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * + * - The simplest option is to use a free endstop connector. + * - Use 5V for powered (usually inductive) sensors. + * + * - RAMPS 1.3/1.4 boards may use the 5V, GND, and Aux4->D32 pin: + * - For simple switches connect... + * - normally-closed switches to GND and D32. + * - normally-open switches to 5V and D32. + * + * WARNING: Setting the wrong pin may have unexpected and potentially + * disastrous consequences. Use with caution and do your homework. + * + */ +//#define Z_MIN_PROBE_ENDSTOP + +/** + * Probe Type + * + * Allen Key Probes, Servo Probes, Z-Sled Probes, FIX_MOUNTED_PROBE, etc. + * Activate one of these to use Auto Bed Leveling below. + */ + +/** + * The "Manual Probe" provides a means to do "Auto" Bed Leveling without a probe. + * Use G29 repeatedly, adjusting the Z height at each point with movement commands + * or (with LCD_BED_LEVELING) the LCD controller. + */ +//#define PROBE_MANUALLY +//#define MANUAL_PROBE_START_Z 0.2 + +/** + * A Fix-Mounted Probe either doesn't deploy or needs manual deployment. + * (e.g., an inductive probe or a nozzle-based probe-switch.) + */ +//#define FIX_MOUNTED_PROBE + +/** + * Z Servo Probe, such as an endstop switch on a rotating arm. + */ +//#define Z_PROBE_SERVO_NR 0 // Defaults to SERVO 0 connector. +//#define Z_SERVO_ANGLES {70,0} // Z Servo Deploy and Stow angles + +/** + * The BLTouch probe uses a Hall effect sensor and emulates a servo. + */ +//#define BLTOUCH +#if ENABLED(BLTOUCH) + //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed +#endif + +// A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) +//#define SOLENOID_PROBE + +// A sled-mounted probe like those designed by Charles Bell. +//#define Z_PROBE_SLED +//#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. + +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + +// +// For Z_PROBE_ALLEN_KEY see the Delta example configurations. +// + +/** + * Z Probe to nozzle (X,Y) offset, relative to (0, 0). + * X and Y offsets must be integers. + * + * In the following example the X and Y offsets are both positive: + * #define X_PROBE_OFFSET_FROM_EXTRUDER 10 + * #define Y_PROBE_OFFSET_FROM_EXTRUDER 10 + * + * +-- BACK ---+ + * | | + * L | (+) P | R <-- probe (20,20) + * E | | I + * F | (-) N (+) | G <-- nozzle (10,10) + * T | | H + * | (-) | T + * | | + * O-- FRONT --+ + * (0,0) + */ +#define X_PROBE_OFFSET_FROM_EXTRUDER 10 // X offset: -left +right [of the nozzle] +#define Y_PROBE_OFFSET_FROM_EXTRUDER 10 // Y offset: -front +behind [the nozzle] +#define Z_PROBE_OFFSET_FROM_EXTRUDER 0 // Z offset: -below +above [the nozzle] + +// Certain types of probes need to stay away from edges +#define MIN_PROBE_EDGE 10 + +// X and Y axis travel speed (mm/m) between probes +#define XY_PROBE_SPEED 8000 + +// Feedrate (mm/m) for the first approach when double-probing (MULTIPLE_PROBING == 2) +#define Z_PROBE_SPEED_FAST HOMING_FEEDRATE_Z + +// Feedrate (mm/m) for the "accurate" probe of each point +#define Z_PROBE_SPEED_SLOW (Z_PROBE_SPEED_FAST / 2) + +// The number of probes to perform at each point. +// Set to 2 for a fast/slow probe, using the second probe result. +// Set to 3 or more for slow probes, averaging the results. +//#define MULTIPLE_PROBING 2 + +/** + * Z probes require clearance when deploying, stowing, and moving between + * probe points to avoid hitting the bed and other hardware. + * Servo-mounted probes require extra space for the arm to rotate. + * Inductive probes need space to keep from triggering early. + * + * Use these settings to specify the distance (mm) to raise the probe (or + * lower the bed). The values set here apply over and above any (negative) + * probe Z Offset set with Z_PROBE_OFFSET_FROM_EXTRUDER, M851, or the LCD. + * Only integer values >= 1 are valid here. + * + * Example: `M851 Z-5` with a CLEARANCE of 4 => 9mm from bed to nozzle. + * But: `M851 Z+1` with a CLEARANCE of 2 => 2mm from bed to nozzle. + */ +#define Z_CLEARANCE_DEPLOY_PROBE 10 // Z Clearance for Deploy/Stow +#define Z_CLEARANCE_BETWEEN_PROBES 5 // Z Clearance between probe points +#define Z_CLEARANCE_MULTI_PROBE 5 // Z Clearance between multiple probes +//#define Z_AFTER_PROBING 5 // Z position after probing is done + +#define Z_PROBE_LOW_POINT -2 // Farthest distance below the trigger-point to go before stopping + +// For M851 give a range for adjusting the Z probe offset +#define Z_PROBE_OFFSET_RANGE_MIN -20 +#define Z_PROBE_OFFSET_RANGE_MAX 20 + +// Enable the M48 repeatability test to test probe accuracy +//#define Z_MIN_PROBE_REPEATABILITY_TEST + +// Before deploy/stow pause for user confirmation +//#define PAUSE_BEFORE_DEPLOY_STOW + +/** + * Enable one or more of the following if probing seems unreliable. + * Heaters and/or fans can be disabled during probing to minimize electrical + * noise. A delay can also be added to allow noise and vibration to settle. + * These options are most useful for the BLTouch probe, but may also improve + * readings with inductive probes and piezo sensors. + */ +//#define PROBING_HEATERS_OFF // Turn heaters off when probing +#if ENABLED(PROBING_HEATERS_OFF) + //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) +#endif +//#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing +//#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors + +// For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 +// :{ 0:'Low', 1:'High' } +#define X_ENABLE_ON 0 +#define Y_ENABLE_ON 0 +#define Z_ENABLE_ON 0 +#define E_ENABLE_ON 0 // For all extruders + +// Disables axis stepper immediately when it's not being used. +// WARNING: When motors turn off there is a chance of losing position accuracy! +#define DISABLE_X false +#define DISABLE_Y false +#define DISABLE_Z false + +// Warn on display about possibly reduced accuracy +//#define DISABLE_REDUCED_ACCURACY_WARNING + +// @section extruder + +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled + +// @section machine + +// Invert the stepper direction. Change (or reverse the motor connector) if an axis goes the wrong way. +#define INVERT_X_DIR false +#define INVERT_Y_DIR true +#define INVERT_Z_DIR false + +// @section extruder + +// For direct drive extruder v9 set to true, for geared extruder set to false. +#define INVERT_E0_DIR false +#define INVERT_E1_DIR false +#define INVERT_E2_DIR false +#define INVERT_E3_DIR false +#define INVERT_E4_DIR false +#define INVERT_E5_DIR false + +// @section homing + +//#define NO_MOTION_BEFORE_HOMING // Inhibit movement until all axes have been homed + +//#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. + +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... + // Be sure you have this distance over your Z_MAX_POS in case. + +// Direction of endstops when homing; 1=MAX, -1=MIN +// :[-1,1] +#define X_HOME_DIR -1 +#define Y_HOME_DIR -1 +#define Z_HOME_DIR -1 + +// @section machine + +// The size of the print bed +#define X_BED_SIZE 200 +#define Y_BED_SIZE 200 + +// Travel limits (mm) after homing, corresponding to endstop positions. +#define X_MIN_POS 0 +#define Y_MIN_POS 0 +#define Z_MIN_POS 0 +#define X_MAX_POS X_BED_SIZE +#define Y_MAX_POS Y_BED_SIZE +#define Z_MAX_POS 200 + +/** + * Software Endstops + * + * - Prevent moves outside the set machine bounds. + * - Individual axes can be disabled, if desired. + * - X and Y only apply to Cartesian robots. + * - Use 'M211' to set software endstops on/off or report current state + */ + +// Min software endstops constrain movement within minimum coordinate bounds +#define MIN_SOFTWARE_ENDSTOPS +#if ENABLED(MIN_SOFTWARE_ENDSTOPS) + #define MIN_SOFTWARE_ENDSTOP_X + #define MIN_SOFTWARE_ENDSTOP_Y + #define MIN_SOFTWARE_ENDSTOP_Z +#endif + +// Max software endstops constrain movement within maximum coordinate bounds +#define MAX_SOFTWARE_ENDSTOPS +#if ENABLED(MAX_SOFTWARE_ENDSTOPS) + #define MAX_SOFTWARE_ENDSTOP_X + #define MAX_SOFTWARE_ENDSTOP_Y + #define MAX_SOFTWARE_ENDSTOP_Z +#endif + +#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) + //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD +#endif + +/** + * Filament Runout Sensors + * Mechanical or opto endstops are used to check for the presence of filament. + * + * RAMPS-based boards use SERVO3_PIN for the first runout sensor. + * For other boards you may need to define FIL_RUNOUT_PIN, FIL_RUNOUT2_PIN, etc. + * By default the firmware assumes HIGH=FILAMENT PRESENT. + */ +//#define FILAMENT_RUNOUT_SENSOR +#if ENABLED(FILAMENT_RUNOUT_SENSOR) + #define NUM_RUNOUT_SENSORS 1 // Number of sensors, up to one per extruder. Define a FIL_RUNOUT#_PIN for each. + #define FIL_RUNOUT_INVERTING false // set to true to invert the logic of the sensor. + #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. + //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. + #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif +#endif + +//=========================================================================== +//=============================== Bed Leveling ============================== +//=========================================================================== +// @section calibrate + +/** + * Choose one of the options below to enable G29 Bed Leveling. The parameters + * and behavior of G29 will change depending on your selection. + * + * If using a Probe for Z Homing, enable Z_SAFE_HOMING also! + * + * - AUTO_BED_LEVELING_3POINT + * Probe 3 arbitrary points on the bed (that aren't collinear) + * You specify the XY coordinates of all 3 points. + * The result is a single tilted plane. Best for a flat bed. + * + * - AUTO_BED_LEVELING_LINEAR + * Probe several points in a grid. + * You specify the rectangle and the density of sample points. + * The result is a single tilted plane. Best for a flat bed. + * + * - AUTO_BED_LEVELING_BILINEAR + * Probe several points in a grid. + * You specify the rectangle and the density of sample points. + * The result is a mesh, best for large or uneven beds. + * + * - AUTO_BED_LEVELING_UBL (Unified Bed Leveling) + * A comprehensive bed leveling system combining the features and benefits + * of other systems. UBL also includes integrated Mesh Generation, Mesh + * Validation and Mesh Editing systems. + * + * - MESH_BED_LEVELING + * Probe a grid manually + * The result is a mesh, suitable for large or uneven beds. (See BILINEAR.) + * For machines without a probe, Mesh Bed Leveling provides a method to perform + * leveling in steps so you can manually adjust the Z height at each grid-point. + * With an LCD controller the process is guided step-by-step. + */ +//#define AUTO_BED_LEVELING_3POINT +//#define AUTO_BED_LEVELING_LINEAR +//#define AUTO_BED_LEVELING_BILINEAR +//#define AUTO_BED_LEVELING_UBL +//#define MESH_BED_LEVELING + +/** + * Normally G28 leaves leveling disabled on completion. Enable + * this option to have G28 restore the prior leveling state. + */ +//#define RESTORE_LEVELING_AFTER_G28 + +/** + * Enable detailed logging of G28, G29, M48, etc. + * Turn on with the command 'M111 S32'. + * NOTE: Requires a lot of PROGMEM! + */ +//#define DEBUG_LEVELING_FEATURE + +#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) + // Gradually reduce leveling correction until a set height is reached, + // at which point movement will be level to the machine's XY plane. + // The height can be set with M420 Z + #define ENABLE_LEVELING_FADE_HEIGHT + + // For Cartesian machines, instead of dividing moves on mesh boundaries, + // split up moves into short segments like a Delta. This follows the + // contours of the bed more closely than edge-to-edge straight moves. + #define SEGMENT_LEVELED_MOVES + #define LEVELED_SEGMENT_LENGTH 5.0 // (mm) Length of all segments (except the last one) + + /** + * Enable the G26 Mesh Validation Pattern tool. + */ + //#define G26_MESH_VALIDATION + #if ENABLED(G26_MESH_VALIDATION) + #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. + #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. + #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #endif + +#endif + +#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) + + // Set the number of grid points per dimension. + #define GRID_MAX_POINTS_X 3 + #define GRID_MAX_POINTS_Y GRID_MAX_POINTS_X + + // Set the boundaries for probing (where the probe can reach). + //#define LEFT_PROBE_BED_POSITION MIN_PROBE_EDGE + //#define RIGHT_PROBE_BED_POSITION (X_BED_SIZE - (MIN_PROBE_EDGE)) + //#define FRONT_PROBE_BED_POSITION MIN_PROBE_EDGE + //#define BACK_PROBE_BED_POSITION (Y_BED_SIZE - (MIN_PROBE_EDGE)) + + // Probe along the Y axis, advancing X after each column + //#define PROBE_Y_FIRST + + #if ENABLED(AUTO_BED_LEVELING_BILINEAR) + + // Beyond the probed grid, continue the implied tilt? + // Default is to maintain the height of the nearest edge. + //#define EXTRAPOLATE_BEYOND_GRID + + // + // Experimental Subdivision of the grid by Catmull-Rom method. + // Synthesizes intermediate points to produce a more detailed mesh. + // + //#define ABL_BILINEAR_SUBDIVISION + #if ENABLED(ABL_BILINEAR_SUBDIVISION) + // Number of subdivisions between probe points + #define BILINEAR_SUBDIVISIONS 3 + #endif + + #endif + +#elif ENABLED(AUTO_BED_LEVELING_UBL) + + //=========================================================================== + //========================= Unified Bed Leveling ============================ + //=========================================================================== + + //#define MESH_EDIT_GFX_OVERLAY // Display a graphics overlay while editing the mesh + + #define MESH_INSET 1 // Set Mesh bounds as an inset region of the bed + #define GRID_MAX_POINTS_X 10 // Don't use more than 15 points per axis, implementation limited. + #define GRID_MAX_POINTS_Y GRID_MAX_POINTS_X + + #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle + #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + +#elif ENABLED(MESH_BED_LEVELING) + + //=========================================================================== + //=================================== Mesh ================================== + //=========================================================================== + + #define MESH_INSET 10 // Set Mesh bounds as an inset region of the bed + #define GRID_MAX_POINTS_X 3 // Don't use more than 7 points per axis, implementation limited. + #define GRID_MAX_POINTS_Y GRID_MAX_POINTS_X + + //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS + +#endif // BED_LEVELING + +/** + * Points to probe for all 3-point Leveling procedures. + * Override if the automatically selected points are inadequate. + */ +#if ENABLED(AUTO_BED_LEVELING_3POINT) || ENABLED(AUTO_BED_LEVELING_UBL) + //#define PROBE_PT_1_X 15 + //#define PROBE_PT_1_Y 180 + //#define PROBE_PT_2_X 15 + //#define PROBE_PT_2_Y 20 + //#define PROBE_PT_3_X 170 + //#define PROBE_PT_3_Y 20 +#endif + +/** + * Add a bed leveling sub-menu for ABL or MBL. + * Include a guided procedure if manual probing is enabled. + */ +//#define LCD_BED_LEVELING + +#if ENABLED(LCD_BED_LEVELING) + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points +#endif + +// Add a menu item to move between bed corners for manual bed adjustment +//#define LEVEL_BED_CORNERS + +#if ENABLED(LEVEL_BED_CORNERS) + #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling + //#define LEVEL_CENTER_TOO // Move to the center after the last corner +#endif + +/** + * Commands to execute at the end of G29 probing. + * Useful to retract or move the Z probe out of the way. + */ +//#define Z_PROBE_END_SCRIPT "G1 Z10 F12000\nG1 X15 Y330\nG1 Z0.5\nG1 Z10" + + +// @section homing + +// The center of the bed is at (X=0, Y=0) +//#define BED_CENTER_AT_0_0 + +// Manually set the home position. Leave these undefined for automatic settings. +// 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 + +// Use "Z Safe Homing" to avoid homing with a Z probe outside the bed area. +// +// With this feature enabled: +// +// - Allow Z homing only after X and Y homing AND stepper drivers still enabled. +// - If stepper drivers time out, it will need X and Y homing again before Z homing. +// - Move the Z probe (or nozzle) to a defined XY point before Z Homing when homing all axes (G28). +// - Prevent Z homing when the Z probe is outside bed area. +// +//#define Z_SAFE_HOMING + +#if ENABLED(Z_SAFE_HOMING) + #define Z_SAFE_HOMING_X_POINT ((X_BED_SIZE) / 2) // X point for Z homing when homing all axes (G28). + #define Z_SAFE_HOMING_Y_POINT ((Y_BED_SIZE) / 2) // Y point for Z homing when homing all axes (G28). +#endif + +// Homing speeds (mm/m) +#define HOMING_FEEDRATE_XY (50*60) +#define HOMING_FEEDRATE_Z (4*60) + +// Validate that endstops are triggered on homing moves +#define VALIDATE_HOMING_ENDSTOPS + +// @section calibrate + +/** + * Bed Skew Compensation + * + * This feature corrects for misalignment in the XYZ axes. + * + * Take the following steps to get the bed skew in the XY plane: + * 1. Print a test square (e.g., https://www.thingiverse.com/thing:2563185) + * 2. For XY_DIAG_AC measure the diagonal A to C + * 3. For XY_DIAG_BD measure the diagonal B to D + * 4. For XY_SIDE_AD measure the edge A to D + * + * Marlin automatically computes skew factors from these measurements. + * Skew factors may also be computed and set manually: + * + * - Compute AB : SQRT(2*AC*AC+2*BD*BD-4*AD*AD)/2 + * - XY_SKEW_FACTOR : TAN(PI/2-ACOS((AC*AC-AB*AB-AD*AD)/(2*AB*AD))) + * + * If desired, follow the same procedure for XZ and YZ. + * Use these diagrams for reference: + * + * Y Z Z + * ^ B-------C ^ B-------C ^ B-------C + * | / / | / / | / / + * | / / | / / | / / + * | A-------D | A-------D | A-------D + * +-------------->X +-------------->X +-------------->Y + * XY_SKEW_FACTOR XZ_SKEW_FACTOR YZ_SKEW_FACTOR + */ +//#define SKEW_CORRECTION + +#if ENABLED(SKEW_CORRECTION) + // Input all length measurements here: + #define XY_DIAG_AC 282.8427124746 + #define XY_DIAG_BD 282.8427124746 + #define XY_SIDE_AD 200 + + // Or, set the default skew factors directly here + // to override the above measurements: + #define XY_SKEW_FACTOR 0.0 + + //#define SKEW_CORRECTION_FOR_Z + #if ENABLED(SKEW_CORRECTION_FOR_Z) + #define XZ_DIAG_AC 282.8427124746 + #define XZ_DIAG_BD 282.8427124746 + #define YZ_DIAG_AC 282.8427124746 + #define YZ_DIAG_BD 282.8427124746 + #define YZ_SIDE_AD 200 + #define XZ_SKEW_FACTOR 0.0 + #define YZ_SKEW_FACTOR 0.0 + #endif + + // Enable this option for M852 to set skew at runtime + //#define SKEW_CORRECTION_GCODE +#endif + +//============================================================================= +//============================= Additional Features =========================== +//============================================================================= + +// @section extras + +// +// EEPROM +// +// The microcontroller can store settings in the EEPROM, e.g. max velocity... +// M500 - stores parameters in EEPROM +// M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily). +// M502 - reverts to the default "factory settings". You still need to store them in EEPROM afterwards if you want to. +// +//#define EEPROM_SETTINGS // Enable for M500 and M501 commands +//#define DISABLE_M503 // Saves ~2700 bytes of PROGMEM. Disable for release! +#define EEPROM_CHITCHAT // Give feedback on EEPROM commands. Disable to save PROGMEM. + +// +// Host Keepalive +// +// When enabled Marlin will send a busy status message to the host +// every couple of seconds when it can't accept commands. +// +#define HOST_KEEPALIVE_FEATURE // Disable this if your host doesn't like keepalive messages +#define DEFAULT_KEEPALIVE_INTERVAL 2 // Number of seconds between "busy" messages. Set with M113. +#define BUSY_WHILE_HEATING // Some hosts require "busy" messages even during heating + +// +// M100 Free Memory Watcher +// +//#define M100_FREE_MEMORY_WATCHER // Add M100 (Free Memory Watcher) to debug memory usage + +// +// G20/G21 Inch mode support +// +//#define INCH_MODE_SUPPORT + +// +// M149 Set temperature units support +// +//#define TEMPERATURE_UNITS_SUPPORT + +// @section temperature + +// Preheat Constants +#define PREHEAT_1_LABEL "PLA" +#define PREHEAT_1_TEMP_HOTEND 180 +#define PREHEAT_1_TEMP_BED 70 +#define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 + +#define PREHEAT_2_LABEL "ABS" +#define PREHEAT_2_TEMP_HOTEND 240 +#define PREHEAT_2_TEMP_BED 110 +#define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 + +/** + * Nozzle Park + * + * Park the nozzle at the given XYZ position on idle or G27. + * + * The "P" parameter controls the action applied to the Z axis: + * + * P0 (Default) If Z is below park Z raise the nozzle. + * P1 Raise the nozzle always to Z-park height. + * P2 Raise the nozzle by Z-park amount, limited to Z_MAX_POS. + */ +//#define NOZZLE_PARK_FEATURE + +#if ENABLED(NOZZLE_PARK_FEATURE) + // Specify a park position as { X, Y, Z } + #define NOZZLE_PARK_POINT { (X_MIN_POS + 10), (Y_MAX_POS - 10), 20 } + #define NOZZLE_PARK_XY_FEEDRATE 100 // X and Y axes feedrate in mm/s (also used for delta printers Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // Z axis feedrate in mm/s (not used for delta printers) +#endif + +/** + * Clean Nozzle Feature -- EXPERIMENTAL + * + * Adds the G12 command to perform a nozzle cleaning process. + * + * Parameters: + * P Pattern + * S Strokes / Repetitions + * T Triangles (P1 only) + * + * Patterns: + * P0 Straight line (default). This process requires a sponge type material + * at a fixed bed location. "S" specifies strokes (i.e. back-forth motions) + * between the start / end points. + * + * P1 Zig-zag pattern between (X0, Y0) and (X1, Y1), "T" specifies the + * number of zig-zag triangles to do. "S" defines the number of strokes. + * Zig-zags are done in whichever is the narrower dimension. + * For example, "G12 P1 S1 T3" will execute: + * + * -- + * | (X0, Y1) | /\ /\ /\ | (X1, Y1) + * | | / \ / \ / \ | + * A | | / \ / \ / \ | + * | | / \ / \ / \ | + * | (X0, Y0) | / \/ \/ \ | (X1, Y0) + * -- +--------------------------------+ + * |________|_________|_________| + * T1 T2 T3 + * + * P2 Circular pattern with middle at NOZZLE_CLEAN_CIRCLE_MIDDLE. + * "R" specifies the radius. "S" specifies the stroke count. + * Before starting, the nozzle moves to NOZZLE_CLEAN_START_POINT. + * + * Caveats: The ending Z should be the same as starting Z. + * Attention: EXPERIMENTAL. G-code arguments may change. + * + */ +//#define NOZZLE_CLEAN_FEATURE + +#if ENABLED(NOZZLE_CLEAN_FEATURE) + // Default number of pattern repetitions + #define NOZZLE_CLEAN_STROKES 12 + + // Default number of triangles + #define NOZZLE_CLEAN_TRIANGLES 3 + + // Specify positions as { X, Y, Z } + #define NOZZLE_CLEAN_START_POINT { 30, 30, (Z_MIN_POS + 1)} + #define NOZZLE_CLEAN_END_POINT {100, 60, (Z_MIN_POS + 1)} + + // Circular pattern radius + #define NOZZLE_CLEAN_CIRCLE_RADIUS 6.5 + // Circular pattern circle fragments number + #define NOZZLE_CLEAN_CIRCLE_FN 10 + // Middle point of circle + #define NOZZLE_CLEAN_CIRCLE_MIDDLE NOZZLE_CLEAN_START_POINT + + // Moves the nozzle to the initial position + #define NOZZLE_CLEAN_GOBACK +#endif + +/** + * Print Job Timer + * + * Automatically start and stop the print job timer on M104/M109/M190. + * + * M104 (hotend, no wait) - high temp = none, low temp = stop timer + * M109 (hotend, wait) - high temp = start timer, low temp = stop timer + * M190 (bed, wait) - high temp = start timer, low temp = none + * + * The timer can also be controlled with the following commands: + * + * M75 - Start the print job timer + * M76 - Pause the print job timer + * M77 - Stop the print job timer + */ +#define PRINTJOB_TIMER_AUTOSTART + +/** + * Print Counter + * + * Track statistical data such as: + * + * - Total print jobs + * - Total successful print jobs + * - Total failed print jobs + * - Total time printing + * + * View the current statistics with M78. + */ +//#define PRINTCOUNTER + +//============================================================================= +//============================= LCD and SD support ============================ +//============================================================================= + +// @section lcd + +/** + * LCD LANGUAGE + * + * Select the language to display on the LCD. These languages are available: + * + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + */ +#define LCD_LANGUAGE en + +/** + * LCD Character Set + * + * Note: This option is NOT applicable to Graphical Displays. + * + * All character-based LCDs provide ASCII plus one of these + * language extensions: + * + * - JAPANESE ... the most common + * - WESTERN ... with more accented characters + * - CYRILLIC ... for the Russian language + * + * To determine the language extension installed on your controller: + * + * - Compile and upload with LCD_LANGUAGE set to 'test' + * - Click the controller to view the LCD menu + * - The LCD will display Japanese, Western, or Cyrillic text + * + * See http://marlinfw.org/docs/development/lcd_language.html + * + * :['JAPANESE', 'WESTERN', 'CYRILLIC'] + */ +#define DISPLAY_CHARSET_HD44780 JAPANESE + +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + +/** + * SD CARD + * + * SD Card support is disabled by default. If your controller has an SD slot, + * you must uncomment the following option or it won't work. + * + */ +//#define SDSUPPORT + +/** + * SD CARD: SPI SPEED + * + * Enable one of the following items for a slower SPI transfer speed. + * This may be required to resolve "volume init" errors. + */ +//#define SPI_SPEED SPI_HALF_SPEED +//#define SPI_SPEED SPI_QUARTER_SPEED +//#define SPI_SPEED SPI_EIGHTH_SPEED + +/** + * SD CARD: ENABLE CRC + * + * Use CRC checks and retries on the SD communication. + */ +//#define SD_CHECK_AND_RETRY + +/** + * LCD Menu Items + * + * Disable all menus and only display the Status Screen, or + * just remove some extraneous menu items to recover space. + */ +//#define NO_LCD_MENUS +//#define SLIM_LCD_MENUS + +// +// ENCODER SETTINGS +// +// This option overrides the default number of encoder pulses needed to +// produce one step. Should be increased for high-resolution encoders. +// +//#define ENCODER_PULSES_PER_STEP 4 + +// +// Use this option to override the number of step signals required to +// move between next/prev menu items. +// +//#define ENCODER_STEPS_PER_MENU_ITEM 1 + +/** + * Encoder Direction Options + * + * Test your encoder's behavior first with both options disabled. + * + * Reversed Value Edit and Menu Nav? Enable REVERSE_ENCODER_DIRECTION. + * Reversed Menu Navigation only? Enable REVERSE_MENU_DIRECTION. + * Reversed Value Editing only? Enable BOTH options. + */ + +// +// This option reverses the encoder direction everywhere. +// +// Set this option if CLOCKWISE causes values to DECREASE +// +//#define REVERSE_ENCODER_DIRECTION + +// +// This option reverses the encoder direction for navigating LCD menus. +// +// If CLOCKWISE normally moves DOWN this makes it go UP. +// If CLOCKWISE normally moves UP this makes it go DOWN. +// +//#define REVERSE_MENU_DIRECTION + +// +// Individual Axis Homing +// +// Add individual axis homing items (Home X, Home Y, and Home Z) to the LCD menu. +// +//#define INDIVIDUAL_AXIS_HOMING_MENU + +// +// SPEAKER/BUZZER +// +// If you have a speaker that can produce tones, enable it here. +// By default Marlin assumes you have a buzzer with a fixed frequency. +// +//#define SPEAKER + +// +// The duration and frequency for the UI feedback sound. +// Set these to 0 to disable audio feedback in the LCD menus. +// +// Note: Test audio output with the G-Code: +// M300 S P +// +//#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 2 +//#define LCD_FEEDBACK_FREQUENCY_HZ 5000 + +//============================================================================= +//======================== LCD / Controller Selection ========================= +//======================== (Character-based LCDs) ========================= +//============================================================================= + +// +// RepRapDiscount Smart Controller. +// http://reprap.org/wiki/RepRapDiscount_Smart_Controller +// +// Note: Usually sold with a white PCB. +// +//#define REPRAP_DISCOUNT_SMART_CONTROLLER + +// +// Original RADDS LCD Display+Encoder+SDCardReader +// http://doku.radds.org/dokumentation/lcd-display/ +// +//#define RADDS_DISPLAY + +// +// ULTIMAKER Controller. +// +//#define ULTIMAKERCONTROLLER + +// +// ULTIPANEL as seen on Thingiverse. +// +//#define ULTIPANEL + +// +// PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3) +// http://reprap.org/wiki/PanelOne +// +//#define PANEL_ONE + +// +// GADGETS3D G3D LCD/SD Controller +// http://reprap.org/wiki/RAMPS_1.3/1.4_GADGETS3D_Shield_with_Panel +// +// Note: Usually sold with a blue PCB. +// +//#define G3D_PANEL + +// +// RigidBot Panel V1.0 +// http://www.inventapart.com/ +// +//#define RIGIDBOT_PANEL + +// +// Makeboard 3D Printer Parts 3D Printer Mini Display 1602 Mini Controller +// https://www.aliexpress.com/item/Micromake-Makeboard-3D-Printer-Parts-3D-Printer-Mini-Display-1602-Mini-Controller-Compatible-with-Ramps-1/32765887917.html +// +//#define MAKEBOARD_MINI_2_LINE_DISPLAY_1602 + +// +// ANET and Tronxy 20x4 Controller +// +//#define ZONESTAR_LCD // Requires ADC_KEYPAD_PIN to be assigned to an analog pin. + // This LCD is known to be susceptible to electrical interference + // which scrambles the display. Pressing any button clears it up. + // This is a LCD2004 display with 5 analog buttons. + +// +// Generic 16x2, 16x4, 20x2, or 20x4 character-based LCD. +// +//#define ULTRA_LCD + +//============================================================================= +//======================== LCD / Controller Selection ========================= +//===================== (I2C and Shift-Register LCDs) ===================== +//============================================================================= + +// +// CONTROLLER TYPE: I2C +// +// Note: These controllers require the installation of Arduino's LiquidCrystal_I2C +// library. For more info: https://github.com/kiyoshigawa/LiquidCrystal_I2C +// + +// +// Elefu RA Board Control Panel +// http://www.elefu.com/index.php?route=product/product&product_id=53 +// +//#define RA_CONTROL_PANEL + +// +// Sainsmart (YwRobot) LCD Displays +// +// These require F.Malpartida's LiquidCrystal_I2C library +// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home +// +//#define LCD_SAINSMART_I2C_1602 +//#define LCD_SAINSMART_I2C_2004 + +// +// Generic LCM1602 LCD adapter +// +//#define LCM1602 + +// +// PANELOLU2 LCD with status LEDs, +// separate encoder and click inputs. +// +// Note: This controller requires Arduino's LiquidTWI2 library v1.2.3 or later. +// For more info: https://github.com/lincomatic/LiquidTWI2 +// +// Note: The PANELOLU2 encoder click input can either be directly connected to +// a pin (if BTN_ENC defined to != -1) or read through I2C (when BTN_ENC == -1). +// +//#define LCD_I2C_PANELOLU2 + +// +// Panucatt VIKI LCD with status LEDs, +// integrated click & L/R/U/D buttons, separate encoder inputs. +// +//#define LCD_I2C_VIKI + +// +// CONTROLLER TYPE: Shift register panels +// + +// +// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// LCD configuration: http://reprap.org/wiki/SAV_3D_LCD +// +//#define SAV_3DLCD + +//============================================================================= +//======================= LCD / Controller Selection ======================= +//========================= (Graphical LCDs) ======================== +//============================================================================= + +// +// CONTROLLER TYPE: Graphical 128x64 (DOGM) +// +// IMPORTANT: The U8glib library is required for Graphical Display! +// https://github.com/olikraus/U8glib_Arduino +// + +// +// RepRapDiscount FULL GRAPHIC Smart Controller +// http://reprap.org/wiki/RepRapDiscount_Full_Graphic_Smart_Controller +// +//#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER + +// +// ReprapWorld Graphical LCD +// https://reprapworld.com/?products_details&products_id/1218 +// +//#define REPRAPWORLD_GRAPHICAL_LCD + +// +// Activate one of these if you have a Panucatt Devices +// Viki 2.0 or mini Viki with Graphic LCD +// http://panucatt.com +// +//#define VIKI2 +//#define miniVIKI + +// +// MakerLab Mini Panel with graphic +// controller and SD support - http://reprap.org/wiki/Mini_panel +// +//#define MINIPANEL + +// +// MaKr3d Makr-Panel with graphic controller and SD support. +// http://reprap.org/wiki/MaKr3d_MaKrPanel +// +//#define MAKRPANEL + +// +// Adafruit ST7565 Full Graphic Controller. +// https://github.com/eboston/Adafruit-ST7565-Full-Graphic-Controller/ +// +//#define ELB_FULL_GRAPHIC_CONTROLLER + +// +// BQ LCD Smart Controller shipped by +// default with the BQ Hephestos 2 and Witbox 2. +// +//#define BQ_LCD_SMART_CONTROLLER + +// +// Cartesio UI +// http://mauk.cc/webshop/cartesio-shop/electronics/user-interface +// +//#define CARTESIO_UI + +// +// LCD for Melzi Card with Graphical LCD +// +//#define LCD_FOR_MELZI + +// +// SSD1306 OLED full graphics generic display +// +//#define U8GLIB_SSD1306 + +// +// SAV OLEd LCD module support using either SSD1306 or SH1106 based LCD modules +// +//#define SAV_3DGLCD +#if ENABLED(SAV_3DGLCD) + //#define U8GLIB_SSD1306 + #define U8GLIB_SH1106 +#endif + +// +// Original Ulticontroller from Ultimaker 2 printer with SSD1309 I2C display and encoder +// https://github.com/Ultimaker/Ultimaker2/tree/master/1249_Ulticontroller_Board_(x1) +// +//#define ULTI_CONTROLLER + +// +// TinyBoy2 128x64 OLED / Encoder Panel +// +//#define OLED_PANEL_TINYBOY2 + +// +// MKS MINI12864 with graphic controller and SD support +// http://reprap.org/wiki/MKS_MINI_12864 +// +//#define MKS_MINI_12864 + +// +// Factory display for Creality CR-10 +// https://www.aliexpress.com/item/Universal-LCD-12864-3D-Printer-Display-Screen-With-Encoder-For-CR-10-CR-7-Model/32833148327.html +// +// This is RAMPS-compatible using a single 10-pin connector. +// (For CR-10 owners who want to replace the Melzi Creality board but retain the display) +// +//#define CR10_STOCKDISPLAY + +// +// ANET and Tronxy Graphical Controller +// +// Anet 128x64 full graphics lcd with rotary encoder as used on Anet A6 +// A clone of the RepRapDiscount full graphics display but with +// different pins/wiring (see pins_ANET_10.h). +// +//#define ANET_FULL_GRAPHICS_LCD + +// +// MKS OLED 1.3" 128 × 64 FULL GRAPHICS CONTROLLER +// http://reprap.org/wiki/MKS_12864OLED +// +// Tiny, but very sharp OLED display +// +//#define MKS_12864OLED // Uses the SH1106 controller (default) +//#define MKS_12864OLED_SSD1306 // Uses the SSD1306 controller + +// +// AZSMZ 12864 LCD with SD +// https://www.aliexpress.com/store/product/3D-printer-smart-controller-SMART-RAMPS-OR-RAMPS-1-4-LCD-12864-LCD-control-panel-green/2179173_32213636460.html +// +//#define AZSMZ_12864 + +// +// Silvergate GLCD controller +// http://github.com/android444/Silvergate +// +//#define SILVER_GATE_GLCD_CONTROLLER + +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + +//============================================================================= +//============================ Other Controllers ============================ +//============================================================================= + +// +// CONTROLLER TYPE: Standalone / Serial +// + +// +// LCD for Malyan M200 printers. +// +//#define MALYAN_LCD + +// +// CONTROLLER TYPE: Keypad / Add-on +// + +// +// RepRapWorld REPRAPWORLD_KEYPAD v1.1 +// http://reprapworld.com/?products_details&products_id=202&cPath=1591_1626 +// +// REPRAPWORLD_KEYPAD_MOVE_STEP sets how much should the robot move when a key +// is pressed, a value of 10.0 means 10mm per click. +// +//#define REPRAPWORLD_KEYPAD +//#define REPRAPWORLD_KEYPAD_MOVE_STEP 10.0 + +//============================================================================= +//=============================== Extra Features ============================== +//============================================================================= + +// @section extras + +// Increase the FAN PWM frequency. Removes the PWM noise but increases heating in the FET/Arduino +//#define FAST_PWM_FAN + +// Use software PWM to drive the fan, as for the heaters. This uses a very low frequency +// which is not as annoying as with the hardware PWM. On the other hand, if this frequency +// is too low, you should also increment SOFT_PWM_SCALE. +//#define FAN_SOFT_PWM + +// Incrementing this by 1 will double the software PWM frequency, +// affecting heaters, and the fan if FAN_SOFT_PWM is enabled. +// However, control resolution will be halved for each increment; +// at zero value, there are 128 effective control positions. +#define SOFT_PWM_SCALE 0 + +// If SOFT_PWM_SCALE is set to a value higher than 0, dithering can +// be used to mitigate the associated resolution loss. If enabled, +// some of the PWM cycles are stretched so on average the desired +// duty cycle is attained. +//#define SOFT_PWM_DITHER + +// Temperature status LEDs that display the hotend and bed temperature. +// If all hotends, bed temperature, and target temperature are under 54C +// then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) +//#define TEMP_STAT_LEDS + +// M240 Triggers a camera by emulating a Canon RC-1 Remote +// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ +//#define PHOTOGRAPH_PIN 23 + +// SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure +//#define SF_ARC_FIX + +// Support for the BariCUDA Paste Extruder +//#define BARICUDA + +// Support for BlinkM/CyzRgb +//#define BLINKM + +// Support for PCA9632 PWM LED driver +//#define PCA9632 + +/** + * RGB LED / LED Strip Control + * + * Enable support for an RGB LED connected to 5V digital pins, or + * an RGB Strip connected to MOSFETs controlled by digital pins. + * + * Adds the M150 command to set the LED (or LED strip) color. + * If pins are PWM capable (e.g., 4, 5, 6, 11) then a range of + * luminance values can be set from 0 to 255. + * For Neopixel LED an overall brightness parameter is also available. + * + * *** CAUTION *** + * LED Strips require a MOSFET Chip between PWM lines and LEDs, + * as the Arduino cannot handle the current the LEDs will require. + * Failure to follow this precaution can destroy your Arduino! + * NOTE: A separate 5V power supply is required! The Neopixel LED needs + * more current than the Arduino 5V linear regulator can produce. + * *** CAUTION *** + * + * LED Type. Enable only one of the following two options. + * + */ +//#define RGB_LED +//#define RGBW_LED + +#if ENABLED(RGB_LED) || ENABLED(RGBW_LED) + #define RGB_LED_R_PIN 34 + #define RGB_LED_G_PIN 43 + #define RGB_LED_B_PIN 35 + #define RGB_LED_W_PIN -1 +#endif + +// Support for Adafruit Neopixel LED driver +//#define NEOPIXEL_LED +#if ENABLED(NEOPIXEL_LED) + #define NEOPIXEL_TYPE NEO_GRBW // NEO_GRBW / NEO_GRB - four/three channel driver type (defined in Adafruit_NeoPixel.h) + #define NEOPIXEL_PIN 4 // LED driving pin on motherboard 4 => D4 (EXP2-5 on Printrboard) / 30 => PC7 (EXP3-13 on Rumba) + #define NEOPIXEL_PIXELS 30 // Number of LEDs in the strip + #define NEOPIXEL_IS_SEQUENTIAL // Sequential display for temperature change - LED by LED. Disable to change all LEDs at once. + #define NEOPIXEL_BRIGHTNESS 127 // Initial brightness (0-255) + //#define NEOPIXEL_STARTUP_TEST // Cycle through colors at startup +#endif + +/** + * Printer Event LEDs + * + * During printing, the LEDs will reflect the printer status: + * + * - Gradually change from blue to violet as the heated bed gets to target temp + * - Gradually change from violet to red as the hotend gets to temperature + * - Change to white to illuminate work surface + * - Change to green once print has finished + * - Turn off after the print has finished and the user has pushed a button + */ +#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632) || ENABLED(NEOPIXEL_LED) + #define PRINTER_EVENT_LEDS +#endif + +/** + * R/C SERVO support + * Sponsored by TrinityLabs, Reworked by codexmas + */ + +/** + * Number of servos + * + * For some servo-related options NUM_SERVOS will be set automatically. + * Set this manually if there are extra servos needing manual control. + * Leave undefined or set to 0 to entirely disable the servo subsystem. + */ +//#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command + +// Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle. +// 300ms is a good value but you can try less delay. +// If the servo can't reach the requested position, increase it. +#define SERVO_DELAY { 300 } + +// Only power servos during movement, otherwise leave off to prevent jitter +//#define DEACTIVATE_SERVOS_AFTER_MOVE + +// Allow servo angle to be edited and saved to EEPROM +//#define EDITABLE_SERVO_ANGLES diff --git a/Marlin/src/config/examples/ArmEd/Configuration_adv.h b/Marlin/src/config/examples/ArmEd/Configuration_adv.h new file mode 100644 index 0000000000..fadfb24102 --- /dev/null +++ b/Marlin/src/config/examples/ArmEd/Configuration_adv.h @@ -0,0 +1,1859 @@ +/** + * 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 . + * + */ +#pragma once + +/** + * Configuration_adv.h + * + * Advanced settings. + * Only change these if you know exactly what you're doing. + * Some of these settings can damage your printer if improperly set! + * + * Basic settings can be found in Configuration.h + * + */ +#define CONFIGURATION_ADV_H_VERSION 020000 + +// @section temperature + +//=========================================================================== +//=============================Thermal Settings ============================ +//=========================================================================== + +#define HEATER_BED_INVERTING true +#define HEATER_0_INVERTING true +#define HEATER_1_INVERTING true + +// +// Hephestos 2 24V heated bed upgrade kit. +// https://store.bq.com/en/heated-bed-kit-hephestos2 +// +//#define HEPHESTOS2_HEATED_BED_KIT +#if ENABLED(HEPHESTOS2_HEATED_BED_KIT) + #undef TEMP_SENSOR_BED + #define TEMP_SENSOR_BED 70 + #define HEATER_BED_INVERTING true +#endif + +#if DISABLED(PIDTEMPBED) + #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control + #if ENABLED(BED_LIMIT_SWITCHING) + #define BED_HYSTERESIS 2 // Only disable heating if T>target+BED_HYSTERESIS and enable heating if T>target-BED_HYSTERESIS + #endif +#endif + +/** + * Thermal Protection provides additional protection to your printer from damage + * and fire. Marlin always includes safe min and max temperature ranges which + * protect against a broken or disconnected thermistor wire. + * + * The issue: If a thermistor falls out, it will report the much lower + * temperature of the air in the room, and the the firmware will keep + * the heater on. + * + * The solution: Once the temperature reaches the target, start observing. + * If the temperature stays too far below the target (hysteresis) for too + * long (period), the firmware will halt the machine as a safety precaution. + * + * If you get false positives for "Thermal Runaway", increase + * THERMAL_PROTECTION_HYSTERESIS and/or THERMAL_PROTECTION_PERIOD + */ +#if ENABLED(THERMAL_PROTECTION_HOTENDS) + #define THERMAL_PROTECTION_PERIOD 40 // Seconds + #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius + + /** + * Whenever an M104, M109, or M303 increases the target temperature, the + * firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature + * hasn't increased by WATCH_TEMP_INCREASE degrees, the machine is halted and + * requires a hard reset. This test restarts with any M104/M109/M303, but only + * if the current temperature is far enough below the target for a reliable + * test. + * + * If you get false positives for "Heating failed", increase WATCH_TEMP_PERIOD + * and/or decrease WATCH_TEMP_INCREASE. WATCH_TEMP_INCREASE should not be set + * below 2. + */ + #define WATCH_TEMP_PERIOD 20 // Seconds + #define WATCH_TEMP_INCREASE 2 // Degrees Celsius +#endif + +/** + * Thermal Protection parameters for the bed are just as above for hotends. + */ +#if ENABLED(THERMAL_PROTECTION_BED) + #define THERMAL_PROTECTION_BED_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_BED_HYSTERESIS 2 // Degrees Celsius + + /** + * As described above, except for the bed (M140/M190/M303). + */ + #define WATCH_BED_TEMP_PERIOD 60 // Seconds + #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius +#endif + +#if ENABLED(PIDTEMP) + // this adds an experimental additional term to the heating power, proportional to the extrusion speed. + // if Kc is chosen well, the additional required power due to increased melting should be compensated. + //#define PID_EXTRUSION_SCALING + #if ENABLED(PID_EXTRUSION_SCALING) + #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) + #define LPQ_MAX_LEN 50 + #endif +#endif + +/** + * Automatic Temperature: + * The hotend target temperature is calculated by all the buffered lines of gcode. + * The maximum buffered steps/sec of the extruder motor is called "se". + * Start autotemp mode with M109 S B F + * The target temperature is set to mintemp+factor*se[steps/sec] and is limited by + * mintemp and maxtemp. Turn this off by executing M109 without F* + * Also, if the temperature is set to a value below mintemp, it will not be changed by autotemp. + * On an Ultimaker, some initial testing worked with M109 S215 B260 F1 in the start.gcode + */ +#define AUTOTEMP +#if ENABLED(AUTOTEMP) + #define AUTOTEMP_OLDWEIGHT 0.98 +#endif + +// Show extra position information in M114 +//#define M114_DETAIL + +// Show Temperature ADC value +// Enable for M105 to include ADC values read from temperature sensors. +//#define SHOW_TEMP_ADC_VALUES + +/** + * High Temperature Thermistor Support + * + * Thermistors able to support high temperature tend to have a hard time getting + * good readings at room and lower temperatures. This means HEATER_X_RAW_LO_TEMP + * will probably be caught when the heating element first turns on during the + * preheating process, which will trigger a min_temp_error as a safety measure + * and force stop everything. + * To circumvent this limitation, we allow for a preheat time (during which, + * min_temp_error won't be triggered) and add a min_temp buffer to handle + * aberrant readings. + * + * If you want to enable this feature for your hotend thermistor(s) + * uncomment and set values > 0 in the constants below + */ + +// The number of consecutive low temperature errors that can occur +// before a min_temp_error is triggered. (Shouldn't be more than 10.) +//#define MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED 0 + +// The number of milliseconds a hotend will preheat before starting to check +// the temperature. This value should NOT be set to the time it takes the +// hot end to reach the target temperature, but the time it takes to reach +// the minimum temperature your thermistor can read. The lower the better/safer. +// This shouldn't need to be more than 30 seconds (30000) +//#define MILLISECONDS_PREHEAT_TIME 0 + +// @section extruder + +// Extruder runout prevention. +// If the machine is idle and the temperature over MINTEMP +// then extrude some filament every couple of SECONDS. +//#define EXTRUDER_RUNOUT_PREVENT +#if ENABLED(EXTRUDER_RUNOUT_PREVENT) + #define EXTRUDER_RUNOUT_MINTEMP 190 + #define EXTRUDER_RUNOUT_SECONDS 30 + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) +#endif + +// @section temperature + +// Calibration for AD595 / AD8495 sensor to adjust temperature measurements. +// The final temperature is calculated as (measuredTemp * GAIN) + OFFSET. +#define TEMP_SENSOR_AD595_OFFSET 0.0 +#define TEMP_SENSOR_AD595_GAIN 1.0 +#define TEMP_SENSOR_AD8495_OFFSET 0.0 +#define TEMP_SENSOR_AD8495_GAIN 1.0 + +/** + * Controller Fan + * To cool down the stepper drivers and MOSFETs. + * + * The fan will turn on automatically whenever any stepper is enabled + * and turn off after a set period after all steppers are turned off. + */ +//#define USE_CONTROLLER_FAN +#if ENABLED(USE_CONTROLLER_FAN) + //#define CONTROLLER_FAN_PIN -1 // Set a custom pin for the controller fan + #define CONTROLLERFAN_SECS 60 // Duration in seconds for the fan to run after all motors are disabled + #define CONTROLLERFAN_SPEED 255 // 255 == full speed +#endif + +// When first starting the main fan, run it at full speed for the +// given number of milliseconds. This gets the fan spinning reliably +// before setting a PWM value. (Does not work with software PWM for fan on Sanguinololu) +//#define FAN_KICKSTART_TIME 100 + +/** + * PWM Fan Scaling + * + * Define the min/max speeds for PWM fans (as set with M106). + * + * With these options the M106 0-255 value range is scaled to a subset + * to ensure that the fan has enough power to spin, or to run lower + * current fans with higher current. (e.g., 5V/12V fans with 12V/24V) + * Value 0 always turns off the fan. + * + * Define one or both of these to override the default 0-255 range. + */ +//#define FAN_MIN_PWM 50 +//#define FAN_MAX_PWM 128 + +// @section extruder + +/** + * Extruder cooling fans + * + * Extruder auto fans automatically turn on when their extruders' + * temperatures go above EXTRUDER_AUTO_FAN_TEMPERATURE. + * + * Your board's pins file specifies the recommended pins. Override those here + * or set to -1 to disable completely. + * + * Multiple extruders can be assigned to the same pin in which case + * the fan will turn on when any selected extruder is above the threshold. + */ +#define E0_AUTO_FAN_PIN -1 +#define E1_AUTO_FAN_PIN -1 +#define E2_AUTO_FAN_PIN -1 +#define E3_AUTO_FAN_PIN -1 +#define E4_AUTO_FAN_PIN -1 +#define E5_AUTO_FAN_PIN -1 +#define CHAMBER_AUTO_FAN_PIN -1 +#define EXTRUDER_AUTO_FAN_TEMPERATURE 50 +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed + +/** + * Part-Cooling Fan Multiplexer + * + * This feature allows you to digitally multiplex the fan output. + * The multiplexer is automatically switched at tool-change. + * Set FANMUX[012]_PINs below for up to 2, 4, or 8 multiplexed fans. + */ +#define FANMUX0_PIN -1 +#define FANMUX1_PIN -1 +#define FANMUX2_PIN -1 + +/** + * M355 Case Light on-off / brightness + */ +//#define CASE_LIGHT_ENABLE +#if ENABLED(CASE_LIGHT_ENABLE) + //#define CASE_LIGHT_PIN 4 // Override the default pin if needed + #define INVERT_CASE_LIGHT false // Set true if Case Light is ON when pin is LOW + #define CASE_LIGHT_DEFAULT_ON true // Set default power-up state on + #define CASE_LIGHT_DEFAULT_BRIGHTNESS 105 // Set default power-up brightness (0-255, requires PWM pin) + //#define MENU_ITEM_CASE_LIGHT // Add a Case Light option to the LCD main menu + //#define CASE_LIGHT_USE_NEOPIXEL // Use Neopixel LED as case light, requires NEOPIXEL_LED. + #if ENABLED(CASE_LIGHT_USE_NEOPIXEL) + #define CASE_LIGHT_NEOPIXEL_COLOR { 255, 255, 255, 255 } // { Red, Green, Blue, White } + #endif +#endif + +//=========================================================================== +//============================ Mechanical Settings ========================== +//=========================================================================== + +// @section homing + +// If you want endstops to stay on (by default) even when not homing +// enable this option. Override at any time with M120, M121. +//#define ENDSTOPS_ALWAYS_ON_DEFAULT + +// @section extras + +//#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats. + +// Employ an external closed loop controller. Override pins here if needed. +//#define EXTERNAL_CLOSED_LOOP_CONTROLLER +#if ENABLED(EXTERNAL_CLOSED_LOOP_CONTROLLER) + //#define CLOSED_LOOP_ENABLE_PIN -1 + //#define CLOSED_LOOP_MOVE_COMPLETE_PIN -1 +#endif + +/** + * Dual Steppers / Dual Endstops + * + * This section will allow you to use extra E drivers to drive a second motor for X, Y, or Z axes. + * + * For example, set X_DUAL_STEPPER_DRIVERS setting to use a second motor. If the motors need to + * spin in opposite directions set INVERT_X2_VS_X_DIR. If the second motor needs its own endstop + * set X_DUAL_ENDSTOPS. This can adjust for "racking." Use X2_USE_ENDSTOP to set the endstop plug + * that should be used for the second endstop. Extra endstops will appear in the output of 'M119'. + * + * Use X_DUAL_ENDSTOP_ADJUSTMENT to adjust for mechanical imperfection. After homing both motors + * this offset is applied to the X2 motor. To find the offset home the X axis, and measure the error + * in X2. Dual endstop offsets can be set at runtime with 'M666 X Y Z'. + */ + +//#define X_DUAL_STEPPER_DRIVERS +#if ENABLED(X_DUAL_STEPPER_DRIVERS) + #define INVERT_X2_VS_X_DIR true // Set 'true' if X motors should rotate in opposite directions + //#define X_DUAL_ENDSTOPS + #if ENABLED(X_DUAL_ENDSTOPS) + #define X2_USE_ENDSTOP _XMAX_ + #define X_DUAL_ENDSTOPS_ADJUSTMENT 0 + #endif +#endif + +//#define Y_DUAL_STEPPER_DRIVERS +#if ENABLED(Y_DUAL_STEPPER_DRIVERS) + #define INVERT_Y2_VS_Y_DIR true // Set 'true' if Y motors should rotate in opposite directions + //#define Y_DUAL_ENDSTOPS + #if ENABLED(Y_DUAL_ENDSTOPS) + #define Y2_USE_ENDSTOP _YMAX_ + #define Y_DUAL_ENDSTOPS_ADJUSTMENT 0 + #endif +#endif + +//#define Z_DUAL_STEPPER_DRIVERS +#if ENABLED(Z_DUAL_STEPPER_DRIVERS) + //#define Z_DUAL_ENDSTOPS + #if ENABLED(Z_DUAL_ENDSTOPS) + #define Z2_USE_ENDSTOP _XMAX_ + #define Z_DUAL_ENDSTOPS_ADJUSTMENT 0 + #endif +#endif + +//#define Z_TRIPLE_STEPPER_DRIVERS +#if ENABLED(Z_TRIPLE_STEPPER_DRIVERS) + //#define Z_TRIPLE_ENDSTOPS + #if ENABLED(Z_TRIPLE_ENDSTOPS) + #define Z2_USE_ENDSTOP _XMAX_ + #define Z3_USE_ENDSTOP _YMAX_ + #define Z_TRIPLE_ENDSTOPS_ADJUSTMENT2 0 + #define Z_TRIPLE_ENDSTOPS_ADJUSTMENT3 0 + #endif +#endif + +/** + * Dual X Carriage + * + * This setup has two X carriages that can move independently, each with its own hotend. + * The carriages can be used to print an object with two colors or materials, or in + * "duplication mode" it can print two identical or X-mirrored objects simultaneously. + * The inactive carriage is parked automatically to prevent oozing. + * X1 is the left carriage, X2 the right. They park and home at opposite ends of the X axis. + * By default the X2 stepper is assigned to the first unused E plug on the board. + */ +//#define DUAL_X_CARRIAGE +#if ENABLED(DUAL_X_CARRIAGE) + #define X1_MIN_POS X_MIN_POS // set minimum to ensure first x-carriage doesn't hit the parked second X-carriage + #define X1_MAX_POS X_BED_SIZE // set maximum to ensure first x-carriage doesn't hit the parked second X-carriage + #define X2_MIN_POS 80 // set minimum to ensure second x-carriage doesn't hit the parked first X-carriage + #define X2_MAX_POS 353 // set maximum to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // the second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // default home position is the maximum carriage position + // However: In this mode the HOTEND_OFFSET_X value for the second extruder provides a software + // override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops + // without modifying the firmware (through the "M218 T1 X???" command). + // Remember: you should set the second extruder x-offset to 0 in your slicer. + + // There are a few selectable movement modes for dual x-carriages using M605 S + // Mode 0 (DXC_FULL_CONTROL_MODE): 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 S0) + // Mode 1 (DXC_AUTO_PARK_MODE) : Auto-park mode. The firmware will automatically park and unpark the x-carriages on tool changes so + // that additional slicer support is not required. (M605 S1) + // Mode 2 (DXC_DUPLICATION_MODE) : Duplication mode. The firmware will transparently make the second x-carriage and extruder copy all + // actions of the first x-carriage. This allows the printer to print 2 arbitrary items at + // once. (2nd extruder x offset and temp offset are set using: M605 S2 [Xnnn] [Rmmm]) + + // This is the default power-up mode which can be later using M605. + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + + // Default x offset in duplication mode (typically set to half print bed width) + #define DEFAULT_DUPLICATION_X_OFFSET 100 + +#endif // DUAL_X_CARRIAGE + +// Activate a solenoid on the active extruder with M380. Disable all with M381. +// Define SOL0_PIN, SOL1_PIN, etc., for each extruder that has a solenoid. +//#define EXT_SOLENOID + +// @section homing + +// Homing hits each endstop, retracts by these distances, then does a slower bump. +#define X_HOME_BUMP_MM 5 +#define Y_HOME_BUMP_MM 5 +#define Z_HOME_BUMP_MM 2 +#define HOMING_BUMP_DIVISOR { 2, 2, 4 } // Re-Bump Speed Divisor (Divides the Homing Feedrate) +//#define QUICK_HOME // If homing includes X and Y, do a diagonal move initially + +// When G28 is called, this option will make Y home before X +//#define HOME_Y_BEFORE_X + +// Enable this if X or Y can't home without homing the other axis first. +//#define CODEPENDENT_XY_HOMING + +// @section machine + +#define AXIS_RELATIVE_MODES {false, false, false, false} + +// Allow duplication mode with a basic dual-nozzle extruder +//#define DUAL_NOZZLE_DUPLICATION_MODE + +// By default pololu step drivers require an active high signal. However, some high power drivers require an active low signal as step. +#define INVERT_X_STEP_PIN false +#define INVERT_Y_STEP_PIN false +#define INVERT_Z_STEP_PIN false +#define INVERT_E_STEP_PIN false + +// Default stepper release if idle. Set to 0 to deactivate. +// Steppers will shut down DEFAULT_STEPPER_DEACTIVE_TIME seconds after the last move when DISABLE_INACTIVE_? is true. +// Time can be set by M18 and M84. +#define DEFAULT_STEPPER_DEACTIVE_TIME 120 +#define DISABLE_INACTIVE_X true +#define DISABLE_INACTIVE_Y true +#define DISABLE_INACTIVE_Z true // set to false if the nozzle will fall down on your printed part when print has finished. +#define DISABLE_INACTIVE_E true + +#define DEFAULT_MINIMUMFEEDRATE 0.0 // minimum feedrate +#define DEFAULT_MINTRAVELFEEDRATE 0.0 + +//#define HOME_AFTER_DEACTIVATE // Require rehoming after steppers are deactivated + +// @section lcd + +#if ENABLED(ULTIPANEL) + #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel + #define MANUAL_E_MOVES_RELATIVE // Show LCD extruder moves as relative rather than absolute positions + #define ULTIPANEL_FEEDMULTIPLY // Comment to disable setting feedrate multiplier via encoder +#endif + +// @section extras + +// minimum time in microseconds that a movement needs to take if the buffer is emptied. +#define DEFAULT_MINSEGMENTTIME 20000 + +// If defined the movements slow down when the look ahead buffer is only half full +#define SLOWDOWN + +// Frequency limit +// See nophead's blog for more info +// Not working O +//#define XY_FREQUENCY_LIMIT 15 + +// Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end +// of the buffer and all stops. This should not be much greater than zero and should only be changed +// if unwanted behavior is observed on a user's machine when running at very slow speeds. +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) + +// +// Use Junction Deviation instead of traditional Jerk Limiting +// +//#define JUNCTION_DEVIATION +#if ENABLED(JUNCTION_DEVIATION) + #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +#endif + +/** + * Adaptive Step Smoothing increases the resolution of multi-axis moves, particularly at step frequencies + * below 1kHz (for AVR) or 10kHz (for ARM), where aliasing between axes in multi-axis moves causes audible + * vibration and surface artifacts. The algorithm adapts to provide the best possible step smoothing at the + * lowest stepping frequencies. + */ +//#define ADAPTIVE_STEP_SMOOTHING + +// Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. +#define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] + +/** + * @section stepper motor current + * + * Some boards have a means of setting the stepper motor current via firmware. + * + * The power on motor currents are set by: + * PWM_MOTOR_CURRENT - used by MINIRAMBO & ULTIMAIN_2 + * known compatible chips: A4982 + * DIGIPOT_MOTOR_CURRENT - used by BQ_ZUM_MEGA_3D, RAMBO & SCOOVO_X9H + * known compatible chips: AD5206 + * DAC_MOTOR_CURRENT_DEFAULT - used by PRINTRBOARD_REVF & RIGIDBOARD_V2 + * known compatible chips: MCP4728 + * DIGIPOT_I2C_MOTOR_CURRENTS - used by 5DPRINT, AZTEEG_X3_PRO, AZTEEG_X5_MINI_WIFI, MIGHTYBOARD_REVE + * known compatible chips: MCP4451, MCP4018 + * + * Motor currents can also be set by M907 - M910 and by the LCD. + * M907 - applies to all. + * M908 - BQ_ZUM_MEGA_3D, RAMBO, PRINTRBOARD_REVF, RIGIDBOARD_V2 & SCOOVO_X9H + * M909, M910 & LCD - only PRINTRBOARD_REVF & RIGIDBOARD_V2 + */ +//#define PWM_MOTOR_CURRENT { 1300, 1300, 1250 } // Values in milliamps +//#define DIGIPOT_MOTOR_CURRENT { 135,135,135,135,135 } // Values 0-255 (RAMBO 135 = ~0.75A, 185 = ~1A) +//#define DAC_MOTOR_CURRENT_DEFAULT { 70, 80, 90, 80 } // Default drive percent - X, Y, Z, E axis + +// Use an I2C based DIGIPOT (e.g., Azteeg X3 Pro) +//#define DIGIPOT_I2C +#if ENABLED(DIGIPOT_I2C) && !defined(DIGIPOT_I2C_ADDRESS_A) + /** + * Common slave addresses: + * + * A (A shifted) B (B shifted) IC + * Smoothie 0x2C (0x58) 0x2D (0x5A) MCP4451 + * AZTEEG_X3_PRO 0x2C (0x58) 0x2E (0x5C) MCP4451 + * AZTEEG_X5_MINI_WIFI 0x58 0x5C MCP4451 + * MIGHTYBOARD_REVE 0x2F (0x5E) MCP4018 + */ + #define DIGIPOT_I2C_ADDRESS_A 0x2C // unshifted slave address for first DIGIPOT + #define DIGIPOT_I2C_ADDRESS_B 0x2D // unshifted slave address for second DIGIPOT +#endif + +//#define DIGIPOT_MCP4018 // Requires library from https://github.com/stawel/SlowSoftI2CMaster +#define DIGIPOT_I2C_NUM_CHANNELS 8 // 5DPRINT: 4 AZTEEG_X3_PRO: 8 MKS SBASE: 5 +// Actual motor currents in Amps. The number of entries must match DIGIPOT_I2C_NUM_CHANNELS. +// These correspond to the physical drivers, so be mindful if the order is changed. +#define DIGIPOT_I2C_MOTOR_CURRENTS { 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 } // AZTEEG_X3_PRO + +//=========================================================================== +//=============================Additional Features=========================== +//=========================================================================== + +// @section lcd + +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + +// Include a page of printer information in the LCD Main Menu +//#define LCD_INFO_MENU + +// Scroll a longer status message into view +//#define STATUS_MESSAGE_SCROLLING + +// On the Info Screen, display XY with one decimal place when possible +//#define LCD_DECIMAL_SMALL_XY + +// The timeout (in ms) to return to the status screen from sub-menus +//#define LCD_TIMEOUT_TO_STATUS 15000 + +// Add an 'M73' G-code to set the current percentage +//#define LCD_SET_PROGRESS_MANUALLY + +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS + //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing + #if ENABLED(LCD_PROGRESS_BAR) + #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar + #define PROGRESS_BAR_MSG_TIME 3000 // (ms) Amount of time to show the status message + #define PROGRESS_MSG_EXPIRE 0 // (ms) Amount of time to retain the status message (0=forever) + //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it + //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar + #endif +#endif // HAS_PRINT_PROGRESS + +/** + * LED Control Menu + * Enable this feature to add LED Control to the LCD menu + */ +//#define LED_CONTROL_MENU +#if ENABLED(LED_CONTROL_MENU) + #define LED_COLOR_PRESETS // Enable the Preset Color menu option + #if ENABLED(LED_COLOR_PRESETS) + #define LED_USER_PRESET_RED 255 // User defined RED value + #define LED_USER_PRESET_GREEN 128 // User defined GREEN value + #define LED_USER_PRESET_BLUE 0 // User defined BLUE value + #define LED_USER_PRESET_WHITE 255 // User defined WHITE value + #define LED_USER_PRESET_BRIGHTNESS 255 // User defined intensity + //#define LED_USER_PRESET_STARTUP // Have the printer display the user preset color on startup + #endif +#endif // LED_CONTROL_MENU + +#if ENABLED(SDSUPPORT) + + // Some RAMPS and other boards don't detect when an SD card is inserted. You can work + // around this by connecting a push button or single throw switch to the pin defined + // as SD_DETECT_PIN in your board's pins definitions. + // This setting should be disabled unless you are using a push button, pulling the pin to ground. + // Note: This is always disabled for ULTIPANEL (except ELB_FULL_GRAPHIC_CONTROLLER). + #define SD_DETECT_INVERTED + + #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. + + // Reverse SD sort to show "more recent" files first, according to the card's FAT. + // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. + #define SDCARD_RATHERRECENTFIRST + + // Add an option in the menu to run all auto#.g files + //#define MENU_ADDAUTOSTART + + /** + * Continue after Power-Loss (Creality3D) + * + * Store the current state to the SD Card at the start of each layer + * during SD printing. If the recovery file is found at boot time, present + * an option on the LCD screen to continue the print from the last-known + * point in the file. + */ + //#define POWER_LOSS_RECOVERY + #if ENABLED(POWER_LOSS_RECOVERY) + //#define POWER_LOSS_PIN 44 // Pin to detect power loss + //#define POWER_LOSS_STATE HIGH // State of pin indicating power loss + #endif + + /** + * Sort SD file listings in alphabetical order. + * + * With this option enabled, items on SD cards will be sorted + * by name for easier navigation. + * + * By default... + * + * - Use the slowest -but safest- method for sorting. + * - Folders are sorted to the top. + * - The sort key is statically allocated. + * - No added G-code (M34) support. + * - 40 item sorting limit. (Items after the first 40 are unsorted.) + * + * SD sorting uses static allocation (as set by SDSORT_LIMIT), allowing the + * compiler to calculate the worst-case usage and throw an error if the SRAM + * limit is exceeded. + * + * - SDSORT_USES_RAM provides faster sorting via a static directory buffer. + * - SDSORT_USES_STACK does the same, but uses a local stack-based buffer. + * - SDSORT_CACHE_NAMES will retain the sorted file listing in RAM. (Expensive!) + * - SDSORT_DYNAMIC_RAM only uses RAM when the SD menu is visible. (Use with caution!) + */ + //#define SDCARD_SORT_ALPHA + + // SD Card Sorting options + #if ENABLED(SDCARD_SORT_ALPHA) + #define SDSORT_LIMIT 40 // Maximum number of sorted items (10-256). Costs 27 bytes each. + #define FOLDER_SORTING -1 // -1=above 0=none 1=below + #define SDSORT_GCODE false // Allow turning sorting on/off with LCD and M34 g-code. + #define SDSORT_USES_RAM false // Pre-allocate a static array for faster pre-sorting. + #define SDSORT_USES_STACK false // Prefer the stack for pre-sorting to give back some SRAM. (Negated by next 2 options.) + #define SDSORT_CACHE_NAMES false // Keep sorted items in RAM longer for speedy performance. Most expensive option. + #define SDSORT_DYNAMIC_RAM false // Use dynamic allocation (within SD menus). Least expensive option. Set SDSORT_LIMIT before use! + #define SDSORT_CACHE_VFATS 2 // Maximum number of 13-byte VFAT entries to use for sorting. + // Note: Only affects SCROLL_LONG_FILENAMES with SDSORT_CACHE_NAMES but not SDSORT_DYNAMIC_RAM. + #endif + + // This allows hosts to request long names for files and folders with M33 + //#define LONG_FILENAME_HOST_SUPPORT + + // Enable this option to scroll long filenames in the SD card menu + //#define SCROLL_LONG_FILENAMES + + /** + * This option allows you to abort SD printing when any endstop is triggered. + * This feature must be enabled with "M540 S1" or from the LCD menu. + * To have any effect, endstops must be enabled during SD printing. + */ + //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED + + /** + * This option makes it easier to print the same SD Card file again. + * On print completion the LCD Menu will open with the file selected. + * You can just click to start the print, or navigate elsewhere. + */ + //#define SD_REPRINT_LAST_SELECTED_FILE + + /** + * Auto-report SdCard status with M27 S + */ + //#define AUTO_REPORT_SD_STATUS + + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + +#endif // SDSUPPORT + +/** + * Additional options for Graphical Displays + * + * Use the optimizations here to improve printing performance, + * which can be adversely affected by graphical display drawing, + * especially when doing several short moves, and when printing + * on DELTA and SCARA machines. + * + * Some of these options may result in the display lagging behind + * controller events, as there is a trade-off between reliable + * printing performance versus fast display updates. + */ +#if HAS_GRAPHICAL_LCD + // Show SD percentage next to the progress bar + //#define DOGM_SD_PERCENT + + // Enable to save many cycles by drawing a hollow frame on the Info Screen + #define XYZ_HOLLOW_FRAME + + // Enable to save many cycles by drawing a hollow frame on Menu Screens + #define MENU_HOLLOW_FRAME + + // A bigger font is available for edit items. Costs 3120 bytes of PROGMEM. + // Western only. Not available for Cyrillic, Kana, Turkish, Greek, or Chinese. + //#define USE_BIG_EDIT_FONT + + // A smaller font may be used on the Info Screen. Costs 2300 bytes of PROGMEM. + // Western only. Not available for Cyrillic, Kana, Turkish, Greek, or Chinese. + //#define USE_SMALL_INFOFONT + + // Enable this option and reduce the value to optimize screen updates. + // The normal delay is 10µs. Use the lowest value that still gives a reliable display. + //#define DOGM_SPI_DELAY_US 5 + + // Swap the CW/CCW indicators in the graphics overlay + //#define OVERLAY_GFX_REVERSE + + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + * + * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. + * This will prevent position updates from being displayed. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + +#endif // DOGLCD + +// @section safety + +// The hardware watchdog should reset the microcontroller disabling all outputs, +// in case the firmware gets stuck and doesn't do temperature regulation. +#define USE_WATCHDOG + +#if ENABLED(USE_WATCHDOG) + // If you have a watchdog reboot in an ArduinoMega2560 then the device will hang forever, as a watchdog reset will leave the watchdog on. + // The "WATCHDOG_RESET_MANUAL" goes around this by not using the hardware reset. + // However, THIS FEATURE IS UNSAFE!, as it will only work if interrupts are disabled. And the code could hang in an interrupt routine with interrupts disabled. + //#define WATCHDOG_RESET_MANUAL +#endif + +// @section lcd + +/** + * Babystepping enables movement of the axes by tiny increments without changing + * the current position values. This feature is used primarily to adjust the Z + * axis in the first layer of a print in real-time. + * + * Warning: Does not respect endstops! + */ +//#define BABYSTEPPING +#if ENABLED(BABYSTEPPING) + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. + + //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping + #if ENABLED(BABYSTEP_ZPROBE_OFFSET) + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + #endif +#endif + +// @section extruder + +/** + * Linear Pressure Control v1.5 + * + * Assumption: advance [steps] = k * (delta velocity [steps/s]) + * K=0 means advance disabled. + * + * NOTE: K values for LIN_ADVANCE 1.5 differ from earlier versions! + * + * Set K around 0.22 for 3mm PLA Direct Drive with ~6.5cm between the drive gear and heatbreak. + * Larger K values will be needed for flexible filament and greater distances. + * If this algorithm produces a higher speed offset than the extruder can handle (compared to E jerk) + * print acceleration will be reduced during the affected moves to keep within the limit. + * + * See http://marlinfw.org/docs/features/lin_advance.html for full instructions. + * Mention @Sebastianv650 on GitHub to alert the author of any issues. + */ +//#define LIN_ADVANCE +#if ENABLED(LIN_ADVANCE) + #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed + //#define LA_DEBUG // If enabled, this will generate debug information output over USB. +#endif + +// @section leveling + +#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_UBL) + // Override the mesh area if the automatic (max) area is too large + //#define MESH_MIN_X MESH_INSET + //#define MESH_MIN_Y MESH_INSET + //#define MESH_MAX_X X_BED_SIZE - (MESH_INSET) + //#define MESH_MAX_Y Y_BED_SIZE - (MESH_INSET) +#endif + +/** + * Repeatedly attempt G29 leveling until it succeeds. + * Stop after G29_MAX_RETRIES attempts. + */ +//#define G29_RETRY_AND_RECOVER +#if ENABLED(G29_RETRY_AND_RECOVER) + #define G29_MAX_RETRIES 3 + #define G29_HALT_ON_FAILURE + /** + * Specify the GCODE commands that will be executed when leveling succeeds, + * between attempts, and after the maximum number of retries have been tried. + */ + #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." + #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" + #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" + /** + * Specify an action command to send to the host on a recovery attempt or failure. + * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. + * The host must be configured to handle the action command. + */ + #define G29_ACTION_ON_RECOVER "probe_rewipe" + #define G29_ACTION_ON_FAILURE "probe_failed" +#endif + +// @section extras + +// +// G2/G3 Arc Support +// +#define ARC_SUPPORT // Disable this feature to save ~3226 bytes +#if ENABLED(ARC_SUPPORT) + #define MM_PER_ARC_SEGMENT 1 // Length of each arc segment + #define N_ARC_CORRECTION 25 // Number of intertpolated segments between corrections + //#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles + //#define CNC_WORKSPACE_PLANES // Allow G2/G3 to operate in XY, ZX, or YZ planes +#endif + +// Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes. +//#define BEZIER_CURVE_SUPPORT + +// G38.2 and G38.3 Probe Target +// Set MULTIPLE_PROBING if you want G38 to double touch +//#define G38_PROBE_TARGET +#if ENABLED(G38_PROBE_TARGET) + #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move) +#endif + +// Moves (or segments) with fewer steps than this will be joined with the next move +#define MIN_STEPS_PER_SEGMENT 6 + +/** + * Minimum delay after setting the stepper DIR (in ns) + * 0 : No delay (Expect at least 10µS since one Stepper ISR must transpire) + * 20 : Minimum for TMC2xxx drivers + * 200 : Minimum for A4988 drivers + * 400 : Minimum for A5984 drivers + * 500 : Minimum for LV8729 drivers (guess, no info in datasheet) + * 650 : Minimum for DRV8825 drivers + * 1500 : Minimum for TB6600 drivers (guess, no info in datasheet) + * 15000 : Minimum for TB6560 drivers (guess, no info in datasheet) + * + * Override the default value based on the driver type set in Configuration.h. + */ +//#define MINIMUM_STEPPER_DIR_DELAY 650 + +/** + * Minimum stepper driver pulse width (in µs) + * 0 : Smallest possible width the MCU can produce, compatible with TMC2xxx drivers + * 1 : Minimum for A4988, A5984, and LV8729 stepper drivers + * 2 : Minimum for DRV8825 stepper drivers + * 3 : Minimum for TB6600 stepper drivers + * 30 : Minimum for TB6560 stepper drivers + * + * Override the default value based on the driver type set in Configuration.h. + */ +//#define MINIMUM_STEPPER_PULSE 2 + +/** + * Maximum stepping rate (in Hz) the stepper driver allows + * If undefined, defaults to 1MHz / (2 * MINIMUM_STEPPER_PULSE) + * 500000 : Maximum for A4988 stepper driver + * 400000 : Maximum for TMC2xxx stepper drivers + * 250000 : Maximum for DRV8825 stepper driver + * 150000 : Maximum for TB6600 stepper driver + * 130000 : Maximum for LV8729 stepper driver + * 15000 : Maximum for TB6560 stepper driver + * + * Override the default value based on the driver type set in Configuration.h. + */ +//#define MAXIMUM_STEPPER_RATE 250000 + +// @section temperature + +// Control heater 0 and heater 1 in parallel. +//#define HEATERS_PARALLEL + +//=========================================================================== +//================================= Buffers ================================= +//=========================================================================== + +// @section hidden + +// The number of linear motions that can be in the plan at any give time. +// THE BLOCK_BUFFER_SIZE NEEDS TO BE A POWER OF 2 (e.g. 8, 16, 32) because shifts and ors are used to do the ring-buffering. +#if ENABLED(SDSUPPORT) + #define BLOCK_BUFFER_SIZE 16 // SD,LCD,Buttons take more memory, block buffer needs to be smaller +#else + #define BLOCK_BUFFER_SIZE 16 // maximize block buffer +#endif + +// @section serial + +// The ASCII buffer for serial input +#define MAX_CMD_SIZE 96 +#define BUFSIZE 4 + +// Transmission to Host Buffer Size +// To save 386 bytes of PROGMEM (and TX_BUFFER_SIZE+3 bytes of RAM) set to 0. +// To buffer a simple "ok" you need 4 bytes. +// For ADVANCED_OK (M105) you need 32 bytes. +// For debug-echo: 128 bytes for the optimal speed. +// Other output doesn't need to be that speedy. +// :[0, 2, 4, 8, 16, 32, 64, 128, 256] +#define TX_BUFFER_SIZE 0 + +// Host Receive Buffer Size +// Without XON/XOFF flow control (see SERIAL_XON_XOFF below) 32 bytes should be enough. +// To use flow control, set this buffer size to at least 1024 bytes. +// :[0, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048] +//#define RX_BUFFER_SIZE 1024 + +#if RX_BUFFER_SIZE >= 1024 + // Enable to have the controller send XON/XOFF control characters to + // the host to signal the RX buffer is becoming full. + //#define SERIAL_XON_XOFF +#endif + +#if ENABLED(SDSUPPORT) + // Enable this option to collect and display the maximum + // RX queue usage after transferring a file to SD. + //#define SERIAL_STATS_MAX_RX_QUEUED + + // Enable this option to collect and display the number + // of dropped bytes after a file transfer to SD. + //#define SERIAL_STATS_DROPPED_RX +#endif + +// Enable an emergency-command parser to intercept certain commands as they +// enter the serial receive buffer, so they cannot be blocked. +// Currently handles M108, M112, M410 +// Does not work on boards using AT90USB (USBCON) processors! +//#define EMERGENCY_PARSER + +// Bad Serial-connections can miss a received command by sending an 'ok' +// Therefore some clients abort after 30 seconds in a timeout. +// Some other clients start sending commands while receiving a 'wait'. +// This "wait" is only sent when the buffer is empty. 1 second is a good value here. +//#define NO_TIMEOUTS 1000 // Milliseconds + +// Some clients will have this feature soon. This could make the NO_TIMEOUTS unnecessary. +//#define ADVANCED_OK + +// @section extras + +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + +/** + * Firmware-based and LCD-controlled retract + * + * Add G10 / G11 commands for automatic firmware-based retract / recover. + * Use M207 and M208 to define parameters for retract / recover. + * + * Use M209 to enable or disable auto-retract. + * With auto-retract enabled, all G1 E moves within the set range + * will be converted to firmware-based retract/recover moves. + * + * Be sure to turn off auto-retract during filament change. + * + * Note that M207 / M208 / M209 settings are saved to EEPROM. + * + */ +//#define FWRETRACT +#if ENABLED(FWRETRACT) + #define FWRETRACT_AUTORETRACT // costs ~500 bytes of PROGMEM + #if ENABLED(FWRETRACT_AUTORETRACT) + #define MIN_AUTORETRACT 0.1 // When auto-retract is on, convert E moves of this length and over + #define MAX_AUTORETRACT 10.0 // Upper limit for auto-retract conversion + #endif + #define RETRACT_LENGTH 3 // Default retract length (positive mm) + #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change + #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) + #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) + #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) + #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) + #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif +#endif + +/** + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. + */ +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif + +/** + * Advanced Pause + * Experimental feature for filament change support and for parking the nozzle when paused. + * Adds the GCode M600 for initiating filament change. + * If PARK_HEAD_ON_PAUSE enabled, adds the GCode M125 to pause printing and park the nozzle. + * + * Requires an LCD display. + * Requires NOZZLE_PARK_FEATURE. + * This feature is required for the default FILAMENT_RUNOUT_SCRIPT. + */ +//#define ADVANCED_PAUSE_FEATURE +#if ENABLED(ADVANCED_PAUSE_FEATURE) + #define PAUSE_PARK_RETRACT_FEEDRATE 60 // (mm/s) Initial retract feedrate. + #define PAUSE_PARK_RETRACT_LENGTH 2 // (mm) Initial retract. + // This short retract is done immediately, before parking the nozzle. + #define FILAMENT_CHANGE_UNLOAD_FEEDRATE 10 // (mm/s) Unload filament feedrate. This can be pretty fast. + #define FILAMENT_CHANGE_UNLOAD_ACCEL 25 // (mm/s^2) Lower acceleration may allow a faster feedrate. + #define FILAMENT_CHANGE_UNLOAD_LENGTH 100 // (mm) The length of filament for a complete unload. + // For Bowden, the full length of the tube and nozzle. + // For direct drive, the full length of the nozzle. + // Set to 0 for manual unloading. + #define FILAMENT_CHANGE_SLOW_LOAD_FEEDRATE 6 // (mm/s) Slow move when starting load. + #define FILAMENT_CHANGE_SLOW_LOAD_LENGTH 0 // (mm) Slow length, to allow time to insert material. + // 0 to disable start loading and skip to fast load only + #define FILAMENT_CHANGE_FAST_LOAD_FEEDRATE 6 // (mm/s) Load filament feedrate. This can be pretty fast. + #define FILAMENT_CHANGE_FAST_LOAD_ACCEL 25 // (mm/s^2) Lower acceleration may allow a faster feedrate. + #define FILAMENT_CHANGE_FAST_LOAD_LENGTH 0 // (mm) Load length of filament, from extruder gear to nozzle. + // For Bowden, the full length of the tube and nozzle. + // For direct drive, the full length of the nozzle. + //#define ADVANCED_PAUSE_CONTINUOUS_PURGE // Purge continuously up to the purge length until interrupted. + #define ADVANCED_PAUSE_PURGE_FEEDRATE 3 // (mm/s) Extrude feedrate (after loading). Should be slower than load feedrate. + #define ADVANCED_PAUSE_PURGE_LENGTH 50 // (mm) Length to extrude after loading. + // Set to 0 for manual extrusion. + // Filament can be extruded repeatedly from the Filament Change menu + // until extrusion is consistent, and to purge old filament. + + // Filament Unload does a Retract, Delay, and Purge first: + #define FILAMENT_UNLOAD_RETRACT_LENGTH 13 // (mm) Unload initial retract length. + #define FILAMENT_UNLOAD_DELAY 5000 // (ms) Delay for the filament to cool after retract. + #define FILAMENT_UNLOAD_PURGE_LENGTH 8 // (mm) An unretract is done, then this length is purged. + + #define PAUSE_PARK_NOZZLE_TIMEOUT 45 // (seconds) Time limit before the nozzle is turned off for safety. + #define FILAMENT_CHANGE_ALERT_BEEPS 10 // Number of alert beeps to play when a response is needed. + #define PAUSE_PARK_NO_STEPPER_TIMEOUT // Enable for XYZ steppers to stay powered on during filament change. + + //#define PARK_HEAD_ON_PAUSE // Park the nozzle during pause and filament change. + //#define HOME_BEFORE_FILAMENT_CHANGE // Ensure homing has been completed prior to parking for filament change + + //#define FILAMENT_LOAD_UNLOAD_GCODES // Add M701/M702 Load/Unload G-codes, plus Load/Unload in the LCD Prepare menu. + + //#define FILAMENT_UNLOAD_ALL_EXTRUDERS // Allow M702 to unload all extruders above a minimum target temp (as set by M302) +#endif + +// @section tmc + +/** + * TMC26X Stepper Driver options + * + * The TMC26XStepper library is required for this stepper driver. + * https://github.com/trinamic/TMC26XStepper + */ +#if HAS_DRIVER(TMC26X) + + #define X_MAX_CURRENT 1000 // in mA + #define X_SENSE_RESISTOR 91 // in mOhms + #define X_MICROSTEPS 16 // number of microsteps + + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + + #define E5_MAX_CURRENT 1000 + #define E5_SENSE_RESISTOR 91 + #define E5_MICROSTEPS 16 + +#endif // TMC26X + +// @section tmc_smart + +/** + * To use TMC2130 stepper drivers in SPI mode connect your SPI pins to + * the hardware SPI interface on your board and define the required CS pins + * in your `pins_MYBOARD.h` file. (e.g., RAMPS 1.4 uses AUX3 pins `X_CS_PIN 53`, `Y_CS_PIN 49`, etc.). + * You may also use software SPI if you wish to use general purpose IO pins. + * + * The TMC2130Stepper library is required for this stepper driver. + * https://github.com/teemuatlut/TMC2130Stepper + * + * To use TMC2208 stepper UART-configurable stepper drivers + * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN + * to PDN_UART without a resistor. + * The drivers can also be used with hardware serial. + * + * The TMC2208Stepper library is required for this stepper driver. + * https://github.com/teemuatlut/TMC2208Stepper + */ +#if HAS_TRINAMIC + + #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 + #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current + #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 + + #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. + #define X_MICROSTEPS 16 // 0..256 + + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + + #define E1_CURRENT 800 + #define E1_MICROSTEPS 16 + + #define E2_CURRENT 800 + #define E2_MICROSTEPS 16 + + #define E3_CURRENT 800 + #define E3_MICROSTEPS 16 + + #define E4_CURRENT 800 + #define E4_MICROSTEPS 16 + + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + + /** + * Use software SPI for TMC2130. + * The default SW SPI pins are defined the respective pins files, + * but you can override or define them here. + */ + //#define TMC_USE_SW_SPI + //#define TMC_SW_MOSI -1 + //#define TMC_SW_MISO -1 + //#define TMC_SW_SCK -1 + + /** + * Use Trinamic's ultra quiet stepping mode. + * When disabled, Marlin will use spreadCycle stepping mode. + */ + #define STEALTHCHOP + + /** + * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * like overtemperature and short to ground. TMC2208 requires hardware serial. + * In the case of overtemperature Marlin can decrease the driver current until error condition clears. + * Other detected conditions can be used to stop the current print. + * Relevant g-codes: + * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. + * M911 - Report stepper driver overtemperature pre-warn condition. + * M912 - Clear stepper driver overtemperature pre-warn condition flag. + * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + */ + //#define MONITOR_DRIVER_STATUS + + #if ENABLED(MONITOR_DRIVER_STATUS) + #define CURRENT_STEP_DOWN 50 // [mA] + #define REPORT_CURRENT_CHANGE + #define STOP_ON_ERROR + #endif + + /** + * The driver will switch to spreadCycle when stepper speed is over HYBRID_THRESHOLD. + * This mode allows for faster movements at the expense of higher noise levels. + * STEALTHCHOP needs to be enabled. + * M913 X/Y/Z/E to live tune the setting + */ + //#define HYBRID_THRESHOLD + + #define X_HYBRID_THRESHOLD 100 // [mm/s] + #define X2_HYBRID_THRESHOLD 100 + #define Y_HYBRID_THRESHOLD 100 + #define Y2_HYBRID_THRESHOLD 100 + #define Z_HYBRID_THRESHOLD 3 + #define Z2_HYBRID_THRESHOLD 3 + #define Z3_HYBRID_THRESHOLD 3 + #define E0_HYBRID_THRESHOLD 30 + #define E1_HYBRID_THRESHOLD 30 + #define E2_HYBRID_THRESHOLD 30 + #define E3_HYBRID_THRESHOLD 30 + #define E4_HYBRID_THRESHOLD 30 + #define E5_HYBRID_THRESHOLD 30 + + /** + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. + * X, Y, and Z homing will always be done in spreadCycle mode. + * + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. + * Higher values make the system LESS sensitive. + * Lower value make the system MORE sensitive. + * Too low values can lead to false positives, while too high values will collide the axis without triggering. + * It is advised to set X/Y/Z_HOME_BUMP_MM to 0. + * M914 X/Y/Z to live tune the setting + */ + //#define SENSORLESS_HOMING // TMC2130 only + + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 + #endif + + /** + * Enable M122 debugging command for TMC stepper drivers. + * M122 S0/1 will enable continous reporting. + */ + //#define TMC_DEBUG + + /** + * M915 Z Axis Calibration + * + * - Adjust Z stepper current, + * - Drive the Z axis to its physical maximum, and + * - Home Z to account for the lost steps. + * + * Use M915 Snn to specify the current. + * Use M925 Znn to add extra Z height to Z_MAX_POS. + */ + //#define TMC_Z_CALIBRATION + #if ENABLED(TMC_Z_CALIBRATION) + #define CALIBRATION_CURRENT 250 + #define CALIBRATION_EXTRA_HEIGHT 10 + #endif + + /** + * You can set your own advanced settings by filling in predefined functions. + * A list of available functions can be found on the library github page + * https://github.com/teemuatlut/TMC2130Stepper + * https://github.com/teemuatlut/TMC2208Stepper + * + * Example: + * #define TMC_ADV() { \ + * stepperX.diag0_temp_prewarn(1); \ + * stepperY.interpolate(0); \ + * } + */ + #define TMC_ADV() { } + +#endif // HAS_TRINAMIC + +// @section L6470 + +/** + * L6470 Stepper Driver options + * + * The Arduino-L6470 library is required for this stepper driver. + * https://github.com/ameyer/Arduino-L6470 + */ +#if HAS_DRIVER(L6470) + + #define X_MICROSTEPS 16 // number of microsteps + #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off + #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + + #define X2_MICROSTEPS 16 + #define X2_OVERCURRENT 2000 + #define X2_STALLCURRENT 1500 + + #define Y_MICROSTEPS 16 + #define Y_OVERCURRENT 2000 + #define Y_STALLCURRENT 1500 + + #define Y2_MICROSTEPS 16 + #define Y2_OVERCURRENT 2000 + #define Y2_STALLCURRENT 1500 + + #define Z_MICROSTEPS 16 + #define Z_OVERCURRENT 2000 + #define Z_STALLCURRENT 1500 + + #define Z2_MICROSTEPS 16 + #define Z2_OVERCURRENT 2000 + #define Z2_STALLCURRENT 1500 + + #define Z3_MICROSTEPS 16 + #define Z3_OVERCURRENT 2000 + #define Z3_STALLCURRENT 1500 + + #define E0_MICROSTEPS 16 + #define E0_OVERCURRENT 2000 + #define E0_STALLCURRENT 1500 + + #define E1_MICROSTEPS 16 + #define E1_OVERCURRENT 2000 + #define E1_STALLCURRENT 1500 + + #define E2_MICROSTEPS 16 + #define E2_OVERCURRENT 2000 + #define E2_STALLCURRENT 1500 + + #define E3_MICROSTEPS 16 + #define E3_OVERCURRENT 2000 + #define E3_STALLCURRENT 1500 + + #define E4_MICROSTEPS 16 + #define E4_OVERCURRENT 2000 + #define E4_STALLCURRENT 1500 + + #define E5_MICROSTEPS 16 + #define E5_OVERCURRENT 2000 + #define E5_STALLCURRENT 1500 + +#endif // L6470 + +/** + * TWI/I2C BUS + * + * This feature is an EXPERIMENTAL feature so it shall not be used on production + * machines. Enabling this will allow you to send and receive I2C data from slave + * devices on the bus. + * + * ; Example #1 + * ; This macro send the string "Marlin" to the slave device with address 0x63 (99) + * ; It uses multiple M260 commands with one B arg + * M260 A99 ; Target slave address + * M260 B77 ; M + * M260 B97 ; a + * M260 B114 ; r + * M260 B108 ; l + * M260 B105 ; i + * M260 B110 ; n + * M260 S1 ; Send the current buffer + * + * ; Example #2 + * ; Request 6 bytes from slave device with address 0x63 (99) + * M261 A99 B5 + * + * ; Example #3 + * ; Example serial output of a M261 request + * echo:i2c-reply: from:99 bytes:5 data:hello + */ + +// @section i2cbus + +//#define EXPERIMENTAL_I2CBUS +#define I2C_SLAVE_ADDRESS 0 // Set a value from 8 to 127 to act as a slave + +// @section extras + +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + +/** + * Spindle & Laser control + * + * Add the M3, M4, and M5 commands to turn the spindle/laser on and off, and + * to set spindle speed, spindle direction, and laser power. + * + * SuperPid is a router/spindle speed controller used in the CNC milling community. + * Marlin can be used to turn the spindle on and off. It can also be used to set + * the spindle speed from 5,000 to 30,000 RPM. + * + * You'll need to select a pin for the ON/OFF function and optionally choose a 0-5V + * hardware PWM pin for the speed control and a pin for the rotation direction. + * + * See http://marlinfw.org/docs/configuration/laser_spindle.html for more config details. + */ +//#define SPINDLE_LASER_ENABLE +#if ENABLED(SPINDLE_LASER_ENABLE) + + #define SPINDLE_LASER_ENABLE_INVERT false // set to "true" if the on/off function is reversed + #define SPINDLE_LASER_PWM true // set to true if your controller supports setting the speed/power + #define SPINDLE_LASER_PWM_INVERT true // set to "true" if the speed/power goes up when you want it to go slower + #define SPINDLE_LASER_POWERUP_DELAY 5000 // delay in milliseconds to allow the spindle/laser to come up to speed/power + #define SPINDLE_LASER_POWERDOWN_DELAY 5000 // delay in milliseconds to allow the spindle to stop + #define SPINDLE_DIR_CHANGE true // set to true if your spindle controller supports changing spindle direction + #define SPINDLE_INVERT_DIR false + #define SPINDLE_STOP_ON_DIR_CHANGE true // set to true if Marlin should stop the spindle before changing rotation direction + + /** + * The M3 & M4 commands use the following equation to convert PWM duty cycle to speed/power + * + * SPEED/POWER = PWM duty cycle * SPEED_POWER_SLOPE + SPEED_POWER_INTERCEPT + * where PWM duty cycle varies from 0 to 255 + * + * set the following for your controller (ALL MUST BE SET) + */ + + #define SPEED_POWER_SLOPE 118.4 + #define SPEED_POWER_INTERCEPT 0 + #define SPEED_POWER_MIN 5000 + #define SPEED_POWER_MAX 30000 // SuperPID router controller 0 - 30,000 RPM + + //#define SPEED_POWER_SLOPE 0.3922 + //#define SPEED_POWER_INTERCEPT 0 + //#define SPEED_POWER_MIN 10 + //#define SPEED_POWER_MAX 100 // 0-100% +#endif + +/** + * Filament Width Sensor + * + * Measures the filament width in real-time and adjusts + * flow rate to compensate for any irregularities. + * + * Also allows the measured filament diameter to set the + * extrusion rate, so the slicer only has to specify the + * volume. + * + * Only a single extruder is supported at this time. + * + * 34 RAMPS_14 : Analog input 5 on the AUX2 connector + * 81 PRINTRBOARD : Analog input 2 on the Exp1 connector (version B,C,D,E) + * 301 RAMBO : Analog input 3 + * + * Note: May require analog pins to be defined for other boards. + */ +//#define FILAMENT_WIDTH_SENSOR + +#if ENABLED(FILAMENT_WIDTH_SENSOR) + #define FILAMENT_SENSOR_EXTRUDER_NUM 0 // Index of the extruder that has the filament sensor. :[0,1,2,3,4] + #define MEASUREMENT_DELAY_CM 14 // (cm) The distance from the filament sensor to the melting chamber + + #define FILWIDTH_ERROR_MARGIN 1.0 // (mm) If a measurement differs too much from nominal width ignore it + #define MAX_MEASUREMENT_DELAY 20 // (bytes) Buffer size for stored measurements (1 byte per cm). Must be larger than MEASUREMENT_DELAY_CM. + + #define DEFAULT_MEASURED_FILAMENT_DIA DEFAULT_NOMINAL_FILAMENT_DIA // Set measured to nominal initially + + // Display filament width on the LCD status line. Status messages will expire after 5 seconds. + //#define FILAMENT_LCD_DISPLAY +#endif + +/** + * CNC Coordinate Systems + * + * Enables G53 and G54-G59.3 commands to select coordinate systems + * and G92.1 to reset the workspace to native machine space. + */ +//#define CNC_COORDINATE_SYSTEMS + +/** + * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins + */ +//#define PINS_DEBUGGING + +/** + * Auto-report temperatures with M155 S + */ +#define AUTO_REPORT_TEMPERATURES + +/** + * Include capabilities in M115 output + */ +#define EXTENDED_CAPABILITIES_REPORT + +/** + * Disable all Volumetric extrusion options + */ +//#define NO_VOLUMETRICS + +#if DISABLED(NO_VOLUMETRICS) + /** + * Volumetric extrusion default state + * Activate to make volumetric extrusion the default method, + * with DEFAULT_NOMINAL_FILAMENT_DIA as the default diameter. + * + * M200 D0 to disable, M200 Dn to set a new diameter. + */ + //#define VOLUMETRIC_DEFAULT_ON +#endif + +/** + * Enable this option for a leaner build of Marlin that removes all + * workspace offsets, simplifying coordinate transformations, leveling, etc. + * + * - M206 and M428 are disabled. + * - G92 will revert to its behavior from Marlin 1.0. + */ +//#define NO_WORKSPACE_OFFSETS + +/** + * Set the number of proportional font spaces required to fill up a typical character space. + * This can help to better align the output of commands like `G29 O` Mesh Output. + * + * For clients that use a fixed-width font (like OctoPrint), leave this set to 1.0. + * Otherwise, adjust according to your client and font. + */ +#define PROPORTIONAL_FONT_RATIO 1.0 + +/** + * Spend 28 bytes of SRAM to optimize the GCode parser + */ +#define FASTER_GCODE_PARSER + +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + +/** + * User-defined menu items that execute custom GCode + */ +//#define CUSTOM_USER_MENUS +#if ENABLED(CUSTOM_USER_MENUS) + //#define CUSTOM_USER_MENU_TITLE "Custom Commands" + #define USER_SCRIPT_DONE "M117 User Script Done" + #define USER_SCRIPT_AUDIBLE_FEEDBACK + //#define USER_SCRIPT_RETURN // Return to status screen after a script + + #define USER_DESC_1 "Home & UBL Info" + #define USER_GCODE_1 "G28\nG29 W" + + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL + #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) + + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL + #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) + + #define USER_DESC_4 "Heat Bed/Home/Level" + #define USER_GCODE_4 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nG28\nG29" + + #define USER_DESC_5 "Home & Info" + #define USER_GCODE_5 "G28\nM503" +#endif + +/** + * Specify an action command to send to the host when the printer is killed. + * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. + * The host must be configured to handle the action command. + */ +//#define ACTION_ON_KILL "poweroff" + +/** + * Specify an action command to send to the host on pause and resume. + * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. + * The host must be configured to handle the action command. + */ +//#define ACTION_ON_PAUSE "pause" +//#define ACTION_ON_RESUME "resume" + +//=========================================================================== +//====================== I2C Position Encoder Settings ====================== +//=========================================================================== + +/** + * I2C position encoders for closed loop control. + * Developed by Chris Barr at Aus3D. + * + * Wiki: http://wiki.aus3d.com.au/Magnetic_Encoder + * Github: https://github.com/Aus3D/MagneticEncoder + * + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ + * + * Reilabuild encoders have been modified to improve reliability. + */ + +//#define I2C_POSITION_ENCODERS +#if ENABLED(I2C_POSITION_ENCODERS) + + #define I2CPE_ENCODER_CNT 1 // The number of encoders installed; max of 5 + // encoders supported currently. + + #define I2CPE_ENC_1_ADDR I2CPE_PRESET_ADDR_X // I2C address of the encoder. 30-200. + #define I2CPE_ENC_1_AXIS X_AXIS // Axis the encoder module is installed on. _AXIS. + #define I2CPE_ENC_1_TYPE I2CPE_ENC_TYPE_LINEAR // Type of encoder: I2CPE_ENC_TYPE_LINEAR -or- + // I2CPE_ENC_TYPE_ROTARY. + #define I2CPE_ENC_1_TICKS_UNIT 2048 // 1024 for magnetic strips with 2mm poles; 2048 for + // 1mm poles. For linear encoders this is ticks / mm, + // for rotary encoders this is ticks / revolution. + //#define I2CPE_ENC_1_TICKS_REV (16 * 200) // Only needed for rotary encoders; number of stepper + // steps per full revolution (motor steps/rev * microstepping) + //#define I2CPE_ENC_1_INVERT // Invert the direction of axis travel. + #define I2CPE_ENC_1_EC_METHOD I2CPE_ECM_MICROSTEP // Type of error error correction. + #define I2CPE_ENC_1_EC_THRESH 0.10 // Threshold size for error (in mm) above which the + // printer will attempt to correct the error; errors + // smaller than this are ignored to minimize effects of + // measurement noise / latency (filter). + + #define I2CPE_ENC_2_ADDR I2CPE_PRESET_ADDR_Y // Same as above, but for encoder 2. + #define I2CPE_ENC_2_AXIS Y_AXIS + #define I2CPE_ENC_2_TYPE I2CPE_ENC_TYPE_LINEAR + #define I2CPE_ENC_2_TICKS_UNIT 2048 + //#define I2CPE_ENC_2_TICKS_REV (16 * 200) + //#define I2CPE_ENC_2_INVERT + #define I2CPE_ENC_2_EC_METHOD I2CPE_ECM_MICROSTEP + #define I2CPE_ENC_2_EC_THRESH 0.10 + + #define I2CPE_ENC_3_ADDR I2CPE_PRESET_ADDR_Z // Encoder 3. Add additional configuration options + #define I2CPE_ENC_3_AXIS Z_AXIS // as above, or use defaults below. + + #define I2CPE_ENC_4_ADDR I2CPE_PRESET_ADDR_E // Encoder 4. + #define I2CPE_ENC_4_AXIS E_AXIS + + #define I2CPE_ENC_5_ADDR 34 // Encoder 5. + #define I2CPE_ENC_5_AXIS E_AXIS + + // Default settings for encoders which are enabled, but without settings configured above. + #define I2CPE_DEF_TYPE I2CPE_ENC_TYPE_LINEAR + #define I2CPE_DEF_ENC_TICKS_UNIT 2048 + #define I2CPE_DEF_TICKS_REV (16 * 200) + #define I2CPE_DEF_EC_METHOD I2CPE_ECM_NONE + #define I2CPE_DEF_EC_THRESH 0.1 + + //#define I2CPE_ERR_THRESH_ABORT 100.0 // Threshold size for error (in mm) error on any given + // axis after which the printer will abort. Comment out to + // disable abort behaviour. + + #define I2CPE_TIME_TRUSTED 10000 // After an encoder fault, there must be no further fault + // for this amount of time (in ms) before the encoder + // is trusted again. + + /** + * Position is checked every time a new command is executed from the buffer but during long moves, + * this setting determines the minimum update time between checks. A value of 100 works well with + * error rolling average when attempting to correct only for skips and not for vibration. + */ + #define I2CPE_MIN_UPD_TIME_MS 4 // (ms) Minimum time between encoder checks. + + // Use a rolling average to identify persistant errors that indicate skips, as opposed to vibration and noise. + #define I2CPE_ERR_ROLLING_AVERAGE + +#endif // I2C_POSITION_ENCODERS + +/** + * MAX7219 Debug Matrix + * + * Add support for a low-cost 8x8 LED Matrix based on the Max7219 chip as a realtime status display. + * Requires 3 signal wires. Some useful debug options are included to demonstrate its usage. + */ +//#define MAX7219_DEBUG +#if ENABLED(MAX7219_DEBUG) + #define MAX7219_CLK_PIN 64 + #define MAX7219_DIN_PIN 57 + #define MAX7219_LOAD_PIN 44 + + //#define MAX7219_GCODE // Add the M7219 G-code to control the LED matrix + #define MAX7219_INIT_TEST 2 // Do a test pattern at initialization (Set to 2 for spiral) + #define MAX7219_NUMBER_UNITS 1 // Number of Max7219 units in chain. + #define MAX7219_ROTATE 0 // Rotate the display clockwise (in multiples of +/- 90°) + // connector at: right=0 bottom=-90 top=90 left=180 + //#define MAX7219_REVERSE_ORDER // The individual LED matrix units may be in reversed order + + /** + * Sample debug features + * If you add more debug displays, be careful to avoid conflicts! + */ + #define MAX7219_DEBUG_PRINTER_ALIVE // Blink corner LED of 8x8 matrix to show that the firmware is functioning + #define MAX7219_DEBUG_PLANNER_HEAD 3 // Show the planner queue head position on this and the next LED matrix row + #define MAX7219_DEBUG_PLANNER_TAIL 5 // Show the planner queue tail position on this and the next LED matrix row + + #define MAX7219_DEBUG_PLANNER_QUEUE 0 // Show the current planner queue depth on this and the next LED matrix row + // If you experience stuttering, reboots, etc. this option can reveal how + // tweaks made to the configuration are affecting the printer in real-time. +#endif + +/** + * NanoDLP Sync support + * + * Add support for Synchronized Z moves when using with NanoDLP. G0/G1 axis moves will output "Z_move_comp" + * string to enable synchronization with DLP projector exposure. This change will allow to use + * [[WaitForDoneMessage]] instead of populating your gcode with M400 commands + */ +//#define NANODLP_Z_SYNC +#if ENABLED(NANODLP_Z_SYNC) + //#define NANODLP_ALL_AXIS // Enables "Z_move_comp" output on any axis move. + // Default behaviour is limited to Z axis only. +#endif + +/** + * WiFi Support (Espressif ESP32 WiFi) + */ +//#define WIFISUPPORT +#if ENABLED(WIFISUPPORT) + #define WIFI_SSID "Wifi SSID" + #define WIFI_PWD "Wifi Password" +#endif + +// Enable Marlin dev mode which adds some special commands +//#define MARLIN_DEV_MODE diff --git a/Marlin/src/config/examples/Azteeg/X5GT/Configuration.h b/Marlin/src/config/examples/Azteeg/X5GT/Configuration.h index f59224e0bf..9daade4b70 100644 --- a/Marlin/src/config/examples/Azteeg/X5GT/Configuration.h +++ b/Marlin/src/config/examples/Azteeg/X5GT/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -772,6 +770,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -859,6 +864,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -879,8 +885,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -905,7 +911,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -972,6 +978,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1141,8 +1159,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1297,10 +1316,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 180 #define PREHEAT_1_TEMP_BED 70 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 110 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -1429,10 +1450,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1460,6 +1481,13 @@ */ #define DISPLAY_CHARSET_HD44780 CYRILLIC +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1824,6 +1852,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1980,5 +2017,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration.h b/Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration.h index 2940c7a32d..160817eae6 100644 --- a/Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration.h +++ b/Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -772,6 +770,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -859,6 +864,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -879,8 +885,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER false // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +//#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -905,7 +911,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -#define Z_HOMING_HEIGHT 8 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +#define Z_HOMING_HEIGHT 8 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -972,6 +978,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1141,8 +1159,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1297,10 +1316,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 190 #define PREHEAT_1_TEMP_BED 65 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 100 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -1429,10 +1450,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1460,6 +1481,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1824,6 +1852,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1980,5 +2017,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration_adv.h b/Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration_adv.h index de942c5966..972833df14 100644 --- a/Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration_adv.h +++ b/Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -30,8 +31,6 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -176,8 +175,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -245,7 +244,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -360,7 +359,6 @@ * X1 is the left carriage, X2 the right. They park and home at opposite ends of the X axis. * By default the X2 stepper is assigned to the first unused E plug on the board. */ -//#define DUAL_X_CARRIAGE #if ENABLED(DUAL_X_CARRIAGE) #define X1_MIN_POS X_MIN_POS // set minimum to ensure first x-carriage doesn't hit the parked second X-carriage #define X1_MAX_POS X_BED_SIZE // set maximum to ensure first x-carriage doesn't hit the parked second X-carriage @@ -385,10 +383,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -413,6 +407,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -464,7 +479,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -482,6 +497,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] @@ -535,15 +561,15 @@ //=============================Additional Features=========================== //=========================================================================== -#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu //#define LCD_INFO_MENU @@ -559,7 +585,7 @@ // Add an 'M73' G-code to set the current percentage //#define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -568,7 +594,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -597,7 +623,7 @@ #define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -683,6 +709,43 @@ */ //#define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -697,7 +760,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar //#define DOGM_SD_PERCENT @@ -767,16 +830,24 @@ */ //#define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. + + //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -978,6 +1049,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -1003,21 +1083,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -//#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1258,11 +1359,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1271,10 +1372,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1414,6 +1523,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1556,6 +1674,33 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ @@ -1569,10 +1714,10 @@ #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "Preheat for PLA" + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "Preheat for ABS" + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) #define USER_DESC_4 "Heat Bed/Home/Level" @@ -1737,5 +1882,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/examples/BIBO/TouchX/default/Configuration.h b/Marlin/src/config/examples/BIBO/TouchX/default/Configuration.h index 875f1439d2..83e8e9a32a 100644 --- a/Marlin/src/config/examples/BIBO/TouchX/default/Configuration.h +++ b/Marlin/src/config/examples/BIBO/TouchX/default/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -772,6 +770,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -859,6 +864,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -879,8 +885,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER false // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +//#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -905,7 +911,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -#define Z_HOMING_HEIGHT 10 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +#define Z_HOMING_HEIGHT 10 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -972,6 +978,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1141,8 +1159,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1297,10 +1316,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 180 #define PREHEAT_1_TEMP_BED 60 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 80 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -1429,10 +1450,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1460,6 +1481,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1824,6 +1852,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1980,5 +2017,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/BIBO/TouchX/default/Configuration_adv.h b/Marlin/src/config/examples/BIBO/TouchX/default/Configuration_adv.h index fde76dbbc1..2beff941b1 100644 --- a/Marlin/src/config/examples/BIBO/TouchX/default/Configuration_adv.h +++ b/Marlin/src/config/examples/BIBO/TouchX/default/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -30,8 +31,6 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -176,8 +175,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -245,7 +244,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -385,10 +384,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -413,6 +408,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -464,7 +480,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -482,6 +498,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] @@ -535,15 +562,15 @@ //=============================Additional Features=========================== //=========================================================================== -#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu //#define LCD_INFO_MENU @@ -559,7 +586,7 @@ // Add an 'M73' G-code to set the current percentage //#define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -568,7 +595,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -597,7 +624,7 @@ #define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -683,6 +710,43 @@ */ //#define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -697,7 +761,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar //#define DOGM_SD_PERCENT @@ -767,16 +831,24 @@ */ //#define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. + + //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -978,6 +1050,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -1003,21 +1084,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -//#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1258,11 +1360,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1271,10 +1373,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1414,6 +1524,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1556,6 +1675,33 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ @@ -1569,10 +1715,10 @@ #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "Preheat for PLA" + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "Preheat for ABS" + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) #define USER_DESC_4 "Heat Bed/Home/Level" @@ -1737,5 +1883,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/examples/BQ/Hephestos/Configuration.h b/Marlin/src/config/examples/BQ/Hephestos/Configuration.h index 3dfc13d77f..d05631d63e 100644 --- a/Marlin/src/config/examples/BQ/Hephestos/Configuration.h +++ b/Marlin/src/config/examples/BQ/Hephestos/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -760,6 +758,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -847,6 +852,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -867,8 +873,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -893,7 +899,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -960,6 +966,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1129,8 +1147,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1285,10 +1304,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 200 #define PREHEAT_1_TEMP_BED 0 #define PREHEAT_1_FAN_SPEED 255 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 220 #define PREHEAT_2_TEMP_BED 100 #define PREHEAT_2_FAN_SPEED 255 // Value from 0 to 255 @@ -1417,10 +1438,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1448,6 +1469,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1812,6 +1840,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1968,5 +2005,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h b/Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h index 85bb42cf49..0d12cf9607 100644 --- a/Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h +++ b/Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -30,8 +31,6 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -176,8 +175,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -245,7 +244,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -282,7 +281,7 @@ // If you want endstops to stay on (by default) even when not homing // enable this option. Override at any time with M120, M121. -#define ENDSTOPS_ALWAYS_ON_DEFAULT +//#define ENDSTOPS_ALWAYS_ON_DEFAULT // @section extras @@ -385,10 +384,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -413,6 +408,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -464,7 +480,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -482,6 +498,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] @@ -535,15 +562,15 @@ //=============================Additional Features=========================== //=========================================================================== -#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu //#define LCD_INFO_MENU @@ -559,7 +586,7 @@ // Add an 'M73' G-code to set the current percentage //#define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -568,7 +595,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -597,7 +624,7 @@ #define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -683,6 +710,43 @@ */ //#define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -697,7 +761,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar //#define DOGM_SD_PERCENT @@ -767,16 +831,24 @@ */ //#define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. + + //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -978,6 +1050,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -1003,21 +1084,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -//#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1258,11 +1360,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1271,10 +1373,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1414,6 +1524,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1556,6 +1675,33 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ @@ -1569,10 +1715,10 @@ #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "Preheat for PLA" + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "Preheat for ABS" + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) #define USER_DESC_4 "Heat Bed/Home/Level" @@ -1737,5 +1883,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/examples/BQ/Hephestos_2/Configuration.h b/Marlin/src/config/examples/BQ/Hephestos_2/Configuration.h index 2180f1cccf..0cbd507188 100644 --- a/Marlin/src/config/examples/BQ/Hephestos_2/Configuration.h +++ b/Marlin/src/config/examples/BQ/Hephestos_2/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -211,7 +210,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -228,7 +227,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -773,6 +771,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -860,6 +865,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -880,8 +886,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -906,7 +912,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 3 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 3 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -972,6 +978,18 @@ #define FIL_RUNOUT_INVERTING false // set to true to invert the logic of the sensor. #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1141,8 +1159,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1297,10 +1316,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 180 #define PREHEAT_1_TEMP_BED 50 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 210 #define PREHEAT_2_TEMP_BED 60 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -1429,10 +1450,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1460,6 +1481,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1824,6 +1852,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1980,5 +2017,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h b/Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h index 7fcc56cfcf..80166dab32 100644 --- a/Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h +++ b/Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -30,8 +31,6 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -176,8 +175,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -245,7 +244,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -385,10 +384,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -413,6 +408,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -464,7 +480,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -482,6 +498,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] @@ -543,15 +570,15 @@ //=============================Additional Features=========================== //=========================================================================== -#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 30 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 50 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 50 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu //#define LCD_INFO_MENU @@ -567,7 +594,7 @@ // Add an 'M73' G-code to set the current percentage //#define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -576,7 +603,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -605,7 +632,7 @@ #define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE false // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "G27 P0" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "G27 P0" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -691,6 +718,43 @@ */ //#define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -705,7 +769,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar //#define DOGM_SD_PERCENT @@ -775,16 +839,24 @@ */ #define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 2 // Babysteps are very small. Increase for faster motion. - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1500 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 2 // Babysteps are very small. Increase for faster motion. + + //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1500 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -986,6 +1058,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -1011,21 +1092,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -//#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1266,11 +1368,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1279,10 +1381,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1422,6 +1532,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1564,6 +1683,33 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ @@ -1577,10 +1723,10 @@ #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "Preheat for PLA" + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "Preheat for ABS" + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) #define USER_DESC_4 "Heat Bed/Home/Level" @@ -1745,5 +1891,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/examples/BQ/WITBOX/Configuration.h b/Marlin/src/config/examples/BQ/WITBOX/Configuration.h index df59b94839..f1fd8318bc 100644 --- a/Marlin/src/config/examples/BQ/WITBOX/Configuration.h +++ b/Marlin/src/config/examples/BQ/WITBOX/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -760,6 +758,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -847,6 +852,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -867,8 +873,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -893,7 +899,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -960,6 +966,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1129,8 +1147,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1285,10 +1304,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 200 #define PREHEAT_1_TEMP_BED 0 #define PREHEAT_1_FAN_SPEED 255 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 220 #define PREHEAT_2_TEMP_BED 100 #define PREHEAT_2_FAN_SPEED 255 // Value from 0 to 255 @@ -1417,10 +1438,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1448,6 +1469,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1812,6 +1840,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1968,5 +2005,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h b/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h index 85bb42cf49..0d12cf9607 100644 --- a/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h +++ b/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -30,8 +31,6 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -176,8 +175,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -245,7 +244,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -282,7 +281,7 @@ // If you want endstops to stay on (by default) even when not homing // enable this option. Override at any time with M120, M121. -#define ENDSTOPS_ALWAYS_ON_DEFAULT +//#define ENDSTOPS_ALWAYS_ON_DEFAULT // @section extras @@ -385,10 +384,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -413,6 +408,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -464,7 +480,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -482,6 +498,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] @@ -535,15 +562,15 @@ //=============================Additional Features=========================== //=========================================================================== -#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu //#define LCD_INFO_MENU @@ -559,7 +586,7 @@ // Add an 'M73' G-code to set the current percentage //#define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -568,7 +595,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -597,7 +624,7 @@ #define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -683,6 +710,43 @@ */ //#define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -697,7 +761,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar //#define DOGM_SD_PERCENT @@ -767,16 +831,24 @@ */ //#define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. + + //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -978,6 +1050,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -1003,21 +1084,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -//#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1258,11 +1360,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1271,10 +1373,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1414,6 +1524,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1556,6 +1675,33 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ @@ -1569,10 +1715,10 @@ #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "Preheat for PLA" + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "Preheat for ABS" + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) #define USER_DESC_4 "Heat Bed/Home/Level" @@ -1737,5 +1883,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/examples/Cartesio/Configuration.h b/Marlin/src/config/examples/Cartesio/Configuration.h index 026e636c2e..b7404119e6 100644 --- a/Marlin/src/config/examples/Cartesio/Configuration.h +++ b/Marlin/src/config/examples/Cartesio/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -204,7 +203,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -221,7 +220,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -771,6 +769,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -858,6 +863,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -878,8 +884,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -904,7 +910,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -971,6 +977,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1140,8 +1158,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1296,10 +1315,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 190 #define PREHEAT_1_TEMP_BED 50 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 110 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -1428,10 +1449,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1459,6 +1480,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1823,6 +1851,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1979,5 +2016,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/Cartesio/Configuration_adv.h b/Marlin/src/config/examples/Cartesio/Configuration_adv.h index 94bcd3eb37..44c60d31e0 100644 --- a/Marlin/src/config/examples/Cartesio/Configuration_adv.h +++ b/Marlin/src/config/examples/Cartesio/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -30,8 +31,6 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -176,8 +175,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -245,7 +244,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 35 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -385,10 +384,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -413,6 +408,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -464,7 +480,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -482,6 +498,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] @@ -535,15 +562,15 @@ //=============================Additional Features=========================== //=========================================================================== -#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu //#define LCD_INFO_MENU @@ -559,7 +586,7 @@ // Add an 'M73' G-code to set the current percentage //#define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -568,7 +595,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -597,7 +624,7 @@ #define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -683,6 +710,43 @@ */ //#define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -697,7 +761,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar //#define DOGM_SD_PERCENT @@ -767,16 +831,24 @@ */ //#define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. + + //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -978,6 +1050,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -1003,21 +1084,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -//#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1258,11 +1360,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1271,10 +1373,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1414,6 +1524,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1556,6 +1675,33 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ @@ -1569,10 +1715,10 @@ #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "Preheat for PLA" + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "Preheat for ABS" + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) #define USER_DESC_4 "Heat Bed/Home/Level" @@ -1737,5 +1883,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/examples/Creality/CR-10/Configuration.h b/Marlin/src/config/examples/Creality/CR-10/Configuration.h index e7f257673b..cede057f4a 100644 --- a/Marlin/src/config/examples/Creality/CR-10/Configuration.h +++ b/Marlin/src/config/examples/Creality/CR-10/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -782,6 +780,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -869,6 +874,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -889,8 +895,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -915,7 +921,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 5 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 5 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -982,6 +988,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1151,8 +1169,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1307,10 +1326,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 190 #define PREHEAT_1_TEMP_BED 70 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 110 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -1439,10 +1460,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1470,6 +1491,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1834,6 +1862,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1990,5 +2027,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h b/Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h index 2e43042a0f..2159fab014 100644 --- a/Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h +++ b/Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -30,8 +31,6 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -176,8 +175,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -245,7 +244,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -385,10 +384,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -413,6 +408,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -464,7 +480,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -482,6 +498,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] @@ -535,15 +562,15 @@ //=============================Additional Features=========================== //=========================================================================== -#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu //#define LCD_INFO_MENU @@ -559,7 +586,7 @@ // Add an 'M73' G-code to set the current percentage //#define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -568,7 +595,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -597,7 +624,7 @@ #define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -683,6 +710,43 @@ */ //#define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -697,7 +761,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar //#define DOGM_SD_PERCENT @@ -767,16 +831,24 @@ */ #define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 10 // Babysteps are very small. Increase for faster motion. - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - #define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 10 // Babysteps are very small. Increase for faster motion. + + #define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -978,6 +1050,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -1003,21 +1084,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -//#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1258,11 +1360,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1271,10 +1373,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1414,6 +1524,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1559,6 +1678,33 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ @@ -1572,10 +1718,10 @@ #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "Preheat for PLA" + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "Preheat for ABS" + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) #define USER_DESC_4 "Heat Bed/Home/Level" @@ -1740,5 +1886,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/examples/Creality/CR-10/_Statusscreen.h b/Marlin/src/config/examples/Creality/CR-10/_Statusscreen.h index a03bc992fa..9df6de9c10 100644 --- a/Marlin/src/config/examples/Creality/CR-10/_Statusscreen.h +++ b/Marlin/src/config/examples/Creality/CR-10/_Statusscreen.h @@ -30,51 +30,36 @@ * http://marlinfw.org/tools/u8glib/converter.html */ -#define STATUS_SCREENWIDTH 128 -#define STATUS_SCREEN_HOTEND_TEXT_X(E) 38 -#define STATUS_SCREEN_BED_TEXT_X 73 +// +// Status Screen Logo bitmap +// +#define STATUS_LOGO_X 8 +#define STATUS_LOGO_Y 5 +#define STATUS_LOGO_WIDTH 22 -//============================================ +const unsigned char status_logo_bmp[] PROGMEM = { + B00111110,B00001111,B11110000, + B11000001,B10000110,B00011000, + B11000001,B10000110,B00001100, + B00000001,B10000110,B00000100, + B00000011,B00000110,B00000100, + B00011111,B00000110,B00000100, + B00000011,B00000110,B00000100, + B00000001,B10000110,B00000100, + B11000001,B10000110,B00001100, + B11000001,B10000110,B00011000, + B00111110,B00001111,B11110000 +}; -const unsigned char status_screen0_bmp[] PROGMEM = { - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B11111100,B00110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B11111100,B00010000, - B00000000,B00111110,B00001111,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B01111000,B00010000, - B00000000,B11000001,B10000110,B00011000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B00110000,B00010000, - B00000000,B11000001,B10000110,B00001100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101100,B00000000,B11010000, - B00000000,B00000001,B10000110,B00000100,B00000000,B00011111,B11100000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00101110,B00110001,B11010000, - B00000000,B00000011,B00000110,B00000100,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00101111,B01111011,B11010000, - B00000000,B00011111,B00000110,B00000100,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00101111,B01111011,B11010000, - B00000000,B00000011,B00000110,B00000100,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00101110,B00110001,B11010000, - B00000000,B00000001,B10000110,B00000100,B00000000,B00011111,B11100000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00101100,B00000000,B11010000, - B00000000,B11000001,B10000110,B00001100,B00000000,B00011111,B11100000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00100000,B00110000,B00010000, - B00000000,B11000001,B10000110,B00011000,B00000000,B00111111,B11110000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00100000,B01111000,B00010000, - B00000000,B00111110,B00001111,B11110000,B00000000,B00111111,B11110000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00100000,B11111100,B00010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00110000,B11111100,B00110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B10000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00111111,B11111111,B11110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00000000,B00000000,B00000000 -}; -const unsigned char status_screen1_bmp[] PROGMEM = { - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110011,B10000111,B00110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100111,B10000111,B10010000, - B00000000,B00111110,B00001111,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B10000111,B11010000, - B00000000,B11000001,B10000110,B00011000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B10000111,B11010000, - B00000000,B11000001,B10000110,B00001100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B00000011,B11010000, - B00000000,B00000001,B10000110,B00000100,B00000000,B00011111,B11100000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00100000,B00110000,B00010000, - B00000000,B00000011,B00000110,B00000100,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00100000,B01111000,B00010000, - B00000000,B00011111,B00000110,B00000100,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00100000,B01111000,B00010000, - B00000000,B00000011,B00000110,B00000100,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00100000,B00110000,B00010000, - B00000000,B00000001,B10000110,B00000100,B00000000,B00011111,B11100000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00101111,B00000011,B11010000, - B00000000,B11000001,B10000110,B00001100,B00000000,B00011111,B11100000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00101111,B10000111,B11010000, - B00000000,B11000001,B10000110,B00011000,B00000000,B00111111,B11110000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00101111,B10000111,B11010000, - B00000000,B00111110,B00001111,B11110000,B00000000,B00111111,B11110000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00100111,B10000111,B10010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00110011,B10000111,B00110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B10000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00111111,B11111111,B11110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00000000,B00000000,B00000000 -}; +// +// Use default bitmaps +// +#define STATUS_HOTEND_ANIM +#define STATUS_BED_ANIM +#if HOTENDS < 2 + #define STATUS_HEATERS_X 40 + #define STATUS_BED_X 72 +#else + #define STATUS_HEATERS_X 32 + #define STATUS_BED_X 80 +#endif diff --git a/Marlin/src/config/examples/Creality/CR-10S/Configuration.h b/Marlin/src/config/examples/Creality/CR-10S/Configuration.h index e1ed8cd883..21435c6350 100644 --- a/Marlin/src/config/examples/Creality/CR-10S/Configuration.h +++ b/Marlin/src/config/examples/Creality/CR-10S/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -91,7 +90,7 @@ */ // Enable to show the bitmap in Marlin/_Bootscreen.h on startup. -//#define SHOW_CUSTOM_BOOTSCREEN +#define SHOW_CUSTOM_BOOTSCREEN // Enable to show the bitmap in Marlin/_Statusscreen.h on the status screen. #define CUSTOM_STATUS_SCREEN_IMAGE @@ -133,11 +132,7 @@ // The following define selects which electronics board you have. // Please choose the name from boards.h that matches your setup #ifndef MOTHERBOARD - #define MOTHERBOARD BOARD_RAMPS_14_EFB - #define PIN_EXP1 65 // A11 - #define PIN_EXP2 66 // A12 - #define PIN_EXP3 11 // SERVO0_PIN - #define PIN_EXP4 12 // PS_ON_PIN + #define MOTHERBOARD BOARD_RAMPS_CREALITY #endif // Optional custom name for your RepStrap or other custom machine @@ -207,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -224,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -670,9 +664,9 @@ * M204 R Retract Acceleration * M204 T Travel Acceleration */ -#define DEFAULT_ACCELERATION 575 // X, Y, Z and E acceleration for printing moves +#define DEFAULT_ACCELERATION 600 // X, Y, Z and E acceleration for printing moves #define DEFAULT_RETRACT_ACCELERATION 1000 // E acceleration for retracts -#define DEFAULT_TRAVEL_ACCELERATION 1000 // X, Y, Z acceleration for travel (non printing) moves +#define DEFAULT_TRAVEL_ACCELERATION 800 // X, Y, Z acceleration for travel (non printing) moves /** * Default Jerk (mm/s) @@ -682,8 +676,8 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 20.0 -#define DEFAULT_YJERK 20.0 +#define DEFAULT_XJERK 10.0 +#define DEFAULT_YJERK 10.0 #define DEFAULT_ZJERK 0.4 #define DEFAULT_EJERK 5.0 @@ -776,6 +770,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -863,6 +864,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -883,8 +885,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -909,7 +911,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -921,15 +923,15 @@ // @section machine // The size of the print bed -#define X_BED_SIZE 300 -#define Y_BED_SIZE 300 +#define X_BED_SIZE 296 // Nozzle is at X4 when homed +#define Y_BED_SIZE 298 // Nozzle is at Y2 when homed // Travel limits (mm) after homing, corresponding to endstop positions. #define X_MIN_POS 0 #define Y_MIN_POS 0 #define Z_MIN_POS 0 -#define X_MAX_POS X_BED_SIZE -#define Y_MAX_POS Y_BED_SIZE +#define X_MAX_POS 319 // 15mm Extra space on the right end +#define Y_MAX_POS 306 // 4mm Extra space behind the bed #define Z_MAX_POS 400 /** @@ -977,6 +979,18 @@ //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" #define FIL_RUNOUT_PIN 2 // Creality CR10-S stock sensor + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1146,8 +1160,9 @@ #define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1172,8 +1187,8 @@ // Manually set the home position. Leave these undefined for automatic settings. // 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_X_HOME_POS 4 +#define MANUAL_Y_HOME_POS 2 //#define MANUAL_Z_HOME_POS 0 // Use "Z Safe Homing" to avoid homing with a Z probe outside the bed area. @@ -1188,13 +1203,13 @@ //#define Z_SAFE_HOMING #if ENABLED(Z_SAFE_HOMING) - #define Z_SAFE_HOMING_X_POINT ((X_BED_SIZE) / 2) // X point for Z homing when homing all axes (G28). - #define Z_SAFE_HOMING_Y_POINT ((Y_BED_SIZE) / 2) // Y point for Z homing when homing all axes (G28). + #define Z_SAFE_HOMING_X_POINT 150 // X point for Z homing when homing all axes (G28). + #define Z_SAFE_HOMING_Y_POINT 150 // Y point for Z homing when homing all axes (G28). #endif // Homing speeds (mm/m) #define HOMING_FEEDRATE_XY (50*60) -#define HOMING_FEEDRATE_Z (4*60) +#define HOMING_FEEDRATE_Z (8*60) // Validate that endstops are triggered on homing moves #define VALIDATE_HOMING_ENDSTOPS @@ -1302,10 +1317,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 205 #define PREHEAT_1_TEMP_BED 60 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 250 #define PREHEAT_2_TEMP_BED 80 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -1434,10 +1451,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1465,6 +1482,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1829,6 +1853,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1985,5 +2018,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/Creality/CR-10S/Configuration_adv.h b/Marlin/src/config/examples/Creality/CR-10S/Configuration_adv.h index 06f17c2b69..3efbde50f5 100644 --- a/Marlin/src/config/examples/Creality/CR-10S/Configuration_adv.h +++ b/Marlin/src/config/examples/Creality/CR-10S/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -30,8 +31,6 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -176,8 +175,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -245,7 +244,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -385,10 +384,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -413,6 +408,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -464,7 +480,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -482,6 +498,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] @@ -535,15 +562,15 @@ //=============================Additional Features=========================== //=========================================================================== -#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu #define LCD_INFO_MENU @@ -559,7 +586,7 @@ // Add an 'M73' G-code to set the current percentage //#define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -568,7 +595,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -597,7 +624,7 @@ #define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -683,6 +710,43 @@ */ //#define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -697,7 +761,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar #define DOGM_SD_PERCENT @@ -767,16 +831,24 @@ */ #define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 5 // Babysteps are very small. Increase for faster motion. - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - #define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 5 // Babysteps are very small. Increase for faster motion. + + #define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -978,6 +1050,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -1003,21 +1084,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -//#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1258,11 +1360,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1271,10 +1373,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1414,6 +1524,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1556,6 +1675,33 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ @@ -1569,10 +1715,10 @@ #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "Preheat for PLA" + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "Preheat for ABS" + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) #define USER_DESC_4 "Heat Bed/Home/Level" @@ -1737,5 +1883,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/examples/Creality/CR-10S/_Statusscreen.h b/Marlin/src/config/examples/Creality/CR-10S/_Statusscreen.h index 30264c6def..b8b13e000c 100644 --- a/Marlin/src/config/examples/Creality/CR-10S/_Statusscreen.h +++ b/Marlin/src/config/examples/Creality/CR-10S/_Statusscreen.h @@ -30,423 +30,44 @@ * http://marlinfw.org/tools/u8glib/converter.html */ -#define STATUS_SCREENWIDTH 128 +// +// Status Screen Logo bitmap +// +#define STATUS_LOGO_Y 1 +#define STATUS_LOGO_WIDTH 36 -#define STATUS_SCREEN_HOTEND_TEXT_X(E) (38 + (E) * 20) - -#define STATUS_SCREEN_BED_TEXT_X (HOTENDS > 1 ? 81 : 73) - -// Can also be overridden in Configuration.h -#ifndef FAN_ANIM_FRAMES - #define FAN_ANIM_FRAMES 3 -#endif -#define STATUS_SCREEN_FAN_TEXT_X (FAN_ANIM_FRAMES == 3 ? 103 : 105) -#define STATUS_SCREEN_FAN_TEXT_Y (FAN_ANIM_FRAMES > 2 ? 28 : 27) - -//============================================ +const unsigned char status_logo_bmp[] PROGMEM = { + B00111101,B11110000,B00000010,B00111000,B11110000, + B01000100,B10001000,B00000110,B01000101,B00010000, + B10000000,B10001000,B00000010,B01000101,B00000000, + B10000000,B11110000,B00000010,B01000100,B10000000, + B10000000,B10100011,B11110010,B01000100,B01100000, + B10000000,B10010000,B00000010,B01000100,B00010000, + B10000000,B10010000,B00000010,B01000100,B00010000, + B01000100,B10001000,B00000010,B01000101,B00010000, + B00111001,B11001100,B00000111,B00111001,B11100000, + B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00111000,B01110000,B11100000,B00000000, + B00000000,B01000100,B10001001,B00010000,B00000000, + B00000000,B00000100,B10001001,B00010000,B00000000, + B00000000,B00011000,B10001001,B00010000,B00000000, + B00000000,B00000100,B10001001,B00010000,B00000000, + B00000000,B00000100,B10001001,B00010000,B00000000, + B00000000,B00000100,B10001001,B00010000,B00000000, + B00000000,B01000100,B10001001,B00010000,B00000000, + B00000000,B00111000,B01110000,B11100000,B00000000 +}; +// +// Use default bitmaps +// +#define STATUS_HOTEND_ANIM +#define STATUS_BED_ANIM +#define STATUS_HEATERS_XSPACE 20 #if HOTENDS < 2 - - #if FAN_ANIM_FRAMES <= 2 - - const unsigned char status_screen0_bmp[] PROGMEM = { - B00111101,B11110000,B00000010,B00111000,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11110000, - B01000100,B10001000,B00000110,B01000101,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B10000000,B10001000,B00000010,B01000101,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B11111100,B00110000, - B10000000,B11110000,B00000010,B01000100,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B11111100,B00010000, - B10000000,B10100011,B11110010,B01000100,B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B01111000,B00010000, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B00110000,B00010000, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101100,B00000000,B11010000, - B01000100,B10001000,B00000010,B01000101,B00010000,B00011111,B11100000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00101110,B00110001,B11010000, - B00111001,B11001100,B00000111,B00111001,B11100000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00101111,B01111011,B11010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00101111,B01111011,B11010000, - B00000000,B00111000,B01110000,B11100000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00101110,B00110001,B11010000, - B00000000,B01000100,B10001001,B00010000,B00000000,B00011111,B11100000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00101100,B00000000,B11010000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00011111,B11100000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00100000,B00110000,B00010000, - B00000000,B00011000,B10001001,B00010000,B00000000,B00111111,B11110000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00100000,B01111000,B00010000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111111,B11110000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00100000,B11111100,B00010000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00110000,B11111100,B00110000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00000000,B01000100,B10001001,B00010000,B00000000,B00000111,B10000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00111111,B11111111,B11110000, - B00000000,B00111000,B01110000,B11100000,B00000000,B00000011,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00000000,B00000000,B00000000 - }; - const unsigned char status_screen1_bmp[] PROGMEM = { - B00111101,B11110000,B00000010,B00111000,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11110000, - B01000100,B10001000,B00000110,B01000101,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B10000000,B10001000,B00000010,B01000101,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110011,B10000111,B00110000, - B10000000,B11110000,B00000010,B01000100,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100111,B10000111,B10010000, - B10000000,B10100011,B11110010,B01000100,B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B10000111,B11010000, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B10000111,B11010000, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B00000011,B11010000, - B01000100,B10001000,B00000010,B01000101,B00010000,B00011111,B11100000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00100000,B00110000,B00010000, - B00111001,B11001100,B00000111,B00111001,B11100000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00100000,B01111000,B00010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00100000,B01111000,B00010000, - B00000000,B00111000,B01110000,B11100000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00100000,B00110000,B00010000, - B00000000,B01000100,B10001001,B00010000,B00000000,B00011111,B11100000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00101111,B00000011,B11010000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00011111,B11100000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00101111,B10000111,B11010000, - B00000000,B00011000,B10001001,B00010000,B00000000,B00111111,B11110000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00101111,B10000111,B11010000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111111,B11110000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00100111,B10000111,B10010000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00110011,B10000111,B00110000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00000000,B01000100,B10001001,B00010000,B00000000,B00000111,B10000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00111111,B11111111,B11110000, - B00000000,B00111000,B01110000,B11100000,B00000000,B00000011,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00000000,B00000000,B00000000 - }; - - #elif FAN_ANIM_FRAMES == 3 - - const unsigned char status_screen0_bmp[] PROGMEM = { - B00111101,B11110000,B00000010,B00111000,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11111111,B11111111, - B01000100,B10001000,B00000110,B01000101,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11000000,B00011111, - B10000000,B10001000,B00000010,B01000101,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B00100000,B00100111, - B10000000,B11110000,B00000010,B01000100,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,B11110000,B01111011, - B10000000,B10100011,B11110010,B01000100,B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,B11110000,B01111011, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000101,B11111000,B11111101, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000100,B11111000,B11111001, - B01000100,B10001000,B00000010,B01000101,B00010000,B00011111,B11100000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00000100,B00111111,B11100001, - B00111001,B11001100,B00000111,B00111001,B11100000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00000100,B00001111,B10000001, - B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00000100,B00001111,B10000001, - B00000000,B00111000,B01110000,B11100000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00000100,B00001111,B10000001, - B00000000,B01000100,B10001001,B00010000,B00000000,B00011111,B11100000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00000100,B00111111,B11100001, - B00000000,B00000100,B10001001,B00010000,B00000000,B00011111,B11100000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00000100,B11111000,B11111001, - B00000000,B00011000,B10001001,B00010000,B00000000,B00111111,B11110000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00000101,B11111000,B11111101, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111111,B11110000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00000110,B11110000,B01111011, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00000110,B11110000,B01111011, - B00000000,B00000100,B10001001,B00010000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B00100000,B00100111, - B00000000,B01000100,B10001001,B00010000,B00000000,B00000111,B10000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00000111,B11000000,B00011111, - B00000000,B00111000,B01110000,B11100000,B00000000,B00000011,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00000111,B11111111,B11111111 - }; - const unsigned char status_screen1_bmp[] PROGMEM = { - B00111101,B11110000,B00000010,B00111000,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11111111,B11111111, - B01000100,B10001000,B00000110,B01000101,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11000110,B00011111, - B10000000,B10001000,B00000010,B01000101,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B00111110,B00000111, - B10000000,B11110000,B00000010,B01000100,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,B00111110,B00000011, - B10000000,B10100011,B11110010,B01000100,B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,B00011110,B00000011, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000100,B00011110,B00001101, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000100,B00000110,B00111101, - B01000100,B10001000,B00000010,B01000101,B00010000,B00011111,B11100000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00000100,B00000111,B00111101, - B00111001,B11001100,B00000111,B00111001,B11100000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00000100,B00001111,B11111111, - B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00000111,B11111111,B11111111, - B00000000,B00111000,B01110000,B11100000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00000111,B11111111,B10000001, - B00000000,B01000100,B10001001,B00010000,B00000000,B00011111,B11100000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00000101,B11100111,B00000001, - B00000000,B00000100,B10001001,B00010000,B00000000,B00011111,B11100000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00000101,B11000011,B00000001, - B00000000,B00011000,B10001001,B00010000,B00000000,B00111111,B11110000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00000101,B10000011,B11000001, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111111,B11110000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00000110,B00000011,B11000011, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00000110,B00000011,B11100011, - B00000000,B00000100,B10001001,B00010000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B00000011,B11100111, - B00000000,B01000100,B10001001,B00010000,B00000000,B00000111,B10000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00000111,B11000011,B00011111, - B00000000,B00111000,B01110000,B11100000,B00000000,B00000011,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00000111,B11111111,B11111111 - }; - const unsigned char status_screen2_bmp[] PROGMEM = { - B00111101,B11110000,B00000010,B00111000,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11111111,B11111111, - B01000100,B10001000,B00000110,B01000101,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11000011,B00011111, - B10000000,B10001000,B00000010,B01000101,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B00000011,B11100111, - B10000000,B11110000,B00000010,B01000100,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,B00000011,B11110011, - B10000000,B10100011,B11110010,B01000100,B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,B10000011,B11100011, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000101,B11000011,B11000001, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000101,B11100011,B10000001, - B01000100,B10001000,B00000010,B01000101,B00010000,B00011111,B11100000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00000101,B11110111,B00000001, - B00111001,B11001100,B00000111,B00111001,B11100000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00000111,B11111111,B10000001, - B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00000111,B11111111,B11111111, - B00000000,B00111000,B01110000,B11100000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00000100,B00001111,B11111111, - B00000000,B01000100,B10001001,B00010000,B00000000,B00011111,B11100000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00000100,B00000111,B01111101, - B00000000,B00000100,B10001001,B00010000,B00000000,B00011111,B11100000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00000100,B00001110,B00111101, - B00000000,B00011000,B10001001,B00010000,B00000000,B00111111,B11110000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00000100,B00011110,B00011101, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111111,B11110000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00000110,B00111110,B00001011, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00000110,B01111110,B00000011, - B00000000,B00000100,B10001001,B00010000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B00111110,B00000111, - B00000000,B01000100,B10001001,B00010000,B00000000,B00000111,B10000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00000111,B11000110,B00011111, - B00000000,B00111000,B01110000,B11100000,B00000000,B00000011,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00000111,B11111111,B11111111 - }; - - #elif FAN_ANIM_FRAMES == 4 - - const unsigned char status_screen0_bmp[] PROGMEM = { - B00111101,B11110000,B00000010,B00111000,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B01000100,B10001000,B00000110,B01000101,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B00000000,B11111000, - B10000000,B10001000,B00000010,B01000101,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00111111,B00111000, - B10000000,B11110000,B00000010,B01000100,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B01111110,B00011000, - B10000000,B10100011,B11110010,B01000100,B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B01111100,B00011000, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101000,B01111100,B00001000, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101100,B00111000,B00001000, - B01000100,B10001000,B00000010,B01000101,B00010000,B00011111,B11100000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00101111,B00111001,B11001000, - B00111001,B11001100,B00000111,B00111001,B11100000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00101111,B11111111,B11101000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00101111,B11000111,B11101000, - B00000000,B00111000,B01110000,B11100000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00101111,B11111111,B11101000, - B00000000,B01000100,B10001001,B00010000,B00000000,B00011111,B11100000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00100111,B00111001,B11101000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00011111,B11100000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00100000,B00111000,B01101000, - B00000000,B00011000,B10001001,B00010000,B00000000,B00111111,B11110000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00100000,B01111100,B00101000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111111,B11110000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00110000,B01111100,B00011000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00110000,B11111100,B00011000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111001,B11111000,B00111000, - B00000000,B01000100,B10001001,B00010000,B00000000,B00000111,B10000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00111110,B00000000,B11111000, - B00000000,B00111000,B01110000,B11100000,B00000000,B00000011,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00111111,B11111111,B11111000 - }; - const unsigned char status_screen1_bmp[] PROGMEM = { - B00111101,B11110000,B00000010,B00111000,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B01000100,B10001000,B00000110,B01000101,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B00000000,B11111000, - B10000000,B10001000,B00000010,B01000101,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00001111,B00111000, - B10000000,B11110000,B00000010,B01000100,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110100,B00011111,B11011000, - B10000000,B10100011,B11110010,B01000100,B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110110,B00011111,B10011000, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B00011111,B00001000, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B10011110,B00001000, - B01000100,B10001000,B00000010,B01000101,B00010000,B00011111,B11100000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00101111,B11111100,B00001000, - B00111001,B11001100,B00000111,B00111001,B11100000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00101111,B11011100,B00001000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00100111,B11101111,B11001000, - B00000000,B00111000,B01110000,B11100000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00100000,B01110111,B11101000, - B00000000,B01000100,B10001001,B00010000,B00000000,B00011111,B11100000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00100000,B01111111,B11101000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00011111,B11100000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00100000,B11110011,B11101000, - B00000000,B00011000,B10001001,B00010000,B00000000,B00111111,B11110000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00100001,B11110001,B11101000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111111,B11110000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00110011,B11110000,B11011000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00110111,B11110000,B01011000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111001,B11100000,B00111000, - B00000000,B01000100,B10001001,B00010000,B00000000,B00000111,B10000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00111110,B00000000,B11111000, - B00000000,B00111000,B01110000,B11100000,B00000000,B00000011,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00111111,B11111111,B11111000 - }; - const unsigned char status_screen2_bmp[] PROGMEM = { - B00111101,B11110000,B00000010,B00111000,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B01000100,B10001000,B00000110,B01000101,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B10000000,B11111000, - B10000000,B10001000,B00000010,B01000101,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111001,B10000000,B00111000, - B10000000,B11110000,B00000010,B01000100,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110111,B10000001,B11011000, - B10000000,B10100011,B11110010,B01000100,B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110111,B11000011,B11011000, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100111,B11000111,B11101000, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100011,B11000111,B11111000, - B01000100,B10001000,B00000010,B01000101,B00010000,B00011111,B11100000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00100001,B11111111,B10001000, - B00111001,B11001100,B00000111,B00111001,B11100000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00100000,B01101100,B00001000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00100000,B01101100,B00001000, - B00000000,B00111000,B01110000,B11100000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00100000,B01101100,B00001000, - B00000000,B01000100,B10001001,B00010000,B00000000,B00011111,B11100000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00100011,B11111111,B00001000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00011111,B11100000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00111111,B11000111,B10001000, - B00000000,B00011000,B10001001,B00010000,B00000000,B00111111,B11110000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00101111,B11000111,B11001000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111111,B11110000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00110111,B10000111,B11011000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00110111,B00000011,B11011000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000011,B00111000, - B00000000,B01000100,B10001001,B00010000,B00000000,B00000111,B10000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00111110,B00000010,B11111000, - B00000000,B00111000,B01110000,B11100000,B00000000,B00000011,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00111111,B11111111,B11111000 - }; - const unsigned char status_screen3_bmp[] PROGMEM = { - B00111101,B11110000,B00000010,B00111000,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B01000100,B10001000,B00000110,B01000101,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B00000000,B11111000, - B10000000,B10001000,B00000010,B01000101,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111001,B11110000,B00111000, - B10000000,B11110000,B00000010,B01000100,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110001,B11100000,B00011000, - B10000000,B10100011,B11110010,B01000100,B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110001,B11100000,B00011000, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100001,B11100001,B11101000, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B11110011,B11101000, - B01000100,B10001000,B00000010,B01000101,B00010000,B00011111,B11100000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00100000,B01111111,B11101000, - B00111001,B11001100,B00000111,B00111001,B11100000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00100000,B01110111,B11101000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00101000,B11101110,B00101000, - B00000000,B00111000,B01110000,B11100000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00101111,B11011100,B00001000, - B00000000,B01000100,B10001001,B00010000,B00000000,B00011111,B11100000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00101111,B11111100,B00001000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00011111,B11100000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00101111,B10011110,B00001000, - B00000000,B00011000,B10001001,B00010000,B00000000,B00111111,B11110000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00101111,B00001111,B00001000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111111,B11110000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00110000,B00001111,B00011000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00110000,B00001111,B00011000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00011111,B00111000, - B00000000,B01000100,B10001001,B00010000,B00000000,B00000111,B10000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00111110,B00000000,B11111000, - B00000000,B00111000,B01110000,B11100000,B00000000,B00000011,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00111111,B11111111,B11111000 - }; - - #endif - -#else // HOTENDS >= 2 - - #if FAN_ANIM_FRAMES <= 2 - - const unsigned char status_screen0_bmp[] PROGMEM = { - B00111101,B11110000,B00000010,B00111000,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11110000, - B01000100,B10001000,B00000110,B01000101,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B10000000,B10001000,B00000010,B01000101,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B11111100,B00110000, - B10000000,B11110000,B00000010,B01000100,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B11111100,B00010000, - B10000000,B10100011,B11110010,B01000100,B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B01111000,B00010000, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B00110000,B00010000, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101100,B00000000,B11010000, - B01000100,B10001000,B00000010,B01000101,B00010000,B00011111,B11100000,B00000001,B11111110,B00000000,B00001000,B00100000,B10000000,B00101110,B00110001,B11010000, - B00111001,B11001100,B00000111,B00111001,B11100000,B00111110,B11110000,B00000011,B11001111,B00000000,B00000100,B00010000,B01000000,B00101111,B01111011,B11010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00111100,B11110000,B00000011,B10110111,B00000000,B00000100,B00010000,B01000000,B00101111,B01111011,B11010000, - B00000000,B00111000,B01110000,B11100000,B00000000,B00111010,B11110000,B00000011,B11110111,B00000000,B00001000,B00100000,B10000000,B00101110,B00110001,B11010000, - B00000000,B01000100,B10001001,B00010000,B00000000,B00011110,B11100000,B00000001,B11101110,B00000000,B00010000,B01000001,B00000000,B00101100,B00000000,B11010000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00011110,B11100000,B00000001,B11011110,B00000000,B00100000,B10000010,B00000000,B00100000,B00110000,B00010000, - B00000000,B00011000,B10001001,B00010000,B00000000,B00111110,B11110000,B00000011,B10111111,B00000000,B00100000,B10000010,B00000000,B00100000,B01111000,B00010000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111110,B11110000,B00000011,B10000111,B00000000,B00010000,B01000001,B00000000,B00100000,B11111100,B00010000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111111,B11110000,B00000011,B11111111,B00000000,B00001000,B00100000,B10000000,B00110000,B11111100,B00110000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00001111,B11000000,B00000000,B11111100,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00000000,B01000100,B10001001,B00010000,B00000000,B00000111,B10000000,B00000000,B01111000,B00000000,B11111111,B11111111,B11000000,B00111111,B11111111,B11110000, - B00000000,B00111000,B01110000,B11100000,B00000000,B00000011,B00000000,B00000000,B00110000,B00000000,B11111111,B11111111,B11000000,B00000000,B00000000,B00000000 - }; - const unsigned char status_screen1_bmp[] PROGMEM = { - B00111101,B11110000,B00000010,B00111000,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11110000, - B01000100,B10001000,B00000110,B01000101,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B10000000,B10001000,B00000010,B01000101,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110011,B10000111,B00110000, - B10000000,B11110000,B00000010,B01000100,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100111,B10000111,B10010000, - B10000000,B10100011,B11110010,B01000100,B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B10000111,B11010000, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B10000111,B11010000, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B00000011,B11010000, - B01000100,B10001000,B00000010,B01000101,B00010000,B00011111,B11100000,B00000001,B11111110,B00000000,B00001000,B00100000,B10000000,B00100000,B00110000,B00010000, - B00111001,B11001100,B00000111,B00111001,B11100000,B00111110,B11110000,B00000011,B11001111,B00000000,B00000100,B00010000,B01000000,B00100000,B01111000,B00010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00111100,B11110000,B00000011,B10110111,B00000000,B00000100,B00010000,B01000000,B00100000,B01111000,B00010000, - B00000000,B00111000,B01110000,B11100000,B00000000,B00111010,B11110000,B00000011,B11110111,B00000000,B00001000,B00100000,B10000000,B00100000,B00110000,B00010000, - B00000000,B01000100,B10001001,B00010000,B00000000,B00011110,B11100000,B00000001,B11101110,B00000000,B00010000,B01000001,B00000000,B00101111,B00000011,B11010000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00011110,B11100000,B00000001,B11011110,B00000000,B00100000,B10000010,B00000000,B00101111,B10000111,B11010000, - B00000000,B00011000,B10001001,B00010000,B00000000,B00111110,B11110000,B00000011,B10111111,B00000000,B00100000,B10000010,B00000000,B00101111,B10000111,B11010000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111110,B11110000,B00000011,B10000111,B00000000,B00010000,B01000001,B00000000,B00100111,B10000111,B10010000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111111,B11110000,B00000011,B11111111,B00000000,B00001000,B00100000,B10000000,B00110011,B10000111,B00110000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00001111,B11000000,B00000000,B11111100,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00000000,B01000100,B10001001,B00010000,B00000000,B00000111,B10000000,B00000000,B01111000,B00000000,B11111111,B11111111,B11000000,B00111111,B11111111,B11110000, - B00000000,B00111000,B01110000,B11100000,B00000000,B00000011,B00000000,B00000000,B00110000,B00000000,B11111111,B11111111,B11000000,B00000000,B00000000,B00000000 - }; - - #elif FAN_ANIM_FRAMES == 3 - - const unsigned char status_screen0_bmp[] PROGMEM = { - B00111101,B11110000,B00000010,B00111000,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11111111,B11111111, - B01000100,B10001000,B00000110,B01000101,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11000000,B00011111, - B10000000,B10001000,B00000010,B01000101,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B00100000,B00100111, - B10000000,B11110000,B00000010,B01000100,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,B11110000,B01111011, - B10000000,B10100011,B11110010,B01000100,B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,B11110000,B01111011, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000101,B11111000,B11111101, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000100,B11111000,B11111001, - B01000100,B10001000,B00000010,B01000101,B00010000,B00011111,B11100000,B00000001,B11111110,B00000000,B00001000,B00100000,B10000000,B00000100,B00111111,B11100001, - B00111001,B11001100,B00000111,B00111001,B11100000,B00111110,B11110000,B00000011,B11001111,B00000000,B00000100,B00010000,B01000000,B00000100,B00001111,B10000001, - B00000000,B00000000,B00000000,B00000000,B00000000,B00111100,B11110000,B00000011,B10110111,B00000000,B00000100,B00010000,B01000000,B00000100,B00001111,B10000001, - B00000000,B00111000,B01110000,B11100000,B00000000,B00111010,B11110000,B00000011,B11110111,B00000000,B00001000,B00100000,B10000000,B00000100,B00001111,B10000001, - B00000000,B01000100,B10001001,B00010000,B00000000,B00011110,B11100000,B00000001,B11101110,B00000000,B00010000,B01000001,B00000000,B00000100,B00111111,B11100001, - B00000000,B00000100,B10001001,B00010000,B00000000,B00011110,B11100000,B00000001,B11011110,B00000000,B00100000,B10000010,B00000000,B00000100,B11111000,B11111001, - B00000000,B00011000,B10001001,B00010000,B00000000,B00111110,B11110000,B00000011,B10111111,B00000000,B00100000,B10000010,B00000000,B00000101,B11111000,B11111101, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111110,B11110000,B00000011,B10000111,B00000000,B00010000,B01000001,B00000000,B00000110,B11110000,B01111011, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111111,B11110000,B00000011,B11111111,B00000000,B00001000,B00100000,B10000000,B00000110,B11110000,B01111011, - B00000000,B00000100,B10001001,B00010000,B00000000,B00001111,B11000000,B00000000,B11111100,B00000000,B00000000,B00000000,B00000000,B00000111,B00100000,B00100111, - B00000000,B01000100,B10001001,B00010000,B00000000,B00000111,B10000000,B00000000,B01111000,B00000000,B11111111,B11111111,B11000000,B00000111,B11000000,B00011111, - B00000000,B00111000,B01110000,B11100000,B00000000,B00000011,B00000000,B00000000,B00110000,B00000000,B11111111,B11111111,B11000000,B00000111,B11111111,B11111111 - }; - const unsigned char status_screen1_bmp[] PROGMEM = { - B00111101,B11110000,B00000010,B00111000,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11111111,B11111111, - B01000100,B10001000,B00000110,B01000101,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11000110,B00011111, - B10000000,B10001000,B00000010,B01000101,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B00111110,B00000111, - B10000000,B11110000,B00000010,B01000100,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,B00111110,B00000011, - B10000000,B10100011,B11110010,B01000100,B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,B00011110,B00000011, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000100,B00011110,B00001101, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000100,B00000110,B00111101, - B01000100,B10001000,B00000010,B01000101,B00010000,B00011111,B11100000,B00000001,B11111110,B00000000,B00001000,B00100000,B10000000,B00000100,B00000111,B00111101, - B00111001,B11001100,B00000111,B00111001,B11100000,B00111110,B11110000,B00000011,B11001111,B00000000,B00000100,B00010000,B01000000,B00000100,B00001111,B11111111, - B00000000,B00000000,B00000000,B00000000,B00000000,B00111100,B11110000,B00000011,B10110111,B00000000,B00000100,B00010000,B01000000,B00000111,B11111111,B11111111, - B00000000,B00111000,B01110000,B11100000,B00000000,B00111010,B11110000,B00000011,B11110111,B00000000,B00001000,B00100000,B10000000,B00000111,B11111111,B10000001, - B00000000,B01000100,B10001001,B00010000,B00000000,B00011110,B11100000,B00000001,B11101110,B00000000,B00010000,B01000001,B00000000,B00000101,B11100111,B00000001, - B00000000,B00000100,B10001001,B00010000,B00000000,B00011110,B11100000,B00000001,B11011110,B00000000,B00100000,B10000010,B00000000,B00000101,B11000011,B00000001, - B00000000,B00011000,B10001001,B00010000,B00000000,B00111110,B11110000,B00000011,B10111111,B00000000,B00100000,B10000010,B00000000,B00000101,B10000011,B11000001, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111110,B11110000,B00000011,B10000111,B00000000,B00010000,B01000001,B00000000,B00000110,B00000011,B11000011, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111111,B11110000,B00000011,B11111111,B00000000,B00001000,B00100000,B10000000,B00000110,B00000011,B11100011, - B00000000,B00000100,B10001001,B00010000,B00000000,B00001111,B11000000,B00000000,B11111100,B00000000,B00000000,B00000000,B00000000,B00000111,B00000011,B11100111, - B00000000,B01000100,B10001001,B00010000,B00000000,B00000111,B10000000,B00000000,B01111000,B00000000,B11111111,B11111111,B11000000,B00000111,B11000011,B00011111, - B00000000,B00111000,B01110000,B11100000,B00000000,B00000011,B00000000,B00000000,B00110000,B00000000,B11111111,B11111111,B11000000,B00000111,B11111111,B11111111 - }; - const unsigned char status_screen2_bmp[] PROGMEM = { - B00111101,B11110000,B00000010,B00111000,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11111111,B11111111, - B01000100,B10001000,B00000110,B01000101,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11000011,B00011111, - B10000000,B10001000,B00000010,B01000101,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B00000011,B11100111, - B10000000,B11110000,B00000010,B01000100,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,B00000011,B11110011, - B10000000,B10100011,B11110010,B01000100,B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,B10000011,B11100011, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000101,B11000011,B11000001, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000101,B11100011,B10000001, - B01000100,B10001000,B00000010,B01000101,B00010000,B00011111,B11100000,B00000001,B11111110,B00000000,B00001000,B00100000,B10000000,B00000101,B11110111,B00000001, - B00111001,B11001100,B00000111,B00111001,B11100000,B00111110,B11110000,B00000011,B11001111,B00000000,B00000100,B00010000,B01000000,B00000111,B11111111,B10000001, - B00000000,B00000000,B00000000,B00000000,B00000000,B00111100,B11110000,B00000011,B10110111,B00000000,B00000100,B00010000,B01000000,B00000111,B11111111,B11111111, - B00000000,B00111000,B01110000,B11100000,B00000000,B00111010,B11110000,B00000011,B11110111,B00000000,B00001000,B00100000,B10000000,B00000100,B00001111,B11111111, - B00000000,B01000100,B10001001,B00010000,B00000000,B00011110,B11100000,B00000001,B11101110,B00000000,B00010000,B01000001,B00000000,B00000100,B00000111,B01111101, - B00000000,B00000100,B10001001,B00010000,B00000000,B00011110,B11100000,B00000001,B11011110,B00000000,B00100000,B10000010,B00000000,B00000100,B00001110,B00111101, - B00000000,B00011000,B10001001,B00010000,B00000000,B00111110,B11110000,B00000011,B10111111,B00000000,B00100000,B10000010,B00000000,B00000100,B00011110,B00011101, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111110,B11110000,B00000011,B10000111,B00000000,B00010000,B01000001,B00000000,B00000110,B00111110,B00001011, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111111,B11110000,B00000011,B11111111,B00000000,B00001000,B00100000,B10000000,B00000110,B01111110,B00000011, - B00000000,B00000100,B10001001,B00010000,B00000000,B00001111,B11000000,B00000000,B11111100,B00000000,B00000000,B00000000,B00000000,B00000111,B00111110,B00000111, - B00000000,B01000100,B10001001,B00010000,B00000000,B00000111,B10000000,B00000000,B01111000,B00000000,B11111111,B11111111,B11000000,B00000111,B11000110,B00011111, - B00000000,B00111000,B01110000,B11100000,B00000000,B00000011,B00000000,B00000000,B00110000,B00000000,B11111111,B11111111,B11000000,B00000111,B11111111,B11111111 - }; - - #elif FAN_ANIM_FRAMES == 4 - - const unsigned char status_screen0_bmp[] PROGMEM = { - B00111101,B11110000,B00000010,B00111000,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B01000100,B10001000,B00000110,B01000101,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B00000000,B11111000, - B10000000,B10001000,B00000010,B01000101,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00111111,B00111000, - B10000000,B11110000,B00000010,B01000100,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B01111110,B00011000, - B10000000,B10100011,B11110010,B01000100,B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B01111100,B00011000, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101000,B01111100,B00001000, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101100,B00111000,B00001000, - B01000100,B10001000,B00000010,B01000101,B00010000,B00011111,B11100000,B00000001,B11111110,B00000000,B00001000,B00100000,B10000000,B00101111,B00111001,B11001000, - B00111001,B11001100,B00000111,B00111001,B11100000,B00111110,B11110000,B00000011,B11001111,B00000000,B00000100,B00010000,B01000000,B00101111,B11111111,B11101000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00111100,B11110000,B00000011,B10110111,B00000000,B00000100,B00010000,B01000000,B00101111,B11000111,B11101000, - B00000000,B00111000,B01110000,B11100000,B00000000,B00111010,B11110000,B00000011,B11110111,B00000000,B00001000,B00100000,B10000000,B00101111,B11111111,B11101000, - B00000000,B01000100,B10001001,B00010000,B00000000,B00011110,B11100000,B00000001,B11101110,B00000000,B00010000,B01000001,B00000000,B00100111,B00111001,B11101000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00011110,B11100000,B00000001,B11011110,B00000000,B00100000,B10000010,B00000000,B00100000,B00111000,B01101000, - B00000000,B00011000,B10001001,B00010000,B00000000,B00111110,B11110000,B00000011,B10111111,B00000000,B00100000,B10000010,B00000000,B00100000,B01111100,B00101000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111110,B11110000,B00000011,B10000111,B00000000,B00010000,B01000001,B00000000,B00110000,B01111100,B00011000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111111,B11110000,B00000011,B11111111,B00000000,B00001000,B00100000,B10000000,B00110000,B11111100,B00011000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00001111,B11000000,B00000000,B11111100,B00000000,B00000000,B00000000,B00000000,B00111001,B11111000,B00111000, - B00000000,B01000100,B10001001,B00010000,B00000000,B00000111,B10000000,B00000000,B01111000,B00000000,B11111111,B11111111,B11000000,B00111110,B00000000,B11111000, - B00000000,B00111000,B01110000,B11100000,B00000000,B00000011,B00000000,B00000000,B00110000,B00000000,B11111111,B11111111,B11000000,B00111111,B11111111,B11111000 - }; - const unsigned char status_screen1_bmp[] PROGMEM = { - B00111101,B11110000,B00000010,B00111000,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B01000100,B10001000,B00000110,B01000101,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B00000000,B11111000, - B10000000,B10001000,B00000010,B01000101,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00001111,B00111000, - B10000000,B11110000,B00000010,B01000100,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110100,B00011111,B11011000, - B10000000,B10100011,B11110010,B01000100,B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110110,B00011111,B10011000, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B00011111,B00001000, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B10011110,B00001000, - B01000100,B10001000,B00000010,B01000101,B00010000,B00011111,B11100000,B00000001,B11111110,B00000000,B00001000,B00100000,B10000000,B00101111,B11111100,B00001000, - B00111001,B11001100,B00000111,B00111001,B11100000,B00111110,B11110000,B00000011,B11001111,B00000000,B00000100,B00010000,B01000000,B00101111,B11011100,B00001000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00111100,B11110000,B00000011,B10110111,B00000000,B00000100,B00010000,B01000000,B00100111,B11101111,B11001000, - B00000000,B00111000,B01110000,B11100000,B00000000,B00111010,B11110000,B00000011,B11110111,B00000000,B00001000,B00100000,B10000000,B00100000,B01110111,B11101000, - B00000000,B01000100,B10001001,B00010000,B00000000,B00011110,B11100000,B00000001,B11101110,B00000000,B00010000,B01000001,B00000000,B00100000,B01111111,B11101000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00011110,B11100000,B00000001,B11011110,B00000000,B00100000,B10000010,B00000000,B00100000,B11110011,B11101000, - B00000000,B00011000,B10001001,B00010000,B00000000,B00111110,B11110000,B00000011,B10111111,B00000000,B00100000,B10000010,B00000000,B00100001,B11110001,B11101000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111110,B11110000,B00000011,B10000111,B00000000,B00010000,B01000001,B00000000,B00110011,B11110000,B11011000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111111,B11110000,B00000011,B11111111,B00000000,B00001000,B00100000,B10000000,B00110111,B11110000,B01011000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00001111,B11000000,B00000000,B11111100,B00000000,B00000000,B00000000,B00000000,B00111001,B11100000,B00111000, - B00000000,B01000100,B10001001,B00010000,B00000000,B00000111,B10000000,B00000000,B01111000,B00000000,B11111111,B11111111,B11000000,B00111110,B00000000,B11111000, - B00000000,B00111000,B01110000,B11100000,B00000000,B00000011,B00000000,B00000000,B00110000,B00000000,B11111111,B11111111,B11000000,B00111111,B11111111,B11111000 - }; - const unsigned char status_screen2_bmp[] PROGMEM = { - B00111101,B11110000,B00000010,B00111000,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B01000100,B10001000,B00000110,B01000101,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B10000000,B11111000, - B10000000,B10001000,B00000010,B01000101,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111001,B10000000,B00111000, - B10000000,B11110000,B00000010,B01000100,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110111,B10000001,B11011000, - B10000000,B10100011,B11110010,B01000100,B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110111,B11000011,B11011000, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100111,B11000111,B11101000, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100011,B11000111,B11111000, - B01000100,B10001000,B00000010,B01000101,B00010000,B00011111,B11100000,B00000001,B11111110,B00000000,B00001000,B00100000,B10000000,B00100001,B11111111,B10001000, - B00111001,B11001100,B00000111,B00111001,B11100000,B00111110,B11110000,B00000011,B11001111,B00000000,B00000100,B00010000,B01000000,B00100000,B01101100,B00001000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00111100,B11110000,B00000011,B10110111,B00000000,B00000100,B00010000,B01000000,B00100000,B01101100,B00001000, - B00000000,B00111000,B01110000,B11100000,B00000000,B00111010,B11110000,B00000011,B11110111,B00000000,B00001000,B00100000,B10000000,B00100000,B01101100,B00001000, - B00000000,B01000100,B10001001,B00010000,B00000000,B00011110,B11100000,B00000001,B11101110,B00000000,B00010000,B01000001,B00000000,B00100011,B11111111,B00001000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00011110,B11100000,B00000001,B11011110,B00000000,B00100000,B10000010,B00000000,B00111111,B11000111,B10001000, - B00000000,B00011000,B10001001,B00010000,B00000000,B00111110,B11110000,B00000011,B10111111,B00000000,B00100000,B10000010,B00000000,B00101111,B11000111,B11001000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111110,B11110000,B00000011,B10000111,B00000000,B00010000,B01000001,B00000000,B00110111,B10000111,B11011000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111111,B11110000,B00000011,B11111111,B00000000,B00001000,B00100000,B10000000,B00110111,B00000011,B11011000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00001111,B11000000,B00000000,B11111100,B00000000,B00000000,B00000000,B00000000,B00111000,B00000011,B00111000, - B00000000,B01000100,B10001001,B00010000,B00000000,B00000111,B10000000,B00000000,B01111000,B00000000,B11111111,B11111111,B11000000,B00111110,B00000010,B11111000, - B00000000,B00111000,B01110000,B11100000,B00000000,B00000011,B00000000,B00000000,B00110000,B00000000,B11111111,B11111111,B11000000,B00111111,B11111111,B11111000 - }; - const unsigned char status_screen3_bmp[] PROGMEM = { - B00111101,B11110000,B00000010,B00111000,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B01000100,B10001000,B00000110,B01000101,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B00000000,B11111000, - B10000000,B10001000,B00000010,B01000101,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111001,B11110000,B00111000, - B10000000,B11110000,B00000010,B01000100,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110001,B11100000,B00011000, - B10000000,B10100011,B11110010,B01000100,B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110001,B11100000,B00011000, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100001,B11100001,B11101000, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B11110011,B11101000, - B01000100,B10001000,B00000010,B01000101,B00010000,B00011111,B11100000,B00000001,B11111110,B00000000,B00001000,B00100000,B10000000,B00100000,B01111111,B11101000, - B00111001,B11001100,B00000111,B00111001,B11100000,B00111110,B11110000,B00000011,B11001111,B00000000,B00000100,B00010000,B01000000,B00100000,B01110111,B11101000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00111100,B11110000,B00000011,B10110111,B00000000,B00000100,B00010000,B01000000,B00101000,B11101110,B00101000, - B00000000,B00111000,B01110000,B11100000,B00000000,B00111010,B11110000,B00000011,B11110111,B00000000,B00001000,B00100000,B10000000,B00101111,B11011100,B00001000, - B00000000,B01000100,B10001001,B00010000,B00000000,B00011110,B11100000,B00000001,B11101110,B00000000,B00010000,B01000001,B00000000,B00101111,B11111100,B00001000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00011110,B11100000,B00000001,B11011110,B00000000,B00100000,B10000010,B00000000,B00101111,B10011110,B00001000, - B00000000,B00011000,B10001001,B00010000,B00000000,B00111110,B11110000,B00000011,B10111111,B00000000,B00100000,B10000010,B00000000,B00101111,B00001111,B00001000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111110,B11110000,B00000011,B10000111,B00000000,B00010000,B01000001,B00000000,B00110000,B00001111,B00011000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111111,B11110000,B00000011,B11111111,B00000000,B00001000,B00100000,B10000000,B00110000,B00001111,B00011000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00001111,B11000000,B00000000,B11111100,B00000000,B00000000,B00000000,B00000000,B00111000,B00011111,B00111000, - B00000000,B01000100,B10001001,B00010000,B00000000,B00000111,B10000000,B00000000,B01111000,B00000000,B11111111,B11111111,B11000000,B00111110,B00000000,B11111000, - B00000000,B00111000,B01110000,B11100000,B00000000,B00000011,B00000000,B00000000,B00110000,B00000000,B11111111,B11111111,B11000000,B00111111,B11111111,B11111000 - }; - - #endif - -#endif // HOTENDS >= 2 + #define STATUS_HEATERS_X 48 + #define STATUS_BED_X 72 +#else + #define STATUS_HEATERS_X 40 + #define STATUS_BED_X 80 +#endif diff --git a/Marlin/src/config/examples/Creality/CR-10mini/Configuration.h b/Marlin/src/config/examples/Creality/CR-10mini/Configuration.h index 5677793099..d43352d402 100644 --- a/Marlin/src/config/examples/Creality/CR-10mini/Configuration.h +++ b/Marlin/src/config/examples/Creality/CR-10mini/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -44,8 +45,6 @@ * CR10_STOCKDISPLAY (RAMPS-compatible with single 10-pin plug) */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -212,7 +211,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -229,7 +228,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -791,6 +789,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -878,6 +883,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -898,8 +904,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -924,7 +930,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 5 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 5 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -991,6 +997,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1160,8 +1178,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1316,10 +1335,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 200 #define PREHEAT_1_TEMP_BED 70 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 110 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -1448,10 +1469,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1479,6 +1500,13 @@ */ #define DISPLAY_CHARSET_HD44780 WESTERN +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1843,6 +1871,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1999,5 +2036,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/Creality/CR-10mini/Configuration_adv.h b/Marlin/src/config/examples/Creality/CR-10mini/Configuration_adv.h index d27b9e27cc..e083d95a41 100644 --- a/Marlin/src/config/examples/Creality/CR-10mini/Configuration_adv.h +++ b/Marlin/src/config/examples/Creality/CR-10mini/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -30,8 +31,6 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -176,8 +175,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -245,7 +244,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -385,10 +384,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -413,6 +408,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -464,7 +480,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -482,6 +498,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] @@ -535,15 +562,15 @@ //=============================Additional Features=========================== //=========================================================================== -#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu #define LCD_INFO_MENU @@ -559,7 +586,7 @@ // Add an 'M73' G-code to set the current percentage //#define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -568,7 +595,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -597,7 +624,7 @@ #define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -683,6 +710,43 @@ */ //#define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -697,7 +761,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar //#define DOGM_SD_PERCENT @@ -767,16 +831,24 @@ */ #define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - #define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. + + #define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -978,6 +1050,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -1003,21 +1084,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -//#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1258,11 +1360,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1271,10 +1373,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1414,6 +1524,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1556,6 +1675,33 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ @@ -1569,10 +1715,10 @@ #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "Preheat for PLA" + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "Preheat for ABS" + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) #define USER_DESC_4 "Heat Bed/Home/Level" @@ -1737,5 +1883,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/examples/Creality/CR-10mini/_Statusscreen.h b/Marlin/src/config/examples/Creality/CR-10mini/_Statusscreen.h index f4fd17696a..29353ad7e5 100644 --- a/Marlin/src/config/examples/Creality/CR-10mini/_Statusscreen.h +++ b/Marlin/src/config/examples/Creality/CR-10mini/_Statusscreen.h @@ -30,51 +30,44 @@ * http://marlinfw.org/tools/u8glib/converter.html */ -#define STATUS_SCREENWIDTH 128 -#define STATUS_SCREEN_HOTEND_TEXT_X(E) 38 -#define STATUS_SCREEN_BED_TEXT_X 73 +// +// Status Screen Logo bitmap +// +#define STATUS_LOGO_Y 5 +#define STATUS_LOGO_WIDTH 36 -//============================================ +const unsigned char status_logo_bmp[] PROGMEM = { + B00000111,B11001111,B10000000,B00110001,B11100000, + B00001111,B11001111,B11000000,B01110011,B11110000, + B00001100,B00001100,B01000000,B01110011,B00110000, + B00001100,B00001100,B11000000,B00110011,B00110000, + B00001100,B00001111,B11001111,B00110011,B00110000, + B00001100,B00001101,B10001111,B00110011,B00110000, + B00001100,B00001100,B11000000,B00110011,B00110000, + B00001111,B11001100,B11000000,B00110011,B11110000, + B00000111,B11001100,B11000000,B00110001,B11100000, + B00000000,B00000000,B00000000,B00000000,B00000000, + B00000001,B10000011,B00110000,B00000011,B00000000, + B00000001,B10000011,B00110010,B00000011,B00000000, + B00000001,B11000111,B00000010,B11100000,B00000000, + B00000001,B11000111,B00110011,B11110011,B00000000, + B00000001,B11101111,B00110011,B00110011,B00000000, + B00000001,B10111011,B00110011,B00110011,B00000000, + B00000001,B10010011,B00110011,B00110011,B00000000, + B00000001,B10010011,B00110011,B00110011,B00000000, + B00000001,B10000011,B00110011,B00110011,B00000000 +}; -const unsigned char status_screen0_bmp[] PROGMEM = { - B00000111,B11001111,B10000000,B00110001,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11110000, - B00001111,B11001111,B11000000,B01110011,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00001100,B00001100,B01000000,B01110011,B00110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B11111100,B00110000, - B00001100,B00001100,B11000000,B00110011,B00110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B11111100,B00010000, - B00001100,B00001111,B11001111,B00110011,B00110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B01111000,B00010000, - B00001100,B00001101,B10001111,B00110011,B00110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B00110000,B00010000, - B00001100,B00001100,B11000000,B00110011,B00110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101100,B00000000,B11010000, - B00001111,B11001100,B11000000,B00110011,B11110000,B00011111,B11100000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00101110,B00110001,B11010000, - B00000111,B11001100,B11000000,B00110001,B11100000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00101111,B01111011,B11010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00101111,B01111011,B11010000, - B00000001,B10000011,B00110000,B00000011,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00101110,B00110001,B11010000, - B00000001,B10000011,B00110010,B00000011,B00000000,B00011111,B11100000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00101100,B00000000,B11010000, - B00000001,B11000111,B00000010,B11100000,B00000000,B00011111,B11100000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00100000,B00110000,B00010000, - B00000001,B11000111,B00110011,B11110011,B00000000,B00111111,B11110000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00100000,B01111000,B00010000, - B00000001,B11101111,B00110011,B00110011,B00000000,B00111111,B11110000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00100000,B11111100,B00010000, - B00000001,B10111011,B00110011,B00110011,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00110000,B11111100,B00110000, - B00000001,B10010011,B00110011,B00110011,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00000001,B10010011,B00110011,B00110011,B00000000,B00000111,B10000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00111111,B11111111,B11110000, - B00000001,B10000011,B00110011,B00110011,B00000000,B00000011,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00000000,B00000000,B00000000 -}; -const unsigned char status_screen1_bmp[] PROGMEM = { - B00000111,B11001111,B10000000,B00110001,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11110000, - B00001111,B11001111,B11000000,B01110011,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00001100,B00001100,B01000000,B01110011,B00110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110011,B10000111,B00110000, - B00001100,B00001100,B11000000,B00110011,B00110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100111,B10000111,B10010000, - B00001100,B00001111,B11001111,B00110011,B00110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B10000111,B11010000, - B00001100,B00001101,B10001111,B00110011,B00110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B10000111,B11010000, - B00001100,B00001100,B11000000,B00110011,B00110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B00000011,B11010000, - B00001111,B11001100,B11000000,B00110011,B11110000,B00011111,B11100000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00100000,B00110000,B00010000, - B00000111,B11001100,B11000000,B00110001,B11100000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00100000,B01111000,B00010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00100000,B01111000,B00010000, - B00000001,B10000011,B00110000,B00000011,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00100000,B00110000,B00010000, - B00000001,B10000011,B00110010,B00000011,B00000000,B00011111,B11100000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00101111,B00000011,B11010000, - B00000001,B11000111,B00000010,B11100000,B00000000,B00011111,B11100000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00101111,B10000111,B11010000, - B00000001,B11000111,B00110011,B11110011,B00000000,B00111111,B11110000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00101111,B10000111,B11010000, - B00000001,B11101111,B00110011,B00110011,B00000000,B00111111,B11110000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00100111,B10000111,B10010000, - B00000001,B10111011,B00110011,B00110011,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00110011,B10000111,B00110000, - B00000001,B10010011,B00110011,B00110011,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00000001,B10010011,B00110011,B00110011,B00000000,B00000111,B10000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00111111,B11111111,B11110000, - B00000001,B10000011,B00110011,B00110011,B00000000,B00000011,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00000000,B00000000,B00000000 -}; +// +// Use default bitmaps +// +#define STATUS_HOTEND_ANIM +#define STATUS_BED_ANIM +#define STATUS_HEATERS_XSPACE 20 +#if HOTENDS < 2 + #define STATUS_HEATERS_X 48 + #define STATUS_BED_X 72 +#else + #define STATUS_HEATERS_X 40 + #define STATUS_BED_X 80 +#endif diff --git a/Marlin/src/config/examples/Creality/CR-8/Configuration.h b/Marlin/src/config/examples/Creality/CR-8/Configuration.h index 1b4197a98d..8623526611 100644 --- a/Marlin/src/config/examples/Creality/CR-8/Configuration.h +++ b/Marlin/src/config/examples/Creality/CR-8/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -782,6 +780,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -869,6 +874,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -889,8 +895,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -915,7 +921,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -982,6 +988,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1151,8 +1169,9 @@ #define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1307,10 +1326,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 200 #define PREHEAT_1_TEMP_BED 60 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 110 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -1439,10 +1460,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1470,6 +1491,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1834,6 +1862,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1990,5 +2027,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/Creality/CR-8/Configuration_adv.h b/Marlin/src/config/examples/Creality/CR-8/Configuration_adv.h index 98b8afb1b7..5d91d855e0 100644 --- a/Marlin/src/config/examples/Creality/CR-8/Configuration_adv.h +++ b/Marlin/src/config/examples/Creality/CR-8/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -30,8 +31,6 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -176,8 +175,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -245,7 +244,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -385,10 +384,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -413,6 +408,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -464,7 +480,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -482,6 +498,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] @@ -535,15 +562,15 @@ //=============================Additional Features=========================== //=========================================================================== -#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu //#define LCD_INFO_MENU @@ -559,7 +586,7 @@ // Add an 'M73' G-code to set the current percentage //#define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -568,7 +595,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -597,7 +624,7 @@ #define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -683,6 +710,43 @@ */ //#define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -697,7 +761,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar //#define DOGM_SD_PERCENT @@ -767,16 +831,24 @@ */ #define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 5 // Babysteps are very small. Increase for faster motion. - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - #define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 5 // Babysteps are very small. Increase for faster motion. + + #define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -978,6 +1050,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -1003,21 +1084,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -//#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1258,11 +1360,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1271,10 +1373,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1414,6 +1524,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1556,6 +1675,33 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ @@ -1569,10 +1715,10 @@ #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "Preheat for PLA" + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "Preheat for ABS" + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) #define USER_DESC_4 "Heat Bed/Home/Level" @@ -1737,5 +1883,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/examples/Creality/Ender-2/Configuration.h b/Marlin/src/config/examples/Creality/Ender-2/Configuration.h index 94d2c2e2ba..7f2818e13b 100644 --- a/Marlin/src/config/examples/Creality/Ender-2/Configuration.h +++ b/Marlin/src/config/examples/Creality/Ender-2/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -376,7 +374,7 @@ #define HEATER_3_MAXTEMP 275 #define HEATER_4_MAXTEMP 275 #define HEATER_5_MAXTEMP 275 -#define BED_MAXTEMP 125 +#define BED_MAXTEMP 75 //=========================================================================== //============================= PID Settings ================================ @@ -776,6 +774,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -863,6 +868,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -883,8 +889,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER false // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +//#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -909,7 +915,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -976,6 +982,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1145,8 +1163,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1301,10 +1320,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 185 #define PREHEAT_1_TEMP_BED 45 #define PREHEAT_1_FAN_SPEED 255 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 0 #define PREHEAT_2_FAN_SPEED 255 // Value from 0 to 255 @@ -1433,10 +1454,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1464,6 +1485,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1828,6 +1856,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1984,5 +2021,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/Creality/Ender-2/Configuration_adv.h b/Marlin/src/config/examples/Creality/Ender-2/Configuration_adv.h index 109a5c1969..89ffa9ae40 100644 --- a/Marlin/src/config/examples/Creality/Ender-2/Configuration_adv.h +++ b/Marlin/src/config/examples/Creality/Ender-2/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -30,8 +31,6 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -176,8 +175,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -245,7 +244,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -385,10 +384,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -413,6 +408,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -464,7 +480,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -482,6 +498,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] @@ -535,15 +562,15 @@ //=============================Additional Features=========================== //=========================================================================== -#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu //#define LCD_INFO_MENU @@ -559,7 +586,7 @@ // Add an 'M73' G-code to set the current percentage //#define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -568,7 +595,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -597,7 +624,7 @@ #define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -683,6 +710,43 @@ */ //#define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -697,7 +761,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar //#define DOGM_SD_PERCENT @@ -767,16 +831,24 @@ */ //#define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. + + //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -978,6 +1050,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -1003,21 +1084,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -//#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1258,11 +1360,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1271,10 +1373,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1414,6 +1524,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1556,6 +1675,33 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ @@ -1569,10 +1715,10 @@ #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "Preheat for PLA" + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "Preheat for ABS" + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) #define USER_DESC_4 "Heat Bed/Home/Level" @@ -1737,5 +1883,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/examples/Creality/Ender-2/README.md b/Marlin/src/config/examples/Creality/Ender-2/README.md index e64f3ec3d2..b45eb94690 100644 --- a/Marlin/src/config/examples/Creality/Ender-2/README.md +++ b/Marlin/src/config/examples/Creality/Ender-2/README.md @@ -16,3 +16,18 @@ For U8Glib, at least version 1.14 and at most 1.17 is used, because ## Bitmaps The bootscreen and custom status screens come from Creality's firmware. + +## Creality Ender-2 firmware status + +The firmware source code has been published on 2018/07/10. +It is based on Marlin 1.1. The source code and .hex binaries for all printers (including Ender-2) can be obtained from: +https://www.creality3d.cn/download/firmware_c0001 + +And repositories for CR-10S and Ender-3 can be found here: +https://github.com/Creality3DPrinting + +The configuration files have been verified to match the original configuration, but further investigation is needed to ensure there aren't any extra changes in the source code. + +## Ender-2 specific changelog: + +* 2018/10/08 - Updated BED_MAXTEMP to 75 to match the original Creality Ender-2 Firmware (which is now open source) diff --git a/Marlin/src/config/examples/Creality/Ender-2/_Statusscreen.h b/Marlin/src/config/examples/Creality/Ender-2/_Statusscreen.h index fd269c4b91..b8f474ee80 100644 --- a/Marlin/src/config/examples/Creality/Ender-2/_Statusscreen.h +++ b/Marlin/src/config/examples/Creality/Ender-2/_Statusscreen.h @@ -30,101 +30,36 @@ * http://marlinfw.org/tools/u8glib/converter.html */ -#define STATUS_SCREENWIDTH 128 -#define STATUS_SCREEN_HOTEND_TEXT_X(E) (38 + (E) * 20) -#define STATUS_SCREEN_BED_TEXT_X (HOTENDS > 1 ? 81 : 73) -#define STATUS_SCREEN_FAN_TEXT_X 103 +// +// Status Screen Logo bitmap +// +#define STATUS_LOGO_Y 5 +#define STATUS_LOGO_WIDTH 39 -//============================================ +const unsigned char status_logo_bmp[] PROGMEM = { + B00000000,B00000000,B00000110,B00000000,B00000000, + B11111110,B00000000,B00000010,B00000000,B00000000, + B01000010,B00000000,B00000010,B00000000,B00000000, + B01001000,B00000000,B00000010,B00000000,B00000000, + B01001000,B11011100,B00111110,B00111100,B11101110, + B01111000,B01100010,B01000010,B01000010,B00110010, + B01001000,B01000010,B01000010,B01000010,B00100000, + B01001000,B01000010,B01000010,B01111110,B00100000, + B01000000,B01000010,B01000010,B01000000,B00100000, + B01000010,B01000010,B01000110,B01000010,B00100000, + B11111110,B11100111,B00111011,B00111100,B11111000 +}; +// +// Use default bitmaps +// +#define STATUS_HOTEND_ANIM +#define STATUS_BED_ANIM +#define STATUS_HEATERS_XSPACE 20 #if HOTENDS < 2 - - const unsigned char status_screen0_bmp[] PROGMEM = { - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B11111100,B00110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B11111100,B00010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B01111000,B00010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B00110000,B00010000, - B00000000,B00000000,B00000110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101100,B00000000,B11010000, - B11111110,B00000000,B00000010,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00101110,B00110001,B11010000, - B01000010,B00000000,B00000010,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00101111,B01111011,B11010000, - B01001000,B00000000,B00000010,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00101111,B01111011,B11010000, - B01001000,B11011100,B00111110,B00111100,B11101110,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00101110,B00110001,B11010000, - B01111000,B01100010,B01000010,B01000010,B00110010,B00011111,B11100000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00101100,B00000000,B11010000, - B01001000,B01000010,B01000010,B01000010,B00100000,B00011111,B11100000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00100000,B00110000,B00010000, - B01001000,B01000010,B01000010,B01111110,B00100000,B00111111,B11110000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00100000,B01111000,B00010000, - B01000000,B01000010,B01000010,B01000000,B00100000,B00111111,B11110000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00100000,B11111100,B00010000, - B01000010,B01000010,B01000110,B01000010,B00100000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00110000,B11111100,B00110000, - B11111110,B11100111,B00111011,B00111100,B11111000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B10000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00111111,B11111111,B11110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00000000,B00000000,B00000000 - }; - const unsigned char status_screen1_bmp[] PROGMEM = { - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110011,B10000111,B00110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100111,B10000111,B10010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B10000111,B11010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B10000111,B11010000, - B00000000,B00000000,B00000110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B00000011,B11010000, - B11111110,B00000000,B00000010,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00100000,B00110000,B00010000, - B01000010,B00000000,B00000010,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00100000,B01111000,B00010000, - B01001000,B00000000,B00000010,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00100000,B01111000,B00010000, - B01001000,B11011100,B00111110,B00111100,B11101110,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00100000,B00110000,B00010000, - B01111000,B01100010,B01000010,B01000010,B00110010,B00011111,B11100000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00101111,B00000011,B11010000, - B01001000,B01000010,B01000010,B01000010,B00100000,B00011111,B11100000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00101111,B10000111,B11010000, - B01001000,B01000010,B01000010,B01111110,B00100000,B00111111,B11110000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00101111,B10000111,B11010000, - B01000000,B01000010,B01000010,B01000000,B00100000,B00111111,B11110000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00100111,B10000111,B10010000, - B01000010,B01000010,B01000110,B01000010,B00100000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00110011,B10000111,B00110000, - B11111110,B11100111,B00111011,B00111100,B11111000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B10000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00111111,B11111111,B11110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00000000,B00000000,B00000000 - }; - -#else // HOTENDS >= 2 - - const unsigned char status_screen0_bmp[] PROGMEM = { - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B11111100,B00110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B11111100,B00010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B01111000,B00010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B00110000,B00010000, - B00000000,B00000000,B00000110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101100,B00000000,B11010000, - B11111110,B00000000,B00000010,B00000000,B00000000,B00011111,B11100000,B00000001,B11111110,B00000000,B00001000,B00100000,B10000000,B00101110,B00110001,B11010000, - B01000010,B00000000,B00000010,B00000000,B00000000,B00111110,B11110000,B00000011,B11001111,B00000000,B00000100,B00010000,B01000000,B00101111,B01111011,B11010000, - B01001000,B00000000,B00000010,B00000000,B00000000,B00111100,B11110000,B00000011,B10110111,B00000000,B00000100,B00010000,B01000000,B00101111,B01111011,B11010000, - B01001000,B11011100,B00111110,B00111100,B11101110,B00111010,B11110000,B00000011,B11110111,B00000000,B00001000,B00100000,B10000000,B00101110,B00110001,B11010000, - B01111000,B01100010,B01000010,B01000010,B00110010,B00011110,B11100000,B00000001,B11101110,B00000000,B00010000,B01000001,B00000000,B00101100,B00000000,B11010000, - B01001000,B01000010,B01000010,B01000010,B00100000,B00011110,B11100000,B00000001,B11011110,B00000000,B00100000,B10000010,B00000000,B00100000,B00110000,B00010000, - B01001000,B01000010,B01000010,B01111110,B00100000,B00111110,B11110000,B00000011,B10111111,B00000000,B00100000,B10000010,B00000000,B00100000,B01111000,B00010000, - B01000000,B01000010,B01000010,B01000000,B00100000,B00111110,B11110000,B00000011,B10000111,B00000000,B00010000,B01000001,B00000000,B00100000,B11111100,B00010000, - B01000010,B01000010,B01000110,B01000010,B00100000,B00111111,B11110000,B00000011,B11111111,B00000000,B00001000,B00100000,B10000000,B00110000,B11111100,B00110000, - B11111110,B11100111,B00111011,B00111100,B11111000,B00001111,B11000000,B00000000,B11111100,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B10000000,B00000000,B01111000,B00000000,B11111111,B11111111,B11000000,B00111111,B11111111,B11110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,B00000000,B00000000,B00110000,B00000000,B11111111,B11111111,B11000000,B00000000,B00000000,B00000000 - }; - const unsigned char status_screen1_bmp[] PROGMEM = { - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110011,B10000111,B00110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100111,B10000111,B10010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B10000111,B11010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B10000111,B11010000, - B00000000,B00000000,B00000110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B00000011,B11010000, - B11111110,B00000000,B00000010,B00000000,B00000000,B00011111,B11100000,B00000001,B11111110,B00000000,B00001000,B00100000,B10000000,B00100000,B00110000,B00010000, - B01000010,B00000000,B00000010,B00000000,B00000000,B00111110,B11110000,B00000011,B11001111,B00000000,B00000100,B00010000,B01000000,B00100000,B01111000,B00010000, - B01001000,B00000000,B00000010,B00000000,B00000000,B00111100,B11110000,B00000011,B10110111,B00000000,B00000100,B00010000,B01000000,B00100000,B01111000,B00010000, - B01001000,B11011100,B00111110,B00111100,B11101110,B00111010,B11110000,B00000011,B11110111,B00000000,B00001000,B00100000,B10000000,B00100000,B00110000,B00010000, - B01111000,B01100010,B01000010,B01000010,B00110010,B00011110,B11100000,B00000001,B11101110,B00000000,B00010000,B01000001,B00000000,B00101111,B00000011,B11010000, - B01001000,B01000010,B01000010,B01000010,B00100000,B00011110,B11100000,B00000001,B11011110,B00000000,B00100000,B10000010,B00000000,B00101111,B10000111,B11010000, - B01001000,B01000010,B01000010,B01111110,B00100000,B00111110,B11110000,B00000011,B10111111,B00000000,B00100000,B10000010,B00000000,B00101111,B10000111,B11010000, - B01000000,B01000010,B01000010,B01000000,B00100000,B00111110,B11110000,B00000011,B10000111,B00000000,B00010000,B01000001,B00000000,B00100111,B10000111,B10010000, - B01000010,B01000010,B01000110,B01000010,B00100000,B00111111,B11110000,B00000011,B11111111,B00000000,B00001000,B00100000,B10000000,B00110011,B10000111,B00110000, - B11111110,B11100111,B00111011,B00111100,B11111000,B00001111,B11000000,B00000000,B11111100,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B10000000,B00000000,B01111000,B00000000,B11111111,B11111111,B11000000,B00111111,B11111111,B11110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,B00000000,B00000000,B00110000,B00000000,B11111111,B11111111,B11000000,B00000000,B00000000,B00000000 - }; - -#endif // HOTENDS >= 2 + #define STATUS_HEATERS_X 48 + #define STATUS_BED_X 72 +#else + #define STATUS_HEATERS_X 40 + #define STATUS_BED_X 80 +#endif diff --git a/Marlin/src/config/examples/Creality/Ender-3/Configuration.h b/Marlin/src/config/examples/Creality/Ender-3/Configuration.h index 56fa0e2d58..0e532a9dc0 100644 --- a/Marlin/src/config/examples/Creality/Ender-3/Configuration.h +++ b/Marlin/src/config/examples/Creality/Ender-3/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -776,6 +774,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -863,6 +868,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -883,8 +889,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER false // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +//#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -909,7 +915,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -976,6 +982,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1145,8 +1163,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1192,7 +1211,7 @@ #endif // Homing speeds (mm/m) -#define HOMING_FEEDRATE_XY (50*60) +#define HOMING_FEEDRATE_XY (20*60) #define HOMING_FEEDRATE_Z (4*60) // Validate that endstops are triggered on homing moves @@ -1301,10 +1320,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 185 #define PREHEAT_1_TEMP_BED 45 #define PREHEAT_1_FAN_SPEED 255 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 0 #define PREHEAT_2_FAN_SPEED 255 // Value from 0 to 255 @@ -1433,10 +1454,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1464,6 +1485,13 @@ */ #define DISPLAY_CHARSET_HD44780 WESTERN +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1828,6 +1856,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1984,5 +2021,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/Creality/Ender-3/Configuration_adv.h b/Marlin/src/config/examples/Creality/Ender-3/Configuration_adv.h index d48d42ffbe..6a078af8f3 100644 --- a/Marlin/src/config/examples/Creality/Ender-3/Configuration_adv.h +++ b/Marlin/src/config/examples/Creality/Ender-3/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -30,8 +31,6 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -176,8 +175,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -245,7 +244,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -385,10 +384,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -413,6 +408,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -464,7 +480,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -482,6 +498,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] @@ -535,15 +562,15 @@ //=============================Additional Features=========================== //=========================================================================== -#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu #define LCD_INFO_MENU @@ -559,7 +586,7 @@ // Add an 'M73' G-code to set the current percentage //#define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -568,7 +595,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -597,7 +624,7 @@ #define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -683,6 +710,43 @@ */ //#define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -697,7 +761,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar //#define DOGM_SD_PERCENT @@ -767,16 +831,24 @@ */ #define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - #define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. + + #define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -978,6 +1050,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -1003,21 +1084,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -//#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1258,11 +1360,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1271,10 +1373,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1414,6 +1524,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1556,6 +1675,33 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ @@ -1569,10 +1715,10 @@ #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "Preheat for PLA" + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "Preheat for ABS" + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) #define USER_DESC_4 "Heat Bed/Home/Level" @@ -1737,5 +1883,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/examples/Creality/Ender-3/_Statusscreen.h b/Marlin/src/config/examples/Creality/Ender-3/_Statusscreen.h index 95e8298c3e..285711236a 100644 --- a/Marlin/src/config/examples/Creality/Ender-3/_Statusscreen.h +++ b/Marlin/src/config/examples/Creality/Ender-3/_Statusscreen.h @@ -30,101 +30,32 @@ * http://marlinfw.org/tools/u8glib/converter.html */ -#define STATUS_SCREENWIDTH 128 -#define STATUS_SCREEN_HOTEND_TEXT_X(E) (38 + (E) * 20) -#define STATUS_SCREEN_BED_TEXT_X (HOTENDS > 1 ? 81 : 73) -#define STATUS_SCREEN_FAN_TEXT_X 103 +// +// Status Screen Logo bitmap +// +#define STATUS_LOGO_Y 8 +#define STATUS_LOGO_WIDTH 39 -//============================================ +const unsigned char status_logo_bmp[] PROGMEM = { + B11111000,B00000001,B10000000,B00000000,B00001100, + B01001000,B00000000,B10000000,B00000000,B00010010, + B01000011,B11000011,B10001100,B11010000,B00000010, + B01110001,B00100100,B10010010,B01100111,B11001100, + B01000001,B00100100,B10011110,B01000000,B00000010, + B01001001,B00100100,B10010000,B01000000,B00010010, + B11111011,B10110011,B11001110,B11100000,B00001100 +}; +// +// Use default bitmaps +// +#define STATUS_HOTEND_ANIM +#define STATUS_BED_ANIM +#define STATUS_HEATERS_XSPACE 20 #if HOTENDS < 2 - - const unsigned char status_screen0_bmp[] PROGMEM = { - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B11111100,B00110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B11111100,B00010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B01111000,B00010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B00110000,B00010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101100,B00000000,B11010000, - B11111000,B00000001,B10000000,B00000000,B00001100,B00011111,B11100000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00101110,B00110001,B11010000, - B01001000,B00000000,B10000000,B00000000,B00010010,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00101111,B01111011,B11010000, - B01000011,B11000011,B10001100,B11010000,B00000010,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00101111,B01111011,B11010000, - B01110001,B00100100,B10010010,B01100111,B11001100,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00101110,B00110001,B11010000, - B01000001,B00100100,B10011110,B01000000,B00000010,B00011111,B11100000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00101100,B00000000,B11010000, - B01001001,B00100100,B10010000,B01000000,B00010010,B00011111,B11100000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00100000,B00110000,B00010000, - B11111011,B10110011,B11001110,B11100000,B00001100,B00111111,B11110000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00100000,B01111000,B00010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00100000,B11111100,B00010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00110000,B11111100,B00110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B10000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00111111,B11111111,B11110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00000000,B00000000,B00000000 - }; - const unsigned char status_screen1_bmp[] PROGMEM = { - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110011,B10000111,B00110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100111,B10000111,B10010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B10000111,B11010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B10000111,B11010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B00000011,B11010000, - B11111000,B00000001,B10000000,B00000000,B00001100,B00011111,B11100000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00100000,B00110000,B00010000, - B01001000,B00000000,B10000000,B00000000,B00010010,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00100000,B01111000,B00010000, - B01000011,B11000011,B10001100,B11010000,B00000010,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00100000,B01111000,B00010000, - B01110001,B00100100,B10010010,B01100111,B11001100,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00100000,B00110000,B00010000, - B01000001,B00100100,B10011110,B01000000,B00000010,B00011111,B11100000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00101111,B00000011,B11010000, - B01001001,B00100100,B10010000,B01000000,B00010010,B00011111,B11100000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00101111,B10000111,B11010000, - B11111011,B10110011,B11001110,B11100000,B00001100,B00111111,B11110000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00101111,B10000111,B11010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00100111,B10000111,B10010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00110011,B10000111,B00110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B10000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00111111,B11111111,B11110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00000000,B00000000,B00000000 - }; - -#else // HOTENDS >= 2 - - const unsigned char status_screen0_bmp[] PROGMEM = { - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B11111100,B00110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B11111100,B00010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B01111000,B00010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B00110000,B00010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101100,B00000000,B11010000, - B11111000,B00000001,B10000000,B00000000,B00001100,B00011111,B11100000,B00000001,B11111110,B00000000,B00001000,B00100000,B10000000,B00101110,B00110001,B11010000, - B01001000,B00000000,B10000000,B00000000,B00010010,B00111110,B11110000,B00000011,B11001111,B00000000,B00000100,B00010000,B01000000,B00101111,B01111011,B11010000, - B01000011,B11000011,B10001100,B11010000,B00000010,B00111100,B11110000,B00000011,B10110111,B00000000,B00000100,B00010000,B01000000,B00101111,B01111011,B11010000, - B01110001,B00100100,B10010010,B01100111,B11001100,B00111010,B11110000,B00000011,B11110111,B00000000,B00001000,B00100000,B10000000,B00101110,B00110001,B11010000, - B01000001,B00100100,B10011110,B01000000,B00000010,B00011110,B11100000,B00000001,B11101110,B00000000,B00010000,B01000001,B00000000,B00101100,B00000000,B11010000, - B01001001,B00100100,B10010000,B01000000,B00010010,B00011110,B11100000,B00000001,B11011110,B00000000,B00100000,B10000010,B00000000,B00100000,B00110000,B00010000, - B11111011,B10110011,B11001110,B11100000,B00001100,B00111110,B11110000,B00000011,B10111111,B00000000,B00100000,B10000010,B00000000,B00100000,B01111000,B00010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B11110000,B00000011,B10000111,B00000000,B00010000,B01000001,B00000000,B00100000,B11111100,B00010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11110000,B00000011,B11111111,B00000000,B00001000,B00100000,B10000000,B00110000,B11111100,B00110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00001111,B11000000,B00000000,B11111100,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B10000000,B00000000,B01111000,B00000000,B11111111,B11111111,B11000000,B00111111,B11111111,B11110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,B00000000,B00000000,B00110000,B00000000,B11111111,B11111111,B11000000,B00000000,B00000000,B00000000 - }; - const unsigned char status_screen1_bmp[] PROGMEM = { - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110011,B10000111,B00110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100111,B10000111,B10010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B10000111,B11010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B10000111,B11010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B00000011,B11010000, - B11111000,B00000001,B10000000,B00000000,B00001100,B00011111,B11100000,B00000001,B11111110,B00000000,B00001000,B00100000,B10000000,B00100000,B00110000,B00010000, - B01001000,B00000000,B10000000,B00000000,B00010010,B00111110,B11110000,B00000011,B11001111,B00000000,B00000100,B00010000,B01000000,B00100000,B01111000,B00010000, - B01000011,B11000011,B10001100,B11010000,B00000010,B00111100,B11110000,B00000011,B10110111,B00000000,B00000100,B00010000,B01000000,B00100000,B01111000,B00010000, - B01110001,B00100100,B10010010,B01100111,B11001100,B00111010,B11110000,B00000011,B11110111,B00000000,B00001000,B00100000,B10000000,B00100000,B00110000,B00010000, - B01000001,B00100100,B10011110,B01000000,B00000010,B00011110,B11100000,B00000001,B11101110,B00000000,B00010000,B01000001,B00000000,B00101111,B00000011,B11010000, - B01001001,B00100100,B10010000,B01000000,B00010010,B00011110,B11100000,B00000001,B11011110,B00000000,B00100000,B10000010,B00000000,B00101111,B10000111,B11010000, - B11111011,B10110011,B11001110,B11100000,B00001100,B00111110,B11110000,B00000011,B10111111,B00000000,B00100000,B10000010,B00000000,B00101111,B10000111,B11010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B11110000,B00000011,B10000111,B00000000,B00010000,B01000001,B00000000,B00100111,B10000111,B10010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11110000,B00000011,B11111111,B00000000,B00001000,B00100000,B10000000,B00110011,B10000111,B00110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00001111,B11000000,B00000000,B11111100,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B10000000,B00000000,B01111000,B00000000,B11111111,B11111111,B11000000,B00111111,B11111111,B11110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,B00000000,B00000000,B00110000,B00000000,B11111111,B11111111,B11000000,B00000000,B00000000,B00000000 - }; - -#endif // HOTENDS >= 2 + #define STATUS_HEATERS_X 48 + #define STATUS_BED_X 72 +#else + #define STATUS_HEATERS_X 40 + #define STATUS_BED_X 80 +#endif diff --git a/Marlin/src/config/examples/Creality/Ender-4/Configuration.h b/Marlin/src/config/examples/Creality/Ender-4/Configuration.h index bdf0e5d54c..f03d73f16f 100644 --- a/Marlin/src/config/examples/Creality/Ender-4/Configuration.h +++ b/Marlin/src/config/examples/Creality/Ender-4/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -74,7 +73,7 @@ // User-specified version info of this build to display in [Pronterface, etc] terminal window during // startup. Implementation of an idea by Prof Braino to inform user that any changes made to this // build by the user have been successfully uploaded into firmware. -#define STRING_CONFIG_H_AUTHOR "Skorpi, Creality Ender-4)" // Who made the changes. +#define STRING_CONFIG_H_AUTHOR "(Skorpi, Creality Ender-4, brandstaetter)" // Who made the changes. #define SHOW_BOOTSCREEN #define STRING_SPLASH_LINE1 SHORT_BUILD_VERSION // will be shown during bootup in line 1 #define STRING_SPLASH_LINE2 WEBSITE_URL // will be shown during bootup in line 2 @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -389,7 +387,7 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. + #define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. //#define PID_DEBUG // Sends debug data to the serial port. //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay @@ -401,9 +399,9 @@ // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it // Ender-4 - #define DEFAULT_Kp 22.57 - #define DEFAULT_Ki 1.72 - #define DEFAULT_Kd 73.96 + #define DEFAULT_Kp 16.67 + #define DEFAULT_Ki 1.12 + #define DEFAULT_Kd 62.14 // Ultimaker // #define DEFAULT_Kp 22.2 @@ -439,7 +437,7 @@ * heater. If your configuration is significantly different than this and you don't understand * the issues involved, don't use bed PID until someone else verifies that your hardware works. */ -//#define PIDTEMPBED +#define PIDTEMPBED //#define BED_LIMIT_SWITCHING @@ -492,7 +490,7 @@ * Note: For Bowden Extruders make this large enough to allow load/unload. */ #define PREVENT_LENGTHY_EXTRUDE -#define EXTRUDE_MAXLENGTH 500 +#define EXTRUDE_MAXLENGTH 750 //=========================================================================== //======================== Thermal Runaway Protection ======================= @@ -572,7 +570,7 @@ #endif // Mechanical endstop with COM to ground and NC to Signal uses "false" here (most common setup). -#define X_MIN_ENDSTOP_INVERTING true//false // set to true to invert the logic of the endstop. +#define X_MIN_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. #define Y_MIN_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. #define Z_MIN_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. #define X_MAX_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. @@ -651,14 +649,14 @@ * Override with M92 * X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]] */ -#define DEFAULT_AXIS_STEPS_PER_UNIT { 80, 80, 400, 110 } +#define DEFAULT_AXIS_STEPS_PER_UNIT { 80, 80, 400, 100 } /** * Default Max Feed Rate (mm/s) * Override with M203 * X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]] */ -#define DEFAULT_MAX_FEEDRATE { 300, 300, 10, 25 } +#define DEFAULT_MAX_FEEDRATE { 500, 500, 15, 25 } /** * Default Max Acceleration (change/s) change = mm/s @@ -666,7 +664,7 @@ * Override with M201 * X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]] */ -#define DEFAULT_MAX_ACCELERATION { 500, 500, 100, 5000 } +#define DEFAULT_MAX_ACCELERATION { 3000, 3000, 100, 10000 } /** * Default Acceleration (change/s) change = mm/s @@ -701,7 +699,7 @@ * * See https://github.com/synthetos/TinyG/wiki/Jerk-Controlled-Motion-Explained */ -//#define S_CURVE_ACCELERATION +#define S_CURVE_ACCELERATION //=========================================================================== //============================= Z Probe Options ============================= @@ -782,6 +780,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -869,6 +874,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -889,8 +895,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -915,7 +921,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -964,7 +970,7 @@ #endif #if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) - //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD + #define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif /** @@ -982,6 +988,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1024,15 +1042,15 @@ */ //#define AUTO_BED_LEVELING_3POINT //#define AUTO_BED_LEVELING_LINEAR -#define AUTO_BED_LEVELING_BILINEAR +//#define AUTO_BED_LEVELING_BILINEAR //#define AUTO_BED_LEVELING_UBL -//#define MESH_BED_LEVELING +#define MESH_BED_LEVELING /** * Normally G28 leaves leveling disabled on completion. Enable * this option to have G28 restore the prior leveling state. */ -//#define RESTORE_LEVELING_AFTER_G28 +#define RESTORE_LEVELING_AFTER_G28 /** * Enable detailed logging of G28, G29, M48, etc. @@ -1127,7 +1145,7 @@ #define GRID_MAX_POINTS_X 3 // Don't use more than 7 points per axis, implementation limited. #define GRID_MAX_POINTS_Y GRID_MAX_POINTS_X - //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS + #define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS #endif // BED_LEVELING @@ -1151,8 +1169,9 @@ #define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1199,7 +1218,7 @@ // Homing speeds (mm/m) #define HOMING_FEEDRATE_XY (50*60) -#define HOMING_FEEDRATE_Z (4*60) +#define HOMING_FEEDRATE_Z (7*60) // Validate that endstops are triggered on homing moves #define VALIDATE_HOMING_ENDSTOPS @@ -1307,10 +1326,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 200 #define PREHEAT_1_TEMP_BED 60 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 110 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -1326,7 +1347,7 @@ * P1 Raise the nozzle always to Z-park height. * P2 Raise the nozzle by Z-park amount, limited to Z_MAX_POS. */ -//#define NOZZLE_PARK_FEATURE +#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) // Specify a park position as { X, Y, Z } @@ -1373,7 +1394,7 @@ * Attention: EXPERIMENTAL. G-code arguments may change. * */ -#define NOZZLE_CLEAN_FEATURE +//#define NOZZLE_CLEAN_FEATURE #if ENABLED(NOZZLE_CLEAN_FEATURE) // Default number of pattern repetitions @@ -1439,10 +1460,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1470,6 +1491,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1834,6 +1862,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1990,5 +2027,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/Creality/Ender-4/Configuration_adv.h b/Marlin/src/config/examples/Creality/Ender-4/Configuration_adv.h index 98b8afb1b7..6443c0ad3a 100644 --- a/Marlin/src/config/examples/Creality/Ender-4/Configuration_adv.h +++ b/Marlin/src/config/examples/Creality/Ender-4/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -30,8 +31,6 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -90,7 +89,7 @@ * and/or decrease WATCH_TEMP_INCREASE. WATCH_TEMP_INCREASE should not be set * below 2. */ - #define WATCH_TEMP_PERIOD 20 // Seconds + #define WATCH_TEMP_PERIOD 30 // Seconds #define WATCH_TEMP_INCREASE 2 // Degrees Celsius #endif @@ -176,8 +175,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -245,7 +244,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -261,13 +260,13 @@ /** * M355 Case Light on-off / brightness */ -//#define CASE_LIGHT_ENABLE +#define CASE_LIGHT_ENABLE #if ENABLED(CASE_LIGHT_ENABLE) - //#define CASE_LIGHT_PIN 4 // Override the default pin if needed + #define CASE_LIGHT_PIN ENDER4_FAN_PIN // Override the default pin if needed #define INVERT_CASE_LIGHT false // Set true if Case Light is ON when pin is LOW - #define CASE_LIGHT_DEFAULT_ON true // Set default power-up state on + #define CASE_LIGHT_DEFAULT_ON false // Set default power-up state on #define CASE_LIGHT_DEFAULT_BRIGHTNESS 105 // Set default power-up brightness (0-255, requires PWM pin) - //#define MENU_ITEM_CASE_LIGHT // Add a Case Light option to the LCD main menu + #define MENU_ITEM_CASE_LIGHT // Add a Case Light option to the LCD main menu //#define CASE_LIGHT_USE_NEOPIXEL // Use Neopixel LED as case light, requires NEOPIXEL_LED. #if ENABLED(CASE_LIGHT_USE_NEOPIXEL) #define CASE_LIGHT_NEOPIXEL_COLOR { 255, 255, 255, 255 } // { Red, Green, Blue, White } @@ -385,10 +384,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -413,6 +408,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -464,7 +480,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -482,6 +498,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] @@ -535,15 +562,15 @@ //=============================Additional Features=========================== //=========================================================================== -#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu //#define LCD_INFO_MENU @@ -559,7 +586,7 @@ // Add an 'M73' G-code to set the current percentage //#define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -568,7 +595,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -597,7 +624,7 @@ #define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -683,6 +710,43 @@ */ //#define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -697,7 +761,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar //#define DOGM_SD_PERCENT @@ -767,16 +831,24 @@ */ #define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 5 // Babysteps are very small. Increase for faster motion. - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - #define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 5 // Babysteps are very small. Increase for faster motion. + + #define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -978,6 +1050,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -1003,21 +1084,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -//#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1029,28 +1131,28 @@ * Requires NOZZLE_PARK_FEATURE. * This feature is required for the default FILAMENT_RUNOUT_SCRIPT. */ -//#define ADVANCED_PAUSE_FEATURE +#define ADVANCED_PAUSE_FEATURE #if ENABLED(ADVANCED_PAUSE_FEATURE) #define PAUSE_PARK_RETRACT_FEEDRATE 60 // (mm/s) Initial retract feedrate. #define PAUSE_PARK_RETRACT_LENGTH 2 // (mm) Initial retract. // This short retract is done immediately, before parking the nozzle. - #define FILAMENT_CHANGE_UNLOAD_FEEDRATE 10 // (mm/s) Unload filament feedrate. This can be pretty fast. + #define FILAMENT_CHANGE_UNLOAD_FEEDRATE 35 // (mm/s) Unload filament feedrate. This can be pretty fast. #define FILAMENT_CHANGE_UNLOAD_ACCEL 25 // (mm/s^2) Lower acceleration may allow a faster feedrate. - #define FILAMENT_CHANGE_UNLOAD_LENGTH 100 // (mm) The length of filament for a complete unload. + #define FILAMENT_CHANGE_UNLOAD_LENGTH 650 // (mm) The length of filament for a complete unload. // For Bowden, the full length of the tube and nozzle. // For direct drive, the full length of the nozzle. // Set to 0 for manual unloading. #define FILAMENT_CHANGE_SLOW_LOAD_FEEDRATE 6 // (mm/s) Slow move when starting load. #define FILAMENT_CHANGE_SLOW_LOAD_LENGTH 0 // (mm) Slow length, to allow time to insert material. // 0 to disable start loading and skip to fast load only - #define FILAMENT_CHANGE_FAST_LOAD_FEEDRATE 6 // (mm/s) Load filament feedrate. This can be pretty fast. + #define FILAMENT_CHANGE_FAST_LOAD_FEEDRATE 35 // (mm/s) Load filament feedrate. This can be pretty fast. #define FILAMENT_CHANGE_FAST_LOAD_ACCEL 25 // (mm/s^2) Lower acceleration may allow a faster feedrate. - #define FILAMENT_CHANGE_FAST_LOAD_LENGTH 0 // (mm) Load length of filament, from extruder gear to nozzle. + #define FILAMENT_CHANGE_FAST_LOAD_LENGTH 600 // (mm) Load length of filament, from extruder gear to nozzle. // For Bowden, the full length of the tube and nozzle. // For direct drive, the full length of the nozzle. - //#define ADVANCED_PAUSE_CONTINUOUS_PURGE // Purge continuously up to the purge length until interrupted. + #define ADVANCED_PAUSE_CONTINUOUS_PURGE // Purge continuously up to the purge length until interrupted. #define ADVANCED_PAUSE_PURGE_FEEDRATE 3 // (mm/s) Extrude feedrate (after loading). Should be slower than load feedrate. - #define ADVANCED_PAUSE_PURGE_LENGTH 50 // (mm) Length to extrude after loading. + #define ADVANCED_PAUSE_PURGE_LENGTH 60 // (mm) Length to extrude after loading. // Set to 0 for manual extrusion. // Filament can be extruded repeatedly from the Filament Change menu // until extrusion is consistent, and to purge old filament. @@ -1064,10 +1166,10 @@ #define FILAMENT_CHANGE_ALERT_BEEPS 10 // Number of alert beeps to play when a response is needed. #define PAUSE_PARK_NO_STEPPER_TIMEOUT // Enable for XYZ steppers to stay powered on during filament change. - //#define PARK_HEAD_ON_PAUSE // Park the nozzle during pause and filament change. - //#define HOME_BEFORE_FILAMENT_CHANGE // Ensure homing has been completed prior to parking for filament change + #define PARK_HEAD_ON_PAUSE // Park the nozzle during pause and filament change. + #define HOME_BEFORE_FILAMENT_CHANGE // Ensure homing has been completed prior to parking for filament change - //#define FILAMENT_LOAD_UNLOAD_GCODES // Add M701/M702 Load/Unload G-codes, plus Load/Unload in the LCD Prepare menu. + #define FILAMENT_LOAD_UNLOAD_GCODES // Add M701/M702 Load/Unload G-codes, plus Load/Unload in the LCD Prepare menu. //#define FILAMENT_UNLOAD_ALL_EXTRUDERS // Allow M702 to unload all extruders above a minimum target temp (as set by M302) #endif @@ -1258,11 +1360,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1271,10 +1373,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1414,6 +1524,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1556,6 +1675,33 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ @@ -1569,10 +1715,10 @@ #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "Preheat for PLA" + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "Preheat for ABS" + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) #define USER_DESC_4 "Heat Bed/Home/Level" @@ -1737,5 +1883,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/examples/Einstart-S/Configuration.h b/Marlin/src/config/examples/Einstart-S/Configuration.h index 29e90d61a8..652f27fbd0 100644 --- a/Marlin/src/config/examples/Einstart-S/Configuration.h +++ b/Marlin/src/config/examples/Einstart-S/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -783,6 +781,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -869,6 +874,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -889,8 +895,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -915,7 +921,7 @@ #define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -982,6 +988,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1151,8 +1169,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1307,10 +1326,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 180 #define PREHEAT_1_TEMP_BED 70 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 110 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -1439,10 +1460,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1470,6 +1491,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1995,5 +2023,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/Einstart-S/Configuration_adv.h b/Marlin/src/config/examples/Einstart-S/Configuration_adv.h index 21c2f3f2f9..7216326349 100644 --- a/Marlin/src/config/examples/Einstart-S/Configuration_adv.h +++ b/Marlin/src/config/examples/Einstart-S/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -30,8 +31,6 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -176,8 +175,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -245,7 +244,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -385,10 +384,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -413,6 +408,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -464,7 +480,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -482,6 +498,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] @@ -535,15 +562,15 @@ //=============================Additional Features=========================== //=========================================================================== -#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu //#define LCD_INFO_MENU @@ -559,7 +586,7 @@ // Add an 'M73' G-code to set the current percentage //#define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -568,7 +595,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -597,7 +624,7 @@ #define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -683,6 +710,43 @@ */ //#define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -697,7 +761,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar //#define DOGM_SD_PERCENT @@ -767,16 +831,24 @@ */ //#define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. + + //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -978,6 +1050,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -1003,21 +1084,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -//#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1258,11 +1360,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1271,10 +1373,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1414,6 +1524,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1556,6 +1675,33 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ @@ -1569,10 +1715,10 @@ #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "Preheat for PLA" + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "Preheat for ABS" + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) #define USER_DESC_4 "Heat Bed/Home/Level" @@ -1737,5 +1883,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/examples/Einstart-S/readme.md b/Marlin/src/config/examples/Einstart-S/readme.md index fbcb5f7668..22e7d8e662 100644 --- a/Marlin/src/config/examples/Einstart-S/readme.md +++ b/Marlin/src/config/examples/Einstart-S/readme.md @@ -10,7 +10,7 @@ The Einstart S is a commercial machine that ships with a proprietary firmware an - Genuine Minebea NEMA17 motors (200 steps/rev) - THC7128 3A Stepper Drivers (configured for 16 microsteps, loud) - 160x160 magnetically coupled non-heated bed - - PLA Only Direct Drive extruder + - PLA-only, Direct Drive extruder - SH1106 OLED Display w/ Cardinal navigation - 9533 I2C PWM RGB LED Chassis illumination - Onboard SD-Card Support diff --git a/Marlin/src/config/examples/Felix/Configuration.h b/Marlin/src/config/examples/Felix/Configuration.h index c4ef4fcc5e..d48a140b2e 100644 --- a/Marlin/src/config/examples/Felix/Configuration.h +++ b/Marlin/src/config/examples/Felix/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -602,7 +600,7 @@ //============================================================================= // @section motion -// default steps per unit for Felix 2.0/3.0: 0.00249mm x/y rounding error with 3mm pitch HTD belt and 14 tooth pulleys. 0 z error. +// default steps per unit for Felix 2.0/3.0: 0.00249mm x/y rounding error with 3mm pitch HTD belt and 14 tooth pulleys. 0 Z error. /** * Default Settings * @@ -754,6 +752,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -841,6 +846,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -861,8 +867,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -887,7 +893,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -954,6 +960,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1123,8 +1141,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1279,10 +1298,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 180 #define PREHEAT_1_TEMP_BED 70 #define PREHEAT_1_FAN_SPEED 255 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 100 #define PREHEAT_2_FAN_SPEED 255 // Value from 0 to 255 @@ -1411,10 +1432,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1442,6 +1463,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1806,6 +1834,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1962,5 +1999,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/Felix/Configuration_adv.h b/Marlin/src/config/examples/Felix/Configuration_adv.h index dcf31e6573..ea7d191d70 100644 --- a/Marlin/src/config/examples/Felix/Configuration_adv.h +++ b/Marlin/src/config/examples/Felix/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -30,8 +31,6 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -176,8 +175,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -245,7 +244,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -385,10 +384,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -413,6 +408,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -464,7 +480,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -482,6 +498,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] @@ -535,15 +562,15 @@ //=============================Additional Features=========================== //=========================================================================== -#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu //#define LCD_INFO_MENU @@ -559,7 +586,7 @@ // Add an 'M73' G-code to set the current percentage //#define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -568,7 +595,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -597,7 +624,7 @@ #define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -683,6 +710,43 @@ */ //#define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -697,7 +761,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar //#define DOGM_SD_PERCENT @@ -767,16 +831,24 @@ */ //#define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. + + //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -978,6 +1050,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -1003,21 +1084,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -//#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1258,11 +1360,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1271,10 +1373,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1414,6 +1524,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1556,6 +1675,33 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ @@ -1569,10 +1715,10 @@ #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "Preheat for PLA" + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "Preheat for ABS" + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) #define USER_DESC_4 "Heat Bed/Home/Level" @@ -1737,5 +1883,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/examples/Felix/DUAL/Configuration.h b/Marlin/src/config/examples/Felix/DUAL/Configuration.h index 026f7987ee..ce9e6cf401 100644 --- a/Marlin/src/config/examples/Felix/DUAL/Configuration.h +++ b/Marlin/src/config/examples/Felix/DUAL/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -602,7 +600,7 @@ //============================================================================= // @section motion -// default steps per unit for Felix 2.0/3.0: 0.00249mm x/y rounding error with 3mm pitch HTD belt and 14 tooth pulleys. 0 z error. +// default steps per unit for Felix 2.0/3.0: 0.00249mm x/y rounding error with 3mm pitch HTD belt and 14 tooth pulleys. 0 Z error. /** * Default Settings * @@ -754,6 +752,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -841,6 +846,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -861,8 +867,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -887,7 +893,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -954,6 +960,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1123,8 +1141,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1279,10 +1298,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 180 #define PREHEAT_1_TEMP_BED 70 #define PREHEAT_1_FAN_SPEED 255 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 100 #define PREHEAT_2_FAN_SPEED 255 // Value from 0 to 255 @@ -1411,10 +1432,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1442,6 +1463,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1806,6 +1834,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1962,5 +1999,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration.h b/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration.h index 46322d6331..d9a60e48db 100644 --- a/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration.h +++ b/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -778,6 +776,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -865,6 +870,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -885,8 +891,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -911,7 +917,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -#define Z_HOMING_HEIGHT 2 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +#define Z_HOMING_HEIGHT 2 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -978,6 +984,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1147,8 +1165,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1303,10 +1322,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 180 #define PREHEAT_1_TEMP_BED 70 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 110 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -1435,10 +1456,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1466,6 +1487,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1830,6 +1858,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1986,5 +2023,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h b/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h index 06cba448c4..68229ec7a1 100644 --- a/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h +++ b/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -30,8 +31,6 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -176,8 +175,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -245,7 +244,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -385,10 +384,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -413,6 +408,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -464,7 +480,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -482,6 +498,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] @@ -535,15 +562,15 @@ //=============================Additional Features=========================== //=========================================================================== -#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu //#define LCD_INFO_MENU @@ -559,7 +586,7 @@ // Add an 'M73' G-code to set the current percentage //#define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS #define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -568,7 +595,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -597,7 +624,7 @@ #define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -683,6 +710,43 @@ */ //#define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -697,7 +761,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar //#define DOGM_SD_PERCENT @@ -767,16 +831,24 @@ */ #define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 2 // Babysteps are very small. Increase for faster motion. - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - #define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 2 // Babysteps are very small. Increase for faster motion. + + #define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -978,6 +1050,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -1003,21 +1084,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -//#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1258,11 +1360,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1271,10 +1373,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1414,6 +1524,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1556,6 +1675,33 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ @@ -1569,10 +1715,10 @@ #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "Preheat for PLA" + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "Preheat for ABS" + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) #define USER_DESC_4 "Heat Bed/Home/Level" @@ -1745,5 +1891,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/examples/Formbot/Raptor/Configuration.h b/Marlin/src/config/examples/Formbot/Raptor/Configuration.h index 9976382ed8..8086bd3690 100644 --- a/Marlin/src/config/examples/Formbot/Raptor/Configuration.h +++ b/Marlin/src/config/examples/Formbot/Raptor/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -244,7 +243,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -261,7 +260,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -753,19 +751,19 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#if ENABLED(X_SpreadCycle) || !ENABLED(X_2208) - #define DEFAULT_XJERK 20.0 +#if ENABLED(X_SpreadCycle) || DISABLED(X_2208) + #define DEFAULT_XJERK 20.0 #else - #define DEFAULT_XJERK 10.0 + #define DEFAULT_XJERK 10.0 #endif -#if ENABLED(Y_SpreadCycle) || !ENABLED(Y_2208) - #define DEFAULT_YJERK 10.0 +#if ENABLED(Y_SpreadCycle) || DISABLED(Y_2208) + #define DEFAULT_YJERK 10.0 #else - #define DEFAULT_YJERK 5.0 + #define DEFAULT_YJERK 5.0 #endif -#define DEFAULT_ZJERK 0.4 -#define DEFAULT_EJERK 5.0 +#define DEFAULT_ZJERK 0.4 +#define DEFAULT_EJERK 5.0 /** * S-Curve Acceleration @@ -849,20 +847,6 @@ //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed #endif -/** - * Enable one or more of the following if probing seems unreliable. - * Heaters and/or fans can be disabled during probing to minimize electrical - * noise. A delay can also be added to allow noise and vibration to settle. - * These options are most useful for the BLTouch probe, but may also improve - * readings with inductive probes and piezo sensors. - */ -//#define PROBING_HEATERS_OFF // Turn heaters off when probing -#if ENABLED(PROBING_HEATERS_OFF) - //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) -#endif -//#define PROBING_FANS_OFF // Turn fans off when probing -//#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors - // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) //#define SOLENOID_PROBE @@ -870,6 +854,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -955,6 +946,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -975,8 +967,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER false // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +//#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -1015,7 +1007,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -1085,6 +1077,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1217,12 +1221,10 @@ #define MESH_EDIT_GFX_OVERLAY // Display a graphics overlay while editing the mesh - #define MESH_INSET 35 // Set Mesh bounds as an inset region of the bed + #define MESH_INSET 35 // Set Mesh bounds as an inset region of the bed #define GRID_MAX_POINTS_X 10 // Don't use more than 15 points per axis, implementation limited. #define GRID_MAX_POINTS_Y GRID_MAX_POINTS_X - - #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 @@ -1263,8 +1265,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1419,10 +1422,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 200 #define PREHEAT_1_TEMP_BED 60 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 220 #define PREHEAT_2_TEMP_BED 100 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -1551,10 +1556,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1582,6 +1587,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1946,6 +1958,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -2102,5 +2123,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/Formbot/Raptor/Configuration_adv.h b/Marlin/src/config/examples/Formbot/Raptor/Configuration_adv.h index ab9d929486..9cedd8215c 100644 --- a/Marlin/src/config/examples/Formbot/Raptor/Configuration_adv.h +++ b/Marlin/src/config/examples/Formbot/Raptor/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -30,8 +31,6 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -176,8 +175,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -245,7 +244,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -263,7 +262,7 @@ */ #define CASE_LIGHT_ENABLE #if ENABLED(CASE_LIGHT_ENABLE) - #define CASE_LIGHT_PIN 5 + #define CASE_LIGHT_PIN 5 #define INVERT_CASE_LIGHT false // Set true if Case Light is ON when pin is LOW #define CASE_LIGHT_DEFAULT_ON true // Set default power-up state on #define CASE_LIGHT_DEFAULT_BRIGHTNESS 255 // Set default power-up brightness (0-255, requires PWM pin) @@ -385,10 +384,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -413,6 +408,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -464,7 +480,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -482,6 +498,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] @@ -535,15 +562,15 @@ //=============================Additional Features=========================== //=========================================================================== -#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu #define LCD_INFO_MENU @@ -559,7 +586,7 @@ // Add an 'M73' G-code to set the current percentage #define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -568,7 +595,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -597,7 +624,7 @@ #define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -683,6 +710,43 @@ */ #define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -697,7 +761,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar #define DOGM_SD_PERCENT @@ -767,16 +831,24 @@ */ #define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 25 // Babysteps are very small. Increase for faster motion. - #define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - #define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - #define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 25 // Babysteps are very small. Increase for faster motion. + + #define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + #define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + #define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -980,6 +1052,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -995,11 +1076,7 @@ * Note that M207 / M208 / M209 settings are saved to EEPROM. * */ -<<<<<<< HEAD:Marlin/src/config/examples/Formbot/Raptor/Configuration_adv.h -#define FWRETRACT // ONLY PARTIALLY TESTED -======= -//#define FWRETRACT ->>>>>>> patch:Marlin/src/config/examples/Azteeg/X5GT/Configuration_adv.h +#define FWRETRACT #if ENABLED(FWRETRACT) #define FWRETRACT_AUTORETRACT // costs ~500 bytes of PROGMEM #if ENABLED(FWRETRACT_AUTORETRACT) @@ -1009,21 +1086,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -//#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1264,11 +1362,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1277,10 +1375,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1420,6 +1526,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1562,6 +1677,33 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ @@ -1574,9 +1716,9 @@ #define USER_SCRIPT_AUDIBLE_FEEDBACK #define USER_SCRIPT_RETURN // Return to status screen after a script - #define USER_DESC_1 "UBL Commission Step 1" + #define USER_DESC_1 "UBL Commission Step 1" #define USER_GCODE_1 "M502 \n M500 \n M501 \n M190 S75 \n G28 \n G29 P1 \n G29 S1 \n M117 Run Step 2 \n" - + #define USER_DESC_2 "UBL Commission Step 2" #define USER_GCODE_2 "G29 S1 \n G29 S0 \n G29 F 10.0 \n G29 A \n M500 \n G28 \n G29 L1 \n M109 S225 \n G1 X150 Y 150 \n G1 Z0 \n M117 Set Z Offset \n" @@ -1745,5 +1887,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/examples/Formbot/Raptor/_Statusscreen.h b/Marlin/src/config/examples/Formbot/Raptor/_Statusscreen.h index 9a11b5295b..d0450837ab 100644 --- a/Marlin/src/config/examples/Formbot/Raptor/_Statusscreen.h +++ b/Marlin/src/config/examples/Formbot/Raptor/_Statusscreen.h @@ -30,422 +30,45 @@ * http://marlinfw.org/tools/u8glib/converter.html */ -//============================================ +// +// Status Screen Logo bitmap +// +#define STATUS_LOGO_Y 3 +#define STATUS_LOGO_WIDTH 24 -#define STATUS_SCREENWIDTH 128 - -#define STATUS_SCREEN_HOTEND_TEXT_X(E) (41 + (E) * 20) - -#define STATUS_SCREEN_BED_TEXT_X (HOTENDS > 1 ? 81 : 73) - -#define FAN_ANIM_FRAMES 3 -#define STATUS_SCREEN_FAN_TEXT_X (FAN_ANIM_FRAMES == 3 ? 103 : 105) -#define STATUS_SCREEN_FAN_TEXT_Y (FAN_ANIM_FRAMES > 2 ? 28 : 27) - -//============================================ +const unsigned char status_logo_bmp[] PROGMEM = { + B11111111,B11111111,B11111111, + B10000000,B00000000,B00000001, + B10001110,B00000000,B11100001, + B10011111,B00000001,B11110001, + B10010011,B10000001,B00111001, + B10011111,B10000001,B11111001, + B10011111,B10000001,B11111001, + B10011111,B10111001,B11111001, + B10001111,B00101000,B11110001, + B10000000,B00111000,B00000001, + B10000000,B00000000,B00000001, + B10011111,B11111111,B11111001, + B10010001,B01110100,B10011001, + B10011011,B00000110,B10101001, + B10011011,B01010100,B10101001, + B10011011,B01010110,B10101001, + B10011011,B01010100,B10011001, + B10011111,B11111111,B11111001, + B11111111,B11111111,B11111111 +}; +// +// Use default bitmaps +// +#define STATUS_HOTEND_ANIM +#define STATUS_BED_ANIM #if HOTENDS < 2 - - #if FAN_ANIM_FRAMES <= 2 - - const unsigned char status_screen0_bmp[] PROGMEM = { - B11111111,B11111111,B11111111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B10000000,B00000000,B00000001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B00000000,B11111000, - B10001110,B00000000,B11100001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00111111,B00111000, - B10011111,B00000000,B11110001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B01111110,B00011000, - B10010011,B10000001,B00111001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B01111100,B00011000, - B10011111,B10000001,B11111001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101000,B01111100,B00001000, - B10011111,B10000001,B11111001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101100,B00111000,B00001000, - B10011111,B10111001,B11110001,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00101111,B00111001,B11001000, - B10001111,B00101000,B11110001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00101111,B11111111,B11101000, - B10000000,B00111000,B00000001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00101111,B11000111,B11101000, - B10000000,B00000000,B00000001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00101111,B11111111,B11101000, - B10011111,B11111111,B11111001,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00100111,B00111001,B11101000, - B10010001,B01110100,B10011001,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00100000,B00111000,B01101000, - B10011011,B00000110,B10101001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00100000,B01111100,B00101000, - B10011011,B01010100,B10101001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00110000,B01111100,B00011000, - B10011011,B01010110,B10101001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00110000,B11111100,B00011000, - B10011011,B01010100,B10011001,B00000000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111001,B11111000,B00111000, - B10011111,B11111111,B11111001,B00000000,B00000000,B00000111,B10000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00111110,B00000000,B11111000, - B11111111,B11111111,B11111111,B00000000,B00000000,B00000011,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00111111,B11111111,B11111000 - }; - const unsigned char status_screen1_bmp[] PROGMEM = { - B11111111,B11111111,B11111111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B10000000,B00000000,B00000001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B10000000,B11111000, - B10001110,B00000000,B11100001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111001,B10000000,B00111000, - B10011111,B00000000,B11110001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110111,B10000001,B11011000, - B10010011,B10000001,B00111001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110111,B11000011,B11011000, - B10011111,B10000001,B11111001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100111,B11000111,B11101000, - B10011111,B10000001,B11111001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100011,B11000111,B11111000, - B10011111,B10111001,B11110001,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00100001,B11111111,B10001000, - B10001111,B00101000,B11110001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00100000,B01101100,B00001000, - B10000000,B00111000,B00000001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00100000,B01101100,B00001000, - B10000000,B00000000,B00000001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00100000,B01101100,B00001000, - B10011111,B11111111,B11111001,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00100011,B11111111,B00001000, - B10010001,B01110100,B10011001,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00111111,B11000111,B10001000, - B10011011,B00000110,B10101001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00101111,B11000111,B11001000, - B10011011,B01010100,B10101001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00110111,B10000111,B11011000, - B10011011,B01010110,B10101001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00110111,B00000011,B11011000, - B10011011,B01010100,B10011001,B00000000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000011,B00111000, - B10011111,B11111111,B11111001,B00000000,B00000000,B00000111,B10000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00111110,B00000010,B11111000, - B11111111,B11111111,B11111111,B00000000,B00000000,B00000011,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00111111,B11111111,B11111000 - }; - - #elif FAN_ANIM_FRAMES == 3 - - const unsigned char status_screen0_bmp[] PROGMEM = { - B11111111,B11111111,B11111111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B10000000,B00000000,B00000001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B00000000,B11111000, - B10001110,B00000000,B11100001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00111111,B00111000, - B10011111,B00000000,B11110001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B01111110,B00011000, - B10010011,B10000001,B00111001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B01111100,B00011000, - B10011111,B10000001,B11111001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101000,B01111100,B00001000, - B10011111,B10000001,B11111001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101100,B00111000,B00001000, - B10011111,B10111001,B11110001,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00101111,B00111001,B11001000, - B10001111,B00101000,B11110001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00101111,B11111111,B11101000, - B10000000,B00111000,B00000001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00101111,B11000111,B11101000, - B10000000,B00000000,B00000001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00101111,B11111111,B11101000, - B10011111,B11111111,B11111001,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00100111,B00111001,B11101000, - B10010001,B01110100,B10011001,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00100000,B00111000,B01101000, - B10011011,B00000110,B10101001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00100000,B01111100,B00101000, - B10011011,B01010100,B10101001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00110000,B01111100,B00011000, - B10011011,B01010110,B10101001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00110000,B11111100,B00011000, - B10011011,B01010100,B10011001,B00000000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111001,B11111000,B00111000, - B10011111,B11111111,B11111001,B00000000,B00000000,B00000111,B10000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00111110,B00000000,B11111000, - B11111111,B11111111,B11111111,B00000000,B00000000,B00000011,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00111111,B11111111,B11111000 - }; - const unsigned char status_screen1_bmp[] PROGMEM = { - B11111111,B11111111,B11111111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B10000000,B00000000,B00000001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B00000000,B11111000, - B10001110,B00000000,B11100001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00001111,B00111000, - B10011111,B00000000,B11110001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110100,B00011111,B11011000, - B10010011,B10000001,B00111001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110110,B00011111,B10011000, - B10011111,B10000001,B11111001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B00011111,B00001000, - B10011111,B10000001,B11111001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B10011110,B00001000, - B10011111,B10111001,B11110001,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00101111,B11111100,B00001000, - B10001111,B00101000,B11110001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00101111,B11011100,B00001000, - B10000000,B00111000,B00000001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00100111,B11101111,B11001000, - B10000000,B00000000,B00000001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00100000,B01110111,B11101000, - B10011111,B11111111,B11111001,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00100000,B01111111,B11101000, - B10010001,B01110100,B10011001,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00100000,B11110011,B11101000, - B10011011,B00000110,B10101001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00100001,B11110001,B11101000, - B10011011,B01010100,B10101001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00110011,B11110000,B11011000, - B10011011,B01010110,B10101001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00110111,B11110000,B01011000, - B10011011,B01010100,B10011001,B00000000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111001,B11100000,B00111000, - B10011111,B11111111,B11111001,B00000000,B00000000,B00000111,B10000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00111110,B00000000,B11111000, - B11111111,B11111111,B11111111,B00000000,B00000000,B00000011,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00111111,B11111111,B11111000 - }; - const unsigned char status_screen2_bmp[] PROGMEM = { - B11111111,B11111111,B11111111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B10000000,B00000000,B00000001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B10000000,B11111000, - B10001110,B00000000,B11100001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111001,B10000000,B00111000, - B10011111,B00000000,B11110001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110111,B10000001,B11011000, - B10010011,B10000001,B00111001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110111,B11000011,B11011000, - B10011111,B10000001,B11111001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100111,B11000111,B11101000, - B10011111,B10000001,B11111001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100011,B11000111,B11111000, - B10011111,B10111001,B11110001,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00100001,B11111111,B10001000, - B10001111,B00101000,B11110001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00100000,B01101100,B00001000, - B10000000,B00111000,B00000001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00100000,B01101100,B00001000, - B10000000,B00000000,B00000001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00100000,B01101100,B00001000, - B10011111,B11111111,B11111001,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00100011,B11111111,B00001000, - B10010001,B01110100,B10011001,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00111111,B11000111,B10001000, - B10011011,B00000110,B10101001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00101111,B11000111,B11001000, - B10011011,B01010100,B10101001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00110111,B10000111,B11011000, - B10011011,B01010110,B10101001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00110111,B00000011,B11011000, - B10011011,B01010100,B10011001,B00000000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000011,B00111000, - B10011111,B11111111,B11111001,B00000000,B00000000,B00000111,B10000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00111110,B00000010,B11111000, - B11111111,B11111111,B11111111,B00000000,B00000000,B00000011,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00111111,B11111111,B11111000 - }; - - #elif FAN_ANIM_FRAMES == 4 - - const unsigned char status_screen0_bmp[] PROGMEM = { - B11111111,B11111111,B11111111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B10000000,B00000000,B00000001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B00000000,B11111000, - B10001110,B00000000,B11100001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00111111,B00111000, - B10011111,B00000000,B11110001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B01111110,B00011000, - B10010011,B10000001,B00111001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B01111100,B00011000, - B10011111,B10000001,B11111001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101000,B01111100,B00001000, - B10011111,B10000001,B11111001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101100,B00111000,B00001000, - B10011111,B10111001,B11110001,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00101111,B00111001,B11001000, - B10001111,B00101000,B11110001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00101111,B11111111,B11101000, - B10000000,B00111000,B00000001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00101111,B11000111,B11101000, - B10000000,B00000000,B00000001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00101111,B11111111,B11101000, - B10011111,B11111111,B11111001,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00100111,B00111001,B11101000, - B10010001,B01110100,B10011001,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00100000,B00111000,B01101000, - B10011011,B00000110,B10101001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00100000,B01111100,B00101000, - B10011011,B01010100,B10101001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00110000,B01111100,B00011000, - B10011011,B01010110,B10101001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00110000,B11111100,B00011000, - B10011011,B01010100,B10011001,B00000000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111001,B11111000,B00111000, - B10011111,B11111111,B11111001,B00000000,B00000000,B00000111,B10000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00111110,B00000000,B11111000, - B11111111,B11111111,B11111111,B00000000,B00000000,B00000011,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00111111,B11111111,B11111000 - }; - const unsigned char status_screen1_bmp[] PROGMEM = { - B11111111,B11111111,B11111111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B10000000,B00000000,B00000001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B00000000,B11111000, - B10001110,B00000000,B11100001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00001111,B00111000, - B10011111,B00000000,B11110001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110100,B00011111,B11011000, - B10010011,B10000001,B00111001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110110,B00011111,B10011000, - B10011111,B10000001,B11111001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B00011111,B00001000, - B10011111,B10000001,B11111001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B10011110,B00001000, - B10011111,B10111001,B11110001,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00101111,B11111100,B00001000, - B10001111,B00101000,B11110001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00101111,B11011100,B00001000, - B10000000,B00111000,B00000001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00100111,B11101111,B11001000, - B10000000,B00000000,B00000001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00100000,B01110111,B11101000, - B10011111,B11111111,B11111001,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00100000,B01111111,B11101000, - B10010001,B01110100,B10011001,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00100000,B11110011,B11101000, - B10011011,B00000110,B10101001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00100001,B11110001,B11101000, - B10011011,B01010100,B10101001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00110011,B11110000,B11011000, - B10011011,B01010110,B10101001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00110111,B11110000,B01011000, - B10011011,B01010100,B10011001,B00000000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111001,B11100000,B00111000, - B10011111,B11111111,B11111001,B00000000,B00000000,B00000111,B10000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00111110,B00000000,B11111000, - B11111111,B11111111,B11111111,B00000000,B00000000,B00000011,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00111111,B11111111,B11111000 - }; - const unsigned char status_screen2_bmp[] PROGMEM = { - B11111111,B11111111,B11111111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B10000000,B00000000,B00000001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B10000000,B11111000, - B10001110,B00000000,B11100001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111001,B10000000,B00111000, - B10011111,B00000000,B11110001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110111,B10000001,B11011000, - B10010011,B10000001,B00111001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110111,B11000011,B11011000, - B10011111,B10000001,B11111001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100111,B11000111,B11101000, - B10011111,B10000001,B11111001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100011,B11000111,B11111000, - B10011111,B10111001,B11110001,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00100001,B11111111,B10001000, - B10001111,B00101000,B11110001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00100000,B01101100,B00001000, - B10000000,B00111000,B00000001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00100000,B01101100,B00001000, - B10000000,B00000000,B00000001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00100000,B01101100,B00001000, - B10011111,B11111111,B11111001,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00100011,B11111111,B00001000, - B10010001,B01110100,B10011001,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00111111,B11000111,B10001000, - B10011011,B00000110,B10101001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00101111,B11000111,B11001000, - B10011011,B01010100,B10101001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00110111,B10000111,B11011000, - B10011011,B01010110,B10101001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00110111,B00000011,B11011000, - B10011011,B01010100,B10011001,B00000000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000011,B00111000, - B10011111,B11111111,B11111001,B00000000,B00000000,B00000111,B10000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00111110,B00000010,B11111000, - B11111111,B11111111,B11111111,B00000000,B00000000,B00000011,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00111111,B11111111,B11111000 - }; - const unsigned char status_screen3_bmp[] PROGMEM = { - B11111111,B11111111,B11111111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B10000000,B00000000,B00000001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B00000000,B11111000, - B10001110,B00000000,B11100001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111001,B11110000,B00111000, - B10011111,B00000000,B11110001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110001,B11100000,B00011000, - B10010011,B10000001,B00111001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110001,B11100000,B00011000, - B10011111,B10000001,B11111001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100001,B11100001,B11101000, - B10011111,B10000001,B11111001,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B11110011,B11101000, - B10011111,B10111001,B11110001,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00100000,B01111111,B11101000, - B10001111,B00101000,B11110001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00100000,B01110111,B11101000, - B10000000,B00111000,B00000001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000100,B00010000,B01000000,B00000000,B00101000,B11101110,B00101000, - B10000000,B00000000,B00000001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00101111,B11011100,B00001000, - B10011111,B11111111,B11111001,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00101111,B11111100,B00001000, - B10010001,B01110100,B10011001,B00000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00101111,B10011110,B00001000, - B10011011,B00000110,B10101001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00100000,B10000010,B00000000,B00000000,B00101111,B00001111,B00001000, - B10011011,B01010100,B10101001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00010000,B01000001,B00000000,B00000000,B00110000,B00001111,B00011000, - B10011011,B01010110,B10101001,B00000000,B00000000,B00111111,B11110000,B00000000,B00000000,B00001000,B00100000,B10000000,B00000000,B00110000,B00001111,B00011000, - B10011011,B01010100,B10011001,B00000000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00011111,B00111000, - B10011111,B11111111,B11111001,B00000000,B00000000,B00000111,B10000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00111110,B00000000,B11111000, - B11111111,B11111111,B11111111,B00000000,B00000000,B00000011,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00111111,B11111111,B11111000 - }; - - #endif - -#else // HOTENDS >= 2 - - #if FAN_ANIM_FRAMES <= 2 - - const unsigned char status_screen0_bmp[] PROGMEM = { - B00111101,B11110000,B00000010,B00111000,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11110000, - B01000100,B10001000,B00000110,B01000101,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B10000000,B10001000,B00000010,B01000101,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B11111100,B00110000, - B10000000,B11110000,B00000010,B01000100,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B11111100,B00010000, - B10000000,B10100011,B11110010,B01000100,B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B01111000,B00010000, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B00110000,B00010000, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101100,B00000000,B11010000, - B01000100,B10001000,B00000010,B01000101,B00010000,B00011111,B11100000,B00000001,B11111110,B00000000,B00001000,B00100000,B10000000,B00101110,B00110001,B11010000, - B00111001,B11001100,B00000111,B00111001,B11100000,B00111110,B11110000,B00000011,B11001111,B00000000,B00000100,B00010000,B01000000,B00101111,B01111011,B11010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00111100,B11110000,B00000011,B10110111,B00000000,B00000100,B00010000,B01000000,B00101111,B01111011,B11010000, - B00000000,B00111000,B01110000,B11100000,B00000000,B00111010,B11110000,B00000011,B11110111,B00000000,B00001000,B00100000,B10000000,B00101110,B00110001,B11010000, - B00000000,B01000100,B10001001,B00010000,B00000000,B00011110,B11100000,B00000001,B11101110,B00000000,B00010000,B01000001,B00000000,B00101100,B00000000,B11010000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00011110,B11100000,B00000001,B11011110,B00000000,B00100000,B10000010,B00000000,B00100000,B00110000,B00010000, - B00000000,B00011000,B10001001,B00010000,B00000000,B00111110,B11110000,B00000011,B10111111,B00000000,B00100000,B10000010,B00000000,B00100000,B01111000,B00010000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111110,B11110000,B00000011,B10000111,B00000000,B00010000,B01000001,B00000000,B00100000,B11111100,B00010000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111111,B11110000,B00000011,B11111111,B00000000,B00001000,B00100000,B10000000,B00110000,B11111100,B00110000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00001111,B11000000,B00000000,B11111100,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00000000,B01000100,B10001001,B00010000,B00000000,B00000111,B10000000,B00000000,B01111000,B00000000,B11111111,B11111111,B11000000,B00111111,B11111111,B11110000, - B00000000,B00111000,B01110000,B11100000,B00000000,B00000011,B00000000,B00000000,B00110000,B00000000,B11111111,B11111111,B11000000,B00000000,B00000000,B00000000 - }; - const unsigned char status_screen1_bmp[] PROGMEM = { - B00111101,B11110000,B00000010,B00111000,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11110000, - B01000100,B10001000,B00000110,B01000101,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B10000000,B10001000,B00000010,B01000101,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110011,B10000111,B00110000, - B10000000,B11110000,B00000010,B01000100,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100111,B10000111,B10010000, - B10000000,B10100011,B11110010,B01000100,B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B10000111,B11010000, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B10000111,B11010000, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B00000011,B11010000, - B01000100,B10001000,B00000010,B01000101,B00010000,B00011111,B11100000,B00000001,B11111110,B00000000,B00001000,B00100000,B10000000,B00100000,B00110000,B00010000, - B00111001,B11001100,B00000111,B00111001,B11100000,B00111110,B11110000,B00000011,B11001111,B00000000,B00000100,B00010000,B01000000,B00100000,B01111000,B00010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00111100,B11110000,B00000011,B10110111,B00000000,B00000100,B00010000,B01000000,B00100000,B01111000,B00010000, - B00000000,B00111000,B01110000,B11100000,B00000000,B00111010,B11110000,B00000011,B11110111,B00000000,B00001000,B00100000,B10000000,B00100000,B00110000,B00010000, - B00000000,B01000100,B10001001,B00010000,B00000000,B00011110,B11100000,B00000001,B11101110,B00000000,B00010000,B01000001,B00000000,B00101111,B00000011,B11010000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00011110,B11100000,B00000001,B11011110,B00000000,B00100000,B10000010,B00000000,B00101111,B10000111,B11010000, - B00000000,B00011000,B10001001,B00010000,B00000000,B00111110,B11110000,B00000011,B10111111,B00000000,B00100000,B10000010,B00000000,B00101111,B10000111,B11010000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111110,B11110000,B00000011,B10000111,B00000000,B00010000,B01000001,B00000000,B00100111,B10000111,B10010000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111111,B11110000,B00000011,B11111111,B00000000,B00001000,B00100000,B10000000,B00110011,B10000111,B00110000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00001111,B11000000,B00000000,B11111100,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00000000,B01000100,B10001001,B00010000,B00000000,B00000111,B10000000,B00000000,B01111000,B00000000,B11111111,B11111111,B11000000,B00111111,B11111111,B11110000, - B00000000,B00111000,B01110000,B11100000,B00000000,B00000011,B00000000,B00000000,B00110000,B00000000,B11111111,B11111111,B11000000,B00000000,B00000000,B00000000 - }; - - #elif FAN_ANIM_FRAMES == 3 - - const unsigned char status_screen0_bmp[] PROGMEM = { - B00111101,B11110000,B00000010,B00111000,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11111111,B11111111, - B01000100,B10001000,B00000110,B01000101,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11000000,B00011111, - B10000000,B10001000,B00000010,B01000101,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B00100000,B00100111, - B10000000,B11110000,B00000010,B01000100,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,B11110000,B01111011, - B10000000,B10100011,B11110010,B01000100,B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,B11110000,B01111011, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000101,B11111000,B11111101, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000100,B11111000,B11111001, - B01000100,B10001000,B00000010,B01000101,B00010000,B00011111,B11100000,B00000001,B11111110,B00000000,B00001000,B00100000,B10000000,B00000100,B00111111,B11100001, - B00111001,B11001100,B00000111,B00111001,B11100000,B00111110,B11110000,B00000011,B11001111,B00000000,B00000100,B00010000,B01000000,B00000100,B00001111,B10000001, - B00000000,B00000000,B00000000,B00000000,B00000000,B00111100,B11110000,B00000011,B10110111,B00000000,B00000100,B00010000,B01000000,B00000100,B00001111,B10000001, - B00000000,B00111000,B01110000,B11100000,B00000000,B00111010,B11110000,B00000011,B11110111,B00000000,B00001000,B00100000,B10000000,B00000100,B00001111,B10000001, - B00000000,B01000100,B10001001,B00010000,B00000000,B00011110,B11100000,B00000001,B11101110,B00000000,B00010000,B01000001,B00000000,B00000100,B00111111,B11100001, - B00000000,B00000100,B10001001,B00010000,B00000000,B00011110,B11100000,B00000001,B11011110,B00000000,B00100000,B10000010,B00000000,B00000100,B11111000,B11111001, - B00000000,B00011000,B10001001,B00010000,B00000000,B00111110,B11110000,B00000011,B10111111,B00000000,B00100000,B10000010,B00000000,B00000101,B11111000,B11111101, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111110,B11110000,B00000011,B10000111,B00000000,B00010000,B01000001,B00000000,B00000110,B11110000,B01111011, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111111,B11110000,B00000011,B11111111,B00000000,B00001000,B00100000,B10000000,B00000110,B11110000,B01111011, - B00000000,B00000100,B10001001,B00010000,B00000000,B00001111,B11000000,B00000000,B11111100,B00000000,B00000000,B00000000,B00000000,B00000111,B00100000,B00100111, - B00000000,B01000100,B10001001,B00010000,B00000000,B00000111,B10000000,B00000000,B01111000,B00000000,B11111111,B11111111,B11000000,B00000111,B11000000,B00011111, - B00000000,B00111000,B01110000,B11100000,B00000000,B00000011,B00000000,B00000000,B00110000,B00000000,B11111111,B11111111,B11000000,B00000111,B11111111,B11111111 - }; - const unsigned char status_screen1_bmp[] PROGMEM = { - B00111101,B11110000,B00000010,B00111000,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11111111,B11111111, - B01000100,B10001000,B00000110,B01000101,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11000110,B00011111, - B10000000,B10001000,B00000010,B01000101,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B00111110,B00000111, - B10000000,B11110000,B00000010,B01000100,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,B00111110,B00000011, - B10000000,B10100011,B11110010,B01000100,B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,B00011110,B00000011, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000100,B00011110,B00001101, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000100,B00000110,B00111101, - B01000100,B10001000,B00000010,B01000101,B00010000,B00011111,B11100000,B00000001,B11111110,B00000000,B00001000,B00100000,B10000000,B00000100,B00000111,B00111101, - B00111001,B11001100,B00000111,B00111001,B11100000,B00111110,B11110000,B00000011,B11001111,B00000000,B00000100,B00010000,B01000000,B00000100,B00001111,B11111111, - B00000000,B00000000,B00000000,B00000000,B00000000,B00111100,B11110000,B00000011,B10110111,B00000000,B00000100,B00010000,B01000000,B00000111,B11111111,B11111111, - B00000000,B00111000,B01110000,B11100000,B00000000,B00111010,B11110000,B00000011,B11110111,B00000000,B00001000,B00100000,B10000000,B00000111,B11111111,B10000001, - B00000000,B01000100,B10001001,B00010000,B00000000,B00011110,B11100000,B00000001,B11101110,B00000000,B00010000,B01000001,B00000000,B00000101,B11100111,B00000001, - B00000000,B00000100,B10001001,B00010000,B00000000,B00011110,B11100000,B00000001,B11011110,B00000000,B00100000,B10000010,B00000000,B00000101,B11000011,B00000001, - B00000000,B00011000,B10001001,B00010000,B00000000,B00111110,B11110000,B00000011,B10111111,B00000000,B00100000,B10000010,B00000000,B00000101,B10000011,B11000001, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111110,B11110000,B00000011,B10000111,B00000000,B00010000,B01000001,B00000000,B00000110,B00000011,B11000011, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111111,B11110000,B00000011,B11111111,B00000000,B00001000,B00100000,B10000000,B00000110,B00000011,B11100011, - B00000000,B00000100,B10001001,B00010000,B00000000,B00001111,B11000000,B00000000,B11111100,B00000000,B00000000,B00000000,B00000000,B00000111,B00000011,B11100111, - B00000000,B01000100,B10001001,B00010000,B00000000,B00000111,B10000000,B00000000,B01111000,B00000000,B11111111,B11111111,B11000000,B00000111,B11000011,B00011111, - B00000000,B00111000,B01110000,B11100000,B00000000,B00000011,B00000000,B00000000,B00110000,B00000000,B11111111,B11111111,B11000000,B00000111,B11111111,B11111111 - }; - const unsigned char status_screen2_bmp[] PROGMEM = { - B00111101,B11110000,B00000010,B00111000,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11111111,B11111111, - B01000100,B10001000,B00000110,B01000101,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11000011,B00011111, - B10000000,B10001000,B00000010,B01000101,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B00000011,B11100111, - B10000000,B11110000,B00000010,B01000100,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,B00000011,B11110011, - B10000000,B10100011,B11110010,B01000100,B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,B10000011,B11100011, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000101,B11000011,B11000001, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000101,B11100011,B10000001, - B01000100,B10001000,B00000010,B01000101,B00010000,B00011111,B11100000,B00000001,B11111110,B00000000,B00001000,B00100000,B10000000,B00000101,B11110111,B00000001, - B00111001,B11001100,B00000111,B00111001,B11100000,B00111110,B11110000,B00000011,B11001111,B00000000,B00000100,B00010000,B01000000,B00000111,B11111111,B10000001, - B00000000,B00000000,B00000000,B00000000,B00000000,B00111100,B11110000,B00000011,B10110111,B00000000,B00000100,B00010000,B01000000,B00000111,B11111111,B11111111, - B00000000,B00111000,B01110000,B11100000,B00000000,B00111010,B11110000,B00000011,B11110111,B00000000,B00001000,B00100000,B10000000,B00000100,B00001111,B11111111, - B00000000,B01000100,B10001001,B00010000,B00000000,B00011110,B11100000,B00000001,B11101110,B00000000,B00010000,B01000001,B00000000,B00000100,B00000111,B01111101, - B00000000,B00000100,B10001001,B00010000,B00000000,B00011110,B11100000,B00000001,B11011110,B00000000,B00100000,B10000010,B00000000,B00000100,B00001110,B00111101, - B00000000,B00011000,B10001001,B00010000,B00000000,B00111110,B11110000,B00000011,B10111111,B00000000,B00100000,B10000010,B00000000,B00000100,B00011110,B00011101, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111110,B11110000,B00000011,B10000111,B00000000,B00010000,B01000001,B00000000,B00000110,B00111110,B00001011, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111111,B11110000,B00000011,B11111111,B00000000,B00001000,B00100000,B10000000,B00000110,B01111110,B00000011, - B00000000,B00000100,B10001001,B00010000,B00000000,B00001111,B11000000,B00000000,B11111100,B00000000,B00000000,B00000000,B00000000,B00000111,B00111110,B00000111, - B00000000,B01000100,B10001001,B00010000,B00000000,B00000111,B10000000,B00000000,B01111000,B00000000,B11111111,B11111111,B11000000,B00000111,B11000110,B00011111, - B00000000,B00111000,B01110000,B11100000,B00000000,B00000011,B00000000,B00000000,B00110000,B00000000,B11111111,B11111111,B11000000,B00000111,B11111111,B11111111 - }; - - #elif FAN_ANIM_FRAMES == 4 - - const unsigned char status_screen0_bmp[] PROGMEM = { - B00111101,B11110000,B00000010,B00111000,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B01000100,B10001000,B00000110,B01000101,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B00000000,B11111000, - B10000000,B10001000,B00000010,B01000101,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00111111,B00111000, - B10000000,B11110000,B00000010,B01000100,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B01111110,B00011000, - B10000000,B10100011,B11110010,B01000100,B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B01111100,B00011000, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101000,B01111100,B00001000, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101100,B00111000,B00001000, - B01000100,B10001000,B00000010,B01000101,B00010000,B00011111,B11100000,B00000001,B11111110,B00000000,B00001000,B00100000,B10000000,B00101111,B00111001,B11001000, - B00111001,B11001100,B00000111,B00111001,B11100000,B00111110,B11110000,B00000011,B11001111,B00000000,B00000100,B00010000,B01000000,B00101111,B11111111,B11101000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00111100,B11110000,B00000011,B10110111,B00000000,B00000100,B00010000,B01000000,B00101111,B11000111,B11101000, - B00000000,B00111000,B01110000,B11100000,B00000000,B00111010,B11110000,B00000011,B11110111,B00000000,B00001000,B00100000,B10000000,B00101111,B11111111,B11101000, - B00000000,B01000100,B10001001,B00010000,B00000000,B00011110,B11100000,B00000001,B11101110,B00000000,B00010000,B01000001,B00000000,B00100111,B00111001,B11101000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00011110,B11100000,B00000001,B11011110,B00000000,B00100000,B10000010,B00000000,B00100000,B00111000,B01101000, - B00000000,B00011000,B10001001,B00010000,B00000000,B00111110,B11110000,B00000011,B10111111,B00000000,B00100000,B10000010,B00000000,B00100000,B01111100,B00101000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111110,B11110000,B00000011,B10000111,B00000000,B00010000,B01000001,B00000000,B00110000,B01111100,B00011000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111111,B11110000,B00000011,B11111111,B00000000,B00001000,B00100000,B10000000,B00110000,B11111100,B00011000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00001111,B11000000,B00000000,B11111100,B00000000,B00000000,B00000000,B00000000,B00111001,B11111000,B00111000, - B00000000,B01000100,B10001001,B00010000,B00000000,B00000111,B10000000,B00000000,B01111000,B00000000,B11111111,B11111111,B11000000,B00111110,B00000000,B11111000, - B00000000,B00111000,B01110000,B11100000,B00000000,B00000011,B00000000,B00000000,B00110000,B00000000,B11111111,B11111111,B11000000,B00111111,B11111111,B11111000 - }; - const unsigned char status_screen1_bmp[] PROGMEM = { - B00111101,B11110000,B00000010,B00111000,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B01000100,B10001000,B00000110,B01000101,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B00000000,B11111000, - B10000000,B10001000,B00000010,B01000101,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00001111,B00111000, - B10000000,B11110000,B00000010,B01000100,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110100,B00011111,B11011000, - B10000000,B10100011,B11110010,B01000100,B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110110,B00011111,B10011000, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B00011111,B00001000, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B10011110,B00001000, - B01000100,B10001000,B00000010,B01000101,B00010000,B00011111,B11100000,B00000001,B11111110,B00000000,B00001000,B00100000,B10000000,B00101111,B11111100,B00001000, - B00111001,B11001100,B00000111,B00111001,B11100000,B00111110,B11110000,B00000011,B11001111,B00000000,B00000100,B00010000,B01000000,B00101111,B11011100,B00001000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00111100,B11110000,B00000011,B10110111,B00000000,B00000100,B00010000,B01000000,B00100111,B11101111,B11001000, - B00000000,B00111000,B01110000,B11100000,B00000000,B00111010,B11110000,B00000011,B11110111,B00000000,B00001000,B00100000,B10000000,B00100000,B01110111,B11101000, - B00000000,B01000100,B10001001,B00010000,B00000000,B00011110,B11100000,B00000001,B11101110,B00000000,B00010000,B01000001,B00000000,B00100000,B01111111,B11101000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00011110,B11100000,B00000001,B11011110,B00000000,B00100000,B10000010,B00000000,B00100000,B11110011,B11101000, - B00000000,B00011000,B10001001,B00010000,B00000000,B00111110,B11110000,B00000011,B10111111,B00000000,B00100000,B10000010,B00000000,B00100001,B11110001,B11101000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111110,B11110000,B00000011,B10000111,B00000000,B00010000,B01000001,B00000000,B00110011,B11110000,B11011000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111111,B11110000,B00000011,B11111111,B00000000,B00001000,B00100000,B10000000,B00110111,B11110000,B01011000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00001111,B11000000,B00000000,B11111100,B00000000,B00000000,B00000000,B00000000,B00111001,B11100000,B00111000, - B00000000,B01000100,B10001001,B00010000,B00000000,B00000111,B10000000,B00000000,B01111000,B00000000,B11111111,B11111111,B11000000,B00111110,B00000000,B11111000, - B00000000,B00111000,B01110000,B11100000,B00000000,B00000011,B00000000,B00000000,B00110000,B00000000,B11111111,B11111111,B11000000,B00111111,B11111111,B11111000 - }; - const unsigned char status_screen2_bmp[] PROGMEM = { - B00111101,B11110000,B00000010,B00111000,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B01000100,B10001000,B00000110,B01000101,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B10000000,B11111000, - B10000000,B10001000,B00000010,B01000101,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111001,B10000000,B00111000, - B10000000,B11110000,B00000010,B01000100,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110111,B10000001,B11011000, - B10000000,B10100011,B11110010,B01000100,B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110111,B11000011,B11011000, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100111,B11000111,B11101000, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100011,B11000111,B11111000, - B01000100,B10001000,B00000010,B01000101,B00010000,B00011111,B11100000,B00000001,B11111110,B00000000,B00001000,B00100000,B10000000,B00100001,B11111111,B10001000, - B00111001,B11001100,B00000111,B00111001,B11100000,B00111110,B11110000,B00000011,B11001111,B00000000,B00000100,B00010000,B01000000,B00100000,B01101100,B00001000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00111100,B11110000,B00000011,B10110111,B00000000,B00000100,B00010000,B01000000,B00100000,B01101100,B00001000, - B00000000,B00111000,B01110000,B11100000,B00000000,B00111010,B11110000,B00000011,B11110111,B00000000,B00001000,B00100000,B10000000,B00100000,B01101100,B00001000, - B00000000,B01000100,B10001001,B00010000,B00000000,B00011110,B11100000,B00000001,B11101110,B00000000,B00010000,B01000001,B00000000,B00100011,B11111111,B00001000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00011110,B11100000,B00000001,B11011110,B00000000,B00100000,B10000010,B00000000,B00111111,B11000111,B10001000, - B00000000,B00011000,B10001001,B00010000,B00000000,B00111110,B11110000,B00000011,B10111111,B00000000,B00100000,B10000010,B00000000,B00101111,B11000111,B11001000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111110,B11110000,B00000011,B10000111,B00000000,B00010000,B01000001,B00000000,B00110111,B10000111,B11011000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111111,B11110000,B00000011,B11111111,B00000000,B00001000,B00100000,B10000000,B00110111,B00000011,B11011000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00001111,B11000000,B00000000,B11111100,B00000000,B00000000,B00000000,B00000000,B00111000,B00000011,B00111000, - B00000000,B01000100,B10001001,B00010000,B00000000,B00000111,B10000000,B00000000,B01111000,B00000000,B11111111,B11111111,B11000000,B00111110,B00000010,B11111000, - B00000000,B00111000,B01110000,B11100000,B00000000,B00000011,B00000000,B00000000,B00110000,B00000000,B11111111,B11111111,B11000000,B00111111,B11111111,B11111000 - }; - const unsigned char status_screen3_bmp[] PROGMEM = { - B00111101,B11110000,B00000010,B00111000,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B01000100,B10001000,B00000110,B01000101,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B00000000,B11111000, - B10000000,B10001000,B00000010,B01000101,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111001,B11110000,B00111000, - B10000000,B11110000,B00000010,B01000100,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110001,B11100000,B00011000, - B10000000,B10100011,B11110010,B01000100,B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110001,B11100000,B00011000, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100001,B11100001,B11101000, - B10000000,B10010000,B00000010,B01000100,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B11110011,B11101000, - B01000100,B10001000,B00000010,B01000101,B00010000,B00011111,B11100000,B00000001,B11111110,B00000000,B00001000,B00100000,B10000000,B00100000,B01111111,B11101000, - B00111001,B11001100,B00000111,B00111001,B11100000,B00111110,B11110000,B00000011,B11001111,B00000000,B00000100,B00010000,B01000000,B00100000,B01110111,B11101000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00111100,B11110000,B00000011,B10110111,B00000000,B00000100,B00010000,B01000000,B00101000,B11101110,B00101000, - B00000000,B00111000,B01110000,B11100000,B00000000,B00111010,B11110000,B00000011,B11110111,B00000000,B00001000,B00100000,B10000000,B00101111,B11011100,B00001000, - B00000000,B01000100,B10001001,B00010000,B00000000,B00011110,B11100000,B00000001,B11101110,B00000000,B00010000,B01000001,B00000000,B00101111,B11111100,B00001000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00011110,B11100000,B00000001,B11011110,B00000000,B00100000,B10000010,B00000000,B00101111,B10011110,B00001000, - B00000000,B00011000,B10001001,B00010000,B00000000,B00111110,B11110000,B00000011,B10111111,B00000000,B00100000,B10000010,B00000000,B00101111,B00001111,B00001000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111110,B11110000,B00000011,B10000111,B00000000,B00010000,B01000001,B00000000,B00110000,B00001111,B00011000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00111111,B11110000,B00000011,B11111111,B00000000,B00001000,B00100000,B10000000,B00110000,B00001111,B00011000, - B00000000,B00000100,B10001001,B00010000,B00000000,B00001111,B11000000,B00000000,B11111100,B00000000,B00000000,B00000000,B00000000,B00111000,B00011111,B00111000, - B00000000,B01000100,B10001001,B00010000,B00000000,B00000111,B10000000,B00000000,B01111000,B00000000,B11111111,B11111111,B11000000,B00111110,B00000000,B11111000, - B00000000,B00111000,B01110000,B11100000,B00000000,B00000011,B00000000,B00000000,B00110000,B00000000,B11111111,B11111111,B11000000,B00111111,B11111111,B11111000 - }; - - #endif - -#endif // HOTENDS >= 2 + #define STATUS_LOGO_X 8 + #define STATUS_HEATERS_X 40 + #define STATUS_BED_X 72 +#else + #define STATUS_LOGO_X 0 + #define STATUS_HEATERS_X 32 + #define STATUS_BED_X 80 +#endif diff --git a/Marlin/src/config/examples/Formbot/T_Rex_2+/Configuration.h b/Marlin/src/config/examples/Formbot/T_Rex_2+/Configuration.h index 1df3baa84e..30422027ec 100644 --- a/Marlin/src/config/examples/Formbot/T_Rex_2+/Configuration.h +++ b/Marlin/src/config/examples/Formbot/T_Rex_2+/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once //#define ROXYs_TRex // Turn this on to get customizations only available on Roxy's T-Rex 2+ // Marlin controlled heat bed, Max7219 debug LED's, less bright LED light level @@ -38,8 +39,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -206,7 +205,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -223,7 +222,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -244,6 +242,9 @@ // Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing). // The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder). // For the other hotends it is their distance from the extruder 0 hotend. +//#define HOTEND_OFFSET_X {0.0, 20.00} // (mm) relative X-offset for each nozzle +//#define HOTEND_OFFSET_Y {0.0, 5.00} // (mm) relative Y-offset for each nozzle +//#define HOTEND_OFFSET_Z {0.0, 0.00} // (mm) relative Z-offset for each nozzle #ifdef ROXYs_TRex #define HOTEND_OFFSET_X {0.0, 0.00} // (mm) for each extruder, offset of the hotend on the X axis @@ -667,7 +668,6 @@ * Override with M92 * X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]] */ -//#define DEFAULT_AXIS_STEPS_PER_UNIT { 80, 160, 1600, 93 } #define DEFAULT_AXIS_STEPS_PER_UNIT { 80, 80, 800, 93 } /** @@ -675,7 +675,6 @@ * Override with M203 * X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]] */ -//#define DEFAULT_MAX_FEEDRATE { 250, 150, 5, 25 } #define DEFAULT_MAX_FEEDRATE { 250, 100, 5, 25 } /** @@ -694,11 +693,6 @@ * M204 R Retract Acceleration * M204 T Travel Acceleration */ - -//#define DEFAULT_ACCELERATION 3000 // X, Y, Z and E acceleration for printing moves -//#define DEFAULT_RETRACT_ACCELERATION 3000 // E acceleration for retracts -//#define DEFAULT_TRAVEL_ACCELERATION 3000 // X, Y, Z acceleration for travel (non printing) moves - #define DEFAULT_ACCELERATION 1500 // X, Y, Z and E acceleration for printing moves #define DEFAULT_RETRACT_ACCELERATION 1500 // E acceleration for retracts #define DEFAULT_TRAVEL_ACCELERATION 1500 // X, Y, Z acceleration for travel (non printing) moves @@ -711,11 +705,6 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -//#define DEFAULT_XJERK 20.0 -//#define DEFAULT_YJERK 10.0 -//#define DEFAULT_ZJERK 0.4 -//#define DEFAULT_EJERK 5.0 - #define DEFAULT_XJERK 12.0 // More conservitive numbers. #define DEFAULT_YJERK 8.0 #define DEFAULT_ZJERK 0.4 @@ -803,6 +792,7 @@ //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed #endif + // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) //#define SOLENOID_PROBE @@ -810,6 +800,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -841,7 +838,7 @@ #define MIN_PROBE_EDGE 0 // X and Y axis travel speed (mm/m) between probes -#define XY_PROBE_SPEED 7000 +#define XY_PROBE_SPEED 5000 // Feedrate (mm/m) for the first approach when double-probing (MULTIPLE_PROBING == 2) #define Z_PROBE_SPEED_FAST HOMING_FEEDRATE_Z @@ -871,7 +868,7 @@ #define Z_CLEARANCE_DEPLOY_PROBE 7 // Z Clearance for Deploy/Stow #define Z_CLEARANCE_BETWEEN_PROBES 7 // Z Clearance between probe points #define Z_CLEARANCE_MULTI_PROBE 5 // Z Clearance between multiple probes -#define Z_AFTER_PROBING 7 // Z position after probing is done +#define Z_AFTER_PROBING 10 // Z position after probing is done #define Z_PROBE_LOW_POINT -2 // Farthest distance below the trigger-point to go before stopping @@ -897,6 +894,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -917,8 +915,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER false // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +//#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -943,7 +941,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -#define Z_HOMING_HEIGHT 8 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +#define Z_HOMING_HEIGHT 8 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -964,11 +962,7 @@ #define Z_MIN_POS 0 #define X_MAX_POS 450 #define Y_MAX_POS Y_BED_SIZE -#if ENABLED(tallVersion) - #define Z_MAX_POS 700 -#else - #define Z_MAX_POS 500 -#endif +#define Z_MAX_POS 700 /** * Software Endstops @@ -1014,6 +1008,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1092,7 +1098,7 @@ #if ENABLED(G26_MESH_VALIDATION) #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. - #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_HOTEND_TEMP 208.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. #endif @@ -1188,8 +1194,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1230,8 +1237,8 @@ #define Z_SAFE_HOMING #if ENABLED(Z_SAFE_HOMING) - #define Z_SAFE_HOMING_X_POINT ((X_BED_SIZE) / 2) // X point for Z homing when homing all axes (G28). - #define Z_SAFE_HOMING_Y_POINT ((Y_BED_SIZE) / 2) // Y point for Z homing when homing all axes (G28). + #define Z_SAFE_HOMING_X_POINT (((X_BED_SIZE) / 2) - 15) // X point for Z homing when homing all axes (G28). + #define Z_SAFE_HOMING_Y_POINT (((Y_BED_SIZE) / 2) - 15) // Y point for Z homing when homing all axes (G28). #endif // Homing speeds (mm/m) @@ -1344,10 +1351,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 180 #define PREHEAT_1_TEMP_BED 70 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 110 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -1463,7 +1472,7 @@ * * View the current statistics with M78. */ -#define PRINTCOUNTER +//#define PRINTCOUNTER //============================================================================= //============================= LCD and SD support ============================ @@ -1476,10 +1485,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1507,6 +1516,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1871,6 +1887,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -2027,5 +2052,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/Formbot/T_Rex_2+/Configuration_adv.h b/Marlin/src/config/examples/Formbot/T_Rex_2+/Configuration_adv.h index df19643be2..34d95af950 100644 --- a/Marlin/src/config/examples/Formbot/T_Rex_2+/Configuration_adv.h +++ b/Marlin/src/config/examples/Formbot/T_Rex_2+/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -30,8 +31,6 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -176,8 +175,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -220,7 +219,7 @@ * * Define one or both of these to override the default 0-255 range. */ -#define FAN_MIN_PWM 64 +#define FAN_MIN_PWM 45 //#define FAN_MAX_PWM 128 // @section extruder @@ -245,7 +244,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -366,12 +365,12 @@ */ #define DUAL_X_CARRIAGE #if ENABLED(DUAL_X_CARRIAGE) - #define X1_MIN_POS X_MIN_POS // set minimum to ensure first x-carriage doesn't hit the parked second X-carriage - #define X1_MAX_POS X_BED_SIZE // set maximum to ensure first x-carriage doesn't hit the parked second X-carriage - #define X2_MIN_POS 0 // set minimum to ensure second x-carriage doesn't hit the parked first X-carriage - #define X2_MAX_POS (442-4.0) // set maximum to the distance between toolheads when both heads are homed - #define X2_HOME_DIR 1 // the second X-carriage always homes to the maximum endstop position - #define X2_HOME_POS X2_MAX_POS // default home position is the maximum carriage position + #define X1_MIN_POS X_MIN_POS // set minimum to ensure first x-carriage doesn't hit the parked second X-carriage + #define X1_MAX_POS (X_BED_SIZE) // set maximum to ensure first x-carriage doesn't hit the parked second X-carriage + #define X2_MIN_POS 0 // set minimum to ensure second x-carriage doesn't hit the parked first X-carriage + #define X2_MAX_POS (442-4.0) // set maximum to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // the second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // default home position is the maximum carriage position // However: In this mode the HOTEND_OFFSET_X value for the second extruder provides a software // override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops // without modifying the firmware (through the "M218 T1 X???" command). @@ -389,10 +388,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 200 @@ -417,6 +412,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -468,7 +484,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -486,6 +502,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] @@ -539,15 +566,15 @@ //=============================Additional Features=========================== //=========================================================================== -#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu #define LCD_INFO_MENU @@ -563,7 +590,7 @@ // Add an 'M73' G-code to set the current percentage #define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_PRINT_PROGRESS //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -572,7 +599,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -601,7 +628,7 @@ #define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -687,6 +714,43 @@ */ #define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -701,7 +765,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar //#define DOGM_SD_PERCENT @@ -771,16 +835,25 @@ */ #define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 40 // Babysteps are very small. Increase for faster motion. -//#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - #define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. -//#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 40 // Babysteps are very small. Increase for faster motion. + + #define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - #define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + #define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -982,6 +1055,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -1007,21 +1089,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1060,19 +1163,19 @@ // until extrusion is consistent, and to purge old filament. // Filament Unload does a Retract, Delay, and Purge first: - #define FILAMENT_UNLOAD_RETRACT_LENGTH 4 // (mm) Unload initial retract length. - #define FILAMENT_UNLOAD_DELAY 5000 // (ms) Delay for the filament to cool after retract. + #define FILAMENT_UNLOAD_RETRACT_LENGTH 0 // (mm) Unload initial retract length. + #define FILAMENT_UNLOAD_DELAY 500 // (ms) Delay for the filament to cool after retract. #define FILAMENT_UNLOAD_PURGE_LENGTH 0 // (mm) An unretract is done, then this length is purged. - #define PAUSE_PARK_NOZZLE_TIMEOUT 45 // (seconds) Time limit before the nozzle is turned off for safety. - #define FILAMENT_CHANGE_ALERT_BEEPS 1 // Number of alert beeps to play when a response is needed. + #define PAUSE_PARK_NOZZLE_TIMEOUT (3*60) // (seconds) Time limit before the nozzle is turned off for safety. + #define FILAMENT_CHANGE_ALERT_BEEPS 3 // Number of alert beeps to play when a response is needed. #define PAUSE_PARK_NO_STEPPER_TIMEOUT // Enable for XYZ steppers to stay powered on during filament change. #define PARK_HEAD_ON_PAUSE // Park the nozzle during pause and filament change. #define HOME_BEFORE_FILAMENT_CHANGE // Ensure homing has been completed prior to parking for filament change - //#define FILAMENT_LOAD_UNLOAD_GCODES // Add M701/M702 Load/Unload G-codes, plus Load/Unload in the LCD Prepare menu. - //#define FILAMENT_UNLOAD_ALL_EXTRUDERS // Allow M702 to unload all extruders above a minimum target temp (as set by M302) + #define FILAMENT_LOAD_UNLOAD_GCODES // Add M701/M702 Load/Unload G-codes, plus Load/Unload in the LCD Prepare menu. + #define FILAMENT_UNLOAD_ALL_EXTRUDERS // Allow M702 to unload all extruders above a minimum target temp (as set by M302) #endif // @section tmc @@ -1262,11 +1365,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1275,10 +1378,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1418,6 +1529,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1560,26 +1680,57 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ //#define CUSTOM_USER_MENUS #if ENABLED(CUSTOM_USER_MENUS) //#define CUSTOM_USER_MENU_TITLE "Custom Commands" - //#define USER_SCRIPT_AUDIBLE_FEEDBACK - #define USER_SCRIPT_RETURN // Return to status screen after a script + #define USER_SCRIPT_DONE "M117 User Script Done" + #define USER_SCRIPT_AUDIBLE_FEEDBACK + //#define USER_SCRIPT_RETURN // Return to status screen after a script - #define USER_DESC_1 "User cmd 1" - #define USER_GCODE_1 "G28 X \n" + #define USER_DESC_1 "Home & UBL Info" + #define USER_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "User cmd 2" - #define USER_GCODE_2 "G28 \nG1 X100 \n" + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL + #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "User cmd 3" - #define USER_GCODE_3 "M48 \n" + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL + #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) - #define USER_DESC_4 "User cmd 4" - #define USER_GCODE_4 "M114 \n" + #define USER_DESC_4 "Heat Bed/Home/Level" + #define USER_GCODE_4 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nG28\nG29" + + #define USER_DESC_5 "Home & Info" + #define USER_GCODE_5 "G28\nM503" #endif /** @@ -1705,7 +1856,7 @@ #define MAX7219_GCODE // Add the M7219 G-code to control the LED matrix #define MAX7219_INIT_TEST 2 // Do a test pattern at initialization (Set to 2 for spiral) - #define MAX7219_NUMBER_UNITS 2 // Number of Max7219 units in chain. + #define MAX7219_NUMBER_UNITS 3 // Number of Max7219 units in chain. #define MAX7219_ROTATE 0 // Rotate the display clockwise (in multiples of +/- 90°) // connector at: right=0 bottom=-90 top=90 left=180 #define MAX7219_REVERSE_ORDER // The individual LED matrix units may be in reversed order @@ -1747,5 +1898,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/examples/Formbot/T_Rex_2+/_Bootscreen.h b/Marlin/src/config/examples/Formbot/T_Rex_2+/_Bootscreen.h index 42d92efef8..c2333ed4cf 100644 --- a/Marlin/src/config/examples/Formbot/T_Rex_2+/_Bootscreen.h +++ b/Marlin/src/config/examples/Formbot/T_Rex_2+/_Bootscreen.h @@ -32,9 +32,7 @@ #include #define CUSTOM_BOOTSCREEN_TIMEOUT 2500 - #define CUSTOM_BOOTSCREEN_BMPWIDTH 128 -#define CUSTOM_BOOTSCREEN_BMPHEIGHT 64 const unsigned char custom_start_bmp[] PROGMEM = { B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00001111, diff --git a/Marlin/src/config/examples/Formbot/T_Rex_2+/_Statusscreen.h b/Marlin/src/config/examples/Formbot/T_Rex_2+/_Statusscreen.h index 487419892d..689b1c947f 100644 --- a/Marlin/src/config/examples/Formbot/T_Rex_2+/_Statusscreen.h +++ b/Marlin/src/config/examples/Formbot/T_Rex_2+/_Statusscreen.h @@ -29,102 +29,45 @@ * Use the Marlin Bitmap Converter to make your own: * http://marlinfw.org/tools/u8glib/converter.html */ -//#include "MarlinConfig.h" -//============================================ +// +// Status Screen Logo bitmap +// +#define STATUS_LOGO_Y 4 +#define STATUS_LOGO_WIDTH 21 -#define STATUS_SCREENWIDTH 128 - -#define STATUS_SCREEN_HOTEND_TEXT_X(E) (27 + (E) * 25) - -#define STATUS_SCREEN_BED_TEXT_X 81 - -#define FAN_ANIM_FRAMES 3 -#define STATUS_SCREEN_FAN_TEXT_X 103 -#define STATUS_SCREEN_FAN_TEXT_Y 28 - -//============================================ +const unsigned char status_logo_bmp[] PROGMEM = { + B00000000,B00011110,B00000000, + B00000000,B11111111,B10000000, + B00000001,B11111111,B11100000, + B00000111,B00000000,B00000000, + B00001111,B00000000,B00000000, + B00011111,B00001111,B11111000, + B00011111,B00001111,B11111000, + B00011111,B00001111,B11111000, + B00011111,B00001111,B11111000, + B00011111,B00001111,B11111000, + B00011111,B00001111,B11111000, + B00011111,B00000000,B00000000, + B00011111,B00000000,B00000000, + B00001111,B00001111,B11111000, + B00000111,B00001111,B11110000, + B00000011,B00001111,B11000000, + B00000001,B00001111,B00000000, + B00000000,B00001100,B00000000 +}; +// +// Use default bitmaps +// +#define STATUS_HOTEND_ANIM +#define STATUS_BED_ANIM #if HOTENDS < 2 - - #error "Single hotend bitmap not available." - -#else // HOTENDS >= 2 - - #if FAN_ANIM_FRAMES <= 2 - - #error "Under 3 FAN_ANIM_FRAMES not available." - - #elif FAN_ANIM_FRAMES == 3 - - const unsigned char status_screen0_bmp[] PROGMEM = { - B00000000,B00001111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11111111,B11111111, - B00000000,B01111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11000000,B00011111, - B00000000,B11111111,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B00100000,B00100111, - B00000011,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,B11110000,B01111011, - B00000111,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,B11110000,B01111011, - B00001111,B10000111,B11111100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000101,B11111000,B11111101, - B00001111,B10000111,B11111100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000100,B11111000,B11111001, - B00001111,B10000111,B11111100,B00000000,B11111111,B00000000,B00000000,B01111111,B10000000,B00000000,B00001000,B00100000,B10000000,B00000100,B00111111,B11100001, - B00001111,B10000111,B11111100,B00000001,B11110111,B10000000,B00000000,B11110011,B11000000,B00000000,B00000100,B00010000,B01000000,B00000100,B00001111,B10000001, - B00001111,B10000111,B11111100,B00000001,B11100111,B10000000,B00000000,B11101101,B11000000,B00000000,B00000100,B00010000,B01000000,B00000100,B00001111,B10000001, - B00001111,B10000111,B11111100,B00000001,B11010111,B10000000,B00000000,B11111101,B11000000,B00000000,B00001000,B00100000,B10000000,B00000100,B00001111,B10000001, - B00001111,B10000000,B00000000,B00000000,B11110111,B00000000,B00000000,B01111011,B10000000,B00000000,B00010000,B01000001,B00000000,B00000100,B00111111,B11100001, - B00001111,B10000000,B00000000,B00000000,B11110111,B00000000,B00000000,B01110111,B10000000,B00000000,B00100000,B10000010,B00000000,B00000100,B11111000,B11111001, - B00000111,B10000111,B11111100,B00000001,B11110111,B10000000,B00000000,B11101111,B11000000,B00000000,B00100000,B10000010,B00000000,B00000101,B11111000,B11111101, - B00000011,B10000111,B11111000,B00000001,B11100011,B10000000,B00000000,B11100001,B11000000,B00000000,B00010000,B01000001,B00000000,B00000110,B11110000,B01111011, - B00000001,B10000111,B11100000,B00000001,B11111111,B10000000,B00000000,B11111111,B11000000,B00000000,B00001000,B00100000,B10000000,B00000110,B11110000,B01111011, - B00000000,B10000111,B10000000,B00000000,B01111110,B00000000,B00000000,B00111111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B00100000,B00100111, - B00000000,B00000110,B00000000,B00000000,B00111100,B00000000,B00000000,B00011110,B00000000,B00000000,B11111111,B11111111,B11000000,B00000111,B11000000,B00011111, - B00000000,B00000000,B00000000,B00000000,B00011000,B00000000,B00000000,B00001100,B00000000,B00000000,B11111111,B11111111,B11000000,B00000111,B11111111,B11111111 - }; - const unsigned char status_screen1_bmp[] PROGMEM = { - B00000000,B00001111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11111111,B11111111, - B00000000,B01111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11000110,B00011111, - B00000000,B11111111,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B00111110,B00000111, - B00000011,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,B00111110,B00000011, - B00000111,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,B00011110,B00000011, - B00001111,B10000111,B11111100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000100,B00011110,B00001101, - B00001111,B10000111,B11111100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000100,B00000110,B00111101, - B00001111,B10000111,B11111100,B00000000,B11111111,B00000000,B00000000,B01111111,B10000000,B00000000,B00001000,B00100000,B10000000,B00000100,B00000111,B00111101, - B00001111,B10000111,B11111100,B00000001,B11110111,B10000000,B00000000,B11110011,B11000000,B00000000,B00000100,B00010000,B01000000,B00000100,B00001111,B11111111, - B00001111,B10000111,B11111100,B00000001,B11100111,B10000000,B00000000,B11101101,B11000000,B00000000,B00000100,B00010000,B01000000,B00000111,B11111111,B11111111, - B00001111,B10000111,B11111100,B00000001,B11010111,B10000000,B00000000,B11111101,B11000000,B00000000,B00001000,B00100000,B10000000,B00000111,B11111111,B10000001, - B00001111,B10000000,B00000000,B00000000,B11110111,B00000000,B00000000,B01111011,B10000000,B00000000,B00010000,B01000001,B00000000,B00000101,B11100111,B00000001, - B00001111,B10000000,B00000000,B00000000,B11110111,B00000000,B00000000,B01110111,B10000000,B00000000,B00100000,B10000010,B00000000,B00000101,B11000011,B00000001, - B00000111,B10000111,B11111100,B00000001,B11110111,B10000000,B00000000,B11101111,B11000000,B00000000,B00100000,B10000010,B00000000,B00000101,B10000011,B11000001, - B00000011,B10000111,B11111000,B00000001,B11100011,B10000000,B00000000,B11100001,B11000000,B00000000,B00010000,B01000001,B00000000,B00000110,B00000011,B11000011, - B00000001,B10000111,B11100000,B00000001,B11111111,B10000000,B00000000,B11111111,B11000000,B00000000,B00001000,B00100000,B10000000,B00000110,B00000011,B11100011, - B00000000,B10000111,B10000000,B00000000,B01111110,B00000000,B00000000,B01111111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B00000011,B11100111, - B00000000,B00000110,B00000000,B00000000,B00111100,B00000000,B00000000,B00111110,B00000000,B00000000,B11111111,B11111111,B11000000,B00000111,B11000011,B00011111, - B00000000,B00000000,B00000000,B00000000,B00011000,B00000000,B00000000,B00001100,B00000000,B00000000,B11111111,B11111111,B11000000,B00000111,B11111111,B11111111 - }; - const unsigned char status_screen2_bmp[] PROGMEM = { - B00000000,B00001111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11111111,B11111111, - B00000000,B01111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11000011,B00011111, - B00000000,B11111111,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B00000011,B11100111, - B00000011,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,B00000011,B11110011, - B00000111,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,B10000011,B11100011, - B00001111,B10000111,B11111100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000101,B11000011,B11000001, - B00001111,B10000111,B11111100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000101,B11100011,B10000001, - B00001111,B10000111,B11111100,B00000000,B11111111,B00000000,B00000000,B01111111,B10000000,B00000000,B00001000,B00100000,B10000000,B00000101,B11110111,B00000001, - B00001111,B10000111,B11111100,B00000001,B11110111,B10000000,B00000000,B11110011,B11000000,B00000000,B00000100,B00010000,B01000000,B00000111,B11111111,B10000001, - B00001111,B10000111,B11111100,B00000001,B11100111,B10000000,B00000000,B11101101,B11000000,B00000000,B00000100,B00010000,B01000000,B00000111,B11111111,B11111111, - B00001111,B10000111,B11111100,B00000001,B11010111,B10000000,B00000000,B11111101,B11000000,B00000000,B00001000,B00100000,B10000000,B00000100,B00001111,B11111111, - B00001111,B10000000,B00000000,B00000000,B11110111,B00000000,B00000000,B01111011,B10000000,B00000000,B00010000,B01000001,B00000000,B00000100,B00000111,B01111101, - B00001111,B10000000,B00000000,B00000000,B11110111,B00000000,B00000000,B01110111,B10000000,B00000000,B00100000,B10000010,B00000000,B00000100,B00001110,B00111101, - B00000111,B10000111,B11111100,B00000001,B11110111,B10000000,B00000000,B11101111,B11000000,B00000000,B00100000,B10000010,B00000000,B00000100,B00011110,B00011101, - B00000011,B10000111,B11111000,B00000001,B11100011,B10000000,B00000000,B11100001,B11000000,B00000000,B00010000,B01000001,B00000000,B00000110,B00111110,B00001011, - B00000001,B10000111,B11100000,B00000001,B11111111,B10000000,B00000000,B11111111,B11000000,B00000000,B00001000,B00100000,B10000000,B00000110,B01111110,B00000011, - B00000000,B10000111,B10000000,B00000000,B01111110,B00000000,B00000000,B01111111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B00111110,B00000111, - B00000000,B00000110,B00000000,B00000000,B00111100,B00000000,B00000000,B00111110,B00000000,B00000000,B11111111,B11111111,B11000000,B00000111,B11000110,B00011111, - B00000000,B00000000,B00000000,B00000000,B00011000,B00000000,B00000000,B00001100,B00000000,B00000000,B11111111,B11111111,B11000000,B00000111,B11111111,B11111111 - }; - - #elif FAN_ANIM_FRAMES == 4 - - #error "4 FAN_ANIM_FRAMES not available." - - #endif - -#endif // HOTENDS >= 2 + #define STATUS_LOGO_X 8 + #define STATUS_HEATERS_X 40 + #define STATUS_BED_X 72 +#else + #define STATUS_LOGO_X 0 + #define STATUS_HEATERS_X 32 + #define STATUS_BED_X 80 +#endif diff --git a/Marlin/src/config/examples/Formbot/T_Rex_3/Configuration.h b/Marlin/src/config/examples/Formbot/T_Rex_3/Configuration.h index 9e0225a0ab..776119cca1 100644 --- a/Marlin/src/config/examples/Formbot/T_Rex_3/Configuration.h +++ b/Marlin/src/config/examples/Formbot/T_Rex_3/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -207,7 +206,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -224,7 +223,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -793,6 +791,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -880,6 +885,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -900,8 +906,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER false // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +//#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -926,7 +932,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -#define Z_HOMING_HEIGHT 8 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +#define Z_HOMING_HEIGHT 8 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -1002,6 +1008,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1171,8 +1189,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1327,10 +1346,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 180 #define PREHEAT_1_TEMP_BED 70 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 110 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -1459,10 +1480,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1490,6 +1511,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1857,6 +1885,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -2013,5 +2050,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/Formbot/T_Rex_3/Configuration_adv.h b/Marlin/src/config/examples/Formbot/T_Rex_3/Configuration_adv.h index 8af3fee58f..a8e0f0f79d 100644 --- a/Marlin/src/config/examples/Formbot/T_Rex_3/Configuration_adv.h +++ b/Marlin/src/config/examples/Formbot/T_Rex_3/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -30,8 +31,6 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -176,8 +175,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -245,7 +244,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -390,10 +389,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 200 @@ -418,6 +413,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -469,7 +485,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -487,6 +503,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] @@ -540,15 +567,15 @@ //=============================Additional Features=========================== //=========================================================================== -#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu #define LCD_INFO_MENU @@ -564,7 +591,7 @@ // Add an 'M73' G-code to set the current percentage #define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -573,7 +600,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -602,7 +629,7 @@ #define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -688,6 +715,43 @@ */ #define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -702,7 +766,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar //#define DOGM_SD_PERCENT @@ -772,16 +836,24 @@ */ #define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 40 // Babysteps are very small. Increase for faster motion. -//#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - #define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. -//#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 40 // Babysteps are very small. Increase for faster motion. + + #define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -983,6 +1055,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -1008,21 +1089,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1263,11 +1365,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1276,10 +1378,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1419,6 +1529,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1561,6 +1680,33 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ @@ -1747,5 +1893,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/examples/Formbot/T_Rex_3/_Bootscreen.h b/Marlin/src/config/examples/Formbot/T_Rex_3/_Bootscreen.h index 02ef485d53..ad09d3523b 100644 --- a/Marlin/src/config/examples/Formbot/T_Rex_3/_Bootscreen.h +++ b/Marlin/src/config/examples/Formbot/T_Rex_3/_Bootscreen.h @@ -32,9 +32,7 @@ #include #define CUSTOM_BOOTSCREEN_TIMEOUT 2500 - #define CUSTOM_BOOTSCREEN_BMPWIDTH 128 -#define CUSTOM_BOOTSCREEN_BMPHEIGHT 64 const unsigned char custom_start_bmp[] PROGMEM = { B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00001111, diff --git a/Marlin/src/config/examples/Formbot/T_Rex_3/_Statusscreen.h b/Marlin/src/config/examples/Formbot/T_Rex_3/_Statusscreen.h index 63159c98a2..689b1c947f 100644 --- a/Marlin/src/config/examples/Formbot/T_Rex_3/_Statusscreen.h +++ b/Marlin/src/config/examples/Formbot/T_Rex_3/_Statusscreen.h @@ -30,102 +30,44 @@ * http://marlinfw.org/tools/u8glib/converter.html */ -//#include "MarlinConfig.h" +// +// Status Screen Logo bitmap +// +#define STATUS_LOGO_Y 4 +#define STATUS_LOGO_WIDTH 21 -//============================================ - -#define STATUS_SCREENWIDTH 128 - -#define STATUS_SCREEN_HOTEND_TEXT_X(E) (27 + (E) * 25) - -#define STATUS_SCREEN_BED_TEXT_X 81 - -#define FAN_ANIM_FRAMES 3 -#define STATUS_SCREEN_FAN_TEXT_X 103 -#define STATUS_SCREEN_FAN_TEXT_Y 28 - -//============================================ +const unsigned char status_logo_bmp[] PROGMEM = { + B00000000,B00011110,B00000000, + B00000000,B11111111,B10000000, + B00000001,B11111111,B11100000, + B00000111,B00000000,B00000000, + B00001111,B00000000,B00000000, + B00011111,B00001111,B11111000, + B00011111,B00001111,B11111000, + B00011111,B00001111,B11111000, + B00011111,B00001111,B11111000, + B00011111,B00001111,B11111000, + B00011111,B00001111,B11111000, + B00011111,B00000000,B00000000, + B00011111,B00000000,B00000000, + B00001111,B00001111,B11111000, + B00000111,B00001111,B11110000, + B00000011,B00001111,B11000000, + B00000001,B00001111,B00000000, + B00000000,B00001100,B00000000 +}; +// +// Use default bitmaps +// +#define STATUS_HOTEND_ANIM +#define STATUS_BED_ANIM #if HOTENDS < 2 - #if FAN_ANIM_FRAMES <= 2 - #elif FAN_ANIM_FRAMES == 3 - #elif FAN_ANIM_FRAMES == 4 - #endif - -#else // HOTENDS >= 2 - - #if FAN_ANIM_FRAMES <= 2 - - #elif FAN_ANIM_FRAMES == 3 - - const unsigned char status_screen0_bmp[] PROGMEM = { - B00000000,B00001111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11111111,B11111111, - B00000000,B01111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11000000,B00011111, - B00000000,B11111111,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B00100000,B00100111, - B00000011,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,B11110000,B01111011, - B00000111,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,B11110000,B01111011, - B00001111,B10000111,B11111100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000101,B11111000,B11111101, - B00001111,B10000111,B11111100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000100,B11111000,B11111001, - B00001111,B10000111,B11111100,B00000000,B11111111,B00000000,B00000000,B01111111,B10000000,B00000000,B00001000,B00100000,B10000000,B00000100,B00111111,B11100001, - B00001111,B10000111,B11111100,B00000001,B11110111,B10000000,B00000000,B11110011,B11000000,B00000000,B00000100,B00010000,B01000000,B00000100,B00001111,B10000001, - B00001111,B10000111,B11111100,B00000001,B11100111,B10000000,B00000000,B11101101,B11000000,B00000000,B00000100,B00010000,B01000000,B00000100,B00001111,B10000001, - B00001111,B10000111,B11111100,B00000001,B11010111,B10000000,B00000000,B11111101,B11000000,B00000000,B00001000,B00100000,B10000000,B00000100,B00001111,B10000001, - B00001111,B10000000,B00000000,B00000000,B11110111,B00000000,B00000000,B01111011,B10000000,B00000000,B00010000,B01000001,B00000000,B00000100,B00111111,B11100001, - B00001111,B10000000,B00000000,B00000000,B11110111,B00000000,B00000000,B01110111,B10000000,B00000000,B00100000,B10000010,B00000000,B00000100,B11111000,B11111001, - B00000111,B10000111,B11111100,B00000001,B11110111,B10000000,B00000000,B11101111,B11000000,B00000000,B00100000,B10000010,B00000000,B00000101,B11111000,B11111101, - B00000011,B10000111,B11111000,B00000001,B11100011,B10000000,B00000000,B11100001,B11000000,B00000000,B00010000,B01000001,B00000000,B00000110,B11110000,B01111011, - B00000001,B10000111,B11100000,B00000001,B11111111,B10000000,B00000000,B11111111,B11000000,B00000000,B00001000,B00100000,B10000000,B00000110,B11110000,B01111011, - B00000000,B10000111,B10000000,B00000000,B01111110,B00000000,B00000000,B00111111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B00100000,B00100111, - B00000000,B00000110,B00000000,B00000000,B00111100,B00000000,B00000000,B00011110,B00000000,B00000000,B11111111,B11111111,B11000000,B00000111,B11000000,B00011111, - B00000000,B00000000,B00000000,B00000000,B00011000,B00000000,B00000000,B00001100,B00000000,B00000000,B11111111,B11111111,B11000000,B00000111,B11111111,B11111111 - }; - const unsigned char status_screen1_bmp[] PROGMEM = { - B00000000,B00001111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11111111,B11111111, - B00000000,B01111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11000110,B00011111, - B00000000,B11111111,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B00111110,B00000111, - B00000011,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,B00111110,B00000011, - B00000111,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,B00011110,B00000011, - B00001111,B10000111,B11111100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000100,B00011110,B00001101, - B00001111,B10000111,B11111100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000100,B00000110,B00111101, - B00001111,B10000111,B11111100,B00000000,B11111111,B00000000,B00000000,B01111111,B10000000,B00000000,B00001000,B00100000,B10000000,B00000100,B00000111,B00111101, - B00001111,B10000111,B11111100,B00000001,B11110111,B10000000,B00000000,B11110011,B11000000,B00000000,B00000100,B00010000,B01000000,B00000100,B00001111,B11111111, - B00001111,B10000111,B11111100,B00000001,B11100111,B10000000,B00000000,B11101101,B11000000,B00000000,B00000100,B00010000,B01000000,B00000111,B11111111,B11111111, - B00001111,B10000111,B11111100,B00000001,B11010111,B10000000,B00000000,B11111101,B11000000,B00000000,B00001000,B00100000,B10000000,B00000111,B11111111,B10000001, - B00001111,B10000000,B00000000,B00000000,B11110111,B00000000,B00000000,B01111011,B10000000,B00000000,B00010000,B01000001,B00000000,B00000101,B11100111,B00000001, - B00001111,B10000000,B00000000,B00000000,B11110111,B00000000,B00000000,B01110111,B10000000,B00000000,B00100000,B10000010,B00000000,B00000101,B11000011,B00000001, - B00000111,B10000111,B11111100,B00000001,B11110111,B10000000,B00000000,B11101111,B11000000,B00000000,B00100000,B10000010,B00000000,B00000101,B10000011,B11000001, - B00000011,B10000111,B11111000,B00000001,B11100011,B10000000,B00000000,B11100001,B11000000,B00000000,B00010000,B01000001,B00000000,B00000110,B00000011,B11000011, - B00000001,B10000111,B11100000,B00000001,B11111111,B10000000,B00000000,B11111111,B11000000,B00000000,B00001000,B00100000,B10000000,B00000110,B00000011,B11100011, - B00000000,B10000111,B10000000,B00000000,B01111110,B00000000,B00000000,B01111111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B00000011,B11100111, - B00000000,B00000110,B00000000,B00000000,B00111100,B00000000,B00000000,B00111110,B00000000,B00000000,B11111111,B11111111,B11000000,B00000111,B11000011,B00011111, - B00000000,B00000000,B00000000,B00000000,B00011000,B00000000,B00000000,B00001100,B00000000,B00000000,B11111111,B11111111,B11000000,B00000111,B11111111,B11111111 - }; - const unsigned char status_screen2_bmp[] PROGMEM = { - B00000000,B00001111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11111111,B11111111, - B00000000,B01111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11000011,B00011111, - B00000000,B11111111,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B00000011,B11100111, - B00000011,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,B00000011,B11110011, - B00000111,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,B10000011,B11100011, - B00001111,B10000111,B11111100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000101,B11000011,B11000001, - B00001111,B10000111,B11111100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000101,B11100011,B10000001, - B00001111,B10000111,B11111100,B00000000,B11111111,B00000000,B00000000,B01111111,B10000000,B00000000,B00001000,B00100000,B10000000,B00000101,B11110111,B00000001, - B00001111,B10000111,B11111100,B00000001,B11110111,B10000000,B00000000,B11110011,B11000000,B00000000,B00000100,B00010000,B01000000,B00000111,B11111111,B10000001, - B00001111,B10000111,B11111100,B00000001,B11100111,B10000000,B00000000,B11101101,B11000000,B00000000,B00000100,B00010000,B01000000,B00000111,B11111111,B11111111, - B00001111,B10000111,B11111100,B00000001,B11010111,B10000000,B00000000,B11111101,B11000000,B00000000,B00001000,B00100000,B10000000,B00000100,B00001111,B11111111, - B00001111,B10000000,B00000000,B00000000,B11110111,B00000000,B00000000,B01111011,B10000000,B00000000,B00010000,B01000001,B00000000,B00000100,B00000111,B01111101, - B00001111,B10000000,B00000000,B00000000,B11110111,B00000000,B00000000,B01110111,B10000000,B00000000,B00100000,B10000010,B00000000,B00000100,B00001110,B00111101, - B00000111,B10000111,B11111100,B00000001,B11110111,B10000000,B00000000,B11101111,B11000000,B00000000,B00100000,B10000010,B00000000,B00000100,B00011110,B00011101, - B00000011,B10000111,B11111000,B00000001,B11100011,B10000000,B00000000,B11100001,B11000000,B00000000,B00010000,B01000001,B00000000,B00000110,B00111110,B00001011, - B00000001,B10000111,B11100000,B00000001,B11111111,B10000000,B00000000,B11111111,B11000000,B00000000,B00001000,B00100000,B10000000,B00000110,B01111110,B00000011, - B00000000,B10000111,B10000000,B00000000,B01111110,B00000000,B00000000,B01111111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B00111110,B00000111, - B00000000,B00000110,B00000000,B00000000,B00111100,B00000000,B00000000,B00111110,B00000000,B00000000,B11111111,B11111111,B11000000,B00000111,B11000110,B00011111, - B00000000,B00000000,B00000000,B00000000,B00011000,B00000000,B00000000,B00001100,B00000000,B00000000,B11111111,B11111111,B11000000,B00000111,B11111111,B11111111 - }; - - #elif FAN_ANIM_FRAMES == 4 - - #error "4 FAN_ANIM_FRAMES not available." - - #endif - -#endif // HOTENDS >= 2 + #define STATUS_LOGO_X 8 + #define STATUS_HEATERS_X 40 + #define STATUS_BED_X 72 +#else + #define STATUS_LOGO_X 0 + #define STATUS_HEATERS_X 32 + #define STATUS_BED_X 80 +#endif diff --git a/Marlin/src/config/examples/Geeetech/GT2560/Configuration.h b/Marlin/src/config/examples/Geeetech/GT2560/Configuration.h index e58841187b..9afc16c4ab 100644 --- a/Marlin/src/config/examples/Geeetech/GT2560/Configuration.h +++ b/Marlin/src/config/examples/Geeetech/GT2560/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -787,6 +785,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -874,6 +879,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -894,8 +900,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -920,7 +926,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -987,6 +993,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1156,8 +1174,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1312,10 +1331,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 180 #define PREHEAT_1_TEMP_BED 70 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 110 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -1444,10 +1465,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1475,6 +1496,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1839,6 +1867,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1998,11 +2035,9 @@ */ #if ENABLED(ULTIMAKERCONTROLLER) || ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER) || ENABLED(G3D_PANEL) || ENABLED(MKS_MINI_12864) #define SDSUPPORT // Force SD Card support on for these displays -#else - #define LCD_WIDTH_OVERRIDE 20 // Default is 22. For this Geeetech use 20. +#elif DISABLED(LIGHTWEIGHT_UI) + #define LCD_WIDTH 20 // Default is 22. For this Geeetech use 20. #endif // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/Geeetech/I3_Pro_X-GT2560/Configuration.h b/Marlin/src/config/examples/Geeetech/I3_Pro_X-GT2560/Configuration.h index 2e9024437a..bf4333174a 100644 --- a/Marlin/src/config/examples/Geeetech/I3_Pro_X-GT2560/Configuration.h +++ b/Marlin/src/config/examples/Geeetech/I3_Pro_X-GT2560/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -772,6 +770,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -859,6 +864,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -879,8 +885,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -905,7 +911,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -#define Z_HOMING_HEIGHT 8 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +#define Z_HOMING_HEIGHT 8 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -972,6 +978,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1141,8 +1159,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1297,10 +1316,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 180 #define PREHEAT_1_TEMP_BED 70 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 215 #define PREHEAT_2_TEMP_BED 105 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -1429,10 +1450,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1460,6 +1481,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1824,6 +1852,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1980,5 +2017,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/Geeetech/MeCreator2/Configuration.h b/Marlin/src/config/examples/Geeetech/MeCreator2/Configuration.h new file mode 100644 index 0000000000..3df7e6f958 --- /dev/null +++ b/Marlin/src/config/examples/Geeetech/MeCreator2/Configuration.h @@ -0,0 +1,2026 @@ +/** + * 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 . + * + */ +#pragma once + +/** + * Configuration.h + * + * Basic settings such as: + * + * - Type of electronics + * - Type of temperature sensor + * - Printer geometry + * - Endstop configuration + * - LCD controller + * - Extra features + * + * Advanced settings can be found in Configuration_adv.h + * + */ +#define CONFIGURATION_H_VERSION 020000 + +//=========================================================================== +//============================= Getting Started ============================= +//=========================================================================== + +/** + * Here are some standard links for getting your machine calibrated: + * + * http://reprap.org/wiki/Calibration + * http://youtu.be/wAL9d7FgInk + * http://calculator.josefprusa.cz + * http://reprap.org/wiki/Triffid_Hunter%27s_Calibration_Guide + * http://www.thingiverse.com/thing:5573 + * https://sites.google.com/site/repraplogphase/calibration-of-your-reprap + * http://www.thingiverse.com/thing:298812 + */ + +//=========================================================================== +//============================= DELTA Printer =============================== +//=========================================================================== +// For a Delta printer start with one of the configuration files in the +// config/examples/delta directory and customize for your machine. +// + +//=========================================================================== +//============================= SCARA Printer =============================== +//=========================================================================== +// For a SCARA printer start with the configuration files in +// config/examples/SCARA and customize for your machine. +// + +// @section info + +// User-specified version info of this build to display in [Pronterface, etc] terminal window during +// startup. Implementation of an idea by Prof Braino to inform user that any changes made to this +// build by the user have been successfully uploaded into firmware. +#define STRING_CONFIG_H_AUTHOR "(Phr3d13, MeCreator2)" // Who made the changes. +#define SHOW_BOOTSCREEN +#define STRING_SPLASH_LINE1 SHORT_BUILD_VERSION // will be shown during bootup in line 1 +#define STRING_SPLASH_LINE2 WEBSITE_URL // will be shown during bootup in line 2 + +/** + * *** VENDORS PLEASE READ *** + * + * Marlin allows you to add a custom boot image for Graphical LCDs. + * With this option Marlin will first show your custom screen followed + * by the standard Marlin logo with version number and web URL. + * + * We encourage you to take advantage of this new feature and we also + * respectfully request that you retain the unmodified Marlin boot screen. + */ + +// Enable to show the bitmap in Marlin/_Bootscreen.h on startup. +//#define SHOW_CUSTOM_BOOTSCREEN + +// Enable to show the bitmap in Marlin/_Statusscreen.h on the status screen. +//#define CUSTOM_STATUS_SCREEN_IMAGE + +// @section machine + +/** + * Select the serial port on the board to use for communication with the host. + * This allows the connection of wireless adapters (for instance) to non-default port pins. + * Note: The first serial port (-1 or 0) will always be used by the Arduino bootloader. + * + * :[-1, 0, 1, 2, 3, 4, 5, 6, 7] + */ +#define SERIAL_PORT 0 + +/** + * Select a secondary serial port on the board to use for communication with the host. + * This allows the connection of wireless adapters (for instance) to non-default port pins. + * Serial port -1 is the USB emulated serial port, if available. + * + * :[-1, 0, 1, 2, 3, 4, 5, 6, 7] + */ +//#define SERIAL_PORT_2 -1 + +/** + * This setting determines the communication speed of the printer. + * + * 250000 works in most cases, but you might try a lower speed if + * you commonly experience drop-outs during host printing. + * You may try up to 1000000 to speed up SD file transfer. + * + * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000] + */ +#define BAUDRATE 250000 + +// Enable the Bluetooth serial interface on AT90USB devices +//#define BLUETOOTH + +// The following define selects which electronics board you have. +// Please choose the name from boards.h that matches your setup +#ifndef MOTHERBOARD + #define MOTHERBOARD BOARD_GT2560_V3_MC2 +#endif + +// Optional custom name for your RepStrap or other custom machine +// Displayed in the LCD "Ready" message +#define CUSTOM_MACHINE_NAME "MeCreator2" + +// Define this to set a unique identifier for this printer, (Used by some programs to differentiate between machines) +// You can use an online service to generate a random UUID. (eg http://www.uuidgenerator.net/version4) +//#define MACHINE_UUID "00000000-0000-0000-0000-000000000000" + +// @section extruder + +// This defines the number of extruders +// :[1, 2, 3, 4, 5, 6] +#define EXTRUDERS 1 + +// Generally expected filament diameter (1.75, 2.85, 3.0, ...). Used for Volumetric, Filament Width Sensor, etc. +#define DEFAULT_NOMINAL_FILAMENT_DIA 1.75 + +// For Cyclops or any "multi-extruder" that shares a single nozzle. +//#define SINGLENOZZLE + +/** + * Průša MK2 Single Nozzle Multi-Material Multiplexer, and variants. + * + * This device allows one stepper driver on a control board to drive + * two to eight stepper motors, one at a time, in a manner suitable + * for extruders. + * + * This option only allows the multiplexer to switch on tool-change. + * Additional options to configure custom E moves are pending. + */ +//#define MK2_MULTIPLEXER +#if ENABLED(MK2_MULTIPLEXER) + // Override the default DIO selector pins here, if needed. + // Some pins files may provide defaults for these pins. + //#define E_MUX0_PIN 40 // Always Required + //#define E_MUX1_PIN 42 // Needed for 3 to 8 inputs + //#define E_MUX2_PIN 44 // Needed for 5 to 8 inputs +#endif + +// A dual extruder that uses a single stepper motor +//#define SWITCHING_EXTRUDER +#if ENABLED(SWITCHING_EXTRUDER) + #define SWITCHING_EXTRUDER_SERVO_NR 0 + #define SWITCHING_EXTRUDER_SERVO_ANGLES { 0, 90 } // Angles for E0, E1[, E2, E3] + #if EXTRUDERS > 3 + #define SWITCHING_EXTRUDER_E23_SERVO_NR 1 + #endif +#endif + +// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +//#define SWITCHING_NOZZLE +#if ENABLED(SWITCHING_NOZZLE) + #define SWITCHING_NOZZLE_SERVO_NR 0 + #define SWITCHING_NOZZLE_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 +#endif + +/** + * Two separate X-carriages with extruders that connect to a moving part + * via a magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + */ +//#define PARKING_EXTRUDER +#if ENABLED(PARKING_EXTRUDER) + #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage + #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil + #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders + #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 +#endif + +/** + * Switching Toolhead + * + * Support for swappable and dockable toolheads, such as + * the E3D Tool Changer. Toolheads are locked with a servo. + */ +//#define SWITCHING_TOOLHEAD +#if ENABLED(SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_SERVO_NR 2 // Index of the servo connector + #define SWITCHING_TOOLHEAD_SERVO_ANGLES { 0, 180 } // (degrees) Angles for Lock, Unlock + #define SWITCHING_TOOLHEAD_Y_POS 235 // (mm) Y position of the toolhead dock + #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis + #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders +#endif + +/** + * "Mixing Extruder" + * - Adds G-codes M163 and M164 to set and "commit" the current mix factors. + * - Extends the stepping routines to move multiple steppers in proportion to the mix. + * - Optional support for Repetier Firmware's 'M164 S' supporting virtual tools. + * - This implementation supports up to two mixing extruders. + * - Enable DIRECT_MIXING_IN_G1 for M165 and mixing in G1 (from Pia Taubert's reference implementation). + */ +//#define MIXING_EXTRUDER +#if ENABLED(MIXING_EXTRUDER) + #define MIXING_STEPPERS 2 // Number of steppers in your mixing extruder + #define MIXING_VIRTUAL_TOOLS 16 // Use the Virtual Tool method with M163 and M164 + //#define DIRECT_MIXING_IN_G1 // Allow ABCDHI mix factors in G1 movement commands +#endif + +// Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing). +// The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder). +// For the other hotends it is their distance from the extruder 0 hotend. +//#define HOTEND_OFFSET_X {0.0, 20.00} // (mm) relative X-offset for each nozzle +//#define HOTEND_OFFSET_Y {0.0, 5.00} // (mm) relative Y-offset for each nozzle +//#define HOTEND_OFFSET_Z {0.0, 0.00} // (mm) relative Z-offset for each nozzle + +// @section machine + +/** + * Select your power supply here. Use 0 if you haven't connected the PS_ON_PIN + * + * 0 = No Power Switch + * 1 = ATX + * 2 = X-Box 360 203Watts (the blue wire connected to PS_ON and the red wire to VCC) + * + * :{ 0:'No power switch', 1:'ATX', 2:'X-Box 360' } + */ +#define POWER_SUPPLY 0 + +#if POWER_SUPPLY > 0 + // Enable this option to leave the PSU off at startup. + // Power to steppers and heaters will need to be turned on with M80. + //#define PS_DEFAULT_OFF + + //#define AUTO_POWER_CONTROL // Enable automatic control of the PS_ON pin + #if ENABLED(AUTO_POWER_CONTROL) + #define AUTO_POWER_FANS // Turn on PSU if fans need power + #define AUTO_POWER_E_FANS + #define AUTO_POWER_CONTROLLERFAN + #define POWER_TIMEOUT 30 + #endif + +#endif + +// @section temperature + +//=========================================================================== +//============================= Thermal Settings ============================ +//=========================================================================== + +/** + * --NORMAL IS 4.7kohm PULLUP!-- 1kohm pullup can be used on hotend sensor, using correct resistor and table + * + * Temperature sensors available: + * + * -4 : thermocouple with AD8495 + * -3 : thermocouple with MAX31855 (only for sensor 0) + * -2 : thermocouple with MAX6675 (only for sensor 0) + * -1 : thermocouple with AD595 + * 0 : not used + * 1 : 100k thermistor - best choice for EPCOS 100k (4.7k pullup) + * 2 : 200k thermistor - ATC Semitec 204GT-2 (4.7k pullup) + * 3 : Mendel-parts thermistor (4.7k pullup) + * 4 : 10k thermistor !! do not use it for a hotend. It gives bad resolution at high temp. !! + * 5 : 100K thermistor - ATC Semitec 104GT-2/104NT-4-R025H42G (Used in ParCan & J-Head) (4.7k pullup) + * 501 : 100K Zonestar (Tronxy X3A) Thermistor + * 6 : 100k EPCOS - Not as accurate as table 1 (created using a fluke thermocouple) (4.7k pullup) + * 7 : 100k Honeywell thermistor 135-104LAG-J01 (4.7k pullup) + * 71 : 100k Honeywell thermistor 135-104LAF-J01 (4.7k pullup) + * 8 : 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) + * 9 : 100k GE Sensing AL03006-58.2K-97-G1 (4.7k pullup) + * 10 : 100k RS thermistor 198-961 (4.7k pullup) + * 11 : 100k beta 3950 1% thermistor (4.7k pullup) + * 12 : 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed) + * 13 : 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE" + * 15 : 100k thermistor calibration for JGAurora A5 hotend + * 20 : the PT100 circuit found in the Ultimainboard V2.x + * 60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950 + * 66 : 4.7M High Temperature thermistor from Dyze Design + * 70 : the 100K thermistor found in the bq Hephestos 2 + * 75 : 100k Generic Silicon Heat Pad with NTC 100K MGB18-104F39050L32 thermistor + * + * 1k ohm pullup tables - This is atypical, and requires changing out the 4.7k pullup for 1k. + * (but gives greater accuracy and more stable PID) + * 51 : 100k thermistor - EPCOS (1k pullup) + * 52 : 200k thermistor - ATC Semitec 204GT-2 (1k pullup) + * 55 : 100k thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (1k pullup) + * + * 1047 : Pt1000 with 4k7 pullup + * 1010 : Pt1000 with 1k pullup (non standard) + * 147 : Pt100 with 4k7 pullup + * 110 : Pt100 with 1k pullup (non standard) + * + * Use these for Testing or Development purposes. NEVER for production machine. + * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. + * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. + * + * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + */ +#define TEMP_SENSOR_0 1 +#define TEMP_SENSOR_1 0 +#define TEMP_SENSOR_2 0 +#define TEMP_SENSOR_3 0 +#define TEMP_SENSOR_4 0 +#define TEMP_SENSOR_5 0 +#define TEMP_SENSOR_BED 1 +#define TEMP_SENSOR_CHAMBER 0 + +// Dummy thermistor constant temperature readings, for use with 998 and 999 +#define DUMMY_THERMISTOR_998_VALUE 25 +#define DUMMY_THERMISTOR_999_VALUE 100 + +// Use temp sensor 1 as a redundant sensor with sensor 0. If the readings +// from the two sensors differ too much the print will be aborted. +//#define TEMP_SENSOR_1_AS_REDUNDANT +#define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 + +// Extruder temperature must be close to target for this long before M109 returns success +#define TEMP_RESIDENCY_TIME 10 // (seconds) +#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one +#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. + +// Bed temperature must be close to target for this long before M190 returns success +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) +#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one +#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. + +// The minimal temperature defines the temperature below which the heater will not be enabled It is used +// to check that the wiring to the thermistor is not broken. +// Otherwise this would lead to the heater being powered on all the time. +#define HEATER_0_MINTEMP 5 +#define HEATER_1_MINTEMP 5 +#define HEATER_2_MINTEMP 5 +#define HEATER_3_MINTEMP 5 +#define HEATER_4_MINTEMP 5 +#define HEATER_5_MINTEMP 5 +#define BED_MINTEMP 5 + +// When temperature exceeds max temp, your heater will be switched off. +// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! +// You should use MINTEMP for thermistor short/failure protection. +#define HEATER_0_MAXTEMP 275 +#define HEATER_1_MAXTEMP 275 +#define HEATER_2_MAXTEMP 275 +#define HEATER_3_MAXTEMP 275 +#define HEATER_4_MAXTEMP 275 +#define HEATER_5_MAXTEMP 275 +#define BED_MAXTEMP 150 + +//=========================================================================== +//============================= PID Settings ================================ +//=========================================================================== +// PID Tuning Guide here: http://reprap.org/wiki/PID_Tuning + +// Comment the following line to disable PID and enable bang-bang. +#define PIDTEMP +#define BANG_MAX 255 // Limits current to nozzle while in bang-bang mode; 255=full current +#define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current +#define PID_K1 0.95 // Smoothing factor within any PID loop +#if ENABLED(PIDTEMP) + //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. + //#define PID_DEBUG // Sends debug data to the serial port. + //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX + //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders) + // Set/get with gcode: M301 E[extruder number, 0-2] + #define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature + // is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max. + + // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it + + // MeCreator2 +#define DEFAULT_Kp 11.93 +#define DEFAULT_Ki 0.59 +#define DEFAULT_Kd 59.89 + // Ultimaker +// #define DEFAULT_Kp 22.2 +// #define DEFAULT_Ki 1.08 +// #define DEFAULT_Kd 114 + + // MakerGear + //#define DEFAULT_Kp 7.0 + //#define DEFAULT_Ki 0.1 + //#define DEFAULT_Kd 12 + + // Mendel Parts V9 on 12V + //#define DEFAULT_Kp 63.0 + //#define DEFAULT_Ki 2.25 + //#define DEFAULT_Kd 440 + +#endif // PIDTEMP + +//=========================================================================== +//============================= PID > Bed Temperature Control =============== +//=========================================================================== + +/** + * PID Bed Heating + * + * If this option is enabled set PID constants below. + * If this option is disabled, bang-bang will be used and BED_LIMIT_SWITCHING will enable hysteresis. + * + * The PID frequency will be the same as the extruder PWM. + * If PID_dT is the default, and correct for the hardware/configuration, that means 7.689Hz, + * which is fine for driving a square wave into a resistive load and does not significantly + * impact FET heating. This also works fine on a Fotek SSR-10DA Solid State Relay into a 250W + * heater. If your configuration is significantly different than this and you don't understand + * the issues involved, don't use bed PID until someone else verifies that your hardware works. + */ +//#define PIDTEMPBED + +//#define BED_LIMIT_SWITCHING + +/** + * Max Bed Power + * Applies to all forms of bed control (PID, bang-bang, and bang-bang with hysteresis). + * When set to any value below 255, enables a form of PWM to the bed that acts like a divider + * so don't use it unless you are OK with PWM on your bed. (See the comment on enabling PIDTEMPBED) + */ +#define MAX_BED_POWER 255 // limits duty cycle to bed; 255=full current + +#if ENABLED(PIDTEMPBED) + + //#define PID_BED_DEBUG // Sends debug data to the serial port. +//MeCreator2 generated by Autotune + #define DEFAULT_bedKp 182.46 // 175.68 189.95 + #define DEFAULT_bedKi 35.92 // 34.59 37.40 + #define DEFAULT_bedKd 231.70 // 223.07 241.19 + //120V 250W silicone heater into 4mm borosilicate (MendelMax 1.5+) + //from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10) +//#define DEFAULT_bedKp 10.00 +//#define DEFAULT_bedKi .023 +//#define DEFAULT_bedKd 305.4 + + //120V 250W silicone heater into 4mm borosilicate (MendelMax 1.5+) + //from pidautotune + //#define DEFAULT_bedKp 97.1 + //#define DEFAULT_bedKi 1.41 + //#define DEFAULT_bedKd 1675.16 + + // FIND YOUR OWN: "M303 E-1 C8 S90" to run autotune on the bed at 90 degreesC for 8 cycles. +#endif // PIDTEMPBED + +// @section extruder + +/** + * Prevent extrusion if the temperature is below EXTRUDE_MINTEMP. + * Add M302 to set the minimum extrusion temperature and/or turn + * cold extrusion prevention on and off. + * + * *** IT IS HIGHLY RECOMMENDED TO LEAVE THIS OPTION ENABLED! *** + */ +#define PREVENT_COLD_EXTRUSION +#define EXTRUDE_MINTEMP 170 + +/** + * Prevent a single extrusion longer than EXTRUDE_MAXLENGTH. + * Note: For Bowden Extruders make this large enough to allow load/unload. + */ +#define PREVENT_LENGTHY_EXTRUDE +#define EXTRUDE_MAXLENGTH 500 + +//=========================================================================== +//======================== Thermal Runaway Protection ======================= +//=========================================================================== + +/** + * Thermal Protection provides additional protection to your printer from damage + * and fire. Marlin always includes safe min and max temperature ranges which + * protect against a broken or disconnected thermistor wire. + * + * The issue: If a thermistor falls out, it will report the much lower + * temperature of the air in the room, and the the firmware will keep + * the heater on. + * + * If you get "Thermal Runaway" or "Heating failed" errors the + * details can be tuned in Configuration_adv.h + */ + +#define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders +#define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed + +//=========================================================================== +//============================= Mechanical Settings ========================= +//=========================================================================== + +// @section machine + +// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics +// either in the usual order or reversed +//#define COREXY +//#define COREXZ +//#define COREYZ +//#define COREYX +//#define COREZX +//#define COREZY + +//=========================================================================== +//============================== Endstop Settings =========================== +//=========================================================================== + +// @section homing + +// Specify here all the endstop connectors that are connected to any endstop or probe. +// Almost all printers will be using one per axis. Probes will use one or more of the +// extra connectors. Leave undefined any used for non-endstop and non-probe purposes. +//#define USE_XMIN_PLUG +//#define USE_YMIN_PLUG +#define USE_ZMIN_PLUG +#define USE_XMAX_PLUG +#define USE_YMAX_PLUG +//#define USE_ZMAX_PLUG + +// Enable pullup for all endstops to prevent a floating state +#define ENDSTOPPULLUPS +#if DISABLED(ENDSTOPPULLUPS) + // Disable ENDSTOPPULLUPS to set pullups individually + //#define ENDSTOPPULLUP_XMAX + //#define ENDSTOPPULLUP_YMAX + //#define ENDSTOPPULLUP_ZMAX + //#define ENDSTOPPULLUP_XMIN + //#define ENDSTOPPULLUP_YMIN + //#define ENDSTOPPULLUP_ZMIN + //#define ENDSTOPPULLUP_ZMIN_PROBE +#endif + +// Enable pulldown for all endstops to prevent a floating state +//#define ENDSTOPPULLDOWNS +#if DISABLED(ENDSTOPPULLDOWNS) + // Disable ENDSTOPPULLDOWNS to set pulldowns individually + //#define ENDSTOPPULLDOWN_XMAX + //#define ENDSTOPPULLDOWN_YMAX + //#define ENDSTOPPULLDOWN_ZMAX + //#define ENDSTOPPULLDOWN_XMIN + //#define ENDSTOPPULLDOWN_YMIN + //#define ENDSTOPPULLDOWN_ZMIN + //#define ENDSTOPPULLDOWN_ZMIN_PROBE +#endif + +// Mechanical endstop with COM to ground and NC to Signal uses "false" here (most common setup). +#define X_MIN_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. +#define Y_MIN_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. +#define Z_MIN_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. +#define X_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. +#define Y_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. +#define Z_MAX_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. +#define Z_MIN_PROBE_ENDSTOP_INVERTING true // set to true to invert the logic of the probe. + +/** + * Stepper Drivers + * + * These settings allow Marlin to tune stepper driver timing and enable advanced options for + * stepper drivers that support them. You may also override timing options in Configuration_adv.h. + * + * A4988 is assumed for unspecified drivers. + * + * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, + * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, + * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, + * TMC5130, TMC5130_STANDALONE + * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + */ +//#define X_DRIVER_TYPE A4988 +//#define Y_DRIVER_TYPE A4988 +//#define Z_DRIVER_TYPE A4988 +//#define X2_DRIVER_TYPE A4988 +//#define Y2_DRIVER_TYPE A4988 +//#define Z2_DRIVER_TYPE A4988 +//#define Z3_DRIVER_TYPE A4988 +//#define E0_DRIVER_TYPE A4988 +//#define E1_DRIVER_TYPE A4988 +//#define E2_DRIVER_TYPE A4988 +//#define E3_DRIVER_TYPE A4988 +//#define E4_DRIVER_TYPE A4988 +//#define E5_DRIVER_TYPE A4988 + +// Enable this feature if all enabled endstop pins are interrupt-capable. +// This will remove the need to poll the interrupt pins, saving many CPU cycles. +//#define ENDSTOP_INTERRUPTS_FEATURE + +/** + * Endstop Noise Threshold + * + * Enable if your probe or endstops falsely trigger due to noise. + * + * - Higher values may affect repeatability or accuracy of some bed probes. + * - To fix noise install a 100nF ceramic capacitor inline with the switch. + * - This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, which already have the 100nF capacitor. + * + * :[2,3,4,5,6,7] + */ +//#define ENDSTOP_NOISE_THRESHOLD 2 + +//============================================================================= +//============================== Movement Settings ============================ +//============================================================================= +// @section motion + +/** + * Default Settings + * + * These settings can be reset by M502 + * + * Note that if EEPROM is enabled, saved values will override these. + */ + +/** + * With this option each E stepper can have its own factors for the + * following movement settings. If fewer factors are given than the + * total number of extruders, the last value applies to the rest. + */ +//#define DISTINCT_E_FACTORS + +/** + * Default Axis Steps Per Unit (steps/mm) + * Override with M92 + * X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]] + */ +#define DEFAULT_AXIS_STEPS_PER_UNIT { 80, 80, 400, 95 } + +/** + * Default Max Feed Rate (mm/s) + * Override with M203 + * X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]] + */ +#define DEFAULT_MAX_FEEDRATE { 250, 250, 400, 45 } + +/** + * Default Max Acceleration (change/s) change = mm/s + * (Maximum start speed for accelerated moves) + * Override with M201 + * X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]] + */ +#define DEFAULT_MAX_ACCELERATION { 2000, 2000, 100, 10000 } + +/** + * Default Acceleration (change/s) change = mm/s + * Override with M204 + * + * M204 P Acceleration + * M204 R Retract Acceleration + * M204 T Travel Acceleration + */ +#define DEFAULT_ACCELERATION 2000 // X, Y, Z and E acceleration for printing moves +#define DEFAULT_RETRACT_ACCELERATION 2000 // E acceleration for retracts +#define DEFAULT_TRAVEL_ACCELERATION 2000 // X, Y, Z acceleration for travel (non printing) moves + +/** + * Default Jerk (mm/s) + * Override with M205 X Y Z E + * + * "Jerk" specifies the minimum speed change that requires acceleration. + * When changing speed and direction, if the difference is less than the + * value set here, it may happen instantaneously. + */ +#define DEFAULT_XJERK 0 +#define DEFAULT_YJERK 0 +#define DEFAULT_ZJERK 0.6 +#define DEFAULT_EJERK 50.0 + +/** + * S-Curve Acceleration + * + * This option eliminates vibration during printing by fitting a Bézier + * curve to move acceleration, producing much smoother direction changes. + * + * See https://github.com/synthetos/TinyG/wiki/Jerk-Controlled-Motion-Explained + */ +//#define S_CURVE_ACCELERATION + +//=========================================================================== +//============================= Z Probe Options ============================= +//=========================================================================== +// @section probes + +// +// See http://marlinfw.org/docs/configuration/probes.html +// + +/** + * Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN + * + * Enable this option for a probe connected to the Z Min endstop pin. + */ +#define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN + +/** + * Z_MIN_PROBE_ENDSTOP + * + * Enable this option for a probe connected to any pin except Z-Min. + * (By default Marlin assumes the Z-Max endstop pin.) + * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * + * - The simplest option is to use a free endstop connector. + * - Use 5V for powered (usually inductive) sensors. + * + * - RAMPS 1.3/1.4 boards may use the 5V, GND, and Aux4->D32 pin: + * - For simple switches connect... + * - normally-closed switches to GND and D32. + * - normally-open switches to 5V and D32. + * + * WARNING: Setting the wrong pin may have unexpected and potentially + * disastrous consequences. Use with caution and do your homework. + * + */ +//#define Z_MIN_PROBE_ENDSTOP + +/** + * Probe Type + * + * Allen Key Probes, Servo Probes, Z-Sled Probes, FIX_MOUNTED_PROBE, etc. + * Activate one of these to use Auto Bed Leveling below. + */ + +/** + * The "Manual Probe" provides a means to do "Auto" Bed Leveling without a probe. + * Use G29 repeatedly, adjusting the Z height at each point with movement commands + * or (with LCD_BED_LEVELING) the LCD controller. + */ +//#define PROBE_MANUALLY +//#define MANUAL_PROBE_START_Z 0.2 + +/** + * A Fix-Mounted Probe either doesn't deploy or needs manual deployment. + * (e.g., an inductive probe or a nozzle-based probe-switch.) + */ +//#define FIX_MOUNTED_PROBE + +/** + * Z Servo Probe, such as an endstop switch on a rotating arm. + */ +//#define Z_PROBE_SERVO_NR 0 // Defaults to SERVO 0 connector. +//#define Z_SERVO_ANGLES {70,0} // Z Servo Deploy and Stow angles + +/** + * The BLTouch probe uses a Hall effect sensor and emulates a servo. + */ +//#define BLTOUCH +#if ENABLED(BLTOUCH) + //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed +#endif + +// A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) +//#define SOLENOID_PROBE + +// A sled-mounted probe like those designed by Charles Bell. +//#define Z_PROBE_SLED +//#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. + +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + +// +// For Z_PROBE_ALLEN_KEY see the Delta example configurations. +// + +/** + * Z Probe to nozzle (X,Y) offset, relative to (0, 0). + * X and Y offsets must be integers. + * + * In the following example the X and Y offsets are both positive: + * #define X_PROBE_OFFSET_FROM_EXTRUDER 10 + * #define Y_PROBE_OFFSET_FROM_EXTRUDER 10 + * + * +-- BACK ---+ + * | | + * L | (+) P | R <-- probe (20,20) + * E | | I + * F | (-) N (+) | G <-- nozzle (10,10) + * T | | H + * | (-) | T + * | | + * O-- FRONT --+ + * (0,0) + */ +#define X_PROBE_OFFSET_FROM_EXTRUDER 10 // X offset: -left +right [of the nozzle] +#define Y_PROBE_OFFSET_FROM_EXTRUDER 10 // Y offset: -front +behind [the nozzle] +#define Z_PROBE_OFFSET_FROM_EXTRUDER 0 // Z offset: -below +above [the nozzle] + +// Certain types of probes need to stay away from edges +#define MIN_PROBE_EDGE 10 + +// X and Y axis travel speed (mm/m) between probes +#define XY_PROBE_SPEED 8000 + +// Feedrate (mm/m) for the first approach when double-probing (MULTIPLE_PROBING == 2) +#define Z_PROBE_SPEED_FAST HOMING_FEEDRATE_Z + +// Feedrate (mm/m) for the "accurate" probe of each point +#define Z_PROBE_SPEED_SLOW (Z_PROBE_SPEED_FAST / 2) + +// The number of probes to perform at each point. +// Set to 2 for a fast/slow probe, using the second probe result. +// Set to 3 or more for slow probes, averaging the results. +//#define MULTIPLE_PROBING 2 + +/** + * Z probes require clearance when deploying, stowing, and moving between + * probe points to avoid hitting the bed and other hardware. + * Servo-mounted probes require extra space for the arm to rotate. + * Inductive probes need space to keep from triggering early. + * + * Use these settings to specify the distance (mm) to raise the probe (or + * lower the bed). The values set here apply over and above any (negative) + * probe Z Offset set with Z_PROBE_OFFSET_FROM_EXTRUDER, M851, or the LCD. + * Only integer values >= 1 are valid here. + * + * Example: `M851 Z-5` with a CLEARANCE of 4 => 9mm from bed to nozzle. + * But: `M851 Z+1` with a CLEARANCE of 2 => 2mm from bed to nozzle. + */ +#define Z_CLEARANCE_DEPLOY_PROBE 10 // Z Clearance for Deploy/Stow +#define Z_CLEARANCE_BETWEEN_PROBES 5 // Z Clearance between probe points +#define Z_CLEARANCE_MULTI_PROBE 5 // Z Clearance between multiple probes +//#define Z_AFTER_PROBING 5 // Z position after probing is done + +#define Z_PROBE_LOW_POINT -2 // Farthest distance below the trigger-point to go before stopping + +// For M851 give a range for adjusting the Z probe offset +#define Z_PROBE_OFFSET_RANGE_MIN -20 +#define Z_PROBE_OFFSET_RANGE_MAX 20 + +// Enable the M48 repeatability test to test probe accuracy +//#define Z_MIN_PROBE_REPEATABILITY_TEST + +// Before deploy/stow pause for user confirmation +//#define PAUSE_BEFORE_DEPLOY_STOW + +/** + * Enable one or more of the following if probing seems unreliable. + * Heaters and/or fans can be disabled during probing to minimize electrical + * noise. A delay can also be added to allow noise and vibration to settle. + * These options are most useful for the BLTouch probe, but may also improve + * readings with inductive probes and piezo sensors. + */ +//#define PROBING_HEATERS_OFF // Turn heaters off when probing +#if ENABLED(PROBING_HEATERS_OFF) + //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) +#endif +//#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing +//#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors + +// For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 +// :{ 0:'Low', 1:'High' } +#define X_ENABLE_ON 0 +#define Y_ENABLE_ON 0 +#define Z_ENABLE_ON 0 +#define E_ENABLE_ON 0 // For all extruders + +// Disables axis stepper immediately when it's not being used. +// WARNING: When motors turn off there is a chance of losing position accuracy! +#define DISABLE_X false +#define DISABLE_Y false +#define DISABLE_Z false + +// Warn on display about possibly reduced accuracy +//#define DISABLE_REDUCED_ACCURACY_WARNING + +// @section extruder + +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled + +// @section machine + +// Invert the stepper direction. Change (or reverse the motor connector) if an axis goes the wrong way. +#define INVERT_X_DIR true +#define INVERT_Y_DIR true +#define INVERT_Z_DIR true + +// @section extruder + +// For direct drive extruder v9 set to true, for geared extruder set to false. +#define INVERT_E0_DIR true +#define INVERT_E1_DIR false +#define INVERT_E2_DIR false +#define INVERT_E3_DIR false +#define INVERT_E4_DIR false +#define INVERT_E5_DIR false + +// @section homing + +//#define NO_MOTION_BEFORE_HOMING // Inhibit movement until all axes have been homed + +//#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. + +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... + // Be sure you have this distance over your Z_MAX_POS in case. + +// Direction of endstops when homing; 1=MAX, -1=MIN +// :[-1,1] +#define X_HOME_DIR 1 +#define Y_HOME_DIR 1 +#define Z_HOME_DIR -1 + +// @section machine + +// The size of the print bed +#define X_BED_SIZE 160 +#define Y_BED_SIZE 160 + +// Travel limits (mm) after homing, corresponding to endstop positions. +#define X_MIN_POS -15 +#define Y_MIN_POS -5 +#define Z_MIN_POS 0 +#define X_MAX_POS X_BED_SIZE +#define Y_MAX_POS Y_BED_SIZE +#define Z_MAX_POS 162 + +/** + * Software Endstops + * + * - Prevent moves outside the set machine bounds. + * - Individual axes can be disabled, if desired. + * - X and Y only apply to Cartesian robots. + * - Use 'M211' to set software endstops on/off or report current state + */ + +// Min software endstops constrain movement within minimum coordinate bounds +#define MIN_SOFTWARE_ENDSTOPS +#if ENABLED(MIN_SOFTWARE_ENDSTOPS) + #define MIN_SOFTWARE_ENDSTOP_X + #define MIN_SOFTWARE_ENDSTOP_Y + #define MIN_SOFTWARE_ENDSTOP_Z +#endif + +// Max software endstops constrain movement within maximum coordinate bounds +#define MAX_SOFTWARE_ENDSTOPS +#if ENABLED(MAX_SOFTWARE_ENDSTOPS) + #define MAX_SOFTWARE_ENDSTOP_X + #define MAX_SOFTWARE_ENDSTOP_Y + #define MAX_SOFTWARE_ENDSTOP_Z +#endif + +#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) + //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD +#endif + +/** + * Filament Runout Sensors + * Mechanical or opto endstops are used to check for the presence of filament. + * + * RAMPS-based boards use SERVO3_PIN for the first runout sensor. + * For other boards you may need to define FIL_RUNOUT_PIN, FIL_RUNOUT2_PIN, etc. + * By default the firmware assumes HIGH=FILAMENT PRESENT. + */ +//#define FILAMENT_RUNOUT_SENSOR +#if ENABLED(FILAMENT_RUNOUT_SENSOR) + #define NUM_RUNOUT_SENSORS 1 // Number of sensors, up to one per extruder. Define a FIL_RUNOUT#_PIN for each. + #define FIL_RUNOUT_INVERTING false // set to true to invert the logic of the sensor. + #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. + //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. + #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif +#endif + +//=========================================================================== +//=============================== Bed Leveling ============================== +//=========================================================================== +// @section calibrate + +/** + * Choose one of the options below to enable G29 Bed Leveling. The parameters + * and behavior of G29 will change depending on your selection. + * + * If using a Probe for Z Homing, enable Z_SAFE_HOMING also! + * + * - AUTO_BED_LEVELING_3POINT + * Probe 3 arbitrary points on the bed (that aren't collinear) + * You specify the XY coordinates of all 3 points. + * The result is a single tilted plane. Best for a flat bed. + * + * - AUTO_BED_LEVELING_LINEAR + * Probe several points in a grid. + * You specify the rectangle and the density of sample points. + * The result is a single tilted plane. Best for a flat bed. + * + * - AUTO_BED_LEVELING_BILINEAR + * Probe several points in a grid. + * You specify the rectangle and the density of sample points. + * The result is a mesh, best for large or uneven beds. + * + * - AUTO_BED_LEVELING_UBL (Unified Bed Leveling) + * A comprehensive bed leveling system combining the features and benefits + * of other systems. UBL also includes integrated Mesh Generation, Mesh + * Validation and Mesh Editing systems. + * + * - MESH_BED_LEVELING + * Probe a grid manually + * The result is a mesh, suitable for large or uneven beds. (See BILINEAR.) + * For machines without a probe, Mesh Bed Leveling provides a method to perform + * leveling in steps so you can manually adjust the Z height at each grid-point. + * With an LCD controller the process is guided step-by-step. + */ +//#define AUTO_BED_LEVELING_3POINT +//#define AUTO_BED_LEVELING_LINEAR +//#define AUTO_BED_LEVELING_BILINEAR +//#define AUTO_BED_LEVELING_UBL +//#define MESH_BED_LEVELING + +/** + * Normally G28 leaves leveling disabled on completion. Enable + * this option to have G28 restore the prior leveling state. + */ +//#define RESTORE_LEVELING_AFTER_G28 + +/** + * Enable detailed logging of G28, G29, M48, etc. + * Turn on with the command 'M111 S32'. + * NOTE: Requires a lot of PROGMEM! + */ +//#define DEBUG_LEVELING_FEATURE + +#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) + // Gradually reduce leveling correction until a set height is reached, + // at which point movement will be level to the machine's XY plane. + // The height can be set with M420 Z + #define ENABLE_LEVELING_FADE_HEIGHT + + // For Cartesian machines, instead of dividing moves on mesh boundaries, + // split up moves into short segments like a Delta. This follows the + // contours of the bed more closely than edge-to-edge straight moves. + #define SEGMENT_LEVELED_MOVES + #define LEVELED_SEGMENT_LENGTH 5.0 // (mm) Length of all segments (except the last one) + + /** + * Enable the G26 Mesh Validation Pattern tool. + */ + //#define G26_MESH_VALIDATION + #if ENABLED(G26_MESH_VALIDATION) + #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. + #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. + #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #endif + +#endif + +#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) + + // Set the number of grid points per dimension. + #define GRID_MAX_POINTS_X 3 + #define GRID_MAX_POINTS_Y GRID_MAX_POINTS_X + + // Set the boundaries for probing (where the probe can reach). + //#define LEFT_PROBE_BED_POSITION MIN_PROBE_EDGE + //#define RIGHT_PROBE_BED_POSITION (X_BED_SIZE - (MIN_PROBE_EDGE)) + //#define FRONT_PROBE_BED_POSITION MIN_PROBE_EDGE + //#define BACK_PROBE_BED_POSITION (Y_BED_SIZE - (MIN_PROBE_EDGE)) + + // Probe along the Y axis, advancing X after each column + //#define PROBE_Y_FIRST + + #if ENABLED(AUTO_BED_LEVELING_BILINEAR) + + // Beyond the probed grid, continue the implied tilt? + // Default is to maintain the height of the nearest edge. + //#define EXTRAPOLATE_BEYOND_GRID + + // + // Experimental Subdivision of the grid by Catmull-Rom method. + // Synthesizes intermediate points to produce a more detailed mesh. + // + //#define ABL_BILINEAR_SUBDIVISION + #if ENABLED(ABL_BILINEAR_SUBDIVISION) + // Number of subdivisions between probe points + #define BILINEAR_SUBDIVISIONS 3 + #endif + + #endif + +#elif ENABLED(AUTO_BED_LEVELING_UBL) + + //=========================================================================== + //========================= Unified Bed Leveling ============================ + //=========================================================================== + + //#define MESH_EDIT_GFX_OVERLAY // Display a graphics overlay while editing the mesh + + #define MESH_INSET 1 // Set Mesh bounds as an inset region of the bed + #define GRID_MAX_POINTS_X 10 // Don't use more than 15 points per axis, implementation limited. + #define GRID_MAX_POINTS_Y GRID_MAX_POINTS_X + + #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle + #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + +#elif ENABLED(MESH_BED_LEVELING) + + //=========================================================================== + //=================================== Mesh ================================== + //=========================================================================== + + #define MESH_INSET 10 // Set Mesh bounds as an inset region of the bed + #define GRID_MAX_POINTS_X 3 // Don't use more than 7 points per axis, implementation limited. + #define GRID_MAX_POINTS_Y GRID_MAX_POINTS_X + + //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS + +#endif // BED_LEVELING + +/** + * Points to probe for all 3-point Leveling procedures. + * Override if the automatically selected points are inadequate. + */ +#if ENABLED(AUTO_BED_LEVELING_3POINT) || ENABLED(AUTO_BED_LEVELING_UBL) + //#define PROBE_PT_1_X 15 + //#define PROBE_PT_1_Y 180 + //#define PROBE_PT_2_X 15 + //#define PROBE_PT_2_Y 20 + //#define PROBE_PT_3_X 170 + //#define PROBE_PT_3_Y 20 +#endif + +/** + * Add a bed leveling sub-menu for ABL or MBL. + * Include a guided procedure if manual probing is enabled. + */ +//#define LCD_BED_LEVELING + +#if ENABLED(LCD_BED_LEVELING) + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points +#endif + +// Add a menu item to move between bed corners for manual bed adjustment +#define LEVEL_BED_CORNERS + +#if ENABLED(LEVEL_BED_CORNERS) + #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling + //#define LEVEL_CENTER_TOO // Move to the center after the last corner +#endif + +/** + * Commands to execute at the end of G29 probing. + * Useful to retract or move the Z probe out of the way. + */ +//#define Z_PROBE_END_SCRIPT "G1 Z10 F12000\nG1 X15 Y330\nG1 Z0.5\nG1 Z10" + + +// @section homing + +// The center of the bed is at (X=0, Y=0) +//#define BED_CENTER_AT_0_0 + +// Manually set the home position. Leave these undefined for automatic settings. +// 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 + +// Use "Z Safe Homing" to avoid homing with a Z probe outside the bed area. +// +// With this feature enabled: +// +// - Allow Z homing only after X and Y homing AND stepper drivers still enabled. +// - If stepper drivers time out, it will need X and Y homing again before Z homing. +// - Move the Z probe (or nozzle) to a defined XY point before Z Homing when homing all axes (G28). +// - Prevent Z homing when the Z probe is outside bed area. +// +//#define Z_SAFE_HOMING + +#if ENABLED(Z_SAFE_HOMING) + #define Z_SAFE_HOMING_X_POINT ((X_BED_SIZE) / 2) // X point for Z homing when homing all axes (G28). + #define Z_SAFE_HOMING_Y_POINT ((Y_BED_SIZE) / 2) // Y point for Z homing when homing all axes (G28). +#endif + +// Homing speeds (mm/m) +#define HOMING_FEEDRATE_XY (40*60) +#define HOMING_FEEDRATE_Z (12*60) + +// Validate that endstops are triggered on homing moves +#define VALIDATE_HOMING_ENDSTOPS + +// @section calibrate + +/** + * Bed Skew Compensation + * + * This feature corrects for misalignment in the XYZ axes. + * + * Take the following steps to get the bed skew in the XY plane: + * 1. Print a test square (e.g., https://www.thingiverse.com/thing:2563185) + * 2. For XY_DIAG_AC measure the diagonal A to C + * 3. For XY_DIAG_BD measure the diagonal B to D + * 4. For XY_SIDE_AD measure the edge A to D + * + * Marlin automatically computes skew factors from these measurements. + * Skew factors may also be computed and set manually: + * + * - Compute AB : SQRT(2*AC*AC+2*BD*BD-4*AD*AD)/2 + * - XY_SKEW_FACTOR : TAN(PI/2-ACOS((AC*AC-AB*AB-AD*AD)/(2*AB*AD))) + * + * If desired, follow the same procedure for XZ and YZ. + * Use these diagrams for reference: + * + * Y Z Z + * ^ B-------C ^ B-------C ^ B-------C + * | / / | / / | / / + * | / / | / / | / / + * | A-------D | A-------D | A-------D + * +-------------->X +-------------->X +-------------->Y + * XY_SKEW_FACTOR XZ_SKEW_FACTOR YZ_SKEW_FACTOR + */ +//#define SKEW_CORRECTION + +#if ENABLED(SKEW_CORRECTION) + // Input all length measurements here: + #define XY_DIAG_AC 282.8427124746 + #define XY_DIAG_BD 282.8427124746 + #define XY_SIDE_AD 200 + + // Or, set the default skew factors directly here + // to override the above measurements: + #define XY_SKEW_FACTOR 0.0 + + //#define SKEW_CORRECTION_FOR_Z + #if ENABLED(SKEW_CORRECTION_FOR_Z) + #define XZ_DIAG_AC 282.8427124746 + #define XZ_DIAG_BD 282.8427124746 + #define YZ_DIAG_AC 282.8427124746 + #define YZ_DIAG_BD 282.8427124746 + #define YZ_SIDE_AD 200 + #define XZ_SKEW_FACTOR 0.0 + #define YZ_SKEW_FACTOR 0.0 + #endif + + // Enable this option for M852 to set skew at runtime + //#define SKEW_CORRECTION_GCODE +#endif + +//============================================================================= +//============================= Additional Features =========================== +//============================================================================= + +// @section extras + +// +// EEPROM +// +// The microcontroller can store settings in the EEPROM, e.g. max velocity... +// M500 - stores parameters in EEPROM +// M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily). +// M502 - reverts to the default "factory settings". You still need to store them in EEPROM afterwards if you want to. +// +#define EEPROM_SETTINGS // Enable for M500 and M501 commands +//#define DISABLE_M503 // Saves ~2700 bytes of PROGMEM. Disable for release! +#define EEPROM_CHITCHAT // Give feedback on EEPROM commands. Disable to save PROGMEM. + +// +// Host Keepalive +// +// When enabled Marlin will send a busy status message to the host +// every couple of seconds when it can't accept commands. +// +#define HOST_KEEPALIVE_FEATURE // Disable this if your host doesn't like keepalive messages +#define DEFAULT_KEEPALIVE_INTERVAL 2 // Number of seconds between "busy" messages. Set with M113. +#define BUSY_WHILE_HEATING // Some hosts require "busy" messages even during heating + +// +// M100 Free Memory Watcher +// +//#define M100_FREE_MEMORY_WATCHER // Add M100 (Free Memory Watcher) to debug memory usage + +// +// G20/G21 Inch mode support +// +//#define INCH_MODE_SUPPORT + +// +// M149 Set temperature units support +// +//#define TEMPERATURE_UNITS_SUPPORT + +// @section temperature + +// Preheat Constants +#define PREHEAT_1_LABEL "PLA" +#define PREHEAT_1_TEMP_HOTEND 190 +#define PREHEAT_1_TEMP_BED 60 +#define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 + +#define PREHEAT_2_LABEL "ABS" +#define PREHEAT_2_TEMP_HOTEND 240 +#define PREHEAT_2_TEMP_BED 100 +#define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 + +/** + * Nozzle Park + * + * Park the nozzle at the given XYZ position on idle or G27. + * + * The "P" parameter controls the action applied to the Z axis: + * + * P0 (Default) If Z is below park Z raise the nozzle. + * P1 Raise the nozzle always to Z-park height. + * P2 Raise the nozzle by Z-park amount, limited to Z_MAX_POS. + */ +//#define NOZZLE_PARK_FEATURE + +#if ENABLED(NOZZLE_PARK_FEATURE) + // Specify a park position as { X, Y, Z } + #define NOZZLE_PARK_POINT { (X_MIN_POS + 10), (Y_MAX_POS - 10), 20 } + #define NOZZLE_PARK_XY_FEEDRATE 100 // X and Y axes feedrate in mm/s (also used for delta printers Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // Z axis feedrate in mm/s (not used for delta printers) +#endif + +/** + * Clean Nozzle Feature -- EXPERIMENTAL + * + * Adds the G12 command to perform a nozzle cleaning process. + * + * Parameters: + * P Pattern + * S Strokes / Repetitions + * T Triangles (P1 only) + * + * Patterns: + * P0 Straight line (default). This process requires a sponge type material + * at a fixed bed location. "S" specifies strokes (i.e. back-forth motions) + * between the start / end points. + * + * P1 Zig-zag pattern between (X0, Y0) and (X1, Y1), "T" specifies the + * number of zig-zag triangles to do. "S" defines the number of strokes. + * Zig-zags are done in whichever is the narrower dimension. + * For example, "G12 P1 S1 T3" will execute: + * + * -- + * | (X0, Y1) | /\ /\ /\ | (X1, Y1) + * | | / \ / \ / \ | + * A | | / \ / \ / \ | + * | | / \ / \ / \ | + * | (X0, Y0) | / \/ \/ \ | (X1, Y0) + * -- +--------------------------------+ + * |________|_________|_________| + * T1 T2 T3 + * + * P2 Circular pattern with middle at NOZZLE_CLEAN_CIRCLE_MIDDLE. + * "R" specifies the radius. "S" specifies the stroke count. + * Before starting, the nozzle moves to NOZZLE_CLEAN_START_POINT. + * + * Caveats: The ending Z should be the same as starting Z. + * Attention: EXPERIMENTAL. G-code arguments may change. + * + */ +//#define NOZZLE_CLEAN_FEATURE + +#if ENABLED(NOZZLE_CLEAN_FEATURE) + // Default number of pattern repetitions + #define NOZZLE_CLEAN_STROKES 12 + + // Default number of triangles + #define NOZZLE_CLEAN_TRIANGLES 3 + + // Specify positions as { X, Y, Z } + #define NOZZLE_CLEAN_START_POINT { 30, 30, (Z_MIN_POS + 1)} + #define NOZZLE_CLEAN_END_POINT {100, 60, (Z_MIN_POS + 1)} + + // Circular pattern radius + #define NOZZLE_CLEAN_CIRCLE_RADIUS 6.5 + // Circular pattern circle fragments number + #define NOZZLE_CLEAN_CIRCLE_FN 10 + // Middle point of circle + #define NOZZLE_CLEAN_CIRCLE_MIDDLE NOZZLE_CLEAN_START_POINT + + // Moves the nozzle to the initial position + #define NOZZLE_CLEAN_GOBACK +#endif + +/** + * Print Job Timer + * + * Automatically start and stop the print job timer on M104/M109/M190. + * + * M104 (hotend, no wait) - high temp = none, low temp = stop timer + * M109 (hotend, wait) - high temp = start timer, low temp = stop timer + * M190 (bed, wait) - high temp = start timer, low temp = none + * + * The timer can also be controlled with the following commands: + * + * M75 - Start the print job timer + * M76 - Pause the print job timer + * M77 - Stop the print job timer + */ +#define PRINTJOB_TIMER_AUTOSTART + +/** + * Print Counter + * + * Track statistical data such as: + * + * - Total print jobs + * - Total successful print jobs + * - Total failed print jobs + * - Total time printing + * + * View the current statistics with M78. + */ +#define PRINTCOUNTER + +//============================================================================= +//============================= LCD and SD support ============================ +//============================================================================= + +// @section lcd + +/** + * LCD LANGUAGE + * + * Select the language to display on the LCD. These languages are available: + * + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + */ +#define LCD_LANGUAGE en + +/** + * LCD Character Set + * + * Note: This option is NOT applicable to Graphical Displays. + * + * All character-based LCDs provide ASCII plus one of these + * language extensions: + * + * - JAPANESE ... the most common + * - WESTERN ... with more accented characters + * - CYRILLIC ... for the Russian language + * + * To determine the language extension installed on your controller: + * + * - Compile and upload with LCD_LANGUAGE set to 'test' + * - Click the controller to view the LCD menu + * - The LCD will display Japanese, Western, or Cyrillic text + * + * See http://marlinfw.org/docs/development/lcd_language.html + * + * :['JAPANESE', 'WESTERN', 'CYRILLIC'] + */ +#define DISPLAY_CHARSET_HD44780 JAPANESE + +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + +/** + * SD CARD + * + * SD Card support is disabled by default. If your controller has an SD slot, + * you must uncomment the following option or it won't work. + * + */ +#define SDSUPPORT + +/** + * SD CARD: SPI SPEED + * + * Enable one of the following items for a slower SPI transfer speed. + * This may be required to resolve "volume init" errors. + */ +//#define SPI_SPEED SPI_HALF_SPEED +//#define SPI_SPEED SPI_QUARTER_SPEED +//#define SPI_SPEED SPI_EIGHTH_SPEED + +/** + * SD CARD: ENABLE CRC + * + * Use CRC checks and retries on the SD communication. + */ +//#define SD_CHECK_AND_RETRY + +/** + * LCD Menu Items + * + * Disable all menus and only display the Status Screen, or + * just remove some extraneous menu items to recover space. + */ +//#define NO_LCD_MENUS +//#define SLIM_LCD_MENUS + +// +// ENCODER SETTINGS +// +// This option overrides the default number of encoder pulses needed to +// produce one step. Should be increased for high-resolution encoders. +// +//#define ENCODER_PULSES_PER_STEP 4 + +// +// Use this option to override the number of step signals required to +// move between next/prev menu items. +// +//#define ENCODER_STEPS_PER_MENU_ITEM 1 + +/** + * Encoder Direction Options + * + * Test your encoder's behavior first with both options disabled. + * + * Reversed Value Edit and Menu Nav? Enable REVERSE_ENCODER_DIRECTION. + * Reversed Menu Navigation only? Enable REVERSE_MENU_DIRECTION. + * Reversed Value Editing only? Enable BOTH options. + */ + +// +// This option reverses the encoder direction everywhere. +// +// Set this option if CLOCKWISE causes values to DECREASE +// +//#define REVERSE_ENCODER_DIRECTION + +// +// This option reverses the encoder direction for navigating LCD menus. +// +// If CLOCKWISE normally moves DOWN this makes it go UP. +// If CLOCKWISE normally moves UP this makes it go DOWN. +// +//#define REVERSE_MENU_DIRECTION + +// +// Individual Axis Homing +// +// Add individual axis homing items (Home X, Home Y, and Home Z) to the LCD menu. +// +//#define INDIVIDUAL_AXIS_HOMING_MENU + +// +// SPEAKER/BUZZER +// +// If you have a speaker that can produce tones, enable it here. +// By default Marlin assumes you have a buzzer with a fixed frequency. +// +//#define SPEAKER + +// +// The duration and frequency for the UI feedback sound. +// Set these to 0 to disable audio feedback in the LCD menus. +// +// Note: Test audio output with the G-Code: +// M300 S P +// +//#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 2 +//#define LCD_FEEDBACK_FREQUENCY_HZ 5000 + +//============================================================================= +//======================== LCD / Controller Selection ========================= +//======================== (Character-based LCDs) ========================= +//============================================================================= + +// +// RepRapDiscount Smart Controller. +// http://reprap.org/wiki/RepRapDiscount_Smart_Controller +// +// Note: Usually sold with a white PCB. +// +#define REPRAP_DISCOUNT_SMART_CONTROLLER + +// +// Original RADDS LCD Display+Encoder+SDCardReader +// http://doku.radds.org/dokumentation/lcd-display/ +// +//#define RADDS_DISPLAY + +// +// ULTIMAKER Controller. +// +//#define ULTIMAKERCONTROLLER + +// +// ULTIPANEL as seen on Thingiverse. +// +//#define ULTIPANEL + +// +// PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3) +// http://reprap.org/wiki/PanelOne +// +//#define PANEL_ONE + +// +// GADGETS3D G3D LCD/SD Controller +// http://reprap.org/wiki/RAMPS_1.3/1.4_GADGETS3D_Shield_with_Panel +// +// Note: Usually sold with a blue PCB. +// +//#define G3D_PANEL + +// +// RigidBot Panel V1.0 +// http://www.inventapart.com/ +// +//#define RIGIDBOT_PANEL + +// +// Makeboard 3D Printer Parts 3D Printer Mini Display 1602 Mini Controller +// https://www.aliexpress.com/item/Micromake-Makeboard-3D-Printer-Parts-3D-Printer-Mini-Display-1602-Mini-Controller-Compatible-with-Ramps-1/32765887917.html +// +//#define MAKEBOARD_MINI_2_LINE_DISPLAY_1602 + +// +// ANET and Tronxy 20x4 Controller +// +//#define ZONESTAR_LCD // Requires ADC_KEYPAD_PIN to be assigned to an analog pin. + // This LCD is known to be susceptible to electrical interference + // which scrambles the display. Pressing any button clears it up. + // This is a LCD2004 display with 5 analog buttons. + +// +// Generic 16x2, 16x4, 20x2, or 20x4 character-based LCD. +// +//#define ULTRA_LCD + +//============================================================================= +//======================== LCD / Controller Selection ========================= +//===================== (I2C and Shift-Register LCDs) ===================== +//============================================================================= + +// +// CONTROLLER TYPE: I2C +// +// Note: These controllers require the installation of Arduino's LiquidCrystal_I2C +// library. For more info: https://github.com/kiyoshigawa/LiquidCrystal_I2C +// + +// +// Elefu RA Board Control Panel +// http://www.elefu.com/index.php?route=product/product&product_id=53 +// +//#define RA_CONTROL_PANEL + +// +// Sainsmart (YwRobot) LCD Displays +// +// These require F.Malpartida's LiquidCrystal_I2C library +// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home +// +//#define LCD_SAINSMART_I2C_1602 +//#define LCD_SAINSMART_I2C_2004 + +// +// Generic LCM1602 LCD adapter +// +//#define LCM1602 + +// +// PANELOLU2 LCD with status LEDs, +// separate encoder and click inputs. +// +// Note: This controller requires Arduino's LiquidTWI2 library v1.2.3 or later. +// For more info: https://github.com/lincomatic/LiquidTWI2 +// +// Note: The PANELOLU2 encoder click input can either be directly connected to +// a pin (if BTN_ENC defined to != -1) or read through I2C (when BTN_ENC == -1). +// +//#define LCD_I2C_PANELOLU2 + +// +// Panucatt VIKI LCD with status LEDs, +// integrated click & L/R/U/D buttons, separate encoder inputs. +// +//#define LCD_I2C_VIKI + +// +// CONTROLLER TYPE: Shift register panels +// + +// +// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// LCD configuration: http://reprap.org/wiki/SAV_3D_LCD +// +//#define SAV_3DLCD + +//============================================================================= +//======================= LCD / Controller Selection ======================= +//========================= (Graphical LCDs) ======================== +//============================================================================= + +// +// CONTROLLER TYPE: Graphical 128x64 (DOGM) +// +// IMPORTANT: The U8glib library is required for Graphical Display! +// https://github.com/olikraus/U8glib_Arduino +// + +// +// RepRapDiscount FULL GRAPHIC Smart Controller +// http://reprap.org/wiki/RepRapDiscount_Full_Graphic_Smart_Controller +// +//#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER + +// +// ReprapWorld Graphical LCD +// https://reprapworld.com/?products_details&products_id/1218 +// +//#define REPRAPWORLD_GRAPHICAL_LCD + +// +// Activate one of these if you have a Panucatt Devices +// Viki 2.0 or mini Viki with Graphic LCD +// http://panucatt.com +// +//#define VIKI2 +//#define miniVIKI + +// +// MakerLab Mini Panel with graphic +// controller and SD support - http://reprap.org/wiki/Mini_panel +// +//#define MINIPANEL + +// +// MaKr3d Makr-Panel with graphic controller and SD support. +// http://reprap.org/wiki/MaKr3d_MaKrPanel +// +//#define MAKRPANEL + +// +// Adafruit ST7565 Full Graphic Controller. +// https://github.com/eboston/Adafruit-ST7565-Full-Graphic-Controller/ +// +//#define ELB_FULL_GRAPHIC_CONTROLLER + +// +// BQ LCD Smart Controller shipped by +// default with the BQ Hephestos 2 and Witbox 2. +// +//#define BQ_LCD_SMART_CONTROLLER + +// +// Cartesio UI +// http://mauk.cc/webshop/cartesio-shop/electronics/user-interface +// +//#define CARTESIO_UI + +// +// LCD for Melzi Card with Graphical LCD +// +//#define LCD_FOR_MELZI + +// +// SSD1306 OLED full graphics generic display +// +//#define U8GLIB_SSD1306 + +// +// SAV OLEd LCD module support using either SSD1306 or SH1106 based LCD modules +// +//#define SAV_3DGLCD +#if ENABLED(SAV_3DGLCD) + //#define U8GLIB_SSD1306 + #define U8GLIB_SH1106 +#endif + +// +// Original Ulticontroller from Ultimaker 2 printer with SSD1309 I2C display and encoder +// https://github.com/Ultimaker/Ultimaker2/tree/master/1249_Ulticontroller_Board_(x1) +// +//#define ULTI_CONTROLLER + +// +// TinyBoy2 128x64 OLED / Encoder Panel +// +//#define OLED_PANEL_TINYBOY2 + +// +// MKS MINI12864 with graphic controller and SD support +// http://reprap.org/wiki/MKS_MINI_12864 +// +//#define MKS_MINI_12864 + +// +// Factory display for Creality CR-10 +// https://www.aliexpress.com/item/Universal-LCD-12864-3D-Printer-Display-Screen-With-Encoder-For-CR-10-CR-7-Model/32833148327.html +// +// This is RAMPS-compatible using a single 10-pin connector. +// (For CR-10 owners who want to replace the Melzi Creality board but retain the display) +// +//#define CR10_STOCKDISPLAY + +// +// ANET and Tronxy Graphical Controller +// +// Anet 128x64 full graphics lcd with rotary encoder as used on Anet A6 +// A clone of the RepRapDiscount full graphics display but with +// different pins/wiring (see pins_ANET_10.h). +// +//#define ANET_FULL_GRAPHICS_LCD + +// +// MKS OLED 1.3" 128 × 64 FULL GRAPHICS CONTROLLER +// http://reprap.org/wiki/MKS_12864OLED +// +// Tiny, but very sharp OLED display +// +//#define MKS_12864OLED // Uses the SH1106 controller (default) +//#define MKS_12864OLED_SSD1306 // Uses the SSD1306 controller + +// +// AZSMZ 12864 LCD with SD +// https://www.aliexpress.com/store/product/3D-printer-smart-controller-SMART-RAMPS-OR-RAMPS-1-4-LCD-12864-LCD-control-panel-green/2179173_32213636460.html +// +//#define AZSMZ_12864 + +// +// Silvergate GLCD controller +// http://github.com/android444/Silvergate +// +//#define SILVER_GATE_GLCD_CONTROLLER + +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + +//============================================================================= +//============================ Other Controllers ============================ +//============================================================================= + +// +// CONTROLLER TYPE: Standalone / Serial +// + +// +// LCD for Malyan M200 printers. +// +//#define MALYAN_LCD + +// +// CONTROLLER TYPE: Keypad / Add-on +// + +// +// RepRapWorld REPRAPWORLD_KEYPAD v1.1 +// http://reprapworld.com/?products_details&products_id=202&cPath=1591_1626 +// +// REPRAPWORLD_KEYPAD_MOVE_STEP sets how much should the robot move when a key +// is pressed, a value of 10.0 means 10mm per click. +// +//#define REPRAPWORLD_KEYPAD +//#define REPRAPWORLD_KEYPAD_MOVE_STEP 10.0 + +//============================================================================= +//=============================== Extra Features ============================== +//============================================================================= + +// @section extras + +// Increase the FAN PWM frequency. Removes the PWM noise but increases heating in the FET/Arduino +//#define FAST_PWM_FAN + +// Use software PWM to drive the fan, as for the heaters. This uses a very low frequency +// which is not as annoying as with the hardware PWM. On the other hand, if this frequency +// is too low, you should also increment SOFT_PWM_SCALE. +//#define FAN_SOFT_PWM + +// Incrementing this by 1 will double the software PWM frequency, +// affecting heaters, and the fan if FAN_SOFT_PWM is enabled. +// However, control resolution will be halved for each increment; +// at zero value, there are 128 effective control positions. +#define SOFT_PWM_SCALE 0 + +// If SOFT_PWM_SCALE is set to a value higher than 0, dithering can +// be used to mitigate the associated resolution loss. If enabled, +// some of the PWM cycles are stretched so on average the desired +// duty cycle is attained. +//#define SOFT_PWM_DITHER + +// Temperature status LEDs that display the hotend and bed temperature. +// If all hotends, bed temperature, and target temperature are under 54C +// then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) +//#define TEMP_STAT_LEDS + +// M240 Triggers a camera by emulating a Canon RC-1 Remote +// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ +//#define PHOTOGRAPH_PIN 23 + +// SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure +//#define SF_ARC_FIX + +// Support for the BariCUDA Paste Extruder +//#define BARICUDA + +// Support for BlinkM/CyzRgb +//#define BLINKM + +// Support for PCA9632 PWM LED driver +//#define PCA9632 + +/** + * RGB LED / LED Strip Control + * + * Enable support for an RGB LED connected to 5V digital pins, or + * an RGB Strip connected to MOSFETs controlled by digital pins. + * + * Adds the M150 command to set the LED (or LED strip) color. + * If pins are PWM capable (e.g., 4, 5, 6, 11) then a range of + * luminance values can be set from 0 to 255. + * For Neopixel LED an overall brightness parameter is also available. + * + * *** CAUTION *** + * LED Strips require a MOSFET Chip between PWM lines and LEDs, + * as the Arduino cannot handle the current the LEDs will require. + * Failure to follow this precaution can destroy your Arduino! + * NOTE: A separate 5V power supply is required! The Neopixel LED needs + * more current than the Arduino 5V linear regulator can produce. + * *** CAUTION *** + * + * LED Type. Enable only one of the following two options. + * + */ +//#define RGB_LED +//#define RGBW_LED + +#if ENABLED(RGB_LED) || ENABLED(RGBW_LED) + #define RGB_LED_R_PIN 34 + #define RGB_LED_G_PIN 43 + #define RGB_LED_B_PIN 35 + #define RGB_LED_W_PIN -1 +#endif + +// Support for Adafruit Neopixel LED driver +//#define NEOPIXEL_LED +#if ENABLED(NEOPIXEL_LED) + #define NEOPIXEL_TYPE NEO_GRBW // NEO_GRBW / NEO_GRB - four/three channel driver type (defined in Adafruit_NeoPixel.h) + #define NEOPIXEL_PIN 4 // LED driving pin on motherboard 4 => D4 (EXP2-5 on Printrboard) / 30 => PC7 (EXP3-13 on Rumba) + #define NEOPIXEL_PIXELS 30 // Number of LEDs in the strip + #define NEOPIXEL_IS_SEQUENTIAL // Sequential display for temperature change - LED by LED. Disable to change all LEDs at once. + #define NEOPIXEL_BRIGHTNESS 127 // Initial brightness (0-255) + //#define NEOPIXEL_STARTUP_TEST // Cycle through colors at startup +#endif + +/** + * Printer Event LEDs + * + * During printing, the LEDs will reflect the printer status: + * + * - Gradually change from blue to violet as the heated bed gets to target temp + * - Gradually change from violet to red as the hotend gets to temperature + * - Change to white to illuminate work surface + * - Change to green once print has finished + * - Turn off after the print has finished and the user has pushed a button + */ +#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632) || ENABLED(NEOPIXEL_LED) + #define PRINTER_EVENT_LEDS +#endif + +/** + * R/C SERVO support + * Sponsored by TrinityLabs, Reworked by codexmas + */ + +/** + * Number of servos + * + * For some servo-related options NUM_SERVOS will be set automatically. + * Set this manually if there are extra servos needing manual control. + * Leave undefined or set to 0 to entirely disable the servo subsystem. + */ +//#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command + +// Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle. +// 300ms is a good value but you can try less delay. +// If the servo can't reach the requested position, increase it. +#define SERVO_DELAY { 300 } + +// Only power servos during movement, otherwise leave off to prevent jitter +//#define DEACTIVATE_SERVOS_AFTER_MOVE + +// Allow servo angle to be edited and saved to EEPROM +//#define EDITABLE_SERVO_ANGLES diff --git a/Marlin/src/config/examples/Geeetech/MeCreator2/Configuration_adv.h b/Marlin/src/config/examples/Geeetech/MeCreator2/Configuration_adv.h new file mode 100644 index 0000000000..e126a73739 --- /dev/null +++ b/Marlin/src/config/examples/Geeetech/MeCreator2/Configuration_adv.h @@ -0,0 +1,1871 @@ +/** + * 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 . + * + */ +#pragma once + +/** + * Configuration_adv.h + * + * Advanced settings. + * Only change these if you know exactly what you're doing. + * Some of these settings can damage your printer if improperly set! + * + * Basic settings can be found in Configuration.h + * + */ +#define CONFIGURATION_ADV_H_VERSION 020000 + +// @section temperature + +//=========================================================================== +//=============================Thermal Settings ============================ +//=========================================================================== + +// +// Hephestos 2 24V heated bed upgrade kit. +// https://store.bq.com/en/heated-bed-kit-hephestos2 +// +//#define HEPHESTOS2_HEATED_BED_KIT +#if ENABLED(HEPHESTOS2_HEATED_BED_KIT) + #undef TEMP_SENSOR_BED + #define TEMP_SENSOR_BED 70 + #define HEATER_BED_INVERTING true +#endif + +#if DISABLED(PIDTEMPBED) + #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control + #if ENABLED(BED_LIMIT_SWITCHING) + #define BED_HYSTERESIS 2 // Only disable heating if T>target+BED_HYSTERESIS and enable heating if T>target-BED_HYSTERESIS + #endif +#endif + +/** + * Thermal Protection provides additional protection to your printer from damage + * and fire. Marlin always includes safe min and max temperature ranges which + * protect against a broken or disconnected thermistor wire. + * + * The issue: If a thermistor falls out, it will report the much lower + * temperature of the air in the room, and the the firmware will keep + * the heater on. + * + * The solution: Once the temperature reaches the target, start observing. + * If the temperature stays too far below the target (hysteresis) for too + * long (period), the firmware will halt the machine as a safety precaution. + * + * If you get false positives for "Thermal Runaway", increase + * THERMAL_PROTECTION_HYSTERESIS and/or THERMAL_PROTECTION_PERIOD + */ +#if ENABLED(THERMAL_PROTECTION_HOTENDS) + #define THERMAL_PROTECTION_PERIOD 40 // Seconds + #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius + + /** + * Whenever an M104, M109, or M303 increases the target temperature, the + * firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature + * hasn't increased by WATCH_TEMP_INCREASE degrees, the machine is halted and + * requires a hard reset. This test restarts with any M104/M109/M303, but only + * if the current temperature is far enough below the target for a reliable + * test. + * + * If you get false positives for "Heating failed", increase WATCH_TEMP_PERIOD + * and/or decrease WATCH_TEMP_INCREASE. WATCH_TEMP_INCREASE should not be set + * below 2. + */ + #define WATCH_TEMP_PERIOD 20 // Seconds + #define WATCH_TEMP_INCREASE 2 // Degrees Celsius +#endif + +/** + * Thermal Protection parameters for the bed are just as above for hotends. + */ +#if ENABLED(THERMAL_PROTECTION_BED) + #define THERMAL_PROTECTION_BED_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_BED_HYSTERESIS 2 // Degrees Celsius + + /** + * As described above, except for the bed (M140/M190/M303). + */ + #define WATCH_BED_TEMP_PERIOD 60 // Seconds + #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius +#endif + +#if ENABLED(PIDTEMP) + // this adds an experimental additional term to the heating power, proportional to the extrusion speed. + // if Kc is chosen well, the additional required power due to increased melting should be compensated. + //#define PID_EXTRUSION_SCALING + #if ENABLED(PID_EXTRUSION_SCALING) + #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) + #define LPQ_MAX_LEN 50 + #endif +#endif + +/** + * Automatic Temperature: + * The hotend target temperature is calculated by all the buffered lines of gcode. + * The maximum buffered steps/sec of the extruder motor is called "se". + * Start autotemp mode with M109 S B F + * The target temperature is set to mintemp+factor*se[steps/sec] and is limited by + * mintemp and maxtemp. Turn this off by executing M109 without F* + * Also, if the temperature is set to a value below mintemp, it will not be changed by autotemp. + * On an Ultimaker, some initial testing worked with M109 S215 B260 F1 in the start.gcode + */ +#define AUTOTEMP +#if ENABLED(AUTOTEMP) + #define AUTOTEMP_OLDWEIGHT 0.98 +#endif + +// Show extra position information in M114 +//#define M114_DETAIL + +// Show Temperature ADC value +// Enable for M105 to include ADC values read from temperature sensors. +//#define SHOW_TEMP_ADC_VALUES + +/** + * High Temperature Thermistor Support + * + * Thermistors able to support high temperature tend to have a hard time getting + * good readings at room and lower temperatures. This means HEATER_X_RAW_LO_TEMP + * will probably be caught when the heating element first turns on during the + * preheating process, which will trigger a min_temp_error as a safety measure + * and force stop everything. + * To circumvent this limitation, we allow for a preheat time (during which, + * min_temp_error won't be triggered) and add a min_temp buffer to handle + * aberrant readings. + * + * If you want to enable this feature for your hotend thermistor(s) + * uncomment and set values > 0 in the constants below + */ + +// The number of consecutive low temperature errors that can occur +// before a min_temp_error is triggered. (Shouldn't be more than 10.) +//#define MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED 0 + +// The number of milliseconds a hotend will preheat before starting to check +// the temperature. This value should NOT be set to the time it takes the +// hot end to reach the target temperature, but the time it takes to reach +// the minimum temperature your thermistor can read. The lower the better/safer. +// This shouldn't need to be more than 30 seconds (30000) +//#define MILLISECONDS_PREHEAT_TIME 0 + +// @section extruder + +// Extruder runout prevention. +// If the machine is idle and the temperature over MINTEMP +// then extrude some filament every couple of SECONDS. +//#define EXTRUDER_RUNOUT_PREVENT +#if ENABLED(EXTRUDER_RUNOUT_PREVENT) + #define EXTRUDER_RUNOUT_MINTEMP 190 + #define EXTRUDER_RUNOUT_SECONDS 30 + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) +#endif + +// @section temperature + +// Calibration for AD595 / AD8495 sensor to adjust temperature measurements. +// The final temperature is calculated as (measuredTemp * GAIN) + OFFSET. +#define TEMP_SENSOR_AD595_OFFSET 0.0 +#define TEMP_SENSOR_AD595_GAIN 1.0 +#define TEMP_SENSOR_AD8495_OFFSET 0.0 +#define TEMP_SENSOR_AD8495_GAIN 1.0 + +/** + * Controller Fan + * To cool down the stepper drivers and MOSFETs. + * + * The fan will turn on automatically whenever any stepper is enabled + * and turn off after a set period after all steppers are turned off. + */ +//#define USE_CONTROLLER_FAN +#if ENABLED(USE_CONTROLLER_FAN) + //#define CONTROLLER_FAN_PIN -1 // Set a custom pin for the controller fan + #define CONTROLLERFAN_SECS 60 // Duration in seconds for the fan to run after all motors are disabled + #define CONTROLLERFAN_SPEED 255 // 255 == full speed +#endif + +// When first starting the main fan, run it at full speed for the +// given number of milliseconds. This gets the fan spinning reliably +// before setting a PWM value. (Does not work with software PWM for fan on Sanguinololu) +//#define FAN_KICKSTART_TIME 100 + +/** + * PWM Fan Scaling + * + * Define the min/max speeds for PWM fans (as set with M106). + * + * With these options the M106 0-255 value range is scaled to a subset + * to ensure that the fan has enough power to spin, or to run lower + * current fans with higher current. (e.g., 5V/12V fans with 12V/24V) + * Value 0 always turns off the fan. + * + * Define one or both of these to override the default 0-255 range. + */ +//#define FAN_MIN_PWM 50 +//#define FAN_MAX_PWM 128 + +// @section extruder + +/** + * Extruder cooling fans + * + * Extruder auto fans automatically turn on when their extruders' + * temperatures go above EXTRUDER_AUTO_FAN_TEMPERATURE. + * + * Your board's pins file specifies the recommended pins. Override those here + * or set to -1 to disable completely. + * + * Multiple extruders can be assigned to the same pin in which case + * the fan will turn on when any selected extruder is above the threshold. + */ +#define E0_AUTO_FAN_PIN -1 +#define E1_AUTO_FAN_PIN -1 +#define E2_AUTO_FAN_PIN -1 +#define E3_AUTO_FAN_PIN -1 +#define E4_AUTO_FAN_PIN -1 +#define E5_AUTO_FAN_PIN -1 +#define CHAMBER_AUTO_FAN_PIN -1 +#define EXTRUDER_AUTO_FAN_TEMPERATURE 50 +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed + +/** + * Part-Cooling Fan Multiplexer + * + * This feature allows you to digitally multiplex the fan output. + * The multiplexer is automatically switched at tool-change. + * Set FANMUX[012]_PINs below for up to 2, 4, or 8 multiplexed fans. + */ +#define FANMUX0_PIN -1 +#define FANMUX1_PIN -1 +#define FANMUX2_PIN -1 + +/** + * M355 Case Light on-off / brightness + */ +#define CASE_LIGHT_ENABLE +#if ENABLED(CASE_LIGHT_ENABLE) + #define CASE_LIGHT_PIN 6 // Override the default pin if needed + #define INVERT_CASE_LIGHT false // Set true if Case Light is ON when pin is LOW + #define CASE_LIGHT_DEFAULT_ON true // Set default power-up state on + #define CASE_LIGHT_DEFAULT_BRIGHTNESS 105 // Set default power-up brightness (0-255, requires PWM pin) + #define MENU_ITEM_CASE_LIGHT // Add a Case Light option to the LCD main menu + //#define CASE_LIGHT_USE_NEOPIXEL // Use Neopixel LED as case light, requires NEOPIXEL_LED. + #if ENABLED(CASE_LIGHT_USE_NEOPIXEL) + #define CASE_LIGHT_NEOPIXEL_COLOR { 255, 255, 255, 255 } // { Red, Green, Blue, White } + #endif +#endif + +//=========================================================================== +//============================ Mechanical Settings ========================== +//=========================================================================== + +// @section homing + +// If you want endstops to stay on (by default) even when not homing +// enable this option. Override at any time with M120, M121. +//#define ENDSTOPS_ALWAYS_ON_DEFAULT + +// @section extras + +//#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats. + +// Employ an external closed loop controller. Override pins here if needed. +//#define EXTERNAL_CLOSED_LOOP_CONTROLLER +#if ENABLED(EXTERNAL_CLOSED_LOOP_CONTROLLER) + //#define CLOSED_LOOP_ENABLE_PIN -1 + //#define CLOSED_LOOP_MOVE_COMPLETE_PIN -1 +#endif + +/** + * Dual Steppers / Dual Endstops + * + * This section will allow you to use extra E drivers to drive a second motor for X, Y, or Z axes. + * + * For example, set X_DUAL_STEPPER_DRIVERS setting to use a second motor. If the motors need to + * spin in opposite directions set INVERT_X2_VS_X_DIR. If the second motor needs its own endstop + * set X_DUAL_ENDSTOPS. This can adjust for "racking." Use X2_USE_ENDSTOP to set the endstop plug + * that should be used for the second endstop. Extra endstops will appear in the output of 'M119'. + * + * Use X_DUAL_ENDSTOP_ADJUSTMENT to adjust for mechanical imperfection. After homing both motors + * this offset is applied to the X2 motor. To find the offset home the X axis, and measure the error + * in X2. Dual endstop offsets can be set at runtime with 'M666 X Y Z'. + */ + +//#define X_DUAL_STEPPER_DRIVERS +#if ENABLED(X_DUAL_STEPPER_DRIVERS) + #define INVERT_X2_VS_X_DIR true // Set 'true' if X motors should rotate in opposite directions + //#define X_DUAL_ENDSTOPS + #if ENABLED(X_DUAL_ENDSTOPS) + #define X2_USE_ENDSTOP _XMAX_ + #define X_DUAL_ENDSTOPS_ADJUSTMENT 0 + #endif +#endif + +//#define Y_DUAL_STEPPER_DRIVERS +#if ENABLED(Y_DUAL_STEPPER_DRIVERS) + #define INVERT_Y2_VS_Y_DIR true // Set 'true' if Y motors should rotate in opposite directions + //#define Y_DUAL_ENDSTOPS + #if ENABLED(Y_DUAL_ENDSTOPS) + #define Y2_USE_ENDSTOP _YMAX_ + #define Y_DUAL_ENDSTOPS_ADJUSTMENT 0 + #endif +#endif + +//#define Z_DUAL_STEPPER_DRIVERS +#if ENABLED(Z_DUAL_STEPPER_DRIVERS) + //#define Z_DUAL_ENDSTOPS + #if ENABLED(Z_DUAL_ENDSTOPS) + #define Z2_USE_ENDSTOP _XMAX_ + #define Z_DUAL_ENDSTOPS_ADJUSTMENT 0 + #endif +#endif + +//#define Z_TRIPLE_STEPPER_DRIVERS +#if ENABLED(Z_TRIPLE_STEPPER_DRIVERS) + //#define Z_TRIPLE_ENDSTOPS + #if ENABLED(Z_TRIPLE_ENDSTOPS) + #define Z2_USE_ENDSTOP _XMAX_ + #define Z3_USE_ENDSTOP _YMAX_ + #define Z_TRIPLE_ENDSTOPS_ADJUSTMENT2 0 + #define Z_TRIPLE_ENDSTOPS_ADJUSTMENT3 0 + #endif +#endif + +/** + * Dual X Carriage + * + * This setup has two X carriages that can move independently, each with its own hotend. + * The carriages can be used to print an object with two colors or materials, or in + * "duplication mode" it can print two identical or X-mirrored objects simultaneously. + * The inactive carriage is parked automatically to prevent oozing. + * X1 is the left carriage, X2 the right. They park and home at opposite ends of the X axis. + * By default the X2 stepper is assigned to the first unused E plug on the board. + */ +//#define DUAL_X_CARRIAGE +#if ENABLED(DUAL_X_CARRIAGE) + #define X1_MIN_POS X_MIN_POS // set minimum to ensure first x-carriage doesn't hit the parked second X-carriage + #define X1_MAX_POS X_BED_SIZE // set maximum to ensure first x-carriage doesn't hit the parked second X-carriage + #define X2_MIN_POS 80 // set minimum to ensure second x-carriage doesn't hit the parked first X-carriage + #define X2_MAX_POS 353 // set maximum to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // the second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // default home position is the maximum carriage position + // However: In this mode the HOTEND_OFFSET_X value for the second extruder provides a software + // override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops + // without modifying the firmware (through the "M218 T1 X???" command). + // Remember: you should set the second extruder x-offset to 0 in your slicer. + + // There are a few selectable movement modes for dual x-carriages using M605 S + // Mode 0 (DXC_FULL_CONTROL_MODE): 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 S0) + // Mode 1 (DXC_AUTO_PARK_MODE) : Auto-park mode. The firmware will automatically park and unpark the x-carriages on tool changes so + // that additional slicer support is not required. (M605 S1) + // Mode 2 (DXC_DUPLICATION_MODE) : Duplication mode. The firmware will transparently make the second x-carriage and extruder copy all + // actions of the first x-carriage. This allows the printer to print 2 arbitrary items at + // once. (2nd extruder x offset and temp offset are set using: M605 S2 [Xnnn] [Rmmm]) + + // This is the default power-up mode which can be later using M605. + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + + // Default x offset in duplication mode (typically set to half print bed width) + #define DEFAULT_DUPLICATION_X_OFFSET 100 + +#endif // DUAL_X_CARRIAGE + +// Activate a solenoid on the active extruder with M380. Disable all with M381. +// Define SOL0_PIN, SOL1_PIN, etc., for each extruder that has a solenoid. +//#define EXT_SOLENOID + +// @section homing + +// Homing hits each endstop, retracts by these distances, then does a slower bump. +#define X_HOME_BUMP_MM 5 +#define Y_HOME_BUMP_MM 5 +#define Z_HOME_BUMP_MM 2 +#define HOMING_BUMP_DIVISOR { 2, 2, 4 } // Re-Bump Speed Divisor (Divides the Homing Feedrate) +//#define QUICK_HOME // If homing includes X and Y, do a diagonal move initially + +// When G28 is called, this option will make Y home before X +//#define HOME_Y_BEFORE_X + +// Enable this if X or Y can't home without homing the other axis first. +//#define CODEPENDENT_XY_HOMING + +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + +// @section machine + +#define AXIS_RELATIVE_MODES {false, false, false, false} + +// Allow duplication mode with a basic dual-nozzle extruder +//#define DUAL_NOZZLE_DUPLICATION_MODE + +// By default pololu step drivers require an active high signal. However, some high power drivers require an active low signal as step. +#define INVERT_X_STEP_PIN false +#define INVERT_Y_STEP_PIN false +#define INVERT_Z_STEP_PIN false +#define INVERT_E_STEP_PIN false + +// Default stepper release if idle. Set to 0 to deactivate. +// Steppers will shut down DEFAULT_STEPPER_DEACTIVE_TIME seconds after the last move when DISABLE_INACTIVE_? is true. +// Time can be set by M18 and M84. +#define DEFAULT_STEPPER_DEACTIVE_TIME 120 +#define DISABLE_INACTIVE_X true +#define DISABLE_INACTIVE_Y true +#define DISABLE_INACTIVE_Z true // set to false if the nozzle will fall down on your printed part when print has finished. +#define DISABLE_INACTIVE_E true + +#define DEFAULT_MINIMUMFEEDRATE 0.0 // minimum feedrate +#define DEFAULT_MINTRAVELFEEDRATE 0.0 + +//#define HOME_AFTER_DEACTIVATE // Require rehoming after steppers are deactivated + +// @section lcd + +#if ENABLED(ULTIPANEL) + #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel + #define MANUAL_E_MOVES_RELATIVE // Show LCD extruder moves as relative rather than absolute positions + #define ULTIPANEL_FEEDMULTIPLY // Comment to disable setting feedrate multiplier via encoder +#endif + +// @section extras + +// minimum time in microseconds that a movement needs to take if the buffer is emptied. +#define DEFAULT_MINSEGMENTTIME 20000 + +// If defined the movements slow down when the look ahead buffer is only half full +#define SLOWDOWN + +// Frequency limit +// See nophead's blog for more info +// Not working O +//#define XY_FREQUENCY_LIMIT 15 + +// Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end +// of the buffer and all stops. This should not be much greater than zero and should only be changed +// if unwanted behavior is observed on a user's machine when running at very slow speeds. +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) + +// +// Use Junction Deviation instead of traditional Jerk Limiting +// +#define JUNCTION_DEVIATION +#if ENABLED(JUNCTION_DEVIATION) + #define JUNCTION_DEVIATION_MM 0.01 // (mm) Distance from real junction edge +#endif + +/** + * Adaptive Step Smoothing increases the resolution of multi-axis moves, particularly at step frequencies + * below 1kHz (for AVR) or 10kHz (for ARM), where aliasing between axes in multi-axis moves causes audible + * vibration and surface artifacts. The algorithm adapts to provide the best possible step smoothing at the + * lowest stepping frequencies. + */ +//#define ADAPTIVE_STEP_SMOOTHING + +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + +// Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. +#define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] + +/** + * @section stepper motor current + * + * Some boards have a means of setting the stepper motor current via firmware. + * + * The power on motor currents are set by: + * PWM_MOTOR_CURRENT - used by MINIRAMBO & ULTIMAIN_2 + * known compatible chips: A4982 + * DIGIPOT_MOTOR_CURRENT - used by BQ_ZUM_MEGA_3D, RAMBO & SCOOVO_X9H + * known compatible chips: AD5206 + * DAC_MOTOR_CURRENT_DEFAULT - used by PRINTRBOARD_REVF & RIGIDBOARD_V2 + * known compatible chips: MCP4728 + * DIGIPOT_I2C_MOTOR_CURRENTS - used by 5DPRINT, AZTEEG_X3_PRO, AZTEEG_X5_MINI_WIFI, MIGHTYBOARD_REVE + * known compatible chips: MCP4451, MCP4018 + * + * Motor currents can also be set by M907 - M910 and by the LCD. + * M907 - applies to all. + * M908 - BQ_ZUM_MEGA_3D, RAMBO, PRINTRBOARD_REVF, RIGIDBOARD_V2 & SCOOVO_X9H + * M909, M910 & LCD - only PRINTRBOARD_REVF & RIGIDBOARD_V2 + */ +//#define PWM_MOTOR_CURRENT { 1300, 1300, 1250 } // Values in milliamps +//#define DIGIPOT_MOTOR_CURRENT { 135,135,135,135,135 } // Values 0-255 (RAMBO 135 = ~0.75A, 185 = ~1A) +//#define DAC_MOTOR_CURRENT_DEFAULT { 70, 80, 90, 80 } // Default drive percent - X, Y, Z, E axis + +// Use an I2C based DIGIPOT (e.g., Azteeg X3 Pro) +//#define DIGIPOT_I2C +#if ENABLED(DIGIPOT_I2C) && !defined(DIGIPOT_I2C_ADDRESS_A) + /** + * Common slave addresses: + * + * A (A shifted) B (B shifted) IC + * Smoothie 0x2C (0x58) 0x2D (0x5A) MCP4451 + * AZTEEG_X3_PRO 0x2C (0x58) 0x2E (0x5C) MCP4451 + * AZTEEG_X5_MINI_WIFI 0x58 0x5C MCP4451 + * MIGHTYBOARD_REVE 0x2F (0x5E) MCP4018 + */ + #define DIGIPOT_I2C_ADDRESS_A 0x2C // unshifted slave address for first DIGIPOT + #define DIGIPOT_I2C_ADDRESS_B 0x2D // unshifted slave address for second DIGIPOT +#endif + +//#define DIGIPOT_MCP4018 // Requires library from https://github.com/stawel/SlowSoftI2CMaster +#define DIGIPOT_I2C_NUM_CHANNELS 8 // 5DPRINT: 4 AZTEEG_X3_PRO: 8 MKS SBASE: 5 +// Actual motor currents in Amps. The number of entries must match DIGIPOT_I2C_NUM_CHANNELS. +// These correspond to the physical drivers, so be mindful if the order is changed. +#define DIGIPOT_I2C_MOTOR_CURRENTS { 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 } // AZTEEG_X3_PRO + +//=========================================================================== +//=============================Additional Features=========================== +//=========================================================================== + +// @section lcd + +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + +// Include a page of printer information in the LCD Main Menu +//#define LCD_INFO_MENU + +// Scroll a longer status message into view +//#define STATUS_MESSAGE_SCROLLING + +// On the Info Screen, display XY with one decimal place when possible +//#define LCD_DECIMAL_SMALL_XY + +// The timeout (in ms) to return to the status screen from sub-menus +//#define LCD_TIMEOUT_TO_STATUS 15000 + +// Add an 'M73' G-code to set the current percentage +//#define LCD_SET_PROGRESS_MANUALLY + +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS + //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing + #if ENABLED(LCD_PROGRESS_BAR) + #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar + #define PROGRESS_BAR_MSG_TIME 3000 // (ms) Amount of time to show the status message + #define PROGRESS_MSG_EXPIRE 0 // (ms) Amount of time to retain the status message (0=forever) + //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it + //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar + #endif +#endif // HAS_PRINT_PROGRESS + +/** + * LED Control Menu + * Enable this feature to add LED Control to the LCD menu + */ +//#define LED_CONTROL_MENU +#if ENABLED(LED_CONTROL_MENU) + #define LED_COLOR_PRESETS // Enable the Preset Color menu option + #if ENABLED(LED_COLOR_PRESETS) + #define LED_USER_PRESET_RED 255 // User defined RED value + #define LED_USER_PRESET_GREEN 128 // User defined GREEN value + #define LED_USER_PRESET_BLUE 0 // User defined BLUE value + #define LED_USER_PRESET_WHITE 255 // User defined WHITE value + #define LED_USER_PRESET_BRIGHTNESS 255 // User defined intensity + //#define LED_USER_PRESET_STARTUP // Have the printer display the user preset color on startup + #endif +#endif // LED_CONTROL_MENU + +#if ENABLED(SDSUPPORT) + + // Some RAMPS and other boards don't detect when an SD card is inserted. You can work + // around this by connecting a push button or single throw switch to the pin defined + // as SD_DETECT_PIN in your board's pins definitions. + // This setting should be disabled unless you are using a push button, pulling the pin to ground. + // Note: This is always disabled for ULTIPANEL (except ELB_FULL_GRAPHIC_CONTROLLER). + #define SD_DETECT_INVERTED + + #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + + // Reverse SD sort to show "more recent" files first, according to the card's FAT. + // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. + #define SDCARD_RATHERRECENTFIRST + + // Add an option in the menu to run all auto#.g files + //#define MENU_ADDAUTOSTART + + /** + * Continue after Power-Loss (Creality3D) + * + * Store the current state to the SD Card at the start of each layer + * during SD printing. If the recovery file is found at boot time, present + * an option on the LCD screen to continue the print from the last-known + * point in the file. + */ + //#define POWER_LOSS_RECOVERY + #if ENABLED(POWER_LOSS_RECOVERY) + //#define POWER_LOSS_PIN 44 // Pin to detect power loss + //#define POWER_LOSS_STATE HIGH // State of pin indicating power loss + #endif + + /** + * Sort SD file listings in alphabetical order. + * + * With this option enabled, items on SD cards will be sorted + * by name for easier navigation. + * + * By default... + * + * - Use the slowest -but safest- method for sorting. + * - Folders are sorted to the top. + * - The sort key is statically allocated. + * - No added G-code (M34) support. + * - 40 item sorting limit. (Items after the first 40 are unsorted.) + * + * SD sorting uses static allocation (as set by SDSORT_LIMIT), allowing the + * compiler to calculate the worst-case usage and throw an error if the SRAM + * limit is exceeded. + * + * - SDSORT_USES_RAM provides faster sorting via a static directory buffer. + * - SDSORT_USES_STACK does the same, but uses a local stack-based buffer. + * - SDSORT_CACHE_NAMES will retain the sorted file listing in RAM. (Expensive!) + * - SDSORT_DYNAMIC_RAM only uses RAM when the SD menu is visible. (Use with caution!) + */ + //#define SDCARD_SORT_ALPHA + + // SD Card Sorting options + #if ENABLED(SDCARD_SORT_ALPHA) + #define SDSORT_LIMIT 40 // Maximum number of sorted items (10-256). Costs 27 bytes each. + #define FOLDER_SORTING -1 // -1=above 0=none 1=below + #define SDSORT_GCODE false // Allow turning sorting on/off with LCD and M34 g-code. + #define SDSORT_USES_RAM false // Pre-allocate a static array for faster pre-sorting. + #define SDSORT_USES_STACK false // Prefer the stack for pre-sorting to give back some SRAM. (Negated by next 2 options.) + #define SDSORT_CACHE_NAMES false // Keep sorted items in RAM longer for speedy performance. Most expensive option. + #define SDSORT_DYNAMIC_RAM false // Use dynamic allocation (within SD menus). Least expensive option. Set SDSORT_LIMIT before use! + #define SDSORT_CACHE_VFATS 2 // Maximum number of 13-byte VFAT entries to use for sorting. + // Note: Only affects SCROLL_LONG_FILENAMES with SDSORT_CACHE_NAMES but not SDSORT_DYNAMIC_RAM. + #endif + + // This allows hosts to request long names for files and folders with M33 + //#define LONG_FILENAME_HOST_SUPPORT + + // Enable this option to scroll long filenames in the SD card menu + //#define SCROLL_LONG_FILENAMES + + /** + * This option allows you to abort SD printing when any endstop is triggered. + * This feature must be enabled with "M540 S1" or from the LCD menu. + * To have any effect, endstops must be enabled during SD printing. + */ + //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED + + /** + * This option makes it easier to print the same SD Card file again. + * On print completion the LCD Menu will open with the file selected. + * You can just click to start the print, or navigate elsewhere. + */ + //#define SD_REPRINT_LAST_SELECTED_FILE + + /** + * Auto-report SdCard status with M27 S + */ + //#define AUTO_REPORT_SD_STATUS + + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + +#endif // SDSUPPORT + +/** + * Additional options for Graphical Displays + * + * Use the optimizations here to improve printing performance, + * which can be adversely affected by graphical display drawing, + * especially when doing several short moves, and when printing + * on DELTA and SCARA machines. + * + * Some of these options may result in the display lagging behind + * controller events, as there is a trade-off between reliable + * printing performance versus fast display updates. + */ +#if HAS_GRAPHICAL_LCD + // Show SD percentage next to the progress bar + //#define DOGM_SD_PERCENT + + // Enable to save many cycles by drawing a hollow frame on the Info Screen + #define XYZ_HOLLOW_FRAME + + // Enable to save many cycles by drawing a hollow frame on Menu Screens + #define MENU_HOLLOW_FRAME + + // A bigger font is available for edit items. Costs 3120 bytes of PROGMEM. + // Western only. Not available for Cyrillic, Kana, Turkish, Greek, or Chinese. + //#define USE_BIG_EDIT_FONT + + // A smaller font may be used on the Info Screen. Costs 2300 bytes of PROGMEM. + // Western only. Not available for Cyrillic, Kana, Turkish, Greek, or Chinese. + //#define USE_SMALL_INFOFONT + + // Enable this option and reduce the value to optimize screen updates. + // The normal delay is 10µs. Use the lowest value that still gives a reliable display. + //#define DOGM_SPI_DELAY_US 5 + + // Swap the CW/CCW indicators in the graphics overlay + //#define OVERLAY_GFX_REVERSE + + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + * + * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. + * This will prevent position updates from being displayed. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + +#endif // DOGLCD + +// @section safety + +// The hardware watchdog should reset the microcontroller disabling all outputs, +// in case the firmware gets stuck and doesn't do temperature regulation. +#define USE_WATCHDOG + +#if ENABLED(USE_WATCHDOG) + // If you have a watchdog reboot in an ArduinoMega2560 then the device will hang forever, as a watchdog reset will leave the watchdog on. + // The "WATCHDOG_RESET_MANUAL" goes around this by not using the hardware reset. + // However, THIS FEATURE IS UNSAFE!, as it will only work if interrupts are disabled. And the code could hang in an interrupt routine with interrupts disabled. + //#define WATCHDOG_RESET_MANUAL +#endif + +// @section lcd + +/** + * Babystepping enables movement of the axes by tiny increments without changing + * the current position values. This feature is used primarily to adjust the Z + * axis in the first layer of a print in real-time. + * + * Warning: Does not respect endstops! + */ +//#define BABYSTEPPING +#if ENABLED(BABYSTEPPING) + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. + + //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping + #if ENABLED(BABYSTEP_ZPROBE_OFFSET) + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + #endif +#endif + +// @section extruder + +/** + * Linear Pressure Control v1.5 + * + * Assumption: advance [steps] = k * (delta velocity [steps/s]) + * K=0 means advance disabled. + * + * NOTE: K values for LIN_ADVANCE 1.5 differ from earlier versions! + * + * Set K around 0.22 for 3mm PLA Direct Drive with ~6.5cm between the drive gear and heatbreak. + * Larger K values will be needed for flexible filament and greater distances. + * If this algorithm produces a higher speed offset than the extruder can handle (compared to E jerk) + * print acceleration will be reduced during the affected moves to keep within the limit. + * + * See http://marlinfw.org/docs/features/lin_advance.html for full instructions. + * Mention @Sebastianv650 on GitHub to alert the author of any issues. + */ +#define LIN_ADVANCE +#if ENABLED(LIN_ADVANCE) + #define LIN_ADVANCE_K 0.05 // Unit: mm compression per 1mm/s extruder speed + //#define LA_DEBUG // If enabled, this will generate debug information output over USB. +#endif + +// @section leveling + +#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_UBL) + // Override the mesh area if the automatic (max) area is too large + //#define MESH_MIN_X MESH_INSET + //#define MESH_MIN_Y MESH_INSET + //#define MESH_MAX_X X_BED_SIZE - (MESH_INSET) + //#define MESH_MAX_Y Y_BED_SIZE - (MESH_INSET) +#endif + +/** + * Repeatedly attempt G29 leveling until it succeeds. + * Stop after G29_MAX_RETRIES attempts. + */ +//#define G29_RETRY_AND_RECOVER +#if ENABLED(G29_RETRY_AND_RECOVER) + #define G29_MAX_RETRIES 3 + #define G29_HALT_ON_FAILURE + /** + * Specify the GCODE commands that will be executed when leveling succeeds, + * between attempts, and after the maximum number of retries have been tried. + */ + #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." + #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" + #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" + /** + * Specify an action command to send to the host on a recovery attempt or failure. + * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. + * The host must be configured to handle the action command. + */ + #define G29_ACTION_ON_RECOVER "probe_rewipe" + #define G29_ACTION_ON_FAILURE "probe_failed" +#endif + +// @section extras + +// +// G2/G3 Arc Support +// +#define ARC_SUPPORT // Disable this feature to save ~3226 bytes +#if ENABLED(ARC_SUPPORT) + #define MM_PER_ARC_SEGMENT 1 // Length of each arc segment + #define N_ARC_CORRECTION 25 // Number of intertpolated segments between corrections + //#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles + //#define CNC_WORKSPACE_PLANES // Allow G2/G3 to operate in XY, ZX, or YZ planes +#endif + +// Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes. +//#define BEZIER_CURVE_SUPPORT + +// G38.2 and G38.3 Probe Target +// Set MULTIPLE_PROBING if you want G38 to double touch +//#define G38_PROBE_TARGET +#if ENABLED(G38_PROBE_TARGET) + #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move) +#endif + +// Moves (or segments) with fewer steps than this will be joined with the next move +#define MIN_STEPS_PER_SEGMENT 6 + +/** + * Minimum delay after setting the stepper DIR (in ns) + * 0 : No delay (Expect at least 10µS since one Stepper ISR must transpire) + * 20 : Minimum for TMC2xxx drivers + * 200 : Minimum for A4988 drivers + * 400 : Minimum for A5984 drivers + * 500 : Minimum for LV8729 drivers (guess, no info in datasheet) + * 650 : Minimum for DRV8825 drivers + * 1500 : Minimum for TB6600 drivers (guess, no info in datasheet) + * 15000 : Minimum for TB6560 drivers (guess, no info in datasheet) + * + * Override the default value based on the driver type set in Configuration.h. + */ +//#define MINIMUM_STEPPER_DIR_DELAY 650 + +/** + * Minimum stepper driver pulse width (in µs) + * 0 : Smallest possible width the MCU can produce, compatible with TMC2xxx drivers + * 1 : Minimum for A4988, A5984, and LV8729 stepper drivers + * 2 : Minimum for DRV8825 stepper drivers + * 3 : Minimum for TB6600 stepper drivers + * 30 : Minimum for TB6560 stepper drivers + * + * Override the default value based on the driver type set in Configuration.h. + */ +//#define MINIMUM_STEPPER_PULSE 2 + +/** + * Maximum stepping rate (in Hz) the stepper driver allows + * If undefined, defaults to 1MHz / (2 * MINIMUM_STEPPER_PULSE) + * 500000 : Maximum for A4988 stepper driver + * 400000 : Maximum for TMC2xxx stepper drivers + * 250000 : Maximum for DRV8825 stepper driver + * 150000 : Maximum for TB6600 stepper driver + * 130000 : Maximum for LV8729 stepper driver + * 15000 : Maximum for TB6560 stepper driver + * + * Override the default value based on the driver type set in Configuration.h. + */ +//#define MAXIMUM_STEPPER_RATE 250000 + +// @section temperature + +// Control heater 0 and heater 1 in parallel. +//#define HEATERS_PARALLEL + +//=========================================================================== +//================================= Buffers ================================= +//=========================================================================== + +// @section hidden + +// The number of linear motions that can be in the plan at any give time. +// THE BLOCK_BUFFER_SIZE NEEDS TO BE A POWER OF 2 (e.g. 8, 16, 32) because shifts and ors are used to do the ring-buffering. +#if ENABLED(SDSUPPORT) + #define BLOCK_BUFFER_SIZE 16 // SD,LCD,Buttons take more memory, block buffer needs to be smaller +#else + #define BLOCK_BUFFER_SIZE 16 // maximize block buffer +#endif + +// @section serial + +// The ASCII buffer for serial input +#define MAX_CMD_SIZE 96 +#define BUFSIZE 4 + +// Transmission to Host Buffer Size +// To save 386 bytes of PROGMEM (and TX_BUFFER_SIZE+3 bytes of RAM) set to 0. +// To buffer a simple "ok" you need 4 bytes. +// For ADVANCED_OK (M105) you need 32 bytes. +// For debug-echo: 128 bytes for the optimal speed. +// Other output doesn't need to be that speedy. +// :[0, 2, 4, 8, 16, 32, 64, 128, 256] +#define TX_BUFFER_SIZE 0 + +// Host Receive Buffer Size +// Without XON/XOFF flow control (see SERIAL_XON_XOFF below) 32 bytes should be enough. +// To use flow control, set this buffer size to at least 1024 bytes. +// :[0, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048] +//#define RX_BUFFER_SIZE 1024 + +#if RX_BUFFER_SIZE >= 1024 + // Enable to have the controller send XON/XOFF control characters to + // the host to signal the RX buffer is becoming full. + //#define SERIAL_XON_XOFF +#endif + +#if ENABLED(SDSUPPORT) + // Enable this option to collect and display the maximum + // RX queue usage after transferring a file to SD. + //#define SERIAL_STATS_MAX_RX_QUEUED + + // Enable this option to collect and display the number + // of dropped bytes after a file transfer to SD. + //#define SERIAL_STATS_DROPPED_RX +#endif + +// Enable an emergency-command parser to intercept certain commands as they +// enter the serial receive buffer, so they cannot be blocked. +// Currently handles M108, M112, M410 +// Does not work on boards using AT90USB (USBCON) processors! +//#define EMERGENCY_PARSER + +// Bad Serial-connections can miss a received command by sending an 'ok' +// Therefore some clients abort after 30 seconds in a timeout. +// Some other clients start sending commands while receiving a 'wait'. +// This "wait" is only sent when the buffer is empty. 1 second is a good value here. +//#define NO_TIMEOUTS 1000 // Milliseconds + +// Some clients will have this feature soon. This could make the NO_TIMEOUTS unnecessary. +//#define ADVANCED_OK + +// @section extras + +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + +/** + * Firmware-based and LCD-controlled retract + * + * Add G10 / G11 commands for automatic firmware-based retract / recover. + * Use M207 and M208 to define parameters for retract / recover. + * + * Use M209 to enable or disable auto-retract. + * With auto-retract enabled, all G1 E moves within the set range + * will be converted to firmware-based retract/recover moves. + * + * Be sure to turn off auto-retract during filament change. + * + * Note that M207 / M208 / M209 settings are saved to EEPROM. + * + */ +//#define FWRETRACT +#if ENABLED(FWRETRACT) + #define FWRETRACT_AUTORETRACT // costs ~500 bytes of PROGMEM + #if ENABLED(FWRETRACT_AUTORETRACT) + #define MIN_AUTORETRACT 0.1 // When auto-retract is on, convert E moves of this length and over + #define MAX_AUTORETRACT 10.0 // Upper limit for auto-retract conversion + #endif + #define RETRACT_LENGTH 3 // Default retract length (positive mm) + #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change + #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) + #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) + #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) + #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) + #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif +#endif + +/** + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. + */ +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif + +/** + * Advanced Pause + * Experimental feature for filament change support and for parking the nozzle when paused. + * Adds the GCode M600 for initiating filament change. + * If PARK_HEAD_ON_PAUSE enabled, adds the GCode M125 to pause printing and park the nozzle. + * + * Requires an LCD display. + * Requires NOZZLE_PARK_FEATURE. + * This feature is required for the default FILAMENT_RUNOUT_SCRIPT. + */ +//#define ADVANCED_PAUSE_FEATURE +#if ENABLED(ADVANCED_PAUSE_FEATURE) + #define PAUSE_PARK_RETRACT_FEEDRATE 60 // (mm/s) Initial retract feedrate. + #define PAUSE_PARK_RETRACT_LENGTH 2 // (mm) Initial retract. + // This short retract is done immediately, before parking the nozzle. + #define FILAMENT_CHANGE_UNLOAD_FEEDRATE 10 // (mm/s) Unload filament feedrate. This can be pretty fast. + #define FILAMENT_CHANGE_UNLOAD_ACCEL 25 // (mm/s^2) Lower acceleration may allow a faster feedrate. + #define FILAMENT_CHANGE_UNLOAD_LENGTH 100 // (mm) The length of filament for a complete unload. + // For Bowden, the full length of the tube and nozzle. + // For direct drive, the full length of the nozzle. + // Set to 0 for manual unloading. + #define FILAMENT_CHANGE_SLOW_LOAD_FEEDRATE 6 // (mm/s) Slow move when starting load. + #define FILAMENT_CHANGE_SLOW_LOAD_LENGTH 0 // (mm) Slow length, to allow time to insert material. + // 0 to disable start loading and skip to fast load only + #define FILAMENT_CHANGE_FAST_LOAD_FEEDRATE 6 // (mm/s) Load filament feedrate. This can be pretty fast. + #define FILAMENT_CHANGE_FAST_LOAD_ACCEL 25 // (mm/s^2) Lower acceleration may allow a faster feedrate. + #define FILAMENT_CHANGE_FAST_LOAD_LENGTH 0 // (mm) Load length of filament, from extruder gear to nozzle. + // For Bowden, the full length of the tube and nozzle. + // For direct drive, the full length of the nozzle. + //#define ADVANCED_PAUSE_CONTINUOUS_PURGE // Purge continuously up to the purge length until interrupted. + #define ADVANCED_PAUSE_PURGE_FEEDRATE 3 // (mm/s) Extrude feedrate (after loading). Should be slower than load feedrate. + #define ADVANCED_PAUSE_PURGE_LENGTH 50 // (mm) Length to extrude after loading. + // Set to 0 for manual extrusion. + // Filament can be extruded repeatedly from the Filament Change menu + // until extrusion is consistent, and to purge old filament. + + // Filament Unload does a Retract, Delay, and Purge first: + #define FILAMENT_UNLOAD_RETRACT_LENGTH 13 // (mm) Unload initial retract length. + #define FILAMENT_UNLOAD_DELAY 5000 // (ms) Delay for the filament to cool after retract. + #define FILAMENT_UNLOAD_PURGE_LENGTH 8 // (mm) An unretract is done, then this length is purged. + + #define PAUSE_PARK_NOZZLE_TIMEOUT 45 // (seconds) Time limit before the nozzle is turned off for safety. + #define FILAMENT_CHANGE_ALERT_BEEPS 10 // Number of alert beeps to play when a response is needed. + #define PAUSE_PARK_NO_STEPPER_TIMEOUT // Enable for XYZ steppers to stay powered on during filament change. + + //#define PARK_HEAD_ON_PAUSE // Park the nozzle during pause and filament change. + //#define HOME_BEFORE_FILAMENT_CHANGE // Ensure homing has been completed prior to parking for filament change + + //#define FILAMENT_LOAD_UNLOAD_GCODES // Add M701/M702 Load/Unload G-codes, plus Load/Unload in the LCD Prepare menu. + //#define FILAMENT_UNLOAD_ALL_EXTRUDERS // Allow M702 to unload all extruders above a minimum target temp (as set by M302) +#endif + +// @section tmc + +/** + * TMC26X Stepper Driver options + * + * The TMC26XStepper library is required for this stepper driver. + * https://github.com/trinamic/TMC26XStepper + */ +#if HAS_DRIVER(TMC26X) + + #define X_MAX_CURRENT 1000 // in mA + #define X_SENSE_RESISTOR 91 // in mOhms + #define X_MICROSTEPS 16 // number of microsteps + + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + + #define E5_MAX_CURRENT 1000 + #define E5_SENSE_RESISTOR 91 + #define E5_MICROSTEPS 16 + +#endif // TMC26X + +// @section tmc_smart + +/** + * To use TMC2130 stepper drivers in SPI mode connect your SPI pins to + * the hardware SPI interface on your board and define the required CS pins + * in your `pins_MYBOARD.h` file. (e.g., RAMPS 1.4 uses AUX3 pins `X_CS_PIN 53`, `Y_CS_PIN 49`, etc.). + * You may also use software SPI if you wish to use general purpose IO pins. + * + * The TMC2130Stepper library is required for this stepper driver. + * https://github.com/teemuatlut/TMC2130Stepper + * + * To use TMC2208 stepper UART-configurable stepper drivers + * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN + * to PDN_UART without a resistor. + * The drivers can also be used with hardware serial. + * + * The TMC2208Stepper library is required for this stepper driver. + * https://github.com/teemuatlut/TMC2208Stepper + */ +#if HAS_TRINAMIC + + #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 + #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current + #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 + + #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. + #define X_MICROSTEPS 16 // 0..256 + + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + + #define E1_CURRENT 800 + #define E1_MICROSTEPS 16 + + #define E2_CURRENT 800 + #define E2_MICROSTEPS 16 + + #define E3_CURRENT 800 + #define E3_MICROSTEPS 16 + + #define E4_CURRENT 800 + #define E4_MICROSTEPS 16 + + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + + /** + * Use software SPI for TMC2130. + * The default SW SPI pins are defined the respective pins files, + * but you can override or define them here. + */ + //#define TMC_USE_SW_SPI + //#define TMC_SW_MOSI -1 + //#define TMC_SW_MISO -1 + //#define TMC_SW_SCK -1 + + /** + * Use Trinamic's ultra quiet stepping mode. + * When disabled, Marlin will use spreadCycle stepping mode. + */ + #define STEALTHCHOP + + /** + * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * like overtemperature and short to ground. TMC2208 requires hardware serial. + * In the case of overtemperature Marlin can decrease the driver current until error condition clears. + * Other detected conditions can be used to stop the current print. + * Relevant g-codes: + * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. + * M911 - Report stepper driver overtemperature pre-warn condition. + * M912 - Clear stepper driver overtemperature pre-warn condition flag. + * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + */ + //#define MONITOR_DRIVER_STATUS + + #if ENABLED(MONITOR_DRIVER_STATUS) + #define CURRENT_STEP_DOWN 50 // [mA] + #define REPORT_CURRENT_CHANGE + #define STOP_ON_ERROR + #endif + + /** + * The driver will switch to spreadCycle when stepper speed is over HYBRID_THRESHOLD. + * This mode allows for faster movements at the expense of higher noise levels. + * STEALTHCHOP needs to be enabled. + * M913 X/Y/Z/E to live tune the setting + */ + //#define HYBRID_THRESHOLD + + #define X_HYBRID_THRESHOLD 100 // [mm/s] + #define X2_HYBRID_THRESHOLD 100 + #define Y_HYBRID_THRESHOLD 100 + #define Y2_HYBRID_THRESHOLD 100 + #define Z_HYBRID_THRESHOLD 3 + #define Z2_HYBRID_THRESHOLD 3 + #define Z3_HYBRID_THRESHOLD 3 + #define E0_HYBRID_THRESHOLD 30 + #define E1_HYBRID_THRESHOLD 30 + #define E2_HYBRID_THRESHOLD 30 + #define E3_HYBRID_THRESHOLD 30 + #define E4_HYBRID_THRESHOLD 30 + #define E5_HYBRID_THRESHOLD 30 + + /** + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. + * X, Y, and Z homing will always be done in spreadCycle mode. + * + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. + * Higher values make the system LESS sensitive. + * Lower value make the system MORE sensitive. + * Too low values can lead to false positives, while too high values will collide the axis without triggering. + * It is advised to set X/Y/Z_HOME_BUMP_MM to 0. + * M914 X/Y/Z to live tune the setting + */ + //#define SENSORLESS_HOMING // TMC2130 only + + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 + #endif + + /** + * Enable M122 debugging command for TMC stepper drivers. + * M122 S0/1 will enable continous reporting. + */ + //#define TMC_DEBUG + + /** + * M915 Z Axis Calibration + * + * - Adjust Z stepper current, + * - Drive the Z axis to its physical maximum, and + * - Home Z to account for the lost steps. + * + * Use M915 Snn to specify the current. + * Use M925 Znn to add extra Z height to Z_MAX_POS. + */ + //#define TMC_Z_CALIBRATION + #if ENABLED(TMC_Z_CALIBRATION) + #define CALIBRATION_CURRENT 250 + #define CALIBRATION_EXTRA_HEIGHT 10 + #endif + + /** + * You can set your own advanced settings by filling in predefined functions. + * A list of available functions can be found on the library github page + * https://github.com/teemuatlut/TMC2130Stepper + * https://github.com/teemuatlut/TMC2208Stepper + * + * Example: + * #define TMC_ADV() { \ + * stepperX.diag0_temp_prewarn(1); \ + * stepperY.interpolate(0); \ + * } + */ + #define TMC_ADV() { } + +#endif // HAS_TRINAMIC + +// @section L6470 + +/** + * L6470 Stepper Driver options + * + * The Arduino-L6470 library is required for this stepper driver. + * https://github.com/ameyer/Arduino-L6470 + */ +#if HAS_DRIVER(L6470) + + #define X_MICROSTEPS 16 // number of microsteps + #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off + #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + + #define X2_MICROSTEPS 16 + #define X2_OVERCURRENT 2000 + #define X2_STALLCURRENT 1500 + + #define Y_MICROSTEPS 16 + #define Y_OVERCURRENT 2000 + #define Y_STALLCURRENT 1500 + + #define Y2_MICROSTEPS 16 + #define Y2_OVERCURRENT 2000 + #define Y2_STALLCURRENT 1500 + + #define Z_MICROSTEPS 16 + #define Z_OVERCURRENT 2000 + #define Z_STALLCURRENT 1500 + + #define Z2_MICROSTEPS 16 + #define Z2_OVERCURRENT 2000 + #define Z2_STALLCURRENT 1500 + + #define Z3_MICROSTEPS 16 + #define Z3_OVERCURRENT 2000 + #define Z3_STALLCURRENT 1500 + + #define E0_MICROSTEPS 16 + #define E0_OVERCURRENT 2000 + #define E0_STALLCURRENT 1500 + + #define E1_MICROSTEPS 16 + #define E1_OVERCURRENT 2000 + #define E1_STALLCURRENT 1500 + + #define E2_MICROSTEPS 16 + #define E2_OVERCURRENT 2000 + #define E2_STALLCURRENT 1500 + + #define E3_MICROSTEPS 16 + #define E3_OVERCURRENT 2000 + #define E3_STALLCURRENT 1500 + + #define E4_MICROSTEPS 16 + #define E4_OVERCURRENT 2000 + #define E4_STALLCURRENT 1500 + + #define E5_MICROSTEPS 16 + #define E5_OVERCURRENT 2000 + #define E5_STALLCURRENT 1500 + +#endif // L6470 + +/** + * TWI/I2C BUS + * + * This feature is an EXPERIMENTAL feature so it shall not be used on production + * machines. Enabling this will allow you to send and receive I2C data from slave + * devices on the bus. + * + * ; Example #1 + * ; This macro send the string "Marlin" to the slave device with address 0x63 (99) + * ; It uses multiple M260 commands with one B arg + * M260 A99 ; Target slave address + * M260 B77 ; M + * M260 B97 ; a + * M260 B114 ; r + * M260 B108 ; l + * M260 B105 ; i + * M260 B110 ; n + * M260 S1 ; Send the current buffer + * + * ; Example #2 + * ; Request 6 bytes from slave device with address 0x63 (99) + * M261 A99 B5 + * + * ; Example #3 + * ; Example serial output of a M261 request + * echo:i2c-reply: from:99 bytes:5 data:hello + */ + +// @section i2cbus + +//#define EXPERIMENTAL_I2CBUS +#define I2C_SLAVE_ADDRESS 0 // Set a value from 8 to 127 to act as a slave + +// @section extras + +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + +/** + * Spindle & Laser control + * + * Add the M3, M4, and M5 commands to turn the spindle/laser on and off, and + * to set spindle speed, spindle direction, and laser power. + * + * SuperPid is a router/spindle speed controller used in the CNC milling community. + * Marlin can be used to turn the spindle on and off. It can also be used to set + * the spindle speed from 5,000 to 30,000 RPM. + * + * You'll need to select a pin for the ON/OFF function and optionally choose a 0-5V + * hardware PWM pin for the speed control and a pin for the rotation direction. + * + * See http://marlinfw.org/docs/configuration/laser_spindle.html for more config details. + */ +//#define SPINDLE_LASER_ENABLE +#if ENABLED(SPINDLE_LASER_ENABLE) + + #define SPINDLE_LASER_ENABLE_INVERT false // set to "true" if the on/off function is reversed + #define SPINDLE_LASER_PWM true // set to true if your controller supports setting the speed/power + #define SPINDLE_LASER_PWM_INVERT true // set to "true" if the speed/power goes up when you want it to go slower + #define SPINDLE_LASER_POWERUP_DELAY 5000 // delay in milliseconds to allow the spindle/laser to come up to speed/power + #define SPINDLE_LASER_POWERDOWN_DELAY 5000 // delay in milliseconds to allow the spindle to stop + #define SPINDLE_DIR_CHANGE true // set to true if your spindle controller supports changing spindle direction + #define SPINDLE_INVERT_DIR false + #define SPINDLE_STOP_ON_DIR_CHANGE true // set to true if Marlin should stop the spindle before changing rotation direction + + /** + * The M3 & M4 commands use the following equation to convert PWM duty cycle to speed/power + * + * SPEED/POWER = PWM duty cycle * SPEED_POWER_SLOPE + SPEED_POWER_INTERCEPT + * where PWM duty cycle varies from 0 to 255 + * + * set the following for your controller (ALL MUST BE SET) + */ + + #define SPEED_POWER_SLOPE 118.4 + #define SPEED_POWER_INTERCEPT 0 + #define SPEED_POWER_MIN 5000 + #define SPEED_POWER_MAX 30000 // SuperPID router controller 0 - 30,000 RPM + + //#define SPEED_POWER_SLOPE 0.3922 + //#define SPEED_POWER_INTERCEPT 0 + //#define SPEED_POWER_MIN 10 + //#define SPEED_POWER_MAX 100 // 0-100% +#endif + +/** + * Filament Width Sensor + * + * Measures the filament width in real-time and adjusts + * flow rate to compensate for any irregularities. + * + * Also allows the measured filament diameter to set the + * extrusion rate, so the slicer only has to specify the + * volume. + * + * Only a single extruder is supported at this time. + * + * 34 RAMPS_14 : Analog input 5 on the AUX2 connector + * 81 PRINTRBOARD : Analog input 2 on the Exp1 connector (version B,C,D,E) + * 301 RAMBO : Analog input 3 + * + * Note: May require analog pins to be defined for other boards. + */ +//#define FILAMENT_WIDTH_SENSOR + +#if ENABLED(FILAMENT_WIDTH_SENSOR) + #define FILAMENT_SENSOR_EXTRUDER_NUM 0 // Index of the extruder that has the filament sensor. :[0,1,2,3,4] + #define MEASUREMENT_DELAY_CM 14 // (cm) The distance from the filament sensor to the melting chamber + + #define FILWIDTH_ERROR_MARGIN 1.0 // (mm) If a measurement differs too much from nominal width ignore it + #define MAX_MEASUREMENT_DELAY 20 // (bytes) Buffer size for stored measurements (1 byte per cm). Must be larger than MEASUREMENT_DELAY_CM. + + #define DEFAULT_MEASURED_FILAMENT_DIA DEFAULT_NOMINAL_FILAMENT_DIA // Set measured to nominal initially + + // Display filament width on the LCD status line. Status messages will expire after 5 seconds. + //#define FILAMENT_LCD_DISPLAY +#endif + +/** + * CNC Coordinate Systems + * + * Enables G53 and G54-G59.3 commands to select coordinate systems + * and G92.1 to reset the workspace to native machine space. + */ +//#define CNC_COORDINATE_SYSTEMS + +/** + * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins + */ +//#define PINS_DEBUGGING + +/** + * Auto-report temperatures with M155 S + */ +#define AUTO_REPORT_TEMPERATURES + +/** + * Include capabilities in M115 output + */ +#define EXTENDED_CAPABILITIES_REPORT + +/** + * Disable all Volumetric extrusion options + */ +//#define NO_VOLUMETRICS + +#if DISABLED(NO_VOLUMETRICS) + /** + * Volumetric extrusion default state + * Activate to make volumetric extrusion the default method, + * with DEFAULT_NOMINAL_FILAMENT_DIA as the default diameter. + * + * M200 D0 to disable, M200 Dn to set a new diameter. + */ + //#define VOLUMETRIC_DEFAULT_ON +#endif + +/** + * Enable this option for a leaner build of Marlin that removes all + * workspace offsets, simplifying coordinate transformations, leveling, etc. + * + * - M206 and M428 are disabled. + * - G92 will revert to its behavior from Marlin 1.0. + */ +//#define NO_WORKSPACE_OFFSETS + +/** + * Set the number of proportional font spaces required to fill up a typical character space. + * This can help to better align the output of commands like `G29 O` Mesh Output. + * + * For clients that use a fixed-width font (like OctoPrint), leave this set to 1.0. + * Otherwise, adjust according to your client and font. + */ +#define PROPORTIONAL_FONT_RATIO 1.0 + +/** + * Spend 28 bytes of SRAM to optimize the GCode parser + */ +#define FASTER_GCODE_PARSER + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + +/** + * User-defined menu items that execute custom GCode + */ +//#define CUSTOM_USER_MENUS +#if ENABLED(CUSTOM_USER_MENUS) + //#define CUSTOM_USER_MENU_TITLE "Custom Commands" + #define USER_SCRIPT_DONE "M117 User Script Done" + #define USER_SCRIPT_AUDIBLE_FEEDBACK + //#define USER_SCRIPT_RETURN // Return to status screen after a script + + #define USER_DESC_1 "Home & UBL Info" + #define USER_GCODE_1 "G28\nG29 W" + + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL + #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) + + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL + #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) + + #define USER_DESC_4 "Heat Bed/Home/Level" + #define USER_GCODE_4 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nG28\nG29" + + #define USER_DESC_5 "Home & Info" + #define USER_GCODE_5 "G28\nM503" +#endif + +/** + * Specify an action command to send to the host when the printer is killed. + * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. + * The host must be configured to handle the action command. + */ +//#define ACTION_ON_KILL "poweroff" + +/** + * Specify an action command to send to the host on pause and resume. + * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. + * The host must be configured to handle the action command. + */ +//#define ACTION_ON_PAUSE "pause" +//#define ACTION_ON_RESUME "resume" + +//=========================================================================== +//====================== I2C Position Encoder Settings ====================== +//=========================================================================== + +/** + * I2C position encoders for closed loop control. + * Developed by Chris Barr at Aus3D. + * + * Wiki: http://wiki.aus3d.com.au/Magnetic_Encoder + * Github: https://github.com/Aus3D/MagneticEncoder + * + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ + * + * Reilabuild encoders have been modified to improve reliability. + */ + +//#define I2C_POSITION_ENCODERS +#if ENABLED(I2C_POSITION_ENCODERS) + + #define I2CPE_ENCODER_CNT 1 // The number of encoders installed; max of 5 + // encoders supported currently. + + #define I2CPE_ENC_1_ADDR I2CPE_PRESET_ADDR_X // I2C address of the encoder. 30-200. + #define I2CPE_ENC_1_AXIS X_AXIS // Axis the encoder module is installed on. _AXIS. + #define I2CPE_ENC_1_TYPE I2CPE_ENC_TYPE_LINEAR // Type of encoder: I2CPE_ENC_TYPE_LINEAR -or- + // I2CPE_ENC_TYPE_ROTARY. + #define I2CPE_ENC_1_TICKS_UNIT 2048 // 1024 for magnetic strips with 2mm poles; 2048 for + // 1mm poles. For linear encoders this is ticks / mm, + // for rotary encoders this is ticks / revolution. + //#define I2CPE_ENC_1_TICKS_REV (16 * 200) // Only needed for rotary encoders; number of stepper + // steps per full revolution (motor steps/rev * microstepping) + //#define I2CPE_ENC_1_INVERT // Invert the direction of axis travel. + #define I2CPE_ENC_1_EC_METHOD I2CPE_ECM_MICROSTEP // Type of error error correction. + #define I2CPE_ENC_1_EC_THRESH 0.10 // Threshold size for error (in mm) above which the + // printer will attempt to correct the error; errors + // smaller than this are ignored to minimize effects of + // measurement noise / latency (filter). + + #define I2CPE_ENC_2_ADDR I2CPE_PRESET_ADDR_Y // Same as above, but for encoder 2. + #define I2CPE_ENC_2_AXIS Y_AXIS + #define I2CPE_ENC_2_TYPE I2CPE_ENC_TYPE_LINEAR + #define I2CPE_ENC_2_TICKS_UNIT 2048 + //#define I2CPE_ENC_2_TICKS_REV (16 * 200) + //#define I2CPE_ENC_2_INVERT + #define I2CPE_ENC_2_EC_METHOD I2CPE_ECM_MICROSTEP + #define I2CPE_ENC_2_EC_THRESH 0.10 + + #define I2CPE_ENC_3_ADDR I2CPE_PRESET_ADDR_Z // Encoder 3. Add additional configuration options + #define I2CPE_ENC_3_AXIS Z_AXIS // as above, or use defaults below. + + #define I2CPE_ENC_4_ADDR I2CPE_PRESET_ADDR_E // Encoder 4. + #define I2CPE_ENC_4_AXIS E_AXIS + + #define I2CPE_ENC_5_ADDR 34 // Encoder 5. + #define I2CPE_ENC_5_AXIS E_AXIS + + // Default settings for encoders which are enabled, but without settings configured above. + #define I2CPE_DEF_TYPE I2CPE_ENC_TYPE_LINEAR + #define I2CPE_DEF_ENC_TICKS_UNIT 2048 + #define I2CPE_DEF_TICKS_REV (16 * 200) + #define I2CPE_DEF_EC_METHOD I2CPE_ECM_NONE + #define I2CPE_DEF_EC_THRESH 0.1 + + //#define I2CPE_ERR_THRESH_ABORT 100.0 // Threshold size for error (in mm) error on any given + // axis after which the printer will abort. Comment out to + // disable abort behaviour. + + #define I2CPE_TIME_TRUSTED 10000 // After an encoder fault, there must be no further fault + // for this amount of time (in ms) before the encoder + // is trusted again. + + /** + * Position is checked every time a new command is executed from the buffer but during long moves, + * this setting determines the minimum update time between checks. A value of 100 works well with + * error rolling average when attempting to correct only for skips and not for vibration. + */ + #define I2CPE_MIN_UPD_TIME_MS 4 // (ms) Minimum time between encoder checks. + + // Use a rolling average to identify persistant errors that indicate skips, as opposed to vibration and noise. + #define I2CPE_ERR_ROLLING_AVERAGE + +#endif // I2C_POSITION_ENCODERS + +/** + * MAX7219 Debug Matrix + * + * Add support for a low-cost 8x8 LED Matrix based on the Max7219 chip as a realtime status display. + * Requires 3 signal wires. Some useful debug options are included to demonstrate its usage. + */ +//#define MAX7219_DEBUG +#if ENABLED(MAX7219_DEBUG) + #define MAX7219_CLK_PIN 64 + #define MAX7219_DIN_PIN 57 + #define MAX7219_LOAD_PIN 44 + + //#define MAX7219_GCODE // Add the M7219 G-code to control the LED matrix + #define MAX7219_INIT_TEST 2 // Do a test pattern at initialization (Set to 2 for spiral) + #define MAX7219_NUMBER_UNITS 1 // Number of Max7219 units in chain. + #define MAX7219_ROTATE 0 // Rotate the display clockwise (in multiples of +/- 90°) + // connector at: right=0 bottom=-90 top=90 left=180 + //#define MAX7219_REVERSE_ORDER // The individual LED matrix units may be in reversed order + + /** + * Sample debug features + * If you add more debug displays, be careful to avoid conflicts! + */ + #define MAX7219_DEBUG_PRINTER_ALIVE // Blink corner LED of 8x8 matrix to show that the firmware is functioning + #define MAX7219_DEBUG_PLANNER_HEAD 3 // Show the planner queue head position on this and the next LED matrix row + #define MAX7219_DEBUG_PLANNER_TAIL 5 // Show the planner queue tail position on this and the next LED matrix row + + #define MAX7219_DEBUG_PLANNER_QUEUE 0 // Show the current planner queue depth on this and the next LED matrix row + // If you experience stuttering, reboots, etc. this option can reveal how + // tweaks made to the configuration are affecting the printer in real-time. +#endif + +/** + * NanoDLP Sync support + * + * Add support for Synchronized Z moves when using with NanoDLP. G0/G1 axis moves will output "Z_move_comp" + * string to enable synchronization with DLP projector exposure. This change will allow to use + * [[WaitForDoneMessage]] instead of populating your gcode with M400 commands + */ +//#define NANODLP_Z_SYNC +#if ENABLED(NANODLP_Z_SYNC) + //#define NANODLP_ALL_AXIS // Enables "Z_move_comp" output on any axis move. + // Default behaviour is limited to Z axis only. +#endif + +/** + * WiFi Support (Espressif ESP32 WiFi) + */ +//#define WIFISUPPORT +#if ENABLED(WIFISUPPORT) + #define WIFI_SSID "Wifi SSID" + #define WIFI_PWD "Wifi Password" +#endif + +// Enable Marlin dev mode which adds some special commands +//#define MARLIN_DEV_MODE diff --git a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro B/bltouch/Configuration.h b/Marlin/src/config/examples/Geeetech/Prusa i3 Pro B/bltouch/Configuration.h index 3e11929e7a..436c1a9c97 100644 --- a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro B/bltouch/Configuration.h +++ b/Marlin/src/config/examples/Geeetech/Prusa i3 Pro B/bltouch/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -138,7 +137,7 @@ // Optional custom name for your RepStrap or other custom machine // Displayed in the LCD "Ready" message -//#define CUSTOM_MACHINE_NAME "Pi3PB-BL" +#define CUSTOM_MACHINE_NAME "i3 Pro B" // Define this to set a unique identifier for this printer, (Used by some programs to differentiate between machines) // You can use an online service to generate a random UUID. (eg http://www.uuidgenerator.net/version4) @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -788,6 +786,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -874,8 +879,9 @@ #if ENABLED(PROBING_HEATERS_OFF) //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif -#define PROBING_FANS_OFF // Turn fans off when probing -#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors +#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing +#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 // :{ 0:'Low', 1:'High' } @@ -895,8 +901,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -921,7 +927,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -988,6 +994,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1157,8 +1175,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1313,10 +1332,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 200 #define PREHEAT_1_TEMP_BED 60 #define PREHEAT_1_FAN_SPEED 170 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 110 #define PREHEAT_2_FAN_SPEED 170 // Value from 0 to 255 @@ -1445,10 +1466,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1476,6 +1497,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1840,6 +1868,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1996,5 +2033,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro B/noprobe/Configuration.h b/Marlin/src/config/examples/Geeetech/Prusa i3 Pro B/noprobe/Configuration.h index 12b2f2334d..549551f2a1 100644 --- a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro B/noprobe/Configuration.h +++ b/Marlin/src/config/examples/Geeetech/Prusa i3 Pro B/noprobe/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -138,7 +137,7 @@ // Optional custom name for your RepStrap or other custom machine // Displayed in the LCD "Ready" message -//#define CUSTOM_MACHINE_NAME "Pi3PB" +#define CUSTOM_MACHINE_NAME "i3 Pro B" // Define this to set a unique identifier for this printer, (Used by some programs to differentiate between machines) // You can use an online service to generate a random UUID. (eg http://www.uuidgenerator.net/version4) @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -787,6 +785,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -874,6 +879,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -894,8 +900,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -920,7 +926,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -987,6 +993,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1156,8 +1174,9 @@ #define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1312,10 +1331,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 200 #define PREHEAT_1_TEMP_BED 60 #define PREHEAT_1_FAN_SPEED 170 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 110 #define PREHEAT_2_FAN_SPEED 170 // Value from 0 to 255 @@ -1444,10 +1465,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1475,6 +1496,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1839,6 +1867,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1995,5 +2032,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro C/Configuration.h b/Marlin/src/config/examples/Geeetech/Prusa i3 Pro C/Configuration.h index 272f5f2197..8b50a3affb 100644 --- a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro C/Configuration.h +++ b/Marlin/src/config/examples/Geeetech/Prusa i3 Pro C/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -138,7 +137,7 @@ // Optional custom name for your RepStrap or other custom machine // Displayed in the LCD "Ready" message -#define CUSTOM_MACHINE_NAME "Pro C" +#define CUSTOM_MACHINE_NAME "i3 Pro C" // Define this to set a unique identifier for this printer, (Used by some programs to differentiate between machines) // You can use an online service to generate a random UUID. (eg http://www.uuidgenerator.net/version4) @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -772,6 +770,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -859,6 +864,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -879,8 +885,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -905,7 +911,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -972,6 +978,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1141,8 +1159,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1297,10 +1316,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 200 #define PREHEAT_1_TEMP_BED 65 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 235 #define PREHEAT_2_TEMP_BED 95 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -1429,10 +1450,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1460,6 +1481,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1824,6 +1852,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1980,5 +2017,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro C/Configuration_adv.h b/Marlin/src/config/examples/Geeetech/Prusa i3 Pro C/Configuration_adv.h index c9afc1c4e5..45760e53d2 100644 --- a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro C/Configuration_adv.h +++ b/Marlin/src/config/examples/Geeetech/Prusa i3 Pro C/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -30,8 +31,6 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -176,8 +175,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -245,7 +244,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -385,10 +384,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -413,6 +408,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -464,7 +480,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -482,6 +498,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] @@ -535,15 +562,15 @@ //=============================Additional Features=========================== //=========================================================================== -#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu #define LCD_INFO_MENU @@ -559,7 +586,7 @@ // Add an 'M73' G-code to set the current percentage //#define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -568,7 +595,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -597,7 +624,7 @@ #define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -683,6 +710,43 @@ */ //#define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -697,7 +761,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar //#define DOGM_SD_PERCENT @@ -767,16 +831,24 @@ */ #define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. + + //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -978,6 +1050,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -1003,21 +1084,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -//#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1258,11 +1360,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1271,10 +1373,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1414,6 +1524,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1556,6 +1675,33 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ @@ -1569,10 +1715,10 @@ #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "Preheat for PLA" + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "Preheat for ABS" + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) #define USER_DESC_4 "Heat Bed/Home/Level" @@ -1737,5 +1883,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro W/Configuration.h b/Marlin/src/config/examples/Geeetech/Prusa i3 Pro W/Configuration.h index 408e165241..1033325fa3 100644 --- a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro W/Configuration.h +++ b/Marlin/src/config/examples/Geeetech/Prusa i3 Pro W/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -138,7 +137,7 @@ // Optional custom name for your RepStrap or other custom machine // Displayed in the LCD "Ready" message -#define CUSTOM_MACHINE_NAME "Pro W" +#define CUSTOM_MACHINE_NAME "i3 Pro W" // Define this to set a unique identifier for this printer, (Used by some programs to differentiate between machines) // You can use an online service to generate a random UUID. (eg http://www.uuidgenerator.net/version4) @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -772,6 +770,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -859,6 +864,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -879,8 +885,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -905,7 +911,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -972,6 +978,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1141,8 +1159,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1297,10 +1316,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 200 #define PREHEAT_1_TEMP_BED 65 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 235 #define PREHEAT_2_TEMP_BED 95 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -1429,10 +1450,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1460,6 +1481,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1824,6 +1852,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1980,5 +2017,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro W/Configuration_adv.h b/Marlin/src/config/examples/Geeetech/Prusa i3 Pro W/Configuration_adv.h index c9afc1c4e5..45760e53d2 100644 --- a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro W/Configuration_adv.h +++ b/Marlin/src/config/examples/Geeetech/Prusa i3 Pro W/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -30,8 +31,6 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -176,8 +175,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -245,7 +244,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -385,10 +384,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -413,6 +408,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -464,7 +480,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -482,6 +498,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] @@ -535,15 +562,15 @@ //=============================Additional Features=========================== //=========================================================================== -#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu #define LCD_INFO_MENU @@ -559,7 +586,7 @@ // Add an 'M73' G-code to set the current percentage //#define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -568,7 +595,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -597,7 +624,7 @@ #define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -683,6 +710,43 @@ */ //#define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -697,7 +761,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar //#define DOGM_SD_PERCENT @@ -767,16 +831,24 @@ */ #define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. + + //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -978,6 +1050,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -1003,21 +1084,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -//#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1258,11 +1360,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1271,10 +1373,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1414,6 +1524,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1556,6 +1675,33 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ @@ -1569,10 +1715,10 @@ #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "Preheat for PLA" + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "Preheat for ABS" + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) #define USER_DESC_4 "Heat Bed/Home/Level" @@ -1737,5 +1883,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/examples/Infitary/i3-M508/Configuration.h b/Marlin/src/config/examples/Infitary/i3-M508/Configuration.h index d444f11d06..fb26dd6f02 100644 --- a/Marlin/src/config/examples/Infitary/i3-M508/Configuration.h +++ b/Marlin/src/config/examples/Infitary/i3-M508/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -776,6 +774,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -863,6 +868,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -883,8 +889,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -909,7 +915,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -976,6 +982,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1145,8 +1163,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1301,10 +1320,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 200 #define PREHEAT_1_TEMP_BED 50 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 245 #define PREHEAT_2_TEMP_BED 100 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -1433,10 +1454,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1464,6 +1485,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1828,6 +1856,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1984,5 +2021,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h b/Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h index c219a55623..5a1af54724 100644 --- a/Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h +++ b/Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -30,8 +31,6 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -176,8 +175,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -245,7 +244,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -385,10 +384,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -413,6 +408,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -464,7 +480,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -482,6 +498,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] @@ -535,15 +562,15 @@ //=============================Additional Features=========================== //=========================================================================== -#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu //#define LCD_INFO_MENU @@ -559,7 +586,7 @@ // Add an 'M73' G-code to set the current percentage //#define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -568,7 +595,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -597,7 +624,7 @@ #define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -683,6 +710,43 @@ */ //#define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -697,7 +761,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar //#define DOGM_SD_PERCENT @@ -767,16 +831,24 @@ */ //#define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. + + //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -978,6 +1050,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -1003,21 +1084,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -//#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1258,11 +1360,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1271,10 +1373,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1414,6 +1524,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1556,6 +1675,33 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ @@ -1569,10 +1715,10 @@ #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "Preheat for PLA" + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "Preheat for ABS" + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) #define USER_DESC_4 "Heat Bed/Home/Level" @@ -1737,5 +1883,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/examples/JGAurora/A5/Configuration.h b/Marlin/src/config/examples/JGAurora/A5/Configuration.h index 004b58a734..8838b110e6 100644 --- a/Marlin/src/config/examples/JGAurora/A5/Configuration.h +++ b/Marlin/src/config/examples/JGAurora/A5/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * JGAurora A5 configuration @@ -40,8 +41,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -208,7 +207,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -225,7 +224,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -784,6 +782,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -871,6 +876,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -891,8 +897,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -917,7 +923,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -984,6 +990,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1128,7 +1146,8 @@ #define MESH_INSET 10 // Set Mesh bounds as an inset region of the bed #define GRID_MAX_POINTS_X 5 // As suggested by DaHai, https://www.youtube.com/watch?v=CBlADPgQqL0 #define GRID_MAX_POINTS_Y GRID_MAX_POINTS_X - #define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS + + #define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS #endif // BED_LEVELING @@ -1152,8 +1171,9 @@ #define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1308,10 +1328,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 205 #define PREHEAT_1_TEMP_BED 70 #define PREHEAT_1_FAN_SPEED 255 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 110 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -1440,10 +1462,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1471,6 +1493,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1835,6 +1864,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1991,5 +2029,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/JGAurora/A5/Configuration_adv.h b/Marlin/src/config/examples/JGAurora/A5/Configuration_adv.h index bc16e78eae..9b1e77b3f7 100644 --- a/Marlin/src/config/examples/JGAurora/A5/Configuration_adv.h +++ b/Marlin/src/config/examples/JGAurora/A5/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -30,8 +31,6 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -176,8 +175,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -245,7 +244,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -385,10 +384,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -413,6 +408,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -464,7 +480,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -482,6 +498,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] @@ -535,15 +562,15 @@ //=============================Additional Features=========================== //=========================================================================== -#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu //#define LCD_INFO_MENU @@ -559,7 +586,7 @@ // Add an 'M73' G-code to set the current percentage //#define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -568,7 +595,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -597,7 +624,7 @@ #define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -683,6 +710,43 @@ */ //#define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -697,7 +761,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar //#define DOGM_SD_PERCENT @@ -767,16 +831,24 @@ */ #define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 5 // Babysteps are very small. Increase for faster motion. - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - #define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 5 // Babysteps are very small. Increase for faster motion. + + #define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -978,6 +1050,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -1003,21 +1084,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -//#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1258,11 +1360,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1271,10 +1373,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1414,6 +1524,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1556,6 +1675,33 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ @@ -1569,10 +1715,10 @@ #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "Preheat for PLA" + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "Preheat for ABS" + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) #define USER_DESC_4 "Heat Bed/Home/Level" @@ -1737,5 +1883,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/examples/MakerParts/Configuration.h b/Marlin/src/config/examples/MakerParts/Configuration.h index 5309acf40f..50f63b9bd3 100644 --- a/Marlin/src/config/examples/MakerParts/Configuration.h +++ b/Marlin/src/config/examples/MakerParts/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -223,7 +222,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -240,7 +239,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -792,6 +790,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -879,6 +884,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -899,8 +905,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -925,7 +931,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -992,6 +998,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1161,8 +1179,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1317,10 +1336,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 180 #define PREHEAT_1_TEMP_BED 70 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 110 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -1449,10 +1470,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1480,6 +1501,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1844,6 +1872,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -2000,5 +2037,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/MakerParts/Configuration_adv.h b/Marlin/src/config/examples/MakerParts/Configuration_adv.h index f5b8f3e7ca..a61dad1245 100644 --- a/Marlin/src/config/examples/MakerParts/Configuration_adv.h +++ b/Marlin/src/config/examples/MakerParts/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -30,8 +31,6 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -176,8 +175,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -245,7 +244,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -385,10 +384,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -413,6 +408,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -464,7 +480,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -482,6 +498,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] @@ -535,15 +562,15 @@ //=============================Additional Features=========================== //=========================================================================== -#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu #define LCD_INFO_MENU @@ -559,7 +586,7 @@ // Add an 'M73' G-code to set the current percentage //#define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -568,7 +595,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -597,7 +624,7 @@ #define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -683,6 +710,43 @@ */ //#define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -697,7 +761,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar //#define DOGM_SD_PERCENT @@ -767,16 +831,24 @@ */ //#define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. + + //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -978,6 +1050,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -1003,21 +1084,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -//#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1258,11 +1360,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1271,10 +1373,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1414,6 +1524,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1556,6 +1675,33 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ @@ -1569,10 +1715,10 @@ #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "Preheat for PLA" + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "Preheat for ABS" + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) #define USER_DESC_4 "Heat Bed/Home/Level" @@ -1737,5 +1883,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/examples/Malyan/M150/Configuration.h b/Marlin/src/config/examples/Malyan/M150/Configuration.h index 55001ae665..0b49502052 100644 --- a/Marlin/src/config/examples/Malyan/M150/Configuration.h +++ b/Marlin/src/config/examples/Malyan/M150/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Maylan M150 Configuration @@ -40,8 +41,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -208,7 +207,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -225,7 +224,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -792,6 +790,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -883,6 +888,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -903,8 +909,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -929,7 +935,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -996,6 +1002,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1169,8 +1187,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1325,10 +1344,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 205 #define PREHEAT_1_TEMP_BED 60 #define PREHEAT_1_FAN_SPEED 128 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 230 #define PREHEAT_2_TEMP_BED 100 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -1457,10 +1478,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1488,6 +1509,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1852,6 +1880,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -2008,5 +2045,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/Malyan/M150/Configuration_adv.h b/Marlin/src/config/examples/Malyan/M150/Configuration_adv.h index 7312924ed8..e004116714 100644 --- a/Marlin/src/config/examples/Malyan/M150/Configuration_adv.h +++ b/Marlin/src/config/examples/Malyan/M150/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -30,8 +31,6 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -176,8 +175,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -245,7 +244,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -385,10 +384,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -413,6 +408,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -464,7 +480,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -482,6 +498,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] @@ -535,15 +562,15 @@ //=============================Additional Features=========================== //=========================================================================== -#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 300 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 75 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 300 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu //#define LCD_INFO_MENU @@ -559,7 +586,7 @@ // Add an 'M73' G-code to set the current percentage //#define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -568,7 +595,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -597,7 +624,7 @@ #define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -683,6 +710,43 @@ */ //#define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -697,7 +761,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar //#define DOGM_SD_PERCENT @@ -767,16 +831,24 @@ */ //#define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. + + //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -978,6 +1050,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -1003,21 +1084,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -//#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1258,11 +1360,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1271,10 +1373,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1414,6 +1524,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1556,6 +1675,33 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ @@ -1569,10 +1715,10 @@ #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "Preheat for PLA" + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "Preheat for ABS" + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) #define USER_DESC_4 "Heat Bed/Home/Level" @@ -1737,5 +1883,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/examples/Malyan/M200/Configuration.h b/Marlin/src/config/examples/Malyan/M200/Configuration.h index 2fb325c169..f6c587e7ae 100644 --- a/Marlin/src/config/examples/Malyan/M200/Configuration.h +++ b/Marlin/src/config/examples/Malyan/M200/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -138,7 +137,7 @@ // Optional custom name for your RepStrap or other custom machine // Displayed in the LCD "Ready" message -//#define CUSTOM_MACHINE_NAME "3D Printer" +#define CUSTOM_MACHINE_NAME "Malyan M200" // Define this to set a unique identifier for this printer, (Used by some programs to differentiate between machines) // You can use an online service to generate a random UUID. (eg http://www.uuidgenerator.net/version4) @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -771,6 +769,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -858,6 +863,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -878,8 +884,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -904,7 +910,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -971,6 +977,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1140,8 +1158,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1296,10 +1315,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 180 #define PREHEAT_1_TEMP_BED 70 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 110 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -1428,10 +1449,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1459,6 +1480,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1823,6 +1851,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1979,5 +2016,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/Malyan/M200/Configuration_adv.h b/Marlin/src/config/examples/Malyan/M200/Configuration_adv.h index ab014b4658..43ef9baa22 100644 --- a/Marlin/src/config/examples/Malyan/M200/Configuration_adv.h +++ b/Marlin/src/config/examples/Malyan/M200/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -30,8 +31,6 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -176,8 +175,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -245,7 +244,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -385,10 +384,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -413,6 +408,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -464,7 +480,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -482,6 +498,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] @@ -535,15 +562,15 @@ //=============================Additional Features=========================== //=========================================================================== -#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu //#define LCD_INFO_MENU @@ -559,7 +586,7 @@ // Add an 'M73' G-code to set the current percentage //#define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -568,7 +595,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -597,7 +624,7 @@ #define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -683,6 +710,43 @@ */ //#define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -697,7 +761,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar //#define DOGM_SD_PERCENT @@ -767,16 +831,24 @@ */ //#define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. + + //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -978,6 +1050,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -1003,21 +1084,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -//#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1258,11 +1360,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1271,10 +1373,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1414,6 +1524,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1556,6 +1675,33 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ @@ -1569,10 +1715,10 @@ #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "Preheat for PLA" + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "Preheat for ABS" + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) #define USER_DESC_4 "Heat Bed/Home/Level" @@ -1737,5 +1883,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/examples/Micromake/C1/basic/Configuration.h b/Marlin/src/config/examples/Micromake/C1/basic/Configuration.h index 0189f22f11..68f6430e20 100644 --- a/Marlin/src/config/examples/Micromake/C1/basic/Configuration.h +++ b/Marlin/src/config/examples/Micromake/C1/basic/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -776,6 +774,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -863,6 +868,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -883,8 +889,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -909,7 +915,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -976,6 +982,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1145,8 +1163,9 @@ #define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1301,10 +1320,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 180 #define PREHEAT_1_TEMP_BED 70 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 110 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -1433,10 +1454,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1464,6 +1485,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1828,6 +1856,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1984,5 +2021,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration.h b/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration.h index d8903ccfa8..0e8ee1e384 100644 --- a/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration.h +++ b/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -776,6 +774,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -863,6 +868,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -883,8 +889,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -909,7 +915,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -976,6 +982,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1145,8 +1163,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1301,10 +1320,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 180 #define PREHEAT_1_TEMP_BED 70 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 110 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -1433,10 +1454,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1464,6 +1485,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1828,6 +1856,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1984,5 +2021,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h b/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h index d5021e513b..c52576d86d 100644 --- a/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h +++ b/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -30,8 +31,6 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -176,8 +175,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -245,7 +244,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -282,7 +281,7 @@ // If you want endstops to stay on (by default) even when not homing // enable this option. Override at any time with M120, M121. -#define ENDSTOPS_ALWAYS_ON_DEFAULT +//#define ENDSTOPS_ALWAYS_ON_DEFAULT // @section extras @@ -385,10 +384,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -413,6 +408,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -464,7 +480,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -482,6 +498,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] @@ -535,15 +562,15 @@ //=============================Additional Features=========================== //=========================================================================== -#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu //#define LCD_INFO_MENU @@ -559,7 +586,7 @@ // Add an 'M73' G-code to set the current percentage //#define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -568,7 +595,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -597,7 +624,7 @@ #define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -683,6 +710,43 @@ */ //#define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -697,7 +761,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar //#define DOGM_SD_PERCENT @@ -767,16 +831,24 @@ */ //#define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. + + //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -978,6 +1050,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -1003,21 +1084,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -//#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1258,11 +1360,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1271,10 +1373,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1414,6 +1524,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1556,6 +1675,33 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ @@ -1569,10 +1715,10 @@ #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "Preheat for PLA" + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "Preheat for ABS" + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) #define USER_DESC_4 "Heat Bed/Home/Level" @@ -1737,5 +1883,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/examples/Mks/Sbase/Configuration.h b/Marlin/src/config/examples/Mks/Sbase/Configuration.h index b029eda192..89368941e8 100644 --- a/Marlin/src/config/examples/Mks/Sbase/Configuration.h +++ b/Marlin/src/config/examples/Mks/Sbase/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -772,6 +770,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -859,6 +864,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -879,8 +885,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -905,7 +911,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -972,6 +978,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1141,8 +1159,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1297,10 +1316,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 180 #define PREHEAT_1_TEMP_BED 70 #define PREHEAT_1_FAN_SPEED 255 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 110 #define PREHEAT_2_FAN_SPEED 255 // Value from 0 to 255 @@ -1429,10 +1450,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1460,6 +1481,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1824,6 +1852,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1980,5 +2017,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h b/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h index 4a835e332e..52ce76c2e9 100644 --- a/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h +++ b/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -30,8 +31,6 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -176,8 +175,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -245,7 +244,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -385,10 +384,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -413,6 +408,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -464,7 +480,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -482,6 +498,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] @@ -536,15 +563,15 @@ //=============================Additional Features=========================== //=========================================================================== -#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu //#define LCD_INFO_MENU @@ -560,7 +587,7 @@ // Add an 'M73' G-code to set the current percentage //#define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -569,7 +596,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -598,7 +625,7 @@ #define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -684,6 +711,43 @@ */ //#define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -698,7 +762,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar //#define DOGM_SD_PERCENT @@ -775,16 +839,24 @@ */ //#define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. + + //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -986,6 +1058,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -1011,21 +1092,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -//#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1266,11 +1368,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1279,10 +1381,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1422,6 +1532,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1564,6 +1683,33 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ @@ -1577,10 +1723,10 @@ #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "Preheat for PLA" + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "Preheat for ABS" + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) #define USER_DESC_4 "Heat Bed/Home/Level" @@ -1745,5 +1891,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/examples/RepRapPro/Huxley/Configuration.h b/Marlin/src/config/examples/RepRapPro/Huxley/Configuration.h index 4274ed2bd3..121f9af6b7 100644 --- a/Marlin/src/config/examples/RepRapPro/Huxley/Configuration.h +++ b/Marlin/src/config/examples/RepRapPro/Huxley/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -687,7 +685,7 @@ Black rubber belt(MXL), 18 - tooth aluminium pulley : 87.489 step per mm (Huxley * Override with M203 * X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]] */ -#define DEFAULT_MAX_Z_FEEDRATE 3.3 // older Huxley has problem with speeds > 3.3 mm/s on z axis +#define DEFAULT_MAX_Z_FEEDRATE 3.3 // older Huxley has problem with speeds > 3.3 mm/s on Z axis #define DEFAULT_MAX_FEEDRATE { 200, 200, DEFAULT_MAX_Z_FEEDRATE, 25 } /** @@ -812,6 +810,13 @@ Black rubber belt(MXL), 18 - tooth aluminium pulley : 87.489 step per mm (Huxley //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -899,6 +904,7 @@ Black rubber belt(MXL), 18 - tooth aluminium pulley : 87.489 step per mm (Huxley //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -919,8 +925,8 @@ Black rubber belt(MXL), 18 - tooth aluminium pulley : 87.489 step per mm (Huxley // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -945,7 +951,7 @@ Black rubber belt(MXL), 18 - tooth aluminium pulley : 87.489 step per mm (Huxley //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -1021,6 +1027,18 @@ Black rubber belt(MXL), 18 - tooth aluminium pulley : 87.489 step per mm (Huxley #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1190,8 +1208,9 @@ Black rubber belt(MXL), 18 - tooth aluminium pulley : 87.489 step per mm (Huxley //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1346,10 +1365,12 @@ Black rubber belt(MXL), 18 - tooth aluminium pulley : 87.489 step per mm (Huxley // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 180 #define PREHEAT_1_TEMP_BED 70 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 110 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -1478,10 +1499,10 @@ Black rubber belt(MXL), 18 - tooth aluminium pulley : 87.489 step per mm (Huxley * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1509,6 +1530,13 @@ Black rubber belt(MXL), 18 - tooth aluminium pulley : 87.489 step per mm (Huxley */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1873,6 +1901,15 @@ Black rubber belt(MXL), 18 - tooth aluminium pulley : 87.489 step per mm (Huxley // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -2029,5 +2066,3 @@ Black rubber belt(MXL), 18 - tooth aluminium pulley : 87.489 step per mm (Huxley // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/RepRapWorld/Megatronics/Configuration.h b/Marlin/src/config/examples/RepRapWorld/Megatronics/Configuration.h index ddf573f085..0e54a291ef 100644 --- a/Marlin/src/config/examples/RepRapWorld/Megatronics/Configuration.h +++ b/Marlin/src/config/examples/RepRapWorld/Megatronics/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -772,6 +770,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -859,6 +864,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -879,8 +885,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -905,7 +911,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -972,6 +978,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1141,8 +1159,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1297,10 +1316,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 180 #define PREHEAT_1_TEMP_BED 70 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 110 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -1429,10 +1450,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1460,6 +1481,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1824,6 +1852,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1980,5 +2017,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/RigidBot/Configuration.h b/Marlin/src/config/examples/RigidBot/Configuration.h index 5b31d5d6c9..0f09f1459b 100644 --- a/Marlin/src/config/examples/RigidBot/Configuration.h +++ b/Marlin/src/config/examples/RigidBot/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -141,7 +140,7 @@ // Optional custom name for your RepStrap or other custom machine // Displayed in the LCD "Ready" message -//#define CUSTOM_MACHINE_NAME "3D Printer" +#define CUSTOM_MACHINE_NAME "Rigidbot" // Define this to set a unique identifier for this printer, (Used by some programs to differentiate between machines) // You can use an online service to generate a random UUID. (eg http://www.uuidgenerator.net/version4) @@ -206,7 +205,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -223,7 +222,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -770,6 +768,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -857,6 +862,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -877,8 +883,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -903,7 +909,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -970,6 +976,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1139,8 +1157,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1295,10 +1314,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 180 #define PREHEAT_1_TEMP_BED 70 #define PREHEAT_1_FAN_SPEED 255 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 110 #define PREHEAT_2_FAN_SPEED 255 // Value from 0 to 255 @@ -1427,10 +1448,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1458,6 +1479,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1824,6 +1852,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1980,5 +2017,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/RigidBot/Configuration_adv.h b/Marlin/src/config/examples/RigidBot/Configuration_adv.h index 7a8a0d3273..bbffe91bff 100644 --- a/Marlin/src/config/examples/RigidBot/Configuration_adv.h +++ b/Marlin/src/config/examples/RigidBot/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -30,8 +31,6 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -176,8 +175,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -245,7 +244,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -385,10 +384,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -413,6 +408,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -464,7 +480,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -482,6 +498,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] @@ -535,15 +562,15 @@ //=============================Additional Features=========================== //=========================================================================== -//#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -//#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -//#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu //#define LCD_INFO_MENU @@ -559,7 +586,7 @@ // Add an 'M73' G-code to set the current percentage //#define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -568,7 +595,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -597,7 +624,7 @@ #define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -683,6 +710,43 @@ */ //#define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -697,7 +761,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar //#define DOGM_SD_PERCENT @@ -767,16 +831,24 @@ */ //#define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. + + //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -978,6 +1050,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -1003,21 +1084,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -//#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1258,11 +1360,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1271,10 +1373,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1414,6 +1524,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1556,6 +1675,33 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ @@ -1569,10 +1715,10 @@ #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "Preheat for PLA" + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "Preheat for ABS" + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) #define USER_DESC_4 "Heat Bed/Home/Level" @@ -1737,5 +1883,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/examples/SCARA/Configuration.h b/Marlin/src/config/examples/SCARA/Configuration.h index 1144fc1c8d..d7aa407d15 100644 --- a/Marlin/src/config/examples/SCARA/Configuration.h +++ b/Marlin/src/config/examples/SCARA/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -169,7 +168,7 @@ // Optional custom name for your RepStrap or other custom machine // Displayed in the LCD "Ready" message -//#define CUSTOM_MACHINE_NAME "3D Printer" +#define CUSTOM_MACHINE_NAME "SCARA" // Define this to set a unique identifier for this printer, (Used by some programs to differentiate between machines) // You can use an online service to generate a random UUID. (eg http://www.uuidgenerator.net/version4) @@ -234,7 +233,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -251,7 +250,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -785,6 +783,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -872,6 +877,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -892,8 +898,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -918,7 +924,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -985,6 +991,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1154,8 +1172,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1310,10 +1329,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 180 #define PREHEAT_1_TEMP_BED 70 #define PREHEAT_1_FAN_SPEED 255 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 100 #define PREHEAT_2_FAN_SPEED 255 // Value from 0 to 255 @@ -1442,10 +1463,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1473,6 +1494,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1837,6 +1865,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1993,5 +2030,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/SCARA/Configuration_adv.h b/Marlin/src/config/examples/SCARA/Configuration_adv.h index 610a98df0e..69e626a4c2 100644 --- a/Marlin/src/config/examples/SCARA/Configuration_adv.h +++ b/Marlin/src/config/examples/SCARA/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -30,8 +31,6 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -176,8 +175,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 180 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 180 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -245,7 +244,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -385,10 +384,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -413,6 +408,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -464,7 +480,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -482,6 +498,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] @@ -535,15 +562,15 @@ //=============================Additional Features=========================== //=========================================================================== -#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu //#define LCD_INFO_MENU @@ -559,7 +586,7 @@ // Add an 'M73' G-code to set the current percentage //#define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -568,7 +595,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -597,7 +624,7 @@ #define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -683,6 +710,43 @@ */ //#define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -697,7 +761,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar //#define DOGM_SD_PERCENT @@ -767,16 +831,24 @@ */ //#define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. + + //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -978,6 +1050,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -1003,21 +1084,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 35 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -//#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1258,11 +1360,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1271,10 +1373,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1414,6 +1524,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1556,6 +1675,33 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ @@ -1569,10 +1715,10 @@ #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "Preheat for PLA" + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "Preheat for ABS" + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) #define USER_DESC_4 "Heat Bed/Home/Level" @@ -1737,5 +1883,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/examples/STM32F10/Configuration.h b/Marlin/src/config/examples/STM32F10/Configuration.h index 358ae6b5ff..0c4fadc32d 100644 --- a/Marlin/src/config/examples/STM32F10/Configuration.h +++ b/Marlin/src/config/examples/STM32F10/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -774,6 +772,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -861,6 +866,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -881,8 +887,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -907,7 +913,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -974,6 +980,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1143,8 +1161,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1299,10 +1318,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 200 #define PREHEAT_1_TEMP_BED 60 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 220 #define PREHEAT_2_TEMP_BED 100 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -1431,10 +1452,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1462,6 +1483,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1826,6 +1854,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1982,5 +2019,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/STM32F4/Configuration.h b/Marlin/src/config/examples/STM32F4/Configuration.h index e32330e7d8..9b2b35788c 100644 --- a/Marlin/src/config/examples/STM32F4/Configuration.h +++ b/Marlin/src/config/examples/STM32F4/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -114,7 +113,7 @@ * * :[-1, 0, 1, 2, 3, 4, 5, 6, 7] */ -////#define SERIAL_PORT_2 -1 +//#define SERIAL_PORT_2 -1 /** * This setting determines the communication speed of the printer. @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -772,6 +770,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -859,6 +864,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -879,8 +885,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -905,7 +911,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -972,6 +978,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1141,8 +1159,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1297,10 +1316,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 180 #define PREHEAT_1_TEMP_BED 70 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 110 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -1429,10 +1450,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1460,6 +1481,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1824,6 +1852,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1980,5 +2017,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/Sanguinololu/Configuration.h b/Marlin/src/config/examples/Sanguinololu/Configuration.h index c0eb394653..e6295d115c 100644 --- a/Marlin/src/config/examples/Sanguinololu/Configuration.h +++ b/Marlin/src/config/examples/Sanguinololu/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -803,6 +801,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -890,6 +895,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -910,8 +916,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -936,7 +942,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -1003,6 +1009,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1172,8 +1190,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1328,10 +1347,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 180 #define PREHEAT_1_TEMP_BED 70 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 110 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -1460,10 +1481,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1491,6 +1512,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1855,6 +1883,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -2011,5 +2048,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/Sanguinololu/Configuration_adv.h b/Marlin/src/config/examples/Sanguinololu/Configuration_adv.h index 4c4360f14a..dbb6e35a2a 100644 --- a/Marlin/src/config/examples/Sanguinololu/Configuration_adv.h +++ b/Marlin/src/config/examples/Sanguinololu/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -30,8 +31,6 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -176,8 +175,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -245,7 +244,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -385,10 +384,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -413,6 +408,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -464,7 +480,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -482,6 +498,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] @@ -535,15 +562,15 @@ //=============================Additional Features=========================== //=========================================================================== -#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu //#define LCD_INFO_MENU @@ -559,7 +586,7 @@ // Add an 'M73' G-code to set the current percentage //#define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -568,7 +595,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -597,7 +624,7 @@ #define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -683,6 +710,43 @@ */ //#define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -697,7 +761,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar //#define DOGM_SD_PERCENT @@ -767,16 +831,24 @@ */ //#define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. + + //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -978,6 +1050,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -1003,21 +1084,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -//#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1258,11 +1360,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1271,10 +1373,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1414,6 +1524,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1556,6 +1675,33 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ @@ -1569,10 +1715,10 @@ #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "Preheat for PLA" + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "Preheat for ABS" + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) #define USER_DESC_4 "Heat Bed/Home/Level" @@ -1737,5 +1883,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/examples/TheBorg/Configuration.h b/Marlin/src/config/examples/TheBorg/Configuration.h index e03d91fd99..33974b0b0e 100644 --- a/Marlin/src/config/examples/TheBorg/Configuration.h +++ b/Marlin/src/config/examples/TheBorg/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -772,6 +770,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -859,6 +864,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -879,8 +885,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -905,7 +911,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -972,6 +978,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1141,8 +1159,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1297,10 +1316,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 180 #define PREHEAT_1_TEMP_BED 70 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 110 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -1429,10 +1450,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1460,6 +1481,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1824,6 +1852,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1980,5 +2017,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/TheBorg/Configuration_adv.h b/Marlin/src/config/examples/TheBorg/Configuration_adv.h index ea0b6a3345..3edd7a0916 100644 --- a/Marlin/src/config/examples/TheBorg/Configuration_adv.h +++ b/Marlin/src/config/examples/TheBorg/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -30,8 +31,6 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -176,8 +175,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -245,7 +244,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -385,10 +384,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -413,6 +408,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -464,7 +480,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -482,6 +498,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] @@ -535,15 +562,15 @@ //=============================Additional Features=========================== //=========================================================================== -#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu //#define LCD_INFO_MENU @@ -559,7 +586,7 @@ // Add an 'M73' G-code to set the current percentage //#define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -568,7 +595,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -597,7 +624,7 @@ #define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -683,6 +710,43 @@ */ //#define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -697,7 +761,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar //#define DOGM_SD_PERCENT @@ -767,16 +831,24 @@ */ //#define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. + + //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -978,6 +1050,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -1003,21 +1084,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -//#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1258,11 +1360,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1271,10 +1373,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1414,6 +1524,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1556,6 +1675,33 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ @@ -1569,10 +1715,10 @@ #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "Preheat for PLA" + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "Preheat for ABS" + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) #define USER_DESC_4 "Heat Bed/Home/Level" @@ -1737,5 +1883,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/examples/TinyBoy2/Configuration.h b/Marlin/src/config/examples/TinyBoy2/Configuration.h index 460b7eaff7..ea0f352169 100644 --- a/Marlin/src/config/examples/TinyBoy2/Configuration.h +++ b/Marlin/src/config/examples/TinyBoy2/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 /** @@ -225,7 +224,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -242,7 +241,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -823,6 +821,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -910,6 +915,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -930,8 +936,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -956,7 +962,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -1028,6 +1034,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1197,8 +1215,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1353,10 +1372,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 180 #define PREHEAT_1_TEMP_BED 70 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 90 // TB2: ABS default 110, 90 is the maximum temp at 12V supply #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -1485,10 +1506,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1516,6 +1537,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1880,6 +1908,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -2036,5 +2073,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h b/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h index 0649e0d975..0ba72fcf81 100644 --- a/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h +++ b/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -30,8 +31,6 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -176,8 +175,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -245,7 +244,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -385,10 +384,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -413,6 +408,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -464,7 +480,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -482,6 +498,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] @@ -535,15 +562,15 @@ //=============================Additional Features=========================== //=========================================================================== -#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu #define LCD_INFO_MENU @@ -559,7 +586,7 @@ // Add an 'M73' G-code to set the current percentage //#define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -568,7 +595,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -597,7 +624,7 @@ #define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -683,6 +710,43 @@ */ //#define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -697,7 +761,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar //#define DOGM_SD_PERCENT @@ -767,16 +831,24 @@ */ //#define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. + + //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -978,6 +1050,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -1003,21 +1084,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -//#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1258,11 +1360,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1271,10 +1373,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1414,6 +1524,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1556,6 +1675,33 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ @@ -1569,10 +1715,10 @@ #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "Preheat for PLA" + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "Preheat for ABS" + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) #define USER_DESC_4 "Heat Bed/Home/Level" @@ -1737,5 +1883,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/examples/Tronxy/X1/Configuration.h b/Marlin/src/config/examples/Tronxy/X1/Configuration.h index b7417b8726..9efc861d0b 100644 --- a/Marlin/src/config/examples/Tronxy/X1/Configuration.h +++ b/Marlin/src/config/examples/Tronxy/X1/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -772,6 +770,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -859,6 +864,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -879,8 +885,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -905,7 +911,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -972,6 +978,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1141,8 +1159,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1297,10 +1316,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 180 #define PREHEAT_1_TEMP_BED 70 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 110 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -1429,10 +1450,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1460,6 +1481,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1824,6 +1852,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1980,5 +2017,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/Tronxy/X3A/Configuration.h b/Marlin/src/config/examples/Tronxy/X3A/Configuration.h index b8e5810200..bb2f3a8fa9 100644 --- a/Marlin/src/config/examples/Tronxy/X3A/Configuration.h +++ b/Marlin/src/config/examples/Tronxy/X3A/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -772,6 +770,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -859,6 +864,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -879,8 +885,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -905,7 +911,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -976,6 +982,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1145,8 +1163,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1301,10 +1320,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 210 #define PREHEAT_1_TEMP_BED 60 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 225 #define PREHEAT_2_TEMP_BED 85 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -1433,10 +1454,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1464,6 +1485,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1828,6 +1856,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1984,5 +2021,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/Tronxy/X3A/Configuration_adv.h b/Marlin/src/config/examples/Tronxy/X3A/Configuration_adv.h index 1f3e26c0e0..275daa415a 100644 --- a/Marlin/src/config/examples/Tronxy/X3A/Configuration_adv.h +++ b/Marlin/src/config/examples/Tronxy/X3A/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -30,8 +31,6 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -176,8 +175,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -245,7 +244,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -385,10 +384,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -413,6 +408,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -464,7 +480,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -482,6 +498,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] @@ -535,15 +562,15 @@ //=============================Additional Features=========================== //=========================================================================== -#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu //#define LCD_INFO_MENU @@ -559,7 +586,7 @@ // Add an 'M73' G-code to set the current percentage //#define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -568,7 +595,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -597,7 +624,7 @@ #define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -683,6 +710,43 @@ */ //#define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -697,7 +761,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar //#define DOGM_SD_PERCENT @@ -767,16 +831,24 @@ */ //#define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. + + //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -978,6 +1050,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -1003,21 +1084,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -//#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1258,11 +1360,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1271,10 +1373,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1414,6 +1524,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1556,6 +1675,33 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ @@ -1569,10 +1715,10 @@ #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "Preheat for PLA" + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "Preheat for ABS" + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) #define USER_DESC_4 "Heat Bed/Home/Level" @@ -1737,5 +1883,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/examples/Tronxy/X5S/Configuration.h b/Marlin/src/config/examples/Tronxy/X5S/Configuration.h index 2432122f3a..2bd0f9f111 100644 --- a/Marlin/src/config/examples/Tronxy/X5S/Configuration.h +++ b/Marlin/src/config/examples/Tronxy/X5S/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -772,6 +770,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -859,6 +864,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -879,8 +885,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -905,7 +911,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 10 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 10 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -972,6 +978,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1141,8 +1159,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1297,10 +1316,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 180 #define PREHEAT_1_TEMP_BED 50 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 110 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -1429,10 +1450,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1460,6 +1481,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1824,6 +1852,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1980,5 +2017,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/Tronxy/XY100/Configuration.h b/Marlin/src/config/examples/Tronxy/XY100/Configuration.h index 3794b5006c..023befcb05 100644 --- a/Marlin/src/config/examples/Tronxy/XY100/Configuration.h +++ b/Marlin/src/config/examples/Tronxy/XY100/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -783,6 +781,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -870,6 +875,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -890,8 +896,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -916,7 +922,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -983,6 +989,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1152,8 +1170,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1308,10 +1327,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 200 #define PREHEAT_1_TEMP_BED 70 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 110 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -1440,10 +1461,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1471,6 +1492,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1835,6 +1863,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1991,5 +2028,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/UltiMachine/Archim1/Configuration.h b/Marlin/src/config/examples/UltiMachine/Archim1/Configuration.h new file mode 100644 index 0000000000..1b8d9555f5 --- /dev/null +++ b/Marlin/src/config/examples/UltiMachine/Archim1/Configuration.h @@ -0,0 +1,2019 @@ +/** + * 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 . + * + */ +#pragma once + +/** + * Configuration.h + * + * Basic settings such as: + * + * - Type of electronics + * - Type of temperature sensor + * - Printer geometry + * - Endstop configuration + * - LCD controller + * - Extra features + * + * Advanced settings can be found in Configuration_adv.h + * + */ +#define CONFIGURATION_H_VERSION 020000 + +//=========================================================================== +//============================= Getting Started ============================= +//=========================================================================== + +/** + * Here are some standard links for getting your machine calibrated: + * + * http://reprap.org/wiki/Calibration + * http://youtu.be/wAL9d7FgInk + * http://calculator.josefprusa.cz + * http://reprap.org/wiki/Triffid_Hunter%27s_Calibration_Guide + * http://www.thingiverse.com/thing:5573 + * https://sites.google.com/site/repraplogphase/calibration-of-your-reprap + * http://www.thingiverse.com/thing:298812 + */ + +//=========================================================================== +//============================= DELTA Printer =============================== +//=========================================================================== +// For a Delta printer start with one of the configuration files in the +// config/examples/delta directory and customize for your machine. +// + +//=========================================================================== +//============================= SCARA Printer =============================== +//=========================================================================== +// For a SCARA printer start with the configuration files in +// config/examples/SCARA and customize for your machine. +// + +// @section info + +// User-specified version info of this build to display in [Pronterface, etc] terminal window during +// startup. Implementation of an idea by Prof Braino to inform user that any changes made to this +// build by the user have been successfully uploaded into firmware. +#define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes. +#define SHOW_BOOTSCREEN +#define STRING_SPLASH_LINE1 SHORT_BUILD_VERSION // will be shown during bootup in line 1 +#define STRING_SPLASH_LINE2 WEBSITE_URL // will be shown during bootup in line 2 + +/** + * *** VENDORS PLEASE READ *** + * + * Marlin allows you to add a custom boot image for Graphical LCDs. + * With this option Marlin will first show your custom screen followed + * by the standard Marlin logo with version number and web URL. + * + * We encourage you to take advantage of this new feature and we also + * respectfully request that you retain the unmodified Marlin boot screen. + */ + +// Enable to show the bitmap in Marlin/_Bootscreen.h on startup. +//#define SHOW_CUSTOM_BOOTSCREEN + +// Enable to show the bitmap in Marlin/_Statusscreen.h on the status screen. +//#define CUSTOM_STATUS_SCREEN_IMAGE + +// @section machine + +/** + * Select the serial port on the board to use for communication with the host. + * This allows the connection of wireless adapters (for instance) to non-default port pins. + * Note: The first serial port (-1 or 0) will always be used by the Arduino bootloader. + * + * :[-1, 0, 1, 2, 3, 4, 5, 6, 7] + */ +#define SERIAL_PORT -1 + +/** + * Select a secondary serial port on the board to use for communication with the host. + * This allows the connection of wireless adapters (for instance) to non-default port pins. + * Serial port -1 is the USB emulated serial port, if available. + * + * :[-1, 0, 1, 2, 3, 4, 5, 6, 7] + */ +//#define SERIAL_PORT_2 -1 + +/** + * This setting determines the communication speed of the printer. + * + * 250000 works in most cases, but you might try a lower speed if + * you commonly experience drop-outs during host printing. + * You may try up to 1000000 to speed up SD file transfer. + * + * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000] + */ +#define BAUDRATE 250000 + +// Enable the Bluetooth serial interface on AT90USB devices +//#define BLUETOOTH + +// The following define selects which electronics board you have. +// Please choose the name from boards.h that matches your setup +#ifndef MOTHERBOARD + #define MOTHERBOARD BOARD_ARCHIM1 +#endif + +// Optional custom name for your RepStrap or other custom machine +// Displayed in the LCD "Ready" message +//#define CUSTOM_MACHINE_NAME "3D Printer" + +// Define this to set a unique identifier for this printer, (Used by some programs to differentiate between machines) +// You can use an online service to generate a random UUID. (eg http://www.uuidgenerator.net/version4) +//#define MACHINE_UUID "00000000-0000-0000-0000-000000000000" + +// @section extruder + +// This defines the number of extruders +// :[1, 2, 3, 4, 5, 6] +#define EXTRUDERS 1 + +// Generally expected filament diameter (1.75, 2.85, 3.0, ...). Used for Volumetric, Filament Width Sensor, etc. +#define DEFAULT_NOMINAL_FILAMENT_DIA 3.0 + +// For Cyclops or any "multi-extruder" that shares a single nozzle. +//#define SINGLENOZZLE + +/** + * Průša MK2 Single Nozzle Multi-Material Multiplexer, and variants. + * + * This device allows one stepper driver on a control board to drive + * two to eight stepper motors, one at a time, in a manner suitable + * for extruders. + * + * This option only allows the multiplexer to switch on tool-change. + * Additional options to configure custom E moves are pending. + */ +//#define MK2_MULTIPLEXER +#if ENABLED(MK2_MULTIPLEXER) + // Override the default DIO selector pins here, if needed. + // Some pins files may provide defaults for these pins. + //#define E_MUX0_PIN 40 // Always Required + //#define E_MUX1_PIN 42 // Needed for 3 to 8 inputs + //#define E_MUX2_PIN 44 // Needed for 5 to 8 inputs +#endif + +// A dual extruder that uses a single stepper motor +//#define SWITCHING_EXTRUDER +#if ENABLED(SWITCHING_EXTRUDER) + #define SWITCHING_EXTRUDER_SERVO_NR 0 + #define SWITCHING_EXTRUDER_SERVO_ANGLES { 0, 90 } // Angles for E0, E1[, E2, E3] + #if EXTRUDERS > 3 + #define SWITCHING_EXTRUDER_E23_SERVO_NR 1 + #endif +#endif + +// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +//#define SWITCHING_NOZZLE +#if ENABLED(SWITCHING_NOZZLE) + #define SWITCHING_NOZZLE_SERVO_NR 0 + #define SWITCHING_NOZZLE_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 +#endif + +/** + * Two separate X-carriages with extruders that connect to a moving part + * via a magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + */ +//#define PARKING_EXTRUDER +#if ENABLED(PARKING_EXTRUDER) + #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage + #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil + #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders + #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 +#endif + +/** + * Switching Toolhead + * + * Support for swappable and dockable toolheads, such as + * the E3D Tool Changer. Toolheads are locked with a servo. + */ +//#define SWITCHING_TOOLHEAD +#if ENABLED(SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_SERVO_NR 2 // Index of the servo connector + #define SWITCHING_TOOLHEAD_SERVO_ANGLES { 0, 180 } // (degrees) Angles for Lock, Unlock + #define SWITCHING_TOOLHEAD_Y_POS 235 // (mm) Y position of the toolhead dock + #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis + #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders +#endif + +/** + * "Mixing Extruder" + * - Adds G-codes M163 and M164 to set and "commit" the current mix factors. + * - Extends the stepping routines to move multiple steppers in proportion to the mix. + * - Optional support for Repetier Firmware's 'M164 S' supporting virtual tools. + * - This implementation supports up to two mixing extruders. + * - Enable DIRECT_MIXING_IN_G1 for M165 and mixing in G1 (from Pia Taubert's reference implementation). + */ +//#define MIXING_EXTRUDER +#if ENABLED(MIXING_EXTRUDER) + #define MIXING_STEPPERS 2 // Number of steppers in your mixing extruder + #define MIXING_VIRTUAL_TOOLS 16 // Use the Virtual Tool method with M163 and M164 + //#define DIRECT_MIXING_IN_G1 // Allow ABCDHI mix factors in G1 movement commands +#endif + +// Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing). +// The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder). +// For the other hotends it is their distance from the extruder 0 hotend. +//#define HOTEND_OFFSET_X {0.0, 20.00} // (mm) relative X-offset for each nozzle +//#define HOTEND_OFFSET_Y {0.0, 5.00} // (mm) relative Y-offset for each nozzle +//#define HOTEND_OFFSET_Z {0.0, 0.00} // (mm) relative Z-offset for each nozzle + +// @section machine + +/** + * Select your power supply here. Use 0 if you haven't connected the PS_ON_PIN + * + * 0 = No Power Switch + * 1 = ATX + * 2 = X-Box 360 203Watts (the blue wire connected to PS_ON and the red wire to VCC) + * + * :{ 0:'No power switch', 1:'ATX', 2:'X-Box 360' } + */ +#define POWER_SUPPLY 0 + +#if POWER_SUPPLY > 0 + // Enable this option to leave the PSU off at startup. + // Power to steppers and heaters will need to be turned on with M80. + //#define PS_DEFAULT_OFF + + //#define AUTO_POWER_CONTROL // Enable automatic control of the PS_ON pin + #if ENABLED(AUTO_POWER_CONTROL) + #define AUTO_POWER_FANS // Turn on PSU if fans need power + #define AUTO_POWER_E_FANS + #define AUTO_POWER_CONTROLLERFAN + #define POWER_TIMEOUT 30 + #endif + +#endif + +// @section temperature + +//=========================================================================== +//============================= Thermal Settings ============================ +//=========================================================================== + +/** + * --NORMAL IS 4.7kohm PULLUP!-- 1kohm pullup can be used on hotend sensor, using correct resistor and table + * + * Temperature sensors available: + * + * -4 : thermocouple with AD8495 + * -3 : thermocouple with MAX31855 (only for sensor 0) + * -2 : thermocouple with MAX6675 (only for sensor 0) + * -1 : thermocouple with AD595 + * 0 : not used + * 1 : 100k thermistor - best choice for EPCOS 100k (4.7k pullup) + * 2 : 200k thermistor - ATC Semitec 204GT-2 (4.7k pullup) + * 3 : Mendel-parts thermistor (4.7k pullup) + * 4 : 10k thermistor !! do not use it for a hotend. It gives bad resolution at high temp. !! + * 5 : 100K thermistor - ATC Semitec 104GT-2/104NT-4-R025H42G (Used in ParCan & J-Head) (4.7k pullup) + * 501 : 100K Zonestar (Tronxy X3A) Thermistor + * 6 : 100k EPCOS - Not as accurate as table 1 (created using a fluke thermocouple) (4.7k pullup) + * 7 : 100k Honeywell thermistor 135-104LAG-J01 (4.7k pullup) + * 71 : 100k Honeywell thermistor 135-104LAF-J01 (4.7k pullup) + * 8 : 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) + * 9 : 100k GE Sensing AL03006-58.2K-97-G1 (4.7k pullup) + * 10 : 100k RS thermistor 198-961 (4.7k pullup) + * 11 : 100k beta 3950 1% thermistor (4.7k pullup) + * 12 : 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed) + * 13 : 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE" + * 15 : 100k thermistor calibration for JGAurora A5 hotend + * 20 : the PT100 circuit found in the Ultimainboard V2.x + * 60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950 + * 66 : 4.7M High Temperature thermistor from Dyze Design + * 70 : the 100K thermistor found in the bq Hephestos 2 + * 75 : 100k Generic Silicon Heat Pad with NTC 100K MGB18-104F39050L32 thermistor + * + * 1k ohm pullup tables - This is atypical, and requires changing out the 4.7k pullup for 1k. + * (but gives greater accuracy and more stable PID) + * 51 : 100k thermistor - EPCOS (1k pullup) + * 52 : 200k thermistor - ATC Semitec 204GT-2 (1k pullup) + * 55 : 100k thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (1k pullup) + * + * 1047 : Pt1000 with 4k7 pullup + * 1010 : Pt1000 with 1k pullup (non standard) + * 147 : Pt100 with 4k7 pullup + * 110 : Pt100 with 1k pullup (non standard) + * + * Use these for Testing or Development purposes. NEVER for production machine. + * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. + * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. + * + * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + */ +#define TEMP_SENSOR_0 1 +#define TEMP_SENSOR_1 0 +#define TEMP_SENSOR_2 0 +#define TEMP_SENSOR_3 0 +#define TEMP_SENSOR_4 0 +#define TEMP_SENSOR_5 0 +#define TEMP_SENSOR_BED 0 +#define TEMP_SENSOR_CHAMBER 0 + +// Dummy thermistor constant temperature readings, for use with 998 and 999 +#define DUMMY_THERMISTOR_998_VALUE 25 +#define DUMMY_THERMISTOR_999_VALUE 100 + +// Use temp sensor 1 as a redundant sensor with sensor 0. If the readings +// from the two sensors differ too much the print will be aborted. +//#define TEMP_SENSOR_1_AS_REDUNDANT +#define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 + +// Extruder temperature must be close to target for this long before M109 returns success +#define TEMP_RESIDENCY_TIME 10 // (seconds) +#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one +#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. + +// Bed temperature must be close to target for this long before M190 returns success +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) +#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one +#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. + +// The minimal temperature defines the temperature below which the heater will not be enabled It is used +// to check that the wiring to the thermistor is not broken. +// Otherwise this would lead to the heater being powered on all the time. +#define HEATER_0_MINTEMP 5 +#define HEATER_1_MINTEMP 5 +#define HEATER_2_MINTEMP 5 +#define HEATER_3_MINTEMP 5 +#define HEATER_4_MINTEMP 5 +#define HEATER_5_MINTEMP 5 +#define BED_MINTEMP 5 + +// When temperature exceeds max temp, your heater will be switched off. +// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! +// You should use MINTEMP for thermistor short/failure protection. +#define HEATER_0_MAXTEMP 275 +#define HEATER_1_MAXTEMP 275 +#define HEATER_2_MAXTEMP 275 +#define HEATER_3_MAXTEMP 275 +#define HEATER_4_MAXTEMP 275 +#define HEATER_5_MAXTEMP 275 +#define BED_MAXTEMP 150 + +//=========================================================================== +//============================= PID Settings ================================ +//=========================================================================== +// PID Tuning Guide here: http://reprap.org/wiki/PID_Tuning + +// Comment the following line to disable PID and enable bang-bang. +#define PIDTEMP +#define BANG_MAX 255 // Limits current to nozzle while in bang-bang mode; 255=full current +#define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current +#define PID_K1 0.95 // Smoothing factor within any PID loop +#if ENABLED(PIDTEMP) + //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. + //#define PID_DEBUG // Sends debug data to the serial port. + //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX + //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders) + // Set/get with gcode: M301 E[extruder number, 0-2] + #define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature + // is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max. + + // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it + + // Ultimaker + #define DEFAULT_Kp 22.2 + #define DEFAULT_Ki 1.08 + #define DEFAULT_Kd 114 + + // MakerGear + //#define DEFAULT_Kp 7.0 + //#define DEFAULT_Ki 0.1 + //#define DEFAULT_Kd 12 + + // Mendel Parts V9 on 12V + //#define DEFAULT_Kp 63.0 + //#define DEFAULT_Ki 2.25 + //#define DEFAULT_Kd 440 + +#endif // PIDTEMP + +//=========================================================================== +//============================= PID > Bed Temperature Control =============== +//=========================================================================== + +/** + * PID Bed Heating + * + * If this option is enabled set PID constants below. + * If this option is disabled, bang-bang will be used and BED_LIMIT_SWITCHING will enable hysteresis. + * + * The PID frequency will be the same as the extruder PWM. + * If PID_dT is the default, and correct for the hardware/configuration, that means 7.689Hz, + * which is fine for driving a square wave into a resistive load and does not significantly + * impact FET heating. This also works fine on a Fotek SSR-10DA Solid State Relay into a 250W + * heater. If your configuration is significantly different than this and you don't understand + * the issues involved, don't use bed PID until someone else verifies that your hardware works. + */ +//#define PIDTEMPBED + +//#define BED_LIMIT_SWITCHING + +/** + * Max Bed Power + * Applies to all forms of bed control (PID, bang-bang, and bang-bang with hysteresis). + * When set to any value below 255, enables a form of PWM to the bed that acts like a divider + * so don't use it unless you are OK with PWM on your bed. (See the comment on enabling PIDTEMPBED) + */ +#define MAX_BED_POWER 255 // limits duty cycle to bed; 255=full current + +#if ENABLED(PIDTEMPBED) + + //#define PID_BED_DEBUG // Sends debug data to the serial port. + + //120V 250W silicone heater into 4mm borosilicate (MendelMax 1.5+) + //from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10) + #define DEFAULT_bedKp 10.00 + #define DEFAULT_bedKi .023 + #define DEFAULT_bedKd 305.4 + + //120V 250W silicone heater into 4mm borosilicate (MendelMax 1.5+) + //from pidautotune + //#define DEFAULT_bedKp 97.1 + //#define DEFAULT_bedKi 1.41 + //#define DEFAULT_bedKd 1675.16 + + // FIND YOUR OWN: "M303 E-1 C8 S90" to run autotune on the bed at 90 degreesC for 8 cycles. +#endif // PIDTEMPBED + +// @section extruder + +/** + * Prevent extrusion if the temperature is below EXTRUDE_MINTEMP. + * Add M302 to set the minimum extrusion temperature and/or turn + * cold extrusion prevention on and off. + * + * *** IT IS HIGHLY RECOMMENDED TO LEAVE THIS OPTION ENABLED! *** + */ +#define PREVENT_COLD_EXTRUSION +#define EXTRUDE_MINTEMP 170 + +/** + * Prevent a single extrusion longer than EXTRUDE_MAXLENGTH. + * Note: For Bowden Extruders make this large enough to allow load/unload. + */ +#define PREVENT_LENGTHY_EXTRUDE +#define EXTRUDE_MAXLENGTH 200 + +//=========================================================================== +//======================== Thermal Runaway Protection ======================= +//=========================================================================== + +/** + * Thermal Protection provides additional protection to your printer from damage + * and fire. Marlin always includes safe min and max temperature ranges which + * protect against a broken or disconnected thermistor wire. + * + * The issue: If a thermistor falls out, it will report the much lower + * temperature of the air in the room, and the the firmware will keep + * the heater on. + * + * If you get "Thermal Runaway" or "Heating failed" errors the + * details can be tuned in Configuration_adv.h + */ + +#define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders +#define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed + +//=========================================================================== +//============================= Mechanical Settings ========================= +//=========================================================================== + +// @section machine + +// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics +// either in the usual order or reversed +//#define COREXY +//#define COREXZ +//#define COREYZ +//#define COREYX +//#define COREZX +//#define COREZY + +//=========================================================================== +//============================== Endstop Settings =========================== +//=========================================================================== + +// @section homing + +// Specify here all the endstop connectors that are connected to any endstop or probe. +// Almost all printers will be using one per axis. Probes will use one or more of the +// extra connectors. Leave undefined any used for non-endstop and non-probe purposes. +#define USE_XMIN_PLUG +#define USE_YMIN_PLUG +#define USE_ZMIN_PLUG +//#define USE_XMAX_PLUG +//#define USE_YMAX_PLUG +//#define USE_ZMAX_PLUG + +// Enable pullup for all endstops to prevent a floating state +#define ENDSTOPPULLUPS +#if DISABLED(ENDSTOPPULLUPS) + // Disable ENDSTOPPULLUPS to set pullups individually + //#define ENDSTOPPULLUP_XMAX + //#define ENDSTOPPULLUP_YMAX + //#define ENDSTOPPULLUP_ZMAX + //#define ENDSTOPPULLUP_XMIN + //#define ENDSTOPPULLUP_YMIN + //#define ENDSTOPPULLUP_ZMIN + //#define ENDSTOPPULLUP_ZMIN_PROBE +#endif + +// Enable pulldown for all endstops to prevent a floating state +//#define ENDSTOPPULLDOWNS +#if DISABLED(ENDSTOPPULLDOWNS) + // Disable ENDSTOPPULLDOWNS to set pulldowns individually + //#define ENDSTOPPULLDOWN_XMAX + //#define ENDSTOPPULLDOWN_YMAX + //#define ENDSTOPPULLDOWN_ZMAX + //#define ENDSTOPPULLDOWN_XMIN + //#define ENDSTOPPULLDOWN_YMIN + //#define ENDSTOPPULLDOWN_ZMIN + //#define ENDSTOPPULLDOWN_ZMIN_PROBE +#endif + +// Mechanical endstop with COM to ground and NC to Signal uses "false" here (most common setup). +#define X_MIN_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. +#define Y_MIN_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. +#define Z_MIN_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. +#define X_MAX_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. +#define Y_MAX_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. +#define Z_MAX_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. +#define Z_MIN_PROBE_ENDSTOP_INVERTING false // set to true to invert the logic of the probe. + +/** + * Stepper Drivers + * + * These settings allow Marlin to tune stepper driver timing and enable advanced options for + * stepper drivers that support them. You may also override timing options in Configuration_adv.h. + * + * A4988 is assumed for unspecified drivers. + * + * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, + * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, + * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, + * TMC5130, TMC5130_STANDALONE + * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + */ +#define X_DRIVER_TYPE DRV8825 +#define Y_DRIVER_TYPE DRV8825 +#define Z_DRIVER_TYPE DRV8825 +#define X2_DRIVER_TYPE DRV8825 +#define Y2_DRIVER_TYPE DRV8825 +#define Z2_DRIVER_TYPE DRV8825 +//#define Z3_DRIVER_TYPE DRV8825 +#define E0_DRIVER_TYPE DRV8825 +#define E1_DRIVER_TYPE DRV8825 +#define E2_DRIVER_TYPE DRV8825 +#define E3_DRIVER_TYPE DRV8825 +//#define E4_DRIVER_TYPE DRV8825 +//#define E5_DRIVER_TYPE DRV8825 + +// Enable this feature if all enabled endstop pins are interrupt-capable. +// This will remove the need to poll the interrupt pins, saving many CPU cycles. +//#define ENDSTOP_INTERRUPTS_FEATURE + +/** + * Endstop Noise Threshold + * + * Enable if your probe or endstops falsely trigger due to noise. + * + * - Higher values may affect repeatability or accuracy of some bed probes. + * - To fix noise install a 100nF ceramic capacitor inline with the switch. + * - This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, which already have the 100nF capacitor. + * + * :[2,3,4,5,6,7] + */ +//#define ENDSTOP_NOISE_THRESHOLD 2 + +//============================================================================= +//============================== Movement Settings ============================ +//============================================================================= +// @section motion + +/** + * Default Settings + * + * These settings can be reset by M502 + * + * Note that if EEPROM is enabled, saved values will override these. + */ + +/** + * With this option each E stepper can have its own factors for the + * following movement settings. If fewer factors are given than the + * total number of extruders, the last value applies to the rest. + */ +//#define DISTINCT_E_FACTORS + +/** + * Default Axis Steps Per Unit (steps/mm) + * Override with M92 + * X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]] + */ +#define DEFAULT_AXIS_STEPS_PER_UNIT { 200, 200, 800, 500 } + +/** + * Default Max Feed Rate (mm/s) + * Override with M203 + * X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]] + */ +#define DEFAULT_MAX_FEEDRATE { 300, 300, 5, 25 } + +/** + * Default Max Acceleration (change/s) change = mm/s + * (Maximum start speed for accelerated moves) + * Override with M201 + * X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]] + */ +#define DEFAULT_MAX_ACCELERATION { 3000, 3000, 100, 10000 } + +/** + * Default Acceleration (change/s) change = mm/s + * Override with M204 + * + * M204 P Acceleration + * M204 R Retract Acceleration + * M204 T Travel Acceleration + */ +#define DEFAULT_ACCELERATION 3000 // X, Y, Z and E acceleration for printing moves +#define DEFAULT_RETRACT_ACCELERATION 3000 // E acceleration for retracts +#define DEFAULT_TRAVEL_ACCELERATION 3000 // X, Y, Z acceleration for travel (non printing) moves + +/** + * Default Jerk (mm/s) + * Override with M205 X Y Z E + * + * "Jerk" specifies the minimum speed change that requires acceleration. + * When changing speed and direction, if the difference is less than the + * value set here, it may happen instantaneously. + */ +#define DEFAULT_XJERK 10.0 +#define DEFAULT_YJERK 10.0 +#define DEFAULT_ZJERK 0.3 +#define DEFAULT_EJERK 5.0 + +/** + * S-Curve Acceleration + * + * This option eliminates vibration during printing by fitting a Bézier + * curve to move acceleration, producing much smoother direction changes. + * + * See https://github.com/synthetos/TinyG/wiki/Jerk-Controlled-Motion-Explained + */ +//#define S_CURVE_ACCELERATION + +//=========================================================================== +//============================= Z Probe Options ============================= +//=========================================================================== +// @section probes + +// +// See http://marlinfw.org/docs/configuration/probes.html +// + +/** + * Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN + * + * Enable this option for a probe connected to the Z Min endstop pin. + */ +#define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN + +/** + * Z_MIN_PROBE_ENDSTOP + * + * Enable this option for a probe connected to any pin except Z-Min. + * (By default Marlin assumes the Z-Max endstop pin.) + * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * + * - The simplest option is to use a free endstop connector. + * - Use 5V for powered (usually inductive) sensors. + * + * - RAMPS 1.3/1.4 boards may use the 5V, GND, and Aux4->D32 pin: + * - For simple switches connect... + * - normally-closed switches to GND and D32. + * - normally-open switches to 5V and D32. + * + * WARNING: Setting the wrong pin may have unexpected and potentially + * disastrous consequences. Use with caution and do your homework. + * + */ +//#define Z_MIN_PROBE_ENDSTOP + +/** + * Probe Type + * + * Allen Key Probes, Servo Probes, Z-Sled Probes, FIX_MOUNTED_PROBE, etc. + * Activate one of these to use Auto Bed Leveling below. + */ + +/** + * The "Manual Probe" provides a means to do "Auto" Bed Leveling without a probe. + * Use G29 repeatedly, adjusting the Z height at each point with movement commands + * or (with LCD_BED_LEVELING) the LCD controller. + */ +//#define PROBE_MANUALLY +//#define MANUAL_PROBE_START_Z 0.2 + +/** + * A Fix-Mounted Probe either doesn't deploy or needs manual deployment. + * (e.g., an inductive probe or a nozzle-based probe-switch.) + */ +//#define FIX_MOUNTED_PROBE + +/** + * Z Servo Probe, such as an endstop switch on a rotating arm. + */ +//#define Z_PROBE_SERVO_NR 0 // Defaults to SERVO 0 connector. +//#define Z_SERVO_ANGLES {70,0} // Z Servo Deploy and Stow angles + +/** + * The BLTouch probe uses a Hall effect sensor and emulates a servo. + */ +//#define BLTOUCH +#if ENABLED(BLTOUCH) + //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed +#endif + +// A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) +//#define SOLENOID_PROBE + +// A sled-mounted probe like those designed by Charles Bell. +//#define Z_PROBE_SLED +//#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. + +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + +// +// For Z_PROBE_ALLEN_KEY see the Delta example configurations. +// + +/** + * Z Probe to nozzle (X,Y) offset, relative to (0, 0). + * X and Y offsets must be integers. + * + * In the following example the X and Y offsets are both positive: + * #define X_PROBE_OFFSET_FROM_EXTRUDER 10 + * #define Y_PROBE_OFFSET_FROM_EXTRUDER 10 + * + * +-- BACK ---+ + * | | + * L | (+) P | R <-- probe (20,20) + * E | | I + * F | (-) N (+) | G <-- nozzle (10,10) + * T | | H + * | (-) | T + * | | + * O-- FRONT --+ + * (0,0) + */ +#define X_PROBE_OFFSET_FROM_EXTRUDER 10 // X offset: -left +right [of the nozzle] +#define Y_PROBE_OFFSET_FROM_EXTRUDER 10 // Y offset: -front +behind [the nozzle] +#define Z_PROBE_OFFSET_FROM_EXTRUDER 0 // Z offset: -below +above [the nozzle] + +// Certain types of probes need to stay away from edges +#define MIN_PROBE_EDGE 10 + +// X and Y axis travel speed (mm/m) between probes +#define XY_PROBE_SPEED 8000 + +// Feedrate (mm/m) for the first approach when double-probing (MULTIPLE_PROBING == 2) +#define Z_PROBE_SPEED_FAST HOMING_FEEDRATE_Z + +// Feedrate (mm/m) for the "accurate" probe of each point +#define Z_PROBE_SPEED_SLOW (Z_PROBE_SPEED_FAST / 2) + +// The number of probes to perform at each point. +// Set to 2 for a fast/slow probe, using the second probe result. +// Set to 3 or more for slow probes, averaging the results. +//#define MULTIPLE_PROBING 2 + +/** + * Z probes require clearance when deploying, stowing, and moving between + * probe points to avoid hitting the bed and other hardware. + * Servo-mounted probes require extra space for the arm to rotate. + * Inductive probes need space to keep from triggering early. + * + * Use these settings to specify the distance (mm) to raise the probe (or + * lower the bed). The values set here apply over and above any (negative) + * probe Z Offset set with Z_PROBE_OFFSET_FROM_EXTRUDER, M851, or the LCD. + * Only integer values >= 1 are valid here. + * + * Example: `M851 Z-5` with a CLEARANCE of 4 => 9mm from bed to nozzle. + * But: `M851 Z+1` with a CLEARANCE of 2 => 2mm from bed to nozzle. + */ +#define Z_CLEARANCE_DEPLOY_PROBE 10 // Z Clearance for Deploy/Stow +#define Z_CLEARANCE_BETWEEN_PROBES 5 // Z Clearance between probe points +#define Z_CLEARANCE_MULTI_PROBE 5 // Z Clearance between multiple probes +//#define Z_AFTER_PROBING 5 // Z position after probing is done + +#define Z_PROBE_LOW_POINT -2 // Farthest distance below the trigger-point to go before stopping + +// For M851 give a range for adjusting the Z probe offset +#define Z_PROBE_OFFSET_RANGE_MIN -20 +#define Z_PROBE_OFFSET_RANGE_MAX 20 + +// Enable the M48 repeatability test to test probe accuracy +//#define Z_MIN_PROBE_REPEATABILITY_TEST + +// Before deploy/stow pause for user confirmation +//#define PAUSE_BEFORE_DEPLOY_STOW + +/** + * Enable one or more of the following if probing seems unreliable. + * Heaters and/or fans can be disabled during probing to minimize electrical + * noise. A delay can also be added to allow noise and vibration to settle. + * These options are most useful for the BLTouch probe, but may also improve + * readings with inductive probes and piezo sensors. + */ +//#define PROBING_HEATERS_OFF // Turn heaters off when probing +#if ENABLED(PROBING_HEATERS_OFF) + //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) +#endif +//#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing +//#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors + +// For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 +// :{ 0:'Low', 1:'High' } +#define X_ENABLE_ON 0 +#define Y_ENABLE_ON 0 +#define Z_ENABLE_ON 0 +#define E_ENABLE_ON 0 // For all extruders + +// Disables axis stepper immediately when it's not being used. +// WARNING: When motors turn off there is a chance of losing position accuracy! +#define DISABLE_X false +#define DISABLE_Y false +#define DISABLE_Z false + +// Warn on display about possibly reduced accuracy +//#define DISABLE_REDUCED_ACCURACY_WARNING + +// @section extruder + +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled + +// @section machine + +// Invert the stepper direction. Change (or reverse the motor connector) if an axis goes the wrong way. +#define INVERT_X_DIR false +#define INVERT_Y_DIR true +#define INVERT_Z_DIR false + +// @section extruder + +// For direct drive extruder v9 set to true, for geared extruder set to false. +#define INVERT_E0_DIR false +#define INVERT_E1_DIR false +#define INVERT_E2_DIR false +#define INVERT_E3_DIR false +#define INVERT_E4_DIR false +#define INVERT_E5_DIR false + +// @section homing + +//#define NO_MOTION_BEFORE_HOMING // Inhibit movement until all axes have been homed + +//#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. + +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... + // Be sure you have this distance over your Z_MAX_POS in case. + +// Direction of endstops when homing; 1=MAX, -1=MIN +// :[-1,1] +#define X_HOME_DIR -1 +#define Y_HOME_DIR -1 +#define Z_HOME_DIR -1 + +// @section machine + +// The size of the print bed +#define X_BED_SIZE 200 +#define Y_BED_SIZE 200 + +// Travel limits (mm) after homing, corresponding to endstop positions. +#define X_MIN_POS 0 +#define Y_MIN_POS 0 +#define Z_MIN_POS 0 +#define X_MAX_POS X_BED_SIZE +#define Y_MAX_POS Y_BED_SIZE +#define Z_MAX_POS 200 + +/** + * Software Endstops + * + * - Prevent moves outside the set machine bounds. + * - Individual axes can be disabled, if desired. + * - X and Y only apply to Cartesian robots. + * - Use 'M211' to set software endstops on/off or report current state + */ + +// Min software endstops constrain movement within minimum coordinate bounds +#define MIN_SOFTWARE_ENDSTOPS +#if ENABLED(MIN_SOFTWARE_ENDSTOPS) + #define MIN_SOFTWARE_ENDSTOP_X + #define MIN_SOFTWARE_ENDSTOP_Y + #define MIN_SOFTWARE_ENDSTOP_Z +#endif + +// Max software endstops constrain movement within maximum coordinate bounds +#define MAX_SOFTWARE_ENDSTOPS +#if ENABLED(MAX_SOFTWARE_ENDSTOPS) + #define MAX_SOFTWARE_ENDSTOP_X + #define MAX_SOFTWARE_ENDSTOP_Y + #define MAX_SOFTWARE_ENDSTOP_Z +#endif + +#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) + //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD +#endif + +/** + * Filament Runout Sensors + * Mechanical or opto endstops are used to check for the presence of filament. + * + * RAMPS-based boards use SERVO3_PIN for the first runout sensor. + * For other boards you may need to define FIL_RUNOUT_PIN, FIL_RUNOUT2_PIN, etc. + * By default the firmware assumes HIGH=FILAMENT PRESENT. + */ +//#define FILAMENT_RUNOUT_SENSOR +#if ENABLED(FILAMENT_RUNOUT_SENSOR) + #define NUM_RUNOUT_SENSORS 1 // Number of sensors, up to one per extruder. Define a FIL_RUNOUT#_PIN for each. + #define FIL_RUNOUT_INVERTING false // set to true to invert the logic of the sensor. + #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. + //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. + #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif +#endif + +//=========================================================================== +//=============================== Bed Leveling ============================== +//=========================================================================== +// @section calibrate + +/** + * Choose one of the options below to enable G29 Bed Leveling. The parameters + * and behavior of G29 will change depending on your selection. + * + * If using a Probe for Z Homing, enable Z_SAFE_HOMING also! + * + * - AUTO_BED_LEVELING_3POINT + * Probe 3 arbitrary points on the bed (that aren't collinear) + * You specify the XY coordinates of all 3 points. + * The result is a single tilted plane. Best for a flat bed. + * + * - AUTO_BED_LEVELING_LINEAR + * Probe several points in a grid. + * You specify the rectangle and the density of sample points. + * The result is a single tilted plane. Best for a flat bed. + * + * - AUTO_BED_LEVELING_BILINEAR + * Probe several points in a grid. + * You specify the rectangle and the density of sample points. + * The result is a mesh, best for large or uneven beds. + * + * - AUTO_BED_LEVELING_UBL (Unified Bed Leveling) + * A comprehensive bed leveling system combining the features and benefits + * of other systems. UBL also includes integrated Mesh Generation, Mesh + * Validation and Mesh Editing systems. + * + * - MESH_BED_LEVELING + * Probe a grid manually + * The result is a mesh, suitable for large or uneven beds. (See BILINEAR.) + * For machines without a probe, Mesh Bed Leveling provides a method to perform + * leveling in steps so you can manually adjust the Z height at each grid-point. + * With an LCD controller the process is guided step-by-step. + */ +//#define AUTO_BED_LEVELING_3POINT +//#define AUTO_BED_LEVELING_LINEAR +//#define AUTO_BED_LEVELING_BILINEAR +//#define AUTO_BED_LEVELING_UBL +//#define MESH_BED_LEVELING + +/** + * Normally G28 leaves leveling disabled on completion. Enable + * this option to have G28 restore the prior leveling state. + */ +//#define RESTORE_LEVELING_AFTER_G28 + +/** + * Enable detailed logging of G28, G29, M48, etc. + * Turn on with the command 'M111 S32'. + * NOTE: Requires a lot of PROGMEM! + */ +//#define DEBUG_LEVELING_FEATURE + +#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) + // Gradually reduce leveling correction until a set height is reached, + // at which point movement will be level to the machine's XY plane. + // The height can be set with M420 Z + #define ENABLE_LEVELING_FADE_HEIGHT + + // For Cartesian machines, instead of dividing moves on mesh boundaries, + // split up moves into short segments like a Delta. This follows the + // contours of the bed more closely than edge-to-edge straight moves. + #define SEGMENT_LEVELED_MOVES + #define LEVELED_SEGMENT_LENGTH 5.0 // (mm) Length of all segments (except the last one) + + /** + * Enable the G26 Mesh Validation Pattern tool. + */ + //#define G26_MESH_VALIDATION + #if ENABLED(G26_MESH_VALIDATION) + #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. + #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. + #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #endif + +#endif + +#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) + + // Set the number of grid points per dimension. + #define GRID_MAX_POINTS_X 3 + #define GRID_MAX_POINTS_Y GRID_MAX_POINTS_X + + // Set the boundaries for probing (where the probe can reach). + //#define LEFT_PROBE_BED_POSITION MIN_PROBE_EDGE + //#define RIGHT_PROBE_BED_POSITION (X_BED_SIZE - (MIN_PROBE_EDGE)) + //#define FRONT_PROBE_BED_POSITION MIN_PROBE_EDGE + //#define BACK_PROBE_BED_POSITION (Y_BED_SIZE - (MIN_PROBE_EDGE)) + + // Probe along the Y axis, advancing X after each column + //#define PROBE_Y_FIRST + + #if ENABLED(AUTO_BED_LEVELING_BILINEAR) + + // Beyond the probed grid, continue the implied tilt? + // Default is to maintain the height of the nearest edge. + //#define EXTRAPOLATE_BEYOND_GRID + + // + // Experimental Subdivision of the grid by Catmull-Rom method. + // Synthesizes intermediate points to produce a more detailed mesh. + // + //#define ABL_BILINEAR_SUBDIVISION + #if ENABLED(ABL_BILINEAR_SUBDIVISION) + // Number of subdivisions between probe points + #define BILINEAR_SUBDIVISIONS 3 + #endif + + #endif + +#elif ENABLED(AUTO_BED_LEVELING_UBL) + + //=========================================================================== + //========================= Unified Bed Leveling ============================ + //=========================================================================== + + //#define MESH_EDIT_GFX_OVERLAY // Display a graphics overlay while editing the mesh + + #define MESH_INSET 1 // Set Mesh bounds as an inset region of the bed + #define GRID_MAX_POINTS_X 10 // Don't use more than 15 points per axis, implementation limited. + #define GRID_MAX_POINTS_Y GRID_MAX_POINTS_X + + #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle + #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + +#elif ENABLED(MESH_BED_LEVELING) + + //=========================================================================== + //=================================== Mesh ================================== + //=========================================================================== + + #define MESH_INSET 10 // Set Mesh bounds as an inset region of the bed + #define GRID_MAX_POINTS_X 3 // Don't use more than 7 points per axis, implementation limited. + #define GRID_MAX_POINTS_Y GRID_MAX_POINTS_X + + //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS + +#endif // BED_LEVELING + +/** + * Points to probe for all 3-point Leveling procedures. + * Override if the automatically selected points are inadequate. + */ +#if ENABLED(AUTO_BED_LEVELING_3POINT) || ENABLED(AUTO_BED_LEVELING_UBL) + //#define PROBE_PT_1_X 15 + //#define PROBE_PT_1_Y 180 + //#define PROBE_PT_2_X 15 + //#define PROBE_PT_2_Y 20 + //#define PROBE_PT_3_X 170 + //#define PROBE_PT_3_Y 20 +#endif + +/** + * Add a bed leveling sub-menu for ABL or MBL. + * Include a guided procedure if manual probing is enabled. + */ +//#define LCD_BED_LEVELING + +#if ENABLED(LCD_BED_LEVELING) + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points +#endif + +// Add a menu item to move between bed corners for manual bed adjustment +//#define LEVEL_BED_CORNERS + +#if ENABLED(LEVEL_BED_CORNERS) + #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling + //#define LEVEL_CENTER_TOO // Move to the center after the last corner +#endif + +/** + * Commands to execute at the end of G29 probing. + * Useful to retract or move the Z probe out of the way. + */ +//#define Z_PROBE_END_SCRIPT "G1 Z10 F12000\nG1 X15 Y330\nG1 Z0.5\nG1 Z10" + + +// @section homing + +// The center of the bed is at (X=0, Y=0) +//#define BED_CENTER_AT_0_0 + +// Manually set the home position. Leave these undefined for automatic settings. +// 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 + +// Use "Z Safe Homing" to avoid homing with a Z probe outside the bed area. +// +// With this feature enabled: +// +// - Allow Z homing only after X and Y homing AND stepper drivers still enabled. +// - If stepper drivers time out, it will need X and Y homing again before Z homing. +// - Move the Z probe (or nozzle) to a defined XY point before Z Homing when homing all axes (G28). +// - Prevent Z homing when the Z probe is outside bed area. +// +//#define Z_SAFE_HOMING + +#if ENABLED(Z_SAFE_HOMING) + #define Z_SAFE_HOMING_X_POINT ((X_BED_SIZE) / 2) // X point for Z homing when homing all axes (G28). + #define Z_SAFE_HOMING_Y_POINT ((Y_BED_SIZE) / 2) // Y point for Z homing when homing all axes (G28). +#endif + +// Homing speeds (mm/m) +#define HOMING_FEEDRATE_XY (50*60) +#define HOMING_FEEDRATE_Z (4*60) + +// Validate that endstops are triggered on homing moves +#define VALIDATE_HOMING_ENDSTOPS + +// @section calibrate + +/** + * Bed Skew Compensation + * + * This feature corrects for misalignment in the XYZ axes. + * + * Take the following steps to get the bed skew in the XY plane: + * 1. Print a test square (e.g., https://www.thingiverse.com/thing:2563185) + * 2. For XY_DIAG_AC measure the diagonal A to C + * 3. For XY_DIAG_BD measure the diagonal B to D + * 4. For XY_SIDE_AD measure the edge A to D + * + * Marlin automatically computes skew factors from these measurements. + * Skew factors may also be computed and set manually: + * + * - Compute AB : SQRT(2*AC*AC+2*BD*BD-4*AD*AD)/2 + * - XY_SKEW_FACTOR : TAN(PI/2-ACOS((AC*AC-AB*AB-AD*AD)/(2*AB*AD))) + * + * If desired, follow the same procedure for XZ and YZ. + * Use these diagrams for reference: + * + * Y Z Z + * ^ B-------C ^ B-------C ^ B-------C + * | / / | / / | / / + * | / / | / / | / / + * | A-------D | A-------D | A-------D + * +-------------->X +-------------->X +-------------->Y + * XY_SKEW_FACTOR XZ_SKEW_FACTOR YZ_SKEW_FACTOR + */ +//#define SKEW_CORRECTION + +#if ENABLED(SKEW_CORRECTION) + // Input all length measurements here: + #define XY_DIAG_AC 282.8427124746 + #define XY_DIAG_BD 282.8427124746 + #define XY_SIDE_AD 200 + + // Or, set the default skew factors directly here + // to override the above measurements: + #define XY_SKEW_FACTOR 0.0 + + //#define SKEW_CORRECTION_FOR_Z + #if ENABLED(SKEW_CORRECTION_FOR_Z) + #define XZ_DIAG_AC 282.8427124746 + #define XZ_DIAG_BD 282.8427124746 + #define YZ_DIAG_AC 282.8427124746 + #define YZ_DIAG_BD 282.8427124746 + #define YZ_SIDE_AD 200 + #define XZ_SKEW_FACTOR 0.0 + #define YZ_SKEW_FACTOR 0.0 + #endif + + // Enable this option for M852 to set skew at runtime + //#define SKEW_CORRECTION_GCODE +#endif + +//============================================================================= +//============================= Additional Features =========================== +//============================================================================= + +// @section extras + +// +// EEPROM +// +// The microcontroller can store settings in the EEPROM, e.g. max velocity... +// M500 - stores parameters in EEPROM +// M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily). +// M502 - reverts to the default "factory settings". You still need to store them in EEPROM afterwards if you want to. +// +//#define EEPROM_SETTINGS // Enable for M500 and M501 commands +//#define DISABLE_M503 // Saves ~2700 bytes of PROGMEM. Disable for release! +#define EEPROM_CHITCHAT // Give feedback on EEPROM commands. Disable to save PROGMEM. + +// +// Host Keepalive +// +// When enabled Marlin will send a busy status message to the host +// every couple of seconds when it can't accept commands. +// +#define HOST_KEEPALIVE_FEATURE // Disable this if your host doesn't like keepalive messages +#define DEFAULT_KEEPALIVE_INTERVAL 2 // Number of seconds between "busy" messages. Set with M113. +#define BUSY_WHILE_HEATING // Some hosts require "busy" messages even during heating + +// +// M100 Free Memory Watcher +// +//#define M100_FREE_MEMORY_WATCHER // Add M100 (Free Memory Watcher) to debug memory usage + +// +// G20/G21 Inch mode support +// +//#define INCH_MODE_SUPPORT + +// +// M149 Set temperature units support +// +//#define TEMPERATURE_UNITS_SUPPORT + +// @section temperature + +// Preheat Constants +#define PREHEAT_1_LABEL "PLA" +#define PREHEAT_1_TEMP_HOTEND 180 +#define PREHEAT_1_TEMP_BED 70 +#define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 + +#define PREHEAT_2_LABEL "ABS" +#define PREHEAT_2_TEMP_HOTEND 240 +#define PREHEAT_2_TEMP_BED 110 +#define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 + +/** + * Nozzle Park + * + * Park the nozzle at the given XYZ position on idle or G27. + * + * The "P" parameter controls the action applied to the Z axis: + * + * P0 (Default) If Z is below park Z raise the nozzle. + * P1 Raise the nozzle always to Z-park height. + * P2 Raise the nozzle by Z-park amount, limited to Z_MAX_POS. + */ +//#define NOZZLE_PARK_FEATURE + +#if ENABLED(NOZZLE_PARK_FEATURE) + // Specify a park position as { X, Y, Z } + #define NOZZLE_PARK_POINT { (X_MIN_POS + 10), (Y_MAX_POS - 10), 20 } + #define NOZZLE_PARK_XY_FEEDRATE 100 // X and Y axes feedrate in mm/s (also used for delta printers Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // Z axis feedrate in mm/s (not used for delta printers) +#endif + +/** + * Clean Nozzle Feature -- EXPERIMENTAL + * + * Adds the G12 command to perform a nozzle cleaning process. + * + * Parameters: + * P Pattern + * S Strokes / Repetitions + * T Triangles (P1 only) + * + * Patterns: + * P0 Straight line (default). This process requires a sponge type material + * at a fixed bed location. "S" specifies strokes (i.e. back-forth motions) + * between the start / end points. + * + * P1 Zig-zag pattern between (X0, Y0) and (X1, Y1), "T" specifies the + * number of zig-zag triangles to do. "S" defines the number of strokes. + * Zig-zags are done in whichever is the narrower dimension. + * For example, "G12 P1 S1 T3" will execute: + * + * -- + * | (X0, Y1) | /\ /\ /\ | (X1, Y1) + * | | / \ / \ / \ | + * A | | / \ / \ / \ | + * | | / \ / \ / \ | + * | (X0, Y0) | / \/ \/ \ | (X1, Y0) + * -- +--------------------------------+ + * |________|_________|_________| + * T1 T2 T3 + * + * P2 Circular pattern with middle at NOZZLE_CLEAN_CIRCLE_MIDDLE. + * "R" specifies the radius. "S" specifies the stroke count. + * Before starting, the nozzle moves to NOZZLE_CLEAN_START_POINT. + * + * Caveats: The ending Z should be the same as starting Z. + * Attention: EXPERIMENTAL. G-code arguments may change. + * + */ +//#define NOZZLE_CLEAN_FEATURE + +#if ENABLED(NOZZLE_CLEAN_FEATURE) + // Default number of pattern repetitions + #define NOZZLE_CLEAN_STROKES 12 + + // Default number of triangles + #define NOZZLE_CLEAN_TRIANGLES 3 + + // Specify positions as { X, Y, Z } + #define NOZZLE_CLEAN_START_POINT { 30, 30, (Z_MIN_POS + 1)} + #define NOZZLE_CLEAN_END_POINT {100, 60, (Z_MIN_POS + 1)} + + // Circular pattern radius + #define NOZZLE_CLEAN_CIRCLE_RADIUS 6.5 + // Circular pattern circle fragments number + #define NOZZLE_CLEAN_CIRCLE_FN 10 + // Middle point of circle + #define NOZZLE_CLEAN_CIRCLE_MIDDLE NOZZLE_CLEAN_START_POINT + + // Moves the nozzle to the initial position + #define NOZZLE_CLEAN_GOBACK +#endif + +/** + * Print Job Timer + * + * Automatically start and stop the print job timer on M104/M109/M190. + * + * M104 (hotend, no wait) - high temp = none, low temp = stop timer + * M109 (hotend, wait) - high temp = start timer, low temp = stop timer + * M190 (bed, wait) - high temp = start timer, low temp = none + * + * The timer can also be controlled with the following commands: + * + * M75 - Start the print job timer + * M76 - Pause the print job timer + * M77 - Stop the print job timer + */ +#define PRINTJOB_TIMER_AUTOSTART + +/** + * Print Counter + * + * Track statistical data such as: + * + * - Total print jobs + * - Total successful print jobs + * - Total failed print jobs + * - Total time printing + * + * View the current statistics with M78. + */ +//#define PRINTCOUNTER + +//============================================================================= +//============================= LCD and SD support ============================ +//============================================================================= + +// @section lcd + +/** + * LCD LANGUAGE + * + * Select the language to display on the LCD. These languages are available: + * + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + */ +#define LCD_LANGUAGE en + +/** + * LCD Character Set + * + * Note: This option is NOT applicable to Graphical Displays. + * + * All character-based LCDs provide ASCII plus one of these + * language extensions: + * + * - JAPANESE ... the most common + * - WESTERN ... with more accented characters + * - CYRILLIC ... for the Russian language + * + * To determine the language extension installed on your controller: + * + * - Compile and upload with LCD_LANGUAGE set to 'test' + * - Click the controller to view the LCD menu + * - The LCD will display Japanese, Western, or Cyrillic text + * + * See http://marlinfw.org/docs/development/lcd_language.html + * + * :['JAPANESE', 'WESTERN', 'CYRILLIC'] + */ +#define DISPLAY_CHARSET_HD44780 JAPANESE + +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + +/** + * SD CARD + * + * SD Card support is disabled by default. If your controller has an SD slot, + * you must uncomment the following option or it won't work. + * + */ +//#define SDSUPPORT + +/** + * SD CARD: SPI SPEED + * + * Enable one of the following items for a slower SPI transfer speed. + * This may be required to resolve "volume init" errors. + */ +#define SPI_SPEED SPI_HALF_SPEED +//#define SPI_SPEED SPI_QUARTER_SPEED +//#define SPI_SPEED SPI_EIGHTH_SPEED + +/** + * SD CARD: ENABLE CRC + * + * Use CRC checks and retries on the SD communication. + */ +//#define SD_CHECK_AND_RETRY + +/** + * LCD Menu Items + * + * Disable all menus and only display the Status Screen, or + * just remove some extraneous menu items to recover space. + */ +//#define NO_LCD_MENUS +//#define SLIM_LCD_MENUS + +// +// ENCODER SETTINGS +// +// This option overrides the default number of encoder pulses needed to +// produce one step. Should be increased for high-resolution encoders. +// +//#define ENCODER_PULSES_PER_STEP 4 + +// +// Use this option to override the number of step signals required to +// move between next/prev menu items. +// +//#define ENCODER_STEPS_PER_MENU_ITEM 1 + +/** + * Encoder Direction Options + * + * Test your encoder's behavior first with both options disabled. + * + * Reversed Value Edit and Menu Nav? Enable REVERSE_ENCODER_DIRECTION. + * Reversed Menu Navigation only? Enable REVERSE_MENU_DIRECTION. + * Reversed Value Editing only? Enable BOTH options. + */ + +// +// This option reverses the encoder direction everywhere. +// +// Set this option if CLOCKWISE causes values to DECREASE +// +//#define REVERSE_ENCODER_DIRECTION + +// +// This option reverses the encoder direction for navigating LCD menus. +// +// If CLOCKWISE normally moves DOWN this makes it go UP. +// If CLOCKWISE normally moves UP this makes it go DOWN. +// +//#define REVERSE_MENU_DIRECTION + +// +// Individual Axis Homing +// +// Add individual axis homing items (Home X, Home Y, and Home Z) to the LCD menu. +// +//#define INDIVIDUAL_AXIS_HOMING_MENU + +// +// SPEAKER/BUZZER +// +// If you have a speaker that can produce tones, enable it here. +// By default Marlin assumes you have a buzzer with a fixed frequency. +// +//#define SPEAKER + +// +// The duration and frequency for the UI feedback sound. +// Set these to 0 to disable audio feedback in the LCD menus. +// +// Note: Test audio output with the G-Code: +// M300 S P +// +//#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 2 +//#define LCD_FEEDBACK_FREQUENCY_HZ 5000 + +//============================================================================= +//======================== LCD / Controller Selection ========================= +//======================== (Character-based LCDs) ========================= +//============================================================================= + +// +// RepRapDiscount Smart Controller. +// http://reprap.org/wiki/RepRapDiscount_Smart_Controller +// +// Note: Usually sold with a white PCB. +// +//#define REPRAP_DISCOUNT_SMART_CONTROLLER + +// +// Original RADDS LCD Display+Encoder+SDCardReader +// http://doku.radds.org/dokumentation/lcd-display/ +// +//#define RADDS_DISPLAY + +// +// ULTIMAKER Controller. +// +//#define ULTIMAKERCONTROLLER + +// +// ULTIPANEL as seen on Thingiverse. +// +//#define ULTIPANEL + +// +// PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3) +// http://reprap.org/wiki/PanelOne +// +//#define PANEL_ONE + +// +// GADGETS3D G3D LCD/SD Controller +// http://reprap.org/wiki/RAMPS_1.3/1.4_GADGETS3D_Shield_with_Panel +// +// Note: Usually sold with a blue PCB. +// +//#define G3D_PANEL + +// +// RigidBot Panel V1.0 +// http://www.inventapart.com/ +// +//#define RIGIDBOT_PANEL + +// +// Makeboard 3D Printer Parts 3D Printer Mini Display 1602 Mini Controller +// https://www.aliexpress.com/item/Micromake-Makeboard-3D-Printer-Parts-3D-Printer-Mini-Display-1602-Mini-Controller-Compatible-with-Ramps-1/32765887917.html +// +//#define MAKEBOARD_MINI_2_LINE_DISPLAY_1602 + +// +// ANET and Tronxy 20x4 Controller +// +//#define ZONESTAR_LCD // Requires ADC_KEYPAD_PIN to be assigned to an analog pin. + // This LCD is known to be susceptible to electrical interference + // which scrambles the display. Pressing any button clears it up. + // This is a LCD2004 display with 5 analog buttons. + +// +// Generic 16x2, 16x4, 20x2, or 20x4 character-based LCD. +// +//#define ULTRA_LCD + +//============================================================================= +//======================== LCD / Controller Selection ========================= +//===================== (I2C and Shift-Register LCDs) ===================== +//============================================================================= + +// +// CONTROLLER TYPE: I2C +// +// Note: These controllers require the installation of Arduino's LiquidCrystal_I2C +// library. For more info: https://github.com/kiyoshigawa/LiquidCrystal_I2C +// + +// +// Elefu RA Board Control Panel +// http://www.elefu.com/index.php?route=product/product&product_id=53 +// +//#define RA_CONTROL_PANEL + +// +// Sainsmart (YwRobot) LCD Displays +// +// These require F.Malpartida's LiquidCrystal_I2C library +// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home +// +//#define LCD_SAINSMART_I2C_1602 +//#define LCD_SAINSMART_I2C_2004 + +// +// Generic LCM1602 LCD adapter +// +//#define LCM1602 + +// +// PANELOLU2 LCD with status LEDs, +// separate encoder and click inputs. +// +// Note: This controller requires Arduino's LiquidTWI2 library v1.2.3 or later. +// For more info: https://github.com/lincomatic/LiquidTWI2 +// +// Note: The PANELOLU2 encoder click input can either be directly connected to +// a pin (if BTN_ENC defined to != -1) or read through I2C (when BTN_ENC == -1). +// +//#define LCD_I2C_PANELOLU2 + +// +// Panucatt VIKI LCD with status LEDs, +// integrated click & L/R/U/D buttons, separate encoder inputs. +// +//#define LCD_I2C_VIKI + +// +// CONTROLLER TYPE: Shift register panels +// + +// +// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// LCD configuration: http://reprap.org/wiki/SAV_3D_LCD +// +//#define SAV_3DLCD + +//============================================================================= +//======================= LCD / Controller Selection ======================= +//========================= (Graphical LCDs) ======================== +//============================================================================= + +// +// CONTROLLER TYPE: Graphical 128x64 (DOGM) +// +// IMPORTANT: The U8glib library is required for Graphical Display! +// https://github.com/olikraus/U8glib_Arduino +// + +// +// RepRapDiscount FULL GRAPHIC Smart Controller +// http://reprap.org/wiki/RepRapDiscount_Full_Graphic_Smart_Controller +// +//#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER + +// +// ReprapWorld Graphical LCD +// https://reprapworld.com/?products_details&products_id/1218 +// +//#define REPRAPWORLD_GRAPHICAL_LCD + +// +// Activate one of these if you have a Panucatt Devices +// Viki 2.0 or mini Viki with Graphic LCD +// http://panucatt.com +// +//#define VIKI2 +//#define miniVIKI + +// +// MakerLab Mini Panel with graphic +// controller and SD support - http://reprap.org/wiki/Mini_panel +// +//#define MINIPANEL + +// +// MaKr3d Makr-Panel with graphic controller and SD support. +// http://reprap.org/wiki/MaKr3d_MaKrPanel +// +//#define MAKRPANEL + +// +// Adafruit ST7565 Full Graphic Controller. +// https://github.com/eboston/Adafruit-ST7565-Full-Graphic-Controller/ +// +//#define ELB_FULL_GRAPHIC_CONTROLLER + +// +// BQ LCD Smart Controller shipped by +// default with the BQ Hephestos 2 and Witbox 2. +// +//#define BQ_LCD_SMART_CONTROLLER + +// +// Cartesio UI +// http://mauk.cc/webshop/cartesio-shop/electronics/user-interface +// +//#define CARTESIO_UI + +// +// LCD for Melzi Card with Graphical LCD +// +//#define LCD_FOR_MELZI + +// +// SSD1306 OLED full graphics generic display +// +//#define U8GLIB_SSD1306 + +// +// SAV OLEd LCD module support using either SSD1306 or SH1106 based LCD modules +// +//#define SAV_3DGLCD +#if ENABLED(SAV_3DGLCD) + //#define U8GLIB_SSD1306 + #define U8GLIB_SH1106 +#endif + +// +// Original Ulticontroller from Ultimaker 2 printer with SSD1309 I2C display and encoder +// https://github.com/Ultimaker/Ultimaker2/tree/master/1249_Ulticontroller_Board_(x1) +// +//#define ULTI_CONTROLLER + +// +// TinyBoy2 128x64 OLED / Encoder Panel +// +//#define OLED_PANEL_TINYBOY2 + +// +// MKS MINI12864 with graphic controller and SD support +// http://reprap.org/wiki/MKS_MINI_12864 +// +//#define MKS_MINI_12864 + +// +// Factory display for Creality CR-10 +// https://www.aliexpress.com/item/Universal-LCD-12864-3D-Printer-Display-Screen-With-Encoder-For-CR-10-CR-7-Model/32833148327.html +// +// This is RAMPS-compatible using a single 10-pin connector. +// (For CR-10 owners who want to replace the Melzi Creality board but retain the display) +// +//#define CR10_STOCKDISPLAY + +// +// ANET and Tronxy Graphical Controller +// +// Anet 128x64 full graphics lcd with rotary encoder as used on Anet A6 +// A clone of the RepRapDiscount full graphics display but with +// different pins/wiring (see pins_ANET_10.h). +// +//#define ANET_FULL_GRAPHICS_LCD + +// +// MKS OLED 1.3" 128 × 64 FULL GRAPHICS CONTROLLER +// http://reprap.org/wiki/MKS_12864OLED +// +// Tiny, but very sharp OLED display +// +//#define MKS_12864OLED // Uses the SH1106 controller (default) +//#define MKS_12864OLED_SSD1306 // Uses the SSD1306 controller + +// +// AZSMZ 12864 LCD with SD +// https://www.aliexpress.com/store/product/3D-printer-smart-controller-SMART-RAMPS-OR-RAMPS-1-4-LCD-12864-LCD-control-panel-green/2179173_32213636460.html +// +//#define AZSMZ_12864 + +// +// Silvergate GLCD controller +// http://github.com/android444/Silvergate +// +//#define SILVER_GATE_GLCD_CONTROLLER + +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + +//============================================================================= +//============================ Other Controllers ============================ +//============================================================================= + +// +// CONTROLLER TYPE: Standalone / Serial +// + +// +// LCD for Malyan M200 printers. +// +//#define MALYAN_LCD + +// +// CONTROLLER TYPE: Keypad / Add-on +// + +// +// RepRapWorld REPRAPWORLD_KEYPAD v1.1 +// http://reprapworld.com/?products_details&products_id=202&cPath=1591_1626 +// +// REPRAPWORLD_KEYPAD_MOVE_STEP sets how much should the robot move when a key +// is pressed, a value of 10.0 means 10mm per click. +// +//#define REPRAPWORLD_KEYPAD +//#define REPRAPWORLD_KEYPAD_MOVE_STEP 10.0 + +//============================================================================= +//=============================== Extra Features ============================== +//============================================================================= + +// @section extras + +// Increase the FAN PWM frequency. Removes the PWM noise but increases heating in the FET/Arduino +//#define FAST_PWM_FAN + +// Use software PWM to drive the fan, as for the heaters. This uses a very low frequency +// which is not as annoying as with the hardware PWM. On the other hand, if this frequency +// is too low, you should also increment SOFT_PWM_SCALE. +//#define FAN_SOFT_PWM + +// Incrementing this by 1 will double the software PWM frequency, +// affecting heaters, and the fan if FAN_SOFT_PWM is enabled. +// However, control resolution will be halved for each increment; +// at zero value, there are 128 effective control positions. +#define SOFT_PWM_SCALE 0 + +// If SOFT_PWM_SCALE is set to a value higher than 0, dithering can +// be used to mitigate the associated resolution loss. If enabled, +// some of the PWM cycles are stretched so on average the desired +// duty cycle is attained. +//#define SOFT_PWM_DITHER + +// Temperature status LEDs that display the hotend and bed temperature. +// If all hotends, bed temperature, and target temperature are under 54C +// then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) +//#define TEMP_STAT_LEDS + +// M240 Triggers a camera by emulating a Canon RC-1 Remote +// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ +//#define PHOTOGRAPH_PIN 23 + +// SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure +//#define SF_ARC_FIX + +// Support for the BariCUDA Paste Extruder +//#define BARICUDA + +// Support for BlinkM/CyzRgb +//#define BLINKM + +// Support for PCA9632 PWM LED driver +//#define PCA9632 + +/** + * RGB LED / LED Strip Control + * + * Enable support for an RGB LED connected to 5V digital pins, or + * an RGB Strip connected to MOSFETs controlled by digital pins. + * + * Adds the M150 command to set the LED (or LED strip) color. + * If pins are PWM capable (e.g., 4, 5, 6, 11) then a range of + * luminance values can be set from 0 to 255. + * For Neopixel LED an overall brightness parameter is also available. + * + * *** CAUTION *** + * LED Strips require a MOSFET Chip between PWM lines and LEDs, + * as the Arduino cannot handle the current the LEDs will require. + * Failure to follow this precaution can destroy your Arduino! + * NOTE: A separate 5V power supply is required! The Neopixel LED needs + * more current than the Arduino 5V linear regulator can produce. + * *** CAUTION *** + * + * LED Type. Enable only one of the following two options. + * + */ +//#define RGB_LED +//#define RGBW_LED + +#if ENABLED(RGB_LED) || ENABLED(RGBW_LED) + #define RGB_LED_R_PIN 34 + #define RGB_LED_G_PIN 43 + #define RGB_LED_B_PIN 35 + #define RGB_LED_W_PIN -1 +#endif + +// Support for Adafruit Neopixel LED driver +//#define NEOPIXEL_LED +#if ENABLED(NEOPIXEL_LED) + #define NEOPIXEL_TYPE NEO_GRBW // NEO_GRBW / NEO_GRB - four/three channel driver type (defined in Adafruit_NeoPixel.h) + #define NEOPIXEL_PIN 4 // LED driving pin on motherboard 4 => D4 (EXP2-5 on Printrboard) / 30 => PC7 (EXP3-13 on Rumba) + #define NEOPIXEL_PIXELS 30 // Number of LEDs in the strip + #define NEOPIXEL_IS_SEQUENTIAL // Sequential display for temperature change - LED by LED. Disable to change all LEDs at once. + #define NEOPIXEL_BRIGHTNESS 127 // Initial brightness (0-255) + //#define NEOPIXEL_STARTUP_TEST // Cycle through colors at startup +#endif + +/** + * Printer Event LEDs + * + * During printing, the LEDs will reflect the printer status: + * + * - Gradually change from blue to violet as the heated bed gets to target temp + * - Gradually change from violet to red as the hotend gets to temperature + * - Change to white to illuminate work surface + * - Change to green once print has finished + * - Turn off after the print has finished and the user has pushed a button + */ +#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632) || ENABLED(NEOPIXEL_LED) + #define PRINTER_EVENT_LEDS +#endif + +/** + * R/C SERVO support + * Sponsored by TrinityLabs, Reworked by codexmas + */ + +/** + * Number of servos + * + * For some servo-related options NUM_SERVOS will be set automatically. + * Set this manually if there are extra servos needing manual control. + * Leave undefined or set to 0 to entirely disable the servo subsystem. + */ +//#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command + +// Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle. +// 300ms is a good value but you can try less delay. +// If the servo can't reach the requested position, increase it. +#define SERVO_DELAY { 300 } + +// Only power servos during movement, otherwise leave off to prevent jitter +//#define DEACTIVATE_SERVOS_AFTER_MOVE + +// Allow servo angle to be edited and saved to EEPROM +//#define EDITABLE_SERVO_ANGLES diff --git a/Marlin/src/config/examples/UltiMachine/Archim1/Configuration_adv.h b/Marlin/src/config/examples/UltiMachine/Archim1/Configuration_adv.h new file mode 100644 index 0000000000..3c4134cc60 --- /dev/null +++ b/Marlin/src/config/examples/UltiMachine/Archim1/Configuration_adv.h @@ -0,0 +1,1886 @@ +/** + * 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 . + * + */ +#pragma once + +/** + * Configuration_adv.h + * + * Advanced settings. + * Only change these if you know exactly what you're doing. + * Some of these settings can damage your printer if improperly set! + * + * Basic settings can be found in Configuration.h + * + */ +#define CONFIGURATION_ADV_H_VERSION 020000 + +// @section temperature + +//=========================================================================== +//=============================Thermal Settings ============================ +//=========================================================================== + +// +// Hephestos 2 24V heated bed upgrade kit. +// https://store.bq.com/en/heated-bed-kit-hephestos2 +// +//#define HEPHESTOS2_HEATED_BED_KIT +#if ENABLED(HEPHESTOS2_HEATED_BED_KIT) + #undef TEMP_SENSOR_BED + #define TEMP_SENSOR_BED 70 + #define HEATER_BED_INVERTING true +#endif + +#if DISABLED(PIDTEMPBED) + #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control + #if ENABLED(BED_LIMIT_SWITCHING) + #define BED_HYSTERESIS 2 // Only disable heating if T>target+BED_HYSTERESIS and enable heating if T>target-BED_HYSTERESIS + #endif +#endif + +/** + * Thermal Protection provides additional protection to your printer from damage + * and fire. Marlin always includes safe min and max temperature ranges which + * protect against a broken or disconnected thermistor wire. + * + * The issue: If a thermistor falls out, it will report the much lower + * temperature of the air in the room, and the the firmware will keep + * the heater on. + * + * The solution: Once the temperature reaches the target, start observing. + * If the temperature stays too far below the target (hysteresis) for too + * long (period), the firmware will halt the machine as a safety precaution. + * + * If you get false positives for "Thermal Runaway", increase + * THERMAL_PROTECTION_HYSTERESIS and/or THERMAL_PROTECTION_PERIOD + */ +#if ENABLED(THERMAL_PROTECTION_HOTENDS) + #define THERMAL_PROTECTION_PERIOD 40 // Seconds + #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius + + /** + * Whenever an M104, M109, or M303 increases the target temperature, the + * firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature + * hasn't increased by WATCH_TEMP_INCREASE degrees, the machine is halted and + * requires a hard reset. This test restarts with any M104/M109/M303, but only + * if the current temperature is far enough below the target for a reliable + * test. + * + * If you get false positives for "Heating failed", increase WATCH_TEMP_PERIOD + * and/or decrease WATCH_TEMP_INCREASE. WATCH_TEMP_INCREASE should not be set + * below 2. + */ + #define WATCH_TEMP_PERIOD 20 // Seconds + #define WATCH_TEMP_INCREASE 2 // Degrees Celsius +#endif + +/** + * Thermal Protection parameters for the bed are just as above for hotends. + */ +#if ENABLED(THERMAL_PROTECTION_BED) + #define THERMAL_PROTECTION_BED_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_BED_HYSTERESIS 2 // Degrees Celsius + + /** + * As described above, except for the bed (M140/M190/M303). + */ + #define WATCH_BED_TEMP_PERIOD 60 // Seconds + #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius +#endif + +#if ENABLED(PIDTEMP) + // this adds an experimental additional term to the heating power, proportional to the extrusion speed. + // if Kc is chosen well, the additional required power due to increased melting should be compensated. + //#define PID_EXTRUSION_SCALING + #if ENABLED(PID_EXTRUSION_SCALING) + #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) + #define LPQ_MAX_LEN 50 + #endif +#endif + +/** + * Automatic Temperature: + * The hotend target temperature is calculated by all the buffered lines of gcode. + * The maximum buffered steps/sec of the extruder motor is called "se". + * Start autotemp mode with M109 S B F + * The target temperature is set to mintemp+factor*se[steps/sec] and is limited by + * mintemp and maxtemp. Turn this off by executing M109 without F* + * Also, if the temperature is set to a value below mintemp, it will not be changed by autotemp. + * On an Ultimaker, some initial testing worked with M109 S215 B260 F1 in the start.gcode + */ +#define AUTOTEMP +#if ENABLED(AUTOTEMP) + #define AUTOTEMP_OLDWEIGHT 0.98 +#endif + +// Show extra position information in M114 +//#define M114_DETAIL + +// Show Temperature ADC value +// Enable for M105 to include ADC values read from temperature sensors. +//#define SHOW_TEMP_ADC_VALUES + +/** + * High Temperature Thermistor Support + * + * Thermistors able to support high temperature tend to have a hard time getting + * good readings at room and lower temperatures. This means HEATER_X_RAW_LO_TEMP + * will probably be caught when the heating element first turns on during the + * preheating process, which will trigger a min_temp_error as a safety measure + * and force stop everything. + * To circumvent this limitation, we allow for a preheat time (during which, + * min_temp_error won't be triggered) and add a min_temp buffer to handle + * aberrant readings. + * + * If you want to enable this feature for your hotend thermistor(s) + * uncomment and set values > 0 in the constants below + */ + +// The number of consecutive low temperature errors that can occur +// before a min_temp_error is triggered. (Shouldn't be more than 10.) +//#define MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED 0 + +// The number of milliseconds a hotend will preheat before starting to check +// the temperature. This value should NOT be set to the time it takes the +// hot end to reach the target temperature, but the time it takes to reach +// the minimum temperature your thermistor can read. The lower the better/safer. +// This shouldn't need to be more than 30 seconds (30000) +//#define MILLISECONDS_PREHEAT_TIME 0 + +// @section extruder + +// Extruder runout prevention. +// If the machine is idle and the temperature over MINTEMP +// then extrude some filament every couple of SECONDS. +//#define EXTRUDER_RUNOUT_PREVENT +#if ENABLED(EXTRUDER_RUNOUT_PREVENT) + #define EXTRUDER_RUNOUT_MINTEMP 190 + #define EXTRUDER_RUNOUT_SECONDS 30 + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) +#endif + +// @section temperature + +// Calibration for AD595 / AD8495 sensor to adjust temperature measurements. +// The final temperature is calculated as (measuredTemp * GAIN) + OFFSET. +#define TEMP_SENSOR_AD595_OFFSET 0.0 +#define TEMP_SENSOR_AD595_GAIN 1.0 +#define TEMP_SENSOR_AD8495_OFFSET 0.0 +#define TEMP_SENSOR_AD8495_GAIN 1.0 + +/** + * Controller Fan + * To cool down the stepper drivers and MOSFETs. + * + * The fan will turn on automatically whenever any stepper is enabled + * and turn off after a set period after all steppers are turned off. + */ +//#define USE_CONTROLLER_FAN +#if ENABLED(USE_CONTROLLER_FAN) + //#define CONTROLLER_FAN_PIN -1 // Set a custom pin for the controller fan + #define CONTROLLERFAN_SECS 60 // Duration in seconds for the fan to run after all motors are disabled + #define CONTROLLERFAN_SPEED 255 // 255 == full speed +#endif + +// When first starting the main fan, run it at full speed for the +// given number of milliseconds. This gets the fan spinning reliably +// before setting a PWM value. (Does not work with software PWM for fan on Sanguinololu) +//#define FAN_KICKSTART_TIME 100 + +/** + * PWM Fan Scaling + * + * Define the min/max speeds for PWM fans (as set with M106). + * + * With these options the M106 0-255 value range is scaled to a subset + * to ensure that the fan has enough power to spin, or to run lower + * current fans with higher current. (e.g., 5V/12V fans with 12V/24V) + * Value 0 always turns off the fan. + * + * Define one or both of these to override the default 0-255 range. + */ +//#define FAN_MIN_PWM 50 +//#define FAN_MAX_PWM 128 + +// @section extruder + +/** + * Extruder cooling fans + * + * Extruder auto fans automatically turn on when their extruders' + * temperatures go above EXTRUDER_AUTO_FAN_TEMPERATURE. + * + * Your board's pins file specifies the recommended pins. Override those here + * or set to -1 to disable completely. + * + * Multiple extruders can be assigned to the same pin in which case + * the fan will turn on when any selected extruder is above the threshold. + */ +#define E0_AUTO_FAN_PIN -1 +#define E1_AUTO_FAN_PIN -1 +#define E2_AUTO_FAN_PIN -1 +#define E3_AUTO_FAN_PIN -1 +#define E4_AUTO_FAN_PIN -1 +#define E5_AUTO_FAN_PIN -1 +#define CHAMBER_AUTO_FAN_PIN -1 +#define EXTRUDER_AUTO_FAN_TEMPERATURE 50 +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed + +/** + * Part-Cooling Fan Multiplexer + * + * This feature allows you to digitally multiplex the fan output. + * The multiplexer is automatically switched at tool-change. + * Set FANMUX[012]_PINs below for up to 2, 4, or 8 multiplexed fans. + */ +#define FANMUX0_PIN -1 +#define FANMUX1_PIN -1 +#define FANMUX2_PIN -1 + +/** + * M355 Case Light on-off / brightness + */ +//#define CASE_LIGHT_ENABLE +#if ENABLED(CASE_LIGHT_ENABLE) + //#define CASE_LIGHT_PIN 4 // Override the default pin if needed + #define INVERT_CASE_LIGHT false // Set true if Case Light is ON when pin is LOW + #define CASE_LIGHT_DEFAULT_ON true // Set default power-up state on + #define CASE_LIGHT_DEFAULT_BRIGHTNESS 105 // Set default power-up brightness (0-255, requires PWM pin) + //#define MENU_ITEM_CASE_LIGHT // Add a Case Light option to the LCD main menu + //#define CASE_LIGHT_USE_NEOPIXEL // Use Neopixel LED as case light, requires NEOPIXEL_LED. + #if ENABLED(CASE_LIGHT_USE_NEOPIXEL) + #define CASE_LIGHT_NEOPIXEL_COLOR { 255, 255, 255, 255 } // { Red, Green, Blue, White } + #endif +#endif + +//=========================================================================== +//============================ Mechanical Settings ========================== +//=========================================================================== + +// @section homing + +// If you want endstops to stay on (by default) even when not homing +// enable this option. Override at any time with M120, M121. +//#define ENDSTOPS_ALWAYS_ON_DEFAULT + +// @section extras + +//#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats. + +// Employ an external closed loop controller. Override pins here if needed. +//#define EXTERNAL_CLOSED_LOOP_CONTROLLER +#if ENABLED(EXTERNAL_CLOSED_LOOP_CONTROLLER) + //#define CLOSED_LOOP_ENABLE_PIN -1 + //#define CLOSED_LOOP_MOVE_COMPLETE_PIN -1 +#endif + +/** + * Dual Steppers / Dual Endstops + * + * This section will allow you to use extra E drivers to drive a second motor for X, Y, or Z axes. + * + * For example, set X_DUAL_STEPPER_DRIVERS setting to use a second motor. If the motors need to + * spin in opposite directions set INVERT_X2_VS_X_DIR. If the second motor needs its own endstop + * set X_DUAL_ENDSTOPS. This can adjust for "racking." Use X2_USE_ENDSTOP to set the endstop plug + * that should be used for the second endstop. Extra endstops will appear in the output of 'M119'. + * + * Use X_DUAL_ENDSTOP_ADJUSTMENT to adjust for mechanical imperfection. After homing both motors + * this offset is applied to the X2 motor. To find the offset home the X axis, and measure the error + * in X2. Dual endstop offsets can be set at runtime with 'M666 X Y Z'. + */ + +//#define X_DUAL_STEPPER_DRIVERS +#if ENABLED(X_DUAL_STEPPER_DRIVERS) + #define INVERT_X2_VS_X_DIR true // Set 'true' if X motors should rotate in opposite directions + //#define X_DUAL_ENDSTOPS + #if ENABLED(X_DUAL_ENDSTOPS) + #define X2_USE_ENDSTOP _XMAX_ + #define X_DUAL_ENDSTOPS_ADJUSTMENT 0 + #endif +#endif + +//#define Y_DUAL_STEPPER_DRIVERS +#if ENABLED(Y_DUAL_STEPPER_DRIVERS) + #define INVERT_Y2_VS_Y_DIR true // Set 'true' if Y motors should rotate in opposite directions + //#define Y_DUAL_ENDSTOPS + #if ENABLED(Y_DUAL_ENDSTOPS) + #define Y2_USE_ENDSTOP _YMAX_ + #define Y_DUAL_ENDSTOPS_ADJUSTMENT 0 + #endif +#endif + +//#define Z_DUAL_STEPPER_DRIVERS +#if ENABLED(Z_DUAL_STEPPER_DRIVERS) + //#define Z_DUAL_ENDSTOPS + #if ENABLED(Z_DUAL_ENDSTOPS) + #define Z2_USE_ENDSTOP _XMAX_ + #define Z_DUAL_ENDSTOPS_ADJUSTMENT 0 + #endif +#endif + +//#define Z_TRIPLE_STEPPER_DRIVERS +#if ENABLED(Z_TRIPLE_STEPPER_DRIVERS) + //#define Z_TRIPLE_ENDSTOPS + #if ENABLED(Z_TRIPLE_ENDSTOPS) + #define Z2_USE_ENDSTOP _XMAX_ + #define Z3_USE_ENDSTOP _YMAX_ + #define Z_TRIPLE_ENDSTOPS_ADJUSTMENT2 0 + #define Z_TRIPLE_ENDSTOPS_ADJUSTMENT3 0 + #endif +#endif + +/** + * Dual X Carriage + * + * This setup has two X carriages that can move independently, each with its own hotend. + * The carriages can be used to print an object with two colors or materials, or in + * "duplication mode" it can print two identical or X-mirrored objects simultaneously. + * The inactive carriage is parked automatically to prevent oozing. + * X1 is the left carriage, X2 the right. They park and home at opposite ends of the X axis. + * By default the X2 stepper is assigned to the first unused E plug on the board. + */ +//#define DUAL_X_CARRIAGE +#if ENABLED(DUAL_X_CARRIAGE) + #define X1_MIN_POS X_MIN_POS // set minimum to ensure first x-carriage doesn't hit the parked second X-carriage + #define X1_MAX_POS X_BED_SIZE // set maximum to ensure first x-carriage doesn't hit the parked second X-carriage + #define X2_MIN_POS 80 // set minimum to ensure second x-carriage doesn't hit the parked first X-carriage + #define X2_MAX_POS 353 // set maximum to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // the second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // default home position is the maximum carriage position + // However: In this mode the HOTEND_OFFSET_X value for the second extruder provides a software + // override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops + // without modifying the firmware (through the "M218 T1 X???" command). + // Remember: you should set the second extruder x-offset to 0 in your slicer. + + // There are a few selectable movement modes for dual x-carriages using M605 S + // Mode 0 (DXC_FULL_CONTROL_MODE): 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 S0) + // Mode 1 (DXC_AUTO_PARK_MODE) : Auto-park mode. The firmware will automatically park and unpark the x-carriages on tool changes so + // that additional slicer support is not required. (M605 S1) + // Mode 2 (DXC_DUPLICATION_MODE) : Duplication mode. The firmware will transparently make the second x-carriage and extruder copy all + // actions of the first x-carriage. This allows the printer to print 2 arbitrary items at + // once. (2nd extruder x offset and temp offset are set using: M605 S2 [Xnnn] [Rmmm]) + + // This is the default power-up mode which can be later using M605. + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + + // Default x offset in duplication mode (typically set to half print bed width) + #define DEFAULT_DUPLICATION_X_OFFSET 100 + +#endif // DUAL_X_CARRIAGE + +// Activate a solenoid on the active extruder with M380. Disable all with M381. +// Define SOL0_PIN, SOL1_PIN, etc., for each extruder that has a solenoid. +//#define EXT_SOLENOID + +// @section homing + +// Homing hits each endstop, retracts by these distances, then does a slower bump. +#define X_HOME_BUMP_MM 5 +#define Y_HOME_BUMP_MM 5 +#define Z_HOME_BUMP_MM 2 +#define HOMING_BUMP_DIVISOR { 2, 2, 4 } // Re-Bump Speed Divisor (Divides the Homing Feedrate) +//#define QUICK_HOME // If homing includes X and Y, do a diagonal move initially + +// When G28 is called, this option will make Y home before X +//#define HOME_Y_BEFORE_X + +// Enable this if X or Y can't home without homing the other axis first. +//#define CODEPENDENT_XY_HOMING + +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + +// @section machine + +#define AXIS_RELATIVE_MODES {false, false, false, false} + +// Allow duplication mode with a basic dual-nozzle extruder +//#define DUAL_NOZZLE_DUPLICATION_MODE + +// By default pololu step drivers require an active high signal. However, some high power drivers require an active low signal as step. +#define INVERT_X_STEP_PIN false +#define INVERT_Y_STEP_PIN false +#define INVERT_Z_STEP_PIN false +#define INVERT_E_STEP_PIN false + +// Default stepper release if idle. Set to 0 to deactivate. +// Steppers will shut down DEFAULT_STEPPER_DEACTIVE_TIME seconds after the last move when DISABLE_INACTIVE_? is true. +// Time can be set by M18 and M84. +#define DEFAULT_STEPPER_DEACTIVE_TIME 120 +#define DISABLE_INACTIVE_X true +#define DISABLE_INACTIVE_Y true +#define DISABLE_INACTIVE_Z true // set to false if the nozzle will fall down on your printed part when print has finished. +#define DISABLE_INACTIVE_E true + +#define DEFAULT_MINIMUMFEEDRATE 0.0 // minimum feedrate +#define DEFAULT_MINTRAVELFEEDRATE 0.0 + +//#define HOME_AFTER_DEACTIVATE // Require rehoming after steppers are deactivated + +// @section lcd + +#if ENABLED(ULTIPANEL) + #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel + #define MANUAL_E_MOVES_RELATIVE // Show LCD extruder moves as relative rather than absolute positions + #define ULTIPANEL_FEEDMULTIPLY // Comment to disable setting feedrate multiplier via encoder +#endif + +// @section extras + +// minimum time in microseconds that a movement needs to take if the buffer is emptied. +#define DEFAULT_MINSEGMENTTIME 20000 + +// If defined the movements slow down when the look ahead buffer is only half full +#define SLOWDOWN + +// Frequency limit +// See nophead's blog for more info +// Not working O +//#define XY_FREQUENCY_LIMIT 15 + +// Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end +// of the buffer and all stops. This should not be much greater than zero and should only be changed +// if unwanted behavior is observed on a user's machine when running at very slow speeds. +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) + +// +// Use Junction Deviation instead of traditional Jerk Limiting +// +//#define JUNCTION_DEVIATION +#if ENABLED(JUNCTION_DEVIATION) + #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +#endif + +/** + * Adaptive Step Smoothing increases the resolution of multi-axis moves, particularly at step frequencies + * below 1kHz (for AVR) or 10kHz (for ARM), where aliasing between axes in multi-axis moves causes audible + * vibration and surface artifacts. The algorithm adapts to provide the best possible step smoothing at the + * lowest stepping frequencies. + */ +//#define ADAPTIVE_STEP_SMOOTHING + +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +#define MICROSTEP1 LOW,LOW,LOW +#define MICROSTEP2 HIGH,LOW,LOW +#define MICROSTEP4 LOW,HIGH,LOW +#define MICROSTEP8 HIGH,HIGH,LOW +#define MICROSTEP16 LOW,LOW,HIGH +#define MICROSTEP32 HIGH,LOW,HIGH + +// Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. +#define MICROSTEP_MODES { 32, 32, 32, 32, 32, 32 } // [1,2,4,8,16] + +/** + * @section stepper motor current + * + * Some boards have a means of setting the stepper motor current via firmware. + * + * The power on motor currents are set by: + * PWM_MOTOR_CURRENT - used by MINIRAMBO & ULTIMAIN_2 + * known compatible chips: A4982 + * DIGIPOT_MOTOR_CURRENT - used by BQ_ZUM_MEGA_3D, RAMBO & SCOOVO_X9H + * known compatible chips: AD5206 + * DAC_MOTOR_CURRENT_DEFAULT - used by PRINTRBOARD_REVF & RIGIDBOARD_V2 + * known compatible chips: MCP4728 + * DIGIPOT_I2C_MOTOR_CURRENTS - used by 5DPRINT, AZTEEG_X3_PRO, AZTEEG_X5_MINI_WIFI, MIGHTYBOARD_REVE + * known compatible chips: MCP4451, MCP4018 + * + * Motor currents can also be set by M907 - M910 and by the LCD. + * M907 - applies to all. + * M908 - BQ_ZUM_MEGA_3D, RAMBO, PRINTRBOARD_REVF, RIGIDBOARD_V2 & SCOOVO_X9H + * M909, M910 & LCD - only PRINTRBOARD_REVF & RIGIDBOARD_V2 + */ +#define PWM_MOTOR_CURRENT { 1200, 1200, 1200 } // Values in milliamps +//#define DIGIPOT_MOTOR_CURRENT { 135,135,135,135,135 } // Values 0-255 (RAMBO 135 = ~0.75A, 185 = ~1A) +//#define DAC_MOTOR_CURRENT_DEFAULT { 70, 80, 90, 80 } // Default drive percent - X, Y, Z, E axis + +// Use an I2C based DIGIPOT (e.g., Azteeg X3 Pro) +//#define DIGIPOT_I2C +#if ENABLED(DIGIPOT_I2C) && !defined(DIGIPOT_I2C_ADDRESS_A) + /** + * Common slave addresses: + * + * A (A shifted) B (B shifted) IC + * Smoothie 0x2C (0x58) 0x2D (0x5A) MCP4451 + * AZTEEG_X3_PRO 0x2C (0x58) 0x2E (0x5C) MCP4451 + * AZTEEG_X5_MINI_WIFI 0x58 0x5C MCP4451 + * MIGHTYBOARD_REVE 0x2F (0x5E) MCP4018 + */ + #define DIGIPOT_I2C_ADDRESS_A 0x2C // unshifted slave address for first DIGIPOT + #define DIGIPOT_I2C_ADDRESS_B 0x2D // unshifted slave address for second DIGIPOT +#endif + +//#define DIGIPOT_MCP4018 // Requires library from https://github.com/stawel/SlowSoftI2CMaster +#define DIGIPOT_I2C_NUM_CHANNELS 8 // 5DPRINT: 4 AZTEEG_X3_PRO: 8 MKS SBASE: 5 +// Actual motor currents in Amps. The number of entries must match DIGIPOT_I2C_NUM_CHANNELS. +// These correspond to the physical drivers, so be mindful if the order is changed. +#define DIGIPOT_I2C_MOTOR_CURRENTS { 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 } // AZTEEG_X3_PRO + +//=========================================================================== +//=============================Additional Features=========================== +//=========================================================================== + +// @section lcd + +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + +// Include a page of printer information in the LCD Main Menu +//#define LCD_INFO_MENU + +// Scroll a longer status message into view +//#define STATUS_MESSAGE_SCROLLING + +// On the Info Screen, display XY with one decimal place when possible +//#define LCD_DECIMAL_SMALL_XY + +// The timeout (in ms) to return to the status screen from sub-menus +//#define LCD_TIMEOUT_TO_STATUS 15000 + +// Add an 'M73' G-code to set the current percentage +//#define LCD_SET_PROGRESS_MANUALLY + +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS + //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing + #if ENABLED(LCD_PROGRESS_BAR) + #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar + #define PROGRESS_BAR_MSG_TIME 3000 // (ms) Amount of time to show the status message + #define PROGRESS_MSG_EXPIRE 0 // (ms) Amount of time to retain the status message (0=forever) + //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it + //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar + #endif +#endif // HAS_PRINT_PROGRESS + +/** + * LED Control Menu + * Enable this feature to add LED Control to the LCD menu + */ +//#define LED_CONTROL_MENU +#if ENABLED(LED_CONTROL_MENU) + #define LED_COLOR_PRESETS // Enable the Preset Color menu option + #if ENABLED(LED_COLOR_PRESETS) + #define LED_USER_PRESET_RED 255 // User defined RED value + #define LED_USER_PRESET_GREEN 128 // User defined GREEN value + #define LED_USER_PRESET_BLUE 0 // User defined BLUE value + #define LED_USER_PRESET_WHITE 255 // User defined WHITE value + #define LED_USER_PRESET_BRIGHTNESS 255 // User defined intensity + //#define LED_USER_PRESET_STARTUP // Have the printer display the user preset color on startup + #endif +#endif // LED_CONTROL_MENU + +#if ENABLED(SDSUPPORT) + + // Some RAMPS and other boards don't detect when an SD card is inserted. You can work + // around this by connecting a push button or single throw switch to the pin defined + // as SD_DETECT_PIN in your board's pins definitions. + // This setting should be disabled unless you are using a push button, pulling the pin to ground. + // Note: This is always disabled for ULTIPANEL (except ELB_FULL_GRAPHIC_CONTROLLER). + #define SD_DETECT_INVERTED + + #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. + + // Reverse SD sort to show "more recent" files first, according to the card's FAT. + // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. + #define SDCARD_RATHERRECENTFIRST + + // Add an option in the menu to run all auto#.g files + //#define MENU_ADDAUTOSTART + + /** + * Continue after Power-Loss (Creality3D) + * + * Store the current state to the SD Card at the start of each layer + * during SD printing. If the recovery file is found at boot time, present + * an option on the LCD screen to continue the print from the last-known + * point in the file. + */ + //#define POWER_LOSS_RECOVERY + #if ENABLED(POWER_LOSS_RECOVERY) + //#define POWER_LOSS_PIN 44 // Pin to detect power loss + //#define POWER_LOSS_STATE HIGH // State of pin indicating power loss + #endif + + /** + * Sort SD file listings in alphabetical order. + * + * With this option enabled, items on SD cards will be sorted + * by name for easier navigation. + * + * By default... + * + * - Use the slowest -but safest- method for sorting. + * - Folders are sorted to the top. + * - The sort key is statically allocated. + * - No added G-code (M34) support. + * - 40 item sorting limit. (Items after the first 40 are unsorted.) + * + * SD sorting uses static allocation (as set by SDSORT_LIMIT), allowing the + * compiler to calculate the worst-case usage and throw an error if the SRAM + * limit is exceeded. + * + * - SDSORT_USES_RAM provides faster sorting via a static directory buffer. + * - SDSORT_USES_STACK does the same, but uses a local stack-based buffer. + * - SDSORT_CACHE_NAMES will retain the sorted file listing in RAM. (Expensive!) + * - SDSORT_DYNAMIC_RAM only uses RAM when the SD menu is visible. (Use with caution!) + */ + //#define SDCARD_SORT_ALPHA + + // SD Card Sorting options + #if ENABLED(SDCARD_SORT_ALPHA) + #define SDSORT_LIMIT 40 // Maximum number of sorted items (10-256). Costs 27 bytes each. + #define FOLDER_SORTING -1 // -1=above 0=none 1=below + #define SDSORT_GCODE false // Allow turning sorting on/off with LCD and M34 g-code. + #define SDSORT_USES_RAM false // Pre-allocate a static array for faster pre-sorting. + #define SDSORT_USES_STACK false // Prefer the stack for pre-sorting to give back some SRAM. (Negated by next 2 options.) + #define SDSORT_CACHE_NAMES false // Keep sorted items in RAM longer for speedy performance. Most expensive option. + #define SDSORT_DYNAMIC_RAM false // Use dynamic allocation (within SD menus). Least expensive option. Set SDSORT_LIMIT before use! + #define SDSORT_CACHE_VFATS 2 // Maximum number of 13-byte VFAT entries to use for sorting. + // Note: Only affects SCROLL_LONG_FILENAMES with SDSORT_CACHE_NAMES but not SDSORT_DYNAMIC_RAM. + #endif + + // This allows hosts to request long names for files and folders with M33 + //#define LONG_FILENAME_HOST_SUPPORT + + // Enable this option to scroll long filenames in the SD card menu + //#define SCROLL_LONG_FILENAMES + + /** + * This option allows you to abort SD printing when any endstop is triggered. + * This feature must be enabled with "M540 S1" or from the LCD menu. + * To have any effect, endstops must be enabled during SD printing. + */ + //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED + + /** + * This option makes it easier to print the same SD Card file again. + * On print completion the LCD Menu will open with the file selected. + * You can just click to start the print, or navigate elsewhere. + */ + //#define SD_REPRINT_LAST_SELECTED_FILE + + /** + * Auto-report SdCard status with M27 S + */ + //#define AUTO_REPORT_SD_STATUS + + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + +#endif // SDSUPPORT + +/** + * Additional options for Graphical Displays + * + * Use the optimizations here to improve printing performance, + * which can be adversely affected by graphical display drawing, + * especially when doing several short moves, and when printing + * on DELTA and SCARA machines. + * + * Some of these options may result in the display lagging behind + * controller events, as there is a trade-off between reliable + * printing performance versus fast display updates. + */ +#if HAS_GRAPHICAL_LCD + // Show SD percentage next to the progress bar + //#define DOGM_SD_PERCENT + + // Enable to save many cycles by drawing a hollow frame on the Info Screen + #define XYZ_HOLLOW_FRAME + + // Enable to save many cycles by drawing a hollow frame on Menu Screens + #define MENU_HOLLOW_FRAME + + // A bigger font is available for edit items. Costs 3120 bytes of PROGMEM. + // Western only. Not available for Cyrillic, Kana, Turkish, Greek, or Chinese. + //#define USE_BIG_EDIT_FONT + + // A smaller font may be used on the Info Screen. Costs 2300 bytes of PROGMEM. + // Western only. Not available for Cyrillic, Kana, Turkish, Greek, or Chinese. + //#define USE_SMALL_INFOFONT + + // Enable this option and reduce the value to optimize screen updates. + // The normal delay is 10µs. Use the lowest value that still gives a reliable display. + //#define DOGM_SPI_DELAY_US 5 + + // Swap the CW/CCW indicators in the graphics overlay + //#define OVERLAY_GFX_REVERSE + + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + * + * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. + * This will prevent position updates from being displayed. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + +#endif // DOGLCD + +// @section safety + +// The hardware watchdog should reset the microcontroller disabling all outputs, +// in case the firmware gets stuck and doesn't do temperature regulation. +#define USE_WATCHDOG + +#if ENABLED(USE_WATCHDOG) + // If you have a watchdog reboot in an ArduinoMega2560 then the device will hang forever, as a watchdog reset will leave the watchdog on. + // The "WATCHDOG_RESET_MANUAL" goes around this by not using the hardware reset. + // However, THIS FEATURE IS UNSAFE!, as it will only work if interrupts are disabled. And the code could hang in an interrupt routine with interrupts disabled. + //#define WATCHDOG_RESET_MANUAL +#endif + +// @section lcd + +/** + * Babystepping enables movement of the axes by tiny increments without changing + * the current position values. This feature is used primarily to adjust the Z + * axis in the first layer of a print in real-time. + * + * Warning: Does not respect endstops! + */ +//#define BABYSTEPPING +#if ENABLED(BABYSTEPPING) + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. + + //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping + #if ENABLED(BABYSTEP_ZPROBE_OFFSET) + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + #endif +#endif + +// @section extruder + +/** + * Linear Pressure Control v1.5 + * + * Assumption: advance [steps] = k * (delta velocity [steps/s]) + * K=0 means advance disabled. + * + * NOTE: K values for LIN_ADVANCE 1.5 differ from earlier versions! + * + * Set K around 0.22 for 3mm PLA Direct Drive with ~6.5cm between the drive gear and heatbreak. + * Larger K values will be needed for flexible filament and greater distances. + * If this algorithm produces a higher speed offset than the extruder can handle (compared to E jerk) + * print acceleration will be reduced during the affected moves to keep within the limit. + * + * See http://marlinfw.org/docs/features/lin_advance.html for full instructions. + * Mention @Sebastianv650 on GitHub to alert the author of any issues. + */ +//#define LIN_ADVANCE +#if ENABLED(LIN_ADVANCE) + #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed + //#define LA_DEBUG // If enabled, this will generate debug information output over USB. +#endif + +// @section leveling + +#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_UBL) + // Override the mesh area if the automatic (max) area is too large + //#define MESH_MIN_X MESH_INSET + //#define MESH_MIN_Y MESH_INSET + //#define MESH_MAX_X X_BED_SIZE - (MESH_INSET) + //#define MESH_MAX_Y Y_BED_SIZE - (MESH_INSET) +#endif + +/** + * Repeatedly attempt G29 leveling until it succeeds. + * Stop after G29_MAX_RETRIES attempts. + */ +//#define G29_RETRY_AND_RECOVER +#if ENABLED(G29_RETRY_AND_RECOVER) + #define G29_MAX_RETRIES 3 + #define G29_HALT_ON_FAILURE + /** + * Specify the GCODE commands that will be executed when leveling succeeds, + * between attempts, and after the maximum number of retries have been tried. + */ + #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." + #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" + #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" + /** + * Specify an action command to send to the host on a recovery attempt or failure. + * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. + * The host must be configured to handle the action command. + */ + #define G29_ACTION_ON_RECOVER "probe_rewipe" + #define G29_ACTION_ON_FAILURE "probe_failed" +#endif + +// @section extras + +// +// G2/G3 Arc Support +// +#define ARC_SUPPORT // Disable this feature to save ~3226 bytes +#if ENABLED(ARC_SUPPORT) + #define MM_PER_ARC_SEGMENT 1 // Length of each arc segment + #define N_ARC_CORRECTION 25 // Number of intertpolated segments between corrections + //#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles + //#define CNC_WORKSPACE_PLANES // Allow G2/G3 to operate in XY, ZX, or YZ planes +#endif + +// Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes. +//#define BEZIER_CURVE_SUPPORT + +// G38.2 and G38.3 Probe Target +// Set MULTIPLE_PROBING if you want G38 to double touch +//#define G38_PROBE_TARGET +#if ENABLED(G38_PROBE_TARGET) + #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move) +#endif + +// Moves (or segments) with fewer steps than this will be joined with the next move +#define MIN_STEPS_PER_SEGMENT 6 + +/** + * Minimum delay after setting the stepper DIR (in ns) + * 0 : No delay (Expect at least 10µS since one Stepper ISR must transpire) + * 20 : Minimum for TMC2xxx drivers + * 200 : Minimum for A4988 drivers + * 400 : Minimum for A5984 drivers + * 500 : Minimum for LV8729 drivers (guess, no info in datasheet) + * 650 : Minimum for DRV8825 drivers + * 1500 : Minimum for TB6600 drivers (guess, no info in datasheet) + * 15000 : Minimum for TB6560 drivers (guess, no info in datasheet) + * + * Override the default value based on the driver type set in Configuration.h. + */ +//#define MINIMUM_STEPPER_DIR_DELAY 650 + +/** + * Minimum stepper driver pulse width (in µs) + * 0 : Smallest possible width the MCU can produce, compatible with TMC2xxx drivers + * 1 : Minimum for A4988, A5984, and LV8729 stepper drivers + * 2 : Minimum for DRV8825 stepper drivers + * 3 : Minimum for TB6600 stepper drivers + * 30 : Minimum for TB6560 stepper drivers + * + * Override the default value based on the driver type set in Configuration.h. + */ +//#define MINIMUM_STEPPER_PULSE 2 + +/** + * Maximum stepping rate (in Hz) the stepper driver allows + * If undefined, defaults to 1MHz / (2 * MINIMUM_STEPPER_PULSE) + * 500000 : Maximum for A4988 stepper driver + * 400000 : Maximum for TMC2xxx stepper drivers + * 250000 : Maximum for DRV8825 stepper driver + * 150000 : Maximum for TB6600 stepper driver + * 130000 : Maximum for LV8729 stepper driver + * 15000 : Maximum for TB6560 stepper driver + * + * Override the default value based on the driver type set in Configuration.h. + */ +//#define MAXIMUM_STEPPER_RATE 250000 + +// @section temperature + +// Control heater 0 and heater 1 in parallel. +//#define HEATERS_PARALLEL + +//=========================================================================== +//================================= Buffers ================================= +//=========================================================================== + +// @section hidden + +// The number of linear motions that can be in the plan at any give time. +// THE BLOCK_BUFFER_SIZE NEEDS TO BE A POWER OF 2 (e.g. 8, 16, 32) because shifts and ors are used to do the ring-buffering. +#if ENABLED(SDSUPPORT) + #define BLOCK_BUFFER_SIZE 16 // SD,LCD,Buttons take more memory, block buffer needs to be smaller +#else + #define BLOCK_BUFFER_SIZE 16 // maximize block buffer +#endif + +// @section serial + +// The ASCII buffer for serial input +#define MAX_CMD_SIZE 96 +#define BUFSIZE 4 + +// Transmission to Host Buffer Size +// To save 386 bytes of PROGMEM (and TX_BUFFER_SIZE+3 bytes of RAM) set to 0. +// To buffer a simple "ok" you need 4 bytes. +// For ADVANCED_OK (M105) you need 32 bytes. +// For debug-echo: 128 bytes for the optimal speed. +// Other output doesn't need to be that speedy. +// :[0, 2, 4, 8, 16, 32, 64, 128, 256] +#define TX_BUFFER_SIZE 0 + +// Host Receive Buffer Size +// Without XON/XOFF flow control (see SERIAL_XON_XOFF below) 32 bytes should be enough. +// To use flow control, set this buffer size to at least 1024 bytes. +// :[0, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048] +//#define RX_BUFFER_SIZE 1024 + +#if RX_BUFFER_SIZE >= 1024 + // Enable to have the controller send XON/XOFF control characters to + // the host to signal the RX buffer is becoming full. + //#define SERIAL_XON_XOFF +#endif + +#if ENABLED(SDSUPPORT) + // Enable this option to collect and display the maximum + // RX queue usage after transferring a file to SD. + //#define SERIAL_STATS_MAX_RX_QUEUED + + // Enable this option to collect and display the number + // of dropped bytes after a file transfer to SD. + //#define SERIAL_STATS_DROPPED_RX +#endif + +// Enable an emergency-command parser to intercept certain commands as they +// enter the serial receive buffer, so they cannot be blocked. +// Currently handles M108, M112, M410 +// Does not work on boards using AT90USB (USBCON) processors! +//#define EMERGENCY_PARSER + +// Bad Serial-connections can miss a received command by sending an 'ok' +// Therefore some clients abort after 30 seconds in a timeout. +// Some other clients start sending commands while receiving a 'wait'. +// This "wait" is only sent when the buffer is empty. 1 second is a good value here. +//#define NO_TIMEOUTS 1000 // Milliseconds + +// Some clients will have this feature soon. This could make the NO_TIMEOUTS unnecessary. +//#define ADVANCED_OK + +// @section extras + +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + +/** + * Firmware-based and LCD-controlled retract + * + * Add G10 / G11 commands for automatic firmware-based retract / recover. + * Use M207 and M208 to define parameters for retract / recover. + * + * Use M209 to enable or disable auto-retract. + * With auto-retract enabled, all G1 E moves within the set range + * will be converted to firmware-based retract/recover moves. + * + * Be sure to turn off auto-retract during filament change. + * + * Note that M207 / M208 / M209 settings are saved to EEPROM. + * + */ +//#define FWRETRACT +#if ENABLED(FWRETRACT) + #define FWRETRACT_AUTORETRACT // costs ~500 bytes of PROGMEM + #if ENABLED(FWRETRACT_AUTORETRACT) + #define MIN_AUTORETRACT 0.1 // When auto-retract is on, convert E moves of this length and over + #define MAX_AUTORETRACT 10.0 // Upper limit for auto-retract conversion + #endif + #define RETRACT_LENGTH 3 // Default retract length (positive mm) + #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change + #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) + #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) + #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) + #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) + #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif +#endif + +/** + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. + */ +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif + +/** + * Advanced Pause + * Experimental feature for filament change support and for parking the nozzle when paused. + * Adds the GCode M600 for initiating filament change. + * If PARK_HEAD_ON_PAUSE enabled, adds the GCode M125 to pause printing and park the nozzle. + * + * Requires an LCD display. + * Requires NOZZLE_PARK_FEATURE. + * This feature is required for the default FILAMENT_RUNOUT_SCRIPT. + */ +//#define ADVANCED_PAUSE_FEATURE +#if ENABLED(ADVANCED_PAUSE_FEATURE) + #define PAUSE_PARK_RETRACT_FEEDRATE 60 // (mm/s) Initial retract feedrate. + #define PAUSE_PARK_RETRACT_LENGTH 2 // (mm) Initial retract. + // This short retract is done immediately, before parking the nozzle. + #define FILAMENT_CHANGE_UNLOAD_FEEDRATE 10 // (mm/s) Unload filament feedrate. This can be pretty fast. + #define FILAMENT_CHANGE_UNLOAD_ACCEL 25 // (mm/s^2) Lower acceleration may allow a faster feedrate. + #define FILAMENT_CHANGE_UNLOAD_LENGTH 100 // (mm) The length of filament for a complete unload. + // For Bowden, the full length of the tube and nozzle. + // For direct drive, the full length of the nozzle. + // Set to 0 for manual unloading. + #define FILAMENT_CHANGE_SLOW_LOAD_FEEDRATE 6 // (mm/s) Slow move when starting load. + #define FILAMENT_CHANGE_SLOW_LOAD_LENGTH 0 // (mm) Slow length, to allow time to insert material. + // 0 to disable start loading and skip to fast load only + #define FILAMENT_CHANGE_FAST_LOAD_FEEDRATE 6 // (mm/s) Load filament feedrate. This can be pretty fast. + #define FILAMENT_CHANGE_FAST_LOAD_ACCEL 25 // (mm/s^2) Lower acceleration may allow a faster feedrate. + #define FILAMENT_CHANGE_FAST_LOAD_LENGTH 0 // (mm) Load length of filament, from extruder gear to nozzle. + // For Bowden, the full length of the tube and nozzle. + // For direct drive, the full length of the nozzle. + //#define ADVANCED_PAUSE_CONTINUOUS_PURGE // Purge continuously up to the purge length until interrupted. + #define ADVANCED_PAUSE_PURGE_FEEDRATE 3 // (mm/s) Extrude feedrate (after loading). Should be slower than load feedrate. + #define ADVANCED_PAUSE_PURGE_LENGTH 50 // (mm) Length to extrude after loading. + // Set to 0 for manual extrusion. + // Filament can be extruded repeatedly from the Filament Change menu + // until extrusion is consistent, and to purge old filament. + + // Filament Unload does a Retract, Delay, and Purge first: + #define FILAMENT_UNLOAD_RETRACT_LENGTH 13 // (mm) Unload initial retract length. + #define FILAMENT_UNLOAD_DELAY 5000 // (ms) Delay for the filament to cool after retract. + #define FILAMENT_UNLOAD_PURGE_LENGTH 8 // (mm) An unretract is done, then this length is purged. + + #define PAUSE_PARK_NOZZLE_TIMEOUT 45 // (seconds) Time limit before the nozzle is turned off for safety. + #define FILAMENT_CHANGE_ALERT_BEEPS 10 // Number of alert beeps to play when a response is needed. + #define PAUSE_PARK_NO_STEPPER_TIMEOUT // Enable for XYZ steppers to stay powered on during filament change. + + //#define PARK_HEAD_ON_PAUSE // Park the nozzle during pause and filament change. + //#define HOME_BEFORE_FILAMENT_CHANGE // Ensure homing has been completed prior to parking for filament change + + //#define FILAMENT_LOAD_UNLOAD_GCODES // Add M701/M702 Load/Unload G-codes, plus Load/Unload in the LCD Prepare menu. + //#define FILAMENT_UNLOAD_ALL_EXTRUDERS // Allow M702 to unload all extruders above a minimum target temp (as set by M302) +#endif + +// @section tmc + +/** + * TMC26X Stepper Driver options + * + * The TMC26XStepper library is required for this stepper driver. + * https://github.com/trinamic/TMC26XStepper + */ +#if HAS_DRIVER(TMC26X) + + #define X_MAX_CURRENT 1000 // in mA + #define X_SENSE_RESISTOR 91 // in mOhms + #define X_MICROSTEPS 16 // number of microsteps + + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + + #define E5_MAX_CURRENT 1000 + #define E5_SENSE_RESISTOR 91 + #define E5_MICROSTEPS 16 + +#endif // TMC26X + +// @section tmc_smart + +/** + * To use TMC2130 stepper drivers in SPI mode connect your SPI pins to + * the hardware SPI interface on your board and define the required CS pins + * in your `pins_MYBOARD.h` file. (e.g., RAMPS 1.4 uses AUX3 pins `X_CS_PIN 53`, `Y_CS_PIN 49`, etc.). + * You may also use software SPI if you wish to use general purpose IO pins. + * + * The TMC2130Stepper library is required for this stepper driver. + * https://github.com/teemuatlut/TMC2130Stepper + * + * To use TMC2208 stepper UART-configurable stepper drivers + * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN + * to PDN_UART without a resistor. + * The drivers can also be used with hardware serial. + * + * The TMC2208Stepper library is required for this stepper driver. + * https://github.com/teemuatlut/TMC2208Stepper + */ +#if HAS_TRINAMIC + + #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 + #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current + #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 + + #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. + #define X_MICROSTEPS 16 // 0..256 + + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + + #define E1_CURRENT 800 + #define E1_MICROSTEPS 16 + + #define E2_CURRENT 800 + #define E2_MICROSTEPS 16 + + #define E3_CURRENT 800 + #define E3_MICROSTEPS 16 + + #define E4_CURRENT 800 + #define E4_MICROSTEPS 16 + + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + + /** + * Use software SPI for TMC2130. + * The default SW SPI pins are defined the respective pins files, + * but you can override or define them here. + */ + //#define TMC_USE_SW_SPI + //#define TMC_SW_MOSI -1 + //#define TMC_SW_MISO -1 + //#define TMC_SW_SCK -1 + + /** + * Use Trinamic's ultra quiet stepping mode. + * When disabled, Marlin will use spreadCycle stepping mode. + */ + #define STEALTHCHOP + + /** + * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * like overtemperature and short to ground. TMC2208 requires hardware serial. + * In the case of overtemperature Marlin can decrease the driver current until error condition clears. + * Other detected conditions can be used to stop the current print. + * Relevant g-codes: + * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. + * M911 - Report stepper driver overtemperature pre-warn condition. + * M912 - Clear stepper driver overtemperature pre-warn condition flag. + * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + */ + //#define MONITOR_DRIVER_STATUS + + #if ENABLED(MONITOR_DRIVER_STATUS) + #define CURRENT_STEP_DOWN 50 // [mA] + #define REPORT_CURRENT_CHANGE + #define STOP_ON_ERROR + #endif + + /** + * The driver will switch to spreadCycle when stepper speed is over HYBRID_THRESHOLD. + * This mode allows for faster movements at the expense of higher noise levels. + * STEALTHCHOP needs to be enabled. + * M913 X/Y/Z/E to live tune the setting + */ + //#define HYBRID_THRESHOLD + + #define X_HYBRID_THRESHOLD 100 // [mm/s] + #define X2_HYBRID_THRESHOLD 100 + #define Y_HYBRID_THRESHOLD 100 + #define Y2_HYBRID_THRESHOLD 100 + #define Z_HYBRID_THRESHOLD 3 + #define Z2_HYBRID_THRESHOLD 3 + #define Z3_HYBRID_THRESHOLD 3 + #define E0_HYBRID_THRESHOLD 30 + #define E1_HYBRID_THRESHOLD 30 + #define E2_HYBRID_THRESHOLD 30 + #define E3_HYBRID_THRESHOLD 30 + #define E4_HYBRID_THRESHOLD 30 + #define E5_HYBRID_THRESHOLD 30 + + /** + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. + * X, Y, and Z homing will always be done in spreadCycle mode. + * + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. + * Higher values make the system LESS sensitive. + * Lower value make the system MORE sensitive. + * Too low values can lead to false positives, while too high values will collide the axis without triggering. + * It is advised to set X/Y/Z_HOME_BUMP_MM to 0. + * M914 X/Y/Z to live tune the setting + */ + //#define SENSORLESS_HOMING // TMC2130 only + + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 + #endif + + /** + * Enable M122 debugging command for TMC stepper drivers. + * M122 S0/1 will enable continous reporting. + */ + //#define TMC_DEBUG + + /** + * M915 Z Axis Calibration + * + * - Adjust Z stepper current, + * - Drive the Z axis to its physical maximum, and + * - Home Z to account for the lost steps. + * + * Use M915 Snn to specify the current. + * Use M925 Znn to add extra Z height to Z_MAX_POS. + */ + //#define TMC_Z_CALIBRATION + #if ENABLED(TMC_Z_CALIBRATION) + #define CALIBRATION_CURRENT 250 + #define CALIBRATION_EXTRA_HEIGHT 10 + #endif + + /** + * You can set your own advanced settings by filling in predefined functions. + * A list of available functions can be found on the library github page + * https://github.com/teemuatlut/TMC2130Stepper + * https://github.com/teemuatlut/TMC2208Stepper + * + * Example: + * #define TMC_ADV() { \ + * stepperX.diag0_temp_prewarn(1); \ + * stepperY.interpolate(0); \ + * } + */ + #define TMC_ADV() { } + +#endif // HAS_TRINAMIC + +// @section L6470 + +/** + * L6470 Stepper Driver options + * + * The Arduino-L6470 library is required for this stepper driver. + * https://github.com/ameyer/Arduino-L6470 + */ +#if HAS_DRIVER(L6470) + + #define X_MICROSTEPS 16 // number of microsteps + #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off + #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + + #define X2_MICROSTEPS 16 + #define X2_OVERCURRENT 2000 + #define X2_STALLCURRENT 1500 + + #define Y_MICROSTEPS 16 + #define Y_OVERCURRENT 2000 + #define Y_STALLCURRENT 1500 + + #define Y2_MICROSTEPS 16 + #define Y2_OVERCURRENT 2000 + #define Y2_STALLCURRENT 1500 + + #define Z_MICROSTEPS 16 + #define Z_OVERCURRENT 2000 + #define Z_STALLCURRENT 1500 + + #define Z2_MICROSTEPS 16 + #define Z2_OVERCURRENT 2000 + #define Z2_STALLCURRENT 1500 + + #define Z3_MICROSTEPS 16 + #define Z3_OVERCURRENT 2000 + #define Z3_STALLCURRENT 1500 + + #define E0_MICROSTEPS 16 + #define E0_OVERCURRENT 2000 + #define E0_STALLCURRENT 1500 + + #define E1_MICROSTEPS 16 + #define E1_OVERCURRENT 2000 + #define E1_STALLCURRENT 1500 + + #define E2_MICROSTEPS 16 + #define E2_OVERCURRENT 2000 + #define E2_STALLCURRENT 1500 + + #define E3_MICROSTEPS 16 + #define E3_OVERCURRENT 2000 + #define E3_STALLCURRENT 1500 + + #define E4_MICROSTEPS 16 + #define E4_OVERCURRENT 2000 + #define E4_STALLCURRENT 1500 + + #define E5_MICROSTEPS 16 + #define E5_OVERCURRENT 2000 + #define E5_STALLCURRENT 1500 + +#endif // L6470 + +/** + * TWI/I2C BUS + * + * This feature is an EXPERIMENTAL feature so it shall not be used on production + * machines. Enabling this will allow you to send and receive I2C data from slave + * devices on the bus. + * + * ; Example #1 + * ; This macro send the string "Marlin" to the slave device with address 0x63 (99) + * ; It uses multiple M260 commands with one B arg + * M260 A99 ; Target slave address + * M260 B77 ; M + * M260 B97 ; a + * M260 B114 ; r + * M260 B108 ; l + * M260 B105 ; i + * M260 B110 ; n + * M260 S1 ; Send the current buffer + * + * ; Example #2 + * ; Request 6 bytes from slave device with address 0x63 (99) + * M261 A99 B5 + * + * ; Example #3 + * ; Example serial output of a M261 request + * echo:i2c-reply: from:99 bytes:5 data:hello + */ + +// @section i2cbus + +//#define EXPERIMENTAL_I2CBUS +#define I2C_SLAVE_ADDRESS 0 // Set a value from 8 to 127 to act as a slave + +// @section extras + +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + +/** + * Spindle & Laser control + * + * Add the M3, M4, and M5 commands to turn the spindle/laser on and off, and + * to set spindle speed, spindle direction, and laser power. + * + * SuperPid is a router/spindle speed controller used in the CNC milling community. + * Marlin can be used to turn the spindle on and off. It can also be used to set + * the spindle speed from 5,000 to 30,000 RPM. + * + * You'll need to select a pin for the ON/OFF function and optionally choose a 0-5V + * hardware PWM pin for the speed control and a pin for the rotation direction. + * + * See http://marlinfw.org/docs/configuration/laser_spindle.html for more config details. + */ +//#define SPINDLE_LASER_ENABLE +#if ENABLED(SPINDLE_LASER_ENABLE) + + #define SPINDLE_LASER_ENABLE_INVERT false // set to "true" if the on/off function is reversed + #define SPINDLE_LASER_PWM true // set to true if your controller supports setting the speed/power + #define SPINDLE_LASER_PWM_INVERT true // set to "true" if the speed/power goes up when you want it to go slower + #define SPINDLE_LASER_POWERUP_DELAY 5000 // delay in milliseconds to allow the spindle/laser to come up to speed/power + #define SPINDLE_LASER_POWERDOWN_DELAY 5000 // delay in milliseconds to allow the spindle to stop + #define SPINDLE_DIR_CHANGE true // set to true if your spindle controller supports changing spindle direction + #define SPINDLE_INVERT_DIR false + #define SPINDLE_STOP_ON_DIR_CHANGE true // set to true if Marlin should stop the spindle before changing rotation direction + + /** + * The M3 & M4 commands use the following equation to convert PWM duty cycle to speed/power + * + * SPEED/POWER = PWM duty cycle * SPEED_POWER_SLOPE + SPEED_POWER_INTERCEPT + * where PWM duty cycle varies from 0 to 255 + * + * set the following for your controller (ALL MUST BE SET) + */ + + #define SPEED_POWER_SLOPE 118.4 + #define SPEED_POWER_INTERCEPT 0 + #define SPEED_POWER_MIN 5000 + #define SPEED_POWER_MAX 30000 // SuperPID router controller 0 - 30,000 RPM + + //#define SPEED_POWER_SLOPE 0.3922 + //#define SPEED_POWER_INTERCEPT 0 + //#define SPEED_POWER_MIN 10 + //#define SPEED_POWER_MAX 100 // 0-100% +#endif + +/** + * Filament Width Sensor + * + * Measures the filament width in real-time and adjusts + * flow rate to compensate for any irregularities. + * + * Also allows the measured filament diameter to set the + * extrusion rate, so the slicer only has to specify the + * volume. + * + * Only a single extruder is supported at this time. + * + * 34 RAMPS_14 : Analog input 5 on the AUX2 connector + * 81 PRINTRBOARD : Analog input 2 on the Exp1 connector (version B,C,D,E) + * 301 RAMBO : Analog input 3 + * + * Note: May require analog pins to be defined for other boards. + */ +//#define FILAMENT_WIDTH_SENSOR + +#if ENABLED(FILAMENT_WIDTH_SENSOR) + #define FILAMENT_SENSOR_EXTRUDER_NUM 0 // Index of the extruder that has the filament sensor. :[0,1,2,3,4] + #define MEASUREMENT_DELAY_CM 14 // (cm) The distance from the filament sensor to the melting chamber + + #define FILWIDTH_ERROR_MARGIN 1.0 // (mm) If a measurement differs too much from nominal width ignore it + #define MAX_MEASUREMENT_DELAY 20 // (bytes) Buffer size for stored measurements (1 byte per cm). Must be larger than MEASUREMENT_DELAY_CM. + + #define DEFAULT_MEASURED_FILAMENT_DIA DEFAULT_NOMINAL_FILAMENT_DIA // Set measured to nominal initially + + // Display filament width on the LCD status line. Status messages will expire after 5 seconds. + //#define FILAMENT_LCD_DISPLAY +#endif + +/** + * CNC Coordinate Systems + * + * Enables G53 and G54-G59.3 commands to select coordinate systems + * and G92.1 to reset the workspace to native machine space. + */ +//#define CNC_COORDINATE_SYSTEMS + +/** + * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins + */ +//#define PINS_DEBUGGING + +/** + * Auto-report temperatures with M155 S + */ +#define AUTO_REPORT_TEMPERATURES + +/** + * Include capabilities in M115 output + */ +#define EXTENDED_CAPABILITIES_REPORT + +/** + * Disable all Volumetric extrusion options + */ +//#define NO_VOLUMETRICS + +#if DISABLED(NO_VOLUMETRICS) + /** + * Volumetric extrusion default state + * Activate to make volumetric extrusion the default method, + * with DEFAULT_NOMINAL_FILAMENT_DIA as the default diameter. + * + * M200 D0 to disable, M200 Dn to set a new diameter. + */ + //#define VOLUMETRIC_DEFAULT_ON +#endif + +/** + * Enable this option for a leaner build of Marlin that removes all + * workspace offsets, simplifying coordinate transformations, leveling, etc. + * + * - M206 and M428 are disabled. + * - G92 will revert to its behavior from Marlin 1.0. + */ +//#define NO_WORKSPACE_OFFSETS + +/** + * Set the number of proportional font spaces required to fill up a typical character space. + * This can help to better align the output of commands like `G29 O` Mesh Output. + * + * For clients that use a fixed-width font (like OctoPrint), leave this set to 1.0. + * Otherwise, adjust according to your client and font. + */ +#define PROPORTIONAL_FONT_RATIO 1.0 + +/** + * Spend 28 bytes of SRAM to optimize the GCode parser + */ +#define FASTER_GCODE_PARSER + +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + +/** + * User-defined menu items that execute custom GCode + */ +//#define CUSTOM_USER_MENUS +#if ENABLED(CUSTOM_USER_MENUS) + //#define CUSTOM_USER_MENU_TITLE "Custom Commands" + #define USER_SCRIPT_DONE "M117 User Script Done" + #define USER_SCRIPT_AUDIBLE_FEEDBACK + //#define USER_SCRIPT_RETURN // Return to status screen after a script + + #define USER_DESC_1 "Home & UBL Info" + #define USER_GCODE_1 "G28\nG29 W" + + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL + #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) + + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL + #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) + + #define USER_DESC_4 "Heat Bed/Home/Level" + #define USER_GCODE_4 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nG28\nG29" + + #define USER_DESC_5 "Home & Info" + #define USER_GCODE_5 "G28\nM503" +#endif + +/** + * Specify an action command to send to the host when the printer is killed. + * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. + * The host must be configured to handle the action command. + */ +//#define ACTION_ON_KILL "poweroff" + +/** + * Specify an action command to send to the host on pause and resume. + * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. + * The host must be configured to handle the action command. + */ +//#define ACTION_ON_PAUSE "pause" +//#define ACTION_ON_RESUME "resume" + +//=========================================================================== +//====================== I2C Position Encoder Settings ====================== +//=========================================================================== + +/** + * I2C position encoders for closed loop control. + * Developed by Chris Barr at Aus3D. + * + * Wiki: http://wiki.aus3d.com.au/Magnetic_Encoder + * Github: https://github.com/Aus3D/MagneticEncoder + * + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ + * + * Reilabuild encoders have been modified to improve reliability. + */ + +//#define I2C_POSITION_ENCODERS +#if ENABLED(I2C_POSITION_ENCODERS) + + #define I2CPE_ENCODER_CNT 1 // The number of encoders installed; max of 5 + // encoders supported currently. + + #define I2CPE_ENC_1_ADDR I2CPE_PRESET_ADDR_X // I2C address of the encoder. 30-200. + #define I2CPE_ENC_1_AXIS X_AXIS // Axis the encoder module is installed on. _AXIS. + #define I2CPE_ENC_1_TYPE I2CPE_ENC_TYPE_LINEAR // Type of encoder: I2CPE_ENC_TYPE_LINEAR -or- + // I2CPE_ENC_TYPE_ROTARY. + #define I2CPE_ENC_1_TICKS_UNIT 2048 // 1024 for magnetic strips with 2mm poles; 2048 for + // 1mm poles. For linear encoders this is ticks / mm, + // for rotary encoders this is ticks / revolution. + //#define I2CPE_ENC_1_TICKS_REV (16 * 200) // Only needed for rotary encoders; number of stepper + // steps per full revolution (motor steps/rev * microstepping) + //#define I2CPE_ENC_1_INVERT // Invert the direction of axis travel. + #define I2CPE_ENC_1_EC_METHOD I2CPE_ECM_MICROSTEP // Type of error error correction. + #define I2CPE_ENC_1_EC_THRESH 0.10 // Threshold size for error (in mm) above which the + // printer will attempt to correct the error; errors + // smaller than this are ignored to minimize effects of + // measurement noise / latency (filter). + + #define I2CPE_ENC_2_ADDR I2CPE_PRESET_ADDR_Y // Same as above, but for encoder 2. + #define I2CPE_ENC_2_AXIS Y_AXIS + #define I2CPE_ENC_2_TYPE I2CPE_ENC_TYPE_LINEAR + #define I2CPE_ENC_2_TICKS_UNIT 2048 + //#define I2CPE_ENC_2_TICKS_REV (16 * 200) + //#define I2CPE_ENC_2_INVERT + #define I2CPE_ENC_2_EC_METHOD I2CPE_ECM_MICROSTEP + #define I2CPE_ENC_2_EC_THRESH 0.10 + + #define I2CPE_ENC_3_ADDR I2CPE_PRESET_ADDR_Z // Encoder 3. Add additional configuration options + #define I2CPE_ENC_3_AXIS Z_AXIS // as above, or use defaults below. + + #define I2CPE_ENC_4_ADDR I2CPE_PRESET_ADDR_E // Encoder 4. + #define I2CPE_ENC_4_AXIS E_AXIS + + #define I2CPE_ENC_5_ADDR 34 // Encoder 5. + #define I2CPE_ENC_5_AXIS E_AXIS + + // Default settings for encoders which are enabled, but without settings configured above. + #define I2CPE_DEF_TYPE I2CPE_ENC_TYPE_LINEAR + #define I2CPE_DEF_ENC_TICKS_UNIT 2048 + #define I2CPE_DEF_TICKS_REV (16 * 200) + #define I2CPE_DEF_EC_METHOD I2CPE_ECM_NONE + #define I2CPE_DEF_EC_THRESH 0.1 + + //#define I2CPE_ERR_THRESH_ABORT 100.0 // Threshold size for error (in mm) error on any given + // axis after which the printer will abort. Comment out to + // disable abort behaviour. + + #define I2CPE_TIME_TRUSTED 10000 // After an encoder fault, there must be no further fault + // for this amount of time (in ms) before the encoder + // is trusted again. + + /** + * Position is checked every time a new command is executed from the buffer but during long moves, + * this setting determines the minimum update time between checks. A value of 100 works well with + * error rolling average when attempting to correct only for skips and not for vibration. + */ + #define I2CPE_MIN_UPD_TIME_MS 4 // (ms) Minimum time between encoder checks. + + // Use a rolling average to identify persistant errors that indicate skips, as opposed to vibration and noise. + #define I2CPE_ERR_ROLLING_AVERAGE + +#endif // I2C_POSITION_ENCODERS + +/** + * MAX7219 Debug Matrix + * + * Add support for a low-cost 8x8 LED Matrix based on the Max7219 chip as a realtime status display. + * Requires 3 signal wires. Some useful debug options are included to demonstrate its usage. + */ +//#define MAX7219_DEBUG +#if ENABLED(MAX7219_DEBUG) + #define MAX7219_CLK_PIN 64 + #define MAX7219_DIN_PIN 57 + #define MAX7219_LOAD_PIN 44 + + //#define MAX7219_GCODE // Add the M7219 G-code to control the LED matrix + #define MAX7219_INIT_TEST 2 // Do a test pattern at initialization (Set to 2 for spiral) + #define MAX7219_NUMBER_UNITS 1 // Number of Max7219 units in chain. + #define MAX7219_ROTATE 0 // Rotate the display clockwise (in multiples of +/- 90°) + // connector at: right=0 bottom=-90 top=90 left=180 + //#define MAX7219_REVERSE_ORDER // The individual LED matrix units may be in reversed order + + /** + * Sample debug features + * If you add more debug displays, be careful to avoid conflicts! + */ + #define MAX7219_DEBUG_PRINTER_ALIVE // Blink corner LED of 8x8 matrix to show that the firmware is functioning + #define MAX7219_DEBUG_PLANNER_HEAD 3 // Show the planner queue head position on this and the next LED matrix row + #define MAX7219_DEBUG_PLANNER_TAIL 5 // Show the planner queue tail position on this and the next LED matrix row + + #define MAX7219_DEBUG_PLANNER_QUEUE 0 // Show the current planner queue depth on this and the next LED matrix row + // If you experience stuttering, reboots, etc. this option can reveal how + // tweaks made to the configuration are affecting the printer in real-time. +#endif + +/** + * NanoDLP Sync support + * + * Add support for Synchronized Z moves when using with NanoDLP. G0/G1 axis moves will output "Z_move_comp" + * string to enable synchronization with DLP projector exposure. This change will allow to use + * [[WaitForDoneMessage]] instead of populating your gcode with M400 commands + */ +//#define NANODLP_Z_SYNC +#if ENABLED(NANODLP_Z_SYNC) + //#define NANODLP_ALL_AXIS // Enables "Z_move_comp" output on any axis move. + // Default behaviour is limited to Z axis only. +#endif + +/** + * WiFi Support (Espressif ESP32 WiFi) + */ +//#define WIFISUPPORT +#if ENABLED(WIFISUPPORT) + #define WIFI_SSID "Wifi SSID" + #define WIFI_PWD "Wifi Password" +#endif + +// Enable Marlin dev mode which adds some special commands +//#define MARLIN_DEV_MODE diff --git a/Marlin/src/config/examples/UltiMachine/Archim2/Configuration.h b/Marlin/src/config/examples/UltiMachine/Archim2/Configuration.h index 479086209d..26a93655a2 100644 --- a/Marlin/src/config/examples/UltiMachine/Archim2/Configuration.h +++ b/Marlin/src/config/examples/UltiMachine/Archim2/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -772,6 +770,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -859,6 +864,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -879,8 +885,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -905,7 +911,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -972,6 +978,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1141,8 +1159,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1297,10 +1316,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 180 #define PREHEAT_1_TEMP_BED 70 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 110 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -1429,10 +1450,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1460,6 +1481,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1824,6 +1852,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1980,5 +2017,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/UltiMachine/Archim2/Configuration_adv.h b/Marlin/src/config/examples/UltiMachine/Archim2/Configuration_adv.h index e8c31bb9e7..17cbf3a57d 100644 --- a/Marlin/src/config/examples/UltiMachine/Archim2/Configuration_adv.h +++ b/Marlin/src/config/examples/UltiMachine/Archim2/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -30,8 +31,6 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -176,8 +175,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -245,7 +244,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -385,10 +384,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -413,6 +408,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -464,7 +480,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -482,6 +498,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] @@ -535,15 +562,15 @@ //=============================Additional Features=========================== //=========================================================================== -#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu //#define LCD_INFO_MENU @@ -559,7 +586,7 @@ // Add an 'M73' G-code to set the current percentage //#define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -568,7 +595,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -597,7 +624,7 @@ #define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -683,6 +710,43 @@ */ //#define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -697,7 +761,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar //#define DOGM_SD_PERCENT @@ -767,16 +831,24 @@ */ //#define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. + + //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -978,6 +1050,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -1003,21 +1084,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -//#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1258,11 +1360,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1271,10 +1373,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1414,6 +1524,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1556,6 +1675,33 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ @@ -1569,10 +1715,10 @@ #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "Preheat for PLA" + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "Preheat for ABS" + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) #define USER_DESC_4 "Heat Bed/Home/Level" @@ -1737,5 +1883,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/examples/Velleman/K8200/Configuration.h b/Marlin/src/config/examples/Velleman/K8200/Configuration.h index 35e8a57a14..a35a677668 100644 --- a/Marlin/src/config/examples/Velleman/K8200/Configuration.h +++ b/Marlin/src/config/examples/Velleman/K8200/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 /** @@ -223,7 +222,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -240,7 +239,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -801,6 +799,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -888,6 +893,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -908,8 +914,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -935,7 +941,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. // K8200: it is usual to have clamps for the glass plate on the heatbed -#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -1002,6 +1008,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1171,8 +1189,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1327,10 +1346,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 180 #define PREHEAT_1_TEMP_BED 50 // K8200: PLA / set back to 70 if you have an upgraded heatbed power supply #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 60 // K8200: ABS / set back to 110 if you have an upgraded heatbed power supply #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -1462,10 +1483,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1493,6 +1514,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE // K8200: for Display VM8201 // this is the most common hardware +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1859,6 +1887,15 @@ #endif // K8200_VM8201 +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -2015,5 +2052,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h b/Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h index 83bc2bcf1b..0616319a35 100644 --- a/Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h +++ b/Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -39,8 +40,6 @@ * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -189,8 +188,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -258,7 +257,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -398,10 +397,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -426,6 +421,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -477,7 +493,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -495,6 +511,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] @@ -548,15 +575,15 @@ //=============================Additional Features=========================== //=========================================================================== -#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu //#define LCD_INFO_MENU @@ -572,7 +599,7 @@ // Add an 'M73' G-code to set the current percentage //#define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS #define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -581,7 +608,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -610,7 +637,7 @@ #define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -696,6 +723,43 @@ */ //#define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -710,7 +774,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar //#define DOGM_SD_PERCENT @@ -780,16 +844,24 @@ */ #define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. + + //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -991,6 +1063,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -1016,21 +1097,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -//#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1271,11 +1373,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1284,10 +1386,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1427,6 +1537,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1569,6 +1688,33 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ @@ -1582,10 +1728,10 @@ #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "Preheat for PLA" + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "Preheat for ABS" + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) #define USER_DESC_4 "Heat Bed/Home/Level" @@ -1750,5 +1896,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/examples/Velleman/K8400/Configuration.h b/Marlin/src/config/examples/Velleman/K8400/Configuration.h index e84738c9c7..82b9c3901e 100644 --- a/Marlin/src/config/examples/Velleman/K8400/Configuration.h +++ b/Marlin/src/config/examples/Velleman/K8400/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -772,6 +770,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -859,6 +864,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -879,8 +885,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -905,7 +911,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -972,6 +978,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1141,8 +1159,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1297,10 +1316,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 210 #define PREHEAT_1_TEMP_BED 0 #define PREHEAT_1_FAN_SPEED 165 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 245 #define PREHEAT_2_TEMP_BED 0 #define PREHEAT_2_FAN_SPEED 165 // Value from 0 to 255 @@ -1429,10 +1450,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1460,6 +1481,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1824,6 +1852,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1981,5 +2018,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h b/Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h index 60113fe3fa..282fc40614 100644 --- a/Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h +++ b/Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -30,8 +31,6 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -176,8 +175,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -245,7 +244,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -385,10 +384,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -413,6 +408,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -464,7 +480,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -482,6 +498,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] @@ -535,15 +562,15 @@ //=============================Additional Features=========================== //=========================================================================== -#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu //#define LCD_INFO_MENU @@ -559,7 +586,7 @@ // Add an 'M73' G-code to set the current percentage //#define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -568,7 +595,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -597,7 +624,7 @@ #define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -683,6 +710,43 @@ */ //#define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -697,7 +761,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar //#define DOGM_SD_PERCENT @@ -767,16 +831,24 @@ */ //#define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. + + //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -978,6 +1050,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -1003,21 +1084,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -//#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1258,11 +1360,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1271,10 +1373,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1414,6 +1524,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1556,6 +1675,33 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ @@ -1569,10 +1715,10 @@ #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "Preheat for PLA" + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "Preheat for ABS" + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) #define USER_DESC_4 "Heat Bed/Home/Level" @@ -1737,5 +1883,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/examples/Velleman/K8400/Dual-head/Configuration.h b/Marlin/src/config/examples/Velleman/K8400/Dual-head/Configuration.h index e78c6d65e0..1bfbb735a8 100644 --- a/Marlin/src/config/examples/Velleman/K8400/Dual-head/Configuration.h +++ b/Marlin/src/config/examples/Velleman/K8400/Dual-head/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -772,6 +770,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -859,6 +864,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -879,8 +885,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -905,7 +911,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -972,6 +978,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1141,8 +1159,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1297,10 +1316,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 210 #define PREHEAT_1_TEMP_BED 0 #define PREHEAT_1_FAN_SPEED 165 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 245 #define PREHEAT_2_TEMP_BED 0 #define PREHEAT_2_FAN_SPEED 165 // Value from 0 to 255 @@ -1429,10 +1450,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1460,6 +1481,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1824,6 +1852,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1981,5 +2018,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration.h b/Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration.h index 567667c4e1..545b7a26dc 100644 --- a/Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration.h +++ b/Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -782,6 +780,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -869,6 +874,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -889,8 +895,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -915,7 +921,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -982,6 +988,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1151,8 +1169,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1307,10 +1326,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 180 #define PREHEAT_1_TEMP_BED 70 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 110 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -1439,10 +1460,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1470,6 +1491,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1837,6 +1865,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1993,5 +2030,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration_adv.h b/Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration_adv.h index b5ca4e7a53..058803b218 100644 --- a/Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration_adv.h +++ b/Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -30,8 +31,6 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -176,8 +175,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -245,7 +244,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -385,10 +384,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -413,6 +408,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -464,7 +480,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -482,6 +498,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] @@ -537,15 +564,15 @@ //=============================Additional Features=========================== //=========================================================================== -#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu #define LCD_INFO_MENU @@ -561,7 +588,7 @@ // Add an 'M73' G-code to set the current percentage //#define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -570,7 +597,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -599,7 +626,7 @@ #define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -685,6 +712,43 @@ */ //#define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -699,7 +763,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar //#define DOGM_SD_PERCENT @@ -769,16 +833,24 @@ */ #define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - #define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. + + #define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -980,6 +1052,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -1005,21 +1086,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -//#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1260,11 +1362,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1273,10 +1375,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1416,6 +1526,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1558,6 +1677,33 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ @@ -1571,10 +1717,10 @@ #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "Preheat for PLA" + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "Preheat for ABS" + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) #define USER_DESC_4 "Heat Bed/Home/Level" @@ -1739,5 +1885,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/examples/adafruit/ST7565/Configuration.h b/Marlin/src/config/examples/adafruit/ST7565/Configuration.h index 252f9d72b0..0be2b56fc6 100644 --- a/Marlin/src/config/examples/adafruit/ST7565/Configuration.h +++ b/Marlin/src/config/examples/adafruit/ST7565/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -772,6 +770,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -859,6 +864,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -879,8 +885,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -905,7 +911,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -972,6 +978,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1141,8 +1159,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1297,10 +1316,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 180 #define PREHEAT_1_TEMP_BED 70 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 110 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -1429,10 +1450,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1460,6 +1481,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1824,6 +1852,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1980,5 +2017,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/delta/Anycubic/Kossel/Configuration.h b/Marlin/src/config/examples/delta/Anycubic/Kossel/Configuration.h index 9b2ab850c7..5a577ddcd5 100644 --- a/Marlin/src/config/examples/delta/Anycubic/Kossel/Configuration.h +++ b/Marlin/src/config/examples/delta/Anycubic/Kossel/Configuration.h @@ -19,14 +19,17 @@ * along with this program. If not, see . * */ +#pragma once /** * Choose your version: */ // normal size or plus? -//#define ANCYUBIC_KOSSEL_PLUS +//#define ANYCUBIC_KOSSEL_PLUS + // Anycubic Probe version 1 or 2 see README.md; 0 for no probe #define ANYCUBIC_PROBE_VERSION 0 + // Heated Bed: // 0 ... no heated bed // 1 ... aluminium heated bed with "BuildTak-like" sticker @@ -48,8 +51,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -216,7 +217,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -233,7 +234,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -571,9 +571,6 @@ // and processor overload (too many expensive sqrt calls). #define DELTA_SEGMENTS_PER_SECOND 80 - // Convert feedrates to apply to the Effector instead of the Carriages - //#define DELTA_FEEDRATE_SCALING - // After homing move down to a height where XY movement is unconstrained #define DELTA_HOME_TO_SAFE_ZONE @@ -596,29 +593,29 @@ #if ENABLED(DELTA_AUTO_CALIBRATION) || ENABLED(DELTA_CALIBRATION_MENU) // Set the radius for the calibration probe points - max DELTA_PRINTABLE_RADIUS for non-eccentric probes - #define DELTA_CALIBRATION_RADIUS DELTA_PRINTABLE_RADIUS - MIN_PROBE_EDGE // mm + #define DELTA_CALIBRATION_RADIUS DELTA_PRINTABLE_RADIUS - MIN_PROBE_EDGE // (mm) // Set the steprate for papertest probing - #define PROBE_MANUALLY_STEP 0.05 // mm + #define PROBE_MANUALLY_STEP 0.05 // (mm) #endif - #if ENABLED(ANCYUBIC_KOSSEL_PLUS) + #if ENABLED(ANYCUBIC_KOSSEL_PLUS) // Print surface diameter/2 minus unreachable space (avoid collisions with vertical towers). - #define DELTA_PRINTABLE_RADIUS 116.0 // mm + #define DELTA_PRINTABLE_RADIUS 116.0 // (mm) // Center-to-center distance of the holes in the diagonal push rods. - #define DELTA_DIAGONAL_ROD 271.5 // mm + #define DELTA_DIAGONAL_ROD 267 // (mm) // Horizontal offset from middle of printer to smooth rod center. - #define DELTA_SMOOTH_ROD_OFFSET 186 // mm + #define DELTA_SMOOTH_ROD_OFFSET 186 // (mm) // Horizontal offset of the universal joints on the end effector. - #define DELTA_EFFECTOR_OFFSET 31 // mm + #define DELTA_EFFECTOR_OFFSET 31 // (mm) // Horizontal offset of the universal joints on the carriages. - #define DELTA_CARRIAGE_OFFSET 20.6 // mm + #define DELTA_CARRIAGE_OFFSET 20.6 // (mm) // Horizontal distance bridged by diagonal push rods when effector is centered. #define DELTA_RADIUS (DELTA_SMOOTH_ROD_OFFSET-(DELTA_EFFECTOR_OFFSET)-(DELTA_CARRIAGE_OFFSET)) //mm Get this value from auto calibrate #else // Print surface diameter/2 minus unreachable space (avoid collisions with vertical towers). - #define DELTA_PRINTABLE_RADIUS 90.0 // mm + #define DELTA_PRINTABLE_RADIUS 90.0 // (mm) // Center-to-center distance of the holes in the diagonal push rods. - #define DELTA_DIAGONAL_ROD 218.0 // mm + #define DELTA_DIAGONAL_ROD 218.0 // (mm) // Horizontal distance bridged by diagonal push rods when effector is centered. #define DELTA_RADIUS 97.0 //mm Get this value from auto calibrate #endif @@ -686,7 +683,7 @@ // Mechanical endstop with COM to ground and NC to Signal uses "false" here (most common setup). #define X_MIN_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. #define Y_MIN_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. -#define Z_MIN_ENDSTOP_INVERTING (ANYCUBIC_PROBE_VERSION + 0 == 2) // V1 is NC, V2 is NO +#define Z_MIN_ENDSTOP_INVERTING (ANYCUBIC_PROBE_VERSION + 0 == 1) // V1 is NO, V2 is NC #define X_MAX_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. #define Y_MAX_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. #define Z_MAX_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. @@ -909,6 +906,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + /** * Allen key retractable z-probe as seen on many Kossel delta printers - http://reprap.org/wiki/Kossel#Automatic_bed_leveling_probe * Deploys by touching z-axis belt. Retracts by pushing the probe down. Uses Z_MIN_PIN. @@ -979,15 +983,15 @@ #define Y_PROBE_OFFSET_FROM_EXTRUDER 0 // Y offset: -front +behind [the nozzle] #if ANYCUBIC_PROBE_VERSION == 2 - #define Z_PROBE_OFFSET_FROM_EXTRUDER -16.8 // Z offset: -below +above [the nozzle] + #define Z_PROBE_OFFSET_FROM_EXTRUDER -16.8 // Z offset: -below +above [the nozzle] #elif ANYCUBIC_PROBE_VERSION == 1 - #define Z_PROBE_OFFSET_FROM_EXTRUDER -19.0 // Z offset: -below +above [the nozzle] + #define Z_PROBE_OFFSET_FROM_EXTRUDER -19.0 // Z offset: -below +above [the nozzle] #else - #define Z_PROBE_OFFSET_FROM_EXTRUDER 0 // Z offset: -below +above [the nozzle] + #define Z_PROBE_OFFSET_FROM_EXTRUDER 0 // Z offset: -below +above [the nozzle] #endif // Certain types of probes need to stay away from edges -#define MIN_PROBE_EDGE 20 +#define MIN_PROBE_EDGE 15 // X and Y axis travel speed (mm/m) between probes #define XY_PROBE_SPEED 6000 @@ -1048,6 +1052,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -1068,8 +1073,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -1094,7 +1099,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -1161,6 +1166,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1267,7 +1284,7 @@ // Beyond the probed grid, continue the implied tilt? // Default is to maintain the height of the nearest edge. - #define EXTRAPOLATE_BEYOND_GRID + //#define EXTRAPOLATE_BEYOND_GRID // // Experimental Subdivision of the grid by Catmull-Rom method. @@ -1333,8 +1350,9 @@ #define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.05 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.05 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1488,10 +1506,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 190 #define PREHEAT_1_TEMP_BED 60 #define PREHEAT_1_FAN_SPEED 255 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 100 #define PREHEAT_2_FAN_SPEED 255 // Value from 0 to 255 @@ -1620,10 +1640,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1651,6 +1671,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -2015,6 +2042,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -2171,5 +2207,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/delta/Anycubic/Kossel/Configuration_adv.h b/Marlin/src/config/examples/delta/Anycubic/Kossel/Configuration_adv.h index fdb4d842ac..de38bdbc94 100644 --- a/Marlin/src/config/examples/delta/Anycubic/Kossel/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/Anycubic/Kossel/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -30,8 +31,6 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -176,8 +175,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -245,7 +244,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -385,10 +384,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -413,6 +408,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -466,7 +482,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -484,6 +500,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] @@ -537,15 +564,15 @@ //=============================Additional Features=========================== //=========================================================================== -#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu #define LCD_INFO_MENU @@ -561,7 +588,7 @@ // Add an 'M73' G-code to set the current percentage //#define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -570,7 +597,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -599,7 +626,7 @@ #define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -685,6 +712,43 @@ */ //#define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -699,7 +763,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar //#define DOGM_SD_PERCENT @@ -769,16 +833,24 @@ */ #define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - #define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. + + #define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -980,6 +1052,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -1005,21 +1086,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -//#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1260,11 +1362,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1273,10 +1375,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1416,6 +1526,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1558,6 +1677,33 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ @@ -1571,10 +1717,10 @@ #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "Preheat for PLA" + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "Preheat for ABS" + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) #define USER_DESC_4 "Heat Bed/Home/Level" @@ -1739,5 +1885,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration.h b/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration.h index e9ad566e85..f7ae89e47a 100644 --- a/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration.h +++ b/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -562,16 +560,16 @@ #if ENABLED(DELTA_AUTO_CALIBRATION) || ENABLED(DELTA_CALIBRATION_MENU) // Set the radius for the calibration probe points - max DELTA_PRINTABLE_RADIUS for non-eccentric probes - #define DELTA_CALIBRATION_RADIUS 73.5 // mm + #define DELTA_CALIBRATION_RADIUS 73.5 // (mm) // Set the steprate for papertest probing - #define PROBE_MANUALLY_STEP 0.05 // mm + #define PROBE_MANUALLY_STEP 0.05 // (mm) #endif // Print surface diameter/2 minus unreachable space (avoid collisions with vertical towers). - #define DELTA_PRINTABLE_RADIUS 85.0 // mm + #define DELTA_PRINTABLE_RADIUS 85.0 // (mm) // Center-to-center distance of the holes in the diagonal push rods. - #define DELTA_DIAGONAL_ROD 218.0 // mm + #define DELTA_DIAGONAL_ROD 218.0 // (mm) // height from z=0 to home position #define DELTA_HEIGHT 295.00 // get this value from auto calibrate @@ -854,6 +852,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + /** * Allen key retractable z-probe as seen on many Kossel delta printers - http://reprap.org/wiki/Kossel#Automatic_bed_leveling_probe * Deploys by touching z-axis belt. Retracts by pushing the probe down. Uses Z_MIN_PIN. @@ -987,6 +992,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -1007,13 +1013,13 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine // Invert the stepper direction. Change (or reverse the motor connector) if an axis goes the wrong way. -#define INVERT_X_DIR true // DELTA does not invert +#define INVERT_X_DIR true #define INVERT_Y_DIR true #define INVERT_Z_DIR true @@ -1033,7 +1039,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -#define Z_HOMING_HEIGHT 15 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +#define Z_HOMING_HEIGHT 15 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -1100,6 +1106,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1270,8 +1288,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1425,10 +1444,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 195 #define PREHEAT_1_TEMP_BED 60 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 100 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -1557,10 +1578,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1588,6 +1609,13 @@ */ #define DISPLAY_CHARSET_HD44780 WESTERN +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1952,6 +1980,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -2108,5 +2145,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h b/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h index 25470870f3..92dbc4998a 100644 --- a/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -30,8 +31,6 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -176,8 +175,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -245,7 +244,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -385,10 +384,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -413,6 +408,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -466,7 +482,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -484,6 +500,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] @@ -537,15 +564,15 @@ //=============================Additional Features=========================== //=========================================================================== -#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu //#define LCD_INFO_MENU @@ -561,7 +588,7 @@ // Add an 'M73' G-code to set the current percentage //#define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -570,7 +597,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -599,7 +626,7 @@ #define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -685,6 +712,43 @@ */ //#define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -699,7 +763,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar //#define DOGM_SD_PERCENT @@ -769,16 +833,24 @@ */ //#define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. + + //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -980,6 +1052,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -1005,21 +1086,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -//#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1260,11 +1362,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1273,10 +1375,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1416,6 +1526,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1558,6 +1677,33 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ @@ -1571,10 +1717,10 @@ #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "Preheat for PLA" + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "Preheat for ABS" + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) #define USER_DESC_4 "Heat Bed/Home/Level" @@ -1739,5 +1885,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/examples/delta/FLSUN/kossel/Configuration.h b/Marlin/src/config/examples/delta/FLSUN/kossel/Configuration.h index caf0890206..d29c31148a 100644 --- a/Marlin/src/config/examples/delta/FLSUN/kossel/Configuration.h +++ b/Marlin/src/config/examples/delta/FLSUN/kossel/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -562,16 +560,16 @@ #if ENABLED(DELTA_AUTO_CALIBRATION) || ENABLED(DELTA_CALIBRATION_MENU) // Set the radius for the calibration probe points - max DELTA_PRINTABLE_RADIUS for non-eccentric probes - #define DELTA_CALIBRATION_RADIUS 63 // mm + #define DELTA_CALIBRATION_RADIUS 63 // (mm) // Set the steprate for papertest probing - #define PROBE_MANUALLY_STEP 0.05 // mm + #define PROBE_MANUALLY_STEP 0.05 // (mm) #endif // Print surface diameter/2 minus unreachable space (avoid collisions with vertical towers). - #define DELTA_PRINTABLE_RADIUS 70.0 // mm + #define DELTA_PRINTABLE_RADIUS 70.0 // (mm) // Center-to-center distance of the holes in the diagonal push rods. - #define DELTA_DIAGONAL_ROD 218.0 // mm + #define DELTA_DIAGONAL_ROD 218.0 // (mm) // height from z=0 to home position #define DELTA_HEIGHT 317.94 // get this value from auto calibrate @@ -854,6 +852,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + /** * Allen key retractable z-probe as seen on many Kossel delta printers - http://reprap.org/wiki/Kossel#Automatic_bed_leveling_probe * Deploys by touching z-axis belt. Retracts by pushing the probe down. Uses Z_MIN_PIN. @@ -986,6 +991,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -1006,13 +1012,13 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine // Invert the stepper direction. Change (or reverse the motor connector) if an axis goes the wrong way. -#define INVERT_X_DIR true // DELTA does not invert +#define INVERT_X_DIR true #define INVERT_Y_DIR true #define INVERT_Z_DIR true @@ -1032,7 +1038,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -#define Z_HOMING_HEIGHT 15 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +#define Z_HOMING_HEIGHT 15 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -1099,6 +1105,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1269,8 +1287,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1424,10 +1443,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 195 #define PREHEAT_1_TEMP_BED 60 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 100 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -1556,10 +1577,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1587,6 +1608,13 @@ */ #define DISPLAY_CHARSET_HD44780 WESTERN +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1951,6 +1979,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -2107,5 +2144,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/delta/FLSUN/kossel/Configuration_adv.h b/Marlin/src/config/examples/delta/FLSUN/kossel/Configuration_adv.h index 25470870f3..92dbc4998a 100644 --- a/Marlin/src/config/examples/delta/FLSUN/kossel/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/FLSUN/kossel/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -30,8 +31,6 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -176,8 +175,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -245,7 +244,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -385,10 +384,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -413,6 +408,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -466,7 +482,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -484,6 +500,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] @@ -537,15 +564,15 @@ //=============================Additional Features=========================== //=========================================================================== -#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu //#define LCD_INFO_MENU @@ -561,7 +588,7 @@ // Add an 'M73' G-code to set the current percentage //#define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -570,7 +597,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -599,7 +626,7 @@ #define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -685,6 +712,43 @@ */ //#define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -699,7 +763,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar //#define DOGM_SD_PERCENT @@ -769,16 +833,24 @@ */ //#define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. + + //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -980,6 +1052,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -1005,21 +1086,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -//#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1260,11 +1362,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1273,10 +1375,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1416,6 +1526,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1558,6 +1677,33 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ @@ -1571,10 +1717,10 @@ #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "Preheat for PLA" + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "Preheat for ABS" + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) #define USER_DESC_4 "Heat Bed/Home/Level" @@ -1739,5 +1885,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration.h b/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration.h index 29e36dd2b3..6801592a35 100644 --- a/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration.h +++ b/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -562,16 +560,16 @@ #if ENABLED(DELTA_AUTO_CALIBRATION) || ENABLED(DELTA_CALIBRATION_MENU) // Set the radius for the calibration probe points - max DELTA_PRINTABLE_RADIUS for non-eccentric probes - #define DELTA_CALIBRATION_RADIUS 73.5 // mm + #define DELTA_CALIBRATION_RADIUS 73.5 // (mm) // Set the steprate for papertest probing - #define PROBE_MANUALLY_STEP 0.05 // mm + #define PROBE_MANUALLY_STEP 0.05 // (mm) #endif // Print surface diameter/2 minus unreachable space (avoid collisions with vertical towers). - #define DELTA_PRINTABLE_RADIUS 85.0 // mm + #define DELTA_PRINTABLE_RADIUS 85.0 // (mm) // Center-to-center distance of the holes in the diagonal push rods. - #define DELTA_DIAGONAL_ROD 218.0 // mm + #define DELTA_DIAGONAL_ROD 218.0 // (mm) // height from z=0 to home position #define DELTA_HEIGHT 280.00 // get this value from auto calibrate @@ -854,6 +852,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + /** * Allen key retractable z-probe as seen on many Kossel delta printers - http://reprap.org/wiki/Kossel#Automatic_bed_leveling_probe * Deploys by touching z-axis belt. Retracts by pushing the probe down. Uses Z_MIN_PIN. @@ -986,6 +991,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -1006,13 +1012,13 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine // Invert the stepper direction. Change (or reverse the motor connector) if an axis goes the wrong way. -#define INVERT_X_DIR true // DELTA does not invert +#define INVERT_X_DIR true #define INVERT_Y_DIR true #define INVERT_Z_DIR true @@ -1032,7 +1038,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -#define Z_HOMING_HEIGHT 15 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +#define Z_HOMING_HEIGHT 15 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -1099,6 +1105,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1269,8 +1287,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1424,10 +1443,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 180 #define PREHEAT_1_TEMP_BED 70 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 100 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -1556,10 +1577,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1587,6 +1608,13 @@ */ #define DISPLAY_CHARSET_HD44780 WESTERN +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1951,6 +1979,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -2107,5 +2144,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h b/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h index f6b7d871b8..e28e67dda3 100644 --- a/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -30,8 +31,6 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -176,8 +175,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -245,7 +244,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -385,10 +384,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -413,6 +408,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -466,7 +482,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -484,6 +500,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] @@ -537,15 +564,15 @@ //=============================Additional Features=========================== //=========================================================================== -#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu //#define LCD_INFO_MENU @@ -561,7 +588,7 @@ // Add an 'M73' G-code to set the current percentage //#define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -570,7 +597,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -599,7 +626,7 @@ #define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -685,6 +712,43 @@ */ //#define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -699,7 +763,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar //#define DOGM_SD_PERCENT @@ -769,16 +833,24 @@ */ //#define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. + + //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -980,6 +1052,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -1005,21 +1086,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -//#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1260,11 +1362,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1273,10 +1375,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1416,6 +1526,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1558,6 +1677,33 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ @@ -1571,10 +1717,10 @@ #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "Preheat for PLA" + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "Preheat for ABS" + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) #define USER_DESC_4 "Heat Bed/Home/Level" @@ -1739,5 +1885,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/examples/delta/Geeetech/Rostock 301/Configuration.h b/Marlin/src/config/examples/delta/Geeetech/Rostock 301/Configuration.h new file mode 100644 index 0000000000..42d6e991c9 --- /dev/null +++ b/Marlin/src/config/examples/delta/Geeetech/Rostock 301/Configuration.h @@ -0,0 +1,2148 @@ +/** + * 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 . + * + */ +#pragma once + +/** + * Configuration.h + * + * Basic settings such as: + * + * - Type of electronics + * - Type of temperature sensor + * - Printer geometry + * - Endstop configuration + * - LCD controller + * - Extra features + * + * Advanced settings can be found in Configuration_adv.h + * + */ +#define CONFIGURATION_H_VERSION 020000 + +//=========================================================================== +//============================= Getting Started ============================= +//=========================================================================== + +/** + * Here are some standard links for getting your machine calibrated: + * + * http://reprap.org/wiki/Calibration + * http://youtu.be/wAL9d7FgInk + * http://calculator.josefprusa.cz + * http://reprap.org/wiki/Triffid_Hunter%27s_Calibration_Guide + * http://www.thingiverse.com/thing:5573 + * https://sites.google.com/site/repraplogphase/calibration-of-your-reprap + * http://www.thingiverse.com/thing:298812 + */ + +//=========================================================================== +//============================= DELTA Printer =============================== +//=========================================================================== +// For a Delta printer start with one of the configuration files in the +// config/examples/delta directory and customize for your machine. +// + +//=========================================================================== +//============================= SCARA Printer =============================== +//=========================================================================== +// For a SCARA printer start with the configuration files in +// config/examples/SCARA and customize for your machine. +// + +// @section info + +// User-specified version info of this build to display in [Pronterface, etc] terminal window during +// startup. Implementation of an idea by Prof Braino to inform user that any changes made to this +// build by the user have been successfully uploaded into firmware. +#define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes. +#define SHOW_BOOTSCREEN +#define STRING_SPLASH_LINE1 SHORT_BUILD_VERSION // will be shown during bootup in line 1 +#define STRING_SPLASH_LINE2 WEBSITE_URL // will be shown during bootup in line 2 + +/** + * *** VENDORS PLEASE READ *** + * + * Marlin allows you to add a custom boot image for Graphical LCDs. + * With this option Marlin will first show your custom screen followed + * by the standard Marlin logo with version number and web URL. + * + * We encourage you to take advantage of this new feature and we also + * respectfully request that you retain the unmodified Marlin boot screen. + */ + +// Enable to show the bitmap in Marlin/_Bootscreen.h on startup. +//#define SHOW_CUSTOM_BOOTSCREEN + +// Enable to show the bitmap in Marlin/_Statusscreen.h on the status screen. +//#define CUSTOM_STATUS_SCREEN_IMAGE + +// @section machine + +/** + * Select the serial port on the board to use for communication with the host. + * This allows the connection of wireless adapters (for instance) to non-default port pins. + * Note: The first serial port (-1 or 0) will always be used by the Arduino bootloader. + * + * :[-1, 0, 1, 2, 3, 4, 5, 6, 7] + */ +#define SERIAL_PORT 0 + +/** + * Select a secondary serial port on the board to use for communication with the host. + * This allows the connection of wireless adapters (for instance) to non-default port pins. + * Serial port -1 is the USB emulated serial port, if available. + * + * :[-1, 0, 1, 2, 3, 4, 5, 6, 7] + */ +#define SERIAL_PORT_2 1 + +/** + * This setting determines the communication speed of the printer. + * + * 250000 works in most cases, but you might try a lower speed if + * you commonly experience drop-outs during host printing. + * You may try up to 1000000 to speed up SD file transfer. + * + * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000] + */ +#define BAUDRATE 250000 + +// Enable the Bluetooth serial interface on AT90USB devices +//#define BLUETOOTH + +// The following define selects which electronics board you have. +// Please choose the name from boards.h that matches your setup +#ifndef MOTHERBOARD + #define MOTHERBOARD BOARD_GTM32_PRO_VB +#endif + +// Optional custom name for your RepStrap or other custom machine +// Displayed in the LCD "Ready" message +#define CUSTOM_MACHINE_NAME "Rostock 301" + +// Define this to set a unique identifier for this printer, (Used by some programs to differentiate between machines) +// You can use an online service to generate a random UUID. (eg http://www.uuidgenerator.net/version4) +//#define MACHINE_UUID "00000000-0000-0000-0000-000000000000" + +// @section extruder + +// This defines the number of extruders +// :[1, 2, 3, 4, 5, 6] +#define EXTRUDERS 3 + +// Generally expected filament diameter (1.75, 2.85, 3.0, ...). Used for Volumetric, Filament Width Sensor, etc. +#define DEFAULT_NOMINAL_FILAMENT_DIA 1.75 + +// For Cyclops or any "multi-extruder" that shares a single nozzle. +#define SINGLENOZZLE +#if ENABLED(SINGLENOZZLE) + // Parameters for filament retract / prime on toolchange + #define SINGLENOZZLE_SWAP_LENGTH 12 // (mm) + #define SINGLENOZZLE_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define SINGLENOZZLE_SWAP_PRIME_SPEED 3600 // (mm/m) + //#define SINGLENOZZLE_SWAP_PARK + #if ENABLED(SINGLENOZZLE_SWAP_PARK) + #define SINGLENOZZLE_TOOLCHANGE_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define SINGLENOZZLE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif + +/** + * Průša MK2 Single Nozzle Multi-Material Multiplexer, and variants. + * + * This device allows one stepper driver on a control board to drive + * two to eight stepper motors, one at a time, in a manner suitable + * for extruders. + * + * This option only allows the multiplexer to switch on tool-change. + * Additional options to configure custom E moves are pending. + */ +//#define MK2_MULTIPLEXER +#if ENABLED(MK2_MULTIPLEXER) + // Override the default DIO selector pins here, if needed. + // Some pins files may provide defaults for these pins. + //#define E_MUX0_PIN 40 // Always Required + //#define E_MUX1_PIN 42 // Needed for 3 to 8 inputs + //#define E_MUX2_PIN 44 // Needed for 5 to 8 inputs +#endif + +// A dual extruder that uses a single stepper motor +//#define SWITCHING_EXTRUDER +#if ENABLED(SWITCHING_EXTRUDER) + #define SWITCHING_EXTRUDER_SERVO_NR 0 + #define SWITCHING_EXTRUDER_SERVO_ANGLES { 0, 90 } // Angles for E0, E1[, E2, E3] + #if EXTRUDERS > 3 + #define SWITCHING_EXTRUDER_E23_SERVO_NR 1 + #endif +#endif + +// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +//#define SWITCHING_NOZZLE +#if ENABLED(SWITCHING_NOZZLE) + #define SWITCHING_NOZZLE_SERVO_NR 0 + #define SWITCHING_NOZZLE_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 +#endif + +/** + * Two separate X-carriages with extruders that connect to a moving part + * via a magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + */ +//#define PARKING_EXTRUDER +#if ENABLED(PARKING_EXTRUDER) + #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage + #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil + #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders + #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 +#endif + +/** + * Switching Toolhead + * + * Support for swappable and dockable toolheads, such as + * the E3D Tool Changer. Toolheads are locked with a servo. + */ +//#define SWITCHING_TOOLHEAD +#if ENABLED(SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_SERVO_NR 2 // Index of the servo connector + #define SWITCHING_TOOLHEAD_SERVO_ANGLES { 0, 180 } // (degrees) Angles for Lock, Unlock + #define SWITCHING_TOOLHEAD_Y_POS 235 // (mm) Y position of the toolhead dock + #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis + #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders +#endif + +/** + * "Mixing Extruder" + * - Adds G-codes M163 and M164 to set and "commit" the current mix factors. + * - Extends the stepping routines to move multiple steppers in proportion to the mix. + * - Optional support for Repetier Firmware's 'M164 S' supporting virtual tools. + * - This implementation supports up to two mixing extruders. + * - Enable DIRECT_MIXING_IN_G1 for M165 and mixing in G1 (from Pia Taubert's reference implementation). + */ +//#define MIXING_EXTRUDER +#if ENABLED(MIXING_EXTRUDER) + #define MIXING_STEPPERS 3 // Number of steppers in your mixing extruder + #define MIXING_VIRTUAL_TOOLS 16 // Use the Virtual Tool method with M163 and M164 + //#define DIRECT_MIXING_IN_G1 // Allow ABCDHI mix factors in G1 movement commands +#endif + +// Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing). +// The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder). +// For the other hotends it is their distance from the extruder 0 hotend. +//#define HOTEND_OFFSET_X {0.0, 20.00} // (mm) relative X-offset for each nozzle +//#define HOTEND_OFFSET_Y {0.0, 5.00} // (mm) relative Y-offset for each nozzle +//#define HOTEND_OFFSET_Z {0.0, 0.00} // (mm) relative Z-offset for each nozzle + +// @section machine + +/** + * Select your power supply here. Use 0 if you haven't connected the PS_ON_PIN + * + * 0 = No Power Switch + * 1 = ATX + * 2 = X-Box 360 203Watts (the blue wire connected to PS_ON and the red wire to VCC) + * + * :{ 0:'No power switch', 1:'ATX', 2:'X-Box 360' } + */ +#define POWER_SUPPLY 1 + +#if POWER_SUPPLY > 0 + // Enable this option to leave the PSU off at startup. + // Power to steppers and heaters will need to be turned on with M80. + //#define PS_DEFAULT_OFF + + //#define AUTO_POWER_CONTROL // Enable automatic control of the PS_ON pin + #if ENABLED(AUTO_POWER_CONTROL) + #define AUTO_POWER_FANS // Turn on PSU if fans need power + #define AUTO_POWER_E_FANS + #define AUTO_POWER_CONTROLLERFAN + #define POWER_TIMEOUT 30 + #endif + +#endif + +// @section temperature + +//=========================================================================== +//============================= Thermal Settings ============================ +//=========================================================================== + +/** + * --NORMAL IS 4.7kohm PULLUP!-- 1kohm pullup can be used on hotend sensor, using correct resistor and table + * + * Temperature sensors available: + * + * -4 : thermocouple with AD8495 + * -3 : thermocouple with MAX31855 (only for sensor 0) + * -2 : thermocouple with MAX6675 (only for sensor 0) + * -1 : thermocouple with AD595 + * 0 : not used + * 1 : 100k thermistor - best choice for EPCOS 100k (4.7k pullup) + * 2 : 200k thermistor - ATC Semitec 204GT-2 (4.7k pullup) + * 3 : Mendel-parts thermistor (4.7k pullup) + * 4 : 10k thermistor !! do not use it for a hotend. It gives bad resolution at high temp. !! + * 5 : 100K thermistor - ATC Semitec 104GT-2/104NT-4-R025H42G (Used in ParCan & J-Head) (4.7k pullup) + * 501 : 100K Zonestar (Tronxy X3A) Thermistor + * 6 : 100k EPCOS - Not as accurate as table 1 (created using a fluke thermocouple) (4.7k pullup) + * 7 : 100k Honeywell thermistor 135-104LAG-J01 (4.7k pullup) + * 71 : 100k Honeywell thermistor 135-104LAF-J01 (4.7k pullup) + * 8 : 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) + * 9 : 100k GE Sensing AL03006-58.2K-97-G1 (4.7k pullup) + * 10 : 100k RS thermistor 198-961 (4.7k pullup) + * 11 : 100k beta 3950 1% thermistor (4.7k pullup) + * 12 : 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed) + * 13 : 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE" + * 15 : 100k thermistor calibration for JGAurora A5 hotend + * 20 : the PT100 circuit found in the Ultimainboard V2.x + * 60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950 + * 66 : 4.7M High Temperature thermistor from Dyze Design + * 70 : the 100K thermistor found in the bq Hephestos 2 + * 75 : 100k Generic Silicon Heat Pad with NTC 100K MGB18-104F39050L32 thermistor + * + * 1k ohm pullup tables - This is atypical, and requires changing out the 4.7k pullup for 1k. + * (but gives greater accuracy and more stable PID) + * 51 : 100k thermistor - EPCOS (1k pullup) + * 52 : 200k thermistor - ATC Semitec 204GT-2 (1k pullup) + * 55 : 100k thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (1k pullup) + * + * 1047 : Pt1000 with 4k7 pullup + * 1010 : Pt1000 with 1k pullup (non standard) + * 147 : Pt100 with 4k7 pullup + * 110 : Pt100 with 1k pullup (non standard) + * + * Use these for Testing or Development purposes. NEVER for production machine. + * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. + * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. + * + * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + */ +#define TEMP_SENSOR_0 1 +#define TEMP_SENSOR_1 0 +#define TEMP_SENSOR_2 0 +#define TEMP_SENSOR_3 0 +#define TEMP_SENSOR_4 0 +#define TEMP_SENSOR_5 0 +#define TEMP_SENSOR_BED 1 +#define TEMP_SENSOR_CHAMBER 0 + +// Dummy thermistor constant temperature readings, for use with 998 and 999 +#define DUMMY_THERMISTOR_998_VALUE 25 +#define DUMMY_THERMISTOR_999_VALUE 100 + +// Use temp sensor 1 as a redundant sensor with sensor 0. If the readings +// from the two sensors differ too much the print will be aborted. +//#define TEMP_SENSOR_1_AS_REDUNDANT +#define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 + +// Extruder temperature must be close to target for this long before M109 returns success +#define TEMP_RESIDENCY_TIME 10 // (seconds) +#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one +#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. + +// Bed temperature must be close to target for this long before M190 returns success +#define TEMP_BED_RESIDENCY_TIME 0 // (seconds) +#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one +#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. + +// The minimal temperature defines the temperature below which the heater will not be enabled It is used +// to check that the wiring to the thermistor is not broken. +// Otherwise this would lead to the heater being powered on all the time. +#define HEATER_0_MINTEMP 5 +#define HEATER_1_MINTEMP 5 +#define HEATER_2_MINTEMP 5 +#define HEATER_3_MINTEMP 5 +#define HEATER_4_MINTEMP 5 +#define HEATER_5_MINTEMP 5 +#define BED_MINTEMP 5 + +// When temperature exceeds max temp, your heater will be switched off. +// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! +// You should use MINTEMP for thermistor short/failure protection. +#define HEATER_0_MAXTEMP 275 +#define HEATER_1_MAXTEMP 275 +#define HEATER_2_MAXTEMP 275 +#define HEATER_3_MAXTEMP 275 +#define HEATER_4_MAXTEMP 275 +#define HEATER_5_MAXTEMP 275 +#define BED_MAXTEMP 150 + +//=========================================================================== +//============================= PID Settings ================================ +//=========================================================================== +// PID Tuning Guide here: http://reprap.org/wiki/PID_Tuning + +// Comment the following line to disable PID and enable bang-bang. +#define PIDTEMP +#define BANG_MAX 255 // Limits current to nozzle while in bang-bang mode; 255=full current +#define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current +#define PID_K1 0.95 // Smoothing factor within any PID loop +#if ENABLED(PIDTEMP) + //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. + //#define PID_DEBUG // Sends debug data to the serial port. + //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX + //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders) + // Set/get with gcode: M301 E[extruder number, 0-2] + #define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature + // is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max. + + // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it + + // Ultimaker + #define DEFAULT_Kp 22.2 + #define DEFAULT_Ki 1.08 + #define DEFAULT_Kd 114 + + // MakerGear + //#define DEFAULT_Kp 7.0 + //#define DEFAULT_Ki 0.1 + //#define DEFAULT_Kd 12 + + // Mendel Parts V9 on 12V + //#define DEFAULT_Kp 63.0 + //#define DEFAULT_Ki 2.25 + //#define DEFAULT_Kd 440 + +#endif // PIDTEMP + +//=========================================================================== +//============================= PID > Bed Temperature Control =============== +//=========================================================================== + +/** + * PID Bed Heating + * + * If this option is enabled set PID constants below. + * If this option is disabled, bang-bang will be used and BED_LIMIT_SWITCHING will enable hysteresis. + * + * The PID frequency will be the same as the extruder PWM. + * If PID_dT is the default, and correct for the hardware/configuration, that means 7.689Hz, + * which is fine for driving a square wave into a resistive load and does not significantly + * impact FET heating. This also works fine on a Fotek SSR-10DA Solid State Relay into a 250W + * heater. If your configuration is significantly different than this and you don't understand + * the issues involved, don't use bed PID until someone else verifies that your hardware works. + */ +//#define PIDTEMPBED + +//#define BED_LIMIT_SWITCHING + +/** + * Max Bed Power + * Applies to all forms of bed control (PID, bang-bang, and bang-bang with hysteresis). + * When set to any value below 255, enables a form of PWM to the bed that acts like a divider + * so don't use it unless you are OK with PWM on your bed. (See the comment on enabling PIDTEMPBED) + */ +#define MAX_BED_POWER 255 // limits duty cycle to bed; 255=full current + +#if ENABLED(PIDTEMPBED) + + //#define PID_BED_DEBUG // Sends debug data to the serial port. + + //120V 250W silicone heater into 4mm borosilicate (MendelMax 1.5+) + //from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10) + #define DEFAULT_bedKp 10.00 + #define DEFAULT_bedKi .023 + #define DEFAULT_bedKd 305.4 + + //120V 250W silicone heater into 4mm borosilicate (MendelMax 1.5+) + //from pidautotune + //#define DEFAULT_bedKp 97.1 + //#define DEFAULT_bedKi 1.41 + //#define DEFAULT_bedKd 1675.16 + + // FIND YOUR OWN: "M303 E-1 C8 S90" to run autotune on the bed at 90 degreesC for 8 cycles. +#endif // PIDTEMPBED + +// @section extruder + +/** + * Prevent extrusion if the temperature is below EXTRUDE_MINTEMP. + * Add M302 to set the minimum extrusion temperature and/or turn + * cold extrusion prevention on and off. + * + * *** IT IS HIGHLY RECOMMENDED TO LEAVE THIS OPTION ENABLED! *** + */ +#define PREVENT_COLD_EXTRUSION +#define EXTRUDE_MINTEMP 170 + +/** + * Prevent a single extrusion longer than EXTRUDE_MAXLENGTH. + * Note: For Bowden Extruders make this large enough to allow load/unload. + */ +#define PREVENT_LENGTHY_EXTRUDE +#define EXTRUDE_MAXLENGTH 200 + +//=========================================================================== +//======================== Thermal Runaway Protection ======================= +//=========================================================================== + +/** + * Thermal Protection provides additional protection to your printer from damage + * and fire. Marlin always includes safe min and max temperature ranges which + * protect against a broken or disconnected thermistor wire. + * + * The issue: If a thermistor falls out, it will report the much lower + * temperature of the air in the room, and the the firmware will keep + * the heater on. + * + * If you get "Thermal Runaway" or "Heating failed" errors the + * details can be tuned in Configuration_adv.h + */ + +#define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders +#define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed + +//=========================================================================== +//============================= Mechanical Settings ========================= +//=========================================================================== + +// @section machine + +// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics +// either in the usual order or reversed +//#define COREXY +//#define COREXZ +//#define COREYZ +//#define COREYX +//#define COREZX +//#define COREZY + +//=========================================================================== +//============================== Delta Settings ============================= +//=========================================================================== +// Enable DELTA kinematics and most of the default configuration for Deltas +#define DELTA + +#if ENABLED(DELTA) + + // Make delta curves from many straight lines (linear interpolation). + // This is a trade-off between visible corners (not enough segments) + // and processor overload (too many expensive sqrt calls). + #define DELTA_SEGMENTS_PER_SECOND 200 + + // After homing move down to a height where XY movement is unconstrained + //#define DELTA_HOME_TO_SAFE_ZONE + + // Delta calibration menu + // uncomment to add three points calibration menu option. + // See http://minow.blogspot.com/index.html#4918805519571907051 + #define DELTA_CALIBRATION_MENU + + // uncomment to add G33 Delta Auto-Calibration (Enable EEPROM_SETTINGS to store results) + //#define DELTA_AUTO_CALIBRATION + + // NOTE NB all values for DELTA_* values MUST be floating point, so always have a decimal point in them + + #if ENABLED(DELTA_AUTO_CALIBRATION) + // set the default number of probe points : n*n (1 -> 7) + #define DELTA_CALIBRATION_DEFAULT_POINTS 4 + #endif + + #if ENABLED(DELTA_AUTO_CALIBRATION) || ENABLED(DELTA_CALIBRATION_MENU) + // Set the radius for the calibration probe points - max DELTA_PRINTABLE_RADIUS for non-eccentric probes + #define DELTA_CALIBRATION_RADIUS 121.5 // (mm) + // Set the steprate for papertest probing + #define PROBE_MANUALLY_STEP 0.05 // (mm) + #endif + + // Print surface diameter/2 minus unreachable space (avoid collisions with vertical towers). + #define DELTA_PRINTABLE_RADIUS 90.0 // (mm) + + // Center-to-center distance of the holes in the diagonal push rods. + #define DELTA_DIAGONAL_ROD 196.0 // (mm) + + // height from z=0 to home position + #define DELTA_HEIGHT 228.00 // get this value from auto calibrate + + #define DELTA_ENDSTOP_ADJ { 0.0, 0.0, 0.0 } // get these from auto calibrate + + // Horizontal distance bridged by diagonal push rods when effector is centered. + #define DELTA_RADIUS 92 //124.0 //mm Get this value from auto calibrate + + // Trim adjustments for individual towers + // tower angle corrections for X and Y tower / rotate XYZ so Z tower angle = 0 + // measured in degrees anticlockwise looking from above the printer + #define DELTA_TOWER_ANGLE_TRIM { 0.0, 0.0, 0.0 } // get these values from auto calibrate + + // delta radius and diaginal rod adjustments measured in mm + //#define DELTA_RADIUS_TRIM_TOWER { 0.0, 0.0, 0.0 } + //#define DELTA_DIAGONAL_ROD_TRIM_TOWER { 0.0, 0.0, 0.0 } + +#endif + +//=========================================================================== +//============================== Endstop Settings =========================== +//=========================================================================== + +// @section homing + +// Specify here all the endstop connectors that are connected to any endstop or probe. +// Almost all printers will be using one per axis. Probes will use one or more of the +// extra connectors. Leave undefined any used for non-endstop and non-probe purposes. +//#define USE_XMIN_PLUG +//#define USE_YMIN_PLUG +//#define USE_ZMIN_PLUG // a Z probe +#define USE_XMAX_PLUG +#define USE_YMAX_PLUG +#define USE_ZMAX_PLUG + +// Enable pullup for all endstops to prevent a floating state +#define ENDSTOPPULLUPS +#if DISABLED(ENDSTOPPULLUPS) + // Disable ENDSTOPPULLUPS to set pullups individually + //#define ENDSTOPPULLUP_XMAX + //#define ENDSTOPPULLUP_YMAX + //#define ENDSTOPPULLUP_ZMAX + //#define ENDSTOPPULLUP_XMIN + //#define ENDSTOPPULLUP_YMIN + //#define ENDSTOPPULLUP_ZMIN + //#define ENDSTOPPULLUP_ZMIN_PROBE +#endif + +// Enable pulldown for all endstops to prevent a floating state +//#define ENDSTOPPULLDOWNS +#if DISABLED(ENDSTOPPULLDOWNS) + // Disable ENDSTOPPULLDOWNS to set pulldowns individually + //#define ENDSTOPPULLDOWN_XMAX + //#define ENDSTOPPULLDOWN_YMAX + //#define ENDSTOPPULLDOWN_ZMAX + //#define ENDSTOPPULLDOWN_XMIN + //#define ENDSTOPPULLDOWN_YMIN + //#define ENDSTOPPULLDOWN_ZMIN + //#define ENDSTOPPULLDOWN_ZMIN_PROBE +#endif + +// Mechanical endstop with COM to ground and NC to Signal uses "false" here (most common setup). +#define X_MIN_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. +#define Y_MIN_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. +#define Z_MIN_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. +#define X_MAX_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. +#define Y_MAX_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. +#define Z_MAX_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. +#define Z_MIN_PROBE_ENDSTOP_INVERTING false // set to true to invert the logic of the probe. + +/** + * Stepper Drivers + * + * These settings allow Marlin to tune stepper driver timing and enable advanced options for + * stepper drivers that support them. You may also override timing options in Configuration_adv.h. + * + * A4988 is assumed for unspecified drivers. + * + * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, + * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, + * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, + * TMC5130, TMC5130_STANDALONE + * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + */ +//#define X_DRIVER_TYPE A4988 +//#define Y_DRIVER_TYPE A4988 +//#define Z_DRIVER_TYPE A4988 +//#define X2_DRIVER_TYPE A4988 +//#define Y2_DRIVER_TYPE A4988 +//#define Z2_DRIVER_TYPE A4988 +//#define Z3_DRIVER_TYPE A4988 +//#define E0_DRIVER_TYPE A4988 +//#define E1_DRIVER_TYPE A4988 +//#define E2_DRIVER_TYPE A4988 +//#define E3_DRIVER_TYPE A4988 +//#define E4_DRIVER_TYPE A4988 +//#define E5_DRIVER_TYPE A4988 + +// Enable this feature if all enabled endstop pins are interrupt-capable. +// This will remove the need to poll the interrupt pins, saving many CPU cycles. +//#define ENDSTOP_INTERRUPTS_FEATURE + +/** + * Endstop Noise Threshold + * + * Enable if your probe or endstops falsely trigger due to noise. + * + * - Higher values may affect repeatability or accuracy of some bed probes. + * - To fix noise install a 100nF ceramic capacitor inline with the switch. + * - This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, which already have the 100nF capacitor. + * + * :[2,3,4,5,6,7] + */ +//#define ENDSTOP_NOISE_THRESHOLD 2 + +//============================================================================= +//============================== Movement Settings ============================ +//============================================================================= +// @section motion + +// delta speeds must be the same on xyz +/** + * Default Settings + * + * These settings can be reset by M502 + * + * Note that if EEPROM is enabled, saved values will override these. + */ + +/** + * With this option each E stepper can have its own factors for the + * following movement settings. If fewer factors are given than the + * total number of extruders, the last value applies to the rest. + */ +//#define DISTINCT_E_FACTORS + +/** + * Default Axis Steps Per Unit (steps/mm) + * Override with M92 + * X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]] + */ +// variables to calculate steps +#define XYZ_FULL_STEPS_PER_ROTATION 200 +#define XYZ_MICROSTEPS 16 +#define XYZ_BELT_PITCH 2 +#define XYZ_PULLEY_TEETH 20 + +// delta speeds must be the same on xyz +#define DEFAULT_XYZ_STEPS_PER_UNIT 80.2649 //((XYZ_FULL_STEPS_PER_ROTATION) * (XYZ_MICROSTEPS) / double(XYZ_BELT_PITCH) / double(XYZ_PULLEY_TEETH)) +#define DEFAULT_AXIS_STEPS_PER_UNIT { DEFAULT_XYZ_STEPS_PER_UNIT, DEFAULT_XYZ_STEPS_PER_UNIT, DEFAULT_XYZ_STEPS_PER_UNIT, 95 } // default steps per unit for Kossel (GT2, 20 tooth) + +/** + * Default Max Feed Rate (mm/s) + * Override with M203 + * X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]] + */ +#define DEFAULT_MAX_FEEDRATE { 500, 500, 500, 25 } + +/** + * Default Max Acceleration (change/s) change = mm/s + * (Maximum start speed for accelerated moves) + * Override with M201 + * X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]] + */ +#define DEFAULT_MAX_ACCELERATION { 9000, 9000, 9000, 10000 } + +/** + * Default Acceleration (change/s) change = mm/s + * Override with M204 + * + * M204 P Acceleration + * M204 R Retract Acceleration + * M204 T Travel Acceleration + */ +#define DEFAULT_ACCELERATION 3000 // X, Y, Z and E acceleration for printing moves +#define DEFAULT_RETRACT_ACCELERATION 3000 // E acceleration for retracts +#define DEFAULT_TRAVEL_ACCELERATION 3000 // X, Y, Z acceleration for travel (non printing) moves + +/** + * Default Jerk (mm/s) + * Override with M205 X Y Z E + * + * "Jerk" specifies the minimum speed change that requires acceleration. + * When changing speed and direction, if the difference is less than the + * value set here, it may happen instantaneously. + */ +#define DEFAULT_XJERK 10.0 +#define DEFAULT_YJERK DEFAULT_XJERK +#define DEFAULT_ZJERK DEFAULT_XJERK // Must be same as XY for delta +#define DEFAULT_EJERK 5.0 + +/** + * S-Curve Acceleration + * + * This option eliminates vibration during printing by fitting a Bézier + * curve to move acceleration, producing much smoother direction changes. + * + * See https://github.com/synthetos/TinyG/wiki/Jerk-Controlled-Motion-Explained + */ +//#define S_CURVE_ACCELERATION + +//=========================================================================== +//============================= Z Probe Options ============================= +//=========================================================================== +// @section probes + +// +// See http://marlinfw.org/docs/configuration/probes.html +// + +/** + * Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN + * + * Enable this option for a probe connected to the Z Min endstop pin. + */ +#define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN + +/** + * Z_MIN_PROBE_ENDSTOP + * + * Enable this option for a probe connected to any pin except Z-Min. + * (By default Marlin assumes the Z-Max endstop pin.) + * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * + * - The simplest option is to use a free endstop connector. + * - Use 5V for powered (usually inductive) sensors. + * + * - RAMPS 1.3/1.4 boards may use the 5V, GND, and Aux4->D32 pin: + * - For simple switches connect... + * - normally-closed switches to GND and D32. + * - normally-open switches to 5V and D32. + * + * WARNING: Setting the wrong pin may have unexpected and potentially + * disastrous consequences. Use with caution and do your homework. + * + */ +//#define Z_MIN_PROBE_ENDSTOP + +/** + * Probe Type + * + * Allen Key Probes, Servo Probes, Z-Sled Probes, FIX_MOUNTED_PROBE, etc. + * Activate one of these to use Auto Bed Leveling below. + */ + +/** + * The "Manual Probe" provides a means to do "Auto" Bed Leveling without a probe. + * Use G29 repeatedly, adjusting the Z height at each point with movement commands + * or (with LCD_BED_LEVELING) the LCD controller. + */ +//#define PROBE_MANUALLY +//#define MANUAL_PROBE_START_Z 0.2 + +/** + * A Fix-Mounted Probe either doesn't deploy or needs manual deployment. + * (e.g., an inductive probe or a nozzle-based probe-switch.) + */ +//#define FIX_MOUNTED_PROBE + +/** + * Z Servo Probe, such as an endstop switch on a rotating arm. + */ +//#define Z_PROBE_SERVO_NR 0 // Defaults to SERVO 0 connector. +//#define Z_SERVO_ANGLES {70,0} // Z Servo Deploy and Stow angles + +/** + * The BLTouch probe uses a Hall effect sensor and emulates a servo. + */ +//#define BLTOUCH +#if ENABLED(BLTOUCH) + //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed +#endif + +// A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) +//#define SOLENOID_PROBE + +// A sled-mounted probe like those designed by Charles Bell. +//#define Z_PROBE_SLED +//#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. + +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + +/** + * Allen key retractable z-probe as seen on many Kossel delta printers - http://reprap.org/wiki/Kossel#Automatic_bed_leveling_probe + * Deploys by touching z-axis belt. Retracts by pushing the probe down. Uses Z_MIN_PIN. + */ +//#define Z_PROBE_ALLEN_KEY + +#if ENABLED(Z_PROBE_ALLEN_KEY) + // 2 or 3 sets of coordinates for deploying and retracting the spring loaded touch probe on G29, + // if servo actuated touch probe is not defined. Uncomment as appropriate for your printer/probe. + + #define Z_PROBE_ALLEN_KEY_DEPLOY_1_X 30.0 + #define Z_PROBE_ALLEN_KEY_DEPLOY_1_Y DELTA_PRINTABLE_RADIUS + #define Z_PROBE_ALLEN_KEY_DEPLOY_1_Z 100.0 + #define Z_PROBE_ALLEN_KEY_DEPLOY_1_FEEDRATE XY_PROBE_SPEED + + #define Z_PROBE_ALLEN_KEY_DEPLOY_2_X 0.0 + #define Z_PROBE_ALLEN_KEY_DEPLOY_2_Y DELTA_PRINTABLE_RADIUS + #define Z_PROBE_ALLEN_KEY_DEPLOY_2_Z 100.0 + #define Z_PROBE_ALLEN_KEY_DEPLOY_2_FEEDRATE (XY_PROBE_SPEED)/10 + + #define Z_PROBE_ALLEN_KEY_DEPLOY_3_X Z_PROBE_ALLEN_KEY_DEPLOY_2_X * 0.75 + #define Z_PROBE_ALLEN_KEY_DEPLOY_3_Y Z_PROBE_ALLEN_KEY_DEPLOY_2_Y * 0.75 + #define Z_PROBE_ALLEN_KEY_DEPLOY_3_Z Z_PROBE_ALLEN_KEY_DEPLOY_2_Z + #define Z_PROBE_ALLEN_KEY_DEPLOY_3_FEEDRATE XY_PROBE_SPEED + + #define Z_PROBE_ALLEN_KEY_STOW_1_X -64.0 // Move the probe into position + #define Z_PROBE_ALLEN_KEY_STOW_1_Y 56.0 + #define Z_PROBE_ALLEN_KEY_STOW_1_Z 23.0 + #define Z_PROBE_ALLEN_KEY_STOW_1_FEEDRATE XY_PROBE_SPEED + + #define Z_PROBE_ALLEN_KEY_STOW_2_X -64.0 // Push it down + #define Z_PROBE_ALLEN_KEY_STOW_2_Y 56.0 + #define Z_PROBE_ALLEN_KEY_STOW_2_Z 3.0 + #define Z_PROBE_ALLEN_KEY_STOW_2_FEEDRATE (XY_PROBE_SPEED)/10 + + #define Z_PROBE_ALLEN_KEY_STOW_3_X -64.0 // Move it up to clear + #define Z_PROBE_ALLEN_KEY_STOW_3_Y 56.0 + #define Z_PROBE_ALLEN_KEY_STOW_3_Z 50.0 + #define Z_PROBE_ALLEN_KEY_STOW_3_FEEDRATE XY_PROBE_SPEED + + #define Z_PROBE_ALLEN_KEY_STOW_4_X 0.0 + #define Z_PROBE_ALLEN_KEY_STOW_4_Y 0.0 + #define Z_PROBE_ALLEN_KEY_STOW_4_Z Z_PROBE_ALLEN_KEY_STOW_3_Z + #define Z_PROBE_ALLEN_KEY_STOW_4_FEEDRATE XY_PROBE_SPEED + +#endif // Z_PROBE_ALLEN_KEY + +/** + * Z Probe to nozzle (X,Y) offset, relative to (0, 0). + * X and Y offsets must be integers. + * + * In the following example the X and Y offsets are both positive: + * #define X_PROBE_OFFSET_FROM_EXTRUDER 10 + * #define Y_PROBE_OFFSET_FROM_EXTRUDER 10 + * + * +-- BACK ---+ + * | | + * L | (+) P | R <-- probe (20,20) + * E | | I + * F | (-) N (+) | G <-- nozzle (10,10) + * T | | H + * | (-) | T + * | | + * O-- FRONT --+ + * (0,0) + */ +#define X_PROBE_OFFSET_FROM_EXTRUDER 0 // X offset: -left +right [of the nozzle] +#define Y_PROBE_OFFSET_FROM_EXTRUDER -10 // Y offset: -front +behind [the nozzle] +#define Z_PROBE_OFFSET_FROM_EXTRUDER -3.5 // Z offset: -below +above [the nozzle] + +// Certain types of probes need to stay away from edges +#define MIN_PROBE_EDGE 10 + +// X and Y axis travel speed (mm/m) between probes +#define XY_PROBE_SPEED 4000 + +// Feedrate (mm/m) for the first approach when double-probing (MULTIPLE_PROBING == 2) +#define Z_PROBE_SPEED_FAST HOMING_FEEDRATE_Z + +// Feedrate (mm/m) for the "accurate" probe of each point +#define Z_PROBE_SPEED_SLOW (Z_PROBE_SPEED_FAST / 2) + +// The number of probes to perform at each point. +// Set to 2 for a fast/slow probe, using the second probe result. +// Set to 3 or more for slow probes, averaging the results. +//#define MULTIPLE_PROBING 2 + +/** + * Z probes require clearance when deploying, stowing, and moving between + * probe points to avoid hitting the bed and other hardware. + * Servo-mounted probes require extra space for the arm to rotate. + * Inductive probes need space to keep from triggering early. + * + * Use these settings to specify the distance (mm) to raise the probe (or + * lower the bed). The values set here apply over and above any (negative) + * probe Z Offset set with Z_PROBE_OFFSET_FROM_EXTRUDER, M851, or the LCD. + * Only integer values >= 1 are valid here. + * + * Example: `M851 Z-5` with a CLEARANCE of 4 => 9mm from bed to nozzle. + * But: `M851 Z+1` with a CLEARANCE of 2 => 2mm from bed to nozzle. + */ +#define Z_CLEARANCE_DEPLOY_PROBE 15 // Z Clearance for Deploy/Stow +#define Z_CLEARANCE_BETWEEN_PROBES 5 // Z Clearance between probe points +#define Z_CLEARANCE_MULTI_PROBE 5 // Z Clearance between multiple probes +//#define Z_AFTER_PROBING 5 // Z position after probing is done + +#define Z_PROBE_LOW_POINT -2 // Farthest distance below the trigger-point to go before stopping + +// For M851 give a range for adjusting the Z probe offset +#define Z_PROBE_OFFSET_RANGE_MIN -20 +#define Z_PROBE_OFFSET_RANGE_MAX 20 + +// Enable the M48 repeatability test to test probe accuracy +//#define Z_MIN_PROBE_REPEATABILITY_TEST + +// Before deploy/stow pause for user confirmation +//#define PAUSE_BEFORE_DEPLOY_STOW + +/** + * Enable one or more of the following if probing seems unreliable. + * Heaters and/or fans can be disabled during probing to minimize electrical + * noise. A delay can also be added to allow noise and vibration to settle. + * These options are most useful for the BLTouch probe, but may also improve + * readings with inductive probes and piezo sensors. + */ +//#define PROBING_HEATERS_OFF // Turn heaters off when probing +#if ENABLED(PROBING_HEATERS_OFF) + //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) +#endif +//#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing +//#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors + +// For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 +// :{ 0:'Low', 1:'High' } +#define X_ENABLE_ON 0 +#define Y_ENABLE_ON 0 +#define Z_ENABLE_ON 0 +#define E_ENABLE_ON 0 // For all extruders + +// Disables axis stepper immediately when it's not being used. +// WARNING: When motors turn off there is a chance of losing position accuracy! +#define DISABLE_X false +#define DISABLE_Y false +#define DISABLE_Z false + +// Warn on display about possibly reduced accuracy +//#define DISABLE_REDUCED_ACCURACY_WARNING + +// @section extruder + +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled + +// @section machine + +// Invert the stepper direction. Change (or reverse the motor connector) if an axis goes the wrong way. +#define INVERT_X_DIR true +#define INVERT_Y_DIR true +#define INVERT_Z_DIR true + +// @section extruder + +// For direct drive extruder v9 set to true, for geared extruder set to false. +#define INVERT_E0_DIR false +#define INVERT_E1_DIR false +#define INVERT_E2_DIR false +#define INVERT_E3_DIR false +#define INVERT_E4_DIR false +#define INVERT_E5_DIR false + +// @section homing + +//#define NO_MOTION_BEFORE_HOMING // Inhibit movement until all axes have been homed + +//#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. + +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... + // Be sure you have this distance over your Z_MAX_POS in case. + +// Direction of endstops when homing; 1=MAX, -1=MIN +// :[-1,1] +#define X_HOME_DIR 1 // deltas always home to max +#define Y_HOME_DIR 1 +#define Z_HOME_DIR 1 + +// @section machine + +// The size of the print bed +#define X_BED_SIZE ((DELTA_PRINTABLE_RADIUS) * 2) +#define Y_BED_SIZE ((DELTA_PRINTABLE_RADIUS) * 2) + +// Travel limits (mm) after homing, corresponding to endstop positions. +#define X_MIN_POS -(DELTA_PRINTABLE_RADIUS) +#define Y_MIN_POS -(DELTA_PRINTABLE_RADIUS) +#define Z_MIN_POS 0 +#define X_MAX_POS DELTA_PRINTABLE_RADIUS +#define Y_MAX_POS DELTA_PRINTABLE_RADIUS +#define Z_MAX_POS MANUAL_Z_HOME_POS + +// Z raise distance for tool-change, as needed for some extruders +#define TOOLCHANGE_ZRAISE 2 // (mm) + +/** + * Software Endstops + * + * - Prevent moves outside the set machine bounds. + * - Individual axes can be disabled, if desired. + * - X and Y only apply to Cartesian robots. + * - Use 'M211' to set software endstops on/off or report current state + */ + +// Min software endstops constrain movement within minimum coordinate bounds +#define MIN_SOFTWARE_ENDSTOPS +#if ENABLED(MIN_SOFTWARE_ENDSTOPS) + #define MIN_SOFTWARE_ENDSTOP_X + #define MIN_SOFTWARE_ENDSTOP_Y + #define MIN_SOFTWARE_ENDSTOP_Z +#endif + +// Max software endstops constrain movement within maximum coordinate bounds +#define MAX_SOFTWARE_ENDSTOPS +#if ENABLED(MAX_SOFTWARE_ENDSTOPS) + #define MAX_SOFTWARE_ENDSTOP_X + #define MAX_SOFTWARE_ENDSTOP_Y + #define MAX_SOFTWARE_ENDSTOP_Z +#endif + +#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) + //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD +#endif + +/** + * Filament Runout Sensors + * Mechanical or opto endstops are used to check for the presence of filament. + * + * RAMPS-based boards use SERVO3_PIN for the first runout sensor. + * For other boards you may need to define FIL_RUNOUT_PIN, FIL_RUNOUT2_PIN, etc. + * By default the firmware assumes HIGH=FILAMENT PRESENT. + */ +//#define FILAMENT_RUNOUT_SENSOR +#if ENABLED(FILAMENT_RUNOUT_SENSOR) + #define NUM_RUNOUT_SENSORS 1 // Number of sensors, up to one per extruder. Define a FIL_RUNOUT#_PIN for each. + #define FIL_RUNOUT_INVERTING false // set to true to invert the logic of the sensor. + #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. + //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. + #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif +#endif + +//=========================================================================== +//=============================== Bed Leveling ============================== +//=========================================================================== +// @section calibrate + +/** + * Choose one of the options below to enable G29 Bed Leveling. The parameters + * and behavior of G29 will change depending on your selection. + * + * If using a Probe for Z Homing, enable Z_SAFE_HOMING also! + * + * - AUTO_BED_LEVELING_3POINT + * Probe 3 arbitrary points on the bed (that aren't collinear) + * You specify the XY coordinates of all 3 points. + * The result is a single tilted plane. Best for a flat bed. + * + * - AUTO_BED_LEVELING_LINEAR + * Probe several points in a grid. + * You specify the rectangle and the density of sample points. + * The result is a single tilted plane. Best for a flat bed. + * + * - AUTO_BED_LEVELING_BILINEAR + * Probe several points in a grid. + * You specify the rectangle and the density of sample points. + * The result is a mesh, best for large or uneven beds. + * + * - AUTO_BED_LEVELING_UBL (Unified Bed Leveling) + * A comprehensive bed leveling system combining the features and benefits + * of other systems. UBL also includes integrated Mesh Generation, Mesh + * Validation and Mesh Editing systems. + * + * - MESH_BED_LEVELING + * Probe a grid manually + * The result is a mesh, suitable for large or uneven beds. (See BILINEAR.) + * For machines without a probe, Mesh Bed Leveling provides a method to perform + * leveling in steps so you can manually adjust the Z height at each grid-point. + * With an LCD controller the process is guided step-by-step. + */ +//#define AUTO_BED_LEVELING_3POINT +//#define AUTO_BED_LEVELING_LINEAR +//#define AUTO_BED_LEVELING_BILINEAR +//#define AUTO_BED_LEVELING_UBL +//#define MESH_BED_LEVELING + +/** + * Normally G28 leaves leveling disabled on completion. Enable + * this option to have G28 restore the prior leveling state. + */ +//#define RESTORE_LEVELING_AFTER_G28 + +/** + * Enable detailed logging of G28, G29, M48, etc. + * Turn on with the command 'M111 S32'. + * NOTE: Requires a lot of PROGMEM! + */ +//#define DEBUG_LEVELING_FEATURE + +#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) + // Gradually reduce leveling correction until a set height is reached, + // at which point movement will be level to the machine's XY plane. + // The height can be set with M420 Z + //#define ENABLE_LEVELING_FADE_HEIGHT + + // For Cartesian machines, instead of dividing moves on mesh boundaries, + // split up moves into short segments like a Delta. This follows the + // contours of the bed more closely than edge-to-edge straight moves. + #define SEGMENT_LEVELED_MOVES + #define LEVELED_SEGMENT_LENGTH 5.0 // (mm) Length of all segments (except the last one) + + /** + * Enable the G26 Mesh Validation Pattern tool. + */ + //#define G26_MESH_VALIDATION + #if ENABLED(G26_MESH_VALIDATION) + #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. + #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. + #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #endif + +#endif + +#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) + + // Set the number of grid points per dimension. + // Works best with 5 or more points in each dimension. + #define GRID_MAX_POINTS_X 9 + #define GRID_MAX_POINTS_Y GRID_MAX_POINTS_X + + // Set the boundaries for probing (where the probe can reach). + //#define LEFT_PROBE_BED_POSITION -(DELTA_PRINTABLE_RADIUS -(MIN_PROBE_EDGE)) + //#define RIGHT_PROBE_BED_POSITION DELTA_PRINTABLE_RADIUS -(MIN_PROBE_EDGE) + //#define FRONT_PROBE_BED_POSITION -(DELTA_PRINTABLE_RADIUS -(MIN_PROBE_EDGE)) + //#define BACK_PROBE_BED_POSITION DELTA_PRINTABLE_RADIUS -(MIN_PROBE_EDGE) + + // Probe along the Y axis, advancing X after each column + //#define PROBE_Y_FIRST + + #if ENABLED(AUTO_BED_LEVELING_BILINEAR) + + // Beyond the probed grid, continue the implied tilt? + // Default is to maintain the height of the nearest edge. + //#define EXTRAPOLATE_BEYOND_GRID + + // + // Experimental Subdivision of the grid by Catmull-Rom method. + // Synthesizes intermediate points to produce a more detailed mesh. + // + //#define ABL_BILINEAR_SUBDIVISION + #if ENABLED(ABL_BILINEAR_SUBDIVISION) + // Number of subdivisions between probe points + #define BILINEAR_SUBDIVISIONS 3 + #endif + + #endif + +#elif ENABLED(AUTO_BED_LEVELING_UBL) + + //=========================================================================== + //========================= Unified Bed Leveling ============================ + //=========================================================================== + + //#define MESH_EDIT_GFX_OVERLAY // Display a graphics overlay while editing the mesh + + #define MESH_INSET 1 // Set Mesh bounds as an inset region of the bed + #define GRID_MAX_POINTS_X 10 // Don't use more than 15 points per axis, implementation limited. + #define GRID_MAX_POINTS_Y GRID_MAX_POINTS_X + + #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle + #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + +#elif ENABLED(MESH_BED_LEVELING) + + //=========================================================================== + //=================================== Mesh ================================== + //=========================================================================== + + #define MESH_INSET 10 // Set Mesh bounds as an inset region of the bed + #define GRID_MAX_POINTS_X 3 // Don't use more than 7 points per axis, implementation limited. + #define GRID_MAX_POINTS_Y GRID_MAX_POINTS_X + + //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS + +#endif // BED_LEVELING + +/** + * Points to probe for all 3-point Leveling procedures. + * Override if the automatically selected points are inadequate. + */ +#if ENABLED(AUTO_BED_LEVELING_3POINT) || ENABLED(AUTO_BED_LEVELING_UBL) + //#define PROBE_PT_1_X 15 + //#define PROBE_PT_1_Y 180 + //#define PROBE_PT_2_X 15 + //#define PROBE_PT_2_Y 20 + //#define PROBE_PT_3_X 170 + //#define PROBE_PT_3_Y 20 +#endif + +/** + * Add a bed leveling sub-menu for ABL or MBL. + * Include a guided procedure if manual probing is enabled. + */ +//#define LCD_BED_LEVELING + +#if ENABLED(LCD_BED_LEVELING) + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points +#endif + +// Add a menu item to move between bed corners for manual bed adjustment +//#define LEVEL_BED_CORNERS + +#if ENABLED(LEVEL_BED_CORNERS) + #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling + //#define LEVEL_CENTER_TOO // Move to the center after the last corner +#endif + +/** + * Commands to execute at the end of G29 probing. + * Useful to retract or move the Z probe out of the way. + */ +//#define Z_PROBE_END_SCRIPT "G1 Z10 F12000\nG1 X15 Y330\nG1 Z0.5\nG1 Z10" + + +// @section homing + +// The center of the bed is at (X=0, Y=0) +#define BED_CENTER_AT_0_0 + +// Manually set the home position. Leave these undefined for automatic settings. +// 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 DELTA_HEIGHT // Distance between the nozzle to printbed after homing + +// Use "Z Safe Homing" to avoid homing with a Z probe outside the bed area. +// +// With this feature enabled: +// +// - Allow Z homing only after X and Y homing AND stepper drivers still enabled. +// - If stepper drivers time out, it will need X and Y homing again before Z homing. +// - Move the Z probe (or nozzle) to a defined XY point before Z Homing when homing all axes (G28). +// - Prevent Z homing when the Z probe is outside bed area. +// +//#define Z_SAFE_HOMING + +#if ENABLED(Z_SAFE_HOMING) + #define Z_SAFE_HOMING_X_POINT ((X_BED_SIZE) / 2) // X point for Z homing when homing all axes (G28). + #define Z_SAFE_HOMING_Y_POINT ((Y_BED_SIZE) / 2) // Y point for Z homing when homing all axes (G28). +#endif + +// Delta only homes to Z +#define HOMING_FEEDRATE_Z (200*60) + +// Validate that endstops are triggered on homing moves +#define VALIDATE_HOMING_ENDSTOPS + +// @section calibrate + +/** + * Bed Skew Compensation + * + * This feature corrects for misalignment in the XYZ axes. + * + * Take the following steps to get the bed skew in the XY plane: + * 1. Print a test square (e.g., https://www.thingiverse.com/thing:2563185) + * 2. For XY_DIAG_AC measure the diagonal A to C + * 3. For XY_DIAG_BD measure the diagonal B to D + * 4. For XY_SIDE_AD measure the edge A to D + * + * Marlin automatically computes skew factors from these measurements. + * Skew factors may also be computed and set manually: + * + * - Compute AB : SQRT(2*AC*AC+2*BD*BD-4*AD*AD)/2 + * - XY_SKEW_FACTOR : TAN(PI/2-ACOS((AC*AC-AB*AB-AD*AD)/(2*AB*AD))) + * + * If desired, follow the same procedure for XZ and YZ. + * Use these diagrams for reference: + * + * Y Z Z + * ^ B-------C ^ B-------C ^ B-------C + * | / / | / / | / / + * | / / | / / | / / + * | A-------D | A-------D | A-------D + * +-------------->X +-------------->X +-------------->Y + * XY_SKEW_FACTOR XZ_SKEW_FACTOR YZ_SKEW_FACTOR + */ +//#define SKEW_CORRECTION + +#if ENABLED(SKEW_CORRECTION) + // Input all length measurements here: + #define XY_DIAG_AC 282.8427124746 + #define XY_DIAG_BD 282.8427124746 + #define XY_SIDE_AD 200 + + // Or, set the default skew factors directly here + // to override the above measurements: + #define XY_SKEW_FACTOR 0.0 + + //#define SKEW_CORRECTION_FOR_Z + #if ENABLED(SKEW_CORRECTION_FOR_Z) + #define XZ_DIAG_AC 282.8427124746 + #define XZ_DIAG_BD 282.8427124746 + #define YZ_DIAG_AC 282.8427124746 + #define YZ_DIAG_BD 282.8427124746 + #define YZ_SIDE_AD 200 + #define XZ_SKEW_FACTOR 0.0 + #define YZ_SKEW_FACTOR 0.0 + #endif + + // Enable this option for M852 to set skew at runtime + //#define SKEW_CORRECTION_GCODE +#endif + +//============================================================================= +//============================= Additional Features =========================== +//============================================================================= + +// @section extras + +// +// EEPROM +// +// The microcontroller can store settings in the EEPROM, e.g. max velocity... +// M500 - stores parameters in EEPROM +// M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily). +// M502 - reverts to the default "factory settings". You still need to store them in EEPROM afterwards if you want to. +// +#define EEPROM_SETTINGS // Enable for M500 and M501 commands +//#define DISABLE_M503 // Saves ~2700 bytes of PROGMEM. Disable for release! +#define EEPROM_CHITCHAT // Give feedback on EEPROM commands. Disable to save PROGMEM. + +// +// Host Keepalive +// +// When enabled Marlin will send a busy status message to the host +// every couple of seconds when it can't accept commands. +// +#define HOST_KEEPALIVE_FEATURE // Disable this if your host doesn't like keepalive messages +#define DEFAULT_KEEPALIVE_INTERVAL 2 // Number of seconds between "busy" messages. Set with M113. +#define BUSY_WHILE_HEATING // Some hosts require "busy" messages even during heating + +// +// M100 Free Memory Watcher +// +//#define M100_FREE_MEMORY_WATCHER // Add M100 (Free Memory Watcher) to debug memory usage + +// +// G20/G21 Inch mode support +// +//#define INCH_MODE_SUPPORT + +// +// M149 Set temperature units support +// +//#define TEMPERATURE_UNITS_SUPPORT + +// @section temperature + +// Preheat Constants +#define PREHEAT_1_LABEL "PLA" +#define PREHEAT_1_TEMP_HOTEND 180 +#define PREHEAT_1_TEMP_BED 70 +#define PREHEAT_1_FAN_SPEED 255 // Value from 0 to 255 + +#define PREHEAT_2_LABEL "ABS" +#define PREHEAT_2_TEMP_HOTEND 240 +#define PREHEAT_2_TEMP_BED 100 +#define PREHEAT_2_FAN_SPEED 255 // Value from 0 to 255 + +/** + * Nozzle Park + * + * Park the nozzle at the given XYZ position on idle or G27. + * + * The "P" parameter controls the action applied to the Z axis: + * + * P0 (Default) If Z is below park Z raise the nozzle. + * P1 Raise the nozzle always to Z-park height. + * P2 Raise the nozzle by Z-park amount, limited to Z_MAX_POS. + */ +//#define NOZZLE_PARK_FEATURE + +#if ENABLED(NOZZLE_PARK_FEATURE) + // Specify a park position as { X, Y, Z } + #define NOZZLE_PARK_POINT { (X_MIN_POS + 10), 0, 20 } + #define NOZZLE_PARK_XY_FEEDRATE 100 // X and Y axes feedrate in mm/s (also used for delta printers Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // Z axis feedrate in mm/s (not used for delta printers) +#endif + +/** + * Clean Nozzle Feature -- EXPERIMENTAL + * + * Adds the G12 command to perform a nozzle cleaning process. + * + * Parameters: + * P Pattern + * S Strokes / Repetitions + * T Triangles (P1 only) + * + * Patterns: + * P0 Straight line (default). This process requires a sponge type material + * at a fixed bed location. "S" specifies strokes (i.e. back-forth motions) + * between the start / end points. + * + * P1 Zig-zag pattern between (X0, Y0) and (X1, Y1), "T" specifies the + * number of zig-zag triangles to do. "S" defines the number of strokes. + * Zig-zags are done in whichever is the narrower dimension. + * For example, "G12 P1 S1 T3" will execute: + * + * -- + * | (X0, Y1) | /\ /\ /\ | (X1, Y1) + * | | / \ / \ / \ | + * A | | / \ / \ / \ | + * | | / \ / \ / \ | + * | (X0, Y0) | / \/ \/ \ | (X1, Y0) + * -- +--------------------------------+ + * |________|_________|_________| + * T1 T2 T3 + * + * P2 Circular pattern with middle at NOZZLE_CLEAN_CIRCLE_MIDDLE. + * "R" specifies the radius. "S" specifies the stroke count. + * Before starting, the nozzle moves to NOZZLE_CLEAN_START_POINT. + * + * Caveats: The ending Z should be the same as starting Z. + * Attention: EXPERIMENTAL. G-code arguments may change. + * + */ +//#define NOZZLE_CLEAN_FEATURE + +#if ENABLED(NOZZLE_CLEAN_FEATURE) + // Default number of pattern repetitions + #define NOZZLE_CLEAN_STROKES 12 + + // Default number of triangles + #define NOZZLE_CLEAN_TRIANGLES 3 + + // Specify positions as { X, Y, Z } + #define NOZZLE_CLEAN_START_POINT { 30, 30, (Z_MIN_POS + 1)} + #define NOZZLE_CLEAN_END_POINT {100, 60, (Z_MIN_POS + 1)} + + // Circular pattern radius + #define NOZZLE_CLEAN_CIRCLE_RADIUS 6.5 + // Circular pattern circle fragments number + #define NOZZLE_CLEAN_CIRCLE_FN 10 + // Middle point of circle + #define NOZZLE_CLEAN_CIRCLE_MIDDLE NOZZLE_CLEAN_START_POINT + + // Moves the nozzle to the initial position + #define NOZZLE_CLEAN_GOBACK +#endif + +/** + * Print Job Timer + * + * Automatically start and stop the print job timer on M104/M109/M190. + * + * M104 (hotend, no wait) - high temp = none, low temp = stop timer + * M109 (hotend, wait) - high temp = start timer, low temp = stop timer + * M190 (bed, wait) - high temp = start timer, low temp = none + * + * The timer can also be controlled with the following commands: + * + * M75 - Start the print job timer + * M76 - Pause the print job timer + * M77 - Stop the print job timer + */ +#define PRINTJOB_TIMER_AUTOSTART + +/** + * Print Counter + * + * Track statistical data such as: + * + * - Total print jobs + * - Total successful print jobs + * - Total failed print jobs + * - Total time printing + * + * View the current statistics with M78. + */ +#define PRINTCOUNTER + +//============================================================================= +//============================= LCD and SD support ============================ +//============================================================================= + +// @section lcd + +/** + * LCD LANGUAGE + * + * Select the language to display on the LCD. These languages are available: + * + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + */ +#define LCD_LANGUAGE en + +/** + * LCD Character Set + * + * Note: This option is NOT applicable to Graphical Displays. + * + * All character-based LCDs provide ASCII plus one of these + * language extensions: + * + * - JAPANESE ... the most common + * - WESTERN ... with more accented characters + * - CYRILLIC ... for the Russian language + * + * To determine the language extension installed on your controller: + * + * - Compile and upload with LCD_LANGUAGE set to 'test' + * - Click the controller to view the LCD menu + * - The LCD will display Japanese, Western, or Cyrillic text + * + * See http://marlinfw.org/docs/development/lcd_language.html + * + * :['JAPANESE', 'WESTERN', 'CYRILLIC'] + */ +#define DISPLAY_CHARSET_HD44780 JAPANESE + +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + +/** + * SD CARD + * + * SD Card support is disabled by default. If your controller has an SD slot, + * you must uncomment the following option or it won't work. + * + */ +#define SDSUPPORT + +/** + * SD CARD: SPI SPEED + * + * Enable one of the following items for a slower SPI transfer speed. + * This may be required to resolve "volume init" errors. + */ +//#define SPI_SPEED SPI_HALF_SPEED +//#define SPI_SPEED SPI_QUARTER_SPEED +//#define SPI_SPEED SPI_EIGHTH_SPEED + +/** + * SD CARD: ENABLE CRC + * + * Use CRC checks and retries on the SD communication. + */ +//#define SD_CHECK_AND_RETRY + +/** + * LCD Menu Items + * + * Disable all menus and only display the Status Screen, or + * just remove some extraneous menu items to recover space. + */ +//#define NO_LCD_MENUS +//#define SLIM_LCD_MENUS + +// +// ENCODER SETTINGS +// +// This option overrides the default number of encoder pulses needed to +// produce one step. Should be increased for high-resolution encoders. +// +//#define ENCODER_PULSES_PER_STEP 4 + +// +// Use this option to override the number of step signals required to +// move between next/prev menu items. +// +//#define ENCODER_STEPS_PER_MENU_ITEM 1 + +/** + * Encoder Direction Options + * + * Test your encoder's behavior first with both options disabled. + * + * Reversed Value Edit and Menu Nav? Enable REVERSE_ENCODER_DIRECTION. + * Reversed Menu Navigation only? Enable REVERSE_MENU_DIRECTION. + * Reversed Value Editing only? Enable BOTH options. + */ + +// +// This option reverses the encoder direction everywhere. +// +// Set this option if CLOCKWISE causes values to DECREASE +// +//#define REVERSE_ENCODER_DIRECTION + +// +// This option reverses the encoder direction for navigating LCD menus. +// +// If CLOCKWISE normally moves DOWN this makes it go UP. +// If CLOCKWISE normally moves UP this makes it go DOWN. +// +//#define REVERSE_MENU_DIRECTION + +// +// Individual Axis Homing +// +// Add individual axis homing items (Home X, Home Y, and Home Z) to the LCD menu. +// +//#define INDIVIDUAL_AXIS_HOMING_MENU + +// +// SPEAKER/BUZZER +// +// If you have a speaker that can produce tones, enable it here. +// By default Marlin assumes you have a buzzer with a fixed frequency. +// +//#define SPEAKER + +// +// The duration and frequency for the UI feedback sound. +// Set these to 0 to disable audio feedback in the LCD menus. +// +// Note: Test audio output with the G-Code: +// M300 S P +// +//#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 2 +//#define LCD_FEEDBACK_FREQUENCY_HZ 5000 + +//============================================================================= +//======================== LCD / Controller Selection ========================= +//======================== (Character-based LCDs) ========================= +//============================================================================= + +// +// RepRapDiscount Smart Controller. +// http://reprap.org/wiki/RepRapDiscount_Smart_Controller +// +// Note: Usually sold with a white PCB. +// +#define REPRAP_DISCOUNT_SMART_CONTROLLER + +// +// Original RADDS LCD Display+Encoder+SDCardReader +// http://doku.radds.org/dokumentation/lcd-display/ +// +//#define RADDS_DISPLAY + +// +// ULTIMAKER Controller. +// +//#define ULTIMAKERCONTROLLER + +// +// ULTIPANEL as seen on Thingiverse. +// +//#define ULTIPANEL + +// +// PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3) +// http://reprap.org/wiki/PanelOne +// +//#define PANEL_ONE + +// +// GADGETS3D G3D LCD/SD Controller +// http://reprap.org/wiki/RAMPS_1.3/1.4_GADGETS3D_Shield_with_Panel +// +// Note: Usually sold with a blue PCB. +// +//#define G3D_PANEL + +// +// RigidBot Panel V1.0 +// http://www.inventapart.com/ +// +//#define RIGIDBOT_PANEL + +// +// Makeboard 3D Printer Parts 3D Printer Mini Display 1602 Mini Controller +// https://www.aliexpress.com/item/Micromake-Makeboard-3D-Printer-Parts-3D-Printer-Mini-Display-1602-Mini-Controller-Compatible-with-Ramps-1/32765887917.html +// +//#define MAKEBOARD_MINI_2_LINE_DISPLAY_1602 + +// +// ANET and Tronxy 20x4 Controller +// +//#define ZONESTAR_LCD // Requires ADC_KEYPAD_PIN to be assigned to an analog pin. + // This LCD is known to be susceptible to electrical interference + // which scrambles the display. Pressing any button clears it up. + // This is a LCD2004 display with 5 analog buttons. + +// +// Generic 16x2, 16x4, 20x2, or 20x4 character-based LCD. +// +//#define ULTRA_LCD + +//============================================================================= +//======================== LCD / Controller Selection ========================= +//===================== (I2C and Shift-Register LCDs) ===================== +//============================================================================= + +// +// CONTROLLER TYPE: I2C +// +// Note: These controllers require the installation of Arduino's LiquidCrystal_I2C +// library. For more info: https://github.com/kiyoshigawa/LiquidCrystal_I2C +// + +// +// Elefu RA Board Control Panel +// http://www.elefu.com/index.php?route=product/product&product_id=53 +// +//#define RA_CONTROL_PANEL + +// +// Sainsmart (YwRobot) LCD Displays +// +// These require F.Malpartida's LiquidCrystal_I2C library +// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home +// +//#define LCD_SAINSMART_I2C_1602 +//#define LCD_SAINSMART_I2C_2004 + +// +// Generic LCM1602 LCD adapter +// +//#define LCM1602 + +// +// PANELOLU2 LCD with status LEDs, +// separate encoder and click inputs. +// +// Note: This controller requires Arduino's LiquidTWI2 library v1.2.3 or later. +// For more info: https://github.com/lincomatic/LiquidTWI2 +// +// Note: The PANELOLU2 encoder click input can either be directly connected to +// a pin (if BTN_ENC defined to != -1) or read through I2C (when BTN_ENC == -1). +// +//#define LCD_I2C_PANELOLU2 + +// +// Panucatt VIKI LCD with status LEDs, +// integrated click & L/R/U/D buttons, separate encoder inputs. +// +//#define LCD_I2C_VIKI + +// +// CONTROLLER TYPE: Shift register panels +// + +// +// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// LCD configuration: http://reprap.org/wiki/SAV_3D_LCD +// +//#define SAV_3DLCD + +//============================================================================= +//======================= LCD / Controller Selection ======================= +//========================= (Graphical LCDs) ======================== +//============================================================================= + +// +// CONTROLLER TYPE: Graphical 128x64 (DOGM) +// +// IMPORTANT: The U8glib library is required for Graphical Display! +// https://github.com/olikraus/U8glib_Arduino +// + +// +// RepRapDiscount FULL GRAPHIC Smart Controller +// http://reprap.org/wiki/RepRapDiscount_Full_Graphic_Smart_Controller +// +//#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER + +// +// ReprapWorld Graphical LCD +// https://reprapworld.com/?products_details&products_id/1218 +// +//#define REPRAPWORLD_GRAPHICAL_LCD + +// +// Activate one of these if you have a Panucatt Devices +// Viki 2.0 or mini Viki with Graphic LCD +// http://panucatt.com +// +//#define VIKI2 +//#define miniVIKI + +// +// MakerLab Mini Panel with graphic +// controller and SD support - http://reprap.org/wiki/Mini_panel +// +//#define MINIPANEL + +// +// MaKr3d Makr-Panel with graphic controller and SD support. +// http://reprap.org/wiki/MaKr3d_MaKrPanel +// +//#define MAKRPANEL + +// +// Adafruit ST7565 Full Graphic Controller. +// https://github.com/eboston/Adafruit-ST7565-Full-Graphic-Controller/ +// +//#define ELB_FULL_GRAPHIC_CONTROLLER + +// +// BQ LCD Smart Controller shipped by +// default with the BQ Hephestos 2 and Witbox 2. +// +//#define BQ_LCD_SMART_CONTROLLER + +// +// Cartesio UI +// http://mauk.cc/webshop/cartesio-shop/electronics/user-interface +// +//#define CARTESIO_UI + +// +// LCD for Melzi Card with Graphical LCD +// +//#define LCD_FOR_MELZI + +// +// SSD1306 OLED full graphics generic display +// +//#define U8GLIB_SSD1306 + +// +// SAV OLEd LCD module support using either SSD1306 or SH1106 based LCD modules +// +//#define SAV_3DGLCD +#if ENABLED(SAV_3DGLCD) + //#define U8GLIB_SSD1306 + #define U8GLIB_SH1106 +#endif + +// +// Original Ulticontroller from Ultimaker 2 printer with SSD1309 I2C display and encoder +// https://github.com/Ultimaker/Ultimaker2/tree/master/1249_Ulticontroller_Board_(x1) +// +//#define ULTI_CONTROLLER + +// +// TinyBoy2 128x64 OLED / Encoder Panel +// +//#define OLED_PANEL_TINYBOY2 + +// +// MKS MINI12864 with graphic controller and SD support +// http://reprap.org/wiki/MKS_MINI_12864 +// +//#define MKS_MINI_12864 + +// +// Factory display for Creality CR-10 +// https://www.aliexpress.com/item/Universal-LCD-12864-3D-Printer-Display-Screen-With-Encoder-For-CR-10-CR-7-Model/32833148327.html +// +// This is RAMPS-compatible using a single 10-pin connector. +// (For CR-10 owners who want to replace the Melzi Creality board but retain the display) +// +//#define CR10_STOCKDISPLAY + +// +// ANET and Tronxy Graphical Controller +// +// Anet 128x64 full graphics lcd with rotary encoder as used on Anet A6 +// A clone of the RepRapDiscount full graphics display but with +// different pins/wiring (see pins_ANET_10.h). +// +//#define ANET_FULL_GRAPHICS_LCD + +// +// MKS OLED 1.3" 128 × 64 FULL GRAPHICS CONTROLLER +// http://reprap.org/wiki/MKS_12864OLED +// +// Tiny, but very sharp OLED display +// +//#define MKS_12864OLED // Uses the SH1106 controller (default) +//#define MKS_12864OLED_SSD1306 // Uses the SSD1306 controller + +// +// AZSMZ 12864 LCD with SD +// https://www.aliexpress.com/store/product/3D-printer-smart-controller-SMART-RAMPS-OR-RAMPS-1-4-LCD-12864-LCD-control-panel-green/2179173_32213636460.html +// +//#define AZSMZ_12864 + +// +// Silvergate GLCD controller +// http://github.com/android444/Silvergate +// +//#define SILVER_GATE_GLCD_CONTROLLER + +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + +//============================================================================= +//============================ Other Controllers ============================ +//============================================================================= + +// +// CONTROLLER TYPE: Standalone / Serial +// + +// +// LCD for Malyan M200 printers. +// +//#define MALYAN_LCD + +// +// CONTROLLER TYPE: Keypad / Add-on +// + +// +// RepRapWorld REPRAPWORLD_KEYPAD v1.1 +// http://reprapworld.com/?products_details&products_id=202&cPath=1591_1626 +// +// REPRAPWORLD_KEYPAD_MOVE_STEP sets how much should the robot move when a key +// is pressed, a value of 10.0 means 10mm per click. +// +//#define REPRAPWORLD_KEYPAD +//#define REPRAPWORLD_KEYPAD_MOVE_STEP 10.0 + +//============================================================================= +//=============================== Extra Features ============================== +//============================================================================= + +// @section extras + +// Increase the FAN PWM frequency. Removes the PWM noise but increases heating in the FET/Arduino +//#define FAST_PWM_FAN + +// Use software PWM to drive the fan, as for the heaters. This uses a very low frequency +// which is not as annoying as with the hardware PWM. On the other hand, if this frequency +// is too low, you should also increment SOFT_PWM_SCALE. +//#define FAN_SOFT_PWM + +// Incrementing this by 1 will double the software PWM frequency, +// affecting heaters, and the fan if FAN_SOFT_PWM is enabled. +// However, control resolution will be halved for each increment; +// at zero value, there are 128 effective control positions. +#define SOFT_PWM_SCALE 0 + +// If SOFT_PWM_SCALE is set to a value higher than 0, dithering can +// be used to mitigate the associated resolution loss. If enabled, +// some of the PWM cycles are stretched so on average the desired +// duty cycle is attained. +//#define SOFT_PWM_DITHER + +// Temperature status LEDs that display the hotend and bed temperature. +// If all hotends, bed temperature, and target temperature are under 54C +// then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) +//#define TEMP_STAT_LEDS + +// M240 Triggers a camera by emulating a Canon RC-1 Remote +// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ +//#define PHOTOGRAPH_PIN 23 + +// SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure +//#define SF_ARC_FIX + +// Support for the BariCUDA Paste Extruder +//#define BARICUDA + +// Support for BlinkM/CyzRgb +//#define BLINKM + +// Support for PCA9632 PWM LED driver +//#define PCA9632 + +/** + * RGB LED / LED Strip Control + * + * Enable support for an RGB LED connected to 5V digital pins, or + * an RGB Strip connected to MOSFETs controlled by digital pins. + * + * Adds the M150 command to set the LED (or LED strip) color. + * If pins are PWM capable (e.g., 4, 5, 6, 11) then a range of + * luminance values can be set from 0 to 255. + * For Neopixel LED an overall brightness parameter is also available. + * + * *** CAUTION *** + * LED Strips require a MOSFET Chip between PWM lines and LEDs, + * as the Arduino cannot handle the current the LEDs will require. + * Failure to follow this precaution can destroy your Arduino! + * NOTE: A separate 5V power supply is required! The Neopixel LED needs + * more current than the Arduino 5V linear regulator can produce. + * *** CAUTION *** + * + * LED Type. Enable only one of the following two options. + * + */ +//#define RGB_LED +//#define RGBW_LED + +#if ENABLED(RGB_LED) || ENABLED(RGBW_LED) + #define RGB_LED_R_PIN 34 + #define RGB_LED_G_PIN 43 + #define RGB_LED_B_PIN 35 + #define RGB_LED_W_PIN -1 +#endif + +// Support for Adafruit Neopixel LED driver +//#define NEOPIXEL_LED +#if ENABLED(NEOPIXEL_LED) + #define NEOPIXEL_TYPE NEO_GRBW // NEO_GRBW / NEO_GRB - four/three channel driver type (defined in Adafruit_NeoPixel.h) + #define NEOPIXEL_PIN 4 // LED driving pin on motherboard 4 => D4 (EXP2-5 on Printrboard) / 30 => PC7 (EXP3-13 on Rumba) + #define NEOPIXEL_PIXELS 30 // Number of LEDs in the strip + #define NEOPIXEL_IS_SEQUENTIAL // Sequential display for temperature change - LED by LED. Disable to change all LEDs at once. + #define NEOPIXEL_BRIGHTNESS 127 // Initial brightness (0-255) + //#define NEOPIXEL_STARTUP_TEST // Cycle through colors at startup +#endif + +/** + * Printer Event LEDs + * + * During printing, the LEDs will reflect the printer status: + * + * - Gradually change from blue to violet as the heated bed gets to target temp + * - Gradually change from violet to red as the hotend gets to temperature + * - Change to white to illuminate work surface + * - Change to green once print has finished + * - Turn off after the print has finished and the user has pushed a button + */ +#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632) || ENABLED(NEOPIXEL_LED) + #define PRINTER_EVENT_LEDS +#endif + +/** + * R/C SERVO support + * Sponsored by TrinityLabs, Reworked by codexmas + */ + +/** + * Number of servos + * + * For some servo-related options NUM_SERVOS will be set automatically. + * Set this manually if there are extra servos needing manual control. + * Leave undefined or set to 0 to entirely disable the servo subsystem. + */ +//#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command + +// Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle. +// 300ms is a good value but you can try less delay. +// If the servo can't reach the requested position, increase it. +#define SERVO_DELAY { 300 } + +// Only power servos during movement, otherwise leave off to prevent jitter +//#define DEACTIVATE_SERVOS_AFTER_MOVE + +// Allow servo angle to be edited and saved to EEPROM +//#define EDITABLE_SERVO_ANGLES diff --git a/Marlin/src/config/examples/delta/Geeetech/Rostock 301/Configuration_adv.h b/Marlin/src/config/examples/delta/Geeetech/Rostock 301/Configuration_adv.h new file mode 100644 index 0000000000..773582e800 --- /dev/null +++ b/Marlin/src/config/examples/delta/Geeetech/Rostock 301/Configuration_adv.h @@ -0,0 +1,1860 @@ +/** + * 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 . + * + */ +#pragma once + +/** + * Configuration_adv.h + * + * Advanced settings. + * Only change these if you know exactly what you're doing. + * Some of these settings can damage your printer if improperly set! + * + * Basic settings can be found in Configuration.h + * + */ +#define CONFIGURATION_ADV_H_VERSION 020000 + +// @section temperature + +//=========================================================================== +//=============================Thermal Settings ============================ +//=========================================================================== + +// +// Hephestos 2 24V heated bed upgrade kit. +// https://store.bq.com/en/heated-bed-kit-hephestos2 +// +//#define HEPHESTOS2_HEATED_BED_KIT +#if ENABLED(HEPHESTOS2_HEATED_BED_KIT) + #undef TEMP_SENSOR_BED + #define TEMP_SENSOR_BED 70 + #define HEATER_BED_INVERTING true +#endif + +#if DISABLED(PIDTEMPBED) + #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control + #if ENABLED(BED_LIMIT_SWITCHING) + #define BED_HYSTERESIS 2 // Only disable heating if T>target+BED_HYSTERESIS and enable heating if T>target-BED_HYSTERESIS + #endif +#endif + +/** + * Thermal Protection provides additional protection to your printer from damage + * and fire. Marlin always includes safe min and max temperature ranges which + * protect against a broken or disconnected thermistor wire. + * + * The issue: If a thermistor falls out, it will report the much lower + * temperature of the air in the room, and the the firmware will keep + * the heater on. + * + * The solution: Once the temperature reaches the target, start observing. + * If the temperature stays too far below the target (hysteresis) for too + * long (period), the firmware will halt the machine as a safety precaution. + * + * If you get false positives for "Thermal Runaway", increase + * THERMAL_PROTECTION_HYSTERESIS and/or THERMAL_PROTECTION_PERIOD + */ +#if ENABLED(THERMAL_PROTECTION_HOTENDS) + #define THERMAL_PROTECTION_PERIOD 40 // Seconds + #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius + + /** + * Whenever an M104, M109, or M303 increases the target temperature, the + * firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature + * hasn't increased by WATCH_TEMP_INCREASE degrees, the machine is halted and + * requires a hard reset. This test restarts with any M104/M109/M303, but only + * if the current temperature is far enough below the target for a reliable + * test. + * + * If you get false positives for "Heating failed", increase WATCH_TEMP_PERIOD + * and/or decrease WATCH_TEMP_INCREASE. WATCH_TEMP_INCREASE should not be set + * below 2. + */ + #define WATCH_TEMP_PERIOD 20 // Seconds + #define WATCH_TEMP_INCREASE 2 // Degrees Celsius +#endif + +/** + * Thermal Protection parameters for the bed are just as above for hotends. + */ +#if ENABLED(THERMAL_PROTECTION_BED) + #define THERMAL_PROTECTION_BED_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_BED_HYSTERESIS 2 // Degrees Celsius + + /** + * As described above, except for the bed (M140/M190/M303). + */ + #define WATCH_BED_TEMP_PERIOD 60 // Seconds + #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius +#endif + +#if ENABLED(PIDTEMP) + // this adds an experimental additional term to the heating power, proportional to the extrusion speed. + // if Kc is chosen well, the additional required power due to increased melting should be compensated. + //#define PID_EXTRUSION_SCALING + #if ENABLED(PID_EXTRUSION_SCALING) + #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) + #define LPQ_MAX_LEN 50 + #endif +#endif + +/** + * Automatic Temperature: + * The hotend target temperature is calculated by all the buffered lines of gcode. + * The maximum buffered steps/sec of the extruder motor is called "se". + * Start autotemp mode with M109 S B F + * The target temperature is set to mintemp+factor*se[steps/sec] and is limited by + * mintemp and maxtemp. Turn this off by executing M109 without F* + * Also, if the temperature is set to a value below mintemp, it will not be changed by autotemp. + * On an Ultimaker, some initial testing worked with M109 S215 B260 F1 in the start.gcode + */ +#define AUTOTEMP +#if ENABLED(AUTOTEMP) + #define AUTOTEMP_OLDWEIGHT 0.98 +#endif + +// Show extra position information in M114 +//#define M114_DETAIL + +// Show Temperature ADC value +// Enable for M105 to include ADC values read from temperature sensors. +//#define SHOW_TEMP_ADC_VALUES + +/** + * High Temperature Thermistor Support + * + * Thermistors able to support high temperature tend to have a hard time getting + * good readings at room and lower temperatures. This means HEATER_X_RAW_LO_TEMP + * will probably be caught when the heating element first turns on during the + * preheating process, which will trigger a min_temp_error as a safety measure + * and force stop everything. + * To circumvent this limitation, we allow for a preheat time (during which, + * min_temp_error won't be triggered) and add a min_temp buffer to handle + * aberrant readings. + * + * If you want to enable this feature for your hotend thermistor(s) + * uncomment and set values > 0 in the constants below + */ + +// The number of consecutive low temperature errors that can occur +// before a min_temp_error is triggered. (Shouldn't be more than 10.) +//#define MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED 0 + +// The number of milliseconds a hotend will preheat before starting to check +// the temperature. This value should NOT be set to the time it takes the +// hot end to reach the target temperature, but the time it takes to reach +// the minimum temperature your thermistor can read. The lower the better/safer. +// This shouldn't need to be more than 30 seconds (30000) +//#define MILLISECONDS_PREHEAT_TIME 0 + +// @section extruder + +// Extruder runout prevention. +// If the machine is idle and the temperature over MINTEMP +// then extrude some filament every couple of SECONDS. +//#define EXTRUDER_RUNOUT_PREVENT +#if ENABLED(EXTRUDER_RUNOUT_PREVENT) + #define EXTRUDER_RUNOUT_MINTEMP 190 + #define EXTRUDER_RUNOUT_SECONDS 30 + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) +#endif + +// @section temperature + +// Calibration for AD595 / AD8495 sensor to adjust temperature measurements. +// The final temperature is calculated as (measuredTemp * GAIN) + OFFSET. +#define TEMP_SENSOR_AD595_OFFSET 0.0 +#define TEMP_SENSOR_AD595_GAIN 1.0 +#define TEMP_SENSOR_AD8495_OFFSET 0.0 +#define TEMP_SENSOR_AD8495_GAIN 1.0 + +/** + * Controller Fan + * To cool down the stepper drivers and MOSFETs. + * + * The fan will turn on automatically whenever any stepper is enabled + * and turn off after a set period after all steppers are turned off. + */ +//#define USE_CONTROLLER_FAN +#if ENABLED(USE_CONTROLLER_FAN) + //#define CONTROLLER_FAN_PIN -1 // Set a custom pin for the controller fan + #define CONTROLLERFAN_SECS 60 // Duration in seconds for the fan to run after all motors are disabled + #define CONTROLLERFAN_SPEED 255 // 255 == full speed +#endif + +// When first starting the main fan, run it at full speed for the +// given number of milliseconds. This gets the fan spinning reliably +// before setting a PWM value. (Does not work with software PWM for fan on Sanguinololu) +//#define FAN_KICKSTART_TIME 100 + +/** + * PWM Fan Scaling + * + * Define the min/max speeds for PWM fans (as set with M106). + * + * With these options the M106 0-255 value range is scaled to a subset + * to ensure that the fan has enough power to spin, or to run lower + * current fans with higher current. (e.g., 5V/12V fans with 12V/24V) + * Value 0 always turns off the fan. + * + * Define one or both of these to override the default 0-255 range. + */ +//#define FAN_MIN_PWM 50 +//#define FAN_MAX_PWM 128 + +// @section extruder + +/** + * Extruder cooling fans + * + * Extruder auto fans automatically turn on when their extruders' + * temperatures go above EXTRUDER_AUTO_FAN_TEMPERATURE. + * + * Your board's pins file specifies the recommended pins. Override those here + * or set to -1 to disable completely. + * + * Multiple extruders can be assigned to the same pin in which case + * the fan will turn on when any selected extruder is above the threshold. + */ +#define E0_AUTO_FAN_PIN -1 +#define E1_AUTO_FAN_PIN -1 +#define E2_AUTO_FAN_PIN -1 +#define E3_AUTO_FAN_PIN -1 +#define E4_AUTO_FAN_PIN -1 +#define E5_AUTO_FAN_PIN -1 +#define CHAMBER_AUTO_FAN_PIN -1 +#define EXTRUDER_AUTO_FAN_TEMPERATURE 50 +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed + +/** + * Part-Cooling Fan Multiplexer + * + * This feature allows you to digitally multiplex the fan output. + * The multiplexer is automatically switched at tool-change. + * Set FANMUX[012]_PINs below for up to 2, 4, or 8 multiplexed fans. + */ +#define FANMUX0_PIN -1 +#define FANMUX1_PIN -1 +#define FANMUX2_PIN -1 + +/** + * M355 Case Light on-off / brightness + */ +//#define CASE_LIGHT_ENABLE +#if ENABLED(CASE_LIGHT_ENABLE) + //#define CASE_LIGHT_PIN 4 // Override the default pin if needed + #define INVERT_CASE_LIGHT false // Set true if Case Light is ON when pin is LOW + #define CASE_LIGHT_DEFAULT_ON true // Set default power-up state on + #define CASE_LIGHT_DEFAULT_BRIGHTNESS 105 // Set default power-up brightness (0-255, requires PWM pin) + //#define MENU_ITEM_CASE_LIGHT // Add a Case Light option to the LCD main menu + //#define CASE_LIGHT_USE_NEOPIXEL // Use Neopixel LED as case light, requires NEOPIXEL_LED. + #if ENABLED(CASE_LIGHT_USE_NEOPIXEL) + #define CASE_LIGHT_NEOPIXEL_COLOR { 255, 255, 255, 255 } // { Red, Green, Blue, White } + #endif +#endif + +//=========================================================================== +//============================ Mechanical Settings ========================== +//=========================================================================== + +// @section homing + +// If you want endstops to stay on (by default) even when not homing +// enable this option. Override at any time with M120, M121. +//#define ENDSTOPS_ALWAYS_ON_DEFAULT + +// @section extras + +//#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats. + +// Employ an external closed loop controller. Override pins here if needed. +//#define EXTERNAL_CLOSED_LOOP_CONTROLLER +#if ENABLED(EXTERNAL_CLOSED_LOOP_CONTROLLER) + //#define CLOSED_LOOP_ENABLE_PIN -1 + //#define CLOSED_LOOP_MOVE_COMPLETE_PIN -1 +#endif + +/** + * Dual Steppers / Dual Endstops + * + * This section will allow you to use extra E drivers to drive a second motor for X, Y, or Z axes. + * + * For example, set X_DUAL_STEPPER_DRIVERS setting to use a second motor. If the motors need to + * spin in opposite directions set INVERT_X2_VS_X_DIR. If the second motor needs its own endstop + * set X_DUAL_ENDSTOPS. This can adjust for "racking." Use X2_USE_ENDSTOP to set the endstop plug + * that should be used for the second endstop. Extra endstops will appear in the output of 'M119'. + * + * Use X_DUAL_ENDSTOP_ADJUSTMENT to adjust for mechanical imperfection. After homing both motors + * this offset is applied to the X2 motor. To find the offset home the X axis, and measure the error + * in X2. Dual endstop offsets can be set at runtime with 'M666 X Y Z'. + */ + +//#define X_DUAL_STEPPER_DRIVERS +#if ENABLED(X_DUAL_STEPPER_DRIVERS) + #define INVERT_X2_VS_X_DIR true // Set 'true' if X motors should rotate in opposite directions + //#define X_DUAL_ENDSTOPS + #if ENABLED(X_DUAL_ENDSTOPS) + #define X2_USE_ENDSTOP _XMAX_ + #define X_DUAL_ENDSTOPS_ADJUSTMENT 0 + #endif +#endif + +//#define Y_DUAL_STEPPER_DRIVERS +#if ENABLED(Y_DUAL_STEPPER_DRIVERS) + #define INVERT_Y2_VS_Y_DIR true // Set 'true' if Y motors should rotate in opposite directions + //#define Y_DUAL_ENDSTOPS + #if ENABLED(Y_DUAL_ENDSTOPS) + #define Y2_USE_ENDSTOP _YMAX_ + #define Y_DUAL_ENDSTOPS_ADJUSTMENT 0 + #endif +#endif + +//#define Z_DUAL_STEPPER_DRIVERS +#if ENABLED(Z_DUAL_STEPPER_DRIVERS) + //#define Z_DUAL_ENDSTOPS + #if ENABLED(Z_DUAL_ENDSTOPS) + #define Z2_USE_ENDSTOP _XMAX_ + #define Z_DUAL_ENDSTOPS_ADJUSTMENT 0 + #endif +#endif + +//#define Z_TRIPLE_STEPPER_DRIVERS +#if ENABLED(Z_TRIPLE_STEPPER_DRIVERS) + //#define Z_TRIPLE_ENDSTOPS + #if ENABLED(Z_TRIPLE_ENDSTOPS) + #define Z2_USE_ENDSTOP _XMAX_ + #define Z3_USE_ENDSTOP _YMAX_ + #define Z_TRIPLE_ENDSTOPS_ADJUSTMENT2 0 + #define Z_TRIPLE_ENDSTOPS_ADJUSTMENT3 0 + #endif +#endif + +/** + * Dual X Carriage + * + * This setup has two X carriages that can move independently, each with its own hotend. + * The carriages can be used to print an object with two colors or materials, or in + * "duplication mode" it can print two identical or X-mirrored objects simultaneously. + * The inactive carriage is parked automatically to prevent oozing. + * X1 is the left carriage, X2 the right. They park and home at opposite ends of the X axis. + * By default the X2 stepper is assigned to the first unused E plug on the board. + */ +//#define DUAL_X_CARRIAGE +#if ENABLED(DUAL_X_CARRIAGE) + #define X1_MIN_POS X_MIN_POS // set minimum to ensure first x-carriage doesn't hit the parked second X-carriage + #define X1_MAX_POS X_BED_SIZE // set maximum to ensure first x-carriage doesn't hit the parked second X-carriage + #define X2_MIN_POS 80 // set minimum to ensure second x-carriage doesn't hit the parked first X-carriage + #define X2_MAX_POS 353 // set maximum to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // the second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // default home position is the maximum carriage position + // However: In this mode the HOTEND_OFFSET_X value for the second extruder provides a software + // override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops + // without modifying the firmware (through the "M218 T1 X???" command). + // Remember: you should set the second extruder x-offset to 0 in your slicer. + + // There are a few selectable movement modes for dual x-carriages using M605 S + // Mode 0 (DXC_FULL_CONTROL_MODE): 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 S0) + // Mode 1 (DXC_AUTO_PARK_MODE) : Auto-park mode. The firmware will automatically park and unpark the x-carriages on tool changes so + // that additional slicer support is not required. (M605 S1) + // Mode 2 (DXC_DUPLICATION_MODE) : Duplication mode. The firmware will transparently make the second x-carriage and extruder copy all + // actions of the first x-carriage. This allows the printer to print 2 arbitrary items at + // once. (2nd extruder x offset and temp offset are set using: M605 S2 [Xnnn] [Rmmm]) + + // This is the default power-up mode which can be later using M605. + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + + // Default x offset in duplication mode (typically set to half print bed width) + #define DEFAULT_DUPLICATION_X_OFFSET 100 + +#endif // DUAL_X_CARRIAGE + +// Activate a solenoid on the active extruder with M380. Disable all with M381. +// Define SOL0_PIN, SOL1_PIN, etc., for each extruder that has a solenoid. +//#define EXT_SOLENOID + +// @section homing + +// Homing hits each endstop, retracts by these distances, then does a slower bump. +#define X_HOME_BUMP_MM 5 +#define Y_HOME_BUMP_MM 5 +#define Z_HOME_BUMP_MM 5 // deltas need the same for all three axes +#define HOMING_BUMP_DIVISOR { 10, 10, 10 } // Re-Bump Speed Divisor (Divides the Homing Feedrate) +//#define QUICK_HOME // If homing includes X and Y, do a diagonal move initially + +// When G28 is called, this option will make Y home before X +//#define HOME_Y_BEFORE_X + +// Enable this if X or Y can't home without homing the other axis first. +//#define CODEPENDENT_XY_HOMING + +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + +// @section machine + +#define AXIS_RELATIVE_MODES {false, false, false, false} + +// Allow duplication mode with a basic dual-nozzle extruder +//#define DUAL_NOZZLE_DUPLICATION_MODE + +// By default pololu step drivers require an active high signal. However, some high power drivers require an active low signal as step. +#define INVERT_X_STEP_PIN false +#define INVERT_Y_STEP_PIN false +#define INVERT_Z_STEP_PIN false +#define INVERT_E_STEP_PIN false + +// Default stepper release if idle. Set to 0 to deactivate. +// Steppers will shut down DEFAULT_STEPPER_DEACTIVE_TIME seconds after the last move when DISABLE_INACTIVE_? is true. +// Time can be set by M18 and M84. +#define DEFAULT_STEPPER_DEACTIVE_TIME 60 +#define DISABLE_INACTIVE_X true +#define DISABLE_INACTIVE_Y true +#define DISABLE_INACTIVE_Z true // set to false if the nozzle will fall down on your printed part when print has finished. +#define DISABLE_INACTIVE_E true + +#define DEFAULT_MINIMUMFEEDRATE 0.0 // minimum feedrate +#define DEFAULT_MINTRAVELFEEDRATE 0.0 + +//#define HOME_AFTER_DEACTIVATE // Require rehoming after steppers are deactivated + +// @section lcd + +#if ENABLED(ULTIPANEL) + #define MANUAL_FEEDRATE_XYZ 50*60 + #define MANUAL_FEEDRATE { MANUAL_FEEDRATE_XYZ, MANUAL_FEEDRATE_XYZ, MANUAL_FEEDRATE_XYZ, 60 } // Feedrates for manual moves along X, Y, Z, E from panel + #define MANUAL_E_MOVES_RELATIVE // Show LCD extruder moves as relative rather than absolute positions + #define ULTIPANEL_FEEDMULTIPLY // Comment to disable setting feedrate multiplier via encoder +#endif + +// @section extras + +// minimum time in microseconds that a movement needs to take if the buffer is emptied. +#define DEFAULT_MINSEGMENTTIME 20000 + +// If defined the movements slow down when the look ahead buffer is only half full +// (don't use SLOWDOWN with DELTA because DELTA generates hundreds of segments per second) +//#define SLOWDOWN + +// Frequency limit +// See nophead's blog for more info +// Not working O +//#define XY_FREQUENCY_LIMIT 15 + +// Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end +// of the buffer and all stops. This should not be much greater than zero and should only be changed +// if unwanted behavior is observed on a user's machine when running at very slow speeds. +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) + +// +// Use Junction Deviation instead of traditional Jerk Limiting +// +//#define JUNCTION_DEVIATION +#if ENABLED(JUNCTION_DEVIATION) + #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +#endif + +/** + * Adaptive Step Smoothing increases the resolution of multi-axis moves, particularly at step frequencies + * below 1kHz (for AVR) or 10kHz (for ARM), where aliasing between axes in multi-axis moves causes audible + * vibration and surface artifacts. The algorithm adapts to provide the best possible step smoothing at the + * lowest stepping frequencies. + */ +//#define ADAPTIVE_STEP_SMOOTHING + +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + +// Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. +#define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] + +/** + * @section stepper motor current + * + * Some boards have a means of setting the stepper motor current via firmware. + * + * The power on motor currents are set by: + * PWM_MOTOR_CURRENT - used by MINIRAMBO & ULTIMAIN_2 + * known compatible chips: A4982 + * DIGIPOT_MOTOR_CURRENT - used by BQ_ZUM_MEGA_3D, RAMBO & SCOOVO_X9H + * known compatible chips: AD5206 + * DAC_MOTOR_CURRENT_DEFAULT - used by PRINTRBOARD_REVF & RIGIDBOARD_V2 + * known compatible chips: MCP4728 + * DIGIPOT_I2C_MOTOR_CURRENTS - used by 5DPRINT, AZTEEG_X3_PRO, AZTEEG_X5_MINI_WIFI, MIGHTYBOARD_REVE + * known compatible chips: MCP4451, MCP4018 + * + * Motor currents can also be set by M907 - M910 and by the LCD. + * M907 - applies to all. + * M908 - BQ_ZUM_MEGA_3D, RAMBO, PRINTRBOARD_REVF, RIGIDBOARD_V2 & SCOOVO_X9H + * M909, M910 & LCD - only PRINTRBOARD_REVF & RIGIDBOARD_V2 + */ +//#define PWM_MOTOR_CURRENT { 1300, 1300, 1250 } // Values in milliamps +//#define DIGIPOT_MOTOR_CURRENT { 135,135,135,135,135 } // Values 0-255 (RAMBO 135 = ~0.75A, 185 = ~1A) +//#define DAC_MOTOR_CURRENT_DEFAULT { 70, 80, 90, 80 } // Default drive percent - X, Y, Z, E axis + +// Use an I2C based DIGIPOT (e.g., Azteeg X3 Pro) +//#define DIGIPOT_I2C +#if ENABLED(DIGIPOT_I2C) && !defined(DIGIPOT_I2C_ADDRESS_A) + /** + * Common slave addresses: + * + * A (A shifted) B (B shifted) IC + * Smoothie 0x2C (0x58) 0x2D (0x5A) MCP4451 + * AZTEEG_X3_PRO 0x2C (0x58) 0x2E (0x5C) MCP4451 + * AZTEEG_X5_MINI_WIFI 0x58 0x5C MCP4451 + * MIGHTYBOARD_REVE 0x2F (0x5E) MCP4018 + */ + #define DIGIPOT_I2C_ADDRESS_A 0x2C // unshifted slave address for first DIGIPOT + #define DIGIPOT_I2C_ADDRESS_B 0x2D // unshifted slave address for second DIGIPOT +#endif + +//#define DIGIPOT_MCP4018 // Requires library from https://github.com/stawel/SlowSoftI2CMaster +#define DIGIPOT_I2C_NUM_CHANNELS 8 // 5DPRINT: 4 AZTEEG_X3_PRO: 8 MKS SBASE: 5 +// Actual motor currents in Amps. The number of entries must match DIGIPOT_I2C_NUM_CHANNELS. +// These correspond to the physical drivers, so be mindful if the order is changed. +#define DIGIPOT_I2C_MOTOR_CURRENTS { 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 } // AZTEEG_X3_PRO + +//=========================================================================== +//=============================Additional Features=========================== +//=========================================================================== + +// @section lcd + +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + +// Include a page of printer information in the LCD Main Menu +//#define LCD_INFO_MENU + +// Scroll a longer status message into view +//#define STATUS_MESSAGE_SCROLLING + +// On the Info Screen, display XY with one decimal place when possible +//#define LCD_DECIMAL_SMALL_XY + +// The timeout (in ms) to return to the status screen from sub-menus +//#define LCD_TIMEOUT_TO_STATUS 15000 + +// Add an 'M73' G-code to set the current percentage +//#define LCD_SET_PROGRESS_MANUALLY + +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS + //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing + #if ENABLED(LCD_PROGRESS_BAR) + #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar + #define PROGRESS_BAR_MSG_TIME 3000 // (ms) Amount of time to show the status message + #define PROGRESS_MSG_EXPIRE 0 // (ms) Amount of time to retain the status message (0=forever) + //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it + //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar + #endif +#endif // HAS_PRINT_PROGRESS + +/** + * LED Control Menu + * Enable this feature to add LED Control to the LCD menu + */ +//#define LED_CONTROL_MENU +#if ENABLED(LED_CONTROL_MENU) + #define LED_COLOR_PRESETS // Enable the Preset Color menu option + #if ENABLED(LED_COLOR_PRESETS) + #define LED_USER_PRESET_RED 255 // User defined RED value + #define LED_USER_PRESET_GREEN 128 // User defined GREEN value + #define LED_USER_PRESET_BLUE 0 // User defined BLUE value + #define LED_USER_PRESET_WHITE 255 // User defined WHITE value + #define LED_USER_PRESET_BRIGHTNESS 255 // User defined intensity + //#define LED_USER_PRESET_STARTUP // Have the printer display the user preset color on startup + #endif +#endif // LED_CONTROL_MENU + +#if ENABLED(SDSUPPORT) + + // Some RAMPS and other boards don't detect when an SD card is inserted. You can work + // around this by connecting a push button or single throw switch to the pin defined + // as SD_DETECT_PIN in your board's pins definitions. + // This setting should be disabled unless you are using a push button, pulling the pin to ground. + // Note: This is always disabled for ULTIPANEL (except ELB_FULL_GRAPHIC_CONTROLLER). + #define SD_DETECT_INVERTED + + #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. + + // Reverse SD sort to show "more recent" files first, according to the card's FAT. + // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. + #define SDCARD_RATHERRECENTFIRST + + // Add an option in the menu to run all auto#.g files + //#define MENU_ADDAUTOSTART + + /** + * Continue after Power-Loss (Creality3D) + * + * Store the current state to the SD Card at the start of each layer + * during SD printing. If the recovery file is found at boot time, present + * an option on the LCD screen to continue the print from the last-known + * point in the file. + */ + //#define POWER_LOSS_RECOVERY + #if ENABLED(POWER_LOSS_RECOVERY) + //#define POWER_LOSS_PIN 44 // Pin to detect power loss + //#define POWER_LOSS_STATE HIGH // State of pin indicating power loss + #endif + + /** + * Sort SD file listings in alphabetical order. + * + * With this option enabled, items on SD cards will be sorted + * by name for easier navigation. + * + * By default... + * + * - Use the slowest -but safest- method for sorting. + * - Folders are sorted to the top. + * - The sort key is statically allocated. + * - No added G-code (M34) support. + * - 40 item sorting limit. (Items after the first 40 are unsorted.) + * + * SD sorting uses static allocation (as set by SDSORT_LIMIT), allowing the + * compiler to calculate the worst-case usage and throw an error if the SRAM + * limit is exceeded. + * + * - SDSORT_USES_RAM provides faster sorting via a static directory buffer. + * - SDSORT_USES_STACK does the same, but uses a local stack-based buffer. + * - SDSORT_CACHE_NAMES will retain the sorted file listing in RAM. (Expensive!) + * - SDSORT_DYNAMIC_RAM only uses RAM when the SD menu is visible. (Use with caution!) + */ + //#define SDCARD_SORT_ALPHA + + // SD Card Sorting options + #if ENABLED(SDCARD_SORT_ALPHA) + #define SDSORT_LIMIT 40 // Maximum number of sorted items (10-256). Costs 27 bytes each. + #define FOLDER_SORTING -1 // -1=above 0=none 1=below + #define SDSORT_GCODE false // Allow turning sorting on/off with LCD and M34 g-code. + #define SDSORT_USES_RAM false // Pre-allocate a static array for faster pre-sorting. + #define SDSORT_USES_STACK false // Prefer the stack for pre-sorting to give back some SRAM. (Negated by next 2 options.) + #define SDSORT_CACHE_NAMES false // Keep sorted items in RAM longer for speedy performance. Most expensive option. + #define SDSORT_DYNAMIC_RAM false // Use dynamic allocation (within SD menus). Least expensive option. Set SDSORT_LIMIT before use! + #define SDSORT_CACHE_VFATS 2 // Maximum number of 13-byte VFAT entries to use for sorting. + // Note: Only affects SCROLL_LONG_FILENAMES with SDSORT_CACHE_NAMES but not SDSORT_DYNAMIC_RAM. + #endif + + // This allows hosts to request long names for files and folders with M33 + //#define LONG_FILENAME_HOST_SUPPORT + + // Enable this option to scroll long filenames in the SD card menu + //#define SCROLL_LONG_FILENAMES + + /** + * This option allows you to abort SD printing when any endstop is triggered. + * This feature must be enabled with "M540 S1" or from the LCD menu. + * To have any effect, endstops must be enabled during SD printing. + */ + //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED + + /** + * This option makes it easier to print the same SD Card file again. + * On print completion the LCD Menu will open with the file selected. + * You can just click to start the print, or navigate elsewhere. + */ + //#define SD_REPRINT_LAST_SELECTED_FILE + + /** + * Auto-report SdCard status with M27 S + */ + //#define AUTO_REPORT_SD_STATUS + + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + +#endif // SDSUPPORT + +/** + * Additional options for Graphical Displays + * + * Use the optimizations here to improve printing performance, + * which can be adversely affected by graphical display drawing, + * especially when doing several short moves, and when printing + * on DELTA and SCARA machines. + * + * Some of these options may result in the display lagging behind + * controller events, as there is a trade-off between reliable + * printing performance versus fast display updates. + */ +#if HAS_GRAPHICAL_LCD + // Show SD percentage next to the progress bar + //#define DOGM_SD_PERCENT + + // Enable to save many cycles by drawing a hollow frame on the Info Screen + #define XYZ_HOLLOW_FRAME + + // Enable to save many cycles by drawing a hollow frame on Menu Screens + #define MENU_HOLLOW_FRAME + + // A bigger font is available for edit items. Costs 3120 bytes of PROGMEM. + // Western only. Not available for Cyrillic, Kana, Turkish, Greek, or Chinese. + //#define USE_BIG_EDIT_FONT + + // A smaller font may be used on the Info Screen. Costs 2300 bytes of PROGMEM. + // Western only. Not available for Cyrillic, Kana, Turkish, Greek, or Chinese. + //#define USE_SMALL_INFOFONT + + // Enable this option and reduce the value to optimize screen updates. + // The normal delay is 10µs. Use the lowest value that still gives a reliable display. + //#define DOGM_SPI_DELAY_US 5 + + // Swap the CW/CCW indicators in the graphics overlay + //#define OVERLAY_GFX_REVERSE + + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + * + * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. + * This will prevent position updates from being displayed. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + +#endif // DOGLCD + +// @section safety + +// The hardware watchdog should reset the microcontroller disabling all outputs, +// in case the firmware gets stuck and doesn't do temperature regulation. +#define USE_WATCHDOG + +#if ENABLED(USE_WATCHDOG) + // If you have a watchdog reboot in an ArduinoMega2560 then the device will hang forever, as a watchdog reset will leave the watchdog on. + // The "WATCHDOG_RESET_MANUAL" goes around this by not using the hardware reset. + // However, THIS FEATURE IS UNSAFE!, as it will only work if interrupts are disabled. And the code could hang in an interrupt routine with interrupts disabled. + //#define WATCHDOG_RESET_MANUAL +#endif + +// @section lcd + +/** + * Babystepping enables movement of the axes by tiny increments without changing + * the current position values. This feature is used primarily to adjust the Z + * axis in the first layer of a print in real-time. + * + * Warning: Does not respect endstops! + */ +//#define BABYSTEPPING +#if ENABLED(BABYSTEPPING) + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. + + //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping + #if ENABLED(BABYSTEP_ZPROBE_OFFSET) + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + #endif +#endif + +// @section extruder + +/** + * Linear Pressure Control v1.5 + * + * Assumption: advance [steps] = k * (delta velocity [steps/s]) + * K=0 means advance disabled. + * + * NOTE: K values for LIN_ADVANCE 1.5 differ from earlier versions! + * + * Set K around 0.22 for 3mm PLA Direct Drive with ~6.5cm between the drive gear and heatbreak. + * Larger K values will be needed for flexible filament and greater distances. + * If this algorithm produces a higher speed offset than the extruder can handle (compared to E jerk) + * print acceleration will be reduced during the affected moves to keep within the limit. + * + * See http://marlinfw.org/docs/features/lin_advance.html for full instructions. + * Mention @Sebastianv650 on GitHub to alert the author of any issues. + */ +//#define LIN_ADVANCE +#if ENABLED(LIN_ADVANCE) + #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed + //#define LA_DEBUG // If enabled, this will generate debug information output over USB. +#endif + +// @section leveling + +#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_UBL) + // Override the mesh area if the automatic (max) area is too large + //#define MESH_MIN_X MESH_INSET + //#define MESH_MIN_Y MESH_INSET + //#define MESH_MAX_X X_BED_SIZE - (MESH_INSET) + //#define MESH_MAX_Y Y_BED_SIZE - (MESH_INSET) +#endif + +/** + * Repeatedly attempt G29 leveling until it succeeds. + * Stop after G29_MAX_RETRIES attempts. + */ +//#define G29_RETRY_AND_RECOVER +#if ENABLED(G29_RETRY_AND_RECOVER) + #define G29_MAX_RETRIES 3 + #define G29_HALT_ON_FAILURE + /** + * Specify the GCODE commands that will be executed when leveling succeeds, + * between attempts, and after the maximum number of retries have been tried. + */ + #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." + #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" + #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" + /** + * Specify an action command to send to the host on a recovery attempt or failure. + * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. + * The host must be configured to handle the action command. + */ + #define G29_ACTION_ON_RECOVER "probe_rewipe" + #define G29_ACTION_ON_FAILURE "probe_failed" +#endif + +// @section extras + +// +// G2/G3 Arc Support +// +#define ARC_SUPPORT // Disable this feature to save ~3226 bytes +#if ENABLED(ARC_SUPPORT) + #define MM_PER_ARC_SEGMENT 1 // Length of each arc segment + #define N_ARC_CORRECTION 25 // Number of intertpolated segments between corrections + //#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles + //#define CNC_WORKSPACE_PLANES // Allow G2/G3 to operate in XY, ZX, or YZ planes +#endif + +// Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes. +//#define BEZIER_CURVE_SUPPORT + +// G38.2 and G38.3 Probe Target +// Set MULTIPLE_PROBING if you want G38 to double touch +//#define G38_PROBE_TARGET +#if ENABLED(G38_PROBE_TARGET) + #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move) +#endif + +// Moves (or segments) with fewer steps than this will be joined with the next move +#define MIN_STEPS_PER_SEGMENT 6 + +/** + * Minimum delay after setting the stepper DIR (in ns) + * 0 : No delay (Expect at least 10µS since one Stepper ISR must transpire) + * 20 : Minimum for TMC2xxx drivers + * 200 : Minimum for A4988 drivers + * 400 : Minimum for A5984 drivers + * 500 : Minimum for LV8729 drivers (guess, no info in datasheet) + * 650 : Minimum for DRV8825 drivers + * 1500 : Minimum for TB6600 drivers (guess, no info in datasheet) + * 15000 : Minimum for TB6560 drivers (guess, no info in datasheet) + * + * Override the default value based on the driver type set in Configuration.h. + */ +//#define MINIMUM_STEPPER_DIR_DELAY 650 + +/** + * Minimum stepper driver pulse width (in µs) + * 0 : Smallest possible width the MCU can produce, compatible with TMC2xxx drivers + * 1 : Minimum for A4988, A5984, and LV8729 stepper drivers + * 2 : Minimum for DRV8825 stepper drivers + * 3 : Minimum for TB6600 stepper drivers + * 30 : Minimum for TB6560 stepper drivers + * + * Override the default value based on the driver type set in Configuration.h. + */ +//#define MINIMUM_STEPPER_PULSE 2 + +/** + * Maximum stepping rate (in Hz) the stepper driver allows + * If undefined, defaults to 1MHz / (2 * MINIMUM_STEPPER_PULSE) + * 500000 : Maximum for A4988 stepper driver + * 400000 : Maximum for TMC2xxx stepper drivers + * 250000 : Maximum for DRV8825 stepper driver + * 150000 : Maximum for TB6600 stepper driver + * 130000 : Maximum for LV8729 stepper driver + * 15000 : Maximum for TB6560 stepper driver + * + * Override the default value based on the driver type set in Configuration.h. + */ +//#define MAXIMUM_STEPPER_RATE 250000 + +// @section temperature + +// Control heater 0 and heater 1 in parallel. +//#define HEATERS_PARALLEL + +//=========================================================================== +//================================= Buffers ================================= +//=========================================================================== + +// @section hidden + +// The number of linear motions that can be in the plan at any give time. +// THE BLOCK_BUFFER_SIZE NEEDS TO BE A POWER OF 2 (e.g. 8, 16, 32) because shifts and ors are used to do the ring-buffering. +#if ENABLED(SDSUPPORT) + #define BLOCK_BUFFER_SIZE 16 // SD,LCD,Buttons take more memory, block buffer needs to be smaller +#else + #define BLOCK_BUFFER_SIZE 16 // maximize block buffer +#endif + +// @section serial + +// The ASCII buffer for serial input +#define MAX_CMD_SIZE 96 +#define BUFSIZE 4 + +// Transmission to Host Buffer Size +// To save 386 bytes of PROGMEM (and TX_BUFFER_SIZE+3 bytes of RAM) set to 0. +// To buffer a simple "ok" you need 4 bytes. +// For ADVANCED_OK (M105) you need 32 bytes. +// For debug-echo: 128 bytes for the optimal speed. +// Other output doesn't need to be that speedy. +// :[0, 2, 4, 8, 16, 32, 64, 128, 256] +#define TX_BUFFER_SIZE 0 + +// Host Receive Buffer Size +// Without XON/XOFF flow control (see SERIAL_XON_XOFF below) 32 bytes should be enough. +// To use flow control, set this buffer size to at least 1024 bytes. +// :[0, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048] +//#define RX_BUFFER_SIZE 1024 + +#if RX_BUFFER_SIZE >= 1024 + // Enable to have the controller send XON/XOFF control characters to + // the host to signal the RX buffer is becoming full. + //#define SERIAL_XON_XOFF +#endif + +#if ENABLED(SDSUPPORT) + // Enable this option to collect and display the maximum + // RX queue usage after transferring a file to SD. + //#define SERIAL_STATS_MAX_RX_QUEUED + + // Enable this option to collect and display the number + // of dropped bytes after a file transfer to SD. + //#define SERIAL_STATS_DROPPED_RX +#endif + +// Enable an emergency-command parser to intercept certain commands as they +// enter the serial receive buffer, so they cannot be blocked. +// Currently handles M108, M112, M410 +// Does not work on boards using AT90USB (USBCON) processors! +//#define EMERGENCY_PARSER + +// Bad Serial-connections can miss a received command by sending an 'ok' +// Therefore some clients abort after 30 seconds in a timeout. +// Some other clients start sending commands while receiving a 'wait'. +// This "wait" is only sent when the buffer is empty. 1 second is a good value here. +//#define NO_TIMEOUTS 1000 // Milliseconds + +// Some clients will have this feature soon. This could make the NO_TIMEOUTS unnecessary. +//#define ADVANCED_OK + +// @section extras + +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + +/** + * Firmware-based and LCD-controlled retract + * + * Add G10 / G11 commands for automatic firmware-based retract / recover. + * Use M207 and M208 to define parameters for retract / recover. + * + * Use M209 to enable or disable auto-retract. + * With auto-retract enabled, all G1 E moves within the set range + * will be converted to firmware-based retract/recover moves. + * + * Be sure to turn off auto-retract during filament change. + * + * Note that M207 / M208 / M209 settings are saved to EEPROM. + * + */ +//#define FWRETRACT +#if ENABLED(FWRETRACT) + #define FWRETRACT_AUTORETRACT // costs ~500 bytes of PROGMEM + #if ENABLED(FWRETRACT_AUTORETRACT) + #define MIN_AUTORETRACT 0.1 // When auto-retract is on, convert E moves of this length and over + #define MAX_AUTORETRACT 10.0 // Upper limit for auto-retract conversion + #endif + #define RETRACT_LENGTH 3 // Default retract length (positive mm) + #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change + #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) + #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) + #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) + #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) + #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif +#endif + +/** + * Advanced Pause + * Experimental feature for filament change support and for parking the nozzle when paused. + * Adds the GCode M600 for initiating filament change. + * If PARK_HEAD_ON_PAUSE enabled, adds the GCode M125 to pause printing and park the nozzle. + * + * Requires an LCD display. + * Requires NOZZLE_PARK_FEATURE. + * This feature is required for the default FILAMENT_RUNOUT_SCRIPT. + */ +//#define ADVANCED_PAUSE_FEATURE +#if ENABLED(ADVANCED_PAUSE_FEATURE) + #define PAUSE_PARK_RETRACT_FEEDRATE 60 // (mm/s) Initial retract feedrate. + #define PAUSE_PARK_RETRACT_LENGTH 2 // (mm) Initial retract. + // This short retract is done immediately, before parking the nozzle. + #define FILAMENT_CHANGE_UNLOAD_FEEDRATE 10 // (mm/s) Unload filament feedrate. This can be pretty fast. + #define FILAMENT_CHANGE_UNLOAD_ACCEL 25 // (mm/s^2) Lower acceleration may allow a faster feedrate. + #define FILAMENT_CHANGE_UNLOAD_LENGTH 100 // (mm) The length of filament for a complete unload. + // For Bowden, the full length of the tube and nozzle. + // For direct drive, the full length of the nozzle. + // Set to 0 for manual unloading. + #define FILAMENT_CHANGE_SLOW_LOAD_FEEDRATE 6 // (mm/s) Slow move when starting load. + #define FILAMENT_CHANGE_SLOW_LOAD_LENGTH 0 // (mm) Slow length, to allow time to insert material. + // 0 to disable start loading and skip to fast load only + #define FILAMENT_CHANGE_FAST_LOAD_FEEDRATE 6 // (mm/s) Load filament feedrate. This can be pretty fast. + #define FILAMENT_CHANGE_FAST_LOAD_ACCEL 25 // (mm/s^2) Lower acceleration may allow a faster feedrate. + #define FILAMENT_CHANGE_FAST_LOAD_LENGTH 0 // (mm) Load length of filament, from extruder gear to nozzle. + // For Bowden, the full length of the tube and nozzle. + // For direct drive, the full length of the nozzle. + //#define ADVANCED_PAUSE_CONTINUOUS_PURGE // Purge continuously up to the purge length until interrupted. + #define ADVANCED_PAUSE_PURGE_FEEDRATE 3 // (mm/s) Extrude feedrate (after loading). Should be slower than load feedrate. + #define ADVANCED_PAUSE_PURGE_LENGTH 50 // (mm) Length to extrude after loading. + // Set to 0 for manual extrusion. + // Filament can be extruded repeatedly from the Filament Change menu + // until extrusion is consistent, and to purge old filament. + + // Filament Unload does a Retract, Delay, and Purge first: + #define FILAMENT_UNLOAD_RETRACT_LENGTH 13 // (mm) Unload initial retract length. + #define FILAMENT_UNLOAD_DELAY 5000 // (ms) Delay for the filament to cool after retract. + #define FILAMENT_UNLOAD_PURGE_LENGTH 8 // (mm) An unretract is done, then this length is purged. + + #define PAUSE_PARK_NOZZLE_TIMEOUT 45 // (seconds) Time limit before the nozzle is turned off for safety. + #define FILAMENT_CHANGE_ALERT_BEEPS 10 // Number of alert beeps to play when a response is needed. + #define PAUSE_PARK_NO_STEPPER_TIMEOUT // Enable for XYZ steppers to stay powered on during filament change. + + //#define PARK_HEAD_ON_PAUSE // Park the nozzle during pause and filament change. + //#define HOME_BEFORE_FILAMENT_CHANGE // Ensure homing has been completed prior to parking for filament change + + //#define FILAMENT_LOAD_UNLOAD_GCODES // Add M701/M702 Load/Unload G-codes, plus Load/Unload in the LCD Prepare menu. + //#define FILAMENT_UNLOAD_ALL_EXTRUDERS // Allow M702 to unload all extruders above a minimum target temp (as set by M302) +#endif + +// @section tmc + +/** + * TMC26X Stepper Driver options + * + * The TMC26XStepper library is required for this stepper driver. + * https://github.com/trinamic/TMC26XStepper + */ +#if HAS_DRIVER(TMC26X) + + #define X_MAX_CURRENT 1000 // in mA + #define X_SENSE_RESISTOR 91 // in mOhms + #define X_MICROSTEPS 16 // number of microsteps + + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + + #define E5_MAX_CURRENT 1000 + #define E5_SENSE_RESISTOR 91 + #define E5_MICROSTEPS 16 + +#endif // TMC26X + +// @section tmc_smart + +/** + * To use TMC2130 stepper drivers in SPI mode connect your SPI pins to + * the hardware SPI interface on your board and define the required CS pins + * in your `pins_MYBOARD.h` file. (e.g., RAMPS 1.4 uses AUX3 pins `X_CS_PIN 53`, `Y_CS_PIN 49`, etc.). + * You may also use software SPI if you wish to use general purpose IO pins. + * + * The TMC2130Stepper library is required for this stepper driver. + * https://github.com/teemuatlut/TMC2130Stepper + * + * To use TMC2208 stepper UART-configurable stepper drivers + * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN + * to PDN_UART without a resistor. + * The drivers can also be used with hardware serial. + * + * The TMC2208Stepper library is required for this stepper driver. + * https://github.com/teemuatlut/TMC2208Stepper + */ +#if HAS_TRINAMIC + + #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 + #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current + #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 + + #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. + #define X_MICROSTEPS 16 // 0..256 + + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + + #define E1_CURRENT 800 + #define E1_MICROSTEPS 16 + + #define E2_CURRENT 800 + #define E2_MICROSTEPS 16 + + #define E3_CURRENT 800 + #define E3_MICROSTEPS 16 + + #define E4_CURRENT 800 + #define E4_MICROSTEPS 16 + + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + + /** + * Use software SPI for TMC2130. + * The default SW SPI pins are defined the respective pins files, + * but you can override or define them here. + */ + //#define TMC_USE_SW_SPI + //#define TMC_SW_MOSI -1 + //#define TMC_SW_MISO -1 + //#define TMC_SW_SCK -1 + + /** + * Use Trinamic's ultra quiet stepping mode. + * When disabled, Marlin will use spreadCycle stepping mode. + */ + #define STEALTHCHOP + + /** + * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * like overtemperature and short to ground. TMC2208 requires hardware serial. + * In the case of overtemperature Marlin can decrease the driver current until error condition clears. + * Other detected conditions can be used to stop the current print. + * Relevant g-codes: + * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. + * M911 - Report stepper driver overtemperature pre-warn condition. + * M912 - Clear stepper driver overtemperature pre-warn condition flag. + * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + */ + //#define MONITOR_DRIVER_STATUS + + #if ENABLED(MONITOR_DRIVER_STATUS) + #define CURRENT_STEP_DOWN 50 // [mA] + #define REPORT_CURRENT_CHANGE + #define STOP_ON_ERROR + #endif + + /** + * The driver will switch to spreadCycle when stepper speed is over HYBRID_THRESHOLD. + * This mode allows for faster movements at the expense of higher noise levels. + * STEALTHCHOP needs to be enabled. + * M913 X/Y/Z/E to live tune the setting + */ + //#define HYBRID_THRESHOLD + + #define X_HYBRID_THRESHOLD 100 // [mm/s] + #define X2_HYBRID_THRESHOLD 100 + #define Y_HYBRID_THRESHOLD 100 + #define Y2_HYBRID_THRESHOLD 100 + #define Z_HYBRID_THRESHOLD 3 + #define Z2_HYBRID_THRESHOLD 3 + #define Z3_HYBRID_THRESHOLD 3 + #define E0_HYBRID_THRESHOLD 30 + #define E1_HYBRID_THRESHOLD 30 + #define E2_HYBRID_THRESHOLD 30 + #define E3_HYBRID_THRESHOLD 30 + #define E4_HYBRID_THRESHOLD 30 + #define E5_HYBRID_THRESHOLD 30 + + /** + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. + * X, Y, and Z homing will always be done in spreadCycle mode. + * + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. + * Higher values make the system LESS sensitive. + * Lower value make the system MORE sensitive. + * Too low values can lead to false positives, while too high values will collide the axis without triggering. + * It is advised to set X/Y/Z_HOME_BUMP_MM to 0. + * M914 X/Y/Z to live tune the setting + */ + //#define SENSORLESS_HOMING // TMC2130 only + + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 + #endif + + /** + * Enable M122 debugging command for TMC stepper drivers. + * M122 S0/1 will enable continous reporting. + */ + //#define TMC_DEBUG + + /** + * M915 Z Axis Calibration + * + * - Adjust Z stepper current, + * - Drive the Z axis to its physical maximum, and + * - Home Z to account for the lost steps. + * + * Use M915 Snn to specify the current. + * Use M925 Znn to add extra Z height to Z_MAX_POS. + */ + //#define TMC_Z_CALIBRATION + #if ENABLED(TMC_Z_CALIBRATION) + #define CALIBRATION_CURRENT 250 + #define CALIBRATION_EXTRA_HEIGHT 10 + #endif + + /** + * You can set your own advanced settings by filling in predefined functions. + * A list of available functions can be found on the library github page + * https://github.com/teemuatlut/TMC2130Stepper + * https://github.com/teemuatlut/TMC2208Stepper + * + * Example: + * #define TMC_ADV() { \ + * stepperX.diag0_temp_prewarn(1); \ + * stepperY.interpolate(0); \ + * } + */ + #define TMC_ADV() { } + +#endif // HAS_TRINAMIC + +// @section L6470 + +/** + * L6470 Stepper Driver options + * + * The Arduino-L6470 library is required for this stepper driver. + * https://github.com/ameyer/Arduino-L6470 + */ +#if HAS_DRIVER(L6470) + + #define X_MICROSTEPS 16 // number of microsteps + #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off + #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + + #define X2_MICROSTEPS 16 + #define X2_OVERCURRENT 2000 + #define X2_STALLCURRENT 1500 + + #define Y_MICROSTEPS 16 + #define Y_OVERCURRENT 2000 + #define Y_STALLCURRENT 1500 + + #define Y2_MICROSTEPS 16 + #define Y2_OVERCURRENT 2000 + #define Y2_STALLCURRENT 1500 + + #define Z_MICROSTEPS 16 + #define Z_OVERCURRENT 2000 + #define Z_STALLCURRENT 1500 + + #define Z2_MICROSTEPS 16 + #define Z2_OVERCURRENT 2000 + #define Z2_STALLCURRENT 1500 + + #define Z3_MICROSTEPS 16 + #define Z3_OVERCURRENT 2000 + #define Z3_STALLCURRENT 1500 + + #define E0_MICROSTEPS 16 + #define E0_OVERCURRENT 2000 + #define E0_STALLCURRENT 1500 + + #define E1_MICROSTEPS 16 + #define E1_OVERCURRENT 2000 + #define E1_STALLCURRENT 1500 + + #define E2_MICROSTEPS 16 + #define E2_OVERCURRENT 2000 + #define E2_STALLCURRENT 1500 + + #define E3_MICROSTEPS 16 + #define E3_OVERCURRENT 2000 + #define E3_STALLCURRENT 1500 + + #define E4_MICROSTEPS 16 + #define E4_OVERCURRENT 2000 + #define E4_STALLCURRENT 1500 + + #define E5_MICROSTEPS 16 + #define E5_OVERCURRENT 2000 + #define E5_STALLCURRENT 1500 + +#endif // L6470 + +/** + * TWI/I2C BUS + * + * This feature is an EXPERIMENTAL feature so it shall not be used on production + * machines. Enabling this will allow you to send and receive I2C data from slave + * devices on the bus. + * + * ; Example #1 + * ; This macro send the string "Marlin" to the slave device with address 0x63 (99) + * ; It uses multiple M260 commands with one B arg + * M260 A99 ; Target slave address + * M260 B77 ; M + * M260 B97 ; a + * M260 B114 ; r + * M260 B108 ; l + * M260 B105 ; i + * M260 B110 ; n + * M260 S1 ; Send the current buffer + * + * ; Example #2 + * ; Request 6 bytes from slave device with address 0x63 (99) + * M261 A99 B5 + * + * ; Example #3 + * ; Example serial output of a M261 request + * echo:i2c-reply: from:99 bytes:5 data:hello + */ + +// @section i2cbus + +//#define EXPERIMENTAL_I2CBUS +#define I2C_SLAVE_ADDRESS 0 // Set a value from 8 to 127 to act as a slave + +// @section extras + +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + +/** + * Spindle & Laser control + * + * Add the M3, M4, and M5 commands to turn the spindle/laser on and off, and + * to set spindle speed, spindle direction, and laser power. + * + * SuperPid is a router/spindle speed controller used in the CNC milling community. + * Marlin can be used to turn the spindle on and off. It can also be used to set + * the spindle speed from 5,000 to 30,000 RPM. + * + * You'll need to select a pin for the ON/OFF function and optionally choose a 0-5V + * hardware PWM pin for the speed control and a pin for the rotation direction. + * + * See http://marlinfw.org/docs/configuration/laser_spindle.html for more config details. + */ +//#define SPINDLE_LASER_ENABLE +#if ENABLED(SPINDLE_LASER_ENABLE) + + #define SPINDLE_LASER_ENABLE_INVERT false // set to "true" if the on/off function is reversed + #define SPINDLE_LASER_PWM true // set to true if your controller supports setting the speed/power + #define SPINDLE_LASER_PWM_INVERT true // set to "true" if the speed/power goes up when you want it to go slower + #define SPINDLE_LASER_POWERUP_DELAY 5000 // delay in milliseconds to allow the spindle/laser to come up to speed/power + #define SPINDLE_LASER_POWERDOWN_DELAY 5000 // delay in milliseconds to allow the spindle to stop + #define SPINDLE_DIR_CHANGE true // set to true if your spindle controller supports changing spindle direction + #define SPINDLE_INVERT_DIR false + #define SPINDLE_STOP_ON_DIR_CHANGE true // set to true if Marlin should stop the spindle before changing rotation direction + + /** + * The M3 & M4 commands use the following equation to convert PWM duty cycle to speed/power + * + * SPEED/POWER = PWM duty cycle * SPEED_POWER_SLOPE + SPEED_POWER_INTERCEPT + * where PWM duty cycle varies from 0 to 255 + * + * set the following for your controller (ALL MUST BE SET) + */ + + #define SPEED_POWER_SLOPE 118.4 + #define SPEED_POWER_INTERCEPT 0 + #define SPEED_POWER_MIN 5000 + #define SPEED_POWER_MAX 30000 // SuperPID router controller 0 - 30,000 RPM + + //#define SPEED_POWER_SLOPE 0.3922 + //#define SPEED_POWER_INTERCEPT 0 + //#define SPEED_POWER_MIN 10 + //#define SPEED_POWER_MAX 100 // 0-100% +#endif + +/** + * Filament Width Sensor + * + * Measures the filament width in real-time and adjusts + * flow rate to compensate for any irregularities. + * + * Also allows the measured filament diameter to set the + * extrusion rate, so the slicer only has to specify the + * volume. + * + * Only a single extruder is supported at this time. + * + * 34 RAMPS_14 : Analog input 5 on the AUX2 connector + * 81 PRINTRBOARD : Analog input 2 on the Exp1 connector (version B,C,D,E) + * 301 RAMBO : Analog input 3 + * + * Note: May require analog pins to be defined for other boards. + */ +//#define FILAMENT_WIDTH_SENSOR + +#if ENABLED(FILAMENT_WIDTH_SENSOR) + #define FILAMENT_SENSOR_EXTRUDER_NUM 0 // Index of the extruder that has the filament sensor. :[0,1,2,3,4] + #define MEASUREMENT_DELAY_CM 14 // (cm) The distance from the filament sensor to the melting chamber + + #define FILWIDTH_ERROR_MARGIN 1.0 // (mm) If a measurement differs too much from nominal width ignore it + #define MAX_MEASUREMENT_DELAY 20 // (bytes) Buffer size for stored measurements (1 byte per cm). Must be larger than MEASUREMENT_DELAY_CM. + + #define DEFAULT_MEASURED_FILAMENT_DIA DEFAULT_NOMINAL_FILAMENT_DIA // Set measured to nominal initially + + // Display filament width on the LCD status line. Status messages will expire after 5 seconds. + //#define FILAMENT_LCD_DISPLAY +#endif + +/** + * CNC Coordinate Systems + * + * Enables G53 and G54-G59.3 commands to select coordinate systems + * and G92.1 to reset the workspace to native machine space. + */ +//#define CNC_COORDINATE_SYSTEMS + +/** + * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins + */ +//#define PINS_DEBUGGING + +/** + * Auto-report temperatures with M155 S + */ +#define AUTO_REPORT_TEMPERATURES + +/** + * Include capabilities in M115 output + */ +#define EXTENDED_CAPABILITIES_REPORT + +/** + * Disable all Volumetric extrusion options + */ +//#define NO_VOLUMETRICS + +#if DISABLED(NO_VOLUMETRICS) + /** + * Volumetric extrusion default state + * Activate to make volumetric extrusion the default method, + * with DEFAULT_NOMINAL_FILAMENT_DIA as the default diameter. + * + * M200 D0 to disable, M200 Dn to set a new diameter. + */ + //#define VOLUMETRIC_DEFAULT_ON +#endif + +/** + * Enable this option for a leaner build of Marlin that removes all + * workspace offsets, simplifying coordinate transformations, leveling, etc. + * + * - M206 and M428 are disabled. + * - G92 will revert to its behavior from Marlin 1.0. + */ +//#define NO_WORKSPACE_OFFSETS + +/** + * Set the number of proportional font spaces required to fill up a typical character space. + * This can help to better align the output of commands like `G29 O` Mesh Output. + * + * For clients that use a fixed-width font (like OctoPrint), leave this set to 1.0. + * Otherwise, adjust according to your client and font. + */ +#define PROPORTIONAL_FONT_RATIO 1.0 + +/** + * Spend 28 bytes of SRAM to optimize the GCode parser + */ +#define FASTER_GCODE_PARSER + +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + +/** + * User-defined menu items that execute custom GCode + */ +//#define CUSTOM_USER_MENUS +#if ENABLED(CUSTOM_USER_MENUS) + //#define CUSTOM_USER_MENU_TITLE "Custom Commands" + #define USER_SCRIPT_DONE "M117 User Script Done" + #define USER_SCRIPT_AUDIBLE_FEEDBACK + //#define USER_SCRIPT_RETURN // Return to status screen after a script + + #define USER_DESC_1 "Home & UBL Info" + #define USER_GCODE_1 "G28\nG29 W" + + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL + #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) + + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL + #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) + + #define USER_DESC_4 "Heat Bed/Home/Level" + #define USER_GCODE_4 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nG28\nG29" + + #define USER_DESC_5 "Home & Info" + #define USER_GCODE_5 "G28\nM503" +#endif + +/** + * Specify an action command to send to the host when the printer is killed. + * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. + * The host must be configured to handle the action command. + */ +//#define ACTION_ON_KILL "poweroff" + +/** + * Specify an action command to send to the host on pause and resume. + * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. + * The host must be configured to handle the action command. + */ +//#define ACTION_ON_PAUSE "pause" +//#define ACTION_ON_RESUME "resume" + +//=========================================================================== +//====================== I2C Position Encoder Settings ====================== +//=========================================================================== + +/** + * I2C position encoders for closed loop control. + * Developed by Chris Barr at Aus3D. + * + * Wiki: http://wiki.aus3d.com.au/Magnetic_Encoder + * Github: https://github.com/Aus3D/MagneticEncoder + * + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ + * + * Reilabuild encoders have been modified to improve reliability. + */ + +//#define I2C_POSITION_ENCODERS +#if ENABLED(I2C_POSITION_ENCODERS) + + #define I2CPE_ENCODER_CNT 1 // The number of encoders installed; max of 5 + // encoders supported currently. + + #define I2CPE_ENC_1_ADDR I2CPE_PRESET_ADDR_X // I2C address of the encoder. 30-200. + #define I2CPE_ENC_1_AXIS X_AXIS // Axis the encoder module is installed on. _AXIS. + #define I2CPE_ENC_1_TYPE I2CPE_ENC_TYPE_LINEAR // Type of encoder: I2CPE_ENC_TYPE_LINEAR -or- + // I2CPE_ENC_TYPE_ROTARY. + #define I2CPE_ENC_1_TICKS_UNIT 2048 // 1024 for magnetic strips with 2mm poles; 2048 for + // 1mm poles. For linear encoders this is ticks / mm, + // for rotary encoders this is ticks / revolution. + //#define I2CPE_ENC_1_TICKS_REV (16 * 200) // Only needed for rotary encoders; number of stepper + // steps per full revolution (motor steps/rev * microstepping) + //#define I2CPE_ENC_1_INVERT // Invert the direction of axis travel. + #define I2CPE_ENC_1_EC_METHOD I2CPE_ECM_MICROSTEP // Type of error error correction. + #define I2CPE_ENC_1_EC_THRESH 0.10 // Threshold size for error (in mm) above which the + // printer will attempt to correct the error; errors + // smaller than this are ignored to minimize effects of + // measurement noise / latency (filter). + + #define I2CPE_ENC_2_ADDR I2CPE_PRESET_ADDR_Y // Same as above, but for encoder 2. + #define I2CPE_ENC_2_AXIS Y_AXIS + #define I2CPE_ENC_2_TYPE I2CPE_ENC_TYPE_LINEAR + #define I2CPE_ENC_2_TICKS_UNIT 2048 + //#define I2CPE_ENC_2_TICKS_REV (16 * 200) + //#define I2CPE_ENC_2_INVERT + #define I2CPE_ENC_2_EC_METHOD I2CPE_ECM_MICROSTEP + #define I2CPE_ENC_2_EC_THRESH 0.10 + + #define I2CPE_ENC_3_ADDR I2CPE_PRESET_ADDR_Z // Encoder 3. Add additional configuration options + #define I2CPE_ENC_3_AXIS Z_AXIS // as above, or use defaults below. + + #define I2CPE_ENC_4_ADDR I2CPE_PRESET_ADDR_E // Encoder 4. + #define I2CPE_ENC_4_AXIS E_AXIS + + #define I2CPE_ENC_5_ADDR 34 // Encoder 5. + #define I2CPE_ENC_5_AXIS E_AXIS + + // Default settings for encoders which are enabled, but without settings configured above. + #define I2CPE_DEF_TYPE I2CPE_ENC_TYPE_LINEAR + #define I2CPE_DEF_ENC_TICKS_UNIT 2048 + #define I2CPE_DEF_TICKS_REV (16 * 200) + #define I2CPE_DEF_EC_METHOD I2CPE_ECM_NONE + #define I2CPE_DEF_EC_THRESH 0.1 + + //#define I2CPE_ERR_THRESH_ABORT 100.0 // Threshold size for error (in mm) error on any given + // axis after which the printer will abort. Comment out to + // disable abort behaviour. + + #define I2CPE_TIME_TRUSTED 10000 // After an encoder fault, there must be no further fault + // for this amount of time (in ms) before the encoder + // is trusted again. + + /** + * Position is checked every time a new command is executed from the buffer but during long moves, + * this setting determines the minimum update time between checks. A value of 100 works well with + * error rolling average when attempting to correct only for skips and not for vibration. + */ + #define I2CPE_MIN_UPD_TIME_MS 4 // (ms) Minimum time between encoder checks. + + // Use a rolling average to identify persistant errors that indicate skips, as opposed to vibration and noise. + #define I2CPE_ERR_ROLLING_AVERAGE + +#endif // I2C_POSITION_ENCODERS + +/** + * MAX7219 Debug Matrix + * + * Add support for a low-cost 8x8 LED Matrix based on the Max7219 chip as a realtime status display. + * Requires 3 signal wires. Some useful debug options are included to demonstrate its usage. + */ +//#define MAX7219_DEBUG +#if ENABLED(MAX7219_DEBUG) + #define MAX7219_CLK_PIN 64 + #define MAX7219_DIN_PIN 57 + #define MAX7219_LOAD_PIN 44 + + //#define MAX7219_GCODE // Add the M7219 G-code to control the LED matrix + #define MAX7219_INIT_TEST 2 // Do a test pattern at initialization (Set to 2 for spiral) + #define MAX7219_NUMBER_UNITS 1 // Number of Max7219 units in chain. + #define MAX7219_ROTATE 0 // Rotate the display clockwise (in multiples of +/- 90°) + // connector at: right=0 bottom=-90 top=90 left=180 + //#define MAX7219_REVERSE_ORDER // The individual LED matrix units may be in reversed order + + /** + * Sample debug features + * If you add more debug displays, be careful to avoid conflicts! + */ + #define MAX7219_DEBUG_PRINTER_ALIVE // Blink corner LED of 8x8 matrix to show that the firmware is functioning + #define MAX7219_DEBUG_PLANNER_HEAD 3 // Show the planner queue head position on this and the next LED matrix row + #define MAX7219_DEBUG_PLANNER_TAIL 5 // Show the planner queue tail position on this and the next LED matrix row + + #define MAX7219_DEBUG_PLANNER_QUEUE 0 // Show the current planner queue depth on this and the next LED matrix row + // If you experience stuttering, reboots, etc. this option can reveal how + // tweaks made to the configuration are affecting the printer in real-time. +#endif + +/** + * NanoDLP Sync support + * + * Add support for Synchronized Z moves when using with NanoDLP. G0/G1 axis moves will output "Z_move_comp" + * string to enable synchronization with DLP projector exposure. This change will allow to use + * [[WaitForDoneMessage]] instead of populating your gcode with M400 commands + */ +//#define NANODLP_Z_SYNC +#if ENABLED(NANODLP_Z_SYNC) + //#define NANODLP_ALL_AXIS // Enables "Z_move_comp" output on any axis move. + // Default behaviour is limited to Z axis only. +#endif + +/** + * WiFi Support (Espressif ESP32 WiFi) + */ +//#define WIFISUPPORT +#if ENABLED(WIFISUPPORT) + #define WIFI_SSID "Wifi SSID" + #define WIFI_PWD "Wifi Password" +#endif + +// Enable Marlin dev mode which adds some special commands +//#define MARLIN_DEV_MODE diff --git a/Marlin/src/config/examples/delta/Hatchbox_Alpha/Configuration.h b/Marlin/src/config/examples/delta/Hatchbox_Alpha/Configuration.h index 01bf4386f8..996bb58b08 100644 --- a/Marlin/src/config/examples/delta/Hatchbox_Alpha/Configuration.h +++ b/Marlin/src/config/examples/delta/Hatchbox_Alpha/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration for Hatchbox Alpha with E3D v6 extruder @@ -40,8 +41,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -208,7 +207,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -225,7 +224,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -567,16 +565,16 @@ #if ENABLED(DELTA_AUTO_CALIBRATION) || ENABLED(DELTA_CALIBRATION_MENU) // Set the radius for the calibration probe points - max DELTA_PRINTABLE_RADIUS for non-eccentric probes - #define DELTA_CALIBRATION_RADIUS 121.5 // mm + #define DELTA_CALIBRATION_RADIUS 121.5 // (mm) // Set the steprate for papertest probing - #define PROBE_MANUALLY_STEP 0.05 // mm + #define PROBE_MANUALLY_STEP 0.05 // (mm) #endif // Print surface diameter/2 minus unreachable space (avoid collisions with vertical towers). - #define DELTA_PRINTABLE_RADIUS 151.0 // mm + #define DELTA_PRINTABLE_RADIUS 151.0 // (mm) // Center-to-center distance of the holes in the diagonal push rods. - #define DELTA_DIAGONAL_ROD 356.5 // mm + #define DELTA_DIAGONAL_ROD 356.5 // (mm) // height from z=0 to home position #define DELTA_HEIGHT 352.00 // get this value from auto calibrate @@ -859,6 +857,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + /** * Allen key retractable z-probe as seen on many Kossel delta printers - http://reprap.org/wiki/Kossel#Automatic_bed_leveling_probe * Deploys by touching z-axis belt. Retracts by pushing the probe down. Uses Z_MIN_PIN. @@ -988,7 +993,8 @@ #if ENABLED(PROBING_HEATERS_OFF) //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif -#define PROBING_FANS_OFF // Turn fans off when probing +#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -1009,13 +1015,13 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine // Invert the stepper direction. Change (or reverse the motor connector) if an axis goes the wrong way. -#define INVERT_X_DIR false // DELTA does not invert +#define INVERT_X_DIR false #define INVERT_Y_DIR false #define INVERT_Z_DIR false @@ -1035,7 +1041,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -1102,6 +1108,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1272,8 +1290,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1427,10 +1446,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 210 #define PREHEAT_1_TEMP_BED 60 #define PREHEAT_1_FAN_SPEED 255 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 230 #define PREHEAT_2_TEMP_BED 105 #define PREHEAT_2_FAN_SPEED 255 // Value from 0 to 255 @@ -1559,10 +1580,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1590,6 +1611,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1954,6 +1982,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -2110,5 +2147,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/delta/Tevo Little Monster/Configuration.h b/Marlin/src/config/examples/delta/Tevo Little Monster/Configuration.h new file mode 100644 index 0000000000..c65ededaa5 --- /dev/null +++ b/Marlin/src/config/examples/delta/Tevo Little Monster/Configuration.h @@ -0,0 +1,2138 @@ +/** + * 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 . + * + */ +#pragma once + +/** + * Configuration.h + * + * Basic settings such as: + * + * - Type of electronics + * - Type of temperature sensor + * - Printer geometry + * - Endstop configuration + * - LCD controller + * - Extra features + * + * Advanced settings can be found in Configuration_adv.h + * + */ +#define CONFIGURATION_H_VERSION 020000 + +//=========================================================================== +//============================= Getting Started ============================= +//=========================================================================== + +/** + * Here are some standard links for getting your machine calibrated: + * + * http://reprap.org/wiki/Calibration + * http://youtu.be/wAL9d7FgInk + * http://calculator.josefprusa.cz + * http://reprap.org/wiki/Triffid_Hunter%27s_Calibration_Guide + * http://www.thingiverse.com/thing:5573 + * https://sites.google.com/site/repraplogphase/calibration-of-your-reprap + * http://www.thingiverse.com/thing:298812 + */ + +//=========================================================================== +//============================= DELTA Printer =============================== +//=========================================================================== +// For a Delta printer start with one of the configuration files in the +// config/examples/delta directory and customize for your machine. +// + +//=========================================================================== +//============================= SCARA Printer =============================== +//=========================================================================== +// For a SCARA printer start with the configuration files in +// config/examples/SCARA and customize for your machine. +// + +// @section info + +// User-specified version info of this build to display in [Pronterface, etc] terminal window during +// startup. Implementation of an idea by Prof Braino to inform user that any changes made to this +// build by the user have been successfully uploaded into firmware. +#define STRING_CONFIG_H_AUTHOR "(HEINRICHS)" // Who made the changes. +#define SHOW_BOOTSCREEN +#define STRING_SPLASH_LINE1 SHORT_BUILD_VERSION // will be shown during bootup in line 1 +#define STRING_SPLASH_LINE2 WEBSITE_URL // will be shown during bootup in line 2 + +/** + * *** VENDORS PLEASE READ *** + * + * Marlin allows you to add a custom boot image for Graphical LCDs. + * With this option Marlin will first show your custom screen followed + * by the standard Marlin logo with version number and web URL. + * + * We encourage you to take advantage of this new feature and we also + * respectfully request that you retain the unmodified Marlin boot screen. + */ + +// Enable to show the bitmap in Marlin/_Bootscreen.h on startup. +//#define SHOW_CUSTOM_BOOTSCREEN + +// Enable to show the bitmap in Marlin/_Statusscreen.h on the status screen. +//#define CUSTOM_STATUS_SCREEN_IMAGE + +// @section machine + +/** + * Select the serial port on the board to use for communication with the host. + * This allows the connection of wireless adapters (for instance) to non-default port pins. + * Note: The first serial port (-1 or 0) will always be used by the Arduino bootloader. + * + * :[-1, 0, 1, 2, 3, 4, 5, 6, 7] + */ +#define SERIAL_PORT 0 + +/** + * Select a secondary serial port on the board to use for communication with the host. + * This allows the connection of wireless adapters (for instance) to non-default port pins. + * Serial port -1 is the USB emulated serial port, if available. + * + * :[-1, 0, 1, 2, 3, 4, 5, 6, 7] + */ +#define SERIAL_PORT_2 1 + +/** + * This setting determines the communication speed of the printer. + * + * 250000 works in most cases, but you might try a lower speed if + * you commonly experience drop-outs during host printing. + * You may try up to 1000000 to speed up SD file transfer. + * + * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000] + */ +#define BAUDRATE 115200 + +// Enable the Bluetooth serial interface on AT90USB devices +//#define BLUETOOTH + +// The following define selects which electronics board you have. +// Please choose the name from boards.h that matches your setup +#ifndef MOTHERBOARD + #define MOTHERBOARD BOARD_MKS_GEN_L +#endif + +// Optional custom name for your RepStrap or other custom machine +// Displayed in the LCD "Ready" message +#define CUSTOM_MACHINE_NAME "TEVO Little Monster" + +// Define this to set a unique identifier for this printer, (Used by some programs to differentiate between machines) +// You can use an online service to generate a random UUID. (eg http://www.uuidgenerator.net/version4) +//#define MACHINE_UUID "00000000-0000-0000-0000-000000000000" + +// @section extruder + +// This defines the number of extruders +// :[1, 2, 3, 4, 5, 6] +#define EXTRUDERS 1 + +// Generally expected filament diameter (1.75, 2.85, 3.0, ...). Used for Volumetric, Filament Width Sensor, etc. +#define DEFAULT_NOMINAL_FILAMENT_DIA 1.75 + +// For Cyclops or any "multi-extruder" that shares a single nozzle. +//#define SINGLENOZZLE + +/** + * Průša MK2 Single Nozzle Multi-Material Multiplexer, and variants. + * + * This device allows one stepper driver on a control board to drive + * two to eight stepper motors, one at a time, in a manner suitable + * for extruders. + * + * This option only allows the multiplexer to switch on tool-change. + * Additional options to configure custom E moves are pending. + */ +//#define MK2_MULTIPLEXER +#if ENABLED(MK2_MULTIPLEXER) + // Override the default DIO selector pins here, if needed. + // Some pins files may provide defaults for these pins. + //#define E_MUX0_PIN 40 // Always Required + //#define E_MUX1_PIN 42 // Needed for 3 to 8 inputs + //#define E_MUX2_PIN 44 // Needed for 5 to 8 inputs +#endif + +// A dual extruder that uses a single stepper motor +//#define SWITCHING_EXTRUDER +#if ENABLED(SWITCHING_EXTRUDER) + #define SWITCHING_EXTRUDER_SERVO_NR 0 + #define SWITCHING_EXTRUDER_SERVO_ANGLES { 0, 90 } // Angles for E0, E1[, E2, E3] + #if EXTRUDERS > 3 + #define SWITCHING_EXTRUDER_E23_SERVO_NR 1 + #endif +#endif + +// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +//#define SWITCHING_NOZZLE +#if ENABLED(SWITCHING_NOZZLE) + #define SWITCHING_NOZZLE_SERVO_NR 0 + #define SWITCHING_NOZZLE_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 +#endif + +/** + * Two separate X-carriages with extruders that connect to a moving part + * via a magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + */ +//#define PARKING_EXTRUDER +#if ENABLED(PARKING_EXTRUDER) + #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage + #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil + #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders + #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 +#endif + +/** + * Switching Toolhead + * + * Support for swappable and dockable toolheads, such as + * the E3D Tool Changer. Toolheads are locked with a servo. + */ +//#define SWITCHING_TOOLHEAD +#if ENABLED(SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_SERVO_NR 2 // Index of the servo connector + #define SWITCHING_TOOLHEAD_SERVO_ANGLES { 0, 180 } // (degrees) Angles for Lock, Unlock + #define SWITCHING_TOOLHEAD_Y_POS 235 // (mm) Y position of the toolhead dock + #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis + #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders +#endif + +/** + * "Mixing Extruder" + * - Adds G-codes M163 and M164 to set and "commit" the current mix factors. + * - Extends the stepping routines to move multiple steppers in proportion to the mix. + * - Optional support for Repetier Firmware's 'M164 S' supporting virtual tools. + * - This implementation supports up to two mixing extruders. + * - Enable DIRECT_MIXING_IN_G1 for M165 and mixing in G1 (from Pia Taubert's reference implementation). + */ +//#define MIXING_EXTRUDER +#if ENABLED(MIXING_EXTRUDER) + #define MIXING_STEPPERS 2 // Number of steppers in your mixing extruder + #define MIXING_VIRTUAL_TOOLS 16 // Use the Virtual Tool method with M163 and M164 + //#define DIRECT_MIXING_IN_G1 // Allow ABCDHI mix factors in G1 movement commands +#endif + +// Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing). +// The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder). +// For the other hotends it is their distance from the extruder 0 hotend. +//#define HOTEND_OFFSET_X {0.0, 20.00} // (mm) relative X-offset for each nozzle +//#define HOTEND_OFFSET_Y {0.0, 5.00} // (mm) relative Y-offset for each nozzle +//#define HOTEND_OFFSET_Z {0.0, 0.00} // (mm) relative Z-offset for each nozzle + +// @section machine + +/** + * Select your power supply here. Use 0 if you haven't connected the PS_ON_PIN + * + * 0 = No Power Switch + * 1 = ATX + * 2 = X-Box 360 203Watts (the blue wire connected to PS_ON and the red wire to VCC) + * + * :{ 0:'No power switch', 1:'ATX', 2:'X-Box 360' } + */ +#define POWER_SUPPLY 0 + +#if POWER_SUPPLY > 0 + // Enable this option to leave the PSU off at startup. + // Power to steppers and heaters will need to be turned on with M80. + //#define PS_DEFAULT_OFF + + //#define AUTO_POWER_CONTROL // Enable automatic control of the PS_ON pin + #if ENABLED(AUTO_POWER_CONTROL) + #define AUTO_POWER_FANS // Turn on PSU if fans need power + #define AUTO_POWER_E_FANS + #define AUTO_POWER_CONTROLLERFAN + #define POWER_TIMEOUT 30 + #endif + +#endif + +// @section temperature + +//=========================================================================== +//============================= Thermal Settings ============================ +//=========================================================================== + +/** + * --NORMAL IS 4.7kohm PULLUP!-- 1kohm pullup can be used on hotend sensor, using correct resistor and table + * + * Temperature sensors available: + * + * -4 : thermocouple with AD8495 + * -3 : thermocouple with MAX31855 (only for sensor 0) + * -2 : thermocouple with MAX6675 (only for sensor 0) + * -1 : thermocouple with AD595 + * 0 : not used + * 1 : 100k thermistor - best choice for EPCOS 100k (4.7k pullup) + * 2 : 200k thermistor - ATC Semitec 204GT-2 (4.7k pullup) + * 3 : Mendel-parts thermistor (4.7k pullup) + * 4 : 10k thermistor !! do not use it for a hotend. It gives bad resolution at high temp. !! + * 5 : 100K thermistor - ATC Semitec 104GT-2/104NT-4-R025H42G (Used in ParCan & J-Head) (4.7k pullup) + * 501 : 100K Zonestar (Tronxy X3A) Thermistor + * 6 : 100k EPCOS - Not as accurate as table 1 (created using a fluke thermocouple) (4.7k pullup) + * 7 : 100k Honeywell thermistor 135-104LAG-J01 (4.7k pullup) + * 71 : 100k Honeywell thermistor 135-104LAF-J01 (4.7k pullup) + * 8 : 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) + * 9 : 100k GE Sensing AL03006-58.2K-97-G1 (4.7k pullup) + * 10 : 100k RS thermistor 198-961 (4.7k pullup) + * 11 : 100k beta 3950 1% thermistor (4.7k pullup) + * 12 : 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed) + * 13 : 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE" + * 15 : 100k thermistor calibration for JGAurora A5 hotend + * 20 : the PT100 circuit found in the Ultimainboard V2.x + * 60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950 + * 66 : 4.7M High Temperature thermistor from Dyze Design + * 70 : the 100K thermistor found in the bq Hephestos 2 + * 75 : 100k Generic Silicon Heat Pad with NTC 100K MGB18-104F39050L32 thermistor + * + * 1k ohm pullup tables - This is atypical, and requires changing out the 4.7k pullup for 1k. + * (but gives greater accuracy and more stable PID) + * 51 : 100k thermistor - EPCOS (1k pullup) + * 52 : 200k thermistor - ATC Semitec 204GT-2 (1k pullup) + * 55 : 100k thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (1k pullup) + * + * 1047 : Pt1000 with 4k7 pullup + * 1010 : Pt1000 with 1k pullup (non standard) + * 147 : Pt100 with 4k7 pullup + * 110 : Pt100 with 1k pullup (non standard) + * + * Use these for Testing or Development purposes. NEVER for production machine. + * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. + * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. + * + * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + */ +#define TEMP_SENSOR_0 1 +#define TEMP_SENSOR_1 0 +#define TEMP_SENSOR_2 0 +#define TEMP_SENSOR_3 0 +#define TEMP_SENSOR_4 0 +#define TEMP_SENSOR_5 0 +#define TEMP_SENSOR_BED 1 +#define TEMP_SENSOR_CHAMBER 0 + +// Dummy thermistor constant temperature readings, for use with 998 and 999 +#define DUMMY_THERMISTOR_998_VALUE 25 +#define DUMMY_THERMISTOR_999_VALUE 100 + +// Use temp sensor 1 as a redundant sensor with sensor 0. If the readings +// from the two sensors differ too much the print will be aborted. +//#define TEMP_SENSOR_1_AS_REDUNDANT +#define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 + +// Extruder temperature must be close to target for this long before M109 returns success +#define TEMP_RESIDENCY_TIME 10 // (seconds) +#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one +#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. + +// Bed temperature must be close to target for this long before M190 returns success +#define TEMP_BED_RESIDENCY_TIME 1 // (seconds) +#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one +#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. + +// The minimal temperature defines the temperature below which the heater will not be enabled It is used +// to check that the wiring to the thermistor is not broken. +// Otherwise this would lead to the heater being powered on all the time. +#define HEATER_0_MINTEMP 5 +#define HEATER_1_MINTEMP 5 +#define HEATER_2_MINTEMP 5 +#define HEATER_3_MINTEMP 5 +#define HEATER_4_MINTEMP 5 +#define HEATER_5_MINTEMP 5 +#define BED_MINTEMP 5 + +// When temperature exceeds max temp, your heater will be switched off. +// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! +// You should use MINTEMP for thermistor short/failure protection. +#define HEATER_0_MAXTEMP 275 +#define HEATER_1_MAXTEMP 275 +#define HEATER_2_MAXTEMP 275 +#define HEATER_3_MAXTEMP 275 +#define HEATER_4_MAXTEMP 275 +#define HEATER_5_MAXTEMP 275 +#define BED_MAXTEMP 150 + +//=========================================================================== +//============================= PID Settings ================================ +//=========================================================================== +// PID Tuning Guide here: http://reprap.org/wiki/PID_Tuning + +// Comment the following line to disable PID and enable bang-bang. +#define PIDTEMP +#define BANG_MAX 255 // Limits current to nozzle while in bang-bang mode; 255=full current +#define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current +#define PID_K1 0.95 // Smoothing factor within any PID loop +#if ENABLED(PIDTEMP) + #define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. + //#define PID_DEBUG // Sends debug data to the serial port. + //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX + //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders) + // Set/get with gcode: M301 E[extruder number, 0-2] + #define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature + // is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max. + + // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it + + // Ultimaker + //#define DEFAULT_Kp 22.2 + //#define DEFAULT_Ki 1.08 + //#define DEFAULT_Kd 114 + + // MakerGear + //#define DEFAULT_Kp 7.0 + //#define DEFAULT_Ki 0.1 + //#define DEFAULT_Kd 12 + + // Mendel Parts V9 on 12V + //#define DEFAULT_Kp 63.0 + //#define DEFAULT_Ki 2.25 + //#define DEFAULT_Kd 440 + + //E3D with 30MM fan + #define DEFAULT_Kp 41.09 + #define DEFAULT_Ki 7.60 + #define DEFAULT_Kd 55.54 +#endif // PIDTEMP + +//=========================================================================== +//============================= PID > Bed Temperature Control =============== +//=========================================================================== + +/** + * PID Bed Heating + * + * If this option is enabled set PID constants below. + * If this option is disabled, bang-bang will be used and BED_LIMIT_SWITCHING will enable hysteresis. + * + * The PID frequency will be the same as the extruder PWM. + * If PID_dT is the default, and correct for the hardware/configuration, that means 7.689Hz, + * which is fine for driving a square wave into a resistive load and does not significantly + * impact FET heating. This also works fine on a Fotek SSR-10DA Solid State Relay into a 250W + * heater. If your configuration is significantly different than this and you don't understand + * the issues involved, don't use bed PID until someone else verifies that your hardware works. + */ +//#define PIDTEMPBED + +#define BED_LIMIT_SWITCHING + +/** + * Max Bed Power + * Applies to all forms of bed control (PID, bang-bang, and bang-bang with hysteresis). + * When set to any value below 255, enables a form of PWM to the bed that acts like a divider + * so don't use it unless you are OK with PWM on your bed. (See the comment on enabling PIDTEMPBED) + */ +#define MAX_BED_POWER 255 // limits duty cycle to bed; 255=full current + +#if ENABLED(PIDTEMPBED) + + //#define PID_BED_DEBUG // Sends debug data to the serial port. + + //120V 250W silicone heater into 4mm borosilicate (MendelMax 1.5+) + //from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10) + #define DEFAULT_bedKp 10.00 + #define DEFAULT_bedKi .023 + #define DEFAULT_bedKd 305.4 + + //120V 250W silicone heater into 4mm borosilicate (MendelMax 1.5+) + //from pidautotune + //#define DEFAULT_bedKp 97.1 + //#define DEFAULT_bedKi 1.41 + //#define DEFAULT_bedKd 1675.16 + + // FIND YOUR OWN: "M303 E-1 C8 S90" to run autotune on the bed at 90 degreesC for 8 cycles. +#endif // PIDTEMPBED + +// @section extruder + +/** + * Prevent extrusion if the temperature is below EXTRUDE_MINTEMP. + * Add M302 to set the minimum extrusion temperature and/or turn + * cold extrusion prevention on and off. + * + * *** IT IS HIGHLY RECOMMENDED TO LEAVE THIS OPTION ENABLED! *** + */ +#define PREVENT_COLD_EXTRUSION +#define EXTRUDE_MINTEMP 170 + +/** + * Prevent a single extrusion longer than EXTRUDE_MAXLENGTH. + * Note: For Bowden Extruders make this large enough to allow load/unload. + */ +#define PREVENT_LENGTHY_EXTRUDE +#define EXTRUDE_MAXLENGTH 300 + +//=========================================================================== +//======================== Thermal Runaway Protection ======================= +//=========================================================================== + +/** + * Thermal Protection provides additional protection to your printer from damage + * and fire. Marlin always includes safe min and max temperature ranges which + * protect against a broken or disconnected thermistor wire. + * + * The issue: If a thermistor falls out, it will report the much lower + * temperature of the air in the room, and the the firmware will keep + * the heater on. + * + * If you get "Thermal Runaway" or "Heating failed" errors the + * details can be tuned in Configuration_adv.h + */ + +#define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders +#define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed + +//=========================================================================== +//============================= Mechanical Settings ========================= +//=========================================================================== + +// @section machine + +// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics +// either in the usual order or reversed +//#define COREXY +//#define COREXZ +//#define COREYZ +//#define COREYX +//#define COREZX +//#define COREZY + +//=========================================================================== +//============================== Delta Settings ============================= +//=========================================================================== +// Enable DELTA kinematics and most of the default configuration for Deltas +#define DELTA + +#if ENABLED(DELTA) + + // Make delta curves from many straight lines (linear interpolation). + // This is a trade-off between visible corners (not enough segments) + // and processor overload (too many expensive sqrt calls). + #define DELTA_SEGMENTS_PER_SECOND 200 + + // After homing move down to a height where XY movement is unconstrained + //#define DELTA_HOME_TO_SAFE_ZONE + + // Delta calibration menu + // uncomment to add three points calibration menu option. + // See http://minow.blogspot.com/index.html#4918805519571907051 + #define DELTA_CALIBRATION_MENU + + // uncomment to add G33 Delta Auto-Calibration (Enable EEPROM_SETTINGS to store results) + #define DELTA_AUTO_CALIBRATION + + // NOTE NB all values for DELTA_* values MUST be floating point, so always have a decimal point in them + + #if ENABLED(DELTA_AUTO_CALIBRATION) + // set the default number of probe points : n*n (1 -> 7) + #define DELTA_CALIBRATION_DEFAULT_POINTS 7 + #endif + + #if ENABLED(DELTA_AUTO_CALIBRATION) || ENABLED(DELTA_CALIBRATION_MENU) + // Set the radius for the calibration probe points - max DELTA_PRINTABLE_RADIUS for non-eccentric probes + #define DELTA_CALIBRATION_RADIUS 140 // (mm) + // Set the steprate for papertest probing + #define PROBE_MANUALLY_STEP 0.05 // (mm) + #endif + + // Print surface diameter/2 minus unreachable space (avoid collisions with vertical towers). + #define DELTA_PRINTABLE_RADIUS 165.0 // (mm) + + // Center-to-center distance of the holes in the diagonal push rods. + #define DELTA_DIAGONAL_ROD 397.19 // (mm) + + // height from z=0 to home position + #define DELTA_HEIGHT 522.27 // get this value from auto calibrate + + #define DELTA_ENDSTOP_ADJ { 0.0, -0.12, -0.78 } // get these from auto calibrate + + // Horizontal distance bridged by diagonal push rods when effector is centered. + #define DELTA_RADIUS 157.39 //mm Get this value from auto calibrate + + // Trim adjustments for individual towers + // tower angle corrections for X and Y tower / rotate XYZ so Z tower angle = 0 + // measured in degrees anticlockwise looking from above the printer + #define DELTA_TOWER_ANGLE_TRIM { -0.18, 0.18, 0.0 } // get these values from auto calibrate + + // delta radius and diaginal rod adjustments measured in mm + //#define DELTA_RADIUS_TRIM_TOWER { 0.0, 0.0, 0.0 } + //#define DELTA_DIAGONAL_ROD_TRIM_TOWER { 0.0, 0.0, 0.0 } + +#endif + +//=========================================================================== +//============================== Endstop Settings =========================== +//=========================================================================== + +// @section homing + +// Specify here all the endstop connectors that are connected to any endstop or probe. +// Almost all printers will be using one per axis. Probes will use one or more of the +// extra connectors. Leave undefined any used for non-endstop and non-probe purposes. +//#define USE_XMIN_PLUG +//#define USE_YMIN_PLUG +#define USE_ZMIN_PLUG // a Z probe +#define USE_XMAX_PLUG +#define USE_YMAX_PLUG +#define USE_ZMAX_PLUG + +// Enable pullup for all endstops to prevent a floating state +#define ENDSTOPPULLUPS +#if DISABLED(ENDSTOPPULLUPS) + // Disable ENDSTOPPULLUPS to set pullups individually + //#define ENDSTOPPULLUP_XMAX + //#define ENDSTOPPULLUP_YMAX + //#define ENDSTOPPULLUP_ZMAX + //#define ENDSTOPPULLUP_XMIN + //#define ENDSTOPPULLUP_YMIN + //#define ENDSTOPPULLUP_ZMIN + //#define ENDSTOPPULLUP_ZMIN_PROBE +#endif + +// Enable pulldown for all endstops to prevent a floating state +//#define ENDSTOPPULLDOWNS +#if DISABLED(ENDSTOPPULLDOWNS) + // Disable ENDSTOPPULLDOWNS to set pulldowns individually + //#define ENDSTOPPULLDOWN_XMAX + //#define ENDSTOPPULLDOWN_YMAX + //#define ENDSTOPPULLDOWN_ZMAX + //#define ENDSTOPPULLDOWN_XMIN + //#define ENDSTOPPULLDOWN_YMIN + //#define ENDSTOPPULLDOWN_ZMIN + //#define ENDSTOPPULLDOWN_ZMIN_PROBE +#endif + +// Mechanical endstop with COM to ground and NC to Signal uses "false" here (most common setup). +#define X_MIN_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. +#define Y_MIN_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. +#define Z_MIN_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. +#define X_MAX_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. +#define Y_MAX_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. +#define Z_MAX_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. +#define Z_MIN_PROBE_ENDSTOP_INVERTING true // set to true to invert the logic of the probe. + +/** + * Stepper Drivers + * + * These settings allow Marlin to tune stepper driver timing and enable advanced options for + * stepper drivers that support them. You may also override timing options in Configuration_adv.h. + * + * A4988 is assumed for unspecified drivers. + * + * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, + * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, + * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, + * TMC5130, TMC5130_STANDALONE + * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + */ +//#define X_DRIVER_TYPE A4988 +//#define Y_DRIVER_TYPE A4988 +//#define Z_DRIVER_TYPE A4988 +//#define X2_DRIVER_TYPE A4988 +//#define Y2_DRIVER_TYPE A4988 +//#define Z2_DRIVER_TYPE A4988 +//#define Z3_DRIVER_TYPE A4988 +//#define E0_DRIVER_TYPE A4988 +//#define E1_DRIVER_TYPE A4988 +//#define E2_DRIVER_TYPE A4988 +//#define E3_DRIVER_TYPE A4988 +//#define E4_DRIVER_TYPE A4988 +//#define E5_DRIVER_TYPE A4988 + +// Enable this feature if all enabled endstop pins are interrupt-capable. +// This will remove the need to poll the interrupt pins, saving many CPU cycles. +//#define ENDSTOP_INTERRUPTS_FEATURE + +/** + * Endstop Noise Threshold + * + * Enable if your probe or endstops falsely trigger due to noise. + * + * - Higher values may affect repeatability or accuracy of some bed probes. + * - To fix noise install a 100nF ceramic capacitor inline with the switch. + * - This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, which already have the 100nF capacitor. + * + * :[2,3,4,5,6,7] + */ +//#define ENDSTOP_NOISE_THRESHOLD 2 + +//============================================================================= +//============================== Movement Settings ============================ +//============================================================================= +// @section motion + +// delta speeds must be the same on xyz +/** + * Default Settings + * + * These settings can be reset by M502 + * + * Note that if EEPROM is enabled, saved values will override these. + */ + +/** + * With this option each E stepper can have its own factors for the + * following movement settings. If fewer factors are given than the + * total number of extruders, the last value applies to the rest. + */ +//#define DISTINCT_E_FACTORS + +/** + * Default Axis Steps Per Unit (steps/mm) + * Override with M92 + * X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]] + */ +// variables to calculate steps +#define XYZ_FULL_STEPS_PER_ROTATION 200 +#define XYZ_MICROSTEPS 16 +#define XYZ_BELT_PITCH 2 +#define XYZ_PULLEY_TEETH 20 + +// delta speeds must be the same on xyz +#define DEFAULT_XYZ_STEPS_PER_UNIT ((XYZ_FULL_STEPS_PER_ROTATION) * (XYZ_MICROSTEPS) / double(XYZ_BELT_PITCH) / double(XYZ_PULLEY_TEETH)) +#define DEFAULT_AXIS_STEPS_PER_UNIT { DEFAULT_XYZ_STEPS_PER_UNIT, DEFAULT_XYZ_STEPS_PER_UNIT, DEFAULT_XYZ_STEPS_PER_UNIT, 376.04 } + +/** + * Default Max Feed Rate (mm/s) + * Override with M203 + * X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]] + */ +#define DEFAULT_MAX_FEEDRATE { 25000, 25000, 25000, 5000 } + +/** + * Default Max Acceleration (change/s) change = mm/s + * (Maximum start speed for accelerated moves) + * Override with M201 + * X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]] + */ +#define DEFAULT_MAX_ACCELERATION { 9000, 9000, 9000, 10000 } + +/** + * Default Acceleration (change/s) change = mm/s + * Override with M204 + * + * M204 P Acceleration + * M204 R Retract Acceleration + * M204 T Travel Acceleration + */ +#define DEFAULT_ACCELERATION 5000 // X, Y, Z and E acceleration for printing moves +#define DEFAULT_RETRACT_ACCELERATION 3000 // E acceleration for retracts +#define DEFAULT_TRAVEL_ACCELERATION 5000 // X, Y, Z acceleration for travel (non printing) moves + +/** + * Default Jerk (mm/s) + * Override with M205 X Y Z E + * + * "Jerk" specifies the minimum speed change that requires acceleration. + * When changing speed and direction, if the difference is less than the + * value set here, it may happen instantaneously. + */ +#define DEFAULT_XJERK 10.0 +#define DEFAULT_YJERK DEFAULT_XJERK +#define DEFAULT_ZJERK DEFAULT_XJERK // Must be same as XY for delta +#define DEFAULT_EJERK 5.0 + +/** + * S-Curve Acceleration + * + * This option eliminates vibration during printing by fitting a Bézier + * curve to move acceleration, producing much smoother direction changes. + * + * See https://github.com/synthetos/TinyG/wiki/Jerk-Controlled-Motion-Explained + */ +//#define S_CURVE_ACCELERATION + +//=========================================================================== +//============================= Z Probe Options ============================= +//=========================================================================== +// @section probes + +// +// See http://marlinfw.org/docs/configuration/probes.html +// + +/** + * Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN + * + * Enable this option for a probe connected to the Z Min endstop pin. + */ +#define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN + +/** + * Z_MIN_PROBE_ENDSTOP + * + * Enable this option for a probe connected to any pin except Z-Min. + * (By default Marlin assumes the Z-Max endstop pin.) + * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * + * - The simplest option is to use a free endstop connector. + * - Use 5V for powered (usually inductive) sensors. + * + * - RAMPS 1.3/1.4 boards may use the 5V, GND, and Aux4->D32 pin: + * - For simple switches connect... + * - normally-closed switches to GND and D32. + * - normally-open switches to 5V and D32. + * + * WARNING: Setting the wrong pin may have unexpected and potentially + * disastrous consequences. Use with caution and do your homework. + * + */ +//#define Z_MIN_PROBE_ENDSTOP + +/** + * Probe Type + * + * Allen Key Probes, Servo Probes, Z-Sled Probes, FIX_MOUNTED_PROBE, etc. + * Activate one of these to use Auto Bed Leveling below. + */ + +/** + * The "Manual Probe" provides a means to do "Auto" Bed Leveling without a probe. + * Use G29 repeatedly, adjusting the Z height at each point with movement commands + * or (with LCD_BED_LEVELING) the LCD controller. + */ +//#define PROBE_MANUALLY +//#define MANUAL_PROBE_START_Z 0.2 + +/** + * A Fix-Mounted Probe either doesn't deploy or needs manual deployment. + * (e.g., an inductive probe or a nozzle-based probe-switch.) + */ +//#define FIX_MOUNTED_PROBE + +/** + * Z Servo Probe, such as an endstop switch on a rotating arm. + */ +//#define Z_PROBE_SERVO_NR 0 // Defaults to SERVO 0 connector. +//#define Z_SERVO_ANGLES {70,0} // Z Servo Deploy and Stow angles + +/** + * The BLTouch probe uses a Hall effect sensor and emulates a servo. + */ +#define BLTOUCH +#if ENABLED(BLTOUCH) + #define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed +#endif + +// A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) +//#define SOLENOID_PROBE + +// A sled-mounted probe like those designed by Charles Bell. +//#define Z_PROBE_SLED +//#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. + +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + +/** + * Allen key retractable z-probe as seen on many Kossel delta printers - http://reprap.org/wiki/Kossel#Automatic_bed_leveling_probe + * Deploys by touching z-axis belt. Retracts by pushing the probe down. Uses Z_MIN_PIN. + */ +//#define Z_PROBE_ALLEN_KEY + +#if ENABLED(Z_PROBE_ALLEN_KEY) + // 2 or 3 sets of coordinates for deploying and retracting the spring loaded touch probe on G29, + // if servo actuated touch probe is not defined. Uncomment as appropriate for your printer/probe. + + #define Z_PROBE_ALLEN_KEY_DEPLOY_1_X 30.0 + #define Z_PROBE_ALLEN_KEY_DEPLOY_1_Y DELTA_PRINTABLE_RADIUS + #define Z_PROBE_ALLEN_KEY_DEPLOY_1_Z 100.0 + #define Z_PROBE_ALLEN_KEY_DEPLOY_1_FEEDRATE XY_PROBE_SPEED + + #define Z_PROBE_ALLEN_KEY_DEPLOY_2_X 0.0 + #define Z_PROBE_ALLEN_KEY_DEPLOY_2_Y DELTA_PRINTABLE_RADIUS + #define Z_PROBE_ALLEN_KEY_DEPLOY_2_Z 100.0 + #define Z_PROBE_ALLEN_KEY_DEPLOY_2_FEEDRATE (XY_PROBE_SPEED)/10 + + #define Z_PROBE_ALLEN_KEY_DEPLOY_3_X Z_PROBE_ALLEN_KEY_DEPLOY_2_X * 0.75 + #define Z_PROBE_ALLEN_KEY_DEPLOY_3_Y Z_PROBE_ALLEN_KEY_DEPLOY_2_Y * 0.75 + #define Z_PROBE_ALLEN_KEY_DEPLOY_3_Z Z_PROBE_ALLEN_KEY_DEPLOY_2_Z + #define Z_PROBE_ALLEN_KEY_DEPLOY_3_FEEDRATE XY_PROBE_SPEED + + #define Z_PROBE_ALLEN_KEY_STOW_1_X -64.0 // Move the probe into position + #define Z_PROBE_ALLEN_KEY_STOW_1_Y 56.0 + #define Z_PROBE_ALLEN_KEY_STOW_1_Z 23.0 + #define Z_PROBE_ALLEN_KEY_STOW_1_FEEDRATE XY_PROBE_SPEED + + #define Z_PROBE_ALLEN_KEY_STOW_2_X -64.0 // Push it down + #define Z_PROBE_ALLEN_KEY_STOW_2_Y 56.0 + #define Z_PROBE_ALLEN_KEY_STOW_2_Z 3.0 + #define Z_PROBE_ALLEN_KEY_STOW_2_FEEDRATE (XY_PROBE_SPEED)/10 + + #define Z_PROBE_ALLEN_KEY_STOW_3_X -64.0 // Move it up to clear + #define Z_PROBE_ALLEN_KEY_STOW_3_Y 56.0 + #define Z_PROBE_ALLEN_KEY_STOW_3_Z 50.0 + #define Z_PROBE_ALLEN_KEY_STOW_3_FEEDRATE XY_PROBE_SPEED + + #define Z_PROBE_ALLEN_KEY_STOW_4_X 0.0 + #define Z_PROBE_ALLEN_KEY_STOW_4_Y 0.0 + #define Z_PROBE_ALLEN_KEY_STOW_4_Z Z_PROBE_ALLEN_KEY_STOW_3_Z + #define Z_PROBE_ALLEN_KEY_STOW_4_FEEDRATE XY_PROBE_SPEED + +#endif // Z_PROBE_ALLEN_KEY + +/** + * Z Probe to nozzle (X,Y) offset, relative to (0, 0). + * X and Y offsets must be integers. + * + * In the following example the X and Y offsets are both positive: + * #define X_PROBE_OFFSET_FROM_EXTRUDER 10 + * #define Y_PROBE_OFFSET_FROM_EXTRUDER 10 + * + * +-- BACK ---+ + * | | + * L | (+) P | R <-- probe (20,20) + * E | | I + * F | (-) N (+) | G <-- nozzle (10,10) + * T | | H + * | (-) | T + * | | + * O-- FRONT --+ + * (0,0) + */ +#define X_PROBE_OFFSET_FROM_EXTRUDER 0 // X offset: -left +right [of the nozzle] +#define Y_PROBE_OFFSET_FROM_EXTRUDER 20 // Y offset: -front +behind [the nozzle] +#define Z_PROBE_OFFSET_FROM_EXTRUDER -1.10 // Z offset: -below +above [the nozzle] + +// Certain types of probes need to stay away from edges +#define MIN_PROBE_EDGE 20 + +// X and Y axis travel speed (mm/m) between probes +#define XY_PROBE_SPEED 4000 + +// Feedrate (mm/m) for the first approach when double-probing (MULTIPLE_PROBING == 2) +#define Z_PROBE_SPEED_FAST HOMING_FEEDRATE_Z + +// Feedrate (mm/m) for the "accurate" probe of each point +#define Z_PROBE_SPEED_SLOW (Z_PROBE_SPEED_FAST / 2) + +// The number of probes to perform at each point. +// Set to 2 for a fast/slow probe, using the second probe result. +// Set to 3 or more for slow probes, averaging the results. +//#define MULTIPLE_PROBING 2 + +/** + * Z probes require clearance when deploying, stowing, and moving between + * probe points to avoid hitting the bed and other hardware. + * Servo-mounted probes require extra space for the arm to rotate. + * Inductive probes need space to keep from triggering early. + * + * Use these settings to specify the distance (mm) to raise the probe (or + * lower the bed). The values set here apply over and above any (negative) + * probe Z Offset set with Z_PROBE_OFFSET_FROM_EXTRUDER, M851, or the LCD. + * Only integer values >= 1 are valid here. + * + * Example: `M851 Z-5` with a CLEARANCE of 4 => 9mm from bed to nozzle. + * But: `M851 Z+1` with a CLEARANCE of 2 => 2mm from bed to nozzle. + */ +#define Z_CLEARANCE_DEPLOY_PROBE 5 // Z Clearance for Deploy/Stow +#define Z_CLEARANCE_BETWEEN_PROBES 2 // Z Clearance between probe points +#define Z_CLEARANCE_MULTI_PROBE 5 // Z Clearance between multiple probes +//#define Z_AFTER_PROBING 2 // Z position after probing is done + +#define Z_PROBE_LOW_POINT -2 // Farthest distance below the trigger-point to go before stopping + +// For M851 give a range for adjusting the Z probe offset +#define Z_PROBE_OFFSET_RANGE_MIN -20 +#define Z_PROBE_OFFSET_RANGE_MAX 20 + +// Enable the M48 repeatability test to test probe accuracy +//#define Z_MIN_PROBE_REPEATABILITY_TEST + +// Before deploy/stow pause for user confirmation +//#define PAUSE_BEFORE_DEPLOY_STOW + +/** + * Enable one or more of the following if probing seems unreliable. + * Heaters and/or fans can be disabled during probing to minimize electrical + * noise. A delay can also be added to allow noise and vibration to settle. + * These options are most useful for the BLTouch probe, but may also improve + * readings with inductive probes and piezo sensors. + */ +//#define PROBING_HEATERS_OFF // Turn heaters off when probing +#if ENABLED(PROBING_HEATERS_OFF) + //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) +#endif +//#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing +//#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors + +// For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 +// :{ 0:'Low', 1:'High' } +#define X_ENABLE_ON 0 +#define Y_ENABLE_ON 0 +#define Z_ENABLE_ON 0 +#define E_ENABLE_ON 0 // For all extruders + +// Disables axis stepper immediately when it's not being used. +// WARNING: When motors turn off there is a chance of losing position accuracy! +#define DISABLE_X false +#define DISABLE_Y false +#define DISABLE_Z false + +// Warn on display about possibly reduced accuracy +//#define DISABLE_REDUCED_ACCURACY_WARNING + +// @section extruder + +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled + +// @section machine + +// Invert the stepper direction. Change (or reverse the motor connector) if an axis goes the wrong way. +#define INVERT_X_DIR true +#define INVERT_Y_DIR true +#define INVERT_Z_DIR true + +// @section extruder + +// For direct drive extruder v9 set to true, for geared extruder set to false. +#define INVERT_E0_DIR true +#define INVERT_E1_DIR false +#define INVERT_E2_DIR false +#define INVERT_E3_DIR false +#define INVERT_E4_DIR false +#define INVERT_E5_DIR false + +// @section homing + +//#define NO_MOTION_BEFORE_HOMING // Inhibit movement until all axes have been homed + +//#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. + +//#define Z_HOMING_HEIGHT 15 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... + // Be sure you have this distance over your Z_MAX_POS in case. + +// Direction of endstops when homing; 1=MAX, -1=MIN +// :[-1,1] +#define X_HOME_DIR 1 // deltas always home to max +#define Y_HOME_DIR 1 +#define Z_HOME_DIR 1 + +// @section machine + +// The size of the print bed +#define X_BED_SIZE ((DELTA_PRINTABLE_RADIUS) * 2) +#define Y_BED_SIZE ((DELTA_PRINTABLE_RADIUS) * 2) + +// Travel limits (mm) after homing, corresponding to endstop positions. +#define X_MIN_POS -(DELTA_PRINTABLE_RADIUS) +#define Y_MIN_POS -(DELTA_PRINTABLE_RADIUS) +#define Z_MIN_POS 0 +#define X_MAX_POS DELTA_PRINTABLE_RADIUS +#define Y_MAX_POS DELTA_PRINTABLE_RADIUS +#define Z_MAX_POS MANUAL_Z_HOME_POS + +/** + * Software Endstops + * + * - Prevent moves outside the set machine bounds. + * - Individual axes can be disabled, if desired. + * - X and Y only apply to Cartesian robots. + * - Use 'M211' to set software endstops on/off or report current state + */ + +// Min software endstops constrain movement within minimum coordinate bounds +//#define MIN_SOFTWARE_ENDSTOPS +#if ENABLED(MIN_SOFTWARE_ENDSTOPS) + #define MIN_SOFTWARE_ENDSTOP_X + #define MIN_SOFTWARE_ENDSTOP_Y + #define MIN_SOFTWARE_ENDSTOP_Z +#endif + +// Max software endstops constrain movement within maximum coordinate bounds +#define MAX_SOFTWARE_ENDSTOPS +#if ENABLED(MAX_SOFTWARE_ENDSTOPS) + #define MAX_SOFTWARE_ENDSTOP_X + #define MAX_SOFTWARE_ENDSTOP_Y + #define MAX_SOFTWARE_ENDSTOP_Z +#endif + +#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) + //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD +#endif + +/** + * Filament Runout Sensors + * Mechanical or opto endstops are used to check for the presence of filament. + * + * RAMPS-based boards use SERVO3_PIN for the first runout sensor. + * For other boards you may need to define FIL_RUNOUT_PIN, FIL_RUNOUT2_PIN, etc. + * By default the firmware assumes HIGH=FILAMENT PRESENT. + */ +//#define FILAMENT_RUNOUT_SENSOR +#if ENABLED(FILAMENT_RUNOUT_SENSOR) + #define NUM_RUNOUT_SENSORS 1 // Number of sensors, up to one per extruder. Define a FIL_RUNOUT#_PIN for each. + #define FIL_RUNOUT_INVERTING false // set to true to invert the logic of the sensor. + #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. + //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. + #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif +#endif + +//=========================================================================== +//=============================== Bed Leveling ============================== +//=========================================================================== +// @section calibrate + +/** + * Choose one of the options below to enable G29 Bed Leveling. The parameters + * and behavior of G29 will change depending on your selection. + * + * If using a Probe for Z Homing, enable Z_SAFE_HOMING also! + * + * - AUTO_BED_LEVELING_3POINT + * Probe 3 arbitrary points on the bed (that aren't collinear) + * You specify the XY coordinates of all 3 points. + * The result is a single tilted plane. Best for a flat bed. + * + * - AUTO_BED_LEVELING_LINEAR + * Probe several points in a grid. + * You specify the rectangle and the density of sample points. + * The result is a single tilted plane. Best for a flat bed. + * + * - AUTO_BED_LEVELING_BILINEAR + * Probe several points in a grid. + * You specify the rectangle and the density of sample points. + * The result is a mesh, best for large or uneven beds. + * + * - AUTO_BED_LEVELING_UBL (Unified Bed Leveling) + * A comprehensive bed leveling system combining the features and benefits + * of other systems. UBL also includes integrated Mesh Generation, Mesh + * Validation and Mesh Editing systems. + * + * - MESH_BED_LEVELING + * Probe a grid manually + * The result is a mesh, suitable for large or uneven beds. (See BILINEAR.) + * For machines without a probe, Mesh Bed Leveling provides a method to perform + * leveling in steps so you can manually adjust the Z height at each grid-point. + * With an LCD controller the process is guided step-by-step. + */ +//#define AUTO_BED_LEVELING_3POINT +#define AUTO_BED_LEVELING_LINEAR +//#define AUTO_BED_LEVELING_BILINEAR +//#define AUTO_BED_LEVELING_UBL +//#define MESH_BED_LEVELING + +/** + * Normally G28 leaves leveling disabled on completion. Enable + * this option to have G28 restore the prior leveling state. + */ +//#define RESTORE_LEVELING_AFTER_G28 + +/** + * Enable detailed logging of G28, G29, M48, etc. + * Turn on with the command 'M111 S32'. + * NOTE: Requires a lot of PROGMEM! + */ +//#define DEBUG_LEVELING_FEATURE + +#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) + // Gradually reduce leveling correction until a set height is reached, + // at which point movement will be level to the machine's XY plane. + // The height can be set with M420 Z + //#define ENABLE_LEVELING_FADE_HEIGHT + + // For Cartesian machines, instead of dividing moves on mesh boundaries, + // split up moves into short segments like a Delta. This follows the + // contours of the bed more closely than edge-to-edge straight moves. + #define SEGMENT_LEVELED_MOVES + #define LEVELED_SEGMENT_LENGTH 5.0 // (mm) Length of all segments (except the last one) + + /** + * Enable the G26 Mesh Validation Pattern tool. + */ + //#define G26_MESH_VALIDATION + #if ENABLED(G26_MESH_VALIDATION) + #define MESH_TEST_NOZZLE_SIZE 0.4 // (mm) Diameter of primary nozzle. + #define MESH_TEST_LAYER_HEIGHT 0.2 // (mm) Default layer height for the G26 Mesh Validation Tool. + #define MESH_TEST_HOTEND_TEMP 205.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #endif + +#endif + +#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) + + // Set the number of grid points per dimension. + // Works best with 5 or more points in each dimension. + #define GRID_MAX_POINTS_X 7 + #define GRID_MAX_POINTS_Y GRID_MAX_POINTS_X + + // Set the boundaries for probing (where the probe can reach). + //#define LEFT_PROBE_BED_POSITION -(DELTA_PRINTABLE_RADIUS -(MIN_PROBE_EDGE)) + //#define RIGHT_PROBE_BED_POSITION DELTA_PRINTABLE_RADIUS -(MIN_PROBE_EDGE) + //#define FRONT_PROBE_BED_POSITION -(DELTA_PRINTABLE_RADIUS -(MIN_PROBE_EDGE)) + //#define BACK_PROBE_BED_POSITION DELTA_PRINTABLE_RADIUS -(MIN_PROBE_EDGE) + + // Probe along the Y axis, advancing X after each column + //#define PROBE_Y_FIRST + + #if ENABLED(AUTO_BED_LEVELING_BILINEAR) + + // Beyond the probed grid, continue the implied tilt? + // Default is to maintain the height of the nearest edge. + //#define EXTRAPOLATE_BEYOND_GRID + + // + // Experimental Subdivision of the grid by Catmull-Rom method. + // Synthesizes intermediate points to produce a more detailed mesh. + // + //#define ABL_BILINEAR_SUBDIVISION + #if ENABLED(ABL_BILINEAR_SUBDIVISION) + // Number of subdivisions between probe points + #define BILINEAR_SUBDIVISIONS 3 + #endif + + #endif + +#elif ENABLED(AUTO_BED_LEVELING_UBL) + + //=========================================================================== + //========================= Unified Bed Leveling ============================ + //=========================================================================== + + //#define MESH_EDIT_GFX_OVERLAY // Display a graphics overlay while editing the mesh + + #define MESH_INSET 1 // Set Mesh bounds as an inset region of the bed + #define GRID_MAX_POINTS_X 10 // Don't use more than 15 points per axis, implementation limited. + #define GRID_MAX_POINTS_Y GRID_MAX_POINTS_X + + #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle + #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + +#elif ENABLED(MESH_BED_LEVELING) + + //=========================================================================== + //=================================== Mesh ================================== + //=========================================================================== + + #define MESH_INSET 10 // Set Mesh bounds as an inset region of the bed + #define GRID_MAX_POINTS_X 3 // Don't use more than 7 points per axis, implementation limited. + #define GRID_MAX_POINTS_Y GRID_MAX_POINTS_X + + //#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS + +#endif // BED_LEVELING + +/** + * Points to probe for all 3-point Leveling procedures. + * Override if the automatically selected points are inadequate. + */ +#if ENABLED(AUTO_BED_LEVELING_3POINT) || ENABLED(AUTO_BED_LEVELING_UBL) + //#define PROBE_PT_1_X 15 + //#define PROBE_PT_1_Y 180 + //#define PROBE_PT_2_X 15 + //#define PROBE_PT_2_Y 20 + //#define PROBE_PT_3_X 170 + //#define PROBE_PT_3_Y 20 +#endif + +/** + * Add a bed leveling sub-menu for ABL or MBL. + * Include a guided procedure if manual probing is enabled. + */ +//#define LCD_BED_LEVELING + +#if ENABLED(LCD_BED_LEVELING) + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points +#endif + +// Add a menu item to move between bed corners for manual bed adjustment +//#define LEVEL_BED_CORNERS + +#if ENABLED(LEVEL_BED_CORNERS) + #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling + //#define LEVEL_CENTER_TOO // Move to the center after the last corner +#endif + +/** + * Commands to execute at the end of G29 probing. + * Useful to retract or move the Z probe out of the way. + */ +//#define Z_PROBE_END_SCRIPT "G1 Z10 F12000\nG1 X15 Y330\nG1 Z0.5\nG1 Z10" + + +// @section homing + +// The center of the bed is at (X=0, Y=0) +#define BED_CENTER_AT_0_0 + +// Manually set the home position. Leave these undefined for automatic settings. +// 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 DELTA_HEIGHT // Distance between the nozzle to printbed after homing + +// Use "Z Safe Homing" to avoid homing with a Z probe outside the bed area. +// +// With this feature enabled: +// +// - Allow Z homing only after X and Y homing AND stepper drivers still enabled. +// - If stepper drivers time out, it will need X and Y homing again before Z homing. +// - Move the Z probe (or nozzle) to a defined XY point before Z Homing when homing all axes (G28). +// - Prevent Z homing when the Z probe is outside bed area. +// +//#define Z_SAFE_HOMING + +#if ENABLED(Z_SAFE_HOMING) + #define Z_SAFE_HOMING_X_POINT ((X_BED_SIZE) / 2) // X point for Z homing when homing all axes (G28). + #define Z_SAFE_HOMING_Y_POINT ((Y_BED_SIZE) / 2) // Y point for Z homing when homing all axes (G28). +#endif + +// Delta only homes to Z +#define HOMING_FEEDRATE_Z (200*60) + +// Validate that endstops are triggered on homing moves +#define VALIDATE_HOMING_ENDSTOPS + +// @section calibrate + +/** + * Bed Skew Compensation + * + * This feature corrects for misalignment in the XYZ axes. + * + * Take the following steps to get the bed skew in the XY plane: + * 1. Print a test square (e.g., https://www.thingiverse.com/thing:2563185) + * 2. For XY_DIAG_AC measure the diagonal A to C + * 3. For XY_DIAG_BD measure the diagonal B to D + * 4. For XY_SIDE_AD measure the edge A to D + * + * Marlin automatically computes skew factors from these measurements. + * Skew factors may also be computed and set manually: + * + * - Compute AB : SQRT(2*AC*AC+2*BD*BD-4*AD*AD)/2 + * - XY_SKEW_FACTOR : TAN(PI/2-ACOS((AC*AC-AB*AB-AD*AD)/(2*AB*AD))) + * + * If desired, follow the same procedure for XZ and YZ. + * Use these diagrams for reference: + * + * Y Z Z + * ^ B-------C ^ B-------C ^ B-------C + * | / / | / / | / / + * | / / | / / | / / + * | A-------D | A-------D | A-------D + * +-------------->X +-------------->X +-------------->Y + * XY_SKEW_FACTOR XZ_SKEW_FACTOR YZ_SKEW_FACTOR + */ +//#define SKEW_CORRECTION + +#if ENABLED(SKEW_CORRECTION) + // Input all length measurements here: + #define XY_DIAG_AC 282.8427124746 + #define XY_DIAG_BD 282.8427124746 + #define XY_SIDE_AD 200 + + // Or, set the default skew factors directly here + // to override the above measurements: + #define XY_SKEW_FACTOR 0.0 + + //#define SKEW_CORRECTION_FOR_Z + #if ENABLED(SKEW_CORRECTION_FOR_Z) + #define XZ_DIAG_AC 282.8427124746 + #define XZ_DIAG_BD 282.8427124746 + #define YZ_DIAG_AC 282.8427124746 + #define YZ_DIAG_BD 282.8427124746 + #define YZ_SIDE_AD 200 + #define XZ_SKEW_FACTOR 0.0 + #define YZ_SKEW_FACTOR 0.0 + #endif + + // Enable this option for M852 to set skew at runtime + //#define SKEW_CORRECTION_GCODE +#endif + +//============================================================================= +//============================= Additional Features =========================== +//============================================================================= + +// @section extras + +// +// EEPROM +// +// The microcontroller can store settings in the EEPROM, e.g. max velocity... +// M500 - stores parameters in EEPROM +// M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily). +// M502 - reverts to the default "factory settings". You still need to store them in EEPROM afterwards if you want to. +// +#define EEPROM_SETTINGS // Enable for M500 and M501 commands +//#define DISABLE_M503 // Saves ~2700 bytes of PROGMEM. Disable for release! +#define EEPROM_CHITCHAT // Give feedback on EEPROM commands. Disable to save PROGMEM. + +// +// Host Keepalive +// +// When enabled Marlin will send a busy status message to the host +// every couple of seconds when it can't accept commands. +// +#define HOST_KEEPALIVE_FEATURE // Disable this if your host doesn't like keepalive messages +#define DEFAULT_KEEPALIVE_INTERVAL 2 // Number of seconds between "busy" messages. Set with M113. +#define BUSY_WHILE_HEATING // Some hosts require "busy" messages even during heating + +// +// M100 Free Memory Watcher +// +//#define M100_FREE_MEMORY_WATCHER // Add M100 (Free Memory Watcher) to debug memory usage + +// +// G20/G21 Inch mode support +// +//#define INCH_MODE_SUPPORT + +// +// M149 Set temperature units support +// +//#define TEMPERATURE_UNITS_SUPPORT + +// @section temperature + +// Preheat Constants +#define PREHEAT_1_LABEL "PLA" +#define PREHEAT_1_TEMP_HOTEND 195 +#define PREHEAT_1_TEMP_BED 60 +#define PREHEAT_1_FAN_SPEED 255 // Value from 0 to 255 + +#define PREHEAT_2_LABEL "ABS" +#define PREHEAT_2_TEMP_HOTEND 240 +#define PREHEAT_2_TEMP_BED 100 +#define PREHEAT_2_FAN_SPEED 255 // Value from 0 to 255 + +/** + * Nozzle Park + * + * Park the nozzle at the given XYZ position on idle or G27. + * + * The "P" parameter controls the action applied to the Z axis: + * + * P0 (Default) If Z is below park Z raise the nozzle. + * P1 Raise the nozzle always to Z-park height. + * P2 Raise the nozzle by Z-park amount, limited to Z_MAX_POS. + */ +#define NOZZLE_PARK_FEATURE + +#if ENABLED(NOZZLE_PARK_FEATURE) + // Specify a park position as { X, Y, Z } + #define NOZZLE_PARK_POINT { 0, 0, (DELTA_HEIGHT - 10) } + #define NOZZLE_PARK_XY_FEEDRATE 100 // X and Y axes feedrate in mm/s (also used for delta printers Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // Z axis feedrate in mm/s (not used for delta printers) +#endif + +/** + * Clean Nozzle Feature -- EXPERIMENTAL + * + * Adds the G12 command to perform a nozzle cleaning process. + * + * Parameters: + * P Pattern + * S Strokes / Repetitions + * T Triangles (P1 only) + * + * Patterns: + * P0 Straight line (default). This process requires a sponge type material + * at a fixed bed location. "S" specifies strokes (i.e. back-forth motions) + * between the start / end points. + * + * P1 Zig-zag pattern between (X0, Y0) and (X1, Y1), "T" specifies the + * number of zig-zag triangles to do. "S" defines the number of strokes. + * Zig-zags are done in whichever is the narrower dimension. + * For example, "G12 P1 S1 T3" will execute: + * + * -- + * | (X0, Y1) | /\ /\ /\ | (X1, Y1) + * | | / \ / \ / \ | + * A | | / \ / \ / \ | + * | | / \ / \ / \ | + * | (X0, Y0) | / \/ \/ \ | (X1, Y0) + * -- +--------------------------------+ + * |________|_________|_________| + * T1 T2 T3 + * + * P2 Circular pattern with middle at NOZZLE_CLEAN_CIRCLE_MIDDLE. + * "R" specifies the radius. "S" specifies the stroke count. + * Before starting, the nozzle moves to NOZZLE_CLEAN_START_POINT. + * + * Caveats: The ending Z should be the same as starting Z. + * Attention: EXPERIMENTAL. G-code arguments may change. + * + */ +//#define NOZZLE_CLEAN_FEATURE + +#if ENABLED(NOZZLE_CLEAN_FEATURE) + // Default number of pattern repetitions + #define NOZZLE_CLEAN_STROKES 12 + + // Default number of triangles + #define NOZZLE_CLEAN_TRIANGLES 3 + + // Specify positions as { X, Y, Z } + #define NOZZLE_CLEAN_START_POINT { 30, 30, (Z_MIN_POS + 1)} + #define NOZZLE_CLEAN_END_POINT {100, 60, (Z_MIN_POS + 1)} + + // Circular pattern radius + #define NOZZLE_CLEAN_CIRCLE_RADIUS 6.5 + // Circular pattern circle fragments number + #define NOZZLE_CLEAN_CIRCLE_FN 10 + // Middle point of circle + #define NOZZLE_CLEAN_CIRCLE_MIDDLE NOZZLE_CLEAN_START_POINT + + // Moves the nozzle to the initial position + #define NOZZLE_CLEAN_GOBACK +#endif + +/** + * Print Job Timer + * + * Automatically start and stop the print job timer on M104/M109/M190. + * + * M104 (hotend, no wait) - high temp = none, low temp = stop timer + * M109 (hotend, wait) - high temp = start timer, low temp = stop timer + * M190 (bed, wait) - high temp = start timer, low temp = none + * + * The timer can also be controlled with the following commands: + * + * M75 - Start the print job timer + * M76 - Pause the print job timer + * M77 - Stop the print job timer + */ +#define PRINTJOB_TIMER_AUTOSTART + +/** + * Print Counter + * + * Track statistical data such as: + * + * - Total print jobs + * - Total successful print jobs + * - Total failed print jobs + * - Total time printing + * + * View the current statistics with M78. + */ +//#define PRINTCOUNTER + +//============================================================================= +//============================= LCD and SD support ============================ +//============================================================================= + +// @section lcd + +/** + * LCD LANGUAGE + * + * Select the language to display on the LCD. These languages are available: + * + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + */ +#define LCD_LANGUAGE en + +/** + * LCD Character Set + * + * Note: This option is NOT applicable to Graphical Displays. + * + * All character-based LCDs provide ASCII plus one of these + * language extensions: + * + * - JAPANESE ... the most common + * - WESTERN ... with more accented characters + * - CYRILLIC ... for the Russian language + * + * To determine the language extension installed on your controller: + * + * - Compile and upload with LCD_LANGUAGE set to 'test' + * - Click the controller to view the LCD menu + * - The LCD will display Japanese, Western, or Cyrillic text + * + * See http://marlinfw.org/docs/development/lcd_language.html + * + * :['JAPANESE', 'WESTERN', 'CYRILLIC'] + */ +#define DISPLAY_CHARSET_HD44780 JAPANESE + +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + +/** + * SD CARD + * + * SD Card support is disabled by default. If your controller has an SD slot, + * you must uncomment the following option or it won't work. + * + */ +//#define SDSUPPORT + +/** + * SD CARD: SPI SPEED + * + * Enable one of the following items for a slower SPI transfer speed. + * This may be required to resolve "volume init" errors. + */ +//#define SPI_SPEED SPI_HALF_SPEED +//#define SPI_SPEED SPI_QUARTER_SPEED +//#define SPI_SPEED SPI_EIGHTH_SPEED + +/** + * SD CARD: ENABLE CRC + * + * Use CRC checks and retries on the SD communication. + */ +//#define SD_CHECK_AND_RETRY + +/** + * LCD Menu Items + * + * Disable all menus and only display the Status Screen, or + * just remove some extraneous menu items to recover space. + */ +//#define NO_LCD_MENUS +//#define SLIM_LCD_MENUS + +// +// ENCODER SETTINGS +// +// This option overrides the default number of encoder pulses needed to +// produce one step. Should be increased for high-resolution encoders. +// +//#define ENCODER_PULSES_PER_STEP 4 + +// +// Use this option to override the number of step signals required to +// move between next/prev menu items. +// +//#define ENCODER_STEPS_PER_MENU_ITEM 1 + +/** + * Encoder Direction Options + * + * Test your encoder's behavior first with both options disabled. + * + * Reversed Value Edit and Menu Nav? Enable REVERSE_ENCODER_DIRECTION. + * Reversed Menu Navigation only? Enable REVERSE_MENU_DIRECTION. + * Reversed Value Editing only? Enable BOTH options. + */ + +// +// This option reverses the encoder direction everywhere. +// +// Set this option if CLOCKWISE causes values to DECREASE +// +//#define REVERSE_ENCODER_DIRECTION + +// +// This option reverses the encoder direction for navigating LCD menus. +// +// If CLOCKWISE normally moves DOWN this makes it go UP. +// If CLOCKWISE normally moves UP this makes it go DOWN. +// +//#define REVERSE_MENU_DIRECTION + +// +// Individual Axis Homing +// +// Add individual axis homing items (Home X, Home Y, and Home Z) to the LCD menu. +// +//#define INDIVIDUAL_AXIS_HOMING_MENU + +// +// SPEAKER/BUZZER +// +// If you have a speaker that can produce tones, enable it here. +// By default Marlin assumes you have a buzzer with a fixed frequency. +// +//#define SPEAKER + +// +// The duration and frequency for the UI feedback sound. +// Set these to 0 to disable audio feedback in the LCD menus. +// +// Note: Test audio output with the G-Code: +// M300 S P +// +//#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 2 +//#define LCD_FEEDBACK_FREQUENCY_HZ 5000 + +//============================================================================= +//======================== LCD / Controller Selection ========================= +//======================== (Character-based LCDs) ========================= +//============================================================================= + +// +// RepRapDiscount Smart Controller. +// http://reprap.org/wiki/RepRapDiscount_Smart_Controller +// +// Note: Usually sold with a white PCB. +// +//#define REPRAP_DISCOUNT_SMART_CONTROLLER + +// +// Original RADDS LCD Display+Encoder+SDCardReader +// http://doku.radds.org/dokumentation/lcd-display/ +// +//#define RADDS_DISPLAY + +// +// ULTIMAKER Controller. +// +//#define ULTIMAKERCONTROLLER + +// +// ULTIPANEL as seen on Thingiverse. +// +//#define ULTIPANEL + +// +// PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3) +// http://reprap.org/wiki/PanelOne +// +//#define PANEL_ONE + +// +// GADGETS3D G3D LCD/SD Controller +// http://reprap.org/wiki/RAMPS_1.3/1.4_GADGETS3D_Shield_with_Panel +// +// Note: Usually sold with a blue PCB. +// +//#define G3D_PANEL + +// +// RigidBot Panel V1.0 +// http://www.inventapart.com/ +// +//#define RIGIDBOT_PANEL + +// +// Makeboard 3D Printer Parts 3D Printer Mini Display 1602 Mini Controller +// https://www.aliexpress.com/item/Micromake-Makeboard-3D-Printer-Parts-3D-Printer-Mini-Display-1602-Mini-Controller-Compatible-with-Ramps-1/32765887917.html +// +//#define MAKEBOARD_MINI_2_LINE_DISPLAY_1602 + +// +// ANET and Tronxy 20x4 Controller +// +//#define ZONESTAR_LCD // Requires ADC_KEYPAD_PIN to be assigned to an analog pin. + // This LCD is known to be susceptible to electrical interference + // which scrambles the display. Pressing any button clears it up. + // This is a LCD2004 display with 5 analog buttons. + +// +// Generic 16x2, 16x4, 20x2, or 20x4 character-based LCD. +// +//#define ULTRA_LCD + +//============================================================================= +//======================== LCD / Controller Selection ========================= +//===================== (I2C and Shift-Register LCDs) ===================== +//============================================================================= + +// +// CONTROLLER TYPE: I2C +// +// Note: These controllers require the installation of Arduino's LiquidCrystal_I2C +// library. For more info: https://github.com/kiyoshigawa/LiquidCrystal_I2C +// + +// +// Elefu RA Board Control Panel +// http://www.elefu.com/index.php?route=product/product&product_id=53 +// +//#define RA_CONTROL_PANEL + +// +// Sainsmart (YwRobot) LCD Displays +// +// These require F.Malpartida's LiquidCrystal_I2C library +// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home +// +//#define LCD_SAINSMART_I2C_1602 +//#define LCD_SAINSMART_I2C_2004 + +// +// Generic LCM1602 LCD adapter +// +//#define LCM1602 + +// +// PANELOLU2 LCD with status LEDs, +// separate encoder and click inputs. +// +// Note: This controller requires Arduino's LiquidTWI2 library v1.2.3 or later. +// For more info: https://github.com/lincomatic/LiquidTWI2 +// +// Note: The PANELOLU2 encoder click input can either be directly connected to +// a pin (if BTN_ENC defined to != -1) or read through I2C (when BTN_ENC == -1). +// +//#define LCD_I2C_PANELOLU2 + +// +// Panucatt VIKI LCD with status LEDs, +// integrated click & L/R/U/D buttons, separate encoder inputs. +// +//#define LCD_I2C_VIKI + +// +// CONTROLLER TYPE: Shift register panels +// + +// +// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// LCD configuration: http://reprap.org/wiki/SAV_3D_LCD +// +//#define SAV_3DLCD + +//============================================================================= +//======================= LCD / Controller Selection ======================= +//========================= (Graphical LCDs) ======================== +//============================================================================= + +// +// CONTROLLER TYPE: Graphical 128x64 (DOGM) +// +// IMPORTANT: The U8glib library is required for Graphical Display! +// https://github.com/olikraus/U8glib_Arduino +// + +// +// RepRapDiscount FULL GRAPHIC Smart Controller +// http://reprap.org/wiki/RepRapDiscount_Full_Graphic_Smart_Controller +// +//#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER + +// +// ReprapWorld Graphical LCD +// https://reprapworld.com/?products_details&products_id/1218 +// +//#define REPRAPWORLD_GRAPHICAL_LCD + +// +// Activate one of these if you have a Panucatt Devices +// Viki 2.0 or mini Viki with Graphic LCD +// http://panucatt.com +// +//#define VIKI2 +//#define miniVIKI + +// +// MakerLab Mini Panel with graphic +// controller and SD support - http://reprap.org/wiki/Mini_panel +// +//#define MINIPANEL + +// +// MaKr3d Makr-Panel with graphic controller and SD support. +// http://reprap.org/wiki/MaKr3d_MaKrPanel +// +//#define MAKRPANEL + +// +// Adafruit ST7565 Full Graphic Controller. +// https://github.com/eboston/Adafruit-ST7565-Full-Graphic-Controller/ +// +//#define ELB_FULL_GRAPHIC_CONTROLLER + +// +// BQ LCD Smart Controller shipped by +// default with the BQ Hephestos 2 and Witbox 2. +// +//#define BQ_LCD_SMART_CONTROLLER + +// +// Cartesio UI +// http://mauk.cc/webshop/cartesio-shop/electronics/user-interface +// +//#define CARTESIO_UI + +// +// LCD for Melzi Card with Graphical LCD +// +//#define LCD_FOR_MELZI + +// +// SSD1306 OLED full graphics generic display +// +//#define U8GLIB_SSD1306 + +// +// SAV OLEd LCD module support using either SSD1306 or SH1106 based LCD modules +// +//#define SAV_3DGLCD +#if ENABLED(SAV_3DGLCD) + //#define U8GLIB_SSD1306 + #define U8GLIB_SH1106 +#endif + +// +// Original Ulticontroller from Ultimaker 2 printer with SSD1309 I2C display and encoder +// https://github.com/Ultimaker/Ultimaker2/tree/master/1249_Ulticontroller_Board_(x1) +// +//#define ULTI_CONTROLLER + +// +// TinyBoy2 128x64 OLED / Encoder Panel +// +//#define OLED_PANEL_TINYBOY2 + +// +// MKS MINI12864 with graphic controller and SD support +// http://reprap.org/wiki/MKS_MINI_12864 +// +//#define MKS_MINI_12864 + +// +// Factory display for Creality CR-10 +// https://www.aliexpress.com/item/Universal-LCD-12864-3D-Printer-Display-Screen-With-Encoder-For-CR-10-CR-7-Model/32833148327.html +// +// This is RAMPS-compatible using a single 10-pin connector. +// (For CR-10 owners who want to replace the Melzi Creality board but retain the display) +// +//#define CR10_STOCKDISPLAY + +// +// ANET and Tronxy Graphical Controller +// +// Anet 128x64 full graphics lcd with rotary encoder as used on Anet A6 +// A clone of the RepRapDiscount full graphics display but with +// different pins/wiring (see pins_ANET_10.h). +// +//#define ANET_FULL_GRAPHICS_LCD + +// +// MKS OLED 1.3" 128 × 64 FULL GRAPHICS CONTROLLER +// http://reprap.org/wiki/MKS_12864OLED +// +// Tiny, but very sharp OLED display +// +//#define MKS_12864OLED // Uses the SH1106 controller (default) +//#define MKS_12864OLED_SSD1306 // Uses the SSD1306 controller + +// +// AZSMZ 12864 LCD with SD +// https://www.aliexpress.com/store/product/3D-printer-smart-controller-SMART-RAMPS-OR-RAMPS-1-4-LCD-12864-LCD-control-panel-green/2179173_32213636460.html +// +//#define AZSMZ_12864 + +// +// Silvergate GLCD controller +// http://github.com/android444/Silvergate +// +//#define SILVER_GATE_GLCD_CONTROLLER + +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + +//============================================================================= +//============================ Other Controllers ============================ +//============================================================================= + +// +// CONTROLLER TYPE: Standalone / Serial +// + +// +// LCD for Malyan M200 printers. +// +//#define MALYAN_LCD + +// +// CONTROLLER TYPE: Keypad / Add-on +// + +// +// RepRapWorld REPRAPWORLD_KEYPAD v1.1 +// http://reprapworld.com/?products_details&products_id=202&cPath=1591_1626 +// +// REPRAPWORLD_KEYPAD_MOVE_STEP sets how much should the robot move when a key +// is pressed, a value of 10.0 means 10mm per click. +// +//#define REPRAPWORLD_KEYPAD +//#define REPRAPWORLD_KEYPAD_MOVE_STEP 10.0 + +//============================================================================= +//=============================== Extra Features ============================== +//============================================================================= + +// @section extras + +// Increase the FAN PWM frequency. Removes the PWM noise but increases heating in the FET/Arduino +//#define FAST_PWM_FAN + +// Use software PWM to drive the fan, as for the heaters. This uses a very low frequency +// which is not as annoying as with the hardware PWM. On the other hand, if this frequency +// is too low, you should also increment SOFT_PWM_SCALE. +//#define FAN_SOFT_PWM + +// Incrementing this by 1 will double the software PWM frequency, +// affecting heaters, and the fan if FAN_SOFT_PWM is enabled. +// However, control resolution will be halved for each increment; +// at zero value, there are 128 effective control positions. +#define SOFT_PWM_SCALE 0 + +// If SOFT_PWM_SCALE is set to a value higher than 0, dithering can +// be used to mitigate the associated resolution loss. If enabled, +// some of the PWM cycles are stretched so on average the desired +// duty cycle is attained. +//#define SOFT_PWM_DITHER + +// Temperature status LEDs that display the hotend and bed temperature. +// If all hotends, bed temperature, and target temperature are under 54C +// then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) +//#define TEMP_STAT_LEDS + +// M240 Triggers a camera by emulating a Canon RC-1 Remote +// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ +//#define PHOTOGRAPH_PIN 23 + +// SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure +//#define SF_ARC_FIX + +// Support for the BariCUDA Paste Extruder +//#define BARICUDA + +// Support for BlinkM/CyzRgb +//#define BLINKM + +// Support for PCA9632 PWM LED driver +//#define PCA9632 + +/** + * RGB LED / LED Strip Control + * + * Enable support for an RGB LED connected to 5V digital pins, or + * an RGB Strip connected to MOSFETs controlled by digital pins. + * + * Adds the M150 command to set the LED (or LED strip) color. + * If pins are PWM capable (e.g., 4, 5, 6, 11) then a range of + * luminance values can be set from 0 to 255. + * For Neopixel LED an overall brightness parameter is also available. + * + * *** CAUTION *** + * LED Strips require a MOSFET Chip between PWM lines and LEDs, + * as the Arduino cannot handle the current the LEDs will require. + * Failure to follow this precaution can destroy your Arduino! + * NOTE: A separate 5V power supply is required! The Neopixel LED needs + * more current than the Arduino 5V linear regulator can produce. + * *** CAUTION *** + * + * LED Type. Enable only one of the following two options. + * + */ +//#define RGB_LED +//#define RGBW_LED + +#if ENABLED(RGB_LED) || ENABLED(RGBW_LED) + #define RGB_LED_R_PIN 34 + #define RGB_LED_G_PIN 43 + #define RGB_LED_B_PIN 35 + #define RGB_LED_W_PIN -1 +#endif + +// Support for Adafruit Neopixel LED driver +//#define NEOPIXEL_LED +#if ENABLED(NEOPIXEL_LED) + #define NEOPIXEL_TYPE NEO_GRBW // NEO_GRBW / NEO_GRB - four/three channel driver type (defined in Adafruit_NeoPixel.h) + #define NEOPIXEL_PIN 4 // LED driving pin on motherboard 4 => D4 (EXP2-5 on Printrboard) / 30 => PC7 (EXP3-13 on Rumba) + #define NEOPIXEL_PIXELS 30 // Number of LEDs in the strip + #define NEOPIXEL_IS_SEQUENTIAL // Sequential display for temperature change - LED by LED. Disable to change all LEDs at once. + #define NEOPIXEL_BRIGHTNESS 127 // Initial brightness (0-255) + //#define NEOPIXEL_STARTUP_TEST // Cycle through colors at startup +#endif + +/** + * Printer Event LEDs + * + * During printing, the LEDs will reflect the printer status: + * + * - Gradually change from blue to violet as the heated bed gets to target temp + * - Gradually change from violet to red as the hotend gets to temperature + * - Change to white to illuminate work surface + * - Change to green once print has finished + * - Turn off after the print has finished and the user has pushed a button + */ +#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632) || ENABLED(NEOPIXEL_LED) + #define PRINTER_EVENT_LEDS +#endif + +/** + * R/C SERVO support + * Sponsored by TrinityLabs, Reworked by codexmas + */ + +/** + * Number of servos + * + * For some servo-related options NUM_SERVOS will be set automatically. + * Set this manually if there are extra servos needing manual control. + * Leave undefined or set to 0 to entirely disable the servo subsystem. + */ +//#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command + +// Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle. +// 300ms is a good value but you can try less delay. +// If the servo can't reach the requested position, increase it. +#define SERVO_DELAY { 300 } + +// Only power servos during movement, otherwise leave off to prevent jitter +//#define DEACTIVATE_SERVOS_AFTER_MOVE + +// Allow servo angle to be edited and saved to EEPROM +//#define EDITABLE_SERVO_ANGLES diff --git a/Marlin/src/config/examples/delta/Tevo Little Monster/Configuration_adv.h b/Marlin/src/config/examples/delta/Tevo Little Monster/Configuration_adv.h new file mode 100644 index 0000000000..4bbf8210e7 --- /dev/null +++ b/Marlin/src/config/examples/delta/Tevo Little Monster/Configuration_adv.h @@ -0,0 +1,1875 @@ +/** + * 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 . + * + */ +#pragma once + +/** + * Configuration_adv.h + * + * Advanced settings. + * Only change these if you know exactly what you're doing. + * Some of these settings can damage your printer if improperly set! + * + * Basic settings can be found in Configuration.h + * + */ +#define CONFIGURATION_ADV_H_VERSION 020000 + +// @section temperature + +//=========================================================================== +//=============================Thermal Settings ============================ +//=========================================================================== + +// +// Hephestos 2 24V heated bed upgrade kit. +// https://store.bq.com/en/heated-bed-kit-hephestos2 +// +//#define HEPHESTOS2_HEATED_BED_KIT +#if ENABLED(HEPHESTOS2_HEATED_BED_KIT) + #undef TEMP_SENSOR_BED + #define TEMP_SENSOR_BED 70 + #define HEATER_BED_INVERTING true +#endif + +#if DISABLED(PIDTEMPBED) + #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control + #if ENABLED(BED_LIMIT_SWITCHING) + #define BED_HYSTERESIS 2 // Only disable heating if T>target+BED_HYSTERESIS and enable heating if T>target-BED_HYSTERESIS + #endif +#endif + +/** + * Thermal Protection provides additional protection to your printer from damage + * and fire. Marlin always includes safe min and max temperature ranges which + * protect against a broken or disconnected thermistor wire. + * + * The issue: If a thermistor falls out, it will report the much lower + * temperature of the air in the room, and the the firmware will keep + * the heater on. + * + * The solution: Once the temperature reaches the target, start observing. + * If the temperature stays too far below the target (hysteresis) for too + * long (period), the firmware will halt the machine as a safety precaution. + * + * If you get false positives for "Thermal Runaway", increase + * THERMAL_PROTECTION_HYSTERESIS and/or THERMAL_PROTECTION_PERIOD + */ +#if ENABLED(THERMAL_PROTECTION_HOTENDS) + #define THERMAL_PROTECTION_PERIOD 60 // Seconds + #define THERMAL_PROTECTION_HYSTERESIS 10 // Degrees Celsius + + /** + * Whenever an M104, M109, or M303 increases the target temperature, the + * firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature + * hasn't increased by WATCH_TEMP_INCREASE degrees, the machine is halted and + * requires a hard reset. This test restarts with any M104/M109/M303, but only + * if the current temperature is far enough below the target for a reliable + * test. + * + * If you get false positives for "Heating failed", increase WATCH_TEMP_PERIOD + * and/or decrease WATCH_TEMP_INCREASE. WATCH_TEMP_INCREASE should not be set + * below 2. + */ + #define WATCH_TEMP_PERIOD 20 // Seconds + #define WATCH_TEMP_INCREASE 2 // Degrees Celsius +#endif + +/** + * Thermal Protection parameters for the bed are just as above for hotends. + */ +#if ENABLED(THERMAL_PROTECTION_BED) + #define THERMAL_PROTECTION_BED_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_BED_HYSTERESIS 2 // Degrees Celsius + + /** + * As described above, except for the bed (M140/M190/M303). + */ + #define WATCH_BED_TEMP_PERIOD 60 // Seconds + #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius +#endif + +#if ENABLED(PIDTEMP) + // this adds an experimental additional term to the heating power, proportional to the extrusion speed. + // if Kc is chosen well, the additional required power due to increased melting should be compensated. + //#define PID_EXTRUSION_SCALING + #if ENABLED(PID_EXTRUSION_SCALING) + #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) + #define LPQ_MAX_LEN 50 + #endif +#endif + +/** + * Automatic Temperature: + * The hotend target temperature is calculated by all the buffered lines of gcode. + * The maximum buffered steps/sec of the extruder motor is called "se". + * Start autotemp mode with M109 S B F + * The target temperature is set to mintemp+factor*se[steps/sec] and is limited by + * mintemp and maxtemp. Turn this off by executing M109 without F* + * Also, if the temperature is set to a value below mintemp, it will not be changed by autotemp. + * On an Ultimaker, some initial testing worked with M109 S215 B260 F1 in the start.gcode + */ +#define AUTOTEMP +#if ENABLED(AUTOTEMP) + #define AUTOTEMP_OLDWEIGHT 0.98 +#endif + +// Show extra position information in M114 +//#define M114_DETAIL + +// Show Temperature ADC value +// Enable for M105 to include ADC values read from temperature sensors. +//#define SHOW_TEMP_ADC_VALUES + +/** + * High Temperature Thermistor Support + * + * Thermistors able to support high temperature tend to have a hard time getting + * good readings at room and lower temperatures. This means HEATER_X_RAW_LO_TEMP + * will probably be caught when the heating element first turns on during the + * preheating process, which will trigger a min_temp_error as a safety measure + * and force stop everything. + * To circumvent this limitation, we allow for a preheat time (during which, + * min_temp_error won't be triggered) and add a min_temp buffer to handle + * aberrant readings. + * + * If you want to enable this feature for your hotend thermistor(s) + * uncomment and set values > 0 in the constants below + */ + +// The number of consecutive low temperature errors that can occur +// before a min_temp_error is triggered. (Shouldn't be more than 10.) +//#define MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED 0 + +// The number of milliseconds a hotend will preheat before starting to check +// the temperature. This value should NOT be set to the time it takes the +// hot end to reach the target temperature, but the time it takes to reach +// the minimum temperature your thermistor can read. The lower the better/safer. +// This shouldn't need to be more than 30 seconds (30000) +//#define MILLISECONDS_PREHEAT_TIME 0 + +// @section extruder + +// Extruder runout prevention. +// If the machine is idle and the temperature over MINTEMP +// then extrude some filament every couple of SECONDS. +//#define EXTRUDER_RUNOUT_PREVENT +#if ENABLED(EXTRUDER_RUNOUT_PREVENT) + #define EXTRUDER_RUNOUT_MINTEMP 190 + #define EXTRUDER_RUNOUT_SECONDS 30 + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) +#endif + +// @section temperature + +// Calibration for AD595 / AD8495 sensor to adjust temperature measurements. +// The final temperature is calculated as (measuredTemp * GAIN) + OFFSET. +#define TEMP_SENSOR_AD595_OFFSET 0.0 +#define TEMP_SENSOR_AD595_GAIN 1.0 +#define TEMP_SENSOR_AD8495_OFFSET 0.0 +#define TEMP_SENSOR_AD8495_GAIN 1.0 + +/** + * Controller Fan + * To cool down the stepper drivers and MOSFETs. + * + * The fan will turn on automatically whenever any stepper is enabled + * and turn off after a set period after all steppers are turned off. + */ +//#define USE_CONTROLLER_FAN +#if ENABLED(USE_CONTROLLER_FAN) + //#define CONTROLLER_FAN_PIN -1 // Set a custom pin for the controller fan + #define CONTROLLERFAN_SECS 60 // Duration in seconds for the fan to run after all motors are disabled + #define CONTROLLERFAN_SPEED 255 // 255 == full speed +#endif + +// When first starting the main fan, run it at full speed for the +// given number of milliseconds. This gets the fan spinning reliably +// before setting a PWM value. (Does not work with software PWM for fan on Sanguinololu) +//#define FAN_KICKSTART_TIME 100 + +/** + * PWM Fan Scaling + * + * Define the min/max speeds for PWM fans (as set with M106). + * + * With these options the M106 0-255 value range is scaled to a subset + * to ensure that the fan has enough power to spin, or to run lower + * current fans with higher current. (e.g., 5V/12V fans with 12V/24V) + * Value 0 always turns off the fan. + * + * Define one or both of these to override the default 0-255 range. + */ +//#define FAN_MIN_PWM 50 +//#define FAN_MAX_PWM 128 + +// @section extruder + +/** + * Extruder cooling fans + * + * Extruder auto fans automatically turn on when their extruders' + * temperatures go above EXTRUDER_AUTO_FAN_TEMPERATURE. + * + * Your board's pins file specifies the recommended pins. Override those here + * or set to -1 to disable completely. + * + * Multiple extruders can be assigned to the same pin in which case + * the fan will turn on when any selected extruder is above the threshold. + */ +#define E0_AUTO_FAN_PIN MOSFET_D_PIN +#define E1_AUTO_FAN_PIN -1 +#define E2_AUTO_FAN_PIN -1 +#define E3_AUTO_FAN_PIN -1 +#define E4_AUTO_FAN_PIN -1 +#define E5_AUTO_FAN_PIN -1 +#define CHAMBER_AUTO_FAN_PIN -1 +#define EXTRUDER_AUTO_FAN_TEMPERATURE 50 +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed + +/** + * Part-Cooling Fan Multiplexer + * + * This feature allows you to digitally multiplex the fan output. + * The multiplexer is automatically switched at tool-change. + * Set FANMUX[012]_PINs below for up to 2, 4, or 8 multiplexed fans. + */ +#define FANMUX0_PIN -1 +#define FANMUX1_PIN -1 +#define FANMUX2_PIN -1 + +/** + * M355 Case Light on-off / brightness + */ +//#define CASE_LIGHT_ENABLE +#if ENABLED(CASE_LIGHT_ENABLE) + //#define CASE_LIGHT_PIN 4 // Override the default pin if needed + #define INVERT_CASE_LIGHT false // Set true if Case Light is ON when pin is LOW + #define CASE_LIGHT_DEFAULT_ON true // Set default power-up state on + #define CASE_LIGHT_DEFAULT_BRIGHTNESS 105 // Set default power-up brightness (0-255, requires PWM pin) + //#define MENU_ITEM_CASE_LIGHT // Add a Case Light option to the LCD main menu + //#define CASE_LIGHT_USE_NEOPIXEL // Use Neopixel LED as case light, requires NEOPIXEL_LED. + #if ENABLED(CASE_LIGHT_USE_NEOPIXEL) + #define CASE_LIGHT_NEOPIXEL_COLOR { 255, 255, 255, 255 } // { Red, Green, Blue, White } + #endif +#endif + +//=========================================================================== +//============================ Mechanical Settings ========================== +//=========================================================================== + +// @section homing + +// If you want endstops to stay on (by default) even when not homing +// enable this option. Override at any time with M120, M121. +//#define ENDSTOPS_ALWAYS_ON_DEFAULT + +// @section extras + +//#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats. + +// Employ an external closed loop controller. Override pins here if needed. +//#define EXTERNAL_CLOSED_LOOP_CONTROLLER +#if ENABLED(EXTERNAL_CLOSED_LOOP_CONTROLLER) + //#define CLOSED_LOOP_ENABLE_PIN -1 + //#define CLOSED_LOOP_MOVE_COMPLETE_PIN -1 +#endif + +/** + * Dual Steppers / Dual Endstops + * + * This section will allow you to use extra E drivers to drive a second motor for X, Y, or Z axes. + * + * For example, set X_DUAL_STEPPER_DRIVERS setting to use a second motor. If the motors need to + * spin in opposite directions set INVERT_X2_VS_X_DIR. If the second motor needs its own endstop + * set X_DUAL_ENDSTOPS. This can adjust for "racking." Use X2_USE_ENDSTOP to set the endstop plug + * that should be used for the second endstop. Extra endstops will appear in the output of 'M119'. + * + * Use X_DUAL_ENDSTOP_ADJUSTMENT to adjust for mechanical imperfection. After homing both motors + * this offset is applied to the X2 motor. To find the offset home the X axis, and measure the error + * in X2. Dual endstop offsets can be set at runtime with 'M666 X Y Z'. + */ + +//#define X_DUAL_STEPPER_DRIVERS +#if ENABLED(X_DUAL_STEPPER_DRIVERS) + #define INVERT_X2_VS_X_DIR true // Set 'true' if X motors should rotate in opposite directions + //#define X_DUAL_ENDSTOPS + #if ENABLED(X_DUAL_ENDSTOPS) + #define X2_USE_ENDSTOP _XMAX_ + #define X_DUAL_ENDSTOPS_ADJUSTMENT 0 + #endif +#endif + +//#define Y_DUAL_STEPPER_DRIVERS +#if ENABLED(Y_DUAL_STEPPER_DRIVERS) + #define INVERT_Y2_VS_Y_DIR true // Set 'true' if Y motors should rotate in opposite directions + //#define Y_DUAL_ENDSTOPS + #if ENABLED(Y_DUAL_ENDSTOPS) + #define Y2_USE_ENDSTOP _YMAX_ + #define Y_DUAL_ENDSTOPS_ADJUSTMENT 0 + #endif +#endif + +//#define Z_DUAL_STEPPER_DRIVERS +#if ENABLED(Z_DUAL_STEPPER_DRIVERS) + //#define Z_DUAL_ENDSTOPS + #if ENABLED(Z_DUAL_ENDSTOPS) + #define Z2_USE_ENDSTOP _XMAX_ + #define Z_DUAL_ENDSTOPS_ADJUSTMENT 0 + #endif +#endif + +//#define Z_TRIPLE_STEPPER_DRIVERS +#if ENABLED(Z_TRIPLE_STEPPER_DRIVERS) + //#define Z_TRIPLE_ENDSTOPS + #if ENABLED(Z_TRIPLE_ENDSTOPS) + #define Z2_USE_ENDSTOP _XMAX_ + #define Z3_USE_ENDSTOP _YMAX_ + #define Z_TRIPLE_ENDSTOPS_ADJUSTMENT2 0 + #define Z_TRIPLE_ENDSTOPS_ADJUSTMENT3 0 + #endif +#endif + +/** + * Dual X Carriage + * + * This setup has two X carriages that can move independently, each with its own hotend. + * The carriages can be used to print an object with two colors or materials, or in + * "duplication mode" it can print two identical or X-mirrored objects simultaneously. + * The inactive carriage is parked automatically to prevent oozing. + * X1 is the left carriage, X2 the right. They park and home at opposite ends of the X axis. + * By default the X2 stepper is assigned to the first unused E plug on the board. + */ +//#define DUAL_X_CARRIAGE +#if ENABLED(DUAL_X_CARRIAGE) + #define X1_MIN_POS X_MIN_POS // set minimum to ensure first x-carriage doesn't hit the parked second X-carriage + #define X1_MAX_POS X_BED_SIZE // set maximum to ensure first x-carriage doesn't hit the parked second X-carriage + #define X2_MIN_POS 80 // set minimum to ensure second x-carriage doesn't hit the parked first X-carriage + #define X2_MAX_POS 353 // set maximum to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // the second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // default home position is the maximum carriage position + // However: In this mode the HOTEND_OFFSET_X value for the second extruder provides a software + // override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops + // without modifying the firmware (through the "M218 T1 X???" command). + // Remember: you should set the second extruder x-offset to 0 in your slicer. + + // There are a few selectable movement modes for dual x-carriages using M605 S + // Mode 0 (DXC_FULL_CONTROL_MODE): 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 S0) + // Mode 1 (DXC_AUTO_PARK_MODE) : Auto-park mode. The firmware will automatically park and unpark the x-carriages on tool changes so + // that additional slicer support is not required. (M605 S1) + // Mode 2 (DXC_DUPLICATION_MODE) : Duplication mode. The firmware will transparently make the second x-carriage and extruder copy all + // actions of the first x-carriage. This allows the printer to print 2 arbitrary items at + // once. (2nd extruder x offset and temp offset are set using: M605 S2 [Xnnn] [Rmmm]) + + // This is the default power-up mode which can be later using M605. + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + + // Default x offset in duplication mode (typically set to half print bed width) + #define DEFAULT_DUPLICATION_X_OFFSET 100 + +#endif // DUAL_X_CARRIAGE + +// Activate a solenoid on the active extruder with M380. Disable all with M381. +// Define SOL0_PIN, SOL1_PIN, etc., for each extruder that has a solenoid. +//#define EXT_SOLENOID + +// @section homing + +// Homing hits each endstop, retracts by these distances, then does a slower bump. +#define X_HOME_BUMP_MM 5 +#define Y_HOME_BUMP_MM 5 +#define Z_HOME_BUMP_MM 5 // deltas need the same for all three axes +#define HOMING_BUMP_DIVISOR { 10, 10, 10 } // Re-Bump Speed Divisor (Divides the Homing Feedrate) +//#define QUICK_HOME // If homing includes X and Y, do a diagonal move initially + +// When G28 is called, this option will make Y home before X +//#define HOME_Y_BEFORE_X + +// Enable this if X or Y can't home without homing the other axis first. +//#define CODEPENDENT_XY_HOMING + +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + +// @section machine + +#define AXIS_RELATIVE_MODES {false, false, false, false} + +// Allow duplication mode with a basic dual-nozzle extruder +//#define DUAL_NOZZLE_DUPLICATION_MODE + +// By default pololu step drivers require an active high signal. However, some high power drivers require an active low signal as step. +#define INVERT_X_STEP_PIN false +#define INVERT_Y_STEP_PIN false +#define INVERT_Z_STEP_PIN false +#define INVERT_E_STEP_PIN false + +// Default stepper release if idle. Set to 0 to deactivate. +// Steppers will shut down DEFAULT_STEPPER_DEACTIVE_TIME seconds after the last move when DISABLE_INACTIVE_? is true. +// Time can be set by M18 and M84. +#define DEFAULT_STEPPER_DEACTIVE_TIME 0 +#define DISABLE_INACTIVE_X true +#define DISABLE_INACTIVE_Y true +#define DISABLE_INACTIVE_Z true // set to false if the nozzle will fall down on your printed part when print has finished. +#define DISABLE_INACTIVE_E true + +#define DEFAULT_MINIMUMFEEDRATE 0.0 // minimum feedrate +#define DEFAULT_MINTRAVELFEEDRATE 0.0 + +//#define HOME_AFTER_DEACTIVATE // Require rehoming after steppers are deactivated + +// @section lcd + +#if ENABLED(ULTIPANEL) + #define MANUAL_FEEDRATE_XYZ 50*60 + #define MANUAL_FEEDRATE { MANUAL_FEEDRATE_XYZ, MANUAL_FEEDRATE_XYZ, MANUAL_FEEDRATE_XYZ, 60 } // Feedrates for manual moves along X, Y, Z, E from panel + #define MANUAL_E_MOVES_RELATIVE // Show LCD extruder moves as relative rather than absolute positions + #define ULTIPANEL_FEEDMULTIPLY // Comment to disable setting feedrate multiplier via encoder +#endif + +// @section extras + +// minimum time in microseconds that a movement needs to take if the buffer is emptied. +#define DEFAULT_MINSEGMENTTIME 20000 + +// If defined the movements slow down when the look ahead buffer is only half full +// (don't use SLOWDOWN with DELTA because DELTA generates hundreds of segments per second) +//#define SLOWDOWN + +// Frequency limit +// See nophead's blog for more info +// Not working O +//#define XY_FREQUENCY_LIMIT 15 + +// Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end +// of the buffer and all stops. This should not be much greater than zero and should only be changed +// if unwanted behavior is observed on a user's machine when running at very slow speeds. +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) + +// +// Use Junction Deviation instead of traditional Jerk Limiting +// +//#define JUNCTION_DEVIATION +#if ENABLED(JUNCTION_DEVIATION) + #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +#endif + +/** + * Adaptive Step Smoothing increases the resolution of multi-axis moves, particularly at step frequencies + * below 1kHz (for AVR) or 10kHz (for ARM), where aliasing between axes in multi-axis moves causes audible + * vibration and surface artifacts. The algorithm adapts to provide the best possible step smoothing at the + * lowest stepping frequencies. + */ +//#define ADAPTIVE_STEP_SMOOTHING + +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + +// Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. +#define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] + +/** + * @section stepper motor current + * + * Some boards have a means of setting the stepper motor current via firmware. + * + * The power on motor currents are set by: + * PWM_MOTOR_CURRENT - used by MINIRAMBO & ULTIMAIN_2 + * known compatible chips: A4982 + * DIGIPOT_MOTOR_CURRENT - used by BQ_ZUM_MEGA_3D, RAMBO & SCOOVO_X9H + * known compatible chips: AD5206 + * DAC_MOTOR_CURRENT_DEFAULT - used by PRINTRBOARD_REVF & RIGIDBOARD_V2 + * known compatible chips: MCP4728 + * DIGIPOT_I2C_MOTOR_CURRENTS - used by 5DPRINT, AZTEEG_X3_PRO, AZTEEG_X5_MINI_WIFI, MIGHTYBOARD_REVE + * known compatible chips: MCP4451, MCP4018 + * + * Motor currents can also be set by M907 - M910 and by the LCD. + * M907 - applies to all. + * M908 - BQ_ZUM_MEGA_3D, RAMBO, PRINTRBOARD_REVF, RIGIDBOARD_V2 & SCOOVO_X9H + * M909, M910 & LCD - only PRINTRBOARD_REVF & RIGIDBOARD_V2 + */ +//#define PWM_MOTOR_CURRENT { 1300, 1300, 1250 } // Values in milliamps +//#define DIGIPOT_MOTOR_CURRENT { 135,135,135,135,135 } // Values 0-255 (RAMBO 135 = ~0.75A, 185 = ~1A) +//#define DAC_MOTOR_CURRENT_DEFAULT { 70, 80, 90, 80 } // Default drive percent - X, Y, Z, E axis + +// Use an I2C based DIGIPOT (e.g., Azteeg X3 Pro) +//#define DIGIPOT_I2C +#if ENABLED(DIGIPOT_I2C) && !defined(DIGIPOT_I2C_ADDRESS_A) + /** + * Common slave addresses: + * + * A (A shifted) B (B shifted) IC + * Smoothie 0x2C (0x58) 0x2D (0x5A) MCP4451 + * AZTEEG_X3_PRO 0x2C (0x58) 0x2E (0x5C) MCP4451 + * AZTEEG_X5_MINI_WIFI 0x58 0x5C MCP4451 + * MIGHTYBOARD_REVE 0x2F (0x5E) MCP4018 + */ + #define DIGIPOT_I2C_ADDRESS_A 0x2C // unshifted slave address for first DIGIPOT + #define DIGIPOT_I2C_ADDRESS_B 0x2D // unshifted slave address for second DIGIPOT +#endif + +//#define DIGIPOT_MCP4018 // Requires library from https://github.com/stawel/SlowSoftI2CMaster +#define DIGIPOT_I2C_NUM_CHANNELS 8 // 5DPRINT: 4 AZTEEG_X3_PRO: 8 MKS SBASE: 5 +// Actual motor currents in Amps. The number of entries must match DIGIPOT_I2C_NUM_CHANNELS. +// These correspond to the physical drivers, so be mindful if the order is changed. +#define DIGIPOT_I2C_MOTOR_CURRENTS { 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 } // AZTEEG_X3_PRO + +//=========================================================================== +//=============================Additional Features=========================== +//=========================================================================== + +// @section lcd + +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + +// Include a page of printer information in the LCD Main Menu +//#define LCD_INFO_MENU + +// Scroll a longer status message into view +//#define STATUS_MESSAGE_SCROLLING + +// On the Info Screen, display XY with one decimal place when possible +//#define LCD_DECIMAL_SMALL_XY + +// The timeout (in ms) to return to the status screen from sub-menus +//#define LCD_TIMEOUT_TO_STATUS 15000 + +// Add an 'M73' G-code to set the current percentage +//#define LCD_SET_PROGRESS_MANUALLY + +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS + //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing + #if ENABLED(LCD_PROGRESS_BAR) + #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar + #define PROGRESS_BAR_MSG_TIME 3000 // (ms) Amount of time to show the status message + #define PROGRESS_MSG_EXPIRE 0 // (ms) Amount of time to retain the status message (0=forever) + //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it + //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar + #endif +#endif // HAS_PRINT_PROGRESS + +/** + * LED Control Menu + * Enable this feature to add LED Control to the LCD menu + */ +//#define LED_CONTROL_MENU +#if ENABLED(LED_CONTROL_MENU) + #define LED_COLOR_PRESETS // Enable the Preset Color menu option + #if ENABLED(LED_COLOR_PRESETS) + #define LED_USER_PRESET_RED 255 // User defined RED value + #define LED_USER_PRESET_GREEN 128 // User defined GREEN value + #define LED_USER_PRESET_BLUE 0 // User defined BLUE value + #define LED_USER_PRESET_WHITE 255 // User defined WHITE value + #define LED_USER_PRESET_BRIGHTNESS 255 // User defined intensity + //#define LED_USER_PRESET_STARTUP // Have the printer display the user preset color on startup + #endif +#endif // LED_CONTROL_MENU + +#if ENABLED(SDSUPPORT) + + // Some RAMPS and other boards don't detect when an SD card is inserted. You can work + // around this by connecting a push button or single throw switch to the pin defined + // as SD_DETECT_PIN in your board's pins definitions. + // This setting should be disabled unless you are using a push button, pulling the pin to ground. + // Note: This is always disabled for ULTIPANEL (except ELB_FULL_GRAPHIC_CONTROLLER). + #define SD_DETECT_INVERTED + + #define SD_FINISHED_STEPPERRELEASE false // Disable steppers when SD Print is finished + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. + + // Reverse SD sort to show "more recent" files first, according to the card's FAT. + // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. + #define SDCARD_RATHERRECENTFIRST + + // Add an option in the menu to run all auto#.g files + //#define MENU_ADDAUTOSTART + + /** + * Continue after Power-Loss (Creality3D) + * + * Store the current state to the SD Card at the start of each layer + * during SD printing. If the recovery file is found at boot time, present + * an option on the LCD screen to continue the print from the last-known + * point in the file. + */ + //#define POWER_LOSS_RECOVERY + #if ENABLED(POWER_LOSS_RECOVERY) + //#define POWER_LOSS_PIN 44 // Pin to detect power loss + //#define POWER_LOSS_STATE HIGH // State of pin indicating power loss + #endif + + /** + * Sort SD file listings in alphabetical order. + * + * With this option enabled, items on SD cards will be sorted + * by name for easier navigation. + * + * By default... + * + * - Use the slowest -but safest- method for sorting. + * - Folders are sorted to the top. + * - The sort key is statically allocated. + * - No added G-code (M34) support. + * - 40 item sorting limit. (Items after the first 40 are unsorted.) + * + * SD sorting uses static allocation (as set by SDSORT_LIMIT), allowing the + * compiler to calculate the worst-case usage and throw an error if the SRAM + * limit is exceeded. + * + * - SDSORT_USES_RAM provides faster sorting via a static directory buffer. + * - SDSORT_USES_STACK does the same, but uses a local stack-based buffer. + * - SDSORT_CACHE_NAMES will retain the sorted file listing in RAM. (Expensive!) + * - SDSORT_DYNAMIC_RAM only uses RAM when the SD menu is visible. (Use with caution!) + */ + //#define SDCARD_SORT_ALPHA + + // SD Card Sorting options + #if ENABLED(SDCARD_SORT_ALPHA) + #define SDSORT_LIMIT 40 // Maximum number of sorted items (10-256). Costs 27 bytes each. + #define FOLDER_SORTING -1 // -1=above 0=none 1=below + #define SDSORT_GCODE false // Allow turning sorting on/off with LCD and M34 g-code. + #define SDSORT_USES_RAM false // Pre-allocate a static array for faster pre-sorting. + #define SDSORT_USES_STACK false // Prefer the stack for pre-sorting to give back some SRAM. (Negated by next 2 options.) + #define SDSORT_CACHE_NAMES false // Keep sorted items in RAM longer for speedy performance. Most expensive option. + #define SDSORT_DYNAMIC_RAM false // Use dynamic allocation (within SD menus). Least expensive option. Set SDSORT_LIMIT before use! + #define SDSORT_CACHE_VFATS 2 // Maximum number of 13-byte VFAT entries to use for sorting. + // Note: Only affects SCROLL_LONG_FILENAMES with SDSORT_CACHE_NAMES but not SDSORT_DYNAMIC_RAM. + #endif + + // This allows hosts to request long names for files and folders with M33 + //#define LONG_FILENAME_HOST_SUPPORT + + // Enable this option to scroll long filenames in the SD card menu + //#define SCROLL_LONG_FILENAMES + + /** + * This option allows you to abort SD printing when any endstop is triggered. + * This feature must be enabled with "M540 S1" or from the LCD menu. + * To have any effect, endstops must be enabled during SD printing. + */ + //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED + + /** + * This option makes it easier to print the same SD Card file again. + * On print completion the LCD Menu will open with the file selected. + * You can just click to start the print, or navigate elsewhere. + */ + //#define SD_REPRINT_LAST_SELECTED_FILE + + /** + * Auto-report SdCard status with M27 S + */ + //#define AUTO_REPORT_SD_STATUS + + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + +#endif // SDSUPPORT + +/** + * Additional options for Graphical Displays + * + * Use the optimizations here to improve printing performance, + * which can be adversely affected by graphical display drawing, + * especially when doing several short moves, and when printing + * on DELTA and SCARA machines. + * + * Some of these options may result in the display lagging behind + * controller events, as there is a trade-off between reliable + * printing performance versus fast display updates. + */ +#if HAS_GRAPHICAL_LCD + // Show SD percentage next to the progress bar + //#define DOGM_SD_PERCENT + + // Enable to save many cycles by drawing a hollow frame on the Info Screen + #define XYZ_HOLLOW_FRAME + + // Enable to save many cycles by drawing a hollow frame on Menu Screens + #define MENU_HOLLOW_FRAME + + // A bigger font is available for edit items. Costs 3120 bytes of PROGMEM. + // Western only. Not available for Cyrillic, Kana, Turkish, Greek, or Chinese. + //#define USE_BIG_EDIT_FONT + + // A smaller font may be used on the Info Screen. Costs 2300 bytes of PROGMEM. + // Western only. Not available for Cyrillic, Kana, Turkish, Greek, or Chinese. + //#define USE_SMALL_INFOFONT + + // Enable this option and reduce the value to optimize screen updates. + // The normal delay is 10µs. Use the lowest value that still gives a reliable display. + //#define DOGM_SPI_DELAY_US 5 + + // Swap the CW/CCW indicators in the graphics overlay + //#define OVERLAY_GFX_REVERSE + + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + * + * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. + * This will prevent position updates from being displayed. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + +#endif // DOGLCD + +// @section safety + +// The hardware watchdog should reset the microcontroller disabling all outputs, +// in case the firmware gets stuck and doesn't do temperature regulation. +#define USE_WATCHDOG + +#if ENABLED(USE_WATCHDOG) + // If you have a watchdog reboot in an ArduinoMega2560 then the device will hang forever, as a watchdog reset will leave the watchdog on. + // The "WATCHDOG_RESET_MANUAL" goes around this by not using the hardware reset. + // However, THIS FEATURE IS UNSAFE!, as it will only work if interrupts are disabled. And the code could hang in an interrupt routine with interrupts disabled. + //#define WATCHDOG_RESET_MANUAL +#endif + +// @section lcd + +/** + * Babystepping enables movement of the axes by tiny increments without changing + * the current position values. This feature is used primarily to adjust the Z + * axis in the first layer of a print in real-time. + * + * Warning: Does not respect endstops! + */ +//#define BABYSTEPPING +#if ENABLED(BABYSTEPPING) + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. + + //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping + #if ENABLED(BABYSTEP_ZPROBE_OFFSET) + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + #endif +#endif + +// @section extruder + +/** + * Linear Pressure Control v1.5 + * + * Assumption: advance [steps] = k * (delta velocity [steps/s]) + * K=0 means advance disabled. + * + * NOTE: K values for LIN_ADVANCE 1.5 differ from earlier versions! + * + * Set K around 0.22 for 3mm PLA Direct Drive with ~6.5cm between the drive gear and heatbreak. + * Larger K values will be needed for flexible filament and greater distances. + * If this algorithm produces a higher speed offset than the extruder can handle (compared to E jerk) + * print acceleration will be reduced during the affected moves to keep within the limit. + * + * See http://marlinfw.org/docs/features/lin_advance.html for full instructions. + * Mention @Sebastianv650 on GitHub to alert the author of any issues. + */ +//#define LIN_ADVANCE +#if ENABLED(LIN_ADVANCE) + #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed + //#define LA_DEBUG // If enabled, this will generate debug information output over USB. +#endif + +// @section leveling + +#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_UBL) + // Override the mesh area if the automatic (max) area is too large + //#define MESH_MIN_X MESH_INSET + //#define MESH_MIN_Y MESH_INSET + //#define MESH_MAX_X X_BED_SIZE - (MESH_INSET) + //#define MESH_MAX_Y Y_BED_SIZE - (MESH_INSET) +#endif + +/** + * Repeatedly attempt G29 leveling until it succeeds. + * Stop after G29_MAX_RETRIES attempts. + */ +//#define G29_RETRY_AND_RECOVER +#if ENABLED(G29_RETRY_AND_RECOVER) + #define G29_MAX_RETRIES 3 + #define G29_HALT_ON_FAILURE + /** + * Specify the GCODE commands that will be executed when leveling succeeds, + * between attempts, and after the maximum number of retries have been tried. + */ + #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." + #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" + #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" + /** + * Specify an action command to send to the host on a recovery attempt or failure. + * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. + * The host must be configured to handle the action command. + */ + #define G29_ACTION_ON_RECOVER "probe_rewipe" + #define G29_ACTION_ON_FAILURE "probe_failed" +#endif + +// @section extras + +// +// G2/G3 Arc Support +// +#define ARC_SUPPORT // Disable this feature to save ~3226 bytes +#if ENABLED(ARC_SUPPORT) + #define MM_PER_ARC_SEGMENT 1 // Length of each arc segment + #define N_ARC_CORRECTION 25 // Number of intertpolated segments between corrections + //#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles + //#define CNC_WORKSPACE_PLANES // Allow G2/G3 to operate in XY, ZX, or YZ planes +#endif + +// Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes. +//#define BEZIER_CURVE_SUPPORT + +// G38.2 and G38.3 Probe Target +// Set MULTIPLE_PROBING if you want G38 to double touch +//#define G38_PROBE_TARGET +#if ENABLED(G38_PROBE_TARGET) + #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move) +#endif + +// Moves (or segments) with fewer steps than this will be joined with the next move +#define MIN_STEPS_PER_SEGMENT 6 + +/** + * Minimum delay after setting the stepper DIR (in ns) + * 0 : No delay (Expect at least 10µS since one Stepper ISR must transpire) + * 20 : Minimum for TMC2xxx drivers + * 200 : Minimum for A4988 drivers + * 400 : Minimum for A5984 drivers + * 500 : Minimum for LV8729 drivers (guess, no info in datasheet) + * 650 : Minimum for DRV8825 drivers + * 1500 : Minimum for TB6600 drivers (guess, no info in datasheet) + * 15000 : Minimum for TB6560 drivers (guess, no info in datasheet) + * + * Override the default value based on the driver type set in Configuration.h. + */ +//#define MINIMUM_STEPPER_DIR_DELAY 650 + +/** + * Minimum stepper driver pulse width (in µs) + * 0 : Smallest possible width the MCU can produce, compatible with TMC2xxx drivers + * 1 : Minimum for A4988, A5984, and LV8729 stepper drivers + * 2 : Minimum for DRV8825 stepper drivers + * 3 : Minimum for TB6600 stepper drivers + * 30 : Minimum for TB6560 stepper drivers + * + * Override the default value based on the driver type set in Configuration.h. + */ +//#define MINIMUM_STEPPER_PULSE 2 + +/** + * Maximum stepping rate (in Hz) the stepper driver allows + * If undefined, defaults to 1MHz / (2 * MINIMUM_STEPPER_PULSE) + * 500000 : Maximum for A4988 stepper driver + * 400000 : Maximum for TMC2xxx stepper drivers + * 250000 : Maximum for DRV8825 stepper driver + * 150000 : Maximum for TB6600 stepper driver + * 130000 : Maximum for LV8729 stepper driver + * 15000 : Maximum for TB6560 stepper driver + * + * Override the default value based on the driver type set in Configuration.h. + */ +//#define MAXIMUM_STEPPER_RATE 250000 + +// @section temperature + +// Control heater 0 and heater 1 in parallel. +//#define HEATERS_PARALLEL + +//=========================================================================== +//================================= Buffers ================================= +//=========================================================================== + +// @section hidden + +// The number of linear motions that can be in the plan at any give time. +// THE BLOCK_BUFFER_SIZE NEEDS TO BE A POWER OF 2 (e.g. 8, 16, 32) because shifts and ors are used to do the ring-buffering. +#if ENABLED(SDSUPPORT) + #define BLOCK_BUFFER_SIZE 16 // SD,LCD,Buttons take more memory, block buffer needs to be smaller +#else + #define BLOCK_BUFFER_SIZE 16 // maximize block buffer +#endif + +// @section serial + +// The ASCII buffer for serial input +#define MAX_CMD_SIZE 96 +#define BUFSIZE 4 + +// Transmission to Host Buffer Size +// To save 386 bytes of PROGMEM (and TX_BUFFER_SIZE+3 bytes of RAM) set to 0. +// To buffer a simple "ok" you need 4 bytes. +// For ADVANCED_OK (M105) you need 32 bytes. +// For debug-echo: 128 bytes for the optimal speed. +// Other output doesn't need to be that speedy. +// :[0, 2, 4, 8, 16, 32, 64, 128, 256] +#define TX_BUFFER_SIZE 0 + +// Host Receive Buffer Size +// Without XON/XOFF flow control (see SERIAL_XON_XOFF below) 32 bytes should be enough. +// To use flow control, set this buffer size to at least 1024 bytes. +// :[0, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048] +//#define RX_BUFFER_SIZE 1024 + +#if RX_BUFFER_SIZE >= 1024 + // Enable to have the controller send XON/XOFF control characters to + // the host to signal the RX buffer is becoming full. + //#define SERIAL_XON_XOFF +#endif + +#if ENABLED(SDSUPPORT) + // Enable this option to collect and display the maximum + // RX queue usage after transferring a file to SD. + //#define SERIAL_STATS_MAX_RX_QUEUED + + // Enable this option to collect and display the number + // of dropped bytes after a file transfer to SD. + //#define SERIAL_STATS_DROPPED_RX +#endif + +// Enable an emergency-command parser to intercept certain commands as they +// enter the serial receive buffer, so they cannot be blocked. +// Currently handles M108, M112, M410 +// Does not work on boards using AT90USB (USBCON) processors! +//#define EMERGENCY_PARSER + +// Bad Serial-connections can miss a received command by sending an 'ok' +// Therefore some clients abort after 30 seconds in a timeout. +// Some other clients start sending commands while receiving a 'wait'. +// This "wait" is only sent when the buffer is empty. 1 second is a good value here. +//#define NO_TIMEOUTS 1000 // Milliseconds + +// Some clients will have this feature soon. This could make the NO_TIMEOUTS unnecessary. +//#define ADVANCED_OK + +// @section extras + +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + +/** + * Firmware-based and LCD-controlled retract + * + * Add G10 / G11 commands for automatic firmware-based retract / recover. + * Use M207 and M208 to define parameters for retract / recover. + * + * Use M209 to enable or disable auto-retract. + * With auto-retract enabled, all G1 E moves within the set range + * will be converted to firmware-based retract/recover moves. + * + * Be sure to turn off auto-retract during filament change. + * + * Note that M207 / M208 / M209 settings are saved to EEPROM. + * + */ +//#define FWRETRACT +#if ENABLED(FWRETRACT) + #define FWRETRACT_AUTORETRACT // costs ~500 bytes of PROGMEM + #if ENABLED(FWRETRACT_AUTORETRACT) + #define MIN_AUTORETRACT 0.1 // When auto-retract is on, convert E moves of this length and over + #define MAX_AUTORETRACT 10.0 // Upper limit for auto-retract conversion + #endif + #define RETRACT_LENGTH 3 // Default retract length (positive mm) + #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change + #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) + #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) + #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) + #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) + #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif +#endif + +/** + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. + */ +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif + +/** + * Advanced Pause + * Experimental feature for filament change support and for parking the nozzle when paused. + * Adds the GCode M600 for initiating filament change. + * If PARK_HEAD_ON_PAUSE enabled, adds the GCode M125 to pause printing and park the nozzle. + * + * Requires an LCD display. + * Requires NOZZLE_PARK_FEATURE. + * This feature is required for the default FILAMENT_RUNOUT_SCRIPT. + */ +//#define ADVANCED_PAUSE_FEATURE +#if ENABLED(ADVANCED_PAUSE_FEATURE) + #define PAUSE_PARK_RETRACT_FEEDRATE 60 // (mm/s) Initial retract feedrate. + #define PAUSE_PARK_RETRACT_LENGTH 2 // (mm) Initial retract. + // This short retract is done immediately, before parking the nozzle. + #define FILAMENT_CHANGE_UNLOAD_FEEDRATE 10 // (mm/s) Unload filament feedrate. This can be pretty fast. + #define FILAMENT_CHANGE_UNLOAD_ACCEL 25 // (mm/s^2) Lower acceleration may allow a faster feedrate. + #define FILAMENT_CHANGE_UNLOAD_LENGTH 100 // (mm) The length of filament for a complete unload. + // For Bowden, the full length of the tube and nozzle. + // For direct drive, the full length of the nozzle. + // Set to 0 for manual unloading. + #define FILAMENT_CHANGE_SLOW_LOAD_FEEDRATE 6 // (mm/s) Slow move when starting load. + #define FILAMENT_CHANGE_SLOW_LOAD_LENGTH 0 // (mm) Slow length, to allow time to insert material. + // 0 to disable start loading and skip to fast load only + #define FILAMENT_CHANGE_FAST_LOAD_FEEDRATE 6 // (mm/s) Load filament feedrate. This can be pretty fast. + #define FILAMENT_CHANGE_FAST_LOAD_ACCEL 25 // (mm/s^2) Lower acceleration may allow a faster feedrate. + #define FILAMENT_CHANGE_FAST_LOAD_LENGTH 0 // (mm) Load length of filament, from extruder gear to nozzle. + // For Bowden, the full length of the tube and nozzle. + // For direct drive, the full length of the nozzle. + //#define ADVANCED_PAUSE_CONTINUOUS_PURGE // Purge continuously up to the purge length until interrupted. + #define ADVANCED_PAUSE_PURGE_FEEDRATE 3 // (mm/s) Extrude feedrate (after loading). Should be slower than load feedrate. + #define ADVANCED_PAUSE_PURGE_LENGTH 50 // (mm) Length to extrude after loading. + // Set to 0 for manual extrusion. + // Filament can be extruded repeatedly from the Filament Change menu + // until extrusion is consistent, and to purge old filament. + + // Filament Unload does a Retract, Delay, and Purge first: + #define FILAMENT_UNLOAD_RETRACT_LENGTH 13 // (mm) Unload initial retract length. + #define FILAMENT_UNLOAD_DELAY 5000 // (ms) Delay for the filament to cool after retract. + #define FILAMENT_UNLOAD_PURGE_LENGTH 8 // (mm) An unretract is done, then this length is purged. + + #define PAUSE_PARK_NOZZLE_TIMEOUT 45 // (seconds) Time limit before the nozzle is turned off for safety. + #define FILAMENT_CHANGE_ALERT_BEEPS 10 // Number of alert beeps to play when a response is needed. + #define PAUSE_PARK_NO_STEPPER_TIMEOUT // Enable for XYZ steppers to stay powered on during filament change. + + //#define PARK_HEAD_ON_PAUSE // Park the nozzle during pause and filament change. + //#define HOME_BEFORE_FILAMENT_CHANGE // Ensure homing has been completed prior to parking for filament change + + //#define FILAMENT_LOAD_UNLOAD_GCODES // Add M701/M702 Load/Unload G-codes, plus Load/Unload in the LCD Prepare menu. + //#define FILAMENT_UNLOAD_ALL_EXTRUDERS // Allow M702 to unload all extruders above a minimum target temp (as set by M302) +#endif + +// @section tmc + +/** + * TMC26X Stepper Driver options + * + * The TMC26XStepper library is required for this stepper driver. + * https://github.com/trinamic/TMC26XStepper + */ +#if HAS_DRIVER(TMC26X) + + #define X_MAX_CURRENT 1000 // in mA + #define X_SENSE_RESISTOR 91 // in mOhms + #define X_MICROSTEPS 16 // number of microsteps + + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + + #define E5_MAX_CURRENT 1000 + #define E5_SENSE_RESISTOR 91 + #define E5_MICROSTEPS 16 + +#endif // TMC26X + +// @section tmc_smart + +/** + * To use TMC2130 stepper drivers in SPI mode connect your SPI pins to + * the hardware SPI interface on your board and define the required CS pins + * in your `pins_MYBOARD.h` file. (e.g., RAMPS 1.4 uses AUX3 pins `X_CS_PIN 53`, `Y_CS_PIN 49`, etc.). + * You may also use software SPI if you wish to use general purpose IO pins. + * + * The TMC2130Stepper library is required for this stepper driver. + * https://github.com/teemuatlut/TMC2130Stepper + * + * To use TMC2208 stepper UART-configurable stepper drivers + * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN + * to PDN_UART without a resistor. + * The drivers can also be used with hardware serial. + * + * The TMC2208Stepper library is required for this stepper driver. + * https://github.com/teemuatlut/TMC2208Stepper + */ +#if HAS_TRINAMIC + + #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 + #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current + #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 + + #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. + #define X_MICROSTEPS 16 // 0..256 + + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + + #define E1_CURRENT 800 + #define E1_MICROSTEPS 16 + + #define E2_CURRENT 800 + #define E2_MICROSTEPS 16 + + #define E3_CURRENT 800 + #define E3_MICROSTEPS 16 + + #define E4_CURRENT 800 + #define E4_MICROSTEPS 16 + + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + + /** + * Use software SPI for TMC2130. + * The default SW SPI pins are defined the respective pins files, + * but you can override or define them here. + */ + //#define TMC_USE_SW_SPI + //#define TMC_SW_MOSI -1 + //#define TMC_SW_MISO -1 + //#define TMC_SW_SCK -1 + + /** + * Use Trinamic's ultra quiet stepping mode. + * When disabled, Marlin will use spreadCycle stepping mode. + */ + #define STEALTHCHOP + + /** + * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * like overtemperature and short to ground. TMC2208 requires hardware serial. + * In the case of overtemperature Marlin can decrease the driver current until error condition clears. + * Other detected conditions can be used to stop the current print. + * Relevant g-codes: + * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. + * M911 - Report stepper driver overtemperature pre-warn condition. + * M912 - Clear stepper driver overtemperature pre-warn condition flag. + * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + */ + //#define MONITOR_DRIVER_STATUS + + #if ENABLED(MONITOR_DRIVER_STATUS) + #define CURRENT_STEP_DOWN 50 // [mA] + #define REPORT_CURRENT_CHANGE + #define STOP_ON_ERROR + #endif + + /** + * The driver will switch to spreadCycle when stepper speed is over HYBRID_THRESHOLD. + * This mode allows for faster movements at the expense of higher noise levels. + * STEALTHCHOP needs to be enabled. + * M913 X/Y/Z/E to live tune the setting + */ + //#define HYBRID_THRESHOLD + + #define X_HYBRID_THRESHOLD 100 // [mm/s] + #define X2_HYBRID_THRESHOLD 100 + #define Y_HYBRID_THRESHOLD 100 + #define Y2_HYBRID_THRESHOLD 100 + #define Z_HYBRID_THRESHOLD 3 + #define Z2_HYBRID_THRESHOLD 3 + #define Z3_HYBRID_THRESHOLD 3 + #define E0_HYBRID_THRESHOLD 30 + #define E1_HYBRID_THRESHOLD 30 + #define E2_HYBRID_THRESHOLD 30 + #define E3_HYBRID_THRESHOLD 30 + #define E4_HYBRID_THRESHOLD 30 + #define E5_HYBRID_THRESHOLD 30 + + /** + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. + * X, Y, and Z homing will always be done in spreadCycle mode. + * + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. + * Higher values make the system LESS sensitive. + * Lower value make the system MORE sensitive. + * Too low values can lead to false positives, while too high values will collide the axis without triggering. + * It is advised to set X/Y/Z_HOME_BUMP_MM to 0. + * M914 X/Y/Z to live tune the setting + */ + //#define SENSORLESS_HOMING // TMC2130 only + + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 + #endif + + /** + * Enable M122 debugging command for TMC stepper drivers. + * M122 S0/1 will enable continous reporting. + */ + //#define TMC_DEBUG + + /** + * M915 Z Axis Calibration + * + * - Adjust Z stepper current, + * - Drive the Z axis to its physical maximum, and + * - Home Z to account for the lost steps. + * + * Use M915 Snn to specify the current. + * Use M925 Znn to add extra Z height to Z_MAX_POS. + */ + //#define TMC_Z_CALIBRATION + #if ENABLED(TMC_Z_CALIBRATION) + #define CALIBRATION_CURRENT 250 + #define CALIBRATION_EXTRA_HEIGHT 10 + #endif + + /** + * You can set your own advanced settings by filling in predefined functions. + * A list of available functions can be found on the library github page + * https://github.com/teemuatlut/TMC2130Stepper + * https://github.com/teemuatlut/TMC2208Stepper + * + * Example: + * #define TMC_ADV() { \ + * stepperX.diag0_temp_prewarn(1); \ + * stepperY.interpolate(0); \ + * } + */ + #define TMC_ADV() { } + +#endif // HAS_TRINAMIC + +// @section L6470 + +/** + * L6470 Stepper Driver options + * + * The Arduino-L6470 library is required for this stepper driver. + * https://github.com/ameyer/Arduino-L6470 + */ +#if HAS_DRIVER(L6470) + + #define X_MICROSTEPS 16 // number of microsteps + #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off + #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + + #define X2_MICROSTEPS 16 + #define X2_OVERCURRENT 2000 + #define X2_STALLCURRENT 1500 + + #define Y_MICROSTEPS 16 + #define Y_OVERCURRENT 2000 + #define Y_STALLCURRENT 1500 + + #define Y2_MICROSTEPS 16 + #define Y2_OVERCURRENT 2000 + #define Y2_STALLCURRENT 1500 + + #define Z_MICROSTEPS 16 + #define Z_OVERCURRENT 2000 + #define Z_STALLCURRENT 1500 + + #define Z2_MICROSTEPS 16 + #define Z2_OVERCURRENT 2000 + #define Z2_STALLCURRENT 1500 + + #define Z3_MICROSTEPS 16 + #define Z3_OVERCURRENT 2000 + #define Z3_STALLCURRENT 1500 + + #define E0_MICROSTEPS 16 + #define E0_OVERCURRENT 2000 + #define E0_STALLCURRENT 1500 + + #define E1_MICROSTEPS 16 + #define E1_OVERCURRENT 2000 + #define E1_STALLCURRENT 1500 + + #define E2_MICROSTEPS 16 + #define E2_OVERCURRENT 2000 + #define E2_STALLCURRENT 1500 + + #define E3_MICROSTEPS 16 + #define E3_OVERCURRENT 2000 + #define E3_STALLCURRENT 1500 + + #define E4_MICROSTEPS 16 + #define E4_OVERCURRENT 2000 + #define E4_STALLCURRENT 1500 + + #define E5_MICROSTEPS 16 + #define E5_OVERCURRENT 2000 + #define E5_STALLCURRENT 1500 + +#endif // L6470 + +/** + * TWI/I2C BUS + * + * This feature is an EXPERIMENTAL feature so it shall not be used on production + * machines. Enabling this will allow you to send and receive I2C data from slave + * devices on the bus. + * + * ; Example #1 + * ; This macro send the string "Marlin" to the slave device with address 0x63 (99) + * ; It uses multiple M260 commands with one B arg + * M260 A99 ; Target slave address + * M260 B77 ; M + * M260 B97 ; a + * M260 B114 ; r + * M260 B108 ; l + * M260 B105 ; i + * M260 B110 ; n + * M260 S1 ; Send the current buffer + * + * ; Example #2 + * ; Request 6 bytes from slave device with address 0x63 (99) + * M261 A99 B5 + * + * ; Example #3 + * ; Example serial output of a M261 request + * echo:i2c-reply: from:99 bytes:5 data:hello + */ + +// @section i2cbus + +//#define EXPERIMENTAL_I2CBUS +#define I2C_SLAVE_ADDRESS 0 // Set a value from 8 to 127 to act as a slave + +// @section extras + +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + +/** + * Spindle & Laser control + * + * Add the M3, M4, and M5 commands to turn the spindle/laser on and off, and + * to set spindle speed, spindle direction, and laser power. + * + * SuperPid is a router/spindle speed controller used in the CNC milling community. + * Marlin can be used to turn the spindle on and off. It can also be used to set + * the spindle speed from 5,000 to 30,000 RPM. + * + * You'll need to select a pin for the ON/OFF function and optionally choose a 0-5V + * hardware PWM pin for the speed control and a pin for the rotation direction. + * + * See http://marlinfw.org/docs/configuration/laser_spindle.html for more config details. + */ +//#define SPINDLE_LASER_ENABLE +#if ENABLED(SPINDLE_LASER_ENABLE) + + #define SPINDLE_LASER_ENABLE_INVERT false // set to "true" if the on/off function is reversed + #define SPINDLE_LASER_PWM true // set to true if your controller supports setting the speed/power + #define SPINDLE_LASER_PWM_INVERT true // set to "true" if the speed/power goes up when you want it to go slower + #define SPINDLE_LASER_POWERUP_DELAY 5000 // delay in milliseconds to allow the spindle/laser to come up to speed/power + #define SPINDLE_LASER_POWERDOWN_DELAY 5000 // delay in milliseconds to allow the spindle to stop + #define SPINDLE_DIR_CHANGE true // set to true if your spindle controller supports changing spindle direction + #define SPINDLE_INVERT_DIR false + #define SPINDLE_STOP_ON_DIR_CHANGE true // set to true if Marlin should stop the spindle before changing rotation direction + + /** + * The M3 & M4 commands use the following equation to convert PWM duty cycle to speed/power + * + * SPEED/POWER = PWM duty cycle * SPEED_POWER_SLOPE + SPEED_POWER_INTERCEPT + * where PWM duty cycle varies from 0 to 255 + * + * set the following for your controller (ALL MUST BE SET) + */ + + #define SPEED_POWER_SLOPE 118.4 + #define SPEED_POWER_INTERCEPT 0 + #define SPEED_POWER_MIN 5000 + #define SPEED_POWER_MAX 30000 // SuperPID router controller 0 - 30,000 RPM + + //#define SPEED_POWER_SLOPE 0.3922 + //#define SPEED_POWER_INTERCEPT 0 + //#define SPEED_POWER_MIN 10 + //#define SPEED_POWER_MAX 100 // 0-100% +#endif + +/** + * Filament Width Sensor + * + * Measures the filament width in real-time and adjusts + * flow rate to compensate for any irregularities. + * + * Also allows the measured filament diameter to set the + * extrusion rate, so the slicer only has to specify the + * volume. + * + * Only a single extruder is supported at this time. + * + * 34 RAMPS_14 : Analog input 5 on the AUX2 connector + * 81 PRINTRBOARD : Analog input 2 on the Exp1 connector (version B,C,D,E) + * 301 RAMBO : Analog input 3 + * + * Note: May require analog pins to be defined for other boards. + */ +//#define FILAMENT_WIDTH_SENSOR + +#if ENABLED(FILAMENT_WIDTH_SENSOR) + #define FILAMENT_SENSOR_EXTRUDER_NUM 0 // Index of the extruder that has the filament sensor. :[0,1,2,3,4] + #define MEASUREMENT_DELAY_CM 14 // (cm) The distance from the filament sensor to the melting chamber + + #define FILWIDTH_ERROR_MARGIN 1.0 // (mm) If a measurement differs too much from nominal width ignore it + #define MAX_MEASUREMENT_DELAY 20 // (bytes) Buffer size for stored measurements (1 byte per cm). Must be larger than MEASUREMENT_DELAY_CM. + + #define DEFAULT_MEASURED_FILAMENT_DIA DEFAULT_NOMINAL_FILAMENT_DIA // Set measured to nominal initially + + // Display filament width on the LCD status line. Status messages will expire after 5 seconds. + //#define FILAMENT_LCD_DISPLAY +#endif + +/** + * CNC Coordinate Systems + * + * Enables G53 and G54-G59.3 commands to select coordinate systems + * and G92.1 to reset the workspace to native machine space. + */ +//#define CNC_COORDINATE_SYSTEMS + +/** + * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins + */ +//#define PINS_DEBUGGING + +/** + * Auto-report temperatures with M155 S + */ +#define AUTO_REPORT_TEMPERATURES + +/** + * Include capabilities in M115 output + */ +#define EXTENDED_CAPABILITIES_REPORT + +/** + * Disable all Volumetric extrusion options + */ +//#define NO_VOLUMETRICS + +#if DISABLED(NO_VOLUMETRICS) + /** + * Volumetric extrusion default state + * Activate to make volumetric extrusion the default method, + * with DEFAULT_NOMINAL_FILAMENT_DIA as the default diameter. + * + * M200 D0 to disable, M200 Dn to set a new diameter. + */ + //#define VOLUMETRIC_DEFAULT_ON +#endif + +/** + * Enable this option for a leaner build of Marlin that removes all + * workspace offsets, simplifying coordinate transformations, leveling, etc. + * + * - M206 and M428 are disabled. + * - G92 will revert to its behavior from Marlin 1.0. + */ +//#define NO_WORKSPACE_OFFSETS + +/** + * Set the number of proportional font spaces required to fill up a typical character space. + * This can help to better align the output of commands like `G29 O` Mesh Output. + * + * For clients that use a fixed-width font (like OctoPrint), leave this set to 1.0. + * Otherwise, adjust according to your client and font. + */ +#define PROPORTIONAL_FONT_RATIO 1.0 + +/** + * Spend 28 bytes of SRAM to optimize the GCode parser + */ +#define FASTER_GCODE_PARSER + +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * User-defined menu items that execute custom GCode + */ +//#define CUSTOM_USER_MENUS +#if ENABLED(CUSTOM_USER_MENUS) + //#define CUSTOM_USER_MENU_TITLE "Custom Commands" + #define USER_SCRIPT_DONE "M117 User Script Done" + #define USER_SCRIPT_AUDIBLE_FEEDBACK + //#define USER_SCRIPT_RETURN // Return to status screen after a script + + #define USER_DESC_1 "Home & UBL Info" + #define USER_GCODE_1 "G28\nG29 W" + + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL + #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) + + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL + #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) + + #define USER_DESC_4 "Heat Bed/Home/Level" + #define USER_GCODE_4 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nG28\nG29" + + #define USER_DESC_5 "Home & Info" + #define USER_GCODE_5 "G28\nM503" +#endif + +/** + * Specify an action command to send to the host when the printer is killed. + * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. + * The host must be configured to handle the action command. + */ +//#define ACTION_ON_KILL "poweroff" + +/** + * Specify an action command to send to the host on pause and resume. + * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. + * The host must be configured to handle the action command. + */ +//#define ACTION_ON_PAUSE "pause" +//#define ACTION_ON_RESUME "resume" + +//=========================================================================== +//====================== I2C Position Encoder Settings ====================== +//=========================================================================== + +/** + * I2C position encoders for closed loop control. + * Developed by Chris Barr at Aus3D. + * + * Wiki: http://wiki.aus3d.com.au/Magnetic_Encoder + * Github: https://github.com/Aus3D/MagneticEncoder + * + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ + * + * Reilabuild encoders have been modified to improve reliability. + */ + +//#define I2C_POSITION_ENCODERS +#if ENABLED(I2C_POSITION_ENCODERS) + + #define I2CPE_ENCODER_CNT 1 // The number of encoders installed; max of 5 + // encoders supported currently. + + #define I2CPE_ENC_1_ADDR I2CPE_PRESET_ADDR_X // I2C address of the encoder. 30-200. + #define I2CPE_ENC_1_AXIS X_AXIS // Axis the encoder module is installed on. _AXIS. + #define I2CPE_ENC_1_TYPE I2CPE_ENC_TYPE_LINEAR // Type of encoder: I2CPE_ENC_TYPE_LINEAR -or- + // I2CPE_ENC_TYPE_ROTARY. + #define I2CPE_ENC_1_TICKS_UNIT 2048 // 1024 for magnetic strips with 2mm poles; 2048 for + // 1mm poles. For linear encoders this is ticks / mm, + // for rotary encoders this is ticks / revolution. + //#define I2CPE_ENC_1_TICKS_REV (16 * 200) // Only needed for rotary encoders; number of stepper + // steps per full revolution (motor steps/rev * microstepping) + //#define I2CPE_ENC_1_INVERT // Invert the direction of axis travel. + #define I2CPE_ENC_1_EC_METHOD I2CPE_ECM_MICROSTEP // Type of error error correction. + #define I2CPE_ENC_1_EC_THRESH 0.10 // Threshold size for error (in mm) above which the + // printer will attempt to correct the error; errors + // smaller than this are ignored to minimize effects of + // measurement noise / latency (filter). + + #define I2CPE_ENC_2_ADDR I2CPE_PRESET_ADDR_Y // Same as above, but for encoder 2. + #define I2CPE_ENC_2_AXIS Y_AXIS + #define I2CPE_ENC_2_TYPE I2CPE_ENC_TYPE_LINEAR + #define I2CPE_ENC_2_TICKS_UNIT 2048 + //#define I2CPE_ENC_2_TICKS_REV (16 * 200) + //#define I2CPE_ENC_2_INVERT + #define I2CPE_ENC_2_EC_METHOD I2CPE_ECM_MICROSTEP + #define I2CPE_ENC_2_EC_THRESH 0.10 + + #define I2CPE_ENC_3_ADDR I2CPE_PRESET_ADDR_Z // Encoder 3. Add additional configuration options + #define I2CPE_ENC_3_AXIS Z_AXIS // as above, or use defaults below. + + #define I2CPE_ENC_4_ADDR I2CPE_PRESET_ADDR_E // Encoder 4. + #define I2CPE_ENC_4_AXIS E_AXIS + + #define I2CPE_ENC_5_ADDR 34 // Encoder 5. + #define I2CPE_ENC_5_AXIS E_AXIS + + // Default settings for encoders which are enabled, but without settings configured above. + #define I2CPE_DEF_TYPE I2CPE_ENC_TYPE_LINEAR + #define I2CPE_DEF_ENC_TICKS_UNIT 2048 + #define I2CPE_DEF_TICKS_REV (16 * 200) + #define I2CPE_DEF_EC_METHOD I2CPE_ECM_NONE + #define I2CPE_DEF_EC_THRESH 0.1 + + //#define I2CPE_ERR_THRESH_ABORT 100.0 // Threshold size for error (in mm) error on any given + // axis after which the printer will abort. Comment out to + // disable abort behaviour. + + #define I2CPE_TIME_TRUSTED 10000 // After an encoder fault, there must be no further fault + // for this amount of time (in ms) before the encoder + // is trusted again. + + /** + * Position is checked every time a new command is executed from the buffer but during long moves, + * this setting determines the minimum update time between checks. A value of 100 works well with + * error rolling average when attempting to correct only for skips and not for vibration. + */ + #define I2CPE_MIN_UPD_TIME_MS 4 // (ms) Minimum time between encoder checks. + + // Use a rolling average to identify persistant errors that indicate skips, as opposed to vibration and noise. + #define I2CPE_ERR_ROLLING_AVERAGE + +#endif // I2C_POSITION_ENCODERS + +/** + * MAX7219 Debug Matrix + * + * Add support for a low-cost 8x8 LED Matrix based on the Max7219 chip as a realtime status display. + * Requires 3 signal wires. Some useful debug options are included to demonstrate its usage. + */ +//#define MAX7219_DEBUG +#if ENABLED(MAX7219_DEBUG) + #define MAX7219_CLK_PIN 64 + #define MAX7219_DIN_PIN 57 + #define MAX7219_LOAD_PIN 44 + + //#define MAX7219_GCODE // Add the M7219 G-code to control the LED matrix + #define MAX7219_INIT_TEST 2 // Do a test pattern at initialization (Set to 2 for spiral) + #define MAX7219_NUMBER_UNITS 1 // Number of Max7219 units in chain. + #define MAX7219_ROTATE 0 // Rotate the display clockwise (in multiples of +/- 90°) + // connector at: right=0 bottom=-90 top=90 left=180 + //#define MAX7219_REVERSE_ORDER // The individual LED matrix units may be in reversed order + + /** + * Sample debug features + * If you add more debug displays, be careful to avoid conflicts! + */ + #define MAX7219_DEBUG_PRINTER_ALIVE // Blink corner LED of 8x8 matrix to show that the firmware is functioning + #define MAX7219_DEBUG_PLANNER_HEAD 3 // Show the planner queue head position on this and the next LED matrix row + #define MAX7219_DEBUG_PLANNER_TAIL 5 // Show the planner queue tail position on this and the next LED matrix row + + #define MAX7219_DEBUG_PLANNER_QUEUE 0 // Show the current planner queue depth on this and the next LED matrix row + // If you experience stuttering, reboots, etc. this option can reveal how + // tweaks made to the configuration are affecting the printer in real-time. +#endif + +/** + * NanoDLP Sync support + * + * Add support for Synchronized Z moves when using with NanoDLP. G0/G1 axis moves will output "Z_move_comp" + * string to enable synchronization with DLP projector exposure. This change will allow to use + * [[WaitForDoneMessage]] instead of populating your gcode with M400 commands + */ +//#define NANODLP_Z_SYNC +#if ENABLED(NANODLP_Z_SYNC) + //#define NANODLP_ALL_AXIS // Enables "Z_move_comp" output on any axis move. + // Default behaviour is limited to Z axis only. +#endif + +/** + * WiFi Support (Espressif ESP32 WiFi) + */ +//#define WIFISUPPORT +#if ENABLED(WIFISUPPORT) + #define WIFI_SSID "Wifi SSID" + #define WIFI_PWD "Wifi Password" +#endif + +// Enable Marlin dev mode which adds some special commands +//#define MARLIN_DEV_MODE diff --git a/Marlin/src/config/examples/delta/generic/Configuration.h b/Marlin/src/config/examples/delta/generic/Configuration.h index 4072fb57d9..29bb6f54f3 100644 --- a/Marlin/src/config/examples/delta/generic/Configuration.h +++ b/Marlin/src/config/examples/delta/generic/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -552,16 +550,16 @@ #if ENABLED(DELTA_AUTO_CALIBRATION) || ENABLED(DELTA_CALIBRATION_MENU) // Set the radius for the calibration probe points - max DELTA_PRINTABLE_RADIUS for non-eccentric probes - #define DELTA_CALIBRATION_RADIUS 121.5 // mm + #define DELTA_CALIBRATION_RADIUS 121.5 // (mm) // Set the steprate for papertest probing - #define PROBE_MANUALLY_STEP 0.05 // mm + #define PROBE_MANUALLY_STEP 0.05 // (mm) #endif // Print surface diameter/2 minus unreachable space (avoid collisions with vertical towers). - #define DELTA_PRINTABLE_RADIUS 140.0 // mm + #define DELTA_PRINTABLE_RADIUS 140.0 // (mm) // Center-to-center distance of the holes in the diagonal push rods. - #define DELTA_DIAGONAL_ROD 250.0 // mm + #define DELTA_DIAGONAL_ROD 250.0 // (mm) // height from z=0 to home position #define DELTA_HEIGHT 250.00 // get this value from auto calibrate @@ -844,6 +842,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + /** * Allen key retractable z-probe as seen on many Kossel delta printers - http://reprap.org/wiki/Kossel#Automatic_bed_leveling_probe * Deploys by touching z-axis belt. Retracts by pushing the probe down. Uses Z_MIN_PIN. @@ -974,6 +979,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -994,13 +1000,13 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine // Invert the stepper direction. Change (or reverse the motor connector) if an axis goes the wrong way. -#define INVERT_X_DIR false // DELTA does not invert +#define INVERT_X_DIR false #define INVERT_Y_DIR false #define INVERT_Z_DIR false @@ -1020,7 +1026,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -1087,6 +1093,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1257,8 +1275,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1412,10 +1431,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 180 #define PREHEAT_1_TEMP_BED 70 #define PREHEAT_1_FAN_SPEED 255 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 100 #define PREHEAT_2_FAN_SPEED 255 // Value from 0 to 255 @@ -1544,10 +1565,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1575,6 +1596,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1939,6 +1967,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -2095,5 +2132,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/delta/generic/Configuration_adv.h b/Marlin/src/config/examples/delta/generic/Configuration_adv.h index f6b7d871b8..e28e67dda3 100644 --- a/Marlin/src/config/examples/delta/generic/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/generic/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -30,8 +31,6 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -176,8 +175,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -245,7 +244,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -385,10 +384,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -413,6 +408,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -466,7 +482,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -484,6 +500,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] @@ -537,15 +564,15 @@ //=============================Additional Features=========================== //=========================================================================== -#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu //#define LCD_INFO_MENU @@ -561,7 +588,7 @@ // Add an 'M73' G-code to set the current percentage //#define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -570,7 +597,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -599,7 +626,7 @@ #define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -685,6 +712,43 @@ */ //#define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -699,7 +763,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar //#define DOGM_SD_PERCENT @@ -769,16 +833,24 @@ */ //#define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. + + //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -980,6 +1052,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -1005,21 +1086,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -//#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1260,11 +1362,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1273,10 +1375,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1416,6 +1526,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1558,6 +1677,33 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ @@ -1571,10 +1717,10 @@ #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "Preheat for PLA" + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "Preheat for ABS" + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) #define USER_DESC_4 "Heat Bed/Home/Level" @@ -1739,5 +1885,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/examples/delta/kossel_mini/Configuration.h b/Marlin/src/config/examples/delta/kossel_mini/Configuration.h index 5ba3379dcf..8185306dc5 100644 --- a/Marlin/src/config/examples/delta/kossel_mini/Configuration.h +++ b/Marlin/src/config/examples/delta/kossel_mini/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -552,16 +550,16 @@ #if ENABLED(DELTA_AUTO_CALIBRATION) || ENABLED(DELTA_CALIBRATION_MENU) // Set the radius for the calibration probe points - max DELTA_PRINTABLE_RADIUS for non-eccentric probes - #define DELTA_CALIBRATION_RADIUS 78.0 // mm + #define DELTA_CALIBRATION_RADIUS 78.0 // (mm) // Set the steprate for papertest probing - #define PROBE_MANUALLY_STEP 0.05 // mm + #define PROBE_MANUALLY_STEP 0.05 // (mm) #endif // Print surface diameter/2 minus unreachable space (avoid collisions with vertical towers). - #define DELTA_PRINTABLE_RADIUS 90.0 // mm + #define DELTA_PRINTABLE_RADIUS 90.0 // (mm) // Center-to-center distance of the holes in the diagonal push rods. - #define DELTA_DIAGONAL_ROD 215.0 // mm + #define DELTA_DIAGONAL_ROD 215.0 // (mm) // height from z=0 to home position #define DELTA_HEIGHT 250.00 // get this value from auto calibrate @@ -844,6 +842,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + /** * Allen key retractable z-probe as seen on many Kossel delta printers - http://reprap.org/wiki/Kossel#Automatic_bed_leveling_probe * Deploys by touching z-axis belt. Retracts by pushing the probe down. Uses Z_MIN_PIN. @@ -976,6 +981,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -996,13 +1002,13 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine // Invert the stepper direction. Change (or reverse the motor connector) if an axis goes the wrong way. -#define INVERT_X_DIR false // DELTA does not invert +#define INVERT_X_DIR false #define INVERT_Y_DIR false #define INVERT_Z_DIR false @@ -1022,7 +1028,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 15 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 15 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -1089,6 +1095,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1259,8 +1277,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1414,10 +1433,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 180 #define PREHEAT_1_TEMP_BED 70 #define PREHEAT_1_FAN_SPEED 255 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 100 #define PREHEAT_2_FAN_SPEED 255 // Value from 0 to 255 @@ -1546,10 +1567,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1577,6 +1598,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1941,6 +1969,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -2097,5 +2134,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h b/Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h index f6b7d871b8..e28e67dda3 100644 --- a/Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -30,8 +31,6 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -176,8 +175,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -245,7 +244,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -385,10 +384,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -413,6 +408,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -466,7 +482,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -484,6 +500,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] @@ -537,15 +564,15 @@ //=============================Additional Features=========================== //=========================================================================== -#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu //#define LCD_INFO_MENU @@ -561,7 +588,7 @@ // Add an 'M73' G-code to set the current percentage //#define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -570,7 +597,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -599,7 +626,7 @@ #define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -685,6 +712,43 @@ */ //#define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -699,7 +763,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar //#define DOGM_SD_PERCENT @@ -769,16 +833,24 @@ */ //#define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. + + //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -980,6 +1052,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -1005,21 +1086,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -//#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1260,11 +1362,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1273,10 +1375,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1416,6 +1526,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1558,6 +1677,33 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ @@ -1571,10 +1717,10 @@ #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "Preheat for PLA" + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "Preheat for ABS" + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) #define USER_DESC_4 "Heat Bed/Home/Level" @@ -1739,5 +1885,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/examples/delta/kossel_pro/Configuration.h b/Marlin/src/config/examples/delta/kossel_pro/Configuration.h index 3d468b688f..33f43cbeca 100644 --- a/Marlin/src/config/examples/delta/kossel_pro/Configuration.h +++ b/Marlin/src/config/examples/delta/kossel_pro/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Example configuration file for OpenBeam Kossel Pro @@ -39,8 +40,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -207,7 +206,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -224,7 +223,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -538,16 +536,16 @@ #if ENABLED(DELTA_AUTO_CALIBRATION) || ENABLED(DELTA_CALIBRATION_MENU) // Set the radius for the calibration probe points - max DELTA_PRINTABLE_RADIUS for non-eccentric probes - #define DELTA_CALIBRATION_RADIUS 110.0 // mm + #define DELTA_CALIBRATION_RADIUS 110.0 // (mm) // Set the steprate for papertest probing - #define PROBE_MANUALLY_STEP 0.05 // mm + #define PROBE_MANUALLY_STEP 0.05 // (mm) #endif // Print surface diameter/2 minus unreachable space (avoid collisions with vertical towers). - #define DELTA_PRINTABLE_RADIUS 127.0 // mm + #define DELTA_PRINTABLE_RADIUS 127.0 // (mm) // Center-to-center distance of the holes in the diagonal push rods. - #define DELTA_DIAGONAL_ROD 301.0 // mm + #define DELTA_DIAGONAL_ROD 301.0 // (mm) // height from z=0 to home position #define DELTA_HEIGHT 277.00 // get this value from auto calibrate @@ -837,6 +835,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + /** * Allen key retractable z-probe as seen on many Kossel delta printers - http://reprap.org/wiki/Kossel#Automatic_bed_leveling_probe * Deploys by touching z-axis belt. Retracts by pushing the probe down. Uses Z_MIN_PIN. @@ -977,6 +982,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -997,8 +1003,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -1023,7 +1029,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -1090,6 +1096,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1260,8 +1278,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1415,10 +1434,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 180 #define PREHEAT_1_TEMP_BED 70 #define PREHEAT_1_FAN_SPEED 255 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 100 #define PREHEAT_2_FAN_SPEED 255 // Value from 0 to 255 @@ -1547,10 +1568,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1578,6 +1599,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1942,6 +1970,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -2098,5 +2135,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/delta/kossel_xl/Configuration.h b/Marlin/src/config/examples/delta/kossel_xl/Configuration.h index e031868d82..f5aa6b5935 100644 --- a/Marlin/src/config/examples/delta/kossel_xl/Configuration.h +++ b/Marlin/src/config/examples/delta/kossel_xl/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -556,16 +554,16 @@ #if ENABLED(DELTA_AUTO_CALIBRATION) || ENABLED(DELTA_CALIBRATION_MENU) // Set the radius for the calibration probe points - max DELTA_PRINTABLE_RADIUS for non-eccentric probes - #define DELTA_CALIBRATION_RADIUS 121.5 // mm + #define DELTA_CALIBRATION_RADIUS 121.5 // (mm) // Set the steprate for papertest probing - #define PROBE_MANUALLY_STEP 0.05 // mm + #define PROBE_MANUALLY_STEP 0.05 // (mm) #endif // Print surface diameter/2 minus unreachable space (avoid collisions with vertical towers). - #define DELTA_PRINTABLE_RADIUS 140.0 // mm + #define DELTA_PRINTABLE_RADIUS 140.0 // (mm) // Center-to-center distance of the holes in the diagonal push rods. - #define DELTA_DIAGONAL_ROD 319.5 // mm + #define DELTA_DIAGONAL_ROD 319.5 // (mm) // height from z=0 to home position #define DELTA_HEIGHT 380.00 // get this value from auto calibrate @@ -847,6 +845,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + /** * Allen key retractable z-probe as seen on many Kossel delta printers - http://reprap.org/wiki/Kossel#Automatic_bed_leveling_probe * Deploys by touching z-axis belt. Retracts by pushing the probe down. Uses Z_MIN_PIN. @@ -977,6 +982,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -997,13 +1003,13 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine // Invert the stepper direction. Change (or reverse the motor connector) if an axis goes the wrong way. -#define INVERT_X_DIR false // DELTA does not invert +#define INVERT_X_DIR false #define INVERT_Y_DIR false #define INVERT_Z_DIR false @@ -1023,7 +1029,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -1090,6 +1096,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1260,8 +1278,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1415,10 +1434,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 180 #define PREHEAT_1_TEMP_BED 70 #define PREHEAT_1_FAN_SPEED 255 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 100 #define PREHEAT_2_FAN_SPEED 255 // Value from 0 to 255 @@ -1547,10 +1568,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1578,6 +1599,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1942,6 +1970,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -2098,5 +2135,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h b/Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h index a44a62b2a3..4eefea7ccd 100644 --- a/Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -30,8 +31,6 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -176,8 +175,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -245,7 +244,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -385,10 +384,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -413,6 +408,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -466,7 +482,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -484,6 +500,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] @@ -537,15 +564,15 @@ //=============================Additional Features=========================== //=========================================================================== -#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu //#define LCD_INFO_MENU @@ -561,7 +588,7 @@ // Add an 'M73' G-code to set the current percentage //#define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -570,7 +597,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -599,7 +626,7 @@ #define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -685,6 +712,43 @@ */ //#define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -699,7 +763,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar //#define DOGM_SD_PERCENT @@ -769,16 +833,24 @@ */ //#define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. + + //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -980,6 +1052,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -1005,21 +1086,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -//#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1260,11 +1362,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1273,10 +1375,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1416,6 +1526,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1558,6 +1677,33 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ @@ -1571,10 +1717,10 @@ #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "Preheat for PLA" + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "Preheat for ABS" + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) #define USER_DESC_4 "Heat Bed/Home/Level" @@ -1739,5 +1885,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration.h b/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration.h index 8f4b89b14a..a4d41f0191 100644 --- a/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration.h +++ b/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -208,7 +207,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -225,7 +224,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -785,6 +783,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -872,6 +877,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -892,8 +898,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -918,7 +924,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -#define Z_HOMING_HEIGHT 10 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +#define Z_HOMING_HEIGHT 10 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -986,6 +992,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1155,8 +1173,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1311,10 +1330,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 200 #define PREHEAT_1_TEMP_BED 70 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 110 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -1443,10 +1464,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1474,6 +1495,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1838,6 +1866,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1994,5 +2031,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h b/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h index 1da1cdaf61..e4a526f73f 100644 --- a/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h +++ b/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -30,8 +31,6 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -176,8 +175,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -245,7 +244,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -385,10 +384,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -413,6 +408,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -464,7 +480,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -482,6 +498,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] @@ -535,15 +562,15 @@ //=============================Additional Features=========================== //=========================================================================== -#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu //#define LCD_INFO_MENU @@ -559,7 +586,7 @@ // Add an 'M73' G-code to set the current percentage //#define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -568,7 +595,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -597,7 +624,7 @@ #define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -683,6 +710,43 @@ */ //#define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -697,7 +761,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar //#define DOGM_SD_PERCENT @@ -767,16 +831,24 @@ */ #define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 3 // Babysteps are very small. Increase for faster motion. - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - #define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 3 // Babysteps are very small. Increase for faster motion. + + #define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -978,6 +1050,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -1003,21 +1084,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -//#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1258,11 +1360,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1271,10 +1373,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1414,6 +1524,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1556,6 +1675,33 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ @@ -1569,10 +1715,10 @@ #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "Preheat for PLA" + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "Preheat for ABS" + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) #define USER_DESC_4 "Heat Bed/Home/Level" @@ -1737,5 +1883,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/examples/makibox/Configuration.h b/Marlin/src/config/examples/makibox/Configuration.h index 45ce1bf627..98d83e367d 100644 --- a/Marlin/src/config/examples/makibox/Configuration.h +++ b/Marlin/src/config/examples/makibox/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -138,7 +137,7 @@ // Optional custom name for your RepStrap or other custom machine // Displayed in the LCD "Ready" message -//#define CUSTOM_MACHINE_NAME "3D Printer" +#define CUSTOM_MACHINE_NAME "MakiBox" // Define this to set a unique identifier for this printer, (Used by some programs to differentiate between machines) // You can use an online service to generate a random UUID. (eg http://www.uuidgenerator.net/version4) @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -775,6 +773,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -862,6 +867,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -882,8 +888,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -908,7 +914,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -975,6 +981,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1144,8 +1162,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1300,10 +1319,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 180 #define PREHEAT_1_TEMP_BED 70 #define PREHEAT_1_FAN_SPEED 255 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 100 #define PREHEAT_2_FAN_SPEED 255 // Value from 0 to 255 @@ -1432,10 +1453,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1463,6 +1484,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1827,6 +1855,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1983,5 +2020,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/makibox/Configuration_adv.h b/Marlin/src/config/examples/makibox/Configuration_adv.h index e74e9339d3..53a9ca9c69 100644 --- a/Marlin/src/config/examples/makibox/Configuration_adv.h +++ b/Marlin/src/config/examples/makibox/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -30,8 +31,6 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -176,8 +175,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -245,7 +244,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -385,10 +384,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -413,6 +408,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -464,7 +480,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -482,6 +498,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] @@ -535,15 +562,15 @@ //=============================Additional Features=========================== //=========================================================================== -#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu //#define LCD_INFO_MENU @@ -559,7 +586,7 @@ // Add an 'M73' G-code to set the current percentage //#define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -568,7 +595,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -597,7 +624,7 @@ //#define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -683,6 +710,43 @@ */ //#define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -697,7 +761,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar //#define DOGM_SD_PERCENT @@ -767,16 +831,24 @@ */ //#define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. + + //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -978,6 +1050,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -1003,21 +1084,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -//#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1258,11 +1360,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1271,10 +1373,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1414,6 +1524,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1556,6 +1675,33 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ @@ -1569,10 +1715,10 @@ #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "Preheat for PLA" + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "Preheat for ABS" + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) #define USER_DESC_4 "Heat Bed/Home/Level" @@ -1737,5 +1883,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/examples/stm32f103ret6/Configuration.h b/Marlin/src/config/examples/stm32f103ret6/Configuration.h index 85b0c93956..16b2ffc4e4 100644 --- a/Marlin/src/config/examples/stm32f103ret6/Configuration.h +++ b/Marlin/src/config/examples/stm32f103ret6/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -774,6 +772,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -861,6 +866,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -881,8 +887,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -907,7 +913,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -974,6 +980,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1143,8 +1161,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1299,10 +1318,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 200 #define PREHEAT_1_TEMP_BED 60 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 220 #define PREHEAT_2_TEMP_BED 100 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -1431,10 +1452,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1462,6 +1483,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1826,6 +1854,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1982,5 +2019,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/tvrrug/Round2/Configuration.h b/Marlin/src/config/examples/tvrrug/Round2/Configuration.h index ff365f5220..47b16f0a30 100644 --- a/Marlin/src/config/examples/tvrrug/Round2/Configuration.h +++ b/Marlin/src/config/examples/tvrrug/Round2/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -767,6 +765,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -854,6 +859,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -874,8 +880,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -900,7 +906,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -967,6 +973,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1136,8 +1154,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1292,10 +1311,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 180 #define PREHEAT_1_TEMP_BED 70 #define PREHEAT_1_FAN_SPEED 255 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 100 #define PREHEAT_2_FAN_SPEED 255 // Value from 0 to 255 @@ -1424,10 +1445,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1455,6 +1476,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1819,6 +1847,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1975,5 +2012,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h b/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h index e7e076847d..887bce5b9f 100644 --- a/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h +++ b/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -30,8 +31,6 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -176,8 +175,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -245,7 +244,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -385,10 +384,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -413,6 +408,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -464,7 +480,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -482,6 +498,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] @@ -535,15 +562,15 @@ //=============================Additional Features=========================== //=========================================================================== -#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu //#define LCD_INFO_MENU @@ -559,7 +586,7 @@ // Add an 'M73' G-code to set the current percentage //#define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -568,7 +595,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -597,7 +624,7 @@ #define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -683,6 +710,43 @@ */ //#define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -697,7 +761,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar //#define DOGM_SD_PERCENT @@ -767,16 +831,24 @@ */ //#define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. + + //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -978,6 +1050,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -1003,21 +1084,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -//#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1258,11 +1360,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1271,10 +1373,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1414,6 +1524,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1556,6 +1675,33 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ @@ -1569,10 +1715,10 @@ #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "Preheat for PLA" + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "Preheat for ABS" + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) #define USER_DESC_4 "Heat Bed/Home/Level" @@ -1737,5 +1883,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/examples/wt150/Configuration.h b/Marlin/src/config/examples/wt150/Configuration.h index d74f16656c..0f7296fba3 100644 --- a/Marlin/src/config/examples/wt150/Configuration.h +++ b/Marlin/src/config/examples/wt150/Configuration.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration.h @@ -35,8 +36,6 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H #define CONFIGURATION_H_VERSION 020000 //=========================================================================== @@ -203,7 +202,7 @@ #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder - #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #endif /** @@ -220,7 +219,6 @@ #define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis #define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis #define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders - #define SWITCHING_TOOLHEAD_SECURITY_RAISE 5 // (mm) Z-raise before parking #endif /** @@ -777,6 +775,13 @@ //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. +// A probe deployed by moving the x-axis, such as the Wilson II's rack-and-pinion probe designed by Marty Rice. +//#define RACK_AND_PINION_PROBE +#if ENABLED(RACK_AND_PINION_PROBE) + #define Z_PROBE_DEPLOY_X X_MIN_POS + #define Z_PROBE_RETRACT_X X_MAX_POS +#endif + // // For Z_PROBE_ALLEN_KEY see the Delta example configurations. // @@ -864,6 +869,7 @@ //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) #endif //#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing //#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -884,8 +890,8 @@ // @section extruder -#define DISABLE_E false // For all extruders -#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled. +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // @section machine @@ -910,7 +916,7 @@ //#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. -//#define Z_HOMING_HEIGHT 4 // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ... +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... // Be sure you have this distance over your Z_MAX_POS in case. // Direction of endstops when homing; 1=MAX, -1=MIN @@ -977,6 +983,18 @@ #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. #define FILAMENT_RUNOUT_SCRIPT "M600" + + // After a runout is detected, continue printing this length of filament + // before executing the runout script. Useful for a sensor at the end of + // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. + //#define FILAMENT_RUNOUT_DISTANCE_MM 25 + + #ifdef FILAMENT_RUNOUT_DISTANCE_MM + // Enable this option to use an encoder disc that toggles the runout pin + // as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM + // large enough to avoid false positives.) + //#define FILAMENT_MOTION_SENSOR + #endif #endif //=========================================================================== @@ -1146,8 +1164,9 @@ //#define LCD_BED_LEVELING #if ENABLED(LCD_BED_LEVELING) - #define MBL_Z_STEP 0.025 // Step size while manually probing Z axis. - #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment + #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. + #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment + //#define MESH_EDIT_MENU // Add a menu to edit mesh points #endif // Add a menu item to move between bed corners for manual bed adjustment @@ -1302,10 +1321,12 @@ // @section temperature // Preheat Constants +#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_TEMP_HOTEND 180 #define PREHEAT_1_TEMP_BED 70 #define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 +#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_BED 110 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 @@ -1434,10 +1455,10 @@ * * Select the language to display on the LCD. These languages are available: * - * en, an, bg, ca, cz, de, el, el-gr, es, eu, fi, fr, gl, hr, it, - * jp-kana, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test + * en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, + * jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test * - * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } + * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ #define LCD_LANGUAGE en @@ -1465,6 +1486,13 @@ */ #define DISPLAY_CHARSET_HD44780 JAPANESE +/** + * Info Screen Style (0:Classic, 1:Prusa) + * + * :[0:'Classic', 1:'Prusa'] + */ +#define LCD_INFO_SCREEN_STYLE 0 + /** * SD CARD * @@ -1829,6 +1857,15 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// Extensible UI +// +// Enable third-party or vendor customized user interfaces that aren't +// packaged with Marlin. Source code for the user interface will need to +// be placed in "src/lcd/extensible_ui/lib" +// +//#define EXTENSIBLE_UI + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1985,5 +2022,3 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES - -#endif // CONFIGURATION_H diff --git a/Marlin/src/config/examples/wt150/Configuration_adv.h b/Marlin/src/config/examples/wt150/Configuration_adv.h index 10ea56af22..b9db322e23 100644 --- a/Marlin/src/config/examples/wt150/Configuration_adv.h +++ b/Marlin/src/config/examples/wt150/Configuration_adv.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Configuration_adv.h @@ -30,8 +31,6 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H_VERSION 020000 // @section temperature @@ -176,8 +175,8 @@ #if ENABLED(EXTRUDER_RUNOUT_PREVENT) #define EXTRUDER_RUNOUT_MINTEMP 190 #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // mm/m - #define EXTRUDER_RUNOUT_EXTRUDE 5 // mm + #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) + #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) #endif // @section temperature @@ -245,7 +244,7 @@ #define E5_AUTO_FAN_PIN -1 #define CHAMBER_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed /** * Part-Cooling Fan Multiplexer @@ -385,10 +384,6 @@ // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - // Default settings in "Auto-park Mode" - #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder - #define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder - // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -413,6 +408,27 @@ // Enable this if X or Y can't home without homing the other axis first. //#define CODEPENDENT_XY_HOMING +/** + * Z Steppers Auto-Alignment + * Add the G34 command to align multiple Z steppers using a bed probe. + */ +//#define Z_STEPPER_AUTO_ALIGN +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + // Define probe X and Y positions for Z1, Z2 [, Z3] + #define Z_STEPPER_ALIGN_X { 10, 150, 290 } + #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } + // Set number of iterations to align + #define Z_STEPPER_ALIGN_ITERATIONS 3 + // Enable to restore leveling setup after operation + #define RESTORE_LEVELING_AFTER_G34 + // Use the amplification factor to de-/increase correction step. + // In case the stepper (spindle) position is further out than the test point + // Use a value > 1. NOTE: This may cause instability + #define Z_STEPPER_ALIGN_AMP 1.0 + // Stop criterion. If the accuracy is better than this stop iterating early + #define Z_STEPPER_ALIGN_ACC 0.02 +#endif + // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -464,7 +480,7 @@ // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/sec) +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // // Use Junction Deviation instead of traditional Jerk Limiting @@ -482,6 +498,17 @@ */ //#define ADAPTIVE_STEP_SMOOTHING +/** + * Custom Microstepping + * Override as-needed for your setup. Up to 3 MS pins are supported. + */ +//#define MICROSTEP1 LOW,LOW,LOW +//#define MICROSTEP2 HIGH,LOW,LOW +//#define MICROSTEP4 LOW,HIGH,LOW +//#define MICROSTEP8 HIGH,HIGH,LOW +//#define MICROSTEP16 LOW,LOW,HIGH +//#define MICROSTEP32 HIGH,LOW,HIGH + // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] @@ -536,15 +563,15 @@ //=============================Additional Features=========================== //=========================================================================== -#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly -#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value -#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value - -//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ -#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again - // @section lcd +// Change values more rapidly when the encoder is rotated faster +#define ENCODER_RATE_MULTIPLIER +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed +#endif + // Include a page of printer information in the LCD Main Menu #define LCD_INFO_MENU @@ -560,7 +587,7 @@ // Add an 'M73' G-code to set the current percentage //#define LCD_SET_PROGRESS_MANUALLY -#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) +#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing #if ENABLED(LCD_PROGRESS_BAR) #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar @@ -569,7 +596,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY +#endif // HAS_PRINT_PROGRESS /** * LED Control Menu @@ -598,7 +625,7 @@ #define SD_DETECT_INVERTED #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. + #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. @@ -684,6 +711,43 @@ */ //#define AUTO_REPORT_SD_STATUS + /** + * Support for USB thumb drives using an Arduino USB Host Shield or + * equivalent MAX3421E breakout board. The USB thumb drive will appear + * to Marlin as an SD card. + * + * The MAX3421E must be assigned the same pins as the SD card reader, with + * the following pin mapping: + * + * SCLK, MOSI, MISO --> SCLK, MOSI, MISO + * INT --> SD_DETECT_PIN + * SS --> SDSS + */ + //#define USB_FLASH_DRIVE_SUPPORT + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_CS_PIN SDSS + #define USB_INTR_PIN SD_DETECT_PIN + #endif + + /** + * When using a bootloader that supports SD-Firmware-Flashing, + * add a menu item to activate SD-FW-Update on the next reboot. + * + * Requires ATMEGA2560 (Arduino Mega) + * + * Tested with this bootloader: + * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 + */ + //#define SD_FIRMWARE_UPDATE + #if ENABLED(SD_FIRMWARE_UPDATE) + #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF + #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 + #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF + #endif + + // Add an optimized binary file transfer mode, initiated with 'M28 B1' + //#define FAST_FILE_TRANSFER + #endif // SDSUPPORT /** @@ -698,7 +762,7 @@ * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD // Show SD percentage next to the progress bar //#define DOGM_SD_PERCENT @@ -768,16 +832,24 @@ */ //#define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor + //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. + + //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) + #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. + // Note: Extra time may be added to mitigate controller latency. + #endif + + //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. + #if ENABLED(MOVE_Z_WHEN_IDLE) + #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + #endif + //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets + //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #endif #endif @@ -979,6 +1051,15 @@ // @section extras +/** + * Extra Fan Speed + * Adds a secondary fan speed for each print-cooling fan. + * 'M106 P T3-255' : Set a secondary speed for + * 'M106 P T2' : Use the set secondary speed + * 'M106 P T1' : Restore the previous fan speed + */ +//#define EXTRA_FAN_SPEED + /** * Firmware-based and LCD-controlled retract * @@ -1004,21 +1085,42 @@ #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) - #define RETRACT_ZLIFT 0 // Default retract Z-lift + #define RETRACT_ZRAISE 0 // Default retract Z-raise (mm) #define RETRACT_RECOVER_LENGTH 0 // Default additional recover length (mm, added to retract length when recovering) #define RETRACT_RECOVER_LENGTH_SWAP 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define RETRACT_RECOVER_FEEDRATE 8 // Default feedrate for recovering from retraction (mm/s) #define RETRACT_RECOVER_FEEDRATE_SWAP 8 // Default feedrate for recovering from swap retraction (mm/s) + #if ENABLED(MIXING_EXTRUDER) + //#define RETRACT_SYNC_MIXING // Retract and restore all mixing steppers simultaneously + #endif #endif /** - * Extra Fan Speed - * Adds a secondary fan speed for each print-cooling fan. - * 'M106 P T3-255' : Set a secondary speed for - * 'M106 P T2' : Use the set secondary speed - * 'M106 P T1' : Restore the previous fan speed + * Universal tool change settings. + * Applies to all types of extruders except where explicitly noted. */ -//#define EXTRA_FAN_SPEED +#if EXTRUDERS > 1 + // Z raise distance for tool-change, as needed for some extruders + #define TOOLCHANGE_ZRAISE 2 // (mm) + + // Retract and prime filament on tool-change + //#define TOOLCHANGE_FILAMENT_SWAP + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #define TOOLCHANGE_FIL_SWAP_LENGTH 12 // (mm) + #define TOOLCHANGE_FIL_SWAP_RETRACT_SPEED 3600 // (mm/m) + #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) + #endif + + /** + * Position to park head during tool change. + * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER + */ + //#define TOOLCHANGE_PARK + #if ENABLED(TOOLCHANGE_PARK) + #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } + #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) + #endif +#endif /** * Advanced Pause @@ -1259,11 +1361,11 @@ #define E5_HYBRID_THRESHOLD 30 /** - * Use stallGuard2 to sense an obstacle and trigger an endstop. - * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. + * Use StallGuard2 to sense an obstacle and trigger an endstop. + * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. * X, Y, and Z homing will always be done in spreadCycle mode. * - * X/Y/Z_HOMING_SENSITIVITY is used for tuning the trigger sensitivity. + * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. @@ -1272,10 +1374,18 @@ */ //#define SENSORLESS_HOMING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) - #define X_HOMING_SENSITIVITY 8 - #define Y_HOMING_SENSITIVITY 8 - //#define Z_HOMING_SENSITIVITY 8 + /** + * Use StallGuard2 to probe the bed with the nozzle. + * + * CAUTION: This could cause damage to machines that use a lead screw or threaded rod + * to move the Z axis. Take extreme care when attempting to enable this feature. + */ + //#define SENSORLESS_PROBING // TMC2130 only + + #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #define X_STALL_SENSITIVITY 8 + #define Y_STALL_SENSITIVITY 8 + //#define Z_STALL_SENSITIVITY 8 #endif /** @@ -1415,6 +1525,15 @@ // @section extras +/** + * Canon Hack Development Kit + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + */ +//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture +#if PIN_EXISTS(CHDK) + #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +#endif + /** * Spindle & Laser control * @@ -1557,6 +1676,33 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + * Note that G0 feedrates should be used with care for 3D printing (if used at all). + * High feedrates may cause ringing and harm print quality. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + +// Enable and set a (default) feedrate for all G0 moves +//#define G0_FEEDRATE 3000 // (mm/m) +#ifdef G0_FEEDRATE + //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode +#endif + +/** + * G-code Macros + * + * Add G-codes M810-M819 to define and run G-code macros. + * Macros are not saved to EEPROM. + */ +//#define GCODE_MACROS +#if ENABLED(GCODE_MACROS) + #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used + #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro +#endif + /** * User-defined menu items that execute custom GCode */ @@ -1570,10 +1716,10 @@ #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "Preheat for PLA" + #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_3 "Preheat for ABS" + #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) #define USER_DESC_4 "Heat Bed/Home/Level" @@ -1738,5 +1884,3 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -#endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index b67d42a3f7..8008ff7f7b 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -19,9 +19,7 @@ * along with this program. If not, see . * */ - -#ifndef BOARDS_H -#define BOARDS_H +#pragma once #define BOARD_UNKNOWN -1 @@ -78,12 +76,13 @@ #define BOARD_FORMBOT_TREX2PLUS 95 // Formbot version 1 #define BOARD_FORMBOT_TREX3 96 // Formbot T-Rex 3 revision #define BOARD_FORMBOT_RAPTOR 97 // Formbot version 1 +#define BOARD_FORMBOT_RAPTOR2 98 // Formbot version 1 #define BOARD_BQ_ZUM_MEGA_3D 503 // bq ZUM Mega 3D #define BOARD_MAKEBOARD_MINI 431 // MakeBoard Mini v2.1.2 is a control board sold by MicroMake #define BOARD_TRIGORILLA_13 343 // TriGorilla Anycubic version 1.3 based on RAMPS EFB #define BOARD_TRIGORILLA_14 443 // TriGorilla Anycubic version 1.4 based on RAMPS EFB #define BOARD_RAMPS_ENDER_4 243 // Creality: Ender-4, CR-8 -#define BOARD_GT2560_V3 76 // Geeetech A10 +#define BOARD_RAMPS_CREALITY 244 // Creality: CR10S, CR20, CR-X #define BOARD_FYSETC_F6_13 541 // Fysetc F6 // @@ -110,6 +109,8 @@ #define BOARD_SCOOVO_X9H 321 // abee Scoovo X9H #define BOARD_GT2560_REV_A 74 // Geeetech GT2560 Rev. A #define BOARD_GT2560_REV_A_PLUS 75 // Geeetech GT2560 Rev. A+ (with auto level probe) +#define BOARD_GT2560_V3 76 // Geeetech GT2560 Rev B for A10(M/D) +#define BOARD_GT2560_V3_MC2 73 // Geeetech GT2560 Rev B for Mecreator2 #define BOARD_EINSTART_S 666 // Einstart retrofit // @@ -209,7 +210,8 @@ #define BOARD_RURAMPS4D_11 1550 // RuRAMPS4Duo v1.1 (Power outputs: Hotend0, Hotend1, Hotend2, Fan0, Fan1, Bed) #define BOARD_RURAMPS4D_13 1551 // RuRAMPS4Duo v1.3 (Power outputs: Hotend0, Hotend1, Hotend2, Fan0, Fan1, Bed) #define BOARD_ULTRATRONICS_PRO 1560 // ReprapWorld Ultratronics Pro V1.0 -#define BOARD_ARCHIM2 1590 // UltiMachine Archim2 (with TMC2130 drivers) +#define BOARD_ARCHIM1 1591 // UltiMachine Archim1 (with DRV8825 drivers) +#define BOARD_ARCHIM2 1592 // UltiMachine Archim2 (with TMC2130 drivers) #define BOARD_ALLIGATOR 1602 // Alligator Board R2 // @@ -230,12 +232,14 @@ #define BOARD_TEENSY35_36 841 // Teensy3.5 and Teensy3.6 #define BOARD_BEAST 1802 // STM32FxxxVxT6 Libmaple based stm32f4 controller #define BOARD_STM32F4 1804 // STM32 STM32GENERIC based STM32F4 controller +#define BOARD_ARMED 1807 // Arm'ed STM32F4 based controller // // ARM Cortex M7 // #define BOARD_THE_BORG 1860 // THE-BORG (Power outputs: Hotend0, Hotend1, Bed, Fan) +#define BOARD_REMRAM_V1 1862 // RemRam v1 // // Espressif ESP32 WiFi @@ -243,5 +247,3 @@ #define BOARD_ESP32 1900 #define MB(board) (defined(BOARD_##board) && MOTHERBOARD==BOARD_##board) - -#endif // __BOARDS_H diff --git a/Marlin/src/core/drivers.h b/Marlin/src/core/drivers.h index e775c58b5c..ce2d913b84 100644 --- a/Marlin/src/core/drivers.h +++ b/Marlin/src/core/drivers.h @@ -31,21 +31,21 @@ #define TB6560 0x006 #define TB6600 0x007 #define TMC2100 0x008 -#define TMC2130 0x109 +#define TMC2130 2130 #define TMC2130_STANDALONE 0x009 -#define TMC2208 0x10A +#define TMC2208 2208 #define TMC2208_STANDALONE 0x00A #define TMC26X 0x10B #define TMC26X_STANDALONE 0x00B -#define TMC2660 0x10C +#define TMC2660 2660 #define TMC2660_STANDALONE 0x00C -#define _AXIS_DRIVER_TYPE(A,T) ( defined(A##_DRIVER_TYPE) && (A##_DRIVER_TYPE == T) ) +#define _AXIS_DRIVER_TYPE(A,T) (defined(A##_DRIVER_TYPE) && (A##_DRIVER_TYPE == T)) #define AXIS_DRIVER_TYPE_X(T) _AXIS_DRIVER_TYPE(X,T) #define AXIS_DRIVER_TYPE_Y(T) _AXIS_DRIVER_TYPE(Y,T) #define AXIS_DRIVER_TYPE_Z(T) _AXIS_DRIVER_TYPE(Z,T) -#define AXIS_DRIVER_TYPE_X2(T) (ENABLED(X_DUAL_STEPPER_DRIVERS) || ENABLED(DUAL_X_CARRIAGE)) && _AXIS_DRIVER_TYPE(X2,T) +#define AXIS_DRIVER_TYPE_X2(T) ((ENABLED(X_DUAL_STEPPER_DRIVERS) || ENABLED(DUAL_X_CARRIAGE)) && _AXIS_DRIVER_TYPE(X2,T)) #define AXIS_DRIVER_TYPE_Y2(T) (ENABLED(Y_DUAL_STEPPER_DRIVERS) && _AXIS_DRIVER_TYPE(Y2,T)) #define AXIS_DRIVER_TYPE_Z2(T) (Z_MULTI_STEPPER_DRIVERS && _AXIS_DRIVER_TYPE(Z2,T)) #define AXIS_DRIVER_TYPE_Z3(T) (ENABLED(Z_TRIPLE_STEPPER_DRIVERS) && _AXIS_DRIVER_TYPE(Z3,T)) @@ -67,7 +67,8 @@ // Test for supported TMC drivers that require advanced configuration // Does not match standalone configurations -#define HAS_TRINAMIC (HAS_DRIVER(TMC2130) || HAS_DRIVER(TMC2208)) +#define HAS_TRINAMIC (HAS_DRIVER(TMC2130) || HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2660)) #define AXIS_IS_TMC(A) ( AXIS_DRIVER_TYPE_##A(TMC2130) || \ - AXIS_DRIVER_TYPE_##A(TMC2208) ) + AXIS_DRIVER_TYPE_##A(TMC2208) || \ + AXIS_DRIVER_TYPE_##A(TMC2660) ) diff --git a/Marlin/src/core/enum.h b/Marlin/src/core/enum.h index d9a3cd18c2..7abfe0bb88 100644 --- a/Marlin/src/core/enum.h +++ b/Marlin/src/core/enum.h @@ -19,9 +19,7 @@ * along with this program. If not, see . * */ - -#ifndef __ENUM_H__ -#define __ENUM_H__ +#pragma once /** * Axis indices as enumerated constants @@ -68,21 +66,3 @@ typedef enum { TEMPUNIT_K, TEMPUNIT_F } TempUnit; - -/** - * SD Card - */ -enum LsAction : char { LS_SerialPrint, LS_Count, LS_GetFilename }; - -/** - * Ultra LCD - */ -enum LCDViewAction : char { - LCDVIEW_NONE, - LCDVIEW_REDRAW_NOW, - LCDVIEW_CALL_REDRAW_NEXT, - LCDVIEW_CLEAR_CALL_REDRAW, - LCDVIEW_CALL_NO_REDRAW -}; - -#endif // __ENUM_H__ diff --git a/Marlin/src/core/language.h b/Marlin/src/core/language.h index b6f954034d..fbd19bc0cc 100644 --- a/Marlin/src/core/language.h +++ b/Marlin/src/core/language.h @@ -19,9 +19,7 @@ * along with this program. If not, see . * */ - -#ifndef LANGUAGE_H -#define LANGUAGE_H +#pragma once #include "../inc/MarlinConfig.h" @@ -60,6 +58,7 @@ // hr Croatian // it Italian // jp-kana Japanese +// ko_KR Korean (South Korea) // nl Dutch // pl Polish // pt Portuguese @@ -95,6 +94,44 @@ #define WEBSITE_URL DEFAULT_WEBSITE_URL #endif +#if HAS_GRAPHICAL_LCD + // + // Custom characters from Marlin_symbols.fon which was merged into ISO10646-0-3.bdf + // \x00 intentionally skipped to avoid problems in strings + // + #define LCD_STR_REFRESH "\x01" + #define LCD_STR_FOLDER "\x02" + #define LCD_STR_ARROW_RIGHT "\x03" + #define LCD_STR_UPLEVEL "\x04" + #define LCD_STR_CLOCK "\x05" + #define LCD_STR_FEEDRATE "\x06" + #define LCD_STR_BEDTEMP "\x07" + #define LCD_STR_THERMOMETER "\x08" + #define LCD_STR_DEGREE "\x09" + + #define LCD_STR_SPECIAL_MAX '\x09' + // Maximum here is 0x1F because 0x20 is ' ' (space) and the normal charsets begin. + // Better stay below 0x10 because DISPLAY_CHARSET_HD44780_WESTERN begins here. + + // Symbol characters + #define LCD_STR_FILAM_DIA "\xF8" + #define LCD_STR_FILAM_MUL "\xA4" + +#elif HAS_CHARACTER_LCD + + // Custom characters defined in the first 8 characters of the LCD + #define LCD_STR_BEDTEMP "\x00" // Print only as a char. This will have 'unexpected' results when used in a string! + #define LCD_STR_DEGREE "\x01" + #define LCD_STR_THERMOMETER "\x02" // Still used with string concatenation + #define LCD_STR_UPLEVEL "\x03" + #define LCD_STR_REFRESH "\x04" + #define LCD_STR_FOLDER "\x05" + #define LCD_STR_FEEDRATE "\x06" + #define LCD_STR_CLOCK "\x07" + #define LCD_STR_ARROW_RIGHT ">" /* from the default character set */ + +#endif + // Common LCD messages /* nothing here yet */ @@ -130,6 +167,7 @@ #define MSG_M115_REPORT "FIRMWARE_NAME:Marlin " DETAILED_BUILD_VERSION " SOURCE_CODE_URL:" SOURCE_CODE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:" MACHINE_NAME " EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) " UUID:" MACHINE_UUID #define MSG_COUNT_X " Count X:" #define MSG_COUNT_A " Count A:" +#define MSG_WATCHDOG_FIRED "Watchdog timeout. Reset required." #define MSG_ERR_KILLED "Printer halted. kill() called!" #define MSG_ERR_STOPPED "Printer stopped due to errors. Fix the error and use M999 to restart. (Temperature is reset. Set it after restarting)" #define MSG_BUSY_PROCESSING "busy: processing" @@ -169,6 +207,8 @@ #define MSG_ERR_M428_TOO_FAR "Too far from reference point" #define MSG_ERR_M303_DISABLED "PIDTEMP disabled" #define MSG_M119_REPORT "Reporting endstop status" +#define MSG_ON "ON" +#define MSG_OFF "OFF" #define MSG_ENDSTOP_HIT "TRIGGERED" #define MSG_ENDSTOP_OPEN "open" #define MSG_HOTEND_OFFSET "Hotend offsets:" @@ -198,14 +238,17 @@ #define MSG_ENDSTOPS_HIT "endstops hit: " #define MSG_ERR_COLD_EXTRUDE_STOP " cold extrusion prevented" #define MSG_ERR_LONG_EXTRUDE_STOP " too long extrusion prevented" -#define MSG_HOTEND_TOO_COLD "Hotend too cold" +#define MSG_ERR_HOTEND_TOO_COLD "Hotend too cold" #define MSG_FILAMENT_CHANGE_HEAT "Press button (or M108) to heat nozzle" #define MSG_FILAMENT_CHANGE_INSERT "Insert filament and press button (or M108)" +#define MSG_FILAMENT_CHANGE_WAIT "Press button (or M108) to resume" #define MSG_FILAMENT_CHANGE_HEAT_LCD "Press button to heat nozzle" #define MSG_FILAMENT_CHANGE_INSERT_LCD "Insert filament and press button" +#define MSG_FILAMENT_CHANGE_WAIT_LCD "Press button to resume" #define MSG_FILAMENT_CHANGE_HEAT_M108 "Send M108 to heat nozzle" #define MSG_FILAMENT_CHANGE_INSERT_M108 "Insert filament and send M108" +#define MSG_FILAMENT_CHANGE_WAIT_M108 "Send M108 to resume" #define MSG_ERR_EEPROM_WRITE "Error writing to EEPROM!" @@ -262,7 +305,7 @@ // LCD Menu Messages -#define LANGUAGE_DATA_INCL_(M) STRINGIFY_(../lcd/dogm/language_data_##M.h) +#define LANGUAGE_DATA_INCL_(M) STRINGIFY_(fontdata/langdata_##M.h) #define LANGUAGE_DATA_INCL(M) LANGUAGE_DATA_INCL_(M) #define INCLUDE_LANGUAGE_DATA LANGUAGE_DATA_INCL(LCD_LANGUAGE) @@ -284,18 +327,23 @@ #define MSG_B "Y" #define MSG_C "Z" #endif +#define MSG_X2 "X2" +#define MSG_Y2 "Y2" +#define MSG_Z2 "Z2" +#define MSG_Z3 "Z3" #define MSG_H1 "1" #define MSG_H2 "2" #define MSG_H3 "3" #define MSG_H4 "4" #define MSG_H5 "5" #define MSG_H6 "6" -#define MSG_N1 " 1" -#define MSG_N2 " 2" -#define MSG_N3 " 3" -#define MSG_N4 " 4" -#define MSG_N5 " 5" -#define MSG_N6 " 6" +#define MSG_LCD_N0 " 1" +#define MSG_LCD_N1 " 2" +#define MSG_LCD_N2 " 3" +#define MSG_LCD_N3 " 4" +#define MSG_LCD_N4 " 5" +#define MSG_LCD_N5 " 6" +#define MSG_E0 "E0" #define MSG_E1 "E1" #define MSG_E2 "E2" #define MSG_E3 "E3" @@ -335,5 +383,3 @@ #undef MSG_USER_MENU #define MSG_USER_MENU CUSTOM_USER_MENU_TITLE #endif - -#endif // __LANGUAGE_H diff --git a/Marlin/src/core/macros.h b/Marlin/src/core/macros.h index fc551b8e16..1c57d88c86 100644 --- a/Marlin/src/core/macros.h +++ b/Marlin/src/core/macros.h @@ -19,9 +19,9 @@ * along with this program. If not, see . * */ +#pragma once -#ifndef _CORE_MACROS_H_ -#define _CORE_MACROS_H_ +#include "minmax.h" #define NUM_AXIS 4 #define ABCE 4 @@ -49,14 +49,14 @@ // Clock speed factors #if !defined(CYCLES_PER_MICROSECOND) && !defined(__STM32F1__) - #define CYCLES_PER_MICROSECOND (F_CPU / 1000000L) // 16 or 20 on AVR + #define CYCLES_PER_MICROSECOND (F_CPU / 1000000UL) // 16 or 20 on AVR #endif // Nanoseconds per cycle #define NANOSECONDS_PER_CYCLE (1000000000.0 / F_CPU) // Remove compiler warning on an unused variable -#define UNUSED(x) (void) (x) +#define UNUSED(x) ((void)(x)) // Macros to make a string from a macro #define STRINGIFY_(M) #M @@ -93,10 +93,6 @@ #define IS_POWER_OF_2(x) ((x) && !((x) & ((x) - 1))) // Macros to constrain values -// Avoid double evaluation of arguments to NOMORE/NOLESS/LIMIT -#undef NOMORE -#undef NOLESS -#undef LIMIT #ifdef __cplusplus // C++11 solution that is standards compliant. @@ -197,59 +193,20 @@ #define PIN_EXISTS(PN) (defined(PN ##_PIN) && PN ##_PIN >= 0) -#define PENDING(NOW,SOON) ((long)(NOW-(SOON))<0) -#define ELAPSED(NOW,SOON) (!PENDING(NOW,SOON)) - #define MMM_TO_MMS(MM_M) ((MM_M)/60.0f) #define MMS_TO_MMM(MM_S) ((MM_S)*60.0f) -#define NOOP do{} while(0) +#define NOOP (void(0)) #define CEILING(x,y) (((x) + (y) - 1) / (y)) -// Avoid double evaluation of arguments on MIN/MAX/ABS -#undef MIN -#undef MAX #undef ABS #ifdef __cplusplus - - // C++11 solution that is standards compliant. Return type is deduced automatically - template static inline constexpr auto MIN(const L lhs, const R rhs) -> decltype(lhs + rhs) { - return lhs < rhs ? lhs : rhs; - } - template static inline constexpr auto MAX(const L lhs, const R rhs) -> decltype(lhs + rhs){ - return lhs > rhs ? lhs : rhs; - } - template static inline constexpr const T ABS(const T v) { - return v >= 0 ? v : -v; - } + template static inline constexpr const T ABS(const T v) { return v >= 0 ? v : -v; } #else - - // Using GCC extensions, but Travis GCC version does not like it and gives - // "error: statement-expressions are not allowed outside functions nor in template-argument lists" - #define MIN(a, b) \ - ({__typeof__(a) _a = (a); \ - __typeof__(b) _b = (b); \ - _a < _b ? _a : _b;}) - - #define MAX(a, b) \ - ({__typeof__(a) _a = (a); \ - __typeof__(b) _b = (b); \ - _a > _b ? _a : _b;}) - - #define ABS(a) \ - ({__typeof__(a) _a = (a); \ - _a >= 0 ? _a : -_a;}) - + #define ABS(a) ({__typeof__(a) _a = (a); _a >= 0 ? _a : -_a;}) #endif -#define MIN3(a, b, c) MIN(MIN(a, b), c) -#define MIN4(a, b, c, d) MIN(MIN3(a, b, c), d) -#define MIN5(a, b, c, d, e) MIN(MIN4(a, b, c, d), e) -#define MAX3(a, b, c) MAX(MAX(a, b), c) -#define MAX4(a, b, c, d) MAX(MAX3(a, b, c), d) -#define MAX5(a, b, c, d, e) MAX(MAX4(a, b, c, d), e) - #define UNEAR_ZERO(x) ((x) < 0.000001f) #define NEAR_ZERO(x) WITHIN(x, -0.000001f, 0.000001f) #define NEAR(x,y) NEAR_ZERO((x)-(y)) @@ -269,5 +226,3 @@ #define LROUND(x) lroundf(x) #define FMOD(x, y) fmodf(x, y) #define HYPOT(x,y) SQRT(HYPOT2(x,y)) - -#endif // _CORE_MACROS_H_ diff --git a/Marlin/src/core/types.h b/Marlin/src/core/millis_t.h similarity index 89% rename from Marlin/src/core/types.h rename to Marlin/src/core/millis_t.h index db6587a08c..d38ab65d0a 100644 --- a/Marlin/src/core/types.h +++ b/Marlin/src/core/millis_t.h @@ -19,13 +19,11 @@ * along with this program. If not, see . * */ - -#ifndef __TYPES_H__ -#define __TYPES_H__ +#pragma once #include -#include typedef uint32_t millis_t; -#endif +#define PENDING(NOW,SOON) ((int32_t)(NOW-(SOON))<0) +#define ELAPSED(NOW,SOON) (!PENDING(NOW,SOON)) diff --git a/Marlin/src/core/minmax.h b/Marlin/src/core/minmax.h new file mode 100644 index 0000000000..0c334fbcda --- /dev/null +++ b/Marlin/src/core/minmax.h @@ -0,0 +1,71 @@ +/** + * 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 . + * + */ + +#undef MIN +#undef MAX + +#ifdef __cplusplus + + #ifndef _MINMAX_H_ + #define _MINMAX_H_ + + extern "C++" { + + // C++11 solution that is standards compliant. Return type is deduced automatically + template static inline constexpr auto MIN(const L lhs, const R rhs) -> decltype(lhs + rhs) { + return lhs < rhs ? lhs : rhs; + } + template static inline constexpr auto MAX(const L lhs, const R rhs) -> decltype(lhs + rhs) { + return lhs > rhs ? lhs : rhs; + } + template static inline constexpr const T MIN(T V, Ts... Vs) { return MIN(V, MIN(Vs...)); } + template static inline constexpr const T MAX(T V, Ts... Vs) { return MAX(V, MAX(Vs...)); } + + } + + #endif + +#else + + // NUM_ARGS(...) evaluates to the number of arguments + #define _NUM_ARGS(X,X6,X5,X4,X3,X2,X1,N,...) N + #define NUM_ARGS(...) _NUM_ARGS(0, __VA_ARGS__ ,6,5,4,3,2,1,0) + + #define MIN_2(a,b) ({__typeof__(a) _a = (a); __typeof__(b) _b = (b); _a < _b ? _a : _b;}) + #define MIN_3(a,...) MIN_2(a,MIN_2(__VA_ARGS__)) + #define MIN_4(a,...) MIN_2(a,MIN_3(__VA_ARGS__)) + #define MIN_5(a,...) MIN_2(a,MIN_4(__VA_ARGS__)) + #define MIN_6(a,...) MIN_2(a,MIN_5(__VA_ARGS__)) + #define __MIN_N(N, ...) MIN_ ## N(__VA_ARGS__) + #define _MIN_N(N, ...) __MIN_N(N, __VA_ARGS__) + #define MIN(...) _MIN_N(NUM_ARGS(__VA_ARGS__), __VA_ARGS__) + + #define MAX_2(a,b) ({__typeof__(a) _a = (a); __typeof__(b) _b = (b); _a > _b ? _a : _b;}) + #define MAX_3(a,...) MAX_2(a,MAX_2(__VA_ARGS__)) + #define MAX_4(a,...) MAX_2(a,MAX_3(__VA_ARGS__)) + #define MAX_5(a,...) MAX_2(a,MAX_4(__VA_ARGS__)) + #define MAX_6(a,...) MAX_2(a,MAX_5(__VA_ARGS__)) + #define __MAX_N(N, ...) MAX_ ## N(__VA_ARGS__) + #define _MAX_N(N, ...) __MAX_N(N, __VA_ARGS__) + #define MAX(...) _MAX_N(NUM_ARGS(__VA_ARGS__), __VA_ARGS__) + +#endif diff --git a/Marlin/src/core/serial.cpp b/Marlin/src/core/serial.cpp index d53d730c6e..e43747b660 100644 --- a/Marlin/src/core/serial.cpp +++ b/Marlin/src/core/serial.cpp @@ -21,49 +21,60 @@ */ #include "serial.h" +#include "language.h" -uint8_t marlin_debug_flags = DEBUG_NONE; +uint8_t marlin_debug_flags = MARLIN_DEBUG_NONE; -const char errormagic[] PROGMEM = "Error:"; -const char echomagic[] PROGMEM = "echo:"; +static const char errormagic[] PROGMEM = "Error:"; +static const char echomagic[] PROGMEM = "echo:"; #if NUM_SERIAL > 1 void serialprintPGM_P(const int8_t p, const char * str) { while (char ch = pgm_read_byte(str++)) SERIAL_CHAR_P(p, ch); } - void serial_echopair_PGM_P(const int8_t p, const char* s_P, const char *v) { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); } - void serial_echopair_PGM_P(const int8_t p, const char* s_P, char v) { serialprintPGM_P(p, s_P); SERIAL_CHAR_P(p, v); } - void serial_echopair_PGM_P(const int8_t p, const char* s_P, int v) { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); } - void serial_echopair_PGM_P(const int8_t p, const char* s_P, long v) { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); } - void serial_echopair_PGM_P(const int8_t p, const char* s_P, float v) { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); } - void serial_echopair_PGM_P(const int8_t p, const char* s_P, double v) { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); } - void serial_echopair_PGM_P(const int8_t p, const char* s_P, unsigned int v) { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); } - void serial_echopair_PGM_P(const int8_t p, const char* s_P, unsigned long v) { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); } + void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, const char *v) { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); } + void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, char v) { serialprintPGM_P(p, s_P); SERIAL_CHAR_P(p, v); } + void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, int v) { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); } + void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, long v) { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); } + void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, float v) { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); } + void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, double v) { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); } + void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, unsigned int v) { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); } + void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, unsigned long v) { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); } void serial_spaces_P(const int8_t p, uint8_t count) { count *= (PROPORTIONAL_FONT_RATIO); while (count--) SERIAL_CHAR_P(p, ' '); } + + void serial_echo_start_P(const int8_t p) { serialprintPGM_P(p, echomagic); } + void serial_error_start_P(const int8_t p) { serialprintPGM_P(p, errormagic); } + #endif -void serialprintPGM(const char * str) { +void serialprintPGM(PGM_P str) { while (char ch = pgm_read_byte(str++)) SERIAL_CHAR(ch); } -void serial_echopair_PGM(const char* s_P, const char *v) { serialprintPGM(s_P); SERIAL_ECHO(v); } -void serial_echopair_PGM(const char* s_P, char v) { serialprintPGM(s_P); SERIAL_CHAR(v); } -void serial_echopair_PGM(const char* s_P, int v) { serialprintPGM(s_P); SERIAL_ECHO(v); } -void serial_echopair_PGM(const char* s_P, long v) { serialprintPGM(s_P); SERIAL_ECHO(v); } -void serial_echopair_PGM(const char* s_P, float v) { serialprintPGM(s_P); SERIAL_ECHO(v); } -void serial_echopair_PGM(const char* s_P, double v) { serialprintPGM(s_P); SERIAL_ECHO(v); } -void serial_echopair_PGM(const char* s_P, unsigned int v) { serialprintPGM(s_P); SERIAL_ECHO(v); } -void serial_echopair_PGM(const char* s_P, unsigned long v) { serialprintPGM(s_P); SERIAL_ECHO(v); } +void serial_echo_start() { serialprintPGM(echomagic); } +void serial_error_start() { serialprintPGM(errormagic); } + +void serial_echopair_PGM(PGM_P s_P, const char *v) { serialprintPGM(s_P); SERIAL_ECHO(v); } +void serial_echopair_PGM(PGM_P s_P, char v) { serialprintPGM(s_P); SERIAL_CHAR(v); } +void serial_echopair_PGM(PGM_P s_P, int v) { serialprintPGM(s_P); SERIAL_ECHO(v); } +void serial_echopair_PGM(PGM_P s_P, long v) { serialprintPGM(s_P); SERIAL_ECHO(v); } +void serial_echopair_PGM(PGM_P s_P, float v) { serialprintPGM(s_P); SERIAL_ECHO(v); } +void serial_echopair_PGM(PGM_P s_P, double v) { serialprintPGM(s_P); SERIAL_ECHO(v); } +void serial_echopair_PGM(PGM_P s_P, unsigned int v) { serialprintPGM(s_P); SERIAL_ECHO(v); } +void serial_echopair_PGM(PGM_P s_P, unsigned long v) { serialprintPGM(s_P); SERIAL_ECHO(v); } void serial_spaces(uint8_t count) { count *= (PROPORTIONAL_FONT_RATIO); while (count--) SERIAL_CHAR(' '); } +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(); } + #if ENABLED(DEBUG_LEVELING_FEATURE) #include "enum.h" - void print_xyz(const char* prefix, const char* suffix, const float x, const float y, const float z) { + void print_xyz(PGM_P prefix, PGM_P suffix, const float x, const float y, const float z) { serialprintPGM(prefix); SERIAL_CHAR('('); SERIAL_ECHO(x); @@ -73,7 +84,7 @@ void serial_spaces(uint8_t count) { count *= (PROPORTIONAL_FONT_RATIO); while (c if (suffix) serialprintPGM(suffix); else SERIAL_EOL(); } - void print_xyz(const char* prefix, const char* suffix, const float xyz[]) { + void print_xyz(PGM_P prefix, PGM_P 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 bbabdb70e3..49b7e21b2e 100644 --- a/Marlin/src/core/serial.h +++ b/Marlin/src/core/serial.h @@ -19,9 +19,7 @@ * along with this program. If not, see . * */ - -#ifndef __SERIAL_H__ -#define __SERIAL_H__ +#pragma once #include "../inc/MarlinConfigPre.h" #include HAL_PATH(../HAL, HAL.h) @@ -29,23 +27,20 @@ /** * Define debug bit-masks */ -enum DebugFlags : unsigned char { - DEBUG_NONE = 0, - DEBUG_ECHO = _BV(0), ///< Echo commands in order as they are processed - DEBUG_INFO = _BV(1), ///< Print messages for code that has debug output - DEBUG_ERRORS = _BV(2), ///< Not implemented - DEBUG_DRYRUN = _BV(3), ///< Ignore temperature setting and E movement commands - DEBUG_COMMUNICATION = _BV(4), ///< Not implemented - DEBUG_LEVELING = _BV(5), ///< Print detailed output for homing and leveling - DEBUG_MESH_ADJUST = _BV(6), ///< UBL bed leveling - DEBUG_ALL = 0xFF +enum MarlinDebugFlags : uint8_t { + MARLIN_DEBUG_NONE = 0, + MARLIN_DEBUG_ECHO = _BV(0), ///< Echo commands in order as they are processed + MARLIN_DEBUG_INFO = _BV(1), ///< Print messages for code that has debug output + MARLIN_DEBUG_ERRORS = _BV(2), ///< Not implemented + MARLIN_DEBUG_DRYRUN = _BV(3), ///< Ignore temperature setting and E movement commands + MARLIN_DEBUG_COMMUNICATION = _BV(4), ///< Not implemented + MARLIN_DEBUG_LEVELING = _BV(5), ///< Print detailed output for homing and leveling + MARLIN_DEBUG_MESH_ADJUST = _BV(6), ///< UBL bed leveling + MARLIN_DEBUG_ALL = 0xFF }; extern uint8_t marlin_debug_flags; -#define DEBUGGING(F) (marlin_debug_flags & (DEBUG_## F)) - -extern const char echomagic[] PROGMEM; -extern const char errormagic[] PROGMEM; +#define DEBUGGING(F) (marlin_debug_flags & (MARLIN_DEBUG_## F)) #if TX_BUFFER_SIZE < 1 #define SERIAL_FLUSHTX_P(p) @@ -53,51 +48,51 @@ extern const char errormagic[] PROGMEM; #endif #if NUM_SERIAL > 1 - #define SERIAL_CHAR_P(p,x) (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.write(x) : MYSERIAL1.write(x)) : SERIAL_CHAR(x)) - #define SERIAL_PROTOCOL_P(p,x) (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.print(x) : MYSERIAL1.print(x)) : SERIAL_PROTOCOL(x)) - #define SERIAL_PROTOCOL_F_P(p,x,y) (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.print(x,y) : MYSERIAL1.print(x,y)) : SERIAL_PROTOCOL_F(x,y)) - #define SERIAL_PROTOCOLLN_P(p,x) (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.println(x) : MYSERIAL1.println(x)) : SERIAL_PROTOCOLLN(x)) - #define SERIAL_PRINT_P(p,x,b) (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.print(x,b) : MYSERIAL1.print(x,b)) : SERIAL_PRINT(x,b)) - #define SERIAL_PRINTLN_P(p,x,b) (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.println(x,b) : MYSERIAL1.println(x,b)) : SERIAL_PRINTLN(x,b)) - #define SERIAL_PRINTF_P(p,args...) (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.printf(args) : MYSERIAL1.printf(args)) : SERIAL_PRINTF(args)) + #define SERIAL_CHAR_P(p,x) (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.write(x) : MYSERIAL1.write(x)) : SERIAL_CHAR(x)) + #define SERIAL_PROTOCOL_P(p,x) (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.print(x) : MYSERIAL1.print(x)) : SERIAL_PROTOCOL(x)) + #define SERIAL_PROTOCOL_F_P(p,x,y) (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.print(x,y) : MYSERIAL1.print(x,y)) : SERIAL_PROTOCOL_F(x,y)) + #define SERIAL_PROTOCOLLN_P(p,x) (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.println(x) : MYSERIAL1.println(x)) : SERIAL_PROTOCOLLN(x)) + #define SERIAL_PRINT_P(p,x,b) (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.print(x,b) : MYSERIAL1.print(x,b)) : SERIAL_PRINT(x,b)) + #define SERIAL_PRINTLN_P(p,x,b) (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.println(x,b) : MYSERIAL1.println(x,b)) : SERIAL_PRINTLN(x,b)) + #define SERIAL_PRINTF_P(p,args...) (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.printf(args) : MYSERIAL1.printf(args)) : SERIAL_PRINTF(args)) - #define SERIAL_CHAR(x) (MYSERIAL0.write(x), MYSERIAL1.write(x)) - #define SERIAL_PROTOCOL(x) (MYSERIAL0.print(x), MYSERIAL1.print(x)) - #define SERIAL_PROTOCOL_F(x,y) (MYSERIAL0.print(x,y), MYSERIAL1.print(x,y)) - #define SERIAL_PROTOCOLLN(x) (MYSERIAL0.println(x), MYSERIAL1.println(x)) - #define SERIAL_PRINT(x,b) (MYSERIAL0.print(x,b), MYSERIAL1.print(x,b)) - #define SERIAL_PRINTLN(x,b) (MYSERIAL0.println(x,b), MYSERIAL1.println(x,b)) - #define SERIAL_PRINTF(args...) (MYSERIAL0.printf(args), MYSERIAL1.printf(args)) + #define SERIAL_CHAR(x) (MYSERIAL0.write(x), MYSERIAL1.write(x)) + #define SERIAL_PROTOCOL(x) (MYSERIAL0.print(x), MYSERIAL1.print(x)) + #define SERIAL_PROTOCOL_F(x,y) (MYSERIAL0.print(x,y), MYSERIAL1.print(x,y)) + #define SERIAL_PROTOCOLLN(x) (MYSERIAL0.println(x), MYSERIAL1.println(x)) + #define SERIAL_PRINT(x,b) (MYSERIAL0.print(x,b), MYSERIAL1.print(x,b)) + #define SERIAL_PRINTLN(x,b) (MYSERIAL0.println(x,b), MYSERIAL1.println(x,b)) + #define SERIAL_PRINTF(args...) (MYSERIAL0.printf(args), MYSERIAL1.printf(args)) - #define SERIAL_FLUSH_P(p) (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.flush() : MYSERIAL1.flush()) : SERIAL_FLUSH()) - #define SERIAL_FLUSH() (MYSERIAL0.flush(), MYSERIAL1.flush()) + #define SERIAL_FLUSH_P(p) (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.flush() : MYSERIAL1.flush()) : SERIAL_FLUSH()) + #define SERIAL_FLUSH() (MYSERIAL0.flush(), MYSERIAL1.flush()) #if TX_BUFFER_SIZE > 0 - #define SERIAL_FLUSHTX_P(p) (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.flushTX() : MYSERIAL1.flushTX()) : SERIAL_FLUSHTX()) - #define SERIAL_FLUSHTX() (MYSERIAL0.flushTX(), MYSERIAL1.flushTX()) + #define SERIAL_FLUSHTX_P(p) (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.flushTX() : MYSERIAL1.flushTX()) : SERIAL_FLUSHTX()) + #define SERIAL_FLUSHTX() (MYSERIAL0.flushTX(), MYSERIAL1.flushTX()) #endif #define SERIAL_EOL_P(p) SERIAL_CHAR_P(p,'\n') - #define SERIAL_PROTOCOLCHAR_P(p,x) SERIAL_CHAR_P(p,x) - #define SERIAL_PROTOCOLPGM_P(p,x) (serialprintPGM_P(p,PSTR(x))) - #define SERIAL_PROTOCOLLNPGM_P(p,x) (serialprintPGM_P(p,PSTR(x "\n"))) - #define SERIAL_PROTOCOLPAIR_P(p, pre, value) (serial_echopair_PGM_P(p,PSTR(pre),(value))) - #define SERIAL_PROTOCOLLNPAIR_P(p, pre, value) do { SERIAL_PROTOCOLPAIR_P(p, pre, value); SERIAL_EOL_P(p); } while(0) + #define SERIAL_PROTOCOLCHAR_P(p,x) SERIAL_CHAR_P(p,x) + #define SERIAL_PROTOCOLPGM_P(p,x) (serialprintPGM_P(p,PSTR(x))) + #define SERIAL_PROTOCOLLNPGM_P(p,x) (serialprintPGM_P(p,PSTR(x "\n"))) + #define SERIAL_PROTOCOLPAIR_P(p, pre, value) (serial_echopair_PGM_P(p,PSTR(pre),(value))) + #define SERIAL_PROTOCOLLNPAIR_P(p, pre, value) do{ SERIAL_PROTOCOLPAIR_P(p, pre, value); SERIAL_EOL_P(p); }while(0) - #define SERIAL_ECHO_START_P(p) (serialprintPGM_P(p,echomagic)) - #define SERIAL_ECHO_P(p,x) SERIAL_PROTOCOL_P(p,x) - #define SERIAL_ECHOPGM_P(p,x) SERIAL_PROTOCOLPGM_P(p,x) - #define SERIAL_ECHOLN_P(p,x) SERIAL_PROTOCOLLN_P(p,x) - #define SERIAL_ECHOLNPGM_P(p,x) SERIAL_PROTOCOLLNPGM_P(p,x) - #define SERIAL_ECHOPAIR_P(p,pre,value) SERIAL_PROTOCOLPAIR_P(p, pre, value) - #define SERIAL_ECHOLNPAIR_P(p,pre, value) SERIAL_PROTOCOLLNPAIR_P(p, pre, value) - #define SERIAL_ECHO_F_P(p,x,y) SERIAL_PROTOCOL_F_P(p,x,y) + #define SERIAL_ECHO_START_P(p) serial_echo_start_P(p) + #define SERIAL_ECHO_P(p,x) SERIAL_PROTOCOL_P(p,x) + #define SERIAL_ECHOPGM_P(p,x) SERIAL_PROTOCOLPGM_P(p,x) + #define SERIAL_ECHOLN_P(p,x) SERIAL_PROTOCOLLN_P(p,x) + #define SERIAL_ECHOLNPGM_P(p,x) SERIAL_PROTOCOLLNPGM_P(p,x) + #define SERIAL_ECHOPAIR_P(p,pre,value) SERIAL_PROTOCOLPAIR_P(p, pre, value) + #define SERIAL_ECHOLNPAIR_P(p,pre, value) SERIAL_PROTOCOLLNPAIR_P(p, pre, value) + #define SERIAL_ECHO_F_P(p,x,y) SERIAL_PROTOCOL_F_P(p,x,y) - #define SERIAL_ERROR_START_P(p) (serialprintPGM_P(p,errormagic)) - #define SERIAL_ERROR_P(p,x) SERIAL_PROTOCOL_P(p,x) - #define SERIAL_ERRORPGM_P(p,x) SERIAL_PROTOCOLPGM_P(p,x) - #define SERIAL_ERRORLN_P(p,x) SERIAL_PROTOCOLLN_P(p,x) - #define SERIAL_ERRORLNPGM_P(p,x) SERIAL_PROTOCOLLNPGM_P(p,x) + #define SERIAL_ERROR_START_P(p) serial_error_start_P(p) + #define SERIAL_ERROR_P(p,x) SERIAL_PROTOCOL_P(p,x) + #define SERIAL_ERRORPGM_P(p,x) SERIAL_PROTOCOLPGM_P(p,x) + #define SERIAL_ERRORLN_P(p,x) SERIAL_PROTOCOLLN_P(p,x) + #define SERIAL_ERRORLNPGM_P(p,x) SERIAL_PROTOCOLLNPGM_P(p,x) // These macros compensate for float imprecision #define SERIAL_PROTOCOLPAIR_F_P(p, pre, value) SERIAL_PROTOCOLPAIR_P(p, pre, FIXFLOAT(value)) @@ -105,70 +100,74 @@ extern const char errormagic[] PROGMEM; #define SERIAL_ECHOPAIR_F_P(p,pre,value) SERIAL_ECHOPAIR_P(p, pre, FIXFLOAT(value)) #define SERIAL_ECHOLNPAIR_F_P(p,pre, value) SERIAL_ECHOLNPAIR_P(p, pre, FIXFLOAT(value)) - void serial_echopair_PGM_P(const int8_t p, const char* s_P, const char *v); - void serial_echopair_PGM_P(const int8_t p, const char* s_P, char v); - void serial_echopair_PGM_P(const int8_t p, const char* s_P, int v); - void serial_echopair_PGM_P(const int8_t p, const char* s_P, long v); - void serial_echopair_PGM_P(const int8_t p, const char* s_P, float v); - void serial_echopair_PGM_P(const int8_t p, const char* s_P, double v); - void serial_echopair_PGM_P(const int8_t p, const char* s_P, unsigned int v); - void serial_echopair_PGM_P(const int8_t p, const char* s_P, unsigned long v); - FORCE_INLINE void serial_echopair_PGM_P(const int8_t p, const char* s_P, uint8_t v) { serial_echopair_PGM_P(p, s_P, (int)v); } - FORCE_INLINE void serial_echopair_PGM_P(const int8_t p, const char* s_P, bool v) { serial_echopair_PGM_P(p, s_P, (int)v); } - FORCE_INLINE void serial_echopair_PGM_P(const int8_t p, const char* s_P, void *v) { serial_echopair_PGM_P(p, s_P, (unsigned long)v); } + void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, const char *v); + void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, char v); + void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, int v); + void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, long v); + void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, float v); + void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, double v); + void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, unsigned int v); + void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, unsigned long v); + inline void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, uint8_t v) { serial_echopair_PGM_P(p, s_P, (int)v); } + inline void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, bool v) { serial_echopair_PGM_P(p, s_P, (int)v); } + inline void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, void *v) { serial_echopair_PGM_P(p, s_P, (unsigned long)v); } void serial_spaces_P(const int8_t p, uint8_t count); - #define SERIAL_ECHO_SP_P(p,C) serial_spaces_P(p,C) - #define SERIAL_ERROR_SP_P(p,C) serial_spaces_P(p,C) - #define SERIAL_PROTOCOL_SP_P(p,C) serial_spaces_P(p,C) + #define SERIAL_ECHO_SP_P(p,C) serial_spaces_P(p,C) + #define SERIAL_ERROR_SP_P(p,C) serial_spaces_P(p,C) + #define SERIAL_PROTOCOL_SP_P(p,C) serial_spaces_P(p,C) - void serialprintPGM_P(const int8_t p, const char* str); -#else - #define SERIAL_CHAR_P(p,x) SERIAL_CHAR(x) - #define SERIAL_PROTOCOL_P(p,x) SERIAL_PROTOCOL(x) - #define SERIAL_PROTOCOL_F_P(p,x,y) SERIAL_PROTOCOL_F(x,y) - #define SERIAL_PROTOCOLLN_P(p,x) SERIAL_PROTOCOLLN(x) - #define SERIAL_PRINT_P(p,x,b) SERIAL_PRINT(x,b) - #define SERIAL_PRINTLN_P(p,x,b) SERIAL_PRINTLN(x,b) - #define SERIAL_PRINTF_P(p,args...) SERIAL_PRINTF(args) + void serialprintPGM_P(const int8_t p, PGM_P str); + void serial_echo_start_P(const int8_t p); + void serial_error_start_P(const int8_t p); - #define SERIAL_CHAR(x) MYSERIAL0.write(x) - #define SERIAL_PROTOCOL(x) MYSERIAL0.print(x) - #define SERIAL_PROTOCOL_F(x,y) MYSERIAL0.print(x,y) - #define SERIAL_PROTOCOLLN(x) MYSERIAL0.println(x) - #define SERIAL_PRINT(x,b) MYSERIAL0.print(x,b) - #define SERIAL_PRINTLN(x,b) MYSERIAL0.println(x,b) - #define SERIAL_PRINTF(args...) MYSERIAL0.printf(args) +#else // NUM_SERIAL < 2 - #define SERIAL_FLUSH_P(p) SERIAL_FLUSH() - #define SERIAL_FLUSH() MYSERIAL0.flush() + #define SERIAL_CHAR_P(p,x) SERIAL_CHAR(x) + #define SERIAL_PROTOCOL_P(p,x) SERIAL_PROTOCOL(x) + #define SERIAL_PROTOCOL_F_P(p,x,y) SERIAL_PROTOCOL_F(x,y) + #define SERIAL_PROTOCOLLN_P(p,x) SERIAL_PROTOCOLLN(x) + #define SERIAL_PRINT_P(p,x,b) SERIAL_PRINT(x,b) + #define SERIAL_PRINTLN_P(p,x,b) SERIAL_PRINTLN(x,b) + #define SERIAL_PRINTF_P(p,args...) SERIAL_PRINTF(args) + + #define SERIAL_CHAR(x) MYSERIAL0.write(x) + #define SERIAL_PROTOCOL(x) MYSERIAL0.print(x) + #define SERIAL_PROTOCOL_F(x,y) MYSERIAL0.print(x,y) + #define SERIAL_PROTOCOLLN(x) MYSERIAL0.println(x) + #define SERIAL_PRINT(x,b) MYSERIAL0.print(x,b) + #define SERIAL_PRINTLN(x,b) MYSERIAL0.println(x,b) + #define SERIAL_PRINTF(args...) MYSERIAL0.printf(args) + + #define SERIAL_FLUSH_P(p) SERIAL_FLUSH() + #define SERIAL_FLUSH() MYSERIAL0.flush() #if TX_BUFFER_SIZE > 0 - #define SERIAL_FLUSHTX_P(p) SERIAL_FLUSHTX() - #define SERIAL_FLUSHTX() MYSERIAL0.flushTX() + #define SERIAL_FLUSHTX_P(p) SERIAL_FLUSHTX() + #define SERIAL_FLUSHTX() MYSERIAL0.flushTX() #endif #define SERIAL_EOL_P(p) SERIAL_EOL() - #define SERIAL_PROTOCOLCHAR_P(p,x) SERIAL_PROTOCOLCHAR(x) - #define SERIAL_PROTOCOLPGM_P(p,x) SERIAL_PROTOCOLPGM(x) - #define SERIAL_PROTOCOLLNPGM_P(p,x) SERIAL_PROTOCOLLNPGM(x) - #define SERIAL_PROTOCOLPAIR_P(p, pre, value) SERIAL_PROTOCOLPAIR(pre, value) - #define SERIAL_PROTOCOLLNPAIR_P(p, pre, value) SERIAL_PROTOCOLLNPAIR(pre, value) + #define SERIAL_PROTOCOLCHAR_P(p,x) SERIAL_PROTOCOLCHAR(x) + #define SERIAL_PROTOCOLPGM_P(p,x) SERIAL_PROTOCOLPGM(x) + #define SERIAL_PROTOCOLLNPGM_P(p,x) SERIAL_PROTOCOLLNPGM(x) + #define SERIAL_PROTOCOLPAIR_P(p, pre, value) SERIAL_PROTOCOLPAIR(pre, value) + #define SERIAL_PROTOCOLLNPAIR_P(p, pre, value) SERIAL_PROTOCOLLNPAIR(pre, value) - #define SERIAL_ECHO_START_P(p) SERIAL_ECHO_START() - #define SERIAL_ECHO_P(p,x) SERIAL_ECHO(x) - #define SERIAL_ECHOPGM_P(p,x) SERIAL_ECHOPGM(x) - #define SERIAL_ECHOLN_P(p,x) SERIAL_ECHOLN(x) - #define SERIAL_ECHOLNPGM_P(p,x) SERIAL_ECHOLNPGM(x) - #define SERIAL_ECHOPAIR_P(p,pre,value) SERIAL_ECHOPAIR(pre, value) - #define SERIAL_ECHOLNPAIR_P(p,pre, value) SERIAL_ECHOLNPAIR(pre, value) - #define SERIAL_ECHO_F_P(p,x,y) SERIAL_ECHO_F(x,y) + #define SERIAL_ECHO_START_P(p) SERIAL_ECHO_START() + #define SERIAL_ECHO_P(p,x) SERIAL_ECHO(x) + #define SERIAL_ECHOPGM_P(p,x) SERIAL_ECHOPGM(x) + #define SERIAL_ECHOLN_P(p,x) SERIAL_ECHOLN(x) + #define SERIAL_ECHOLNPGM_P(p,x) SERIAL_ECHOLNPGM(x) + #define SERIAL_ECHOPAIR_P(p,pre,value) SERIAL_ECHOPAIR(pre, value) + #define SERIAL_ECHOLNPAIR_P(p,pre, value) SERIAL_ECHOLNPAIR(pre, value) + #define SERIAL_ECHO_F_P(p,x,y) SERIAL_ECHO_F(x,y) - #define SERIAL_ERROR_START_P(p) SERIAL_ERROR_START() - #define SERIAL_ERROR_P(p,x) SERIAL_ERROR(x) - #define SERIAL_ERRORPGM_P(p,x) SERIAL_ERRORPGM(x) - #define SERIAL_ERRORLN_P(p,x) SERIAL_ERRORLN(x) - #define SERIAL_ERRORLNPGM_P(p,x) SERIAL_ERRORLNPGM(x) + #define SERIAL_ERROR_START_P(p) SERIAL_ERROR_START() + #define SERIAL_ERROR_P(p,x) SERIAL_ERROR(x) + #define SERIAL_ERRORPGM_P(p,x) SERIAL_ERRORPGM(x) + #define SERIAL_ERRORLN_P(p,x) SERIAL_ERRORLN(x) + #define SERIAL_ERRORLNPGM_P(p,x) SERIAL_ERRORLNPGM(x) // These macros compensate for float imprecision #define SERIAL_PROTOCOLPAIR_F_P(p, pre, value) SERIAL_PROTOCOLPAIR_F(pre, value) @@ -178,69 +177,72 @@ extern const char errormagic[] PROGMEM; #define serial_echopair_PGM_P(p,s_P,v) serial_echopair_PGM(s_P, v) - #define serial_spaces_P(p,c) serial_spaces(c) - #define SERIAL_ECHO_SP_P(p,C) SERIAL_ECHO_SP(C) - #define SERIAL_ERROR_SP_P(p,C) SERIAL_ERROR_SP(C) - #define SERIAL_PROTOCOL_SP_P(p,C) SERIAL_PROTOCOL_SP(C) + #define serial_spaces_P(p,c) serial_spaces(c) + #define SERIAL_ECHO_SP_P(p,C) SERIAL_ECHO_SP(C) + #define SERIAL_ERROR_SP_P(p,C) SERIAL_ERROR_SP(C) + #define SERIAL_PROTOCOL_SP_P(p,C) SERIAL_PROTOCOL_SP(C) - #define serialprintPGM_P(p,s) serialprintPGM(s) -#endif + #define serialprintPGM_P(p,s) serialprintPGM(s) + +#endif // NUM_SERIAL < 2 #define SERIAL_EOL() SERIAL_CHAR('\n') -#define SERIAL_PROTOCOLCHAR(x) SERIAL_CHAR(x) -#define SERIAL_PROTOCOLPGM(x) (serialprintPGM(PSTR(x))) -#define SERIAL_PROTOCOLLNPGM(x) (serialprintPGM(PSTR(x "\n"))) -#define SERIAL_PROTOCOLPAIR(pre, value) (serial_echopair_PGM(PSTR(pre), value)) -#define SERIAL_PROTOCOLLNPAIR(pre, value) do { SERIAL_PROTOCOLPAIR(pre, value); SERIAL_EOL(); } while(0) +#define SERIAL_PROTOCOLCHAR(x) SERIAL_CHAR(x) +#define SERIAL_PROTOCOLPGM(x) (serialprintPGM(PSTR(x))) +#define SERIAL_PROTOCOLLNPGM(x) (serialprintPGM(PSTR(x "\n"))) +#define SERIAL_PROTOCOLPAIR(pre, value) (serial_echopair_PGM(PSTR(pre), value)) +#define SERIAL_PROTOCOLLNPAIR(pre, value) do { SERIAL_PROTOCOLPAIR(pre, value); SERIAL_EOL(); } while(0) -#define SERIAL_ECHO_START() (serialprintPGM(echomagic)) -#define SERIAL_ECHO(x) SERIAL_PROTOCOL(x) -#define SERIAL_ECHOPGM(x) SERIAL_PROTOCOLPGM(x) -#define SERIAL_ECHOLN(x) SERIAL_PROTOCOLLN(x) -#define SERIAL_ECHOLNPGM(x) SERIAL_PROTOCOLLNPGM(x) -#define SERIAL_ECHOPAIR(pre,value) SERIAL_PROTOCOLPAIR(pre, value) -#define SERIAL_ECHOLNPAIR(pre, value) SERIAL_PROTOCOLLNPAIR(pre, value) -#define SERIAL_ECHO_F(x,y) SERIAL_PROTOCOL_F(x, y) +#define SERIAL_ECHO_START() serial_echo_start() +#define SERIAL_ECHO(x) SERIAL_PROTOCOL(x) +#define SERIAL_ECHOPGM(x) SERIAL_PROTOCOLPGM(x) +#define SERIAL_ECHOLN(x) SERIAL_PROTOCOLLN(x) +#define SERIAL_ECHOLNPGM(x) SERIAL_PROTOCOLLNPGM(x) +#define SERIAL_ECHOPAIR(pre,value) SERIAL_PROTOCOLPAIR(pre, value) +#define SERIAL_ECHOLNPAIR(pre, value) SERIAL_PROTOCOLLNPAIR(pre, value) +#define SERIAL_ECHO_F(x,y) SERIAL_PROTOCOL_F(x, y) -#define SERIAL_ERROR_START() (serialprintPGM(errormagic)) -#define SERIAL_ERROR(x) SERIAL_PROTOCOL(x) -#define SERIAL_ERRORPGM(x) SERIAL_PROTOCOLPGM(x) -#define SERIAL_ERRORLN(x) SERIAL_PROTOCOLLN(x) -#define SERIAL_ERRORLNPGM(x) SERIAL_PROTOCOLLNPGM(x) +#define SERIAL_ERROR_START() serial_error_start() +#define SERIAL_ERROR(x) SERIAL_PROTOCOL(x) +#define SERIAL_ERRORPGM(x) SERIAL_PROTOCOLPGM(x) +#define SERIAL_ERRORLN(x) SERIAL_PROTOCOLLN(x) +#define SERIAL_ERRORLNPGM(x) SERIAL_PROTOCOLLNPGM(x) // These macros compensate for float imprecision -#define SERIAL_PROTOCOLPAIR_F(pre, value) SERIAL_PROTOCOLPAIR(pre, FIXFLOAT(value)) -#define SERIAL_PROTOCOLLNPAIR_F(pre, value) SERIAL_PROTOCOLLNPAIR(pre, FIXFLOAT(value)) -#define SERIAL_ECHOPAIR_F(pre,value) SERIAL_ECHOPAIR(pre, FIXFLOAT(value)) -#define SERIAL_ECHOLNPAIR_F(pre, value) SERIAL_ECHOLNPAIR(pre, FIXFLOAT(value)) +#define SERIAL_PROTOCOLPAIR_F(pre, value) SERIAL_PROTOCOLPAIR(pre, FIXFLOAT(value)) +#define SERIAL_PROTOCOLLNPAIR_F(pre, value) SERIAL_PROTOCOLLNPAIR(pre, FIXFLOAT(value)) +#define SERIAL_ECHOPAIR_F(pre,value) SERIAL_ECHOPAIR(pre, FIXFLOAT(value)) +#define SERIAL_ECHOLNPAIR_F(pre, value) SERIAL_ECHOLNPAIR(pre, FIXFLOAT(value)) -void serial_echopair_PGM(const char* s_P, const char *v); -void serial_echopair_PGM(const char* s_P, char v); -void serial_echopair_PGM(const char* s_P, int v); -void serial_echopair_PGM(const char* s_P, long v); -void serial_echopair_PGM(const char* s_P, float v); -void serial_echopair_PGM(const char* s_P, double v); -void serial_echopair_PGM(const char* s_P, unsigned int v); -void serial_echopair_PGM(const char* s_P, unsigned long v); -FORCE_INLINE void serial_echopair_PGM(const char* s_P, uint8_t v) { serial_echopair_PGM(s_P, (int)v); } -FORCE_INLINE void serial_echopair_PGM(const char* s_P, bool v) { serial_echopair_PGM(s_P, (int)v); } -FORCE_INLINE void serial_echopair_PGM(const char* s_P, void *v) { serial_echopair_PGM(s_P, (unsigned long)v); } +void serial_echopair_PGM(PGM_P s_P, const char *v); +void serial_echopair_PGM(PGM_P s_P, char v); +void serial_echopair_PGM(PGM_P s_P, int v); +void serial_echopair_PGM(PGM_P s_P, long v); +void serial_echopair_PGM(PGM_P s_P, float v); +void serial_echopair_PGM(PGM_P s_P, double v); +void serial_echopair_PGM(PGM_P s_P, unsigned int v); +void serial_echopair_PGM(PGM_P s_P, unsigned long v); +inline void serial_echopair_PGM(PGM_P s_P, uint8_t v) { serial_echopair_PGM(s_P, (int)v); } +inline void serial_echopair_PGM(PGM_P s_P, bool v) { serial_echopair_PGM(s_P, (int)v); } +inline void serial_echopair_PGM(PGM_P s_P, void *v) { serial_echopair_PGM(s_P, (unsigned long)v); } void serial_spaces(uint8_t count); -#define SERIAL_ECHO_SP(C) serial_spaces(C) -#define SERIAL_ERROR_SP(C) serial_spaces(C) -#define SERIAL_PROTOCOL_SP(C) serial_spaces(C) +#define SERIAL_ECHO_SP(C) serial_spaces(C) +#define SERIAL_ERROR_SP(C) serial_spaces(C) +#define SERIAL_PROTOCOL_SP(C) serial_spaces(C) // // Functions for serial printing from PROGMEM. (Saves loads of SRAM.) // -void serialprintPGM(const char* str); +void serialprintPGM(PGM_P str); +void serial_echo_start(); +void serial_error_start(); +void serialprint_onoff(const bool onoff); +void serialprintln_onoff(const bool onoff); #if ENABLED(DEBUG_LEVELING_FEATURE) - void print_xyz(const char* prefix, const char* suffix, const float x, const float y, const float z); - void print_xyz(const char* prefix, const char* suffix, const float xyz[]); + void print_xyz(PGM_P prefix, PGM_P suffix, const float x, const float y, const float z); + void print_xyz(PGM_P prefix, PGM_P suffix, const float xyz[]); #define DEBUG_POS(SUFFIX,VAR) do { print_xyz(PSTR(" " STRINGIFY(VAR) "="), PSTR(" : " SUFFIX "\n"), VAR); } while(0) #endif - -#endif // __SERIAL_H__ diff --git a/Marlin/src/core/utility.cpp b/Marlin/src/core/utility.cpp index ba374f7593..041c61b1ea 100644 --- a/Marlin/src/core/utility.cpp +++ b/Marlin/src/core/utility.cpp @@ -35,7 +35,7 @@ void safe_delay(millis_t ms) { thermalManager.manage_heater(); // This keeps us safe if too many small safe_delay() calls are made } -#if ENABLED(EEPROM_SETTINGS) +#if ENABLED(EEPROM_SETTINGS) || ENABLED(SD_FIRMWARE_UPDATE) void crc16(uint16_t *crc, const void * const data, uint16_t cnt) { uint8_t *ptr = (uint8_t *)data; @@ -46,9 +46,9 @@ void safe_delay(millis_t ms) { } } -#endif // EEPROM_SETTINGS +#endif // EEPROM_SETTINGS || SD_FIRMWARE_UPDATE -#if ENABLED(ULTRA_LCD) || ENABLED(DEBUG_LEVELING_FEATURE) +#if ENABLED(ULTRA_LCD) || ENABLED(DEBUG_LEVELING_FEATURE) || ENABLED(EXTENSIBLE_UI) char conv[8] = { 0 }; @@ -231,7 +231,8 @@ void safe_delay(millis_t ms) { char* ftostr52sp(const float &f) { long i = (f * 1000 + (f < 0 ? -5: 5)) / 10; uint8_t dig; - conv[1] = MINUSOR(i, RJDIGIT(i, 10000)); + conv[0] = MINUSOR(i, ' '); + conv[1] = RJDIGIT(i, 10000); conv[2] = RJDIGIT(i, 1000); conv[3] = DIGIMOD(i, 100); @@ -249,7 +250,7 @@ void safe_delay(millis_t ms) { conv[4] = conv[5] = ' '; conv[6] = ' '; } - return &conv[1]; + return conv; } #endif // ULTRA_LCD @@ -295,30 +296,32 @@ void safe_delay(millis_t ms) { #if HAS_BED_PROBE SERIAL_ECHOPGM("Probe Offset X:" STRINGIFY(X_PROBE_OFFSET_FROM_EXTRUDER) " Y:" STRINGIFY(Y_PROBE_OFFSET_FROM_EXTRUDER)); SERIAL_ECHOPAIR(" Z:", zprobe_zoffset); - #if X_PROBE_OFFSET_FROM_EXTRUDER > 0 + if ((X_PROBE_OFFSET_FROM_EXTRUDER) > 0) SERIAL_ECHOPGM(" (Right"); - #elif X_PROBE_OFFSET_FROM_EXTRUDER < 0 + else if ((X_PROBE_OFFSET_FROM_EXTRUDER) < 0) SERIAL_ECHOPGM(" (Left"); - #elif Y_PROBE_OFFSET_FROM_EXTRUDER != 0 + else if ((Y_PROBE_OFFSET_FROM_EXTRUDER) != 0) SERIAL_ECHOPGM(" (Middle"); - #else + else SERIAL_ECHOPGM(" (Aligned With"); - #endif - #if Y_PROBE_OFFSET_FROM_EXTRUDER > 0 + + if ((Y_PROBE_OFFSET_FROM_EXTRUDER) > 0) { #if IS_SCARA SERIAL_ECHOPGM("-Distal"); #else SERIAL_ECHOPGM("-Back"); #endif - #elif Y_PROBE_OFFSET_FROM_EXTRUDER < 0 + } + else if ((Y_PROBE_OFFSET_FROM_EXTRUDER) < 0) { #if IS_SCARA SERIAL_ECHOPGM("-Proximal"); #else SERIAL_ECHOPGM("-Front"); #endif - #elif X_PROBE_OFFSET_FROM_EXTRUDER != 0 + } + else if ((X_PROBE_OFFSET_FROM_EXTRUDER) != 0) SERIAL_ECHOPGM("-Center"); - #endif + if (zprobe_zoffset < 0) SERIAL_ECHOPGM(" & Below"); else if (zprobe_zoffset > 0) diff --git a/Marlin/src/core/utility.h b/Marlin/src/core/utility.h index f4f2e7cf80..324028a96f 100644 --- a/Marlin/src/core/utility.h +++ b/Marlin/src/core/utility.h @@ -19,9 +19,7 @@ * along with this program. If not, see . * */ - -#ifndef __UTILITY_H__ -#define __UTILITY_H__ +#pragma once #include "../inc/MarlinConfigPre.h" @@ -29,7 +27,7 @@ constexpr char axis_codes[XYZE] = { 'X', 'Y', 'Z', 'E' }; void safe_delay(millis_t ms); -#if ENABLED(EEPROM_SETTINGS) +#if ENABLED(EEPROM_SETTINGS) || ENABLED(SD_FIRMWARE_UPDATE) void crc16(uint16_t *crc, const void * const data, uint16_t cnt); #endif @@ -45,7 +43,7 @@ void safe_delay(millis_t ms); FORCE_INLINE bool is_bitmap_set(uint16_t bits[16], const uint8_t x, const uint8_t y) { return TEST(bits[y], x); } #endif -#if ENABLED(ULTRA_LCD) || ENABLED(DEBUG_LEVELING_FEATURE) +#if ENABLED(ULTRA_LCD) || ENABLED(DEBUG_LEVELING_FEATURE) || ENABLED(EXTENSIBLE_UI) // Convert uint8_t to string with 123 format char* i8tostr3(const uint8_t x); @@ -102,5 +100,3 @@ void safe_delay(millis_t ms); #if ENABLED(DEBUG_LEVELING_FEATURE) void log_machine_info(); #endif - -#endif // __UTILITY_H__ diff --git a/Marlin/src/feature/I2CPositionEncoder.cpp b/Marlin/src/feature/I2CPositionEncoder.cpp index 55c607ca4f..b5ab7234eb 100644 --- a/Marlin/src/feature/I2CPositionEncoder.cpp +++ b/Marlin/src/feature/I2CPositionEncoder.cpp @@ -163,8 +163,8 @@ void I2CPositionEncoder::update() { //SERIAL_ECHOLN(error); #ifdef I2CPE_ERR_THRESH_ABORT - if (ABS(error) > I2CPE_ERR_THRESH_ABORT * planner.axis_steps_per_mm[encoderAxis]) { - //kill("Significant Error"); + if (ABS(error) > I2CPE_ERR_THRESH_ABORT * planner.settings.axis_steps_per_mm[encoderAxis]) { + //kill(PSTR("Significant Error")); SERIAL_ECHOPGM("Axis error greater than set threshold, aborting!"); SERIAL_ECHOLN(error); safe_delay(5000); @@ -175,7 +175,7 @@ void I2CPositionEncoder::update() { if (errIdx == 0) { // In order to correct for "error" but avoid correcting for noise and non-skips // it must be > threshold and have a difference average of < 10 and be < 2000 steps - if (ABS(error) > threshold * planner.axis_steps_per_mm[encoderAxis] && + if (ABS(error) > threshold * planner.settings.axis_steps_per_mm[encoderAxis] && diffSum < 10 * (I2CPE_ERR_ARRAY_SIZE - 1) && ABS(error) < 2000) { // Check for persistent error (skip) errPrst[errPrstIdx++] = error; // Error must persist for I2CPE_ERR_PRST_ARRAY_SIZE error cycles. This also serves to improve the average accuracy if (errPrstIdx >= I2CPE_ERR_PRST_ARRAY_SIZE) { @@ -193,14 +193,14 @@ void I2CPositionEncoder::update() { errPrstIdx = 0; } #else - if (ABS(error) > threshold * planner.axis_steps_per_mm[encoderAxis]) { + if (ABS(error) > threshold * planner.settings.axis_steps_per_mm[encoderAxis]) { //SERIAL_ECHOLN(error); //SERIAL_ECHOLN(position); thermalManager.babystepsTodo[encoderAxis] = -LROUND(error / 2); } #endif - if (ABS(error) > I2CPE_ERR_CNT_THRESH * planner.axis_steps_per_mm[encoderAxis]) { + if (ABS(error) > I2CPE_ERR_CNT_THRESH * planner.settings.axis_steps_per_mm[encoderAxis]) { const millis_t ms = millis(); if (ELAPSED(ms, nextErrorCountTime)) { SERIAL_ECHOPAIR("Large error on ", axis_codes[encoderAxis]); @@ -232,6 +232,16 @@ void I2CPositionEncoder::set_homed() { } } +void I2CPositionEncoder::set_unhomed() { + zeroOffset = 0; + homed = trusted = false; + + #ifdef I2CPE_DEBUG + SERIAL_ECHO(axis_codes[encoderAxis]); + SERIAL_ECHOLNPGM(" axis encoder unhomed."); + #endif +} + bool I2CPositionEncoder::passes_test(const bool report) { if (report) { if (H != I2CPE_MAG_SIG_GOOD) SERIAL_ECHOPGM("Warning. "); @@ -284,7 +294,7 @@ int32_t I2CPositionEncoder::get_axis_error_steps(const bool report) { //int32_t stepperTicks = stepper.position(encoderAxis); // With a rotary encoder we're concerned with ticks/rev; whereas with a linear we're concerned with ticks/mm - stepperTicksPerUnit = (type == I2CPE_ENC_TYPE_ROTARY) ? stepperTicks : planner.axis_steps_per_mm[encoderAxis]; + stepperTicksPerUnit = (type == I2CPE_ENC_TYPE_ROTARY) ? stepperTicks : planner.settings.axis_steps_per_mm[encoderAxis]; //convert both 'ticks' into same units / base encoderCountInStepperTicksScaled = LROUND((stepperTicksPerUnit * encoderTicks) / encoderTicksPerUnit); @@ -444,14 +454,14 @@ void I2CPositionEncoder::calibrate_steps_mm(const uint8_t iter) { SERIAL_ECHOLNPGM("mm."); //Calculate new axis steps per unit - old_steps_mm = planner.axis_steps_per_mm[encoderAxis]; + old_steps_mm = planner.settings.axis_steps_per_mm[encoderAxis]; new_steps_mm = (old_steps_mm * travelDistance) / travelledDistance; SERIAL_ECHOLNPAIR("Old steps per mm: ", old_steps_mm); SERIAL_ECHOLNPAIR("New steps per mm: ", new_steps_mm); //Save new value - planner.axis_steps_per_mm[encoderAxis] = new_steps_mm; + planner.settings.axis_steps_per_mm[encoderAxis] = new_steps_mm; if (iter > 1) { total += new_steps_mm; diff --git a/Marlin/src/feature/I2CPositionEncoder.h b/Marlin/src/feature/I2CPositionEncoder.h index f5fe8bced8..32895e62ce 100644 --- a/Marlin/src/feature/I2CPositionEncoder.h +++ b/Marlin/src/feature/I2CPositionEncoder.h @@ -19,9 +19,7 @@ * along with this program. If not, see . * */ - -#ifndef I2CPOSENC_H -#define I2CPOSENC_H +#pragma once #include "../inc/MarlinConfig.h" @@ -146,6 +144,7 @@ class I2CPositionEncoder { void update(); void set_homed(); + void set_unhomed(); int32_t get_raw_count(); @@ -155,7 +154,7 @@ class I2CPositionEncoder { case I2CPE_ENC_TYPE_LINEAR: return count / encoderTicksPerUnit; case I2CPE_ENC_TYPE_ROTARY: - return (count * stepperTicks) / (encoderTicksPerUnit * planner.axis_steps_per_mm[encoderAxis]); + return (count * stepperTicks) / (encoderTicksPerUnit * planner.settings.axis_steps_per_mm[encoderAxis]); } } @@ -199,7 +198,7 @@ class I2CPositionEncoder { case I2CPE_ENC_TYPE_LINEAR: return encoderTicksPerUnit; case I2CPE_ENC_TYPE_ROTARY: - return (int)((encoderTicksPerUnit / stepperTicks) * planner.axis_steps_per_mm[encoderAxis]); + return (int)((encoderTicksPerUnit / stepperTicks) * planner.settings.axis_steps_per_mm[encoderAxis]); } } @@ -230,6 +229,11 @@ class I2CPositionEncodersMgr { if (encoders[i].get_axis() == axis) encoders[i].set_homed(); } + static void unhomed(const AxisEnum axis) { + LOOP_PE(i) + if (encoders[i].get_axis() == axis) encoders[i].set_unhomed(); + } + static void report_position(const int8_t idx, const bool units, const bool noOffset); static void report_status(const int8_t idx) { @@ -325,5 +329,3 @@ class I2CPositionEncodersMgr { }; extern I2CPositionEncodersMgr I2CPEM; - -#endif //I2CPOSENC_H diff --git a/Marlin/src/feature/Max7219_Debug_LEDs.h b/Marlin/src/feature/Max7219_Debug_LEDs.h index 8b3d19e18c..643a560944 100644 --- a/Marlin/src/feature/Max7219_Debug_LEDs.h +++ b/Marlin/src/feature/Max7219_Debug_LEDs.h @@ -96,7 +96,7 @@ public: static void send(const uint8_t reg, const uint8_t data); // Refresh all units - inline static void refresh() { for (uint8_t i = 0; i < 8; i++) refresh_line(i); } + static inline void refresh() { for (uint8_t i = 0; i < 8; i++) refresh_line(i); } // Update a single native line on all units static void refresh_line(const uint8_t line); diff --git a/Marlin/src/feature/baricuda.h b/Marlin/src/feature/baricuda.h index 7ed23925b8..a7a70d8dc9 100644 --- a/Marlin/src/feature/baricuda.h +++ b/Marlin/src/feature/baricuda.h @@ -19,11 +19,7 @@ * along with this program. If not, see . * */ - -#ifndef __BARICUDA_H__ -#define __BARICUDA_H__ +#pragma once extern uint8_t baricuda_valve_pressure, baricuda_e_to_p_pressure; - -#endif // __BARICUDA_H__ diff --git a/Marlin/src/feature/bedlevel/abl/abl.cpp b/Marlin/src/feature/bedlevel/abl/abl.cpp index 044adc5d36..f1e736c88b 100644 --- a/Marlin/src/feature/bedlevel/abl/abl.cpp +++ b/Marlin/src/feature/bedlevel/abl/abl.cpp @@ -25,6 +25,7 @@ #if ENABLED(AUTO_BED_LEVELING_BILINEAR) #include "abl.h" +#include "../bedlevel.h" #include "../../../module/motion.h" diff --git a/Marlin/src/feature/bedlevel/abl/abl.h b/Marlin/src/feature/bedlevel/abl/abl.h index 0ac1f424bb..26a5350645 100644 --- a/Marlin/src/feature/bedlevel/abl/abl.h +++ b/Marlin/src/feature/bedlevel/abl/abl.h @@ -19,33 +19,25 @@ * along with this program. If not, see . * */ +#pragma once -#ifndef __ABL_H__ -#define __ABL_H__ +#include "../../../inc/MarlinConfigPre.h" -#include "../../../inc/MarlinConfig.h" +extern int bilinear_grid_spacing[2], bilinear_start[2]; +extern float bilinear_grid_factor[2], + z_values[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y]; +float bilinear_z_offset(const float raw[XYZ]); -#if ENABLED(AUTO_BED_LEVELING_BILINEAR) +void extrapolate_unprobed_bed_level(); +void print_bilinear_leveling_grid(); +void refresh_bed_level(); +#if ENABLED(ABL_BILINEAR_SUBDIVISION) + void print_bilinear_leveling_grid_virt(); + void bed_level_virt_interpolate(); +#endif - #include "../bedlevel.h" +#if IS_CARTESIAN && DISABLED(SEGMENT_LEVELED_MOVES) + void bilinear_line_to_destination(const float fr_mm_s, uint16_t x_splits=0xFFFF, uint16_t y_splits=0xFFFF); +#endif - extern int bilinear_grid_spacing[2], bilinear_start[2]; - extern float bilinear_grid_factor[2], - z_values[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y]; - float bilinear_z_offset(const float raw[XYZ]); - - void extrapolate_unprobed_bed_level(); - void print_bilinear_leveling_grid(); - void refresh_bed_level(); - #if ENABLED(ABL_BILINEAR_SUBDIVISION) - void print_bilinear_leveling_grid_virt(); - void bed_level_virt_interpolate(); - #endif - - #if IS_CARTESIAN && DISABLED(SEGMENT_LEVELED_MOVES) - void bilinear_line_to_destination(const float fr_mm_s, uint16_t x_splits=0xFFFF, uint16_t y_splits=0xFFFF); - #endif - -#endif // AUTO_BED_LEVELING_BILINEAR - -#endif // __ABL_H__ +#define Z_VALUES(X,Y) z_values[X][Y] diff --git a/Marlin/src/feature/bedlevel/bedlevel.cpp b/Marlin/src/feature/bedlevel/bedlevel.cpp index 5dc328c273..bc5bf2397d 100644 --- a/Marlin/src/feature/bedlevel/bedlevel.cpp +++ b/Marlin/src/feature/bedlevel/bedlevel.cpp @@ -159,8 +159,7 @@ void reset_bed_level() { void print_2d_array(const uint8_t sx, const uint8_t sy, const uint8_t precision, element_2d_fn fn) { #ifndef SCAD_MESH_OUTPUT for (uint8_t x = 0; x < sx; x++) { - for (uint8_t i = 0; i < precision + 2 + (x < 10 ? 1 : 0); i++) - SERIAL_PROTOCOLCHAR(' '); + serial_spaces(precision + (x < 10 ? 3 : 2)); SERIAL_PROTOCOL(int(x)); } SERIAL_EOL(); @@ -234,7 +233,7 @@ void reset_bed_level() { current_position[Y_AXIS] = ry; #if ENABLED(LCD_BED_LEVELING) - lcd_wait_for_move = false; + ui.wait_for_bl_move = false; #endif } diff --git a/Marlin/src/feature/bedlevel/bedlevel.h b/Marlin/src/feature/bedlevel/bedlevel.h index 3db5aabd68..b57ed696fa 100644 --- a/Marlin/src/feature/bedlevel/bedlevel.h +++ b/Marlin/src/feature/bedlevel/bedlevel.h @@ -19,9 +19,7 @@ * along with this program. If not, see . * */ - -#ifndef __BEDLEVEL_H__ -#define __BEDLEVEL_H__ +#pragma once #include "../../inc/MarlinConfigPre.h" @@ -82,8 +80,6 @@ void reset_bed_level(); #include "mbl/mesh_bed_leveling.h" #elif ENABLED(AUTO_BED_LEVELING_UBL) #include "ubl/ubl.h" -#elif HAS_ABL +#elif ENABLED(AUTO_BED_LEVELING_BILINEAR) #include "abl/abl.h" #endif - -#endif // __BEDLEVEL_H__ diff --git a/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.cpp b/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.cpp index 36812b6355..bf60f87083 100644 --- a/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.cpp +++ b/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.cpp @@ -119,8 +119,8 @@ #endif // IS_CARTESIAN && !SEGMENT_LEVELED_MOVES void mesh_bed_leveling::report_mesh() { - SERIAL_PROTOCOLLNPGM("Num X,Y: " STRINGIFY(GRID_MAX_POINTS_X) "," STRINGIFY(GRID_MAX_POINTS_Y)); - SERIAL_PROTOCOLPGM("Z offset: "); SERIAL_PROTOCOL_F(z_offset, 5); + SERIAL_PROTOCOLPGM(STRINGIFY(GRID_MAX_POINTS_X) "x" STRINGIFY(GRID_MAX_POINTS_Y) " mesh. Z offset: "); + SERIAL_PROTOCOL_F(z_offset, 5); SERIAL_PROTOCOLLNPGM("\nMeasured points:"); print_2d_array(GRID_MAX_POINTS_X, GRID_MAX_POINTS_Y, 5, [](const uint8_t ix, const uint8_t iy) { return z_values[ix][iy]; } diff --git a/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.h b/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.h index 5b68edefe5..8fbba8f7e8 100644 --- a/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.h +++ b/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.h @@ -19,19 +19,17 @@ * along with this program. If not, see . * */ - -#ifndef _MESH_BED_LEVELING_H_ -#define _MESH_BED_LEVELING_H_ +#pragma once #include "../../../inc/MarlinConfig.h" enum MeshLevelingState : char { - MeshReport, - MeshStart, - MeshNext, - MeshSet, - MeshSetZOffset, - MeshReset + MeshReport, // G29 S0 + MeshStart, // G29 S1 + MeshNext, // G29 S2 + MeshSet, // G29 S3 + MeshSetZOffset, // G29 S4 + MeshReset // G29 S5 }; #define MESH_X_DIST ((MESH_MAX_X - (MESH_MIN_X)) / (GRID_MAX_POINTS_X - 1)) @@ -121,4 +119,4 @@ public: extern mesh_bed_leveling mbl; -#endif // _MESH_BED_LEVELING_H_ +#define Z_VALUES(X,Y) mbl.z_values[X][Y] diff --git a/Marlin/src/feature/bedlevel/ubl/ubl.cpp b/Marlin/src/feature/bedlevel/ubl/ubl.cpp index 143d7a0fcc..c5ff87466a 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl.cpp @@ -34,8 +34,6 @@ #include "math.h" - uint8_t ubl_cnt = 0; - void unified_bed_leveling::echo_name( #if NUM_SERIAL > 1 const int8_t port/*= -1*/ @@ -90,7 +88,7 @@ SERIAL_ECHO_F(destination[X_AXIS], 6); } - void debug_current_and_destination(const char *title) { + 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 @@ -106,30 +104,19 @@ if (xy_dist == 0.0) return; - SERIAL_ECHOPGM(" fpmm="); const float fpmm = de / xy_dist; - SERIAL_ECHO_F(fpmm, 6); - + SERIAL_ECHOPGM(" fpmm="); SERIAL_ECHO_F(fpmm, 6); SERIAL_ECHOPGM(" current=( "); - SERIAL_ECHO_F(current_position[X_AXIS], 6); - SERIAL_ECHOPGM(", "); - SERIAL_ECHO_F(current_position[Y_AXIS], 6); - SERIAL_ECHOPGM(", "); - SERIAL_ECHO_F(current_position[Z_AXIS], 6); - SERIAL_ECHOPGM(", "); - SERIAL_ECHO_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(" ) "); - SERIAL_ECHO(title); + SERIAL_ECHO_F(current_position[X_AXIS], 6); SERIAL_ECHOPGM(", "); + SERIAL_ECHO_F(current_position[Y_AXIS], 6); SERIAL_ECHOPGM(", "); + SERIAL_ECHO_F(current_position[Z_AXIS], 6); SERIAL_ECHOPGM(", "); + SERIAL_ECHO_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 @@ -143,14 +130,13 @@ constexpr float unified_bed_leveling::_mesh_index_to_xpos[16], unified_bed_leveling::_mesh_index_to_ypos[16]; - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU bool unified_bed_leveling::lcd_map_control = false; #endif volatile int unified_bed_leveling::encoder_diff; unified_bed_leveling::unified_bed_leveling() { - ubl_cnt++; // Debug counter to ensure we only have one UBL object present in memory. We can eliminate this (and all references to ubl_cnt) very soon. reset(); } diff --git a/Marlin/src/feature/bedlevel/ubl/ubl.h b/Marlin/src/feature/bedlevel/ubl/ubl.h index 2db2b4dd7a..cd13e081d9 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl.h +++ b/Marlin/src/feature/bedlevel/ubl/ubl.h @@ -19,15 +19,14 @@ * along with this program. If not, see . * */ - -#ifndef UNIFIED_BED_LEVELING_H -#define UNIFIED_BED_LEVELING_H +#pragma once //#define UBL_DEVEL_DEBUGGING #include "../bedlevel.h" #include "../../../module/planner.h" #include "../../../module/motion.h" +#include "../../../lcd/ultralcd.h" #include "../../../Marlin.h" #define UBL_VERSION "1.01" @@ -40,9 +39,9 @@ // ubl_motion.cpp #if ENABLED(UBL_DEVEL_DEBUGGING) - void debug_current_and_destination(const char * const title); + void debug_current_and_destination(PGM_P const title); #else - FORCE_INLINE void debug_current_and_destination(const char * const title) { UNUSED(title); } + FORCE_INLINE void debug_current_and_destination(PGM_P const title) { UNUSED(title); } #endif // ubl_G29.cpp @@ -51,14 +50,6 @@ enum MeshPointType : char { INVALID, REAL, SET_IN_BITMAP }; // External references -extern uint8_t ubl_cnt; - -/////////////////////////////////////////////////////////////////////////////////////////////////////// - -#if ENABLED(ULTRA_LCD) - void lcd_quick_feedback(const bool clear_buttons); -#endif - #define MESH_X_DIST (float(MESH_MAX_X - (MESH_MIN_X)) / float(GRID_MAX_POINTS_X - 1)) #define MESH_Y_DIST (float(MESH_MAX_Y - (MESH_MIN_Y)) / float(GRID_MAX_POINTS_Y - 1)) @@ -92,12 +83,15 @@ class unified_bed_leveling { static void probe_entire_mesh(const float &rx, const float &ry, const bool do_ubl_mesh_map, const bool stow_probe, const bool do_furthest) _O0; static void tilt_mesh_based_on_3pts(const float &z1, const float &z2, const float &z3); static void tilt_mesh_based_on_probed_grid(const bool do_ubl_mesh_map); - static void g29_what_command(); - static void g29_eeprom_dump(); - static void g29_compare_current_mesh_to_stored_mesh(); static bool smart_fill_one(const uint8_t x, const uint8_t y, const int8_t xdir, const int8_t ydir); static void smart_fill_mesh(); + #if ENABLED(UBL_DEVEL_DEBUGGING) + static void g29_what_command(); + static void g29_eeprom_dump(); + static void g29_compare_current_mesh_to_stored_mesh(); + #endif + public: static void echo_name( @@ -157,7 +151,7 @@ class unified_bed_leveling { MESH_MIN_Y + 14 * (MESH_Y_DIST), MESH_MIN_Y + 15 * (MESH_Y_DIST) }; - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU static bool lcd_map_control; #endif @@ -348,11 +342,11 @@ class unified_bed_leveling { return z0; } - FORCE_INLINE static float mesh_index_to_xpos(const uint8_t i) { + static inline float mesh_index_to_xpos(const uint8_t i) { return i < GRID_MAX_POINTS_X ? pgm_read_float(&_mesh_index_to_xpos[i]) : MESH_MIN_X + i * (MESH_X_DIST); } - FORCE_INLINE static float mesh_index_to_ypos(const uint8_t i) { + static inline float mesh_index_to_ypos(const uint8_t i) { return i < GRID_MAX_POINTS_Y ? pgm_read_float(&_mesh_index_to_ypos[i]) : MESH_MIN_Y + i * (MESH_Y_DIST); } @@ -373,4 +367,4 @@ class unified_bed_leveling { extern unified_bed_leveling ubl; -#endif // UNIFIED_BED_LEVELING_H +#define Z_VALUES(X,Y) ubl.z_values[X][Y] diff --git a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp index 671ed79947..3e03dd0fd5 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp @@ -52,8 +52,7 @@ extern float destination[XYZE], current_position[XYZE]; - #if ENABLED(NEWPANEL) - void lcd_return_to_status(); + #if HAS_LCD_MENU void _lcd_ubl_output_map_lcd(); #endif @@ -128,9 +127,6 @@ * J # Grid Perform a Grid Based Leveling of the current Mesh using a grid with n points on a side. * Not specifying a grid size will invoke the 3-Point leveling function. * - * K # Kompare Kompare current Mesh with stored Mesh # replacing current Mesh with the result. This - * command literally performs a diff between two Meshes. - * * L Load Load Mesh from the previously activated location in the EEPROM. * * L # Load Load Mesh from the specified location in the EEPROM. Set this location as activated @@ -266,12 +262,20 @@ * * V # Verbosity Set the verbosity level (0-4) for extra details. (Default 0) * - * W What? Display valuable Unified Bed Leveling System data. - * * X # X Location for this command * * Y # Y Location for this command * + * With UBL_DEVEL_DEBUGGING: + * + * K # Kompare Kompare current Mesh with stored Mesh #, replacing current Mesh with the result. + * This command literally performs a diff between two Meshes. + * + * Q-1 Dump EEPROM Dump the UBL contents stored in EEPROM as HEX format. Useful for developers to help + * verify correct operation of the UBL. + * + * W What? Display valuable UBL data. + * * * Release Notes: * You MUST do M502, M500 to initialize the storage. Failure to do this will cause all @@ -345,9 +349,13 @@ } SERIAL_PROTOCOLLNPGM("Loading test_pattern values.\n"); switch (test_pattern) { - case -1: - g29_eeprom_dump(); - break; + + #if ENABLED(UBL_DEVEL_DEBUGGING) + case -1: + g29_eeprom_dump(); + break; + #endif + case 0: for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++) { // Create a bowl shape - similar to for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++) { // a poorly calibrated Delta. @@ -357,12 +365,14 @@ } } break; + case 1: for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++) { // Create a diagonal line several Mesh cells thick that is raised z_values[x][x] += 9.999f; z_values[x][x + (x < GRID_MAX_POINTS_Y - 1) ? 1 : -1] += 9.999f; // We want the altered line several mesh points thick } break; + case 2: // Allow the user to specify the height because 10mm is a little extreme in some cases. for (uint8_t x = (GRID_MAX_POINTS_X) / 3; x < 2 * (GRID_MAX_POINTS_X) / 3; x++) // Create a rectangular raised area in @@ -432,7 +442,7 @@ #endif // HAS_BED_PROBE case 2: { - #if ENABLED(NEWPANEL) + #if HAS_LCD_MENU // // Manually Probe Mesh in areas that can't be reached by the probe // @@ -540,7 +550,7 @@ } case 4: // Fine Tune (i.e., Edit) the Mesh - #if ENABLED(NEWPANEL) + #if HAS_LCD_MENU fine_tune_mesh(g29_x_pos, g29_y_pos, parser.seen('T')); #else SERIAL_PROTOCOLLNPGM("?P4 is only available when an LCD is present."); @@ -554,19 +564,24 @@ } } - // - // Much of the 'What?' command can be eliminated. But until we are fully debugged, it is - // good to have the extra information. Soon... we prune this to just a few items - // - if (parser.seen('W')) g29_what_command(); + #if ENABLED(UBL_DEVEL_DEBUGGING) - // - // When we are fully debugged, this may go away. But there are some valid - // use cases for the users. So we can wait and see what to do with it. - // + // + // Much of the 'What?' command can be eliminated. But until we are fully debugged, it is + // good to have the extra information. Soon... we prune this to just a few items + // + if (parser.seen('W')) g29_what_command(); + + // + // When we are fully debugged, this may go away. But there are some valid + // use cases for the users. So we can wait and see what to do with it. + // + + if (parser.seen('K')) // Kompare Current Mesh Data to Specified Stored Mesh + g29_compare_current_mesh_to_stored_mesh(); + + #endif // UBL_DEVEL_DEBUGGING - if (parser.seen('K')) // Kompare Current Mesh Data to Specified Stored Mesh - g29_compare_current_mesh_to_stored_mesh(); // // Load a Mesh from the EEPROM @@ -628,11 +643,11 @@ LEAVE: - #if ENABLED(NEWPANEL) - lcd_reset_alert_level(); - lcd_quick_feedback(true); - lcd_reset_status(); - lcd_external_control = false; + #if HAS_LCD_MENU + ui.reset_alert_level(); + ui.quick_feedback(); + ui.reset_status(); + ui.release(); #endif return; @@ -683,32 +698,6 @@ z_values[x][y] += g29_constant; } - #if ENABLED(NEWPANEL) - - typedef void (*clickFunc_t)(); - - bool click_and_hold(const clickFunc_t func=NULL) { - if (is_lcd_clicked()) { - lcd_quick_feedback(false); // Do NOT clear button status! If cleared, the code - // code can not look for a 'click and hold' - const millis_t nxt = millis() + 1500UL; - while (is_lcd_clicked()) { // Loop while the encoder is pressed. Uses hardware flag! - idle(); // idle, of course - if (ELAPSED(millis(), nxt)) { // After 1.5 seconds - lcd_quick_feedback(true); - if (func) (*func)(); - wait_for_release(); - safe_delay(50); // Debounce the Encoder wheel - return true; - } - } - } - safe_delay(15); - return false; - } - - #endif // NEWPANEL - #if HAS_BED_PROBE /** * Probe all invalidated locations of the mesh that can be reached by the probe. @@ -717,11 +706,11 @@ void unified_bed_leveling::probe_entire_mesh(const float &rx, const float &ry, const bool do_ubl_mesh_map, const bool stow_probe, const bool do_furthest) { mesh_index_pair location; - #if ENABLED(NEWPANEL) - lcd_external_control = true; + #if HAS_LCD_MENU + ui.capture(); #endif - save_ubl_active_state_and_disable(); // we don't do bed level correction because we want the raw data when we probe + save_ubl_active_state_and_disable(); // No bed level correction so only raw data is obtained DEPLOY_PROBE(); uint16_t count = GRID_MAX_POINTS; @@ -729,16 +718,15 @@ do { if (do_ubl_mesh_map) display_map(g29_map_type); - #if ENABLED(NEWPANEL) - if (is_lcd_clicked()) { + #if HAS_LCD_MENU + if (ui.button_pressed()) { + ui.quick_feedback(false); // Preserve button state for click-and-hold SERIAL_PROTOCOLLNPGM("\nMesh only partially populated.\n"); - lcd_quick_feedback(false); STOW_PROBE(); - while (is_lcd_clicked()) idle(); - lcd_external_control = false; + ui.wait_for_release(); + ui.quick_feedback(); + ui.release(); restore_ubl_active_state_and_leave(); - lcd_quick_feedback(true); - safe_delay(50); // Debounce the Encoder wheel return; } #endif @@ -772,14 +760,33 @@ ); } - #endif // HAS_BED_PROBE - #if ENABLED(NEWPANEL) + #if HAS_LCD_MENU + + typedef void (*clickFunc_t)(); + + bool click_and_hold(const clickFunc_t func=NULL) { + if (ui.button_pressed()) { + ui.quick_feedback(false); // Preserve button state for click-and-hold + const millis_t nxt = millis() + 1500UL; + while (ui.button_pressed()) { // Loop while the encoder is pressed. Uses hardware flag! + idle(); // idle, of course + if (ELAPSED(millis(), nxt)) { // After 1.5 seconds + ui.quick_feedback(); + if (func) (*func)(); + ui.wait_for_release(); + return true; + } + } + } + safe_delay(15); + return false; + } void unified_bed_leveling::move_z_with_encoder(const float &multiplier) { - wait_for_release(); - while (!is_lcd_clicked()) { + ui.wait_for_release(); + while (!ui.button_pressed()) { idle(); gcode.reset_stepper_timeout(); // Keep steppers powered if (encoder_diff) { @@ -799,16 +806,16 @@ static void echo_and_take_a_measurement() { SERIAL_PROTOCOLLNPGM(" and take a measurement."); } float unified_bed_leveling::measure_business_card_thickness(float in_height) { - lcd_external_control = true; + ui.capture(); save_ubl_active_state_and_disable(); // Disable bed level correction for probing do_blocking_move_to(0.5f * (MESH_MAX_X - (MESH_MIN_X)), 0.5f * (MESH_MAX_Y - (MESH_MIN_Y)), in_height); - //, MIN(planner.max_feedrate_mm_s[X_AXIS], planner.max_feedrate_mm_s[Y_AXIS]) * 0.5f); + //, MIN(planner.settings.max_feedrate_mm_s[X_AXIS], planner.settings.max_feedrate_mm_s[Y_AXIS]) * 0.5f); planner.synchronize(); SERIAL_PROTOCOLPGM("Place shim under nozzle"); LCD_MESSAGEPGM(MSG_UBL_BC_INSERT); - lcd_return_to_status(); + ui.return_to_status(); echo_and_take_a_measurement(); const float z1 = measure_point_with_encoder(); @@ -831,7 +838,7 @@ SERIAL_PROTOCOLLNPGM("mm thick."); } - lcd_external_control = false; + ui.release(); restore_ubl_active_state_and_leave(); @@ -841,20 +848,20 @@ void abort_manual_probe_remaining_mesh() { SERIAL_PROTOCOLLNPGM("\nMesh only partially populated."); do_blocking_move_to_z(Z_CLEARANCE_DEPLOY_PROBE); - lcd_external_control = false; + ui.release(); KEEPALIVE_STATE(IN_HANDLER); - lcd_quick_feedback(true); + ui.quick_feedback(); ubl.restore_ubl_active_state_and_leave(); } void unified_bed_leveling::manually_probe_remaining_mesh(const float &rx, const float &ry, const float &z_clearance, const float &thick, const bool do_ubl_mesh_map) { - lcd_external_control = true; + ui.capture(); - save_ubl_active_state_and_disable(); // we don't do bed level correction because we want the raw data when we probe + save_ubl_active_state_and_disable(); // No bed level correction so only raw data is obtained do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], z_clearance); - lcd_return_to_status(); + ui.return_to_status(); mesh_index_pair location; do { @@ -873,7 +880,7 @@ do_blocking_move_to_z(z_clearance); KEEPALIVE_STATE(PAUSED_FOR_USER); - lcd_external_control = true; + ui.capture(); if (do_ubl_mesh_map) display_map(g29_map_type); // show user where we're probing @@ -887,7 +894,7 @@ if (click_and_hold()) { SERIAL_PROTOCOLLNPGM("\nMesh only partially populated."); do_blocking_move_to_z(Z_CLEARANCE_DEPLOY_PROBE); - lcd_external_control = false; + ui.release(); KEEPALIVE_STATE(IN_HANDLER); restore_ubl_active_state_and_leave(); return; @@ -908,14 +915,127 @@ KEEPALIVE_STATE(IN_HANDLER); do_blocking_move_to(rx, ry, Z_CLEARANCE_DEPLOY_PROBE); } - #endif // NEWPANEL + + inline void set_message_with_feedback(PGM_P const msg_P) { + ui.set_status_P(msg_P); + ui.quick_feedback(); + } + + void abort_fine_tune() { + ui.return_to_status(); + do_blocking_move_to_z(Z_CLEARANCE_BETWEEN_PROBES); + set_message_with_feedback(PSTR(MSG_EDITING_STOPPED)); + } + + void unified_bed_leveling::fine_tune_mesh(const float &rx, const float &ry, const bool do_ubl_mesh_map) { + if (!parser.seen('R')) // fine_tune_mesh() is special. If no repetition count flag is specified + g29_repetition_cnt = 1; // do exactly one mesh location. Otherwise use what the parser decided. + + #if ENABLED(UBL_MESH_EDIT_MOVES_Z) + const float h_offset = parser.seenval('H') ? parser.value_linear_units() : 0; + if (!WITHIN(h_offset, 0, 10)) { + SERIAL_PROTOCOLLNPGM("Offset out of bounds. (0 to 10mm)\n"); + return; + } + #endif + + mesh_index_pair location; + + if (!position_is_reachable(rx, ry)) { + SERIAL_PROTOCOLLNPGM("(X,Y) outside printable radius."); + return; + } + + save_ubl_active_state_and_disable(); + + LCD_MESSAGEPGM(MSG_UBL_FINE_TUNE_MESH); + ui.capture(); // Take over control of the LCD encoder + + do_blocking_move_to(rx, ry, Z_CLEARANCE_BETWEEN_PROBES); // Move to the given XY with probe clearance + + #if ENABLED(UBL_MESH_EDIT_MOVES_Z) + do_blocking_move_to_z(h_offset); // Move Z to the given 'H' offset + #endif + + uint16_t not_done[16]; + memset(not_done, 0xFF, sizeof(not_done)); + do { + location = find_closest_mesh_point_of_type(SET_IN_BITMAP, rx, ry, USE_NOZZLE_AS_REFERENCE, not_done); + + if (location.x_index < 0) break; // Stop when there are no more reachable points + + bitmap_clear(not_done, location.x_index, location.y_index); // Mark this location as 'adjusted' so a new + // location is used on the next loop + + const float rawx = mesh_index_to_xpos(location.x_index), + rawy = mesh_index_to_ypos(location.y_index); + + if (!position_is_reachable(rawx, rawy)) break; // SHOULD NOT OCCUR because find_closest_mesh_point_of_type will only return reachable + + do_blocking_move_to(rawx, rawy, Z_CLEARANCE_BETWEEN_PROBES); // Move the nozzle to the edit point with probe clearance + + #if ENABLED(UBL_MESH_EDIT_MOVES_Z) + do_blocking_move_to_z(h_offset); // Move Z to the given 'H' offset before editing + #endif + + KEEPALIVE_STATE(PAUSED_FOR_USER); + + if (do_ubl_mesh_map) display_map(g29_map_type); // Display the current point + + ui.refresh(); + + float new_z = z_values[location.x_index][location.y_index]; + if (isnan(new_z)) new_z = 0; // Invalid points begin at 0 + new_z = FLOOR(new_z * 1000) * 0.001f; // Chop off digits after the 1000ths place + + lcd_mesh_edit_setup(new_z); + + do { + new_z = lcd_mesh_edit(); + #if ENABLED(UBL_MESH_EDIT_MOVES_Z) + do_blocking_move_to_z(h_offset + new_z); // Move the nozzle as the point is edited + #endif + idle(); + SERIAL_FLUSH(); // Prevent host M105 buffer overrun. + } while (!ui.button_pressed()); + + if (!lcd_map_control) ui.return_to_status(); // Just editing a single point? Return to status + + if (click_and_hold(abort_fine_tune)) goto FINE_TUNE_EXIT; // If the click is held down, abort editing + + z_values[location.x_index][location.y_index] = new_z; // Save the updated Z value + + safe_delay(20); // No switch noise + ui.refresh(); + + } while (location.x_index >= 0 && --g29_repetition_cnt > 0); + + FINE_TUNE_EXIT: + + ui.release(); + KEEPALIVE_STATE(IN_HANDLER); + + if (do_ubl_mesh_map) display_map(g29_map_type); + restore_ubl_active_state_and_leave(); + + do_blocking_move_to(rx, ry, Z_CLEARANCE_BETWEEN_PROBES); + + LCD_MESSAGEPGM(MSG_UBL_DONE_EDITING_MESH); + SERIAL_ECHOLNPGM("Done Editing Mesh"); + + if (lcd_map_control) + ui.goto_screen(_lcd_ubl_output_map_lcd); + else + ui.return_to_status(); + } + + #endif // HAS_LCD_MENU bool unified_bed_leveling::g29_parameter_parsing() { bool err_flag = false; - #if ENABLED(NEWPANEL) - LCD_MESSAGEPGM(MSG_UBL_DOING_G29); - lcd_quick_feedback(true); + #if HAS_LCD_MENU + set_message_with_feedback(PSTR(MSG_UBL_DOING_G29)); #endif g29_constant = 0; @@ -1027,18 +1147,17 @@ static uint8_t ubl_state_at_invocation = 0; - #ifdef UBL_DEVEL_DEBUGGING + #if ENABLED(UBL_DEVEL_DEBUGGING) static uint8_t ubl_state_recursion_chk = 0; #endif void unified_bed_leveling::save_ubl_active_state_and_disable() { - #ifdef UBL_DEVEL_DEBUGGING + #if ENABLED(UBL_DEVEL_DEBUGGING) ubl_state_recursion_chk++; if (ubl_state_recursion_chk != 1) { SERIAL_ECHOLNPGM("save_ubl_active_state_and_disabled() called multiple times in a row."); - #if ENABLED(NEWPANEL) - LCD_MESSAGEPGM(MSG_UBL_SAVE_ERROR); - lcd_quick_feedback(true); + #if HAS_LCD_MENU + set_message_with_feedback(PSTR(MSG_UBL_SAVE_ERROR)); #endif return; } @@ -1048,12 +1167,11 @@ } void unified_bed_leveling::restore_ubl_active_state_and_leave() { - #ifdef UBL_DEVEL_DEBUGGING + #if ENABLED(UBL_DEVEL_DEBUGGING) if (--ubl_state_recursion_chk) { SERIAL_ECHOLNPGM("restore_ubl_active_state_and_leave() called too many times."); - #if ENABLED(NEWPANEL) - LCD_MESSAGEPGM(MSG_UBL_RESTORE_ERROR); - lcd_quick_feedback(true); + #if HAS_LCD_MENU + set_message_with_feedback(PSTR(MSG_UBL_RESTORE_ERROR)); #endif return; } @@ -1061,170 +1179,6 @@ set_bed_leveling_enabled(ubl_state_at_invocation); } - /** - * Much of the 'What?' command can be eliminated. But until we are fully debugged, it is - * good to have the extra information. Soon... we prune this to just a few items - */ - void unified_bed_leveling::g29_what_command() { - report_state(); - - if (storage_slot == -1) - SERIAL_PROTOCOLPGM("No Mesh Loaded."); - else { - SERIAL_PROTOCOLPAIR("Mesh ", storage_slot); - SERIAL_PROTOCOLPGM(" Loaded."); - } - SERIAL_EOL(); - safe_delay(50); - - SERIAL_PROTOCOLLNPAIR("UBL object count: ", (int)ubl_cnt); - - #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) - SERIAL_PROTOCOLPGM("planner.z_fade_height : "); - SERIAL_PROTOCOL_F(planner.z_fade_height, 4); - SERIAL_EOL(); - #endif - - adjust_mesh_to_mean(g29_c_flag, g29_constant); - - #if HAS_BED_PROBE - SERIAL_PROTOCOLPGM("zprobe_zoffset: "); - SERIAL_PROTOCOL_F(zprobe_zoffset, 7); - SERIAL_EOL(); - #endif - - SERIAL_ECHOLNPAIR("MESH_MIN_X " STRINGIFY(MESH_MIN_X) "=", MESH_MIN_X); - safe_delay(50); - SERIAL_ECHOLNPAIR("MESH_MIN_Y " STRINGIFY(MESH_MIN_Y) "=", MESH_MIN_Y); - safe_delay(50); - SERIAL_ECHOLNPAIR("MESH_MAX_X " STRINGIFY(MESH_MAX_X) "=", MESH_MAX_X); - safe_delay(50); - SERIAL_ECHOLNPAIR("MESH_MAX_Y " STRINGIFY(MESH_MAX_Y) "=", MESH_MAX_Y); - safe_delay(50); - SERIAL_ECHOLNPAIR("GRID_MAX_POINTS_X ", GRID_MAX_POINTS_X); - safe_delay(50); - SERIAL_ECHOLNPAIR("GRID_MAX_POINTS_Y ", GRID_MAX_POINTS_Y); - safe_delay(50); - SERIAL_ECHOLNPAIR("MESH_X_DIST ", MESH_X_DIST); - SERIAL_ECHOLNPAIR("MESH_Y_DIST ", MESH_Y_DIST); - safe_delay(50); - - SERIAL_PROTOCOLPGM("X-Axis Mesh Points at: "); - for (uint8_t i = 0; i < GRID_MAX_POINTS_X; i++) { - SERIAL_PROTOCOL_F(LOGICAL_X_POSITION(mesh_index_to_xpos(i)), 3); - SERIAL_PROTOCOLPGM(" "); - safe_delay(25); - } - SERIAL_EOL(); - - SERIAL_PROTOCOLPGM("Y-Axis Mesh Points at: "); - for (uint8_t i = 0; i < GRID_MAX_POINTS_Y; i++) { - SERIAL_PROTOCOL_F(LOGICAL_Y_POSITION(mesh_index_to_ypos(i)), 3); - SERIAL_PROTOCOLPGM(" "); - safe_delay(25); - } - SERIAL_EOL(); - - #if HAS_KILL - SERIAL_PROTOCOLPAIR("Kill pin on :", KILL_PIN); - SERIAL_PROTOCOLLNPAIR(" state:", READ(KILL_PIN)); - #endif - SERIAL_EOL(); - safe_delay(50); - - #ifdef UBL_DEVEL_DEBUGGING - SERIAL_PROTOCOLLNPAIR("ubl_state_at_invocation :", ubl_state_at_invocation); - SERIAL_EOL(); - SERIAL_PROTOCOLLNPAIR("ubl_state_recursion_chk :", ubl_state_recursion_chk); - SERIAL_EOL(); - safe_delay(50); - - SERIAL_PROTOCOLPAIR("Meshes go from ", hex_address((void*)settings.meshes_start_index())); - SERIAL_PROTOCOLLNPAIR(" to ", hex_address((void*)settings.meshes_end_index())); - safe_delay(50); - - SERIAL_PROTOCOLLNPAIR("sizeof(ubl) : ", (int)sizeof(ubl)); - SERIAL_EOL(); - SERIAL_PROTOCOLLNPAIR("z_value[][] size: ", (int)sizeof(z_values)); - SERIAL_EOL(); - safe_delay(25); - - SERIAL_PROTOCOLLNPAIR("EEPROM free for UBL: ", hex_address((void*)(settings.meshes_end_index() - settings.meshes_start_index()))); - safe_delay(50); - - SERIAL_PROTOCOLPAIR("EEPROM can hold ", settings.calc_num_meshes()); - SERIAL_PROTOCOLLNPGM(" meshes.\n"); - safe_delay(25); - #endif // UBL_DEVEL_DEBUGGING - - if (!sanity_check()) { - echo_name(); - SERIAL_PROTOCOLLNPGM(" sanity checks passed."); - } - } - - /** - * When we are fully debugged, the EEPROM dump command will get deleted also. But - * right now, it is good to have the extra information. Soon... we prune this. - */ - void unified_bed_leveling::g29_eeprom_dump() { - uint8_t cccc; - - SERIAL_ECHO_START(); - SERIAL_ECHOLNPGM("EEPROM Dump:"); - persistentStore.access_start(); - for (uint16_t i = 0; i < persistentStore.capacity(); i += 16) { - if (!(i & 0x3)) idle(); - print_hex_word(i); - SERIAL_ECHOPGM(": "); - for (uint16_t j = 0; j < 16; j++) { - persistentStore.read_data(i + j, &cccc, sizeof(uint8_t)); - print_hex_byte(cccc); - SERIAL_ECHO(' '); - } - SERIAL_EOL(); - } - SERIAL_EOL(); - persistentStore.access_finish(); - } - - /** - * When we are fully debugged, this may go away. But there are some valid - * use cases for the users. So we can wait and see what to do with it. - */ - void unified_bed_leveling::g29_compare_current_mesh_to_stored_mesh() { - int16_t a = settings.calc_num_meshes(); - - if (!a) { - SERIAL_PROTOCOLLNPGM("?EEPROM storage not available."); - return; - } - - if (!parser.has_value()) { - SERIAL_PROTOCOLLNPGM("?Storage slot # required."); - SERIAL_PROTOCOLLNPAIR("?Use 0 to ", a - 1); - return; - } - - g29_storage_slot = parser.value_int(); - - if (!WITHIN(g29_storage_slot, 0, a - 1)) { - SERIAL_PROTOCOLLNPGM("?Invalid storage slot."); - SERIAL_PROTOCOLLNPAIR("?Use 0 to ", a - 1); - return; - } - - float tmp_z_values[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y]; - settings.load_mesh(g29_storage_slot, &tmp_z_values); - - SERIAL_PROTOCOLPAIR("Subtracting mesh in slot ", g29_storage_slot); - SERIAL_PROTOCOLLNPGM(" from current mesh."); - - for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++) - for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++) - z_values[x][y] -= tmp_z_values[x][y]; - } - mesh_index_pair unified_bed_leveling::find_furthest_invalid_mesh_point() { bool found_a_NAN = false, found_a_real = false; @@ -1339,119 +1293,6 @@ return out_mesh; } - #if ENABLED(NEWPANEL) - - void abort_fine_tune() { - lcd_return_to_status(); - do_blocking_move_to_z(Z_CLEARANCE_BETWEEN_PROBES); - LCD_MESSAGEPGM(MSG_EDITING_STOPPED); - lcd_quick_feedback(true); - } - - void unified_bed_leveling::fine_tune_mesh(const float &rx, const float &ry, const bool do_ubl_mesh_map) { - if (!parser.seen('R')) // fine_tune_mesh() is special. If no repetition count flag is specified - g29_repetition_cnt = 1; // do exactly one mesh location. Otherwise use what the parser decided. - - #if ENABLED(UBL_MESH_EDIT_MOVES_Z) - const float h_offset = parser.seenval('H') ? parser.value_linear_units() : 0; - if (!WITHIN(h_offset, 0, 10)) { - SERIAL_PROTOCOLLNPGM("Offset out of bounds. (0 to 10mm)\n"); - return; - } - #endif - - mesh_index_pair location; - - if (!position_is_reachable(rx, ry)) { - SERIAL_PROTOCOLLNPGM("(X,Y) outside printable radius."); - return; - } - - save_ubl_active_state_and_disable(); - - LCD_MESSAGEPGM(MSG_UBL_FINE_TUNE_MESH); - lcd_external_control = true; // Take over control of the LCD encoder - - do_blocking_move_to(rx, ry, Z_CLEARANCE_BETWEEN_PROBES); // Move to the given XY with probe clearance - - #if ENABLED(UBL_MESH_EDIT_MOVES_Z) - do_blocking_move_to_z(h_offset); // Move Z to the given 'H' offset - #endif - - uint16_t not_done[16]; - memset(not_done, 0xFF, sizeof(not_done)); - do { - location = find_closest_mesh_point_of_type(SET_IN_BITMAP, rx, ry, USE_NOZZLE_AS_REFERENCE, not_done); - - if (location.x_index < 0) break; // Stop when there are no more reachable points - - bitmap_clear(not_done, location.x_index, location.y_index); // Mark this location as 'adjusted' so a new - // location is used on the next loop - - const float rawx = mesh_index_to_xpos(location.x_index), - rawy = mesh_index_to_ypos(location.y_index); - - if (!position_is_reachable(rawx, rawy)) break; // SHOULD NOT OCCUR because find_closest_mesh_point_of_type will only return reachable - - do_blocking_move_to(rawx, rawy, Z_CLEARANCE_BETWEEN_PROBES); // Move the nozzle to the edit point with probe clearance - - #if ENABLED(UBL_MESH_EDIT_MOVES_Z) - do_blocking_move_to_z(h_offset); // Move Z to the given 'H' offset before editing - #endif - - KEEPALIVE_STATE(PAUSED_FOR_USER); - - if (do_ubl_mesh_map) display_map(g29_map_type); // Display the current point - - lcd_refresh(); - - float new_z = z_values[location.x_index][location.y_index]; - if (isnan(new_z)) new_z = 0; // Invalid points begin at 0 - new_z = FLOOR(new_z * 1000) * 0.001f; // Chop off digits after the 1000ths place - - lcd_mesh_edit_setup(new_z); - - do { - new_z = lcd_mesh_edit(); - #if ENABLED(UBL_MESH_EDIT_MOVES_Z) - do_blocking_move_to_z(h_offset + new_z); // Move the nozzle as the point is edited - #endif - idle(); - SERIAL_FLUSH(); // Prevent host M105 buffer overrun. - } while (!is_lcd_clicked()); - - if (!lcd_map_control) lcd_return_to_status(); // Just editing a single point? Return to status - - if (click_and_hold(abort_fine_tune)) goto FINE_TUNE_EXIT; // If the click is held down, abort editing - - z_values[location.x_index][location.y_index] = new_z; // Save the updated Z value - - safe_delay(20); // No switch noise - lcd_refresh(); - - } while (location.x_index >= 0 && --g29_repetition_cnt > 0); - - FINE_TUNE_EXIT: - - lcd_external_control = false; - KEEPALIVE_STATE(IN_HANDLER); - - if (do_ubl_mesh_map) display_map(g29_map_type); - restore_ubl_active_state_and_leave(); - - do_blocking_move_to(rx, ry, Z_CLEARANCE_BETWEEN_PROBES); - - LCD_MESSAGEPGM(MSG_UBL_DONE_EDITING_MESH); - SERIAL_ECHOLNPGM("Done Editing Mesh"); - - if (lcd_map_control) - lcd_goto_screen(_lcd_ubl_output_map_lcd); - else - lcd_return_to_status(); - } - - #endif // NEWPANEL - /** * 'Smart Fill': Scan from the outward edges of the mesh towards the center. * If an invalid location is found, use the next two points (if valid) to @@ -1825,4 +1666,158 @@ } #endif // UBL_G29_P31 + #if ENABLED(UBL_DEVEL_DEBUGGING) + /** + * Much of the 'What?' command can be eliminated. But until we are fully debugged, it is + * good to have the extra information. Soon... we prune this to just a few items + */ + void unified_bed_leveling::g29_what_command() { + report_state(); + + if (storage_slot == -1) + SERIAL_PROTOCOLPGM("No Mesh Loaded."); + else { + SERIAL_PROTOCOLPAIR("Mesh ", storage_slot); + SERIAL_PROTOCOLPGM(" Loaded."); + } + SERIAL_EOL(); + safe_delay(50); + + #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) + SERIAL_PROTOCOLPGM("planner.z_fade_height : "); + SERIAL_PROTOCOL_F(planner.z_fade_height, 4); + SERIAL_EOL(); + #endif + + adjust_mesh_to_mean(g29_c_flag, g29_constant); + + #if HAS_BED_PROBE + SERIAL_PROTOCOLPGM("zprobe_zoffset: "); + SERIAL_PROTOCOL_F(zprobe_zoffset, 7); + SERIAL_EOL(); + #endif + + SERIAL_ECHOLNPAIR("MESH_MIN_X " STRINGIFY(MESH_MIN_X) "=", MESH_MIN_X); safe_delay(50); + SERIAL_ECHOLNPAIR("MESH_MIN_Y " STRINGIFY(MESH_MIN_Y) "=", MESH_MIN_Y); safe_delay(50); + SERIAL_ECHOLNPAIR("MESH_MAX_X " STRINGIFY(MESH_MAX_X) "=", MESH_MAX_X); safe_delay(50); + SERIAL_ECHOLNPAIR("MESH_MAX_Y " STRINGIFY(MESH_MAX_Y) "=", MESH_MAX_Y); safe_delay(50); + SERIAL_ECHOLNPAIR("GRID_MAX_POINTS_X ", GRID_MAX_POINTS_X); safe_delay(50); + SERIAL_ECHOLNPAIR("GRID_MAX_POINTS_Y ", GRID_MAX_POINTS_Y); safe_delay(50); + SERIAL_ECHOLNPAIR("MESH_X_DIST ", MESH_X_DIST); + SERIAL_ECHOLNPAIR("MESH_Y_DIST ", MESH_Y_DIST); safe_delay(50); + + SERIAL_PROTOCOLPGM("X-Axis Mesh Points at: "); + for (uint8_t i = 0; i < GRID_MAX_POINTS_X; i++) { + SERIAL_PROTOCOL_F(LOGICAL_X_POSITION(mesh_index_to_xpos(i)), 3); + SERIAL_PROTOCOLPGM(" "); + safe_delay(25); + } + SERIAL_EOL(); + + SERIAL_PROTOCOLPGM("Y-Axis Mesh Points at: "); + for (uint8_t i = 0; i < GRID_MAX_POINTS_Y; i++) { + SERIAL_PROTOCOL_F(LOGICAL_Y_POSITION(mesh_index_to_ypos(i)), 3); + SERIAL_PROTOCOLPGM(" "); + safe_delay(25); + } + SERIAL_EOL(); + + #if HAS_KILL + SERIAL_PROTOCOLPAIR("Kill pin on :", KILL_PIN); + SERIAL_PROTOCOLLNPAIR(" state:", READ(KILL_PIN)); + #endif + SERIAL_EOL(); + safe_delay(50); + + #if ENABLED(UBL_DEVEL_DEBUGGING) + SERIAL_PROTOCOLLNPAIR("ubl_state_at_invocation :", ubl_state_at_invocation); SERIAL_EOL(); + SERIAL_PROTOCOLLNPAIR("ubl_state_recursion_chk :", ubl_state_recursion_chk); SERIAL_EOL(); + safe_delay(50); + + SERIAL_PROTOCOLPAIR("Meshes go from ", hex_address((void*)settings.meshes_start_index())); + SERIAL_PROTOCOLLNPAIR(" to ", hex_address((void*)settings.meshes_end_index())); + safe_delay(50); + + SERIAL_PROTOCOLLNPAIR("sizeof(ubl) : ", (int)sizeof(ubl)); SERIAL_EOL(); + SERIAL_PROTOCOLLNPAIR("z_value[][] size: ", (int)sizeof(z_values)); SERIAL_EOL(); + safe_delay(25); + + SERIAL_PROTOCOLLNPAIR("EEPROM free for UBL: ", hex_address((void*)(settings.meshes_end_index() - settings.meshes_start_index()))); + safe_delay(50); + + SERIAL_PROTOCOLPAIR("EEPROM can hold ", settings.calc_num_meshes()); + SERIAL_PROTOCOLLNPGM(" meshes.\n"); + safe_delay(25); + #endif // UBL_DEVEL_DEBUGGING + + if (!sanity_check()) { + echo_name(); + SERIAL_PROTOCOLLNPGM(" sanity checks passed."); + } + } + + /** + * When we are fully debugged, the EEPROM dump command will get deleted also. But + * right now, it is good to have the extra information. Soon... we prune this. + */ + void unified_bed_leveling::g29_eeprom_dump() { + uint8_t cccc; + + SERIAL_ECHO_START(); + SERIAL_ECHOLNPGM("EEPROM Dump:"); + persistentStore.access_start(); + for (uint16_t i = 0; i < persistentStore.capacity(); i += 16) { + if (!(i & 0x3)) idle(); + print_hex_word(i); + SERIAL_ECHOPGM(": "); + for (uint16_t j = 0; j < 16; j++) { + persistentStore.read_data(i + j, &cccc, sizeof(uint8_t)); + print_hex_byte(cccc); + SERIAL_ECHO(' '); + } + SERIAL_EOL(); + } + SERIAL_EOL(); + persistentStore.access_finish(); + } + + /** + * When we are fully debugged, this may go away. But there are some valid + * use cases for the users. So we can wait and see what to do with it. + */ + void unified_bed_leveling::g29_compare_current_mesh_to_stored_mesh() { + int16_t a = settings.calc_num_meshes(); + + if (!a) { + SERIAL_PROTOCOLLNPGM("?EEPROM storage not available."); + return; + } + + if (!parser.has_value()) { + SERIAL_PROTOCOLLNPGM("?Storage slot # required."); + SERIAL_PROTOCOLLNPAIR("?Use 0 to ", a - 1); + return; + } + + g29_storage_slot = parser.value_int(); + + if (!WITHIN(g29_storage_slot, 0, a - 1)) { + SERIAL_PROTOCOLLNPGM("?Invalid storage slot."); + SERIAL_PROTOCOLLNPAIR("?Use 0 to ", a - 1); + return; + } + + float tmp_z_values[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y]; + settings.load_mesh(g29_storage_slot, &tmp_z_values); + + SERIAL_PROTOCOLPAIR("Subtracting mesh in slot ", g29_storage_slot); + SERIAL_PROTOCOLLNPGM(" from current mesh."); + + for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++) + for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++) + z_values[x][y] -= tmp_z_values[x][y]; + } + + #endif // UBL_DEVEL_DEBUGGING + #endif // AUTO_BED_LEVELING_UBL diff --git a/Marlin/src/feature/caselight.h b/Marlin/src/feature/caselight.h index 3e16819eb5..4cd6c13770 100644 --- a/Marlin/src/feature/caselight.h +++ b/Marlin/src/feature/caselight.h @@ -19,9 +19,7 @@ * along with this program. If not, see . * */ - -#ifndef __CASELIGHT_H__ -#define __CASELIGHT_H__ +#pragma once extern uint8_t case_light_brightness; extern bool case_light_on; @@ -29,5 +27,3 @@ extern uint8_t case_light_brightness_sav; // saves brighness info when case_li extern bool case_light_arg_flag; // flag to notify if S or P argument type void update_case_light(); - -#endif // __CASELIGHT_H__ diff --git a/Marlin/src/feature/controllerfan.cpp b/Marlin/src/feature/controllerfan.cpp index 1dec32647e..7ee6671332 100644 --- a/Marlin/src/feature/controllerfan.cpp +++ b/Marlin/src/feature/controllerfan.cpp @@ -27,7 +27,7 @@ #include "../module/stepper_indirection.h" #include "../module/temperature.h" -uint8_t controllerFanSpeed; +uint8_t controllerfan_speed; void controllerfan_update() { static millis_t lastMotorOn = 0, // Last time a motor was turned on @@ -75,7 +75,7 @@ void controllerfan_update() { // Fan off if no steppers have been enabled for CONTROLLERFAN_SECS seconds uint8_t speed = (!lastMotorOn || ELAPSED(ms, lastMotorOn + (CONTROLLERFAN_SECS) * 1000UL)) ? 0 : CONTROLLERFAN_SPEED; - controllerFanSpeed = speed; + controllerfan_speed = speed; // allows digital or PWM fan output to be used (see M42 handling) WRITE(CONTROLLER_FAN_PIN, speed); diff --git a/Marlin/src/feature/controllerfan.h b/Marlin/src/feature/controllerfan.h index 8a7b393c33..7badc99d26 100644 --- a/Marlin/src/feature/controllerfan.h +++ b/Marlin/src/feature/controllerfan.h @@ -19,10 +19,6 @@ * along with this program. If not, see . * */ - -#ifndef __CONTROLLERFAN_H__ -#define __CONTROLLERFAN_H__ +#pragma once void controllerfan_update(); - -#endif // __CONTROLLERFAN_H__ diff --git a/Marlin/src/feature/dac/dac_dac084s085.h b/Marlin/src/feature/dac/dac_dac084s085.h index af98c16776..f1b69c292b 100644 --- a/Marlin/src/feature/dac/dac_dac084s085.h +++ b/Marlin/src/feature/dac/dac_dac084s085.h @@ -1,5 +1,25 @@ -#ifndef DAC084S085_H -#define DAC084S085_H +/** + * 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 . + * + */ +#pragma once class dac084s085 { public: @@ -9,5 +29,3 @@ class dac084s085 { private: static void cshigh(); }; - -#endif // DAC084S085_H diff --git a/Marlin/src/feature/dac/dac_mcp4728.h b/Marlin/src/feature/dac/dac_mcp4728.h index aeacaaa0bc..2e0937fcf6 100644 --- a/Marlin/src/feature/dac/dac_mcp4728.h +++ b/Marlin/src/feature/dac/dac_mcp4728.h @@ -19,14 +19,12 @@ * along with this program. If not, see . * */ +#pragma once /** * Arduino library for MicroChip MCP4728 I2C D/A converter. */ -#ifndef DAC_MCP4728_H -#define DAC_MCP4728_H - #include #define defaultVDD DAC_STEPPER_MAX //was 5000 but differs with internal Vref @@ -57,5 +55,3 @@ uint8_t mcp4728_fastWrite(); uint8_t mcp4728_simpleCommand(byte simpleCommand); uint8_t mcp4728_getDrvPct(uint8_t channel); void mcp4728_setDrvPct(uint8_t pct[XYZE]); - -#endif // DAC_MCP4728_H diff --git a/Marlin/src/feature/dac/stepper_dac.h b/Marlin/src/feature/dac/stepper_dac.h index e74bac5f15..a2e2370482 100644 --- a/Marlin/src/feature/dac/stepper_dac.h +++ b/Marlin/src/feature/dac/stepper_dac.h @@ -19,31 +19,12 @@ * along with this program. If not, see . * */ +#pragma once /** * stepper_dac.h - To set stepper current via DAC - * - * Part of Marlin - * - * Copyright (c) 2016 MarlinFirmware - * - * Marlin 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. - * - * Marlin 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 Marlin. If not, see . */ -#ifndef STEPPER_DAC_H -#define STEPPER_DAC_H - #include "dac_mcp4728.h" int dac_init(); @@ -53,5 +34,3 @@ void dac_print_values(); void dac_commit_eeprom(); uint8_t dac_current_get_percent(AxisEnum axis); void dac_current_set_percents(const uint8_t pct[XYZE]); - -#endif // STEPPER_DAC_H diff --git a/Marlin/src/feature/digipot/digipot.h b/Marlin/src/feature/digipot/digipot.h index f2cd00ba6e..d4354c748f 100644 --- a/Marlin/src/feature/digipot/digipot.h +++ b/Marlin/src/feature/digipot/digipot.h @@ -19,11 +19,7 @@ * along with this program. If not, see . * */ - -#ifndef __DIGIPOT_H__ -#define __DIGIPOT_H__ +#pragma once void digipot_i2c_set_current(const uint8_t channel, const float current); void digipot_i2c_init(); - -#endif // __DIGIPOT_H__ diff --git a/Marlin/src/feature/emergency_parser.cpp b/Marlin/src/feature/emergency_parser.cpp index 3c9cbf12e5..7908f342db 100644 --- a/Marlin/src/feature/emergency_parser.cpp +++ b/Marlin/src/feature/emergency_parser.cpp @@ -31,7 +31,8 @@ #include "emergency_parser.h" // Static data members -bool EmergencyParser::killed_by_M112; // = false +bool EmergencyParser::killed_by_M112, // = false + EmergencyParser::enabled; // Global instance EmergencyParser emergency_parser; diff --git a/Marlin/src/feature/emergency_parser.h b/Marlin/src/feature/emergency_parser.h index 127b5c20da..3684a3b126 100644 --- a/Marlin/src/feature/emergency_parser.h +++ b/Marlin/src/feature/emergency_parser.h @@ -19,13 +19,13 @@ * along with this program. If not, see . * */ +#pragma once /** * emergency_parser.h - Intercept special commands directly in the serial stream */ -#ifndef _EMERGENCY_PARSER_H_ -#define _EMERGENCY_PARSER_H_ +#define FORCE_INLINE __attribute__((always_inline)) inline // External references extern volatile bool wait_for_user, wait_for_heatup; @@ -53,11 +53,13 @@ public: static bool killed_by_M112; - EmergencyParser() {} + EmergencyParser() { enable(); } - __attribute__((always_inline)) inline - static void update(State &state, const uint8_t c) { + FORCE_INLINE static void enable() { enabled = true; } + FORCE_INLINE static void disable() { enabled = false; } + + FORCE_INLINE static void update(State &state, const uint8_t c) { switch (state) { case EP_RESET: switch (c) { @@ -118,7 +120,7 @@ public: default: if (c == '\n') { - switch (state) { + if (enabled) switch (state) { case EP_M108: wait_for_user = wait_for_heatup = false; break; @@ -136,8 +138,8 @@ public: } } +private: + static bool enabled; }; extern EmergencyParser emergency_parser; - -#endif // _EMERGENCY_PARSER_H_ diff --git a/Marlin/src/feature/fanmux.h b/Marlin/src/feature/fanmux.h index 2524876146..2dfc4aabf8 100644 --- a/Marlin/src/feature/fanmux.h +++ b/Marlin/src/feature/fanmux.h @@ -19,15 +19,11 @@ * along with this program. If not, see . * */ +#pragma once /** * feature/fanmux.h - Cooling Fan Multiplexer support functions */ -#ifndef _FANMUX_H_ -#define _FANMUX_H_ - extern void fanmux_switch(const uint8_t e); extern void fanmux_init(void); - -#endif // _FANMUX_H_ diff --git a/Marlin/src/feature/filwidth.h b/Marlin/src/feature/filwidth.h index 1f0dfc6f04..a130e8cf8c 100644 --- a/Marlin/src/feature/filwidth.h +++ b/Marlin/src/feature/filwidth.h @@ -19,9 +19,7 @@ * along with this program. If not, see . * */ - -#ifndef __FILWIDTH_H__ -#define __FILWIDTH_H__ +#pragma once #include "../inc/MarlinConfig.h" @@ -31,5 +29,3 @@ extern float filament_width_nominal, // Nominal filament extern uint8_t meas_delay_cm; // Distance delay setting extern int8_t measurement_delay[MAX_MEASUREMENT_DELAY + 1], // Ring buffer to delayed measurement. Store extruder factor after subtracting 100 filwidth_delay_index[2]; // Indexes into ring buffer - -#endif // __FILWIDTH_H__ diff --git a/Marlin/src/feature/fwretract.cpp b/Marlin/src/feature/fwretract.cpp index a06f48ec05..3fc37e3aa3 100644 --- a/Marlin/src/feature/fwretract.cpp +++ b/Marlin/src/feature/fwretract.cpp @@ -36,37 +36,41 @@ FWRetract fwretract; // Single instance - this calls the constructor #include "../module/planner.h" #include "../module/stepper.h" +#if ENABLED(RETRACT_SYNC_MIXING) + #include "../feature/mixing.h" +#endif + // private: #if EXTRUDERS > 1 - bool FWRetract::retracted_swap[EXTRUDERS]; // Which extruders are swap-retracted + bool FWRetract::retracted_swap[EXTRUDERS]; // Which extruders are swap-retracted #endif // public: -bool FWRetract::autoretract_enabled, // M209 S - Autoretract switch - FWRetract::retracted[EXTRUDERS]; // Which extruders are currently retracted -float FWRetract::retract_length, // M207 S - G10 Retract length - FWRetract::retract_feedrate_mm_s, // M207 F - G10 Retract feedrate - FWRetract::retract_zlift, // M207 Z - G10 Retract hop size - FWRetract::retract_recover_length, // M208 S - G11 Recover length - FWRetract::retract_recover_feedrate_mm_s, // M208 F - G11 Recover feedrate - FWRetract::swap_retract_length, // M207 W - G10 Swap Retract length - FWRetract::swap_retract_recover_length, // M208 W - G11 Swap Recover length - FWRetract::swap_retract_recover_feedrate_mm_s, // M208 R - G11 Swap Recover feedrate - FWRetract::current_retract[EXTRUDERS], // Retract value used by planner +fwretract_settings_t FWRetract::settings; // M207 S F Z W, M208 S F W R + +#if ENABLED(FWRETRACT_AUTORETRACT) + bool FWRetract::autoretract_enabled; // M209 S - Autoretract switch +#endif + +bool FWRetract::retracted[EXTRUDERS]; // Which extruders are currently retracted + +float FWRetract::current_retract[EXTRUDERS], // Retract value used by planner FWRetract::current_hop; void FWRetract::reset() { - autoretract_enabled = false; - retract_length = RETRACT_LENGTH; - retract_feedrate_mm_s = RETRACT_FEEDRATE; - retract_zlift = RETRACT_ZLIFT; - retract_recover_length = RETRACT_RECOVER_LENGTH; - retract_recover_feedrate_mm_s = RETRACT_RECOVER_FEEDRATE; - swap_retract_length = RETRACT_LENGTH_SWAP; - swap_retract_recover_length = RETRACT_RECOVER_LENGTH_SWAP; - swap_retract_recover_feedrate_mm_s = RETRACT_RECOVER_FEEDRATE_SWAP; + #if ENABLED(FWRETRACT_AUTORETRACT) + autoretract_enabled = false; + #endif + settings.retract_length = RETRACT_LENGTH; + settings.retract_feedrate_mm_s = RETRACT_FEEDRATE; + settings.retract_zraise = RETRACT_ZRAISE; + settings.retract_recover_length = RETRACT_RECOVER_LENGTH; + settings.retract_recover_feedrate_mm_s = RETRACT_RECOVER_FEEDRATE; + settings.swap_retract_length = RETRACT_LENGTH_SWAP; + settings.swap_retract_recover_length = RETRACT_RECOVER_LENGTH_SWAP; + settings.swap_retract_recover_feedrate_mm_s = RETRACT_RECOVER_FEEDRATE_SWAP; current_hop = 0.0; for (uint8_t i = 0; i < EXTRUDERS; ++i) { @@ -127,22 +131,37 @@ void FWRetract::retract(const bool retracting const float old_feedrate_mm_s = feedrate_mm_s, unscale_e = RECIPROCAL(planner.e_factor[active_extruder]), unscale_fr = 100.0 / feedrate_percentage, // Disable feedrate scaling for retract moves - base_retract = swapping ? swap_retract_length : retract_length; + base_retract = ( + (swapping ? settings.swap_retract_length : settings.retract_length) + #if ENABLED(RETRACT_SYNC_MIXING) + * (MIXING_STEPPERS) + #endif + ); // The current position will be the destination for E and Z moves set_destination_from_current(); + #if ENABLED(RETRACT_SYNC_MIXING) + uint8_t old_mixing_tool = mixer.get_current_v_tool(); + mixer.T(MIXER_AUTORETRACT_TOOL); + #endif + if (retracting) { // Retract by moving from a faux E position back to the current E position - feedrate_mm_s = retract_feedrate_mm_s * unscale_fr; + feedrate_mm_s = ( + settings.retract_feedrate_mm_s * unscale_fr + #if ENABLED(RETRACT_SYNC_MIXING) + * (MIXING_STEPPERS) + #endif + ); current_retract[active_extruder] = base_retract * unscale_e; prepare_move_to_destination(); // set_current_to_destination planner.synchronize(); // Wait for move to complete // Is a Z hop set, and has the hop not yet been done? - if (retract_zlift > 0.01 && !current_hop) { // Apply hop only once - current_hop += retract_zlift; // Add to the hop total (again, only once) - feedrate_mm_s = planner.max_feedrate_mm_s[Z_AXIS] * unscale_fr; // Maximum Z feedrate + if (settings.retract_zraise > 0.01 && !current_hop) { // Apply hop only once + current_hop += settings.retract_zraise; // Add to the hop total (again, only once) + feedrate_mm_s = planner.settings.max_feedrate_mm_s[Z_AXIS] * unscale_fr; // Maximum Z feedrate prepare_move_to_destination(); // Raise up, set_current_to_destination planner.synchronize(); // Wait for move to complete } @@ -151,23 +170,32 @@ void FWRetract::retract(const bool retracting // If a hop was done and Z hasn't changed, undo the Z hop if (current_hop) { current_hop = 0.0; - feedrate_mm_s = planner.max_feedrate_mm_s[Z_AXIS] * unscale_fr; // Z feedrate to max + feedrate_mm_s = planner.settings.max_feedrate_mm_s[Z_AXIS] * unscale_fr; // Z feedrate to max prepare_move_to_destination(); // Lower Z, set_current_to_destination planner.synchronize(); // Wait for move to complete } - const float extra_recover = swapping ? swap_retract_recover_length : retract_recover_length; + const float extra_recover = swapping ? settings.swap_retract_recover_length : settings.retract_recover_length; if (extra_recover != 0.0) { current_position[E_AXIS] -= extra_recover; // Adjust the current E position by the extra amount to recover sync_plan_position_e(); // Sync the planner position so the extra amount is recovered } current_retract[active_extruder] = 0.0; - feedrate_mm_s = (swapping ? swap_retract_recover_feedrate_mm_s : retract_recover_feedrate_mm_s) * unscale_fr; + feedrate_mm_s = ( + (swapping ? settings.swap_retract_recover_feedrate_mm_s : settings.retract_recover_feedrate_mm_s) * unscale_fr + #if ENABLED(RETRACT_SYNC_MIXING) + * (MIXING_STEPPERS) + #endif + ); prepare_move_to_destination(); // Recover E, set_current_to_destination planner.synchronize(); // Wait for move to complete } + #if ENABLED(RETRACT_SYNC_MIXING) + mixer.T(old_mixing_tool); // Restore original mixing tool + #endif + feedrate_mm_s = old_feedrate_mm_s; // Restore original feedrate retracted[active_extruder] = retracting; // Active extruder now retracted / recovered diff --git a/Marlin/src/feature/fwretract.h b/Marlin/src/feature/fwretract.h index e1cd94dc94..247ea22023 100644 --- a/Marlin/src/feature/fwretract.h +++ b/Marlin/src/feature/fwretract.h @@ -19,15 +19,30 @@ * along with this program. If not, see . * */ +#pragma once /** * fwretract.h - Define firmware-based retraction interface */ -#ifndef FWRETRACT_H -#define FWRETRACT_H +#include "../inc/MarlinConfigPre.h" -#include "../inc/MarlinConfig.h" +#pragma pack(push, 1) // No padding between fields + +typedef struct { + float retract_length, // M207 S - G10 Retract length + retract_feedrate_mm_s, // M207 F - G10 Retract feedrate + retract_zraise, // M207 Z - G10 Retract hop size + retract_recover_length, // M208 S - G11 Recover length + retract_recover_feedrate_mm_s, // M208 F - G11 Recover feedrate + swap_retract_length, // M207 W - G10 Swap Retract length + swap_retract_recover_length, // M208 W - G11 Swap Recover length + swap_retract_recover_feedrate_mm_s; // M208 R - G11 Swap Recover feedrate +} fwretract_settings_t; + +#pragma pack(pop) + +#if ENABLED(FWRETRACT) class FWRetract { private: @@ -36,17 +51,16 @@ private: #endif public: - static bool autoretract_enabled, // M209 S - Autoretract switch - retracted[EXTRUDERS]; // Which extruders are currently retracted - static float retract_length, // M207 S - G10 Retract length - retract_feedrate_mm_s, // M207 F - G10 Retract feedrate - retract_zlift, // M207 Z - G10 Retract hop size - retract_recover_length, // M208 S - G11 Recover length - retract_recover_feedrate_mm_s, // M208 F - G11 Recover feedrate - swap_retract_length, // M207 W - G10 Swap Retract length - swap_retract_recover_length, // M208 W - G11 Swap Recover length - swap_retract_recover_feedrate_mm_s, // M208 R - G11 Swap Recover feedrate - current_retract[EXTRUDERS], // Retract value used by planner + static fwretract_settings_t settings; + + #if ENABLED(FWRETRACT_AUTORETRACT) + static bool autoretract_enabled; // M209 S - Autoretract switch + #else + static constexpr bool autoretract_enabled = false; + #endif + + static bool retracted[EXTRUDERS]; // Which extruders are currently retracted + static float current_retract[EXTRUDERS], // Retract value used by planner current_hop; // Hop value used by planner FWRetract() { reset(); } @@ -54,7 +68,7 @@ public: static void reset(); static void refresh_autoretract() { - for (uint8_t i = 0; i < EXTRUDERS; i++) retracted[i] = false; + LOOP_L_N(i, EXTRUDERS) retracted[i] = false; } static void enable_autoretract(const bool enable) { @@ -73,4 +87,4 @@ public: extern FWRetract fwretract; -#endif // FWRETRACT_H +#endif // FWRETRACT diff --git a/Marlin/src/feature/leds/blinkm.h b/Marlin/src/feature/leds/blinkm.h index 20e84d9a95..8709ebda34 100644 --- a/Marlin/src/feature/leds/blinkm.h +++ b/Marlin/src/feature/leds/blinkm.h @@ -19,17 +19,13 @@ * along with this program. If not, see . * */ +#pragma once /** * blinkm.h - Control a BlinkM over i2c */ -#ifndef _BLINKM_H_ -#define _BLINKM_H_ - struct LEDColor; typedef LEDColor LEDColor; void blinkm_set_led_color(const LEDColor &color); - -#endif // _BLINKM_H_ diff --git a/Marlin/src/feature/leds/leds.cpp b/Marlin/src/feature/leds/leds.cpp index d3175a0314..0694491f0f 100644 --- a/Marlin/src/feature/leds/leds.cpp +++ b/Marlin/src/feature/leds/leds.cpp @@ -48,7 +48,7 @@ ); #endif -#if ENABLED(LED_CONTROL_MENU) +#if ENABLED(LED_CONTROL_MENU) || ENABLED(PRINTER_EVENT_LEDS) LEDColor LEDLights::color; bool LEDLights::lights_on; #endif @@ -72,7 +72,9 @@ void LEDLights::set_color(const LEDColor &incol #if ENABLED(NEOPIXEL_LED) - const uint32_t neocolor = pixels.Color(incol.r, incol.g, incol.b, incol.w); + const uint32_t neocolor = LEDColorWhite() == incol + ? pixels.Color(NEO_WHITE) + : pixels.Color(incol.r, incol.g, incol.b, incol.w); static uint16_t nextLed = 0; pixels.setBrightness(incol.i); @@ -117,22 +119,13 @@ void LEDLights::set_color(const LEDColor &incol pca9632_set_led_color(incol); #endif - #if ENABLED(LED_CONTROL_MENU) + #if ENABLED(LED_CONTROL_MENU) || ENABLED(PRINTER_EVENT_LEDS) // Don't update the color when OFF lights_on = !incol.is_off(); if (lights_on) color = incol; #endif } -void LEDLights::set_white() { - #if ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(BLINKM) || ENABLED(PCA9632) - set_color(LEDColorWhite()); - #endif - #if ENABLED(NEOPIXEL_LED) - set_neopixel_color(pixels.Color(NEO_WHITE)); - #endif -} - #if ENABLED(LED_CONTROL_MENU) void LEDLights::toggle() { if (lights_on) set_off(); else update(); } #endif diff --git a/Marlin/src/feature/leds/leds.h b/Marlin/src/feature/leds/leds.h index fe00cd3c48..77654d44a3 100644 --- a/Marlin/src/feature/leds/leds.h +++ b/Marlin/src/feature/leds/leds.h @@ -19,15 +19,15 @@ * along with this program. If not, see . * */ +#pragma once /** * leds.h - Marlin general RGB LED support */ -#ifndef __LEDS_H__ -#define __LEDS_H__ +#include "../../inc/MarlinConfigPre.h" -#include "../../inc/MarlinConfig.h" +#include #if ENABLED(NEOPIXEL_LED) #include "neopixel.h" @@ -47,6 +47,7 @@ typedef struct LEDColor { #endif #endif ; + LEDColor() : r(255), g(255), b(255) #if HAS_WHITE_LED , w(255) @@ -55,6 +56,7 @@ typedef struct LEDColor { #endif #endif {} + LEDColor(uint8_t r, uint8_t g, uint8_t b #if HAS_WHITE_LED , uint8_t w=0 @@ -70,6 +72,7 @@ typedef struct LEDColor { #endif #endif {} + LEDColor(const uint8_t (&rgbw)[4]) : r(rgbw[0]), g(rgbw[1]), b(rgbw[2]) #if HAS_WHITE_LED , w(rgbw[3]) @@ -78,6 +81,7 @@ typedef struct LEDColor { #endif #endif {} + LEDColor& operator=(const uint8_t (&rgbw)[4]) { r = rgbw[0]; g = rgbw[1]; b = rgbw[2]; #if HAS_WHITE_LED @@ -85,15 +89,19 @@ typedef struct LEDColor { #endif return *this; } + LEDColor& operator=(const LEDColor &right) { if (this != &right) memcpy(this, &right, sizeof(LEDColor)); return *this; } + bool operator==(const LEDColor &right) { if (this == &right) return true; return 0 == memcmp(this, &right, sizeof(LEDColor)); } + bool operator!=(const LEDColor &right) { return !operator==(right); } + bool is_off() const { return 3 > r + g + b #if HAS_WHITE_LED @@ -107,12 +115,12 @@ typedef struct LEDColor { * Color helpers and presets */ #if HAS_WHITE_LED - #define LEDColorWhite() LEDColor(0, 0, 0, 255) #if ENABLED(NEOPIXEL_LED) #define MakeLEDColor(R,G,B,W,I) LEDColor(R, G, B, W, I) #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) @@ -138,7 +146,7 @@ public: #endif ); - FORCE_INLINE void set_color(uint8_t r, uint8_t g, uint8_t b + inline void set_color(uint8_t r, uint8_t g, uint8_t b #if HAS_WHITE_LED , uint8_t w=0 #if ENABLED(NEOPIXEL_LED) @@ -156,29 +164,33 @@ public: ); } - static void set_white(); - FORCE_INLINE static void set_off() { set_color(LEDColorOff()); } - FORCE_INLINE static void set_green() { set_color(LEDColorGreen()); } + static inline void set_off() { set_color(LEDColorOff()); } + static inline void set_green() { set_color(LEDColorGreen()); } + static inline void set_white() { set_color(LEDColorWhite()); } #if ENABLED(LED_COLOR_PRESETS) static const LEDColor defaultLEDColor; - FORCE_INLINE static void set_default() { set_color(defaultLEDColor); } - FORCE_INLINE static void set_red() { set_color(LEDColorRed()); } - FORCE_INLINE static void set_orange() { set_color(LEDColorOrange()); } - FORCE_INLINE static void set_yellow() { set_color(LEDColorYellow()); } - FORCE_INLINE static void set_blue() { set_color(LEDColorBlue()); } - FORCE_INLINE static void set_indigo() { set_color(LEDColorIndigo()); } - FORCE_INLINE static void set_violet() { set_color(LEDColorViolet()); } + static inline void set_default() { set_color(defaultLEDColor); } + static inline void set_red() { set_color(LEDColorRed()); } + static inline void set_orange() { set_color(LEDColorOrange()); } + static inline void set_yellow() { set_color(LEDColorYellow()); } + static inline void set_blue() { set_color(LEDColorBlue()); } + static inline void set_indigo() { set_color(LEDColorIndigo()); } + static inline void set_violet() { set_color(LEDColorViolet()); } #endif - #if ENABLED(LED_CONTROL_MENU) + #if ENABLED(PRINTER_EVENT_LEDS) + static inline LEDColor get_color() { return lights_on ? color : LEDColorOff(); } + #endif + + #if ENABLED(LED_CONTROL_MENU) || ENABLED(PRINTER_EVENT_LEDS) static LEDColor color; // last non-off color static bool lights_on; // the last set color was "on" + #endif + #if ENABLED(LED_CONTROL_MENU) static void toggle(); // swap "off" with color - FORCE_INLINE static void update() { set_color(color); } + static inline void update() { set_color(color); } #endif }; extern LEDLights leds; - -#endif // __LEDS_H__ diff --git a/Marlin/src/feature/leds/neopixel.h b/Marlin/src/feature/leds/neopixel.h index 9f24b0287a..f761877c9a 100644 --- a/Marlin/src/feature/leds/neopixel.h +++ b/Marlin/src/feature/leds/neopixel.h @@ -19,14 +19,12 @@ * along with this program. If not, see . * */ +#pragma once /** * Neopixel support */ -#ifndef __NEOPIXEL_H__ -#define __NEOPIXEL_H__ - #include "../../inc/MarlinConfig.h" #include @@ -46,5 +44,3 @@ void set_neopixel_color(const uint32_t color); //bool neopixel_set_led_color(const uint8_t r, const uint8_t g, const uint8_t b, const uint8_t w, const uint8_t p); extern Adafruit_NeoPixel pixels; - -#endif // __NEOPIXEL_H__ diff --git a/Marlin/src/feature/leds/pca9632.h b/Marlin/src/feature/leds/pca9632.h index 4d98267beb..f2d6687780 100644 --- a/Marlin/src/feature/leds/pca9632.h +++ b/Marlin/src/feature/leds/pca9632.h @@ -19,18 +19,14 @@ * along with this program. If not, see . * */ +#pragma once /** * Driver for the Philips PCA9632 LED driver. * Written by Robert Mendon Feb 2017. */ -#ifndef __PCA9632_H__ -#define __PCA9632_H__ - struct LEDColor; typedef LEDColor LEDColor; void pca9632_set_led_color(const LEDColor &color); - -#endif // __PCA9632_H__ diff --git a/Marlin/src/feature/leds/printer_event_leds.cpp b/Marlin/src/feature/leds/printer_event_leds.cpp new file mode 100644 index 0000000000..3d974e7b3e --- /dev/null +++ b/Marlin/src/feature/leds/printer_event_leds.cpp @@ -0,0 +1,81 @@ +/** + * 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 . + * + */ + +/** + * printer_event_leds.cpp - LED color changing based on printer status + */ + +#include "../../inc/MarlinConfigPre.h" + +#if ENABLED(PRINTER_EVENT_LEDS) + +#include "printer_event_leds.h" + +PrinterEventLEDs printerEventLEDs; + +#if HAS_LEDS_OFF_FLAG + bool PrinterEventLEDs::leds_off_after_print; // = false +#endif + +#if HAS_TEMP_HOTEND || HAS_HEATED_BED + + uint8_t PrinterEventLEDs::old_intensity = 0; + + inline uint8_t pel_intensity(const float &start, const float ¤t, const float &target) { + return (uint8_t)map(constrain(current, start, target), start, target, 0.f, 255.f); + } + + inline void pel_set_rgb(const uint8_t r, const uint8_t g, const uint8_t b) { + leds.set_color( + MakeLEDColor(r, g, b, 0, pixels.getBrightness()) + #if ENABLED(NEOPIXEL_IS_SEQUENTIAL) + , true + #endif + ); + } + +#endif + +#if HAS_TEMP_HOTEND + + void PrinterEventLEDs::onHotendHeating(const float &start, const float ¤t, const float &target) { + const uint8_t blue = pel_intensity(start, current, target); + if (blue != old_intensity) { + old_intensity = blue; + pel_set_rgb(255, 0, 255 - blue); + } + } + +#endif + +#if HAS_HEATED_BED + + void PrinterEventLEDs::onBedHeating(const float &start, const float ¤t, const float &target) { + const uint8_t red = pel_intensity(start, current, target); + if (red != old_intensity) { + old_intensity = red; + pel_set_rgb(red, 0, 255); + } + } +#endif + +#endif // PRINTER_EVENT_LEDS diff --git a/Marlin/src/feature/leds/printer_event_leds.h b/Marlin/src/feature/leds/printer_event_leds.h new file mode 100644 index 0000000000..bae891dd70 --- /dev/null +++ b/Marlin/src/feature/leds/printer_event_leds.h @@ -0,0 +1,79 @@ +/** + * 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 . + * + */ +#pragma once + +/** + * printer_event_leds.h - LED color changing based on printer status + */ + +#include "leds.h" +#include "../../inc/MarlinConfig.h" + +class PrinterEventLEDs { +private: + static uint8_t old_intensity; + + #if HAS_LEDS_OFF_FLAG + static bool leds_off_after_print; + #endif + +public: + #if HAS_TEMP_HOTEND + static inline LEDColor onHotendHeatingStart() { old_intensity = 0; return leds.get_color(); } + static void onHotendHeating(const float &start, const float ¤t, const float &target); + #endif + + #if HAS_HEATED_BED + static inline LEDColor onBedHeatingStart() { old_intensity = 127; return leds.get_color(); } + static void onBedHeating(const float &start, const float ¤t, const float &target); + #endif + + #if HAS_TEMP_HOTEND || HAS_HEATED_BED + static inline void onHeatingDone() { leds.set_color(LEDColorWhite()); } + static inline void onPidTuningDone(LEDColor c) { leds.set_color(c); } + #endif + + #if ENABLED(SDSUPPORT) + + static inline void onPrintCompleted() { + leds.set_green(); + #if HAS_LEDS_OFF_FLAG + leds_off_after_print = true; + #else + safe_delay(2000); + leds.set_off(); + #endif + } + + static inline void onResumeAfterWait() { + #if HAS_LEDS_OFF_FLAG + if (leds_off_after_print) { + leds.set_off(); + leds_off_after_print = false; + } + #endif + } + + #endif // SDSUPPORT +}; + +extern PrinterEventLEDs printerEventLEDs; diff --git a/Marlin/src/feature/leds/tempstat.cpp b/Marlin/src/feature/leds/tempstat.cpp index 5ab0d2efab..8a5a4a0b70 100644 --- a/Marlin/src/feature/leds/tempstat.cpp +++ b/Marlin/src/feature/leds/tempstat.cpp @@ -32,26 +32,26 @@ #include "../../module/temperature.h" void handle_status_leds(void) { - static bool red_led = false; + static uint8_t red_led = LOW; static millis_t next_status_led_update_ms = 0; if (ELAPSED(millis(), next_status_led_update_ms)) { next_status_led_update_ms += 500; // Update every 0.5s float max_temp = 0.0; #if HAS_HEATED_BED - max_temp = MAX3(max_temp, thermalManager.degTargetBed(), thermalManager.degBed()); + max_temp = MAX(max_temp, thermalManager.degTargetBed(), thermalManager.degBed()); #endif HOTEND_LOOP() - max_temp = MAX3(max_temp, thermalManager.degHotend(e), thermalManager.degTargetHotend(e)); - const bool new_led = (max_temp > 55.0) ? true : (max_temp < 54.0) ? false : red_led; + max_temp = MAX(max_temp, thermalManager.degHotend(e), thermalManager.degTargetHotend(e)); + const uint8_t new_led = (max_temp > 55.0) ? HIGH : (max_temp < 54.0) ? LOW : red_led; if (new_led != red_led) { red_led = new_led; #if PIN_EXISTS(STAT_LED_RED) - WRITE(STAT_LED_RED_PIN, new_led ? HIGH : LOW); + WRITE(STAT_LED_RED_PIN, new_led); #if PIN_EXISTS(STAT_LED_BLUE) - WRITE(STAT_LED_BLUE_PIN, new_led ? LOW : HIGH); + WRITE(STAT_LED_BLUE_PIN, !new_led); #endif #else - WRITE(STAT_LED_BLUE_PIN, new_led ? HIGH : LOW); + WRITE(STAT_LED_BLUE_PIN, new_led); #endif } } diff --git a/Marlin/src/feature/leds/tempstat.h b/Marlin/src/feature/leds/tempstat.h index 290e73f1c0..ac50d93f29 100644 --- a/Marlin/src/feature/leds/tempstat.h +++ b/Marlin/src/feature/leds/tempstat.h @@ -19,14 +19,10 @@ * along with this program. If not, see . * */ +#pragma once /** * Marlin general RGB LED support */ -#ifndef __TEMPSTAT_H__ -#define __TEMPSTAT_H__ - void handle_status_leds(void); - -#endif // __TEMPSTAT_H__ diff --git a/Marlin/src/feature/mixing.cpp b/Marlin/src/feature/mixing.cpp index 37a6bdc5e7..0713dca56f 100644 --- a/Marlin/src/feature/mixing.cpp +++ b/Marlin/src/feature/mixing.cpp @@ -24,81 +24,90 @@ #if ENABLED(MIXING_EXTRUDER) -#if ENABLED(DIRECT_MIXING_IN_G1) - #include "../gcode/parser.h" +//#define MIXER_NORMALIZER_DEBUG +#ifdef MIXER_NORMALIZER_DEBUG + #include "../core/serial.h" #endif -float mixing_factor[MIXING_STEPPERS]; // Reciprocal of mix proportion. 0.0 = off, otherwise <= 1.0. (Array must sum to 1.0.) +#include "mixing.h" -#if MIXING_VIRTUAL_TOOLS > 1 +Mixer mixer; - float mixing_virtual_tool_mix[MIXING_VIRTUAL_TOOLS][MIXING_STEPPERS]; +// Used up to Planner level +uint_fast8_t Mixer::selected_v_tool = 0; +float Mixer::M163_collector[MIXING_STEPPERS]; // mix proportion. 0.0 = off, otherwise <= COLOR_A_MASK. +mixer_color_t Mixer::color[NR_MIXING_VIRTUAL_TOOLS][MIXING_STEPPERS]; - void mixing_tools_init() { - // Virtual Tools 0, 1, 2, 3 = Filament 1, 2, 3, 4, etc. - for (uint8_t t = 0; t < MIXING_VIRTUAL_TOOLS && t < MIXING_STEPPERS; t++) - for (uint8_t i = 0; i < MIXING_STEPPERS; i++) - mixing_virtual_tool_mix[t][i] = (t == i) ? 1.0 : 0.0; +// Used in Stepper +int_fast8_t Mixer::runner = 0; +mixer_color_t Mixer::s_color[MIXING_STEPPERS]; +mixer_accu_t Mixer::accu[MIXING_STEPPERS] = { 0 }; - // Remaining virtual tools are 100% filament 1 - #if MIXING_STEPPERS < MIXING_VIRTUAL_TOOLS - for (uint8_t t = MIXING_STEPPERS; t < MIXING_VIRTUAL_TOOLS; t++) - for (uint8_t i = 0; i < MIXING_STEPPERS; i++) - mixing_virtual_tool_mix[t][i] = (i == 0) ? 1.0 : 0.0; +void Mixer::normalize(const uint8_t tool_index) { + float cmax = 0; + #ifdef MIXER_NORMALIZER_DEBUG + float csum = 0; + #endif + MIXER_STEPPER_LOOP(i) { + cmax = max(cmax, M163_collector[i]); + #ifdef MIXER_NORMALIZER_DEBUG + csum += M163_collector[i]; #endif - - // Initialize mixing to tool 0 color - for (uint8_t i = 0; i < MIXING_STEPPERS; i++) - mixing_factor[i] = mixing_virtual_tool_mix[0][i]; } + #ifdef MIXER_NORMALIZER_DEBUG + SERIAL_ECHOPGM("Mixer: Relation before normalizing: [ "); + MIXER_STEPPER_LOOP(i) { + SERIAL_ECHO_F(M163_collector[i] / csum, 3); + SERIAL_CHAR(' '); + } + SERIAL_ECHOPGM("]\n"); + #endif -#endif // MIXING_VIRTUAL_TOOLS > 1 + // Scale all values so their maximum is COLOR_A_MASK + const float inverse_max = RECIPROCAL(cmax); + MIXER_STEPPER_LOOP(i) + color[tool_index][i] = M163_collector[i] * COLOR_A_MASK * inverse_max; -void normalize_mix() { - float mix_total = 0.0; - for (uint8_t i = 0; i < MIXING_STEPPERS; i++) mix_total += mixing_factor[i]; - // Scale all values if they don't add up to ~1.0 - if (!NEAR(mix_total, 1.0)) { - SERIAL_PROTOCOLLNPGM("Warning: Mix factors must add up to 1.0. Scaling."); - const float inverse_sum = RECIPROCAL(mix_total); - for (uint8_t i = 0; i < MIXING_STEPPERS; i++) mixing_factor[i] *= inverse_sum; - } + #ifdef MIXER_NORMALIZER_DEBUG + csum = 0; + SERIAL_ECHOPGM("Mixer: Normalizing to : [ "); + MIXER_STEPPER_LOOP(i) { + SERIAL_ECHO(uint16_t(color[tool_index][i])); + SERIAL_CHAR(' '); + csum += color[tool_index][i]; + } + SERIAL_ECHOLNPGM("]"); + SERIAL_ECHOPGM("Mixer: Relation after normalizing: [ "); + MIXER_STEPPER_LOOP(i) { + SERIAL_ECHO_F(uint16_t(color[tool_index][i]) / csum, 3); + SERIAL_CHAR(' '); + } + SERIAL_ECHOLNPGM("]"); + #endif } -#if ENABLED(DIRECT_MIXING_IN_G1) - // Get mixing parameters from the GCode - // The total "must" be 1.0 (but it will be normalized) - // If no mix factors are given, the old mix is preserved - void gcode_get_mix() { - const char mixing_codes[] = { 'A', 'B' - #if MIXING_STEPPERS > 2 - , 'C' - #if MIXING_STEPPERS > 3 - , 'D' - #if MIXING_STEPPERS > 4 - , 'H' - #if MIXING_STEPPERS > 5 - , 'I' - #endif // MIXING_STEPPERS > 5 - #endif // MIXING_STEPPERS > 4 - #endif // MIXING_STEPPERS > 3 - #endif // MIXING_STEPPERS > 2 - }; - byte mix_bits = 0; - for (uint8_t i = 0; i < MIXING_STEPPERS; i++) { - if (parser.seenval(mixing_codes[i])) { - SBI(mix_bits, i); - mixing_factor[i] = MAX(parser.value_float(), 0.0); - } - } - // If any mixing factors were included, clear the rest - // If none were included, preserve the last mix - if (mix_bits) { - for (uint8_t i = 0; i < MIXING_STEPPERS; i++) - if (!TEST(mix_bits, i)) mixing_factor[i] = 0.0; - normalize_mix(); - } - } -#endif +// called at boot +void Mixer::init( void ) { + // Virtual Tools 0, 1, 2, 3 = Filament 1, 2, 3, 4, etc. + // Every virtual tool gets a pure filament + for (uint8_t t = 0; t < MIXING_VIRTUAL_TOOLS && t < MIXING_STEPPERS; t++) + MIXER_STEPPER_LOOP(i) + color[t][i] = (t == i) ? COLOR_A_MASK : 0; + + // Remaining virtual tools are 100% filament 1 + #if MIXING_STEPPERS < MIXING_VIRTUAL_TOOLS + for (uint8_t t = MIXING_STEPPERS; t < MIXING_VIRTUAL_TOOLS; t++) + MIXER_STEPPER_LOOP(i) + color[t][i] = (i == 0) ? COLOR_A_MASK : 0; + #endif + + #if ENABLED(RETRACT_SYNC_MIXING) + // AUTORETRACT_TOOL gets the same amount of all filaments + MIXER_STEPPER_LOOP(i) + color[MIXER_AUTORETRACT_TOOL][i] = COLOR_A_MASK; + #endif + + ZERO(M163_collector); +} #endif // MIXING_EXTRUDER diff --git a/Marlin/src/feature/mixing.h b/Marlin/src/feature/mixing.h index fff240c0e0..0c282377f4 100644 --- a/Marlin/src/feature/mixing.h +++ b/Marlin/src/feature/mixing.h @@ -19,23 +19,95 @@ * along with this program. If not, see . * */ - -#ifndef __MIXING_H__ -#define __MIXING_H__ +#pragma once #include "../inc/MarlinConfig.h" -extern float mixing_factor[MIXING_STEPPERS]; // Reciprocal of mix proportion. 0.0 = off, otherwise >= 1.0. - -#if MIXING_VIRTUAL_TOOLS > 1 - extern float mixing_virtual_tool_mix[MIXING_VIRTUAL_TOOLS][MIXING_STEPPERS]; - void mixing_tools_init(); +#ifdef __AVR__ + #define MIXER_ACCU_SIGNED + typedef uint8_t mixer_color_t; + typedef int8_t mixer_accu_t; + #define COLOR_A_MASK 0x80 + #define COLOR_MASK 0x7F +#else + typedef uint_fast16_t mixer_color_t; + typedef uint_fast16_t mixer_accu_t; + #define COLOR_A_MASK 0x8000 + #define COLOR_MASK 0x7FFF #endif -void normalize_mix(); - -#if ENABLED(DIRECT_MIXING_IN_G1) - void gcode_get_mix(); +#ifndef MIXING_VIRTUAL_TOOLS + #define MIXING_VIRTUAL_TOOLS 1 #endif -#endif // __MIXING_H__ +#ifdef RETRACT_SYNC_MIXING + #define NR_MIXING_VIRTUAL_TOOLS (MIXING_VIRTUAL_TOOLS + 1) + #define MIXER_AUTORETRACT_TOOL MIXING_VIRTUAL_TOOLS + #if NR_MIXING_VIRTUAL_TOOLS > 254 + #error "MIXING_VIRTUAL_TOOLS must be <= 254!" + #endif +#else + #define NR_MIXING_VIRTUAL_TOOLS (MIXING_VIRTUAL_TOOLS) + #if NR_MIXING_VIRTUAL_TOOLS > 255 + #error "MIXING_VIRTUAL_TOOLS must be <= 255!" + #endif +#endif + +#define MIXER_STEPPER_LOOP(VAR) \ + for (uint_fast8_t VAR = 0; VAR < MIXING_STEPPERS; VAR++) + +#define MIXER_BLOCK_DEFINITION mixer_color_t b_color[MIXING_STEPPERS] +#define MIXER_POPULATE_BLOCK() mixer.populate_block(block->b_color) +#define MIXER_STEPPER_SETUP() mixer.stepper_setup(current_block->b_color) + +class Mixer { + public: + + static void init(void); // Populate colors at boot time + + // Used up to Planner level + static void normalize(const uint8_t tool_index); + FORCE_INLINE static uint8_t get_current_v_tool(void) { return selected_v_tool; } + FORCE_INLINE static void T(const uint_fast8_t c) { selected_v_tool = c; } + FORCE_INLINE static void set_M163_collector(const uint8_t c, const float f) { M163_collector[c] = f; } + + // Used when dealing with blocks + FORCE_INLINE static void populate_block(mixer_color_t b_color[]) { + uint_fast8_t j = get_current_v_tool(); + MIXER_STEPPER_LOOP(i) b_color[i] = color[j][i]; + } + FORCE_INLINE static void stepper_setup(mixer_color_t b_color[]) { MIXER_STEPPER_LOOP(i) s_color[i] = b_color[i]; } + + // Used in Stepper + FORCE_INLINE static uint8_t get_stepper(void) { return runner; } + FORCE_INLINE static uint8_t get_next_stepper(void) { + do { + if (--runner < 0) runner = MIXING_STEPPERS - 1; + accu[runner] += s_color[runner]; + if ( + #ifdef MIXER_ACCU_SIGNED + accu[runner] < 0 + #else + accu[runner] & COLOR_A_MASK + #endif + ) { + accu[runner] &= COLOR_MASK; + return runner; + } + } while( true ); + } + + private: + + // Used up to Planner level + static uint_fast8_t selected_v_tool; + static float M163_collector[MIXING_STEPPERS]; + static mixer_color_t color[NR_MIXING_VIRTUAL_TOOLS][MIXING_STEPPERS]; + + // Used in Stepper + static int_fast8_t runner; + static mixer_color_t s_color[MIXING_STEPPERS]; + static mixer_accu_t accu[MIXING_STEPPERS]; +}; + +extern Mixer mixer; diff --git a/Marlin/src/feature/pause.cpp b/Marlin/src/feature/pause.cpp index f96254b44f..0736bfebd8 100644 --- a/Marlin/src/feature/pause.cpp +++ b/Marlin/src/feature/pause.cpp @@ -25,7 +25,7 @@ * This may be combined with related G-codes if features are consolidated. */ -#include "../inc/MarlinConfig.h" +#include "../inc/MarlinConfigPre.h" #if ENABLED(ADVANCED_PAUSE_FEATURE) @@ -45,7 +45,7 @@ #include "../feature/runout.h" #endif -#if ENABLED(ULTIPANEL) +#if HAS_LCD_MENU #include "../lcd/ultralcd.h" #endif @@ -59,8 +59,7 @@ static float resume_position[XYZE]; AdvancedPauseMenuResponse advanced_pause_menu_response; -float filament_change_unload_length[EXTRUDERS], - filament_change_load_length[EXTRUDERS]; +fil_change_settings_t fc_settings[EXTRUDERS]; #if ENABLED(SDSUPPORT) #include "../sd/cardreader.h" @@ -93,35 +92,28 @@ float filament_change_unload_length[EXTRUDERS], * * Returns 'true' if heating was completed, 'false' for abort */ -static bool ensure_safe_temperature(const AdvancedPauseMode mode=ADVANCED_PAUSE_MODE_PAUSE_PRINT) { +static bool ensure_safe_temperature(const AdvancedPauseMode mode=ADVANCED_PAUSE_MODE_SAME) { #if ENABLED(PREVENT_COLD_EXTRUSION) if (!DEBUGGING(DRYRUN) && thermalManager.targetTooColdToExtrude(active_extruder)) { SERIAL_ERROR_START(); - SERIAL_ERRORLNPGM(MSG_HOTEND_TOO_COLD); + SERIAL_ERRORLNPGM(MSG_ERR_HOTEND_TOO_COLD); return false; } #endif - #if ENABLED(ULTIPANEL) - lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_WAIT_FOR_NOZZLES_TO_HEAT, mode); + #if HAS_LCD_MENU + lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_HEATING, mode); #else UNUSED(mode); #endif - wait_for_heatup = true; // M108 will clear this - while (wait_for_heatup && thermalManager.wait_for_heating(active_extruder)) idle(); - const bool status = wait_for_heatup; - wait_for_heatup = false; - - return status; + return thermalManager.wait_for_hotend(active_extruder); } -static void do_pause_e_move(const float &length, const float &fr) { - set_destination_from_current(); - destination[E_AXIS] += length / planner.e_factor[active_extruder]; - planner.buffer_line(destination, fr, active_extruder); - set_current_from_destination(); +void do_pause_e_move(const float &length, const float &fr) { + current_position[E_AXIS] += length / planner.e_factor[active_extruder]; + planner.buffer_line(current_position, fr, active_extruder); planner.synchronize(); } @@ -142,23 +134,16 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l const AdvancedPauseMode mode/*=ADVANCED_PAUSE_MODE_PAUSE_PRINT*/ DXC_ARGS ) { - #if DISABLED(ULTIPANEL) - UNUSED(show_lcd); - #endif - if (!ensure_safe_temperature(mode)) { - #if ENABLED(ULTIPANEL) - if (show_lcd) // Show status screen - lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_STATUS); + #if HAS_LCD_MENU + if (show_lcd) lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_STATUS, mode); #endif - return false; } if (pause_for_user) { - #if ENABLED(ULTIPANEL) - if (show_lcd) // Show "insert filament" - lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INSERT, mode); + #if HAS_LCD_MENU + if (show_lcd) lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INSERT, mode); #endif SERIAL_ECHO_START(); SERIAL_ECHOLNPGM(MSG_FILAMENT_CHANGE_INSERT); @@ -180,9 +165,10 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l KEEPALIVE_STATE(IN_HANDLER); } - #if ENABLED(ULTIPANEL) - if (show_lcd) // Show "wait for load" message - lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_LOAD, mode); + #if HAS_LCD_MENU + if (show_lcd) lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_LOAD, mode); + #else + UNUSED(show_lcd); #endif #if ENABLED(DUAL_X_CARRIAGE) @@ -198,14 +184,14 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l // Fast Load Filament if (fast_load_length) { #if FILAMENT_CHANGE_FAST_LOAD_ACCEL > 0 - const float saved_acceleration = planner.retract_acceleration; - planner.retract_acceleration = FILAMENT_CHANGE_FAST_LOAD_ACCEL; + const float saved_acceleration = planner.settings.retract_acceleration; + planner.settings.retract_acceleration = FILAMENT_CHANGE_FAST_LOAD_ACCEL; #endif do_pause_e_move(fast_load_length, FILAMENT_CHANGE_FAST_LOAD_FEEDRATE); #if FILAMENT_CHANGE_FAST_LOAD_ACCEL > 0 - planner.retract_acceleration = saved_acceleration; + planner.settings.retract_acceleration = saved_acceleration; #endif } @@ -217,9 +203,8 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l #if ENABLED(ADVANCED_PAUSE_CONTINUOUS_PURGE) - #if ENABLED(ULTIPANEL) - if (show_lcd) - lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_CONTINUOUS_PURGE); + #if HAS_LCD_MENU + if (show_lcd) lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_PURGE); #endif wait_for_user = true; @@ -232,9 +217,8 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l do { if (purge_length > 0) { // "Wait for filament purge" - #if ENABLED(ULTIPANEL) - if (show_lcd) - lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_PURGE, mode); + #if HAS_LCD_MENU + if (show_lcd) lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_PURGE); #endif // Extrude filament to get into hotend @@ -242,11 +226,11 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l } // Show "Purge More" / "Resume" menu and wait for reply - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU if (show_lcd) { KEEPALIVE_STATE(PAUSED_FOR_USER); wait_for_user = false; - lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_OPTION, mode); + lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_OPTION); while (advanced_pause_menu_response == ADVANCED_PAUSE_RESPONSE_WAIT_FOR) idle(true); KEEPALIVE_STATE(IN_HANDLER); } @@ -254,7 +238,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l // Keep looping if "Purge More" was selected } while ( - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU show_lcd && advanced_pause_menu_response == ADVANCED_PAUSE_RESPONSE_EXTRUDE_MORE #else 0 @@ -280,19 +264,17 @@ bool unload_filament(const float &unload_length, const bool show_lcd/*=false*/, const AdvancedPauseMode mode/*=ADVANCED_PAUSE_MODE_PAUSE_PRINT*/ ) { if (!ensure_safe_temperature(mode)) { - #if ENABLED(ULTIPANEL) - if (show_lcd) // Show status screen - lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_STATUS); + #if HAS_LCD_MENU + if (show_lcd) lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_STATUS); #endif return false; } - #if DISABLED(ULTIPANEL) - UNUSED(show_lcd); + #if HAS_LCD_MENU + if (show_lcd) lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_UNLOAD, mode); #else - if (show_lcd) - lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_UNLOAD, mode); + UNUSED(show_lcd); #endif // Retract filament @@ -302,22 +284,22 @@ bool unload_filament(const float &unload_length, const bool show_lcd/*=false*/, safe_delay(FILAMENT_UNLOAD_DELAY); // Quickly purge - do_pause_e_move(FILAMENT_UNLOAD_RETRACT_LENGTH + FILAMENT_UNLOAD_PURGE_LENGTH, planner.max_feedrate_mm_s[E_AXIS]); + do_pause_e_move(FILAMENT_UNLOAD_RETRACT_LENGTH + FILAMENT_UNLOAD_PURGE_LENGTH, planner.settings.max_feedrate_mm_s[E_AXIS]); // Unload filament #if FILAMENT_CHANGE_UNLOAD_ACCEL > 0 - const float saved_acceleration = planner.retract_acceleration; - planner.retract_acceleration = FILAMENT_CHANGE_UNLOAD_ACCEL; + const float saved_acceleration = planner.settings.retract_acceleration; + planner.settings.retract_acceleration = FILAMENT_CHANGE_UNLOAD_ACCEL; #endif do_pause_e_move(unload_length, FILAMENT_CHANGE_UNLOAD_FEEDRATE); #if FILAMENT_CHANGE_FAST_LOAD_ACCEL > 0 - planner.retract_acceleration = saved_acceleration; + planner.settings.retract_acceleration = saved_acceleration; #endif // Disable extruders steppers for manual filament changing (only on boards that have separate ENABLE_PINS) - #if E0_ENABLE_PIN != X_ENABLE_PIN && E1_ENABLE_PIN != Y_ENABLE_PIN + #if (E0_ENABLE_PIN != X_ENABLE_PIN && E1_ENABLE_PIN != Y_ENABLE_PIN) || AXIS_DRIVER_TYPE(E0, TMC2660) || AXIS_DRIVER_TYPE(E1, TMC2660) || AXIS_DRIVER_TYPE(E2, TMC2660) || AXIS_DRIVER_TYPE(E3, TMC2660) || AXIS_DRIVER_TYPE(E4, TMC2660) || AXIS_DRIVER_TYPE(E5, TMC2660) disable_e_stepper(active_extruder); safe_delay(100); #endif @@ -350,16 +332,17 @@ bool pause_print(const float &retract, const point_t &park_point, const float &u SERIAL_ECHOLNPGM("//action:" ACTION_ON_PAUSE); #endif - #if ENABLED(ULTIPANEL) - if (show_lcd) // Show initial message - lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INIT); + #if HAS_LCD_MENU + if (show_lcd) lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INIT, ADVANCED_PAUSE_MODE_PAUSE_PRINT); + #else + UNUSED(show_lcd); #endif if (!DEBUGGING(DRYRUN) && unload_length && thermalManager.targetTooColdToExtrude(active_extruder)) { SERIAL_ERROR_START(); - SERIAL_ERRORLNPGM(MSG_HOTEND_TOO_COLD); + SERIAL_ERRORLNPGM(MSG_ERR_HOTEND_TOO_COLD); - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU if (show_lcd) { // Show status screen lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_STATUS); LCD_MESSAGEPGM(MSG_M600_TOO_COLD); @@ -374,11 +357,12 @@ bool pause_print(const float &retract, const point_t &park_point, const float &u // Pause the print job and timer #if ENABLED(SDSUPPORT) - if (card.sdprinting) { + if (IS_SD_PRINTING()) { card.pauseSDPrint(); ++did_pause_print; // Indicate SD pause also } #endif + print_job_timer.pause(); // Save current position @@ -415,20 +399,38 @@ bool pause_print(const float &retract, const point_t &park_point, const float &u } /** + * For Paused Print: + * - Show "Press button (or M108) to resume" + * + * For Filament Change: * - Show "Insert filament and press button to continue" + * * - Wait for a click before returning - * - Heaters can time out, reheated before accepting a click + * - Heaters can time out and must reheat before continuing * * Used by M125 and M600 */ -void wait_for_filament_reload(const int8_t max_beep_count/*=0*/ DXC_ARGS) { - bool nozzle_timed_out = false; - #if ENABLED(ULTIPANEL) - lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INSERT); +#if (HAS_LCD_MENU || ENABLED(EXTENSIBLE_UI)) && ENABLED(EMERGENCY_PARSER) + #define _PMSG(L) L +#elif ENABLED(EMERGENCY_PARSER) + #define _PMSG(L) L##_M108 +#else + #define _PMSG(L) L##_LCD +#endif + +void show_continue_prompt(const bool is_reload) { + #if HAS_LCD_MENU + lcd_advanced_pause_show_message(is_reload ? ADVANCED_PAUSE_MESSAGE_INSERT : ADVANCED_PAUSE_MESSAGE_WAITING); #endif SERIAL_ECHO_START(); - SERIAL_ERRORLNPGM(MSG_FILAMENT_CHANGE_INSERT); + serialprintPGM(is_reload ? PSTR(_PMSG(MSG_FILAMENT_CHANGE_INSERT) "\n") : PSTR(_PMSG(MSG_FILAMENT_CHANGE_WAIT) "\n")); +} + +void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep_count/*=0*/ DXC_ARGS) { + bool nozzle_timed_out = false; + + show_continue_prompt(is_reload); #if HAS_BUZZER filament_change_beep(max_beep_count, true); @@ -455,24 +457,18 @@ void wait_for_filament_reload(const int8_t max_beep_count/*=0*/ DXC_ARGS) { filament_change_beep(max_beep_count); #endif - // If the nozzle has timed out, wait for the user to press the button to re-heat the nozzle, then - // re-heat the nozzle, re-show the insert screen, restart the idle timers, and start over + // If the nozzle has timed out... if (!nozzle_timed_out) - HOTEND_LOOP() - nozzle_timed_out |= thermalManager.is_heater_idle(e); + HOTEND_LOOP() nozzle_timed_out |= thermalManager.is_heater_idle(e); + // Wait for the user to press the button to re-heat the nozzle, then + // re-heat the nozzle, re-show the continue prompt, restart idle timers, start over if (nozzle_timed_out) { - #if ENABLED(ULTIPANEL) - lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_CLICK_TO_HEAT_NOZZLE); + #if HAS_LCD_MENU + lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_HEAT); #endif SERIAL_ECHO_START(); - #if ENABLED(ULTIPANEL) && ENABLED(EMERGENCY_PARSER) - SERIAL_ECHOLNPGM(MSG_FILAMENT_CHANGE_HEAT); - #elif ENABLED(EMERGENCY_PARSER) - SERIAL_ECHOLNPGM(MSG_FILAMENT_CHANGE_HEAT_M108); - #else - SERIAL_ECHOLNPGM(MSG_FILAMENT_CHANGE_HEAT_LCD); - #endif + SERIAL_ECHOLNPGM(_PMSG(MSG_FILAMENT_CHANGE_HEAT)); // Wait for LCD click or M108 while (wait_for_user) idle(true); @@ -483,17 +479,8 @@ void wait_for_filament_reload(const int8_t max_beep_count/*=0*/ DXC_ARGS) { // Wait for the heaters to reach the target temperatures ensure_safe_temperature(); - #if ENABLED(ULTIPANEL) - lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INSERT); - #endif - SERIAL_ECHO_START(); - #if ENABLED(ULTIPANEL) && ENABLED(EMERGENCY_PARSER) - SERIAL_ECHOLNPGM(MSG_FILAMENT_CHANGE_INSERT); - #elif ENABLED(EMERGENCY_PARSER) - SERIAL_ECHOLNPGM(MSG_FILAMENT_CHANGE_INSERT_M108); - #else - SERIAL_ECHOLNPGM(MSG_FILAMENT_CHANGE_INSERT_LCD); - #endif + // Show the prompt to continue + show_continue_prompt(is_reload); // Start the heater idle timers const millis_t nozzle_timeout = (millis_t)(PAUSE_PARK_NOZZLE_TIMEOUT) * 1000UL; @@ -501,7 +488,7 @@ void wait_for_filament_reload(const int8_t max_beep_count/*=0*/ DXC_ARGS) { HOTEND_LOOP() thermalManager.start_heater_idle_timer(e, nozzle_timeout); - wait_for_user = true; // Wait for user to load filament + wait_for_user = true; nozzle_timed_out = false; #if HAS_BUZZER @@ -558,15 +545,15 @@ void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_le if (nozzle_timed_out || thermalManager.hotEnoughToExtrude(active_extruder)) // Load the new filament load_filament(slow_load_length, fast_load_length, purge_length, max_beep_count, true, nozzle_timed_out, ADVANCED_PAUSE_MODE_PAUSE_PRINT DXC_PASS); - #if ENABLED(ULTIPANEL) - lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_RESUME); // "Wait for print to resume" + #if HAS_LCD_MENU + lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_RESUME); #endif // Intelligent resuming #if ENABLED(FWRETRACT) // If retracted before goto pause if (fwretract.retracted[active_extruder]) - do_pause_e_move(-fwretract.retract_length, fwretract.retract_feedrate_mm_s); + do_pause_e_move(-fwretract.settings.retract_length, fwretract.settings.retract_feedrate_mm_s); #endif // If resume_position is negative @@ -586,8 +573,7 @@ void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_le runout.reset(); #endif - #if ENABLED(ULTIPANEL) - // Show status screen + #if HAS_LCD_MENU lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_STATUS); #endif @@ -603,6 +589,10 @@ void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_le --did_pause_print; } #endif + + #if ENABLED(ULTRA_LCD) + ui.reset_status(); + #endif } #endif // ADVANCED_PAUSE_FEATURE diff --git a/Marlin/src/feature/pause.h b/Marlin/src/feature/pause.h index 5eb39a5e1a..87cfe05f7c 100644 --- a/Marlin/src/feature/pause.h +++ b/Marlin/src/feature/pause.h @@ -19,20 +19,25 @@ * along with this program. If not, see . * */ +#pragma once /** * feature/pause.h - Pause feature support functions * This may be combined with related G-codes if features are consolidated. */ -#ifndef _PAUSE_H_ -#define _PAUSE_H_ - -#include "../libs/nozzle.h" +typedef struct { + float unload_length, load_length; +} fil_change_settings_t; #include "../inc/MarlinConfigPre.h" +#if ENABLED(ADVANCED_PAUSE_FEATURE) + +#include "../libs/nozzle.h" + enum AdvancedPauseMode : char { + ADVANCED_PAUSE_MODE_SAME, ADVANCED_PAUSE_MODE_PAUSE_PRINT, ADVANCED_PAUSE_MODE_LOAD_FILAMENT, ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT @@ -40,18 +45,16 @@ enum AdvancedPauseMode : char { enum AdvancedPauseMessage : char { ADVANCED_PAUSE_MESSAGE_INIT, + ADVANCED_PAUSE_MESSAGE_WAITING, ADVANCED_PAUSE_MESSAGE_UNLOAD, ADVANCED_PAUSE_MESSAGE_INSERT, ADVANCED_PAUSE_MESSAGE_LOAD, ADVANCED_PAUSE_MESSAGE_PURGE, - #if ENABLED(ADVANCED_PAUSE_CONTINUOUS_PURGE) - ADVANCED_PAUSE_MESSAGE_CONTINUOUS_PURGE, - #endif ADVANCED_PAUSE_MESSAGE_OPTION, ADVANCED_PAUSE_MESSAGE_RESUME, ADVANCED_PAUSE_MESSAGE_STATUS, - ADVANCED_PAUSE_MESSAGE_CLICK_TO_HEAT_NOZZLE, - ADVANCED_PAUSE_MESSAGE_WAIT_FOR_NOZZLES_TO_HEAT + ADVANCED_PAUSE_MESSAGE_HEAT, + ADVANCED_PAUSE_MESSAGE_HEATING }; enum AdvancedPauseMenuResponse : char { @@ -62,8 +65,7 @@ enum AdvancedPauseMenuResponse : char { extern AdvancedPauseMenuResponse advanced_pause_menu_response; -extern float filament_change_unload_length[EXTRUDERS], - filament_change_load_length[EXTRUDERS]; +extern fil_change_settings_t fc_settings[EXTRUDERS]; extern uint8_t did_pause_print; @@ -77,9 +79,11 @@ extern uint8_t did_pause_print; #define DXC_PASS #endif +void do_pause_e_move(const float &length, const float &fr); + bool pause_print(const float &retract, const point_t &park_point, const float &unload_length=0, const bool show_lcd=false DXC_PARAMS); -void wait_for_filament_reload(const int8_t max_beep_count=0 DXC_PARAMS); +void wait_for_confirmation(const bool is_reload=false, const int8_t max_beep_count=0 DXC_PARAMS); void resume_print(const float &slow_load_length=0, const float &fast_load_length=0, const float &extrude_length=ADVANCED_PAUSE_PURGE_LENGTH, const int8_t max_beep_count=0 DXC_PARAMS); @@ -88,4 +92,4 @@ bool load_filament(const float &slow_load_length=0, const float &fast_load_lengt bool unload_filament(const float &unload_length, const bool show_lcd=false, const AdvancedPauseMode mode=ADVANCED_PAUSE_MODE_PAUSE_PRINT); -#endif // _PAUSE_H_ +#endif //ADVANCED_PAUSE_FEATURE diff --git a/Marlin/src/feature/power.cpp b/Marlin/src/feature/power.cpp index 6c196fd6f3..24f02041b2 100644 --- a/Marlin/src/feature/power.cpp +++ b/Marlin/src/feature/power.cpp @@ -39,15 +39,15 @@ millis_t Power::lastPowerOn; bool Power::is_power_needed() { #if ENABLED(AUTO_POWER_FANS) - for (uint8_t i = 0; i < FAN_COUNT; i++) if (fanSpeeds[i] > 0) return true; + for (uint8_t i = 0; i < FAN_COUNT; i++) if (fan_speed[i]) return true; #endif #if ENABLED(AUTO_POWER_E_FANS) - HOTEND_LOOP() if (thermalManager.autofan_speed[e] > 0) return true; + HOTEND_LOOP() if (thermalManager.autofan_speed[e]) return true; #endif #if ENABLED(AUTO_POWER_CONTROLLERFAN) && HAS_CONTROLLER_FAN && ENABLED(USE_CONTROLLER_FAN) - if (controllerFanSpeed > 0) return true; + if (controllerfan_speed) return true; #endif // If any of the drivers or the bed are enabled... diff --git a/Marlin/src/feature/power.h b/Marlin/src/feature/power.h index 225e4dc6f3..101ccb4a52 100644 --- a/Marlin/src/feature/power.h +++ b/Marlin/src/feature/power.h @@ -19,15 +19,13 @@ * along with this program. If not, see . * */ +#pragma once /** * power.h - power control */ -#ifndef POWER_H -#define POWER_H - -#include "../core/types.h" +#include "../core/millis_t.h" class Power { public: @@ -40,5 +38,3 @@ class Power { }; extern Power powerManager; - -#endif // POWER_H diff --git a/Marlin/src/feature/power_loss_recovery.cpp b/Marlin/src/feature/power_loss_recovery.cpp index 6613c0adf6..5093e09f40 100644 --- a/Marlin/src/feature/power_loss_recovery.cpp +++ b/Marlin/src/feature/power_loss_recovery.cpp @@ -29,247 +29,145 @@ #if ENABLED(POWER_LOSS_RECOVERY) #include "power_loss_recovery.h" +#include "../core/macros.h" +bool PrintJobRecovery::enabled; // Initialized by settings.load() + +SdFile PrintJobRecovery::file; +job_recovery_info_t PrintJobRecovery::info; + +#include "../sd/cardreader.h" #include "../lcd/ultralcd.h" #include "../gcode/queue.h" +#include "../gcode/gcode.h" #include "../module/motion.h" #include "../module/planner.h" #include "../module/printcounter.h" #include "../module/temperature.h" -#include "../sd/cardreader.h" #include "../core/serial.h" #if ENABLED(FWRETRACT) #include "fwretract.h" #endif -// Recovery data -job_recovery_info_t job_recovery_info; -JobRecoveryPhase job_recovery_phase = JOB_RECOVERY_IDLE; -uint8_t job_recovery_commands_count; //=0 -char job_recovery_commands[BUFSIZE + APPEND_CMD_COUNT][MAX_CMD_SIZE]; +PrintJobRecovery recovery; -extern uint8_t commands_in_queue, cmd_queue_index_r; +/** + * Clear the recovery info + */ +void PrintJobRecovery::init() { memset(&info, 0, sizeof(info)); } -#if ENABLED(DEBUG_POWER_LOSS_RECOVERY) - void debug_print_job_recovery(const bool recovery) { - SERIAL_PROTOCOLLNPGM("---- Job Recovery Info ----"); - SERIAL_PROTOCOLPAIR("valid_head:", int(job_recovery_info.valid_head)); - SERIAL_PROTOCOLLNPAIR(" valid_foot:", int(job_recovery_info.valid_foot)); - if (job_recovery_info.valid_head) { - if (job_recovery_info.valid_head == job_recovery_info.valid_foot) { - SERIAL_PROTOCOLPGM("current_position: "); - LOOP_XYZE(i) { - SERIAL_PROTOCOL(job_recovery_info.current_position[i]); - if (i < E_AXIS) SERIAL_CHAR(','); - } - SERIAL_EOL(); - SERIAL_PROTOCOLLNPAIR("feedrate: ", job_recovery_info.feedrate); +/** + * Enable or disable then call changed() + */ +void PrintJobRecovery::enable(const bool onoff) { + enabled = onoff; + changed(); +} - #if HOTENDS > 1 - SERIAL_PROTOCOLLNPAIR("active_hotend: ", int(job_recovery_info.active_hotend)); - #endif - - SERIAL_PROTOCOLPGM("target_temperature: "); - HOTEND_LOOP() { - SERIAL_PROTOCOL(job_recovery_info.target_temperature[e]); - if (e < HOTENDS - 1) SERIAL_CHAR(','); - } - SERIAL_EOL(); - - #if HAS_HEATED_BED - SERIAL_PROTOCOLLNPAIR("target_temperature_bed: ", job_recovery_info.target_temperature_bed); - #endif - - #if FAN_COUNT - SERIAL_PROTOCOLPGM("fanSpeeds: "); - for (int8_t i = 0; i < FAN_COUNT; i++) { - SERIAL_PROTOCOL(job_recovery_info.fanSpeeds[i]); - if (i < FAN_COUNT - 1) SERIAL_CHAR(','); - } - SERIAL_EOL(); - #endif - - #if HAS_LEVELING - SERIAL_PROTOCOLPAIR("leveling: ", int(job_recovery_info.leveling)); - SERIAL_PROTOCOLLNPAIR(" fade: ", int(job_recovery_info.fade)); - #endif - #if ENABLED(FWRETRACT) - SERIAL_PROTOCOLPGM("retract: "); - for (int8_t e = 0; e < EXTRUDERS; e++) { - SERIAL_PROTOCOL(job_recovery_info.retract[e]); - if (e < EXTRUDERS - 1) SERIAL_CHAR(','); - } - SERIAL_EOL(); - SERIAL_PROTOCOLLNPAIR("retract_hop: ", job_recovery_info.retract_hop); - #endif - SERIAL_PROTOCOLLNPAIR("cmd_queue_index_r: ", int(job_recovery_info.cmd_queue_index_r)); - SERIAL_PROTOCOLLNPAIR("commands_in_queue: ", int(job_recovery_info.commands_in_queue)); - if (recovery) - for (uint8_t i = 0; i < job_recovery_commands_count; i++) SERIAL_PROTOCOLLNPAIR("> ", job_recovery_commands[i]); - else - for (uint8_t i = 0; i < job_recovery_info.commands_in_queue; i++) SERIAL_PROTOCOLLNPAIR("> ", job_recovery_info.command_queue[i]); - SERIAL_PROTOCOLLNPAIR("sd_filename: ", job_recovery_info.sd_filename); - SERIAL_PROTOCOLLNPAIR("sdpos: ", job_recovery_info.sdpos); - SERIAL_PROTOCOLLNPAIR("print_job_elapsed: ", job_recovery_info.print_job_elapsed); - } - else - SERIAL_PROTOCOLLNPGM("INVALID DATA"); - } - SERIAL_PROTOCOLLNPGM("---------------------------"); - } -#endif // DEBUG_POWER_LOSS_RECOVERY +/** + * The enabled state was changed: + * - Enabled: Purge the job recovery file + * - Disabled: Write the job recovery file + */ +void PrintJobRecovery::changed() { + if (!enabled) + purge(); + else if (IS_SD_PRINTING()) + save(true); +} /** * Check for Print Job Recovery during setup() * - * If a saved state exists, populate job_recovery_commands with - * commands to restore the machine state and continue the file. + * If a saved state exists send 'M1000 S' to initiate job recovery. */ -void check_print_job_recovery() { - memset(&job_recovery_info, 0, sizeof(job_recovery_info)); - ZERO(job_recovery_commands); - - if (!card.cardOK) card.initsd(); - - if (card.cardOK) { - - #if ENABLED(DEBUG_POWER_LOSS_RECOVERY) - SERIAL_PROTOCOLLNPAIR("Init job recovery info. Size: ", int(sizeof(job_recovery_info))); - #endif - - if (card.jobRecoverFileExists()) { - card.openJobRecoveryFile(true); - card.loadJobRecoveryInfo(); - card.closeJobRecoveryFile(); - //card.removeJobRecoveryFile(); - - if (job_recovery_info.valid_head && job_recovery_info.valid_head == job_recovery_info.valid_foot) { - - uint8_t ind = 0; - - #if HAS_LEVELING - strcpy_P(job_recovery_commands[ind++], PSTR("M420 S0 Z0")); // Leveling off before G92 or G28 - #endif - - strcpy_P(job_recovery_commands[ind++], PSTR("G92.0 Z0")); // Ensure Z is equal to 0 - strcpy_P(job_recovery_commands[ind++], PSTR("G1 Z2")); // Raise Z by 2mm (we hope!) - strcpy_P(job_recovery_commands[ind++], PSTR("G28 R0" - #if ENABLED(MARLIN_DEV_MODE) - " S" - #elif !IS_KINEMATIC - " X Y" // Home X and Y for Cartesian - #endif - )); - - char str_1[16], str_2[16]; - - #if HAS_LEVELING - if (job_recovery_info.fade || job_recovery_info.leveling) { - // Restore leveling state before G92 sets Z - // This ensures the steppers correspond to the native Z - dtostrf(job_recovery_info.fade, 1, 1, str_1); - sprintf_P(job_recovery_commands[ind++], PSTR("M420 S%i Z%s"), int(job_recovery_info.leveling), str_1); - } - #endif - - #if ENABLED(FWRETRACT) - for (uint8_t e = 0; e < EXTRUDERS; e++) { - if (job_recovery_info.retract[e] != 0.0) - fwretract.current_retract[e] = job_recovery_info.retract[e]; - fwretract.retracted[e] = true; - } - fwretract.current_hop = job_recovery_info.retract_hop; - #endif - - dtostrf(job_recovery_info.current_position[Z_AXIS] + 2, 1, 3, str_1); - dtostrf(job_recovery_info.current_position[E_AXIS] - #if ENABLED(SAVE_EACH_CMD_MODE) - - 5 - #endif - , 1, 3, str_2 - ); - sprintf_P(job_recovery_commands[ind++], PSTR("G92.0 Z%s E%s"), str_1, str_2); // Current Z + 2 and E - - uint8_t r = job_recovery_info.cmd_queue_index_r, c = job_recovery_info.commands_in_queue; - while (c--) { - strcpy(job_recovery_commands[ind++], job_recovery_info.command_queue[r]); - r = (r + 1) % BUFSIZE; - } - - if (job_recovery_info.sd_filename[0] == '/') job_recovery_info.sd_filename[0] = ' '; - sprintf_P(job_recovery_commands[ind++], PSTR("M23 %s"), job_recovery_info.sd_filename); - sprintf_P(job_recovery_commands[ind++], PSTR("M24 S%ld T%ld"), job_recovery_info.sdpos, job_recovery_info.print_job_elapsed); - - job_recovery_commands_count = ind; - - #if ENABLED(DEBUG_POWER_LOSS_RECOVERY) - debug_print_job_recovery(true); - #endif - } - else { - if (job_recovery_info.valid_head != job_recovery_info.valid_foot) - LCD_ALERTMESSAGEPGM("INVALID DATA"); - memset(&job_recovery_info, 0, sizeof(job_recovery_info)); - } +void PrintJobRecovery::check() { + if (enabled) { + if (!card.flag.cardOK) card.initsd(); + if (card.flag.cardOK) { + load(); + if (!valid()) return purge(); + enqueue_and_echo_commands_P(PSTR("M1000 S")); } } } +/** + * Delete the recovery file and clear the recovery data + */ +void PrintJobRecovery::purge() { + init(); + card.removeJobRecoveryFile(); +} + +/** + * Load the recovery data, if it exists + */ +void PrintJobRecovery::load() { + if (exists()) { + open(true); + (void)file.read(&info, sizeof(info)); + close(); + } + #if ENABLED(DEBUG_POWER_LOSS_RECOVERY) + debug(PSTR("Load")); + #endif +} + /** * Save the current machine state to the power-loss recovery file */ -void save_job_recovery_info() { +void PrintJobRecovery::save(const bool force/*=false*/) { + #if SAVE_INFO_INTERVAL_MS > 0 - static millis_t next_save_ms; // = 0; // Init on reset + static millis_t next_save_ms; // = 0 millis_t ms = millis(); #endif - if ( - // Save on every command - #if ENABLED(SAVE_EACH_CMD_MODE) - true - #else - // Save if power loss pin is triggered - #if PIN_EXISTS(POWER_LOSS) - READ(POWER_LOSS_PIN) == POWER_LOSS_STATE || + + 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 + || READ(POWER_LOSS_PIN) == POWER_LOSS_STATE #endif - // Save if interval is elapsed - #if SAVE_INFO_INTERVAL_MS > 0 - ELAPSED(ms, next_save_ms) || + #if SAVE_INFO_INTERVAL_MS > 0 // Save if interval is elapsed + || ELAPSED(ms, next_save_ms) #endif - // Save on every new Z height - (current_position[Z_AXIS] > 0 && current_position[Z_AXIS] > job_recovery_info.current_position[Z_AXIS]) + // Save every time Z is higher than the last call + || current_position[Z_AXIS] > info.current_position[Z_AXIS] #endif ) { + #if SAVE_INFO_INTERVAL_MS > 0 next_save_ms = ms + SAVE_INFO_INTERVAL_MS; #endif - // Head and foot will match if valid data was saved - if (!++job_recovery_info.valid_head) ++job_recovery_info.valid_head; // non-zero in sequence - job_recovery_info.valid_foot = job_recovery_info.valid_head; + // Set Head and Foot to matching non-zero values + if (!++info.valid_head) ++info.valid_head; // non-zero in sequence + //if (!IS_SD_PRINTING()) info.valid_head = 0; + info.valid_foot = info.valid_head; // Machine state - COPY(job_recovery_info.current_position, current_position); - job_recovery_info.feedrate = feedrate_mm_s; + COPY(info.current_position, current_position); + info.feedrate = uint16_t(feedrate_mm_s * 60.0f); #if HOTENDS > 1 - job_recovery_info.active_hotend = active_extruder; + info.active_hotend = active_extruder; #endif - COPY(job_recovery_info.target_temperature, thermalManager.target_temperature); + COPY(info.target_temperature, thermalManager.target_temperature); #if HAS_HEATED_BED - job_recovery_info.target_temperature_bed = thermalManager.target_temperature_bed; + info.target_temperature_bed = thermalManager.target_temperature_bed; #endif #if FAN_COUNT - COPY(job_recovery_info.fanSpeeds, fanSpeeds); + COPY(info.fan_speed, fan_speed); #endif #if HAS_LEVELING - job_recovery_info.leveling = planner.leveling_active; - job_recovery_info.fade = ( + info.leveling = planner.leveling_active; + info.fade = ( #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) planner.z_fade_height #else @@ -279,35 +177,240 @@ void save_job_recovery_info() { #endif #if ENABLED(FWRETRACT) - COPY(job_recovery_info.retract, fwretract.current_retract); - job_recovery_info.retract_hop = fwretract.current_hop; + COPY(info.retract, fwretract.current_retract); + info.retract_hop = fwretract.current_hop; #endif // Commands in the queue - job_recovery_info.cmd_queue_index_r = cmd_queue_index_r; - job_recovery_info.commands_in_queue = commands_in_queue; - COPY(job_recovery_info.command_queue, command_queue); + info.cmd_queue_index_r = cmd_queue_index_r; + info.commands_in_queue = commands_in_queue; + COPY(info.command_queue, command_queue); // Elapsed print job time - job_recovery_info.print_job_elapsed = print_job_timer.duration(); + info.print_job_elapsed = print_job_timer.duration(); // SD file position - card.getAbsFilename(job_recovery_info.sd_filename); - job_recovery_info.sdpos = card.getIndex(); + card.getAbsFilename(info.sd_filename); + info.sdpos = card.getIndex(); - #if ENABLED(DEBUG_POWER_LOSS_RECOVERY) - SERIAL_PROTOCOLLNPGM("Saving..."); - debug_print_job_recovery(false); - #endif + write(); - card.openJobRecoveryFile(false); - (void)card.saveJobRecoveryInfo(); - - // If power-loss pin was triggered, write just once then kill + // KILL now if the power-loss pin was triggered #if PIN_EXISTS(POWER_LOSS) - if (READ(POWER_LOSS_PIN) == POWER_LOSS_STATE) kill(MSG_POWER_LOSS_RECOVERY); + if (READ(POWER_LOSS_PIN) == POWER_LOSS_STATE) kill(PSTR(MSG_OUTAGE_RECOVERY)); #endif } } +/** + * Save the recovery info the recovery file + */ +void PrintJobRecovery::write() { + + #if ENABLED(DEBUG_POWER_LOSS_RECOVERY) + debug(PSTR("Write")); + #endif + + open(false); + file.seekSet(0); + const int16_t ret = file.write(&info, sizeof(info)); + #if ENABLED(DEBUG_POWER_LOSS_RECOVERY) + if (ret == -1) SERIAL_ECHOLNPGM("Power-loss file write failed."); + #else + UNUSED(ret); + #endif +} + +/** + * Resume the saved print job + */ +void PrintJobRecovery::resume() { + + #define RECOVERY_ZRAISE 2 + + #if HAS_LEVELING + // Make sure leveling is off before any G92 and G28 + gcode.process_subcommands_now_P(PSTR("M420 S0 Z0")); + #endif + + // Set Z to 0, raise Z by 2mm, and Home (XY only for Cartesian) with no raise + // (Only do simulated homing in Marlin Dev Mode.) + gcode.process_subcommands_now_P(PSTR("G92.0 Z0|G1 Z" STRINGIFY(RECOVERY_ZRAISE) "|G28 R0" + #if ENABLED(MARLIN_DEV_MODE) + " S" + #elif !IS_KINEMATIC + " X Y" + #endif + )); + + // Pretend that all axes are homed + axis_homed = axis_known_position = xyz_bits; + + char cmd[40], str_1[16], str_2[16]; + + // Select the previously active tool (with no_move) + #if EXTRUDERS > 1 + sprintf_P(cmd, PSTR("T%i S"), info.active_hotend); + gcode.process_subcommands_now(cmd); + #endif + + #if HAS_HEATED_BED + const int16_t bt = info.target_temperature_bed; + if (bt) { + // Restore the bed temperature + sprintf_P(cmd, PSTR("M190 S%i"), bt); + gcode.process_subcommands_now(cmd); + } + #endif + + // Restore all hotend temperatures + HOTEND_LOOP() { + const int16_t et = info.target_temperature[e]; + if (et) { + #if HOTENDS > 1 + sprintf_P(cmd, PSTR("T%i"), e); + gcode.process_subcommands_now(cmd); + #endif + sprintf_P(cmd, PSTR("M109 S%i"), et); + gcode.process_subcommands_now(cmd); + } + } + + // Restore print cooling fan speeds + for (uint8_t i = 0; i < FAN_COUNT; i++) { + uint8_t f = info.fan_speed[i]; + if (f) { + sprintf_P(cmd, PSTR("M106 P%i S%i"), i, f); + gcode.process_subcommands_now(cmd); + } + } + + // Restore retract and hop state + #if ENABLED(FWRETRACT) + for (uint8_t e = 0; e < EXTRUDERS; e++) { + if (info.retract[e] != 0.0) + fwretract.current_retract[e] = info.retract[e]; + fwretract.retracted[e] = true; + } + fwretract.current_hop = info.retract_hop; + #endif + + #if HAS_LEVELING + // Restore leveling state before 'G92 Z' to ensure + // the Z stepper count corresponds to the native Z. + if (info.fade || info.leveling) { + dtostrf(info.fade, 1, 1, str_1); + sprintf_P(cmd, PSTR("M420 S%i Z%s"), int(info.leveling), str_1); + gcode.process_subcommands_now(cmd); + } + #endif + + // Restore Z (plus raise) and E positions with G92.0 + dtostrf(info.current_position[Z_AXIS] + RECOVERY_ZRAISE, 1, 3, str_1); + dtostrf(info.current_position[E_AXIS] + #if ENABLED(SAVE_EACH_CMD_MODE) + - 5 // Extra extrusion on restart + #endif + , 1, 3, str_2 + ); + sprintf_P(cmd, PSTR("G92.0 Z%s E%s"), str_1, str_2); + gcode.process_subcommands_now(cmd); + + // Move back to the saved XY + dtostrf(info.current_position[X_AXIS], 1, 3, str_1); + dtostrf(info.current_position[Y_AXIS], 1, 3, str_2); + sprintf_P(cmd, PSTR("G1 X%s Y%s F3000"), str_1, str_2); + gcode.process_subcommands_now(cmd); + + // Move back to the saved Z + dtostrf(info.current_position[Z_AXIS], 1, 3, str_1); + sprintf_P(cmd, PSTR("G1 Z%s F200"), str_1); + gcode.process_subcommands_now(cmd); + + // Restore the feedrate + sprintf_P(cmd, PSTR("G1 F%d"), info.feedrate); + gcode.process_subcommands_now(cmd); + + // Process commands from the old pending queue + uint8_t r = info.cmd_queue_index_r, c = info.commands_in_queue; + for (; c--; r = (r + 1) % BUFSIZE) + gcode.process_subcommands_now(info.command_queue[r]); + + // Resume the SD file from the last position + char *fn = info.sd_filename; + while (*fn == '/') fn++; + sprintf_P(cmd, PSTR("M23 %s"), fn); + gcode.process_subcommands_now(cmd); + sprintf_P(cmd, PSTR("M24 S%ld T%ld"), info.sdpos, info.print_job_elapsed); + gcode.process_subcommands_now(cmd); +} + +#if ENABLED(DEBUG_POWER_LOSS_RECOVERY) + + void PrintJobRecovery::debug(PGM_P const prefix) { + serialprintPGM(prefix); + SERIAL_ECHOPAIR(" Job Recovery Info...\nvalid_head:", int(info.valid_head)); + SERIAL_ECHOLNPAIR(" valid_foot:", int(info.valid_foot)); + if (info.valid_head) { + if (info.valid_head == info.valid_foot) { + SERIAL_ECHOPGM("current_position: "); + LOOP_XYZE(i) { + SERIAL_ECHO(info.current_position[i]); + if (i < E_AXIS) SERIAL_CHAR(','); + } + SERIAL_EOL(); + SERIAL_ECHOLNPAIR("feedrate: ", info.feedrate); + + #if HOTENDS > 1 + SERIAL_ECHOLNPAIR("active_hotend: ", int(info.active_hotend)); + #endif + + SERIAL_ECHOPGM("target_temperature: "); + HOTEND_LOOP() { + SERIAL_ECHO(info.target_temperature[e]); + if (e < HOTENDS - 1) SERIAL_CHAR(','); + } + SERIAL_EOL(); + + #if HAS_HEATED_BED + SERIAL_ECHOLNPAIR("target_temperature_bed: ", info.target_temperature_bed); + #endif + + #if FAN_COUNT + SERIAL_ECHOPGM("fan_speed: "); + for (int8_t i = 0; i < FAN_COUNT; i++) { + SERIAL_ECHO(int(info.fan_speed[i])); + if (i < FAN_COUNT - 1) SERIAL_CHAR(','); + } + SERIAL_EOL(); + #endif + + #if HAS_LEVELING + SERIAL_ECHOPAIR("leveling: ", int(info.leveling)); + SERIAL_ECHOLNPAIR(" fade: ", int(info.fade)); + #endif + #if ENABLED(FWRETRACT) + SERIAL_ECHOPGM("retract: "); + for (int8_t e = 0; e < EXTRUDERS; e++) { + SERIAL_ECHO(info.retract[e]); + if (e < EXTRUDERS - 1) SERIAL_CHAR(','); + } + SERIAL_EOL(); + SERIAL_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); + } + else + SERIAL_ECHOLNPGM("INVALID DATA"); + } + SERIAL_ECHOLNPGM("---"); + } + +#endif // DEBUG_POWER_LOSS_RECOVERY + #endif // POWER_LOSS_RECOVERY diff --git a/Marlin/src/feature/power_loss_recovery.h b/Marlin/src/feature/power_loss_recovery.h index 24b0891a02..0de0457c00 100644 --- a/Marlin/src/feature/power_loss_recovery.h +++ b/Marlin/src/feature/power_loss_recovery.h @@ -19,16 +19,13 @@ * along with this program. If not, see . * */ +#pragma once /** * power_loss_recovery.h - Resume an SD print after power-loss */ -#ifndef _POWER_LOSS_RECOVERY_H_ -#define _POWER_LOSS_RECOVERY_H_ - #include "../sd/cardreader.h" -#include "../core/types.h" #include "../inc/MarlinConfigPre.h" #define SAVE_INFO_INTERVAL_MS 0 @@ -39,7 +36,9 @@ typedef struct { uint8_t valid_head; // Machine state - float current_position[NUM_AXIS], feedrate; + float current_position[NUM_AXIS]; + + uint16_t feedrate; #if HOTENDS > 1 uint8_t active_hotend; @@ -52,7 +51,7 @@ typedef struct { #endif #if FAN_COUNT - int16_t fanSpeeds[FAN_COUNT]; + uint8_t fan_speed[FAN_COUNT]; #endif #if HAS_LEVELING @@ -76,28 +75,45 @@ typedef struct { millis_t print_job_elapsed; uint8_t valid_foot; + } job_recovery_info_t; -extern job_recovery_info_t job_recovery_info; +class PrintJobRecovery { + public: + static SdFile file; + static job_recovery_info_t info; -enum JobRecoveryPhase : unsigned char { - JOB_RECOVERY_IDLE, - JOB_RECOVERY_MAYBE, - JOB_RECOVERY_YES, - JOB_RECOVERY_DONE + static void init(); + + static bool enabled; + static void enable(const bool onoff); + static void changed(); + + static void check(); + static void resume(); + + static inline bool exists() { return card.jobRecoverFileExists(); } + static inline void open(const bool read) { card.openJobRecoveryFile(read); } + static inline void close() { file.close(); } + + static void purge(); + static void load(); + static void save(const bool force= + #if ENABLED(SAVE_EACH_CMD_MODE) + true + #else + false + #endif + ); + + 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 + + private: + static void write(); }; -extern JobRecoveryPhase job_recovery_phase; -#if HAS_LEVELING - #define APPEND_CMD_COUNT 9 -#else - #define APPEND_CMD_COUNT 7 -#endif - -extern char job_recovery_commands[BUFSIZE + APPEND_CMD_COUNT][MAX_CMD_SIZE]; -extern uint8_t job_recovery_commands_count; - -void check_print_job_recovery(); -void save_job_recovery_info(); - -#endif // _POWER_LOSS_RECOVERY_H_ +extern PrintJobRecovery recovery; diff --git a/Marlin/src/feature/runout.cpp b/Marlin/src/feature/runout.cpp index 00eb97195d..3dcb82673c 100644 --- a/Marlin/src/feature/runout.cpp +++ b/Marlin/src/feature/runout.cpp @@ -30,37 +30,28 @@ #include "runout.h" -FilamentRunoutSensor runout; +FilamentMonitor runout; -bool FilamentRunoutSensor::filament_ran_out; // = false -uint8_t FilamentRunoutSensor::runout_count; // = 0 +bool FilamentMonitorBase::enabled = true, + FilamentMonitorBase::filament_ran_out; // = false -void FilamentRunoutSensor::setup() { - - #if ENABLED(FIL_RUNOUT_PULLUP) - #define INIT_RUNOUT_PIN(P) SET_INPUT_PULLUP(P) - #elif ENABLED(FIL_RUNOUT_PULLDOWN) - #define INIT_RUNOUT_PIN(P) SET_INPUT_PULLDOWN(P) - #else - #define INIT_RUNOUT_PIN(P) SET_INPUT(P) - #endif - - INIT_RUNOUT_PIN(FIL_RUNOUT_PIN); - #if NUM_RUNOUT_SENSORS > 1 - INIT_RUNOUT_PIN(FIL_RUNOUT2_PIN); - #if NUM_RUNOUT_SENSORS > 2 - INIT_RUNOUT_PIN(FIL_RUNOUT3_PIN); - #if NUM_RUNOUT_SENSORS > 3 - INIT_RUNOUT_PIN(FIL_RUNOUT4_PIN); - #if NUM_RUNOUT_SENSORS > 4 - INIT_RUNOUT_PIN(FIL_RUNOUT5_PIN); - #if NUM_RUNOUT_SENSORS > 5 - INIT_RUNOUT_PIN(FIL_RUNOUT6_PIN); - #endif - #endif - #endif - #endif - #endif +/** + * Called by FilamentSensorSwitch::run when filament is detected. + * Called by FilamentSensorEncoder::block_completed when motion is detected. + */ +void FilamentSensorBase::filament_present(const uint8_t extruder) { + runout.filament_present(extruder); // calls response.filament_present(extruder) } +#if ENABLED(FILAMENT_MOTION_SENSOR) + uint8_t FilamentSensorEncoder::motion_detected; +#endif + +#if FILAMENT_RUNOUT_DISTANCE_MM > 0 + float RunoutResponseDelayed::runout_distance_mm = FILAMENT_RUNOUT_DISTANCE_MM; + volatile float RunoutResponseDelayed::runout_mm_countdown[EXTRUDERS]; +#else + int8_t RunoutResponseDebounced::runout_count; // = 0 +#endif + #endif // FILAMENT_RUNOUT_SENSOR diff --git a/Marlin/src/feature/runout.h b/Marlin/src/feature/runout.h index aaabaad6e9..3594c52314 100644 --- a/Marlin/src/feature/runout.h +++ b/Marlin/src/feature/runout.h @@ -19,14 +19,12 @@ * along with this program. If not, see . * */ +#pragma once /** * feature/runout.h - Runout sensor support */ -#ifndef _RUNOUT_H_ -#define _RUNOUT_H_ - #include "../sd/cardreader.h" #include "../module/printcounter.h" #include "../module/stepper.h" @@ -34,64 +32,305 @@ #include "../inc/MarlinConfig.h" -#define FIL_RUNOUT_THRESHOLD 5 +#if ENABLED(EXTENSIBLE_UI) + #include "../lcd/extensible_ui/ui_api.h" +#endif -class FilamentRunoutSensor { +//#define FILAMENT_RUNOUT_SENSOR_DEBUG + +class FilamentMonitorBase { public: - FilamentRunoutSensor() {} + static bool enabled; - static void setup(); + protected: + static bool filament_ran_out; +}; - FORCE_INLINE static void reset() { runout_count = 0; filament_ran_out = false; } +template +class TFilamentMonitor : public FilamentMonitorBase { + private: + typedef RESPONSE_T response_t; + typedef SENSOR_T sensor_t; + static response_t response; + static sensor_t sensor; - FORCE_INLINE static void run() { - if ((IS_SD_PRINTING || print_job_timer.isRunning()) && check() && !filament_ran_out) { - filament_ran_out = true; - enqueue_and_echo_commands_P(PSTR(FILAMENT_RUNOUT_SCRIPT)); - planner.synchronize(); + public: + static inline void setup() { + sensor.setup(); + reset(); + } + + static inline void reset() { + filament_ran_out = false; + response.reset(); + } + + // Call this method when filament is present, + // so the response can reset its counter. + static inline void filament_present(const uint8_t extruder) { + response.filament_present(extruder); + } + + // Handle a block completion. RunoutResponseDelayed uses this to + // add up the length of filament moved while the filament is out. + static inline void block_completed(const block_t* const b) { + if (enabled) { + response.block_completed(b); + sensor.block_completed(b); } } - private: - static bool filament_ran_out; - static uint8_t runout_count; - FORCE_INLINE static bool check() { - #if NUM_RUNOUT_SENSORS < 2 - // A single sensor applying to all extruders - const bool is_out = READ(FIL_RUNOUT_PIN) == FIL_RUNOUT_INVERTING; - #else - // Read the sensor for the active extruder - bool is_out; - #if ENABLED(DUAL_X_CARRIAGE) - const bool out1 = READ(FIL_RUNOUT_PIN ) == FIL_RUNOUT_INVERTING, - out2 = READ(FIL_RUNOUT2_PIN) == FIL_RUNOUT_INVERTING; - if (extruder_duplication_enabled) - is_out = out1 || out2; - else - is_out = active_extruder ? out2 : out1; - #else - switch (active_extruder) { - case 0: is_out = READ(FIL_RUNOUT_PIN) == FIL_RUNOUT_INVERTING; break; - case 1: is_out = READ(FIL_RUNOUT2_PIN) == FIL_RUNOUT_INVERTING; break; - #if NUM_RUNOUT_SENSORS > 2 - case 2: is_out = READ(FIL_RUNOUT3_PIN) == FIL_RUNOUT_INVERTING; break; - #if NUM_RUNOUT_SENSORS > 3 - case 3: is_out = READ(FIL_RUNOUT4_PIN) == FIL_RUNOUT_INVERTING; break; - #if NUM_RUNOUT_SENSORS > 4 - case 4: is_out = READ(FIL_RUNOUT5_PIN) == FIL_RUNOUT_INVERTING; break; - #if NUM_RUNOUT_SENSORS > 5 - case 5: is_out = READ(FIL_RUNOUT6_PIN) == FIL_RUNOUT_INVERTING; break; - #endif // > 5 - #endif // > 4 - #endif // > 3 - #endif // > 2 - } + // Give the response a chance to update its counter. + static inline void run() { + if (enabled && !filament_ran_out && (IS_SD_PRINTING() || print_job_timer.isRunning())) { + #if FILAMENT_RUNOUT_DISTANCE_MM > 0 + cli(); // Prevent RunoutResponseDelayed::block_completed from accumulating here #endif - #endif - return (is_out ? ++runout_count : (runout_count = 0)) > FIL_RUNOUT_THRESHOLD; + response.run(); + sensor.run(); + const bool ran_out = response.has_run_out(); + #if FILAMENT_RUNOUT_DISTANCE_MM > 0 + sei(); + #endif + if (ran_out) { + filament_ran_out = true; + #if ENABLED(EXTENSIBLE_UI) + ExtUI::onFilamentRunout(); + #endif + enqueue_and_echo_commands_P(PSTR(FILAMENT_RUNOUT_SCRIPT)); + planner.synchronize(); + } + } } }; -extern FilamentRunoutSensor runout; +/*************************** FILAMENT PRESENCE SENSORS ***************************/ -#endif // _RUNOUT_H_ +class FilamentSensorBase { + protected: + static void filament_present(const uint8_t extruder); + + public: + static void setup() { + #if ENABLED(FIL_RUNOUT_PULLUP) + #define INIT_RUNOUT_PIN(P) SET_INPUT_PULLUP(P) + #elif ENABLED(FIL_RUNOUT_PULLDOWN) + #define INIT_RUNOUT_PIN(P) SET_INPUT_PULLDOWN(P) + #else + #define INIT_RUNOUT_PIN(P) SET_INPUT(P) + #endif + + INIT_RUNOUT_PIN(FIL_RUNOUT_PIN); + #if NUM_RUNOUT_SENSORS > 1 + INIT_RUNOUT_PIN(FIL_RUNOUT2_PIN); + #if NUM_RUNOUT_SENSORS > 2 + INIT_RUNOUT_PIN(FIL_RUNOUT3_PIN); + #if NUM_RUNOUT_SENSORS > 3 + INIT_RUNOUT_PIN(FIL_RUNOUT4_PIN); + #if NUM_RUNOUT_SENSORS > 4 + INIT_RUNOUT_PIN(FIL_RUNOUT5_PIN); + #if NUM_RUNOUT_SENSORS > 5 + INIT_RUNOUT_PIN(FIL_RUNOUT6_PIN); + #endif + #endif + #endif + #endif + #endif + } + + #if FIL_RUNOUT_INVERTING + #define FIL_RUNOUT_INVERT_MASK (_BV(NUM_RUNOUT_SENSORS) - 1) + #else + #define FIL_RUNOUT_INVERT_MASK 0 + #endif + + // Return a bitmask of all runout sensor states + static uint8_t poll_runout_pins() { + return ( + (READ(FIL_RUNOUT_PIN ) ? _BV(0) : 0) + #if NUM_RUNOUT_SENSORS > 1 + | (READ(FIL_RUNOUT2_PIN) ? _BV(1) : 0) + #if NUM_RUNOUT_SENSORS > 2 + | (READ(FIL_RUNOUT3_PIN) ? _BV(2) : 0) + #if NUM_RUNOUT_SENSORS > 3 + | (READ(FIL_RUNOUT4_PIN) ? _BV(3) : 0) + #if NUM_RUNOUT_SENSORS > 4 + | (READ(FIL_RUNOUT5_PIN) ? _BV(4) : 0) + #if NUM_RUNOUT_SENSORS > 5 + | (READ(FIL_RUNOUT6_PIN) ? _BV(5) : 0) + #endif + #endif + #endif + #endif + #endif + ) ^ FIL_RUNOUT_INVERT_MASK; + } +}; + +#if ENABLED(FILAMENT_MOTION_SENSOR) + + /** + * This sensor uses a magnetic encoder disc and a Hall effect + * sensor (or a slotted disc and optical sensor). The state + * will toggle between 0 and 1 on filament movement. It can detect + * filament runout and stripouts or jams. + */ + class FilamentSensorEncoder : public FilamentSensorBase { + private: + static uint8_t motion_detected; + + static inline void poll_motion_sensor() { + static uint8_t old_state; + const uint8_t new_state = poll_runout_pins(), + change = old_state ^ new_state; + old_state = new_state; + + #ifdef FILAMENT_RUNOUT_SENSOR_DEBUG + if (change) SERIAL_PROTOCOLLNPAIR("Motion detected: ", int(change)); + #endif + + motion_detected |= change; + } + + public: + static inline void block_completed(const block_t* const b) { + // If the sensor wheel has moved since the last call to + // this method reset the runout counter for the extruder. + if (TEST(motion_detected, b->extruder)) + filament_present(b->extruder); + + // Clear motion triggers for next block + motion_detected = 0; + } + + static inline void run() { poll_motion_sensor(); } + }; + +#else + + /** + * This is a simple endstop switch in the path of the filament. + * It can detect filament runout, but not stripouts or jams. + */ + class FilamentSensorSwitch : public FilamentSensorBase { + private: + static bool poll_runout_pin(const uint8_t extruder) { + const uint8_t runout_bits = poll_runout_pins(); + #if NUM_RUNOUT_SENSORS == 1 + return runout_bits; // A single sensor applying to all extruders + #else + #if ENABLED(DUAL_X_CARRIAGE) + if (dual_x_carriage_mode == DXC_DUPLICATION_MODE || dual_x_carriage_mode == DXC_SCALED_DUPLICATION_MODE) + return runout_bits; // Any extruder + else + #elif ENABLED(DUAL_NOZZLE_DUPLICATION_MODE) + if (extruder_duplication_enabled) + return runout_bits; // Any extruder + else + #endif + return TEST(runout_bits, extruder); // Specific extruder + #endif + } + + public: + static inline void block_completed(const block_t* const b) {} + + static inline void run() { + const bool out = poll_runout_pin(active_extruder); + if (!out) filament_present(active_extruder); + #ifdef FILAMENT_RUNOUT_SENSOR_DEBUG + static bool was_out = false; + if (out != was_out) { + was_out = out; + SERIAL_PROTOCOL("Filament "); + serialprintPGM(out ? PSTR("OUT\n") : PSTR("IN\n")); + } + #endif + } + }; + + +#endif // !FILAMENT_MOTION_SENSOR + +/********************************* RESPONSE TYPE *********************************/ + +#if FILAMENT_RUNOUT_DISTANCE_MM > 0 + + // RunoutResponseDelayed triggers a runout event only if the length + // of filament specified by FILAMENT_RUNOUT_DISTANCE_MM has been fed + // during a runout condition. + class RunoutResponseDelayed { + private: + static volatile float runout_mm_countdown[EXTRUDERS]; + + public: + static float runout_distance_mm; + + static void reset() { + LOOP_L_N(i, EXTRUDERS) filament_present(i); + } + + static inline void run() { + #ifdef FILAMENT_RUNOUT_SENSOR_DEBUG + static millis_t t = 0; + const millis_t ms = millis(); + if (ELAPSED(ms, t)) { + t = millis() + 1000UL; + LOOP_L_N(i, EXTRUDERS) { + serialprintPGM(i ? PSTR(", ") : PSTR("Remaining mm: ")); + SERIAL_PROTOCOL(runout_mm_countdown[i]); + } + SERIAL_EOL(); + } + #endif + } + + static inline bool has_run_out() { + return runout_mm_countdown[active_extruder] < 0; + } + + static inline void filament_present(const uint8_t extruder) { + runout_mm_countdown[extruder] = runout_distance_mm; + } + + static inline void block_completed(const block_t* const b) { + const uint8_t e = b->extruder; + const int32_t steps = b->steps[E_AXIS]; + runout_mm_countdown[e] -= (TEST(b->direction_bits, E_AXIS) ? -steps : steps) * planner.steps_to_mm[E_AXIS_N(e)]; + } + }; + +#else // !FILAMENT_RUNOUT_DISTANCE_MM + + // RunoutResponseDebounced triggers a runout event after a runout + // condition has been detected runout_threshold times in a row. + + class RunoutResponseDebounced { + private: + static constexpr int8_t runout_threshold = 5; + static int8_t runout_count; + public: + static inline void reset() { runout_count = runout_threshold; } + static inline void run() { runout_count--; } + static inline bool has_run_out() { return runout_count < 0; } + static inline void block_completed(const block_t* const b) {} + static inline void filament_present(const uint8_t extruder) { runout_count = runout_threshold; UNUSED(extruder); } + }; + +#endif // !FILAMENT_RUNOUT_DISTANCE_MM + +/********************************* TEMPLATE SPECIALIZATION *********************************/ + +typedef TFilamentMonitor< + #if FILAMENT_RUNOUT_DISTANCE_MM > 0 + #if ENABLED(FILAMENT_MOTION_SENSOR) + RunoutResponseDelayed, FilamentSensorEncoder + #else + RunoutResponseDelayed, FilamentSensorSwitch + #endif + #else + RunoutResponseDebounced, FilamentSensorSwitch + #endif +> FilamentMonitor; + +extern FilamentMonitor runout; diff --git a/Marlin/src/feature/snmm.h b/Marlin/src/feature/snmm.h index b15f9147a6..ad8782d16a 100644 --- a/Marlin/src/feature/snmm.h +++ b/Marlin/src/feature/snmm.h @@ -19,10 +19,6 @@ * along with this program. If not, see . * */ - -#ifndef __SNMM_H__ -#define __SNMM_H__ +#pragma once void select_multiplexed_stepper(const uint8_t e); - -#endif // __SNMM_H__ diff --git a/Marlin/src/feature/solenoid.cpp b/Marlin/src/feature/solenoid.cpp index b0efa88270..33b442ccc5 100644 --- a/Marlin/src/feature/solenoid.cpp +++ b/Marlin/src/feature/solenoid.cpp @@ -22,13 +22,13 @@ #include "../inc/MarlinConfig.h" -#if ENABLED(EXT_SOLENOID) +#if ENABLED(EXT_SOLENOID) || ENABLED(MANUAL_SOLENOID_CONTROL) #include "solenoid.h" #include "../module/motion.h" // for active_extruder -inline void enable_solenoid(const uint8_t num) { +void enable_solenoid(const uint8_t num) { switch (num) { case 0: OUT_WRITE(SOL0_PIN, HIGH); diff --git a/Marlin/src/feature/solenoid.h b/Marlin/src/feature/solenoid.h index 5959b99a4e..6652b19daa 100644 --- a/Marlin/src/feature/solenoid.h +++ b/Marlin/src/feature/solenoid.h @@ -19,11 +19,8 @@ * along with this program. If not, see . * */ - -#ifndef __SOLENOID_H__ -#define __SOLENOID_H__ +#pragma once void enable_solenoid_on_active_extruder(); void disable_all_solenoids(); - -#endif // __SOLENOID_H__ +void enable_solenoid(const uint8_t num); diff --git a/Marlin/src/feature/tmc_util.cpp b/Marlin/src/feature/tmc_util.cpp index abfe4ba035..07128df4fc 100644 --- a/Marlin/src/feature/tmc_util.cpp +++ b/Marlin/src/feature/tmc_util.cpp @@ -34,10 +34,9 @@ #if ENABLED(TMC_DEBUG) #include "../module/planner.h" + static bool report_tmc_status; // = false; #endif -bool report_tmc_status = false; - /** * Check for over temperature or short to ground error flags. * Report and log warning of overtemperature condition. @@ -46,6 +45,7 @@ bool report_tmc_status = false; * and so we don't repeatedly report warning before the condition is cleared. */ #if ENABLED(MONITOR_DRIVER_STATUS) + struct TMC_driver_data { uint32_t drv_status; bool is_otpw; @@ -53,8 +53,10 @@ bool report_tmc_status = false; bool is_error; }; #if HAS_DRIVER(TMC2130) - static uint32_t get_pwm_scale(TMC2130Stepper &st) { return st.PWM_SCALE(); } - static uint8_t get_status_response(TMC2130Stepper &st) { return st.status_response & 0xF; } + #if ENABLED(TMC_DEBUG) + static uint32_t get_pwm_scale(TMC2130Stepper &st) { return st.PWM_SCALE(); } + static uint8_t get_status_response(TMC2130Stepper &st) { return st.status_response & 0xF; } + #endif static TMC_driver_data get_driver_data(TMC2130Stepper &st) { constexpr uint32_t OTPW_bm = 0x4000000UL; constexpr uint8_t OTPW_bp = 26; @@ -71,15 +73,17 @@ bool report_tmc_status = false; } #endif #if HAS_DRIVER(TMC2208) - static uint32_t get_pwm_scale(TMC2208Stepper &st) { return st.pwm_scale_sum(); } - static uint8_t get_status_response(TMC2208Stepper &st) { - uint32_t drv_status = st.DRV_STATUS(); - uint8_t gstat = st.GSTAT(); - uint8_t response = 0; - response |= (drv_status >> (31-3)) & 0b1000; - response |= gstat & 0b11; - return response; - } + #if ENABLED(TMC_DEBUG) + static uint32_t get_pwm_scale(TMC2208Stepper &st) { return st.pwm_scale_sum(); } + static uint8_t get_status_response(TMC2208Stepper &st) { + uint32_t drv_status = st.DRV_STATUS(); + uint8_t gstat = st.GSTAT(); + uint8_t response = 0; + response |= (drv_status >> (31-3)) & 0b1000; + response |= gstat & 0b11; + return response; + } + #endif static TMC_driver_data get_driver_data(TMC2208Stepper &st) { constexpr uint32_t OTPW_bm = 0b1ul; constexpr uint8_t OTPW_bp = 0; @@ -93,15 +97,34 @@ bool report_tmc_status = false; return data; } #endif + #if HAS_DRIVER(TMC2660) + #if ENABLED(TMC_DEBUG) + static uint32_t get_pwm_scale(TMC2660Stepper) { return 0; } + static uint8_t get_status_response(TMC2660Stepper) { return 0; } + #endif + static TMC_driver_data get_driver_data(TMC2660Stepper &st) { + constexpr uint32_t OTPW_bm = 0x4UL; + constexpr uint8_t OTPW_bp = 2; + constexpr uint32_t OT_bm = 0x2UL; + constexpr uint8_t OT_bp = 1; + constexpr uint8_t DRIVER_ERROR_bm = 0x6; + TMC_driver_data data; + data.drv_status = st.DRVSTATUS(); + data.is_otpw = (data.drv_status & OTPW_bm) >> OTPW_bp; + data.is_ot = (data.drv_status & OT_bm) >> OT_bp; + data.is_error = data.drv_status & DRIVER_ERROR_bm; + return data; + } + #endif template - void monitor_tmc_driver(TMC &st, const TMC_AxisEnum axis, uint8_t &otpw_cnt) { + void monitor_tmc_driver(TMC &st) { TMC_driver_data data = get_driver_data(st); #if ENABLED(STOP_ON_ERROR) if (data.is_error) { SERIAL_EOL(); - _tmc_say_axis(axis); + st.printLabel(); SERIAL_ECHOLNPGM(" driver error detected:"); if (data.is_ot) SERIAL_ECHOLNPGM("overtemperature"); if (st.s2ga()) SERIAL_ECHOLNPGM("short to ground (coil A)"); @@ -114,212 +137,119 @@ bool report_tmc_status = false; #endif // Report if a warning was triggered - if (data.is_otpw && otpw_cnt == 0) { - char timestamp[10]; + if (data.is_otpw && st.otpw_count == 0) { + char timestamp[14]; duration_t elapsed = print_job_timer.duration(); const bool has_days = (elapsed.value > 60*60*24L); (void)elapsed.toDigital(timestamp, has_days); SERIAL_EOL(); SERIAL_ECHO(timestamp); SERIAL_ECHOPGM(": "); - _tmc_say_axis(axis); + st.printLabel(); SERIAL_ECHOPGM(" driver overtemperature warning! ("); - SERIAL_ECHO(st.getCurrent()); + SERIAL_ECHO(st.getMilliamps()); SERIAL_ECHOLNPGM("mA)"); } #if CURRENT_STEP_DOWN > 0 // Decrease current if is_otpw is true and driver is enabled and there's been more than 4 warnings - if (data.is_otpw && st.isEnabled() && otpw_cnt > 4) { - st.setCurrent(st.getCurrent() - (CURRENT_STEP_DOWN), R_SENSE, HOLD_MULTIPLIER); + if (data.is_otpw && st.isEnabled() && st.otpw_count > 4) { + st.rms_current(MAX(int16_t(st.getMilliamps() - (CURRENT_STEP_DOWN)), 0)); #if ENABLED(REPORT_CURRENT_CHANGE) - _tmc_say_axis(axis); - SERIAL_ECHOLNPAIR(" current decreased to ", st.getCurrent()); + st.printLabel(); + SERIAL_ECHOLNPAIR(" current decreased to ", st.getMilliamps()); #endif } #endif if (data.is_otpw) { - otpw_cnt++; + st.otpw_count++; st.flag_otpw = true; } - else if (otpw_cnt > 0) otpw_cnt = 0; + else if (st.otpw_count > 0) st.otpw_count = 0; - if (report_tmc_status) { - const uint32_t pwm_scale = get_pwm_scale(st); - _tmc_say_axis(axis); - SERIAL_ECHOPAIR(":", pwm_scale); - SERIAL_ECHOPGM(" |0b"); SERIAL_PRINT(get_status_response(st), BIN); - SERIAL_ECHOPGM("| "); - if (data.is_error) SERIAL_CHAR('E'); - else if (data.is_ot) SERIAL_CHAR('O'); - else if (data.is_otpw) SERIAL_CHAR('W'); - else if (otpw_cnt > 0) SERIAL_PRINT(otpw_cnt, DEC); - else if (st.flag_otpw) SERIAL_CHAR('F'); - SERIAL_CHAR('\t'); - } + #if ENABLED(TMC_DEBUG) + if (report_tmc_status) { + const uint32_t pwm_scale = get_pwm_scale(st); + st.printLabel(); + SERIAL_ECHOPAIR(":", pwm_scale); + SERIAL_ECHOPGM(" |0b"); SERIAL_PRINT(get_status_response(st), BIN); + SERIAL_ECHOPGM("| "); + if (data.is_error) SERIAL_CHAR('E'); + else if (data.is_ot) SERIAL_CHAR('O'); + else if (data.is_otpw) SERIAL_CHAR('W'); + else if (st.otpw_count > 0) SERIAL_PRINT(st.otpw_count, DEC); + else if (st.flag_otpw) SERIAL_CHAR('F'); + SERIAL_CHAR('\t'); + } + #endif } - #define HAS_HW_COMMS(ST) AXIS_DRIVER_TYPE(ST, TMC2130) || (AXIS_DRIVER_TYPE(ST, TMC2208) && defined(ST##_HARDWARE_SERIAL)) + #define HAS_HW_COMMS(ST) AXIS_DRIVER_TYPE(ST, TMC2130) || AXIS_DRIVER_TYPE(ST, TMC2660) || (AXIS_DRIVER_TYPE(ST, TMC2208) && defined(ST##_HARDWARE_SERIAL)) void monitor_tmc_driver() { static millis_t next_cOT = 0; if (ELAPSED(millis(), next_cOT)) { next_cOT = millis() + 500; #if HAS_HW_COMMS(X) - static uint8_t x_otpw_cnt = 0; - monitor_tmc_driver(stepperX, TMC_X, x_otpw_cnt); + monitor_tmc_driver(stepperX); #endif #if HAS_HW_COMMS(Y) - static uint8_t y_otpw_cnt = 0; - monitor_tmc_driver(stepperY, TMC_Y, y_otpw_cnt); + monitor_tmc_driver(stepperY); #endif #if HAS_HW_COMMS(Z) - static uint8_t z_otpw_cnt = 0; - monitor_tmc_driver(stepperZ, TMC_Z, z_otpw_cnt); + monitor_tmc_driver(stepperZ); #endif #if HAS_HW_COMMS(X2) - static uint8_t x2_otpw_cnt = 0; - monitor_tmc_driver(stepperX2, TMC_X, x2_otpw_cnt); + monitor_tmc_driver(stepperX2); #endif #if HAS_HW_COMMS(Y2) - static uint8_t y2_otpw_cnt = 0; - monitor_tmc_driver(stepperY2, TMC_Y, y2_otpw_cnt); + monitor_tmc_driver(stepperY2); #endif #if HAS_HW_COMMS(Z2) - static uint8_t z2_otpw_cnt = 0; - monitor_tmc_driver(stepperZ2, TMC_Z, z2_otpw_cnt); + monitor_tmc_driver(stepperZ2); #endif #if HAS_HW_COMMS(Z3) - static uint8_t z3_otpw_cnt = 0; - monitor_tmc_driver(stepperZ3, TMC_Z, z3_otpw_cnt); + monitor_tmc_driver(stepperZ3); #endif #if HAS_HW_COMMS(E0) - static uint8_t e0_otpw_cnt = 0; - monitor_tmc_driver(stepperE0, TMC_E0, e0_otpw_cnt); + monitor_tmc_driver(stepperE0); #endif #if HAS_HW_COMMS(E1) - static uint8_t e1_otpw_cnt = 0; - monitor_tmc_driver(stepperE1, TMC_E1, e1_otpw_cnt); + monitor_tmc_driver(stepperE1); #endif #if HAS_HW_COMMS(E2) - static uint8_t e2_otpw_cnt = 0; - monitor_tmc_driver(stepperE2, TMC_E2, e2_otpw_cnt); + monitor_tmc_driver(stepperE2); #endif #if HAS_HW_COMMS(E3) - static uint8_t e3_otpw_cnt = 0; - monitor_tmc_driver(stepperE3, TMC_E3, e3_otpw_cnt); + monitor_tmc_driver(stepperE3); #endif #if HAS_HW_COMMS(E4) - static uint8_t e4_otpw_cnt = 0; - monitor_tmc_driver(stepperE4, TMC_E4, e4_otpw_cnt); + monitor_tmc_driver(stepperE4); #endif #if HAS_HW_COMMS(E5) - static uint8_t e5_otpw_cnt = 0; - monitor_tmc_driver(stepperE5, TMC_E5, e5_otpw_cnt); + monitor_tmc_driver(stepperE5); #endif - if (report_tmc_status) SERIAL_EOL(); + #if ENABLED(TMC_DEBUG) + if (report_tmc_status) SERIAL_EOL(); + #endif } } #endif // MONITOR_DRIVER_STATUS -void _tmc_say_axis(const TMC_AxisEnum axis) { - static const char ext_X[] PROGMEM = "X", ext_Y[] PROGMEM = "Y", ext_Z[] PROGMEM = "Z" - #if ENABLED(DUAL_X_CARRIAGE) || ENABLED(X_DUAL_STEPPER_DRIVERS) - , ext_X2[] PROGMEM = "X2" - #endif - #if ENABLED(Y_DUAL_STEPPER_DRIVERS) - , ext_Y2[] PROGMEM = "Y2" - #endif - #if Z_MULTI_STEPPER_DRIVERS - , ext_Z2[] PROGMEM = "Z2" - #if ENABLED(Z_TRIPLE_STEPPER_DRIVERS) - , ext_Z3[] PROGMEM = "Z3" - #endif - #endif - #if E_STEPPERS - , ext_E0[] PROGMEM = "E0" - #if E_STEPPERS > 1 - , ext_E1[] PROGMEM = "E1" - #if E_STEPPERS > 2 - , ext_E2[] PROGMEM = "E2" - #if E_STEPPERS > 3 - , ext_E3[] PROGMEM = "E3" - #if E_STEPPERS > 4 - , ext_E4[] PROGMEM = "E4" - #if E_STEPPERS > 5 - , ext_E5[] PROGMEM = "E5" - #endif - #endif - #endif - #endif - #endif - #endif - ; - - static const char* const tmc_axes[] PROGMEM = { - ext_X, ext_Y, ext_Z - #if ENABLED(DUAL_X_CARRIAGE) || ENABLED(X_DUAL_STEPPER_DRIVERS) - , ext_X2 - #endif - #if ENABLED(Y_DUAL_STEPPER_DRIVERS) - , ext_Y2 - #endif - #if Z_MULTI_STEPPER_DRIVERS - , ext_Z2 - #if ENABLED(Z_TRIPLE_STEPPER_DRIVERS) - , ext_Z3 - #endif - #endif - #if E_STEPPERS - , ext_E0 - #if E_STEPPERS > 1 - , ext_E1 - #if E_STEPPERS > 2 - , ext_E2 - #if E_STEPPERS > 3 - , ext_E3 - #if E_STEPPERS > 4 - , ext_E4 - #if E_STEPPERS > 5 - , ext_E5 - #endif - #endif - #endif - #endif - #endif - #endif - }; - serialprintPGM((char*)pgm_read_ptr(&tmc_axes[axis])); -} - -void _tmc_say_current(const TMC_AxisEnum axis, const uint16_t curr) { - _tmc_say_axis(axis); - SERIAL_ECHOLNPAIR(" driver current: ", curr); -} -void _tmc_say_otpw(const TMC_AxisEnum axis, const bool otpw) { - _tmc_say_axis(axis); - SERIAL_ECHOPGM(" temperature prewarn triggered: "); - serialprintPGM(otpw ? PSTR("true") : PSTR("false")); - SERIAL_EOL(); -} -void _tmc_say_otpw_cleared(const TMC_AxisEnum axis) { - _tmc_say_axis(axis); - SERIAL_ECHOLNPGM(" prewarn flag cleared"); -} -void _tmc_say_pwmthrs(const TMC_AxisEnum axis, const uint32_t thrs) { - _tmc_say_axis(axis); - SERIAL_ECHOLNPAIR(" stealthChop max speed: ", thrs); -} -void _tmc_say_sgt(const TMC_AxisEnum axis, const int8_t sgt) { - _tmc_say_axis(axis); - SERIAL_ECHOPGM(" homing sensitivity: "); - SERIAL_PRINTLN(sgt, DEC); -} - #if ENABLED(TMC_DEBUG) + /** + * M122 S[1,0] Enable periodic status reports + */ + #if ENABLED(MONITOR_DRIVER_STATUS) + void tmc_set_report_status(const bool status) { + if ((report_tmc_status = status)) + SERIAL_ECHOLNPGM("axis:pwm_scale |status_response|"); + } + #endif + enum TMC_debug_enum : char { TMC_CODES, TMC_ENABLED, @@ -366,9 +296,7 @@ void _tmc_say_sgt(const TMC_AxisEnum axis, const int8_t sgt) { TMC_S2VSB, TMC_S2VSA }; - static void drv_status_print_hex(const TMC_AxisEnum axis, const uint32_t drv_status) { - _tmc_say_axis(axis); - SERIAL_ECHOPGM(" = 0x"); + static void drv_status_print_hex(const uint32_t drv_status) { for (int B = 24; B >= 8; B -= 8){ SERIAL_PRINT((drv_status >> (B + 4)) & 0xF, HEX); SERIAL_PRINT((drv_status >> B) & 0xF, HEX); @@ -379,21 +307,24 @@ void _tmc_say_sgt(const TMC_AxisEnum axis, const int8_t sgt) { SERIAL_EOL(); } + template + static void print_vsense(TMC &st) { serialprintPGM(st.vsense() ? PSTR("1=.18") : PSTR("0=.325")); } + #if HAS_DRIVER(TMC2130) static void tmc_status(TMC2130Stepper &st, const TMC_debug_enum i) { switch (i) { case TMC_PWM_SCALE: SERIAL_PRINT(st.PWM_SCALE(), DEC); break; - case TMC_TSTEP: SERIAL_ECHO(st.TSTEP()); break; case TMC_SGT: SERIAL_PRINT(st.sgt(), DEC); break; - case TMC_STEALTHCHOP: serialprintPGM(st.stealthChop() ? PSTR("true") : PSTR("false")); break; + case TMC_STEALTHCHOP: serialprintPGM(st.en_pwm_mode() ? PSTR("true") : PSTR("false")); break; default: break; } } - static void tmc_parse_drv_status(TMC2130Stepper &st, const TMC_drv_status_enum i) { + static void _tmc_parse_drv_status(TMC2130Stepper &st, const TMC_drv_status_enum i) { switch (i) { case TMC_STALLGUARD: if (st.stallguard()) SERIAL_CHAR('X'); break; case TMC_SG_RESULT: SERIAL_PRINT(st.sg_result(), DEC); break; case TMC_FSACTIVE: if (st.fsactive()) SERIAL_CHAR('X'); break; + case TMC_DRV_CS_ACTUAL: SERIAL_PRINT(st.cs_actual(), DEC); break; default: break; } } @@ -402,7 +333,6 @@ void _tmc_say_sgt(const TMC_AxisEnum axis, const int8_t sgt) { #if HAS_DRIVER(TMC2208) static void tmc_status(TMC2208Stepper &st, const TMC_debug_enum i) { switch (i) { - case TMC_TSTEP: { uint32_t data = 0; st.TSTEP(&data); SERIAL_PROTOCOL(data); break; } 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_S2VSA: if (st.s2vsa()) SERIAL_CHAR('X'); break; @@ -410,24 +340,29 @@ void _tmc_say_sgt(const TMC_AxisEnum axis, const int8_t sgt) { default: break; } } - static void tmc_parse_drv_status(TMC2208Stepper &st, const TMC_drv_status_enum i) { + static void _tmc_parse_drv_status(TMC2208Stepper &st, const TMC_drv_status_enum i) { switch (i) { case TMC_T157: if (st.t157()) SERIAL_CHAR('X'); break; case TMC_T150: if (st.t150()) SERIAL_CHAR('X'); break; case TMC_T143: if (st.t143()) SERIAL_CHAR('X'); break; case TMC_T120: if (st.t120()) SERIAL_CHAR('X'); break; + case TMC_DRV_CS_ACTUAL: SERIAL_PRINT(st.cs_actual(), DEC); break; default: break; } } #endif + #if HAS_DRIVER(TMC2660) + static void _tmc_parse_drv_status(TMC2660Stepper, const TMC_drv_status_enum) { } + #endif + template - static void tmc_status(TMC &st, const TMC_AxisEnum axis, const TMC_debug_enum i, const float spmm) { + static void tmc_status(TMC &st, const TMC_debug_enum i, const float spmm) { SERIAL_ECHO('\t'); switch (i) { - case TMC_CODES: _tmc_say_axis(axis); break; + case TMC_CODES: st.printLabel(); break; case TMC_ENABLED: serialprintPGM(st.isEnabled() ? PSTR("true") : PSTR("false")); break; - case TMC_CURRENT: SERIAL_ECHO(st.getCurrent()); break; + case TMC_CURRENT: SERIAL_ECHO(st.getMilliamps()); break; case TMC_RMS_CURRENT: SERIAL_PROTOCOL(st.rms_current()); break; case TMC_MAX_CURRENT: SERIAL_PRINT((float)st.rms_current() * 1.41, 0); break; case TMC_IRUN: @@ -442,10 +377,9 @@ void _tmc_say_sgt(const TMC_AxisEnum axis, const int8_t sgt) { SERIAL_PRINT(st.cs_actual(), DEC); SERIAL_ECHOPGM("/31"); break; - - case TMC_VSENSE: serialprintPGM(st.vsense() ? PSTR("1=.18") : PSTR("0=.325")); break; - + case TMC_VSENSE: print_vsense(st); break; case TMC_MICROSTEPS: SERIAL_ECHO(st.microsteps()); break; + case TMC_TSTEP: SERIAL_ECHO(st.TSTEP()); break; case TMC_TPWMTHRS: { uint32_t tpwmthrs_val = st.TPWMTHRS(); SERIAL_ECHO(tpwmthrs_val); @@ -460,7 +394,9 @@ void _tmc_say_sgt(const TMC_AxisEnum axis, const int8_t sgt) { } break; case TMC_OTPW: serialprintPGM(st.otpw() ? PSTR("true") : PSTR("false")); break; - case TMC_OTPW_TRIGGERED: serialprintPGM(st.getOTPW() ? PSTR("true") : PSTR("false")); break; + #if ENABLED(MONITOR_DRIVER_STATUS) + case TMC_OTPW_TRIGGERED: serialprintPGM(st.getOTPW() ? PSTR("true") : PSTR("false")); break; + #endif case TMC_TOFF: SERIAL_PRINT(st.toff(), DEC); break; case TMC_TBL: SERIAL_PRINT(st.blank_time(), DEC); break; case TMC_HEND: SERIAL_PRINT(st.hysteresis_end(), DEC); break; @@ -469,11 +405,39 @@ void _tmc_say_sgt(const TMC_AxisEnum axis, const int8_t sgt) { } } + #if HAS_DRIVER(TMC2660) + template + void tmc_status(TMCMarlin &st, const TMC_debug_enum i, const float) { + SERIAL_ECHO('\t'); + switch (i) { + case TMC_CODES: st.printLabel(); break; + case TMC_ENABLED: serialprintPGM(st.isEnabled() ? PSTR("true") : PSTR("false")); break; + case TMC_CURRENT: SERIAL_ECHO(st.getMilliamps()); break; + case TMC_RMS_CURRENT: SERIAL_PROTOCOL(st.rms_current()); break; + case TMC_MAX_CURRENT: SERIAL_PRINT((float)st.rms_current() * 1.41, 0); break; + case TMC_IRUN: + SERIAL_PRINT(st.cs(), DEC); + SERIAL_ECHOPGM("/31"); + 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_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; + case TMC_HEND: SERIAL_PRINT(st.hysteresis_end(), DEC); break; + case TMC_HSTRT: SERIAL_PRINT(st.hysteresis_start(), DEC); break; + default: break; + } + } + #endif + template - static void tmc_parse_drv_status(TMC &st, const TMC_AxisEnum axis, const TMC_drv_status_enum i) { + static void tmc_parse_drv_status(TMC &st, const TMC_drv_status_enum i) { SERIAL_CHAR('\t'); switch (i) { - case TMC_DRV_CODES: _tmc_say_axis(axis); break; + case TMC_DRV_CODES: st.printLabel(); break; case TMC_STST: if (st.stst()) SERIAL_CHAR('X'); break; case TMC_OLB: if (st.olb()) SERIAL_CHAR('X'); break; case TMC_OLA: if (st.ola()) SERIAL_CHAR('X'); break; @@ -481,70 +445,73 @@ void _tmc_say_sgt(const TMC_AxisEnum axis, const int8_t sgt) { case TMC_S2GA: if (st.s2ga()) SERIAL_CHAR('X'); break; case TMC_DRV_OTPW: if (st.otpw()) SERIAL_CHAR('X'); break; case TMC_OT: if (st.ot()) SERIAL_CHAR('X'); break; - case TMC_DRV_CS_ACTUAL: SERIAL_PRINT(st.cs_actual(), DEC); break; - case TMC_DRV_STATUS_HEX:drv_status_print_hex(axis, st.DRV_STATUS()); break; - default: tmc_parse_drv_status(st, i); break; + case TMC_DRV_STATUS_HEX: + st.printLabel(); + SERIAL_ECHOPGM("\t0x"); + drv_status_print_hex(st.DRV_STATUS()); + break; + default: _tmc_parse_drv_status(st, i); break; } } static void tmc_debug_loop(const TMC_debug_enum i) { #if AXIS_IS_TMC(X) - tmc_status(stepperX, TMC_X, i, planner.axis_steps_per_mm[X_AXIS]); + tmc_status(stepperX, i, planner.settings.axis_steps_per_mm[X_AXIS]); #endif #if AXIS_IS_TMC(X2) - tmc_status(stepperX2, TMC_X2, i, planner.axis_steps_per_mm[X_AXIS]); + tmc_status(stepperX2, i, planner.settings.axis_steps_per_mm[X_AXIS]); #endif #if AXIS_IS_TMC(Y) - tmc_status(stepperY, TMC_Y, i, planner.axis_steps_per_mm[Y_AXIS]); + tmc_status(stepperY, i, planner.settings.axis_steps_per_mm[Y_AXIS]); #endif #if AXIS_IS_TMC(Y2) - tmc_status(stepperY2, TMC_Y2, i, planner.axis_steps_per_mm[Y_AXIS]); + tmc_status(stepperY2, i, planner.settings.axis_steps_per_mm[Y_AXIS]); #endif #if AXIS_IS_TMC(Z) - tmc_status(stepperZ, TMC_Z, i, planner.axis_steps_per_mm[Z_AXIS]); + tmc_status(stepperZ, i, planner.settings.axis_steps_per_mm[Z_AXIS]); #endif #if AXIS_IS_TMC(Z2) - tmc_status(stepperZ2, TMC_Z2, i, planner.axis_steps_per_mm[Z_AXIS]); + tmc_status(stepperZ2, i, planner.settings.axis_steps_per_mm[Z_AXIS]); #endif #if AXIS_IS_TMC(Z3) - tmc_status(stepperZ3, TMC_Z3, i, planner.axis_steps_per_mm[Z_AXIS]); + tmc_status(stepperZ3, i, planner.settings.axis_steps_per_mm[Z_AXIS]); #endif #if AXIS_IS_TMC(E0) - tmc_status(stepperE0, TMC_E0, i, planner.axis_steps_per_mm[E_AXIS]); + tmc_status(stepperE0, i, planner.settings.axis_steps_per_mm[E_AXIS]); #endif #if AXIS_IS_TMC(E1) - tmc_status(stepperE1, TMC_E1, i, planner.axis_steps_per_mm[E_AXIS + tmc_status(stepperE1, i, planner.settings.axis_steps_per_mm[E_AXIS #if ENABLED(DISTINCT_E_FACTORS) + 1 #endif ]); #endif #if AXIS_IS_TMC(E2) - tmc_status(stepperE2, TMC_E2, i, planner.axis_steps_per_mm[E_AXIS + tmc_status(stepperE2, i, planner.settings.axis_steps_per_mm[E_AXIS #if ENABLED(DISTINCT_E_FACTORS) + 2 #endif ]); #endif #if AXIS_IS_TMC(E3) - tmc_status(stepperE3, TMC_E3, i, planner.axis_steps_per_mm[E_AXIS + tmc_status(stepperE3, i, planner.settings.axis_steps_per_mm[E_AXIS #if ENABLED(DISTINCT_E_FACTORS) + 3 #endif ]); #endif #if AXIS_IS_TMC(E4) - tmc_status(stepperE4, TMC_E4, i, planner.axis_steps_per_mm[E_AXIS + tmc_status(stepperE4, i, planner.settings.axis_steps_per_mm[E_AXIS #if ENABLED(DISTINCT_E_FACTORS) + 4 #endif ]); #endif #if AXIS_IS_TMC(E5) - tmc_status(stepperE5, TMC_E5, i, planner.axis_steps_per_mm[E_AXIS + tmc_status(stepperE5, i, planner.settings.axis_steps_per_mm[E_AXIS #if ENABLED(DISTINCT_E_FACTORS) + 5 #endif @@ -556,46 +523,46 @@ void _tmc_say_sgt(const TMC_AxisEnum axis, const int8_t sgt) { static void drv_status_loop(const TMC_drv_status_enum i) { #if AXIS_IS_TMC(X) - tmc_parse_drv_status(stepperX, TMC_X, i); + tmc_parse_drv_status(stepperX, i); #endif #if AXIS_IS_TMC(X2) - tmc_parse_drv_status(stepperX2, TMC_X2, i); + tmc_parse_drv_status(stepperX2, i); #endif #if AXIS_IS_TMC(Y) - tmc_parse_drv_status(stepperY, TMC_Y, i); + tmc_parse_drv_status(stepperY, i); #endif #if AXIS_IS_TMC(Y2) - tmc_parse_drv_status(stepperY2, TMC_Y2, i); + tmc_parse_drv_status(stepperY2, i); #endif #if AXIS_IS_TMC(Z) - tmc_parse_drv_status(stepperZ, TMC_Z, i); + tmc_parse_drv_status(stepperZ, i); #endif #if AXIS_IS_TMC(Z2) - tmc_parse_drv_status(stepperZ2, TMC_Z2, i); + tmc_parse_drv_status(stepperZ2, i); #endif #if AXIS_IS_TMC(Z3) - tmc_parse_drv_status(stepperZ3, TMC_Z3, i); + tmc_parse_drv_status(stepperZ3, i); #endif #if AXIS_IS_TMC(E0) - tmc_parse_drv_status(stepperE0, TMC_E0, i); + tmc_parse_drv_status(stepperE0, i); #endif #if AXIS_IS_TMC(E1) - tmc_parse_drv_status(stepperE1, TMC_E1, i); + tmc_parse_drv_status(stepperE1, i); #endif #if AXIS_IS_TMC(E2) - tmc_parse_drv_status(stepperE2, TMC_E2, i); + tmc_parse_drv_status(stepperE2, i); #endif #if AXIS_IS_TMC(E3) - tmc_parse_drv_status(stepperE3, TMC_E3, i); + tmc_parse_drv_status(stepperE3, i); #endif #if AXIS_IS_TMC(E4) - tmc_parse_drv_status(stepperE4, TMC_E4, i); + tmc_parse_drv_status(stepperE4, i); #endif #if AXIS_IS_TMC(E5) - tmc_parse_drv_status(stepperE5, TMC_E5, i); + tmc_parse_drv_status(stepperE5, i); #endif SERIAL_EOL(); @@ -604,10 +571,6 @@ void _tmc_say_sgt(const TMC_AxisEnum axis, const int8_t sgt) { /** * M122 report functions */ - void tmc_set_report_status(const bool status) { - if ((report_tmc_status = status)) - SERIAL_ECHOLNPGM("axis:pwm_scale |status_response|"); - } void tmc_report_all() { #define TMC_REPORT(LABEL, ITEM) do{ SERIAL_ECHOPGM(LABEL); tmc_debug_loop(ITEM); }while(0) @@ -620,7 +583,7 @@ void _tmc_say_sgt(const TMC_AxisEnum axis, const int8_t sgt) { TMC_REPORT("Run current", TMC_IRUN); TMC_REPORT("Hold current", TMC_IHOLD); TMC_REPORT("CS actual\t", TMC_CS_ACTUAL); - TMC_REPORT("PWM scale\t", TMC_PWM_SCALE); + TMC_REPORT("PWM scale", TMC_PWM_SCALE); TMC_REPORT("vsense\t", TMC_VSENSE); TMC_REPORT("stealthChop", TMC_STEALTHCHOP); TMC_REPORT("msteps\t", TMC_MICROSTEPS); @@ -628,8 +591,10 @@ void _tmc_say_sgt(const TMC_AxisEnum axis, const int8_t sgt) { TMC_REPORT("pwm\nthreshold\t", TMC_TPWMTHRS); TMC_REPORT("[mm/s]\t", TMC_TPWMTHRS_MMS); TMC_REPORT("OT prewarn", TMC_OTPW); - TMC_REPORT("OT prewarn has\n" - "been triggered", TMC_OTPW_TRIGGERED); + #if ENABLED(MONITOR_DRIVER_STATUS) + TMC_REPORT("OT prewarn has\n" + "been triggered", TMC_OTPW_TRIGGERED); + #endif TMC_REPORT("off time\t", TMC_TOFF); TMC_REPORT("blank time", TMC_TBL); TMC_REPORT("hysteresis\n-end\t", TMC_HEND); @@ -657,67 +622,70 @@ void _tmc_say_sgt(const TMC_AxisEnum axis, const int8_t sgt) { DRV_REPORT("s2vsa\t", TMC_S2VSA); DRV_REPORT("s2vsb\t", TMC_S2VSB); #endif - DRV_REPORT("Driver registers:", TMC_DRV_STATUS_HEX); + DRV_REPORT("Driver registers:\n",TMC_DRV_STATUS_HEX); SERIAL_EOL(); } #endif // TMC_DEBUG -#if ENABLED(SENSORLESS_HOMING) +#if USE_SENSORLESS - void tmc_sensorless_homing(TMC2130Stepper &st, const bool enable/*=true*/) { - st.coolstep_min_speed(enable ? 1024UL * 1024UL - 1UL : 0); + void tmc_stallguard(TMC2130Stepper &st, const bool enable/*=true*/) { + st.TCOOLTHRS(enable ? 0xFFFFF : 0); #if ENABLED(STEALTHCHOP) - st.stealthChop(!enable); + st.en_pwm_mode(!enable); #endif st.diag1_stall(enable ? 1 : 0); } + void tmc_sensorless_homing(TMC2660Stepper &st, const bool enable) { + // TODO + } -#endif // SENSORLESS_HOMING +#endif // USE_SENSORLESS -#if HAS_DRIVER(TMC2130) +#if TMC_HAS_SPI #define SET_CS_PIN(st) OUT_WRITE(st##_CS_PIN, HIGH) void tmc_init_cs_pins() { - #if AXIS_DRIVER_TYPE(X, TMC2130) + #if AXIS_HAS_SPI(X) SET_CS_PIN(X); #endif - #if AXIS_DRIVER_TYPE(Y, TMC2130) + #if AXIS_HAS_SPI(Y) SET_CS_PIN(Y); #endif - #if AXIS_DRIVER_TYPE(Z, TMC2130) + #if AXIS_HAS_SPI(Z) SET_CS_PIN(Z); #endif - #if AXIS_DRIVER_TYPE(X2, TMC2130) + #if AXIS_HAS_SPI(X2) SET_CS_PIN(X2); #endif - #if AXIS_DRIVER_TYPE(Y2, TMC2130) + #if AXIS_HAS_SPI(Y2) SET_CS_PIN(Y2); #endif - #if AXIS_DRIVER_TYPE(Z2, TMC2130) + #if AXIS_HAS_SPI(Z2) SET_CS_PIN(Z2); #endif - #if AXIS_DRIVER_TYPE(Z3, TMC2130) + #if AXIS_HAS_SPI(Z3) SET_CS_PIN(Z3); #endif - #if AXIS_DRIVER_TYPE(E0, TMC2130) + #if AXIS_HAS_SPI(E0) SET_CS_PIN(E0); #endif - #if AXIS_DRIVER_TYPE(E1, TMC2130) + #if AXIS_HAS_SPI(E1) SET_CS_PIN(E1); #endif - #if AXIS_DRIVER_TYPE(E2, TMC2130) + #if AXIS_HAS_SPI(E2) SET_CS_PIN(E2); #endif - #if AXIS_DRIVER_TYPE(E3, TMC2130) + #if AXIS_HAS_SPI(E3) SET_CS_PIN(E3); #endif - #if AXIS_DRIVER_TYPE(E4, TMC2130) + #if AXIS_HAS_SPI(E4) SET_CS_PIN(E4); #endif - #if AXIS_DRIVER_TYPE(E5, TMC2130) + #if AXIS_HAS_SPI(E5) SET_CS_PIN(E5); #endif } -#endif // TMC2130 +#endif // TMC_HAS_SPI #endif // HAS_TRINAMIC diff --git a/Marlin/src/feature/tmc_util.h b/Marlin/src/feature/tmc_util.h index 514f603f18..015c82c499 100644 --- a/Marlin/src/feature/tmc_util.h +++ b/Marlin/src/feature/tmc_util.h @@ -19,95 +19,134 @@ * along with this program. If not, see . * */ +#pragma once -#ifndef _TMC_UTIL_H_ -#define _TMC_UTIL_H_ - -#include "../inc/MarlinConfigPre.h" - -#if HAS_DRIVER(TMC2130) - #include +#include "../inc/MarlinConfig.h" +#if HAS_TRINAMIC + #include #endif -#if HAS_DRIVER(TMC2208) - #include -#endif +#define TMC_X_LABEL 'X', '0' +#define TMC_Y_LABEL 'Y', '0' +#define TMC_Z_LABEL 'Z', '0' -extern bool report_tmc_status; +#define TMC_X2_LABEL 'X', '2' +#define TMC_Y2_LABEL 'Y', '2' +#define TMC_Z2_LABEL 'Z', '2' +#define TMC_Z3_LABEL 'Z', '3' -enum TMC_AxisEnum : char { - TMC_X, TMC_Y, TMC_Z - #if ENABLED(DUAL_X_CARRIAGE) || ENABLED(X_DUAL_STEPPER_DRIVERS) - , TMC_X2 - #endif - #if ENABLED(Y_DUAL_STEPPER_DRIVERS) - , TMC_Y2 - #endif - #if ENABLED(Z_DUAL_STEPPER_DRIVERS) - , TMC_Z2 - #endif - #if ENABLED(Z_TRIPLE_STEPPER_DRIVERS) - , TMC_Z3 - #endif - #if E_STEPPERS - , TMC_E0 - #if E_STEPPERS > 1 - , TMC_E1 - #if E_STEPPERS > 2 - , TMC_E2 - #if E_STEPPERS > 3 - , TMC_E3 - #if E_STEPPERS > 4 - , TMC_E4 - #if E_STEPPERS > 5 - , TMC_E5 - #endif // E_STEPPERS > 5 - #endif // E_STEPPERS > 4 - #endif // E_STEPPERS > 3 - #endif // E_STEPPERS > 2 - #endif // E_STEPPERS > 1 - #endif // E_STEPPERS +#define TMC_E0_LABEL 'E', '0' +#define TMC_E1_LABEL 'E', '1' +#define TMC_E2_LABEL 'E', '2' +#define TMC_E3_LABEL 'E', '3' +#define TMC_E4_LABEL 'E', '4' +#define TMC_E5_LABEL 'E', '5' + +template +class TMCStorage { + protected: + // Only a child class has access to constructor => Don't create on its own! "Poor man's abstract class" + TMCStorage() {} + + uint16_t val_mA = 0; + + public: + #if ENABLED(MONITOR_DRIVER_STATUS) + uint8_t otpw_count = 0; + bool flag_otpw = false; + bool getOTPW() { return flag_otpw; } + void clear_otpw() { flag_otpw = 0; } + #endif + + uint16_t getMilliamps() { return val_mA; } + + void printLabel() { + SERIAL_CHAR(AXIS_LETTER); + if (DRIVER_ID > '0') SERIAL_CHAR(DRIVER_ID); + } +}; + +template +class TMCMarlin : public TMC, public TMCStorage { + public: + TMCMarlin(uint16_t cs_pin, float RS) : + TMC(cs_pin, RS) + {} + TMCMarlin(uint16_t CS, float RS, uint16_t pinMOSI, uint16_t pinMISO, uint16_t pinSCK) : + TMC(CS, RS, pinMOSI, pinMISO, pinSCK) + {} + uint16_t rms_current() { return TMC::rms_current(); } + void rms_current(uint16_t mA) { + this->val_mA = mA; + TMC::rms_current(mA); + } + void rms_current(uint16_t mA, float mult) { + this->val_mA = mA; + TMC::rms_current(mA, mult); + } +}; +template +class TMCMarlin : public TMC2208Stepper, public TMCStorage { + public: + TMCMarlin(Stream * SerialPort, float RS, bool has_rx=true) : + TMC2208Stepper(SerialPort, RS, has_rx=true) + {} + TMCMarlin(uint16_t RX, uint16_t TX, float RS, bool has_rx=true) : + TMC2208Stepper(RX, TX, RS, has_rx=true) + {} + uint16_t rms_current() { return TMC2208Stepper::rms_current(); } + void rms_current(uint16_t mA) { + this->val_mA = mA; + TMC2208Stepper::rms_current(mA); + } + void rms_current(uint16_t mA, float mult) { + this->val_mA = mA; + TMC2208Stepper::rms_current(mA, mult); + } }; constexpr uint32_t _tmc_thrs(const uint16_t msteps, const int32_t thrs, const uint32_t spmm) { return 12650000UL * msteps / (256 * thrs * spmm); } -void _tmc_say_axis(const TMC_AxisEnum axis); -void _tmc_say_current(const TMC_AxisEnum axis, const uint16_t curr); -void _tmc_say_otpw(const TMC_AxisEnum axis, const bool otpw); -void _tmc_say_otpw_cleared(const TMC_AxisEnum axis); -void _tmc_say_pwmthrs(const TMC_AxisEnum axis, const uint32_t thrs); -void _tmc_say_sgt(const TMC_AxisEnum axis, const int8_t sgt); - template -void tmc_get_current(TMC &st, const TMC_AxisEnum axis) { - _tmc_say_current(axis, st.getCurrent()); +void tmc_get_current(TMC &st) { + st.printLabel(); + SERIAL_ECHOLNPAIR(" driver current: ", st.getMilliamps()); } template void tmc_set_current(TMC &st, const int mA) { - st.setCurrent(mA, R_SENSE, HOLD_MULTIPLIER); + st.rms_current(mA); } +#if ENABLED(MONITOR_DRIVER_STATUS) + template + void tmc_report_otpw(TMC &st) { + st.printLabel(); + SERIAL_ECHOPGM(" temperature prewarn triggered: "); + serialprintPGM(st.getOTPW() ? PSTR("true") : PSTR("false")); + SERIAL_EOL(); + } + template + void tmc_clear_otpw(TMC &st) { + st.clear_otpw(); + st.printLabel(); + SERIAL_ECHOLNPGM(" prewarn flag cleared"); + } +#endif template -void tmc_report_otpw(TMC &st, const TMC_AxisEnum axis) { - _tmc_say_otpw(axis, st.getOTPW()); -} -template -void tmc_clear_otpw(TMC &st, const TMC_AxisEnum axis) { - st.clear_otpw(); - _tmc_say_otpw_cleared(axis); -} -template -void tmc_get_pwmthrs(TMC &st, const TMC_AxisEnum axis, const uint16_t spmm) { - _tmc_say_pwmthrs(axis, _tmc_thrs(st.microsteps(), st.TPWMTHRS(), spmm)); +void tmc_get_pwmthrs(TMC &st, const uint16_t spmm) { + st.printLabel(); + SERIAL_ECHOLNPAIR(" stealthChop max speed: ", _tmc_thrs(st.microsteps(), st.TPWMTHRS(), spmm)); } template void tmc_set_pwmthrs(TMC &st, const int32_t thrs, const uint32_t spmm) { st.TPWMTHRS(_tmc_thrs(st.microsteps(), thrs, spmm)); } template -void tmc_get_sgt(TMC &st, const TMC_AxisEnum axis) { - _tmc_say_sgt(axis, st.sgt()); +void tmc_get_sgt(TMC &st) { + st.printLabel(); + SERIAL_ECHOPGM(" homing sensitivity: "); + SERIAL_PRINTLN(st.sgt(), DEC); } template void tmc_set_sgt(TMC &st, const int8_t sgt_val) { @@ -117,7 +156,9 @@ void tmc_set_sgt(TMC &st, const int8_t sgt_val) { void monitor_tmc_driver(); #if ENABLED(TMC_DEBUG) - void tmc_set_report_status(const bool status); + #if ENABLED(MONITOR_DRIVER_STATUS) + void tmc_set_report_status(const bool status); + #endif void tmc_report_all(); #endif @@ -128,12 +169,11 @@ void monitor_tmc_driver(); * * Defined here because of limitations with templates and headers. */ -#if ENABLED(SENSORLESS_HOMING) - void tmc_sensorless_homing(TMC2130Stepper &st, const bool enable=true); +#if USE_SENSORLESS + void tmc_stallguard(TMC2130Stepper &st, const bool enable=true); + void tmc_stallguard(TMC2660Stepper &st, const bool enable=true); #endif -#if HAS_DRIVER(TMC2130) +#if TMC_HAS_SPI void tmc_init_cs_pins(); #endif - -#endif // _TMC_UTIL_H_ diff --git a/Marlin/src/feature/twibus.h b/Marlin/src/feature/twibus.h index 7a17e2d53a..449cf7f691 100644 --- a/Marlin/src/feature/twibus.h +++ b/Marlin/src/feature/twibus.h @@ -19,9 +19,7 @@ * along with this program. If not, see . * */ - -#ifndef TWIBUS_H -#define TWIBUS_H +#pragma once #include "../core/macros.h" @@ -238,5 +236,3 @@ class TWIBus { #endif }; - -#endif // TWIBUS_H diff --git a/Marlin/src/gcode/bedlevel/G26.cpp b/Marlin/src/gcode/bedlevel/G26.cpp index e94fdcda71..65a777d413 100644 --- a/Marlin/src/gcode/bedlevel/G26.cpp +++ b/Marlin/src/gcode/bedlevel/G26.cpp @@ -38,6 +38,7 @@ #include "../../module/planner.h" #include "../../module/stepper.h" #include "../../module/motion.h" +#include "../../module/tool_change.h" #include "../../module/temperature.h" #include "../../lcd/ultralcd.h" @@ -124,8 +125,8 @@ * S # Nozzle Used to control the size of nozzle diameter. If not specified, a .4mm nozzle is assumed. * * U # Random Randomize the order that the circles are drawn on the bed. The search for the closest - * undrawn cicle is still done. But the distance to the location for each circle has a - * random number of the size specified added to it. Specifying S50 will give an interesting + * un-drawn circle is still done. But the distance to the location for each circle has a + * random number of the specified size added to it. Specifying S50 will give an interesting * deviation from the normal behaviour on a 10 x 10 Mesh. * * X # X Coord. Specify the starting location of the drawing activity. @@ -156,27 +157,21 @@ int16_t g26_bed_temp, int8_t g26_prime_flag; -#if ENABLED(ULTIPANEL) +#if HAS_LCD_MENU /** * If the LCD is clicked, cancel, wait for release, return true */ bool user_canceled() { - if (!is_lcd_clicked()) return false; // Return if the button isn't pressed - lcd_setstatusPGM(PSTR("Mesh Validation Stopped."), 99); - #if ENABLED(ULTIPANEL) - lcd_quick_feedback(true); + if (!ui.button_pressed()) return false; // Return if the button isn't pressed + ui.set_status_P(PSTR("Mesh Validation Stopped."), 99); + #if HAS_LCD_MENU + ui.quick_feedback(); #endif - wait_for_release(); + ui.wait_for_release(); return true; } - bool exit_from_g26() { - lcd_setstatusPGM(PSTR("Leaving G26"), -1); - wait_for_release(); - return G26_ERR; - } - #endif mesh_index_pair find_closest_circle_to_print(const float &X, const float &Y) { @@ -232,11 +227,11 @@ void move_to(const float &rx, const float &ry, const float &z, const float &e_de if (z != last_z) { last_z = z; - feed_value = planner.max_feedrate_mm_s[Z_AXIS]/(3.0); // Base the feed rate off of the configured Z_AXIS feed rate + feed_value = planner.settings.max_feedrate_mm_s[Z_AXIS]/(2.0); // Base the feed rate off of the configured Z_AXIS feed rate destination[X_AXIS] = current_position[X_AXIS]; destination[Y_AXIS] = current_position[Y_AXIS]; - destination[Z_AXIS] = z; // We know the last_z==z or we wouldn't be in this block of code. + destination[Z_AXIS] = z; // We know the last_z!=z or we wouldn't be in this block of code. destination[E_AXIS] = current_position[E_AXIS]; G26_line_to_destination(feed_value); @@ -245,7 +240,7 @@ void move_to(const float &rx, const float &ry, const float &z, const float &e_de // Check if X or Y is involved in the movement. // Yes: a 'normal' movement. No: a retract() or recover() - feed_value = has_xy_component ? PLANNER_XY_FEEDRATE() / 10.0 : planner.max_feedrate_mm_s[E_AXIS] / 1.5; + feed_value = has_xy_component ? PLANNER_XY_FEEDRATE() / 3.0 : 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); @@ -327,7 +322,7 @@ inline bool look_for_lines_to_connect() { for (uint8_t i = 0; i < GRID_MAX_POINTS_X; i++) { for (uint8_t j = 0; j < GRID_MAX_POINTS_Y; j++) { - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU if (user_canceled()) return true; // Check if the user wants to stop the Mesh Validation #endif @@ -412,58 +407,50 @@ inline bool look_for_lines_to_connect() { * wait for them to get up to temperature. */ inline bool turn_on_heaters() { - millis_t next = millis() + 5000UL; + + SERIAL_ECHOLNPGM("Waiting for heatup."); + #if HAS_HEATED_BED - #if ENABLED(ULTRA_LCD) - if (g26_bed_temp > 25) { - lcd_setstatusPGM(PSTR("G26 Heating Bed."), 99); - lcd_quick_feedback(true); - #if ENABLED(ULTIPANEL) - lcd_external_control = true; + + if (g26_bed_temp > 25) { + #if ENABLED(ULTRA_LCD) + ui.set_status_P(PSTR("G26 Heating Bed."), 99); + ui.quick_feedback(); + #if HAS_LCD_MENU + ui.capture(); #endif - #endif - thermalManager.setTargetBed(g26_bed_temp); - while (ABS(thermalManager.degBed() - g26_bed_temp) > 3) { + #endif + thermalManager.setTargetBed(g26_bed_temp); - #if ENABLED(ULTIPANEL) - if (is_lcd_clicked()) return exit_from_g26(); + // Wait for the temperature to stabilize + if (!thermalManager.wait_for_bed(true + #if G26_CLICK_CAN_CANCEL + , true #endif - - if (ELAPSED(millis(), next)) { - next = millis() + 5000UL; - thermalManager.print_heaterstates(); - SERIAL_EOL(); - } - idle(); - SERIAL_FLUSH(); // Prevent host M105 buffer overrun. - } - #if ENABLED(ULTRA_LCD) - } - lcd_setstatusPGM(PSTR("G26 Heating Nozzle."), 99); - lcd_quick_feedback(true); - #endif - #endif - - // Start heating the nozzle and wait for it to reach temperature. - thermalManager.setTargetHotend(g26_hotend_temp, 0); - while (ABS(thermalManager.degHotend(0) - g26_hotend_temp) > 3) { - - #if ENABLED(ULTIPANEL) - if (is_lcd_clicked()) return exit_from_g26(); - #endif - - if (ELAPSED(millis(), next)) { - next = millis() + 5000UL; - thermalManager.print_heaterstates(); - SERIAL_EOL(); + ) + ) return G26_ERR; } - idle(); - SERIAL_FLUSH(); // Prevent host M105 buffer overrun. - } + + #endif // HAS_HEATED_BED + + // Start heating the active nozzle + #if ENABLED(ULTRA_LCD) + ui.set_status_P(PSTR("G26 Heating Nozzle."), 99); + ui.quick_feedback(); + #endif + thermalManager.setTargetHotend(g26_hotend_temp, active_extruder); + + // Wait for the temperature to stabilize + if (!thermalManager.wait_for_hotend(active_extruder, true + #if G26_CLICK_CAN_CANCEL + , true + #endif + ) + ) return G26_ERR; #if ENABLED(ULTRA_LCD) - lcd_reset_status(); - lcd_quick_feedback(true); + ui.reset_status(); + ui.quick_feedback(); #endif return G26_OK; @@ -474,27 +461,29 @@ inline bool turn_on_heaters() { */ inline bool prime_nozzle() { - #if ENABLED(ULTIPANEL) - float Total_Prime = 0.0; + #if HAS_LCD_MENU + #if ENABLED(PREVENT_LENGTHY_EXTRUDE) + float Total_Prime = 0.0; + #endif if (g26_prime_flag == -1) { // The user wants to control how much filament gets purged - lcd_external_control = true; - lcd_setstatusPGM(PSTR("User-Controlled Prime"), 99); - lcd_chirp(); + ui.capture(); + ui.set_status_P(PSTR("User-Controlled Prime"), 99); + ui.chirp(); set_destination_from_current(); recover_filament(destination); // Make sure G26 doesn't think the filament is retracted(). - while (!is_lcd_clicked()) { - lcd_chirp(); + while (!ui.button_pressed()) { + ui.chirp(); destination[E_AXIS] += 0.25; - #ifdef PREVENT_LENGTHY_EXTRUDE + #if ENABLED(PREVENT_LENGTHY_EXTRUDE) Total_Prime += 0.25; if (Total_Prime >= EXTRUDE_MAXLENGTH) return G26_ERR; #endif - G26_line_to_destination(planner.max_feedrate_mm_s[E_AXIS] / 15.0); + G26_line_to_destination(planner.settings.max_feedrate_mm_s[E_AXIS] / 15.0); set_destination_from_current(); planner.synchronize(); // Without this synchronize, the purge is more consistent, // but because the planner has a buffer, we won't be able @@ -502,22 +491,22 @@ inline bool prime_nozzle() { // action to give the user a more responsive 'Stop'. } - wait_for_release(); + ui.wait_for_release(); - lcd_setstatusPGM(PSTR("Done Priming"), 99); - lcd_quick_feedback(true); - lcd_external_control = false; + ui.set_status_P(PSTR("Done Priming"), 99); + ui.quick_feedback(); + ui.release(); } else #endif { #if ENABLED(ULTRA_LCD) - lcd_setstatusPGM(PSTR("Fixed Length Prime."), 99); - lcd_quick_feedback(true); + ui.set_status_P(PSTR("Fixed Length Prime."), 99); + ui.quick_feedback(); #endif set_destination_from_current(); destination[E_AXIS] += g26_prime_length; - G26_line_to_destination(planner.max_feedrate_mm_s[E_AXIS] / 15.0); + G26_line_to_destination(planner.settings.max_feedrate_mm_s[E_AXIS] / 15.0); set_destination_from_current(); retract_filament(destination); } @@ -551,17 +540,21 @@ float valid_trig_angle(float d) { * Q Retraction multiplier * R Repetitions (number of grid points) * S Nozzle Size (diameter) in mm + * T Tool index to change to, if included * U Random deviation (50 if no value given) * X X position * Y Y position */ void GcodeSuite::G26() { - SERIAL_ECHOLNPGM("G26 command started. Waiting for heater(s)."); + SERIAL_ECHOLNPGM("G26 starting..."); // Don't allow Mesh Validation without homing first, // or if the parameter parsing did not go OK, abort if (axis_unhomed_error()) return; + // Change the tool first, if specified + if (parser.seenval('T')) tool_change(parser.value_int()); + g26_extrusion_multiplier = EXTRUSION_MULTIPLIER; g26_retraction_multiplier = RETRACTION_MULTIPLIER; g26_layer_height = MESH_TEST_LAYER_HEIGHT; @@ -617,7 +610,7 @@ void GcodeSuite::G26() { if (parser.seen('P')) { if (!parser.has_value()) { - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU g26_prime_flag = -1; #else SERIAL_PROTOCOLLNPGM("?Prime length must be specified when not using an LCD."); @@ -662,7 +655,7 @@ void GcodeSuite::G26() { } int16_t g26_repeats; - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU g26_repeats = parser.intval('R', GRID_MAX_POINTS + 1); #else if (!parser.seen('R')) { @@ -721,8 +714,8 @@ void GcodeSuite::G26() { move_to(destination, 0.0); move_to(destination, g26_ooze_amount); - #if ENABLED(ULTIPANEL) - lcd_external_control = true; + #if HAS_LCD_MENU + ui.capture(); #endif //debug_current_and_destination(PSTR("Starting G26 Mesh Validation Pattern.")); @@ -826,10 +819,23 @@ void GcodeSuite::G26() { recover_filament(destination); 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(); - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU if (user_canceled()) goto LEAVE; // Check if the user wants to stop the Mesh Validation #endif @@ -855,7 +861,7 @@ void GcodeSuite::G26() { for (int8_t ind = start_ind; ind <= end_ind; ind++) { - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU if (user_canceled()) goto LEAVE; // Check if the user wants to stop the Mesh Validation #endif @@ -888,7 +894,7 @@ void GcodeSuite::G26() { } while (--g26_repeats && location.x_index >= 0 && location.y_index >= 0); LEAVE: - lcd_setstatusPGM(PSTR("Leaving G26"), -1); + ui.set_status_P(PSTR("Leaving G26"), -1); retract_filament(destination); destination[Z_AXIS] = Z_CLEARANCE_BETWEEN_PROBES; @@ -897,22 +903,22 @@ void GcodeSuite::G26() { 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[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 + //destination[Z_AXIS] = Z_CLEARANCE_BETWEEN_PROBES; // Keep the nozzle where it is - move_to(destination, 0); // Move back to the starting position + move_to(destination, 0); // Move back to the starting position //debug_current_and_destination(PSTR("done doing X/Y move.")); - #if ENABLED(ULTIPANEL) - lcd_external_control = false; // Give back control of the LCD Panel! + #if HAS_LCD_MENU + ui.release(); // Give back control of the LCD #endif if (!g26_keep_heaters_on) { #if HAS_HEATED_BED thermalManager.setTargetBed(0); #endif - thermalManager.setTargetHotend(0, 0); + thermalManager.setTargetHotend(active_extruder, 0); } } diff --git a/Marlin/src/gcode/bedlevel/M420.cpp b/Marlin/src/gcode/bedlevel/M420.cpp index bdf33a0a28..33f464efe2 100644 --- a/Marlin/src/gcode/bedlevel/M420.cpp +++ b/Marlin/src/gcode/bedlevel/M420.cpp @@ -49,10 +49,33 @@ * With mesh-based leveling only: * * C Center mesh on the mean of the lowest and highest + * + * With MARLIN_DEV_MODE: + * S2 Create a simple random mesh and enable */ void GcodeSuite::M420() { - const bool seen_S = parser.seen('S'); - bool to_enable = seen_S ? parser.value_bool() : planner.leveling_active; + const bool seen_S = parser.seen('S'), + to_enable = seen_S ? parser.value_bool() : planner.leveling_active; + + #if ENABLED(MARLIN_DEV_MODE) + if (parser.intval('S') == 2) { + #if ENABLED(AUTO_BED_LEVELING_BILINEAR) + bilinear_start[X_AXIS] = MIN_PROBE_X; + bilinear_start[Y_AXIS] = MIN_PROBE_Y; + bilinear_grid_spacing[X_AXIS] = (MAX_PROBE_X - (MIN_PROBE_X)) / (GRID_MAX_POINTS_X - 1); + bilinear_grid_spacing[Y_AXIS] = (MAX_PROBE_Y - (MIN_PROBE_Y)) / (GRID_MAX_POINTS_Y - 1); + #endif + for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++) + for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++) + Z_VALUES(x, y) = 0.001 * random(-200, 200); + SERIAL_ECHOPGM("Simulated " STRINGIFY(GRID_MAX_POINTS_X) "x" STRINGIFY(GRID_MAX_POINTS_X) " mesh "); + SERIAL_ECHOPAIR(" (", MIN_PROBE_X); + SERIAL_CHAR(','); SERIAL_ECHO(MIN_PROBE_Y); + SERIAL_ECHOPAIR(")-(", MAX_PROBE_X); + SERIAL_CHAR(','); SERIAL_ECHO(MAX_PROBE_Y); + SERIAL_ECHOLNPGM(")"); + } + #endif // If disabling leveling do it right away // (Don't disable for just M420 or M420 V) @@ -105,12 +128,6 @@ void GcodeSuite::M420() { #if HAS_MESH - #if ENABLED(MESH_BED_LEVELING) - #define Z_VALUES(X,Y) mbl.z_values[X][Y] - #else - #define Z_VALUES(X,Y) z_values[X][Y] - #endif - // Subtract the given value or the mean from all mesh values if (leveling_is_valid() && parser.seen('C')) { const float cval = parser.value_float(); @@ -195,7 +212,8 @@ void GcodeSuite::M420() { } SERIAL_ECHO_START(); - SERIAL_ECHOLNPAIR("Bed Leveling ", planner.leveling_active ? MSG_ON : MSG_OFF); + SERIAL_ECHOPGM("Bed Leveling "); + serialprintln_onoff(planner.leveling_active); #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) SERIAL_ECHO_START(); diff --git a/Marlin/src/gcode/bedlevel/abl/G29.cpp b/Marlin/src/gcode/bedlevel/abl/G29.cpp index 6f4a2a5635..ecc2196923 100644 --- a/Marlin/src/gcode/bedlevel/abl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/abl/G29.cpp @@ -103,6 +103,10 @@ * * S Set the XY travel speed between probe points (in units/min) * + * H Set bounds to a centered square H x H units in size + * + * -or- + * * F Set the Front limit of the probing grid * B Set the Back limit of the probing grid * L Set the Left limit of the probing grid @@ -153,7 +157,7 @@ G29_TYPE GcodeSuite::G29() { // G29 Q is also available if debugging #if ENABLED(DEBUG_LEVELING_FEATURE) const uint8_t old_debug_flags = marlin_debug_flags; - if (seenQ) marlin_debug_flags |= DEBUG_LEVELING; + if (seenQ) marlin_debug_flags |= MARLIN_DEBUG_LEVELING; if (DEBUGGING(LEVELING)) { DEBUG_POS(">>> G29", current_position); log_machine_info(); @@ -381,10 +385,19 @@ G29_TYPE GcodeSuite::G29() { xy_probe_feedrate_mm_s = MMM_TO_MMS(parser.linearval('S', XY_PROBE_SPEED)); - left_probe_bed_position = parser.seenval('L') ? (int)RAW_X_POSITION(parser.value_linear_units()) : LEFT_PROBE_BED_POSITION; - right_probe_bed_position = parser.seenval('R') ? (int)RAW_X_POSITION(parser.value_linear_units()) : RIGHT_PROBE_BED_POSITION; - front_probe_bed_position = parser.seenval('F') ? (int)RAW_Y_POSITION(parser.value_linear_units()) : FRONT_PROBE_BED_POSITION; - back_probe_bed_position = parser.seenval('B') ? (int)RAW_Y_POSITION(parser.value_linear_units()) : BACK_PROBE_BED_POSITION; + if (parser.seen('H')) { + const int16_t size = (int16_t)parser.value_linear_units(); + left_probe_bed_position = MAX((MIN_PROBE_X + MAX_PROBE_X - size) / 2, MIN_PROBE_X); + right_probe_bed_position = MIN(left_probe_bed_position + size, MAX_PROBE_X); + front_probe_bed_position = MAX((MIN_PROBE_Y + MAX_PROBE_Y - size) / 2, MIN_PROBE_Y); + back_probe_bed_position = MIN(front_probe_bed_position + size, MAX_PROBE_Y); + } + else { + left_probe_bed_position = parser.seenval('L') ? (int)RAW_X_POSITION(parser.value_linear_units()) : LEFT_PROBE_BED_POSITION; + right_probe_bed_position = parser.seenval('R') ? (int)RAW_X_POSITION(parser.value_linear_units()) : RIGHT_PROBE_BED_POSITION; + front_probe_bed_position = parser.seenval('F') ? (int)RAW_Y_POSITION(parser.value_linear_units()) : FRONT_PROBE_BED_POSITION; + back_probe_bed_position = parser.seenval('B') ? (int)RAW_Y_POSITION(parser.value_linear_units()) : BACK_PROBE_BED_POSITION; + } if ( #if IS_SCARA || ENABLED(DELTA) @@ -485,7 +498,7 @@ G29_TYPE GcodeSuite::G29() { set_bed_leveling_enabled(abl_should_enable); g29_in_progress = false; #if ENABLED(LCD_BED_LEVELING) - lcd_wait_for_move = false; + ui.wait_for_bl_move = false; #endif } @@ -777,7 +790,7 @@ G29_TYPE GcodeSuite::G29() { #if ENABLED(PROBE_MANUALLY) g29_in_progress = false; #if ENABLED(LCD_BED_LEVELING) - lcd_wait_for_move = false; + ui.wait_for_bl_move = false; #endif #endif diff --git a/Marlin/src/gcode/bedlevel/mbl/G29.cpp b/Marlin/src/gcode/bedlevel/mbl/G29.cpp index 8c970e89b0..8643712d2c 100644 --- a/Marlin/src/gcode/bedlevel/mbl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/mbl/G29.cpp @@ -39,7 +39,7 @@ #include "../../../module/stepper.h" // Save 130 bytes with non-duplication of PSTR -void echo_not_entered() { SERIAL_PROTOCOLLNPGM(" not entered."); } +inline void echo_not_entered(const char c) { SERIAL_CHAR(c); SERIAL_PROTOCOLLNPGM(" not entered."); } /** * G29: Mesh-based Z probe, probes a grid and produces a @@ -47,20 +47,13 @@ void echo_not_entered() { SERIAL_PROTOCOLLNPGM(" not entered."); } * * Parameters With MESH_BED_LEVELING: * - * S0 Produce a mesh report + * S0 Report the current mesh values * S1 Start probing mesh points * S2 Probe the next mesh point - * S3 Xn Yn Zn.nn Manually modify a single point + * S3 In Jn Zn.nn Manually modify a single point * S4 Zn.nn Set z offset. Positive away from bed, negative closer to bed. * S5 Reset and disable mesh * - * The S0 report the points as below - * - * +----> X-axis 1-n - * | - * | - * v Y-axis 1-n - * */ void GcodeSuite::G29() { @@ -75,22 +68,23 @@ void GcodeSuite::G29() { return; } - int8_t px, py; + int8_t ix, iy; switch (state) { case MeshReport: + SERIAL_PROTOCOLPGM("Mesh Bed Leveling "); if (leveling_is_valid()) { - SERIAL_PROTOCOLLNPAIR("State: ", planner.leveling_active ? MSG_ON : MSG_OFF); + serialprintln_onoff(planner.leveling_active); mbl.report_mesh(); } else - SERIAL_PROTOCOLLNPGM("Mesh bed leveling has no data."); + SERIAL_PROTOCOLLNPGM("has no data."); break; case MeshStart: mbl.reset(); mbl_probe_index = 0; - if (!lcd_wait_for_move) { + if (!ui.wait_for_bl_move) { enqueue_and_echo_commands_P(PSTR("G28\nG29 S2")); return; } @@ -125,8 +119,8 @@ void GcodeSuite::G29() { soft_endstops_enabled = false; #endif - mbl.zigzag(mbl_probe_index++, px, py); - _manual_goto_xy(mbl.index_to_xpos[px], mbl.index_to_ypos[py]); + mbl.zigzag(mbl_probe_index++, ix, iy); + _manual_goto_xy(mbl.index_to_xpos[ix], mbl.index_to_ypos[iy]); } else { // One last "return to the bed" (as originally coded) at completion @@ -151,51 +145,45 @@ void GcodeSuite::G29() { #endif #if ENABLED(LCD_BED_LEVELING) - lcd_wait_for_move = false; + ui.wait_for_bl_move = false; #endif } break; case MeshSet: - if (parser.seenval('X')) { - px = parser.value_int() - 1; - if (!WITHIN(px, 0, GRID_MAX_POINTS_X - 1)) { - SERIAL_PROTOCOLLNPGM("X out of range (1-" STRINGIFY(GRID_MAX_POINTS_X) ")."); + if (parser.seenval('I')) { + ix = parser.value_int(); + if (!WITHIN(ix, 0, GRID_MAX_POINTS_X - 1)) { + SERIAL_PROTOCOLPAIR("I out of range (0-", int(GRID_MAX_POINTS_X - 1)); + SERIAL_PROTOCOLLNPGM(")"); return; } } - else { - SERIAL_CHAR('X'); echo_not_entered(); - return; - } + else + return echo_not_entered('J'); - if (parser.seenval('Y')) { - py = parser.value_int() - 1; - if (!WITHIN(py, 0, GRID_MAX_POINTS_Y - 1)) { - SERIAL_PROTOCOLLNPGM("Y out of range (1-" STRINGIFY(GRID_MAX_POINTS_Y) ")."); + if (parser.seenval('J')) { + iy = parser.value_int(); + if (!WITHIN(iy, 0, GRID_MAX_POINTS_Y - 1)) { + SERIAL_PROTOCOLPAIR("J out of range (0-", int(GRID_MAX_POINTS_Y - 1)); + SERIAL_PROTOCOLLNPGM(")"); return; } } - else { - SERIAL_CHAR('Y'); echo_not_entered(); - return; - } + else + return echo_not_entered('J'); if (parser.seenval('Z')) - mbl.z_values[px][py] = parser.value_linear_units(); - else { - SERIAL_CHAR('Z'); echo_not_entered(); - return; - } + mbl.z_values[ix][iy] = parser.value_linear_units(); + else + return echo_not_entered('Z'); break; case MeshSetZOffset: if (parser.seenval('Z')) mbl.z_offset = parser.value_linear_units(); - else { - SERIAL_CHAR('Z'); echo_not_entered(); - return; - } + else + return echo_not_entered('Z'); break; case MeshReset: diff --git a/Marlin/src/gcode/calibrate/G28.cpp b/Marlin/src/gcode/calibrate/G28.cpp index 6553fc5cfc..29a0e6552c 100644 --- a/Marlin/src/gcode/calibrate/G28.cpp +++ b/Marlin/src/gcode/calibrate/G28.cpp @@ -192,14 +192,22 @@ void GcodeSuite::G28(const bool always_home_all) { } #endif - if (all_axes_known() && parser.boolval('O')) { // home only if needed - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) { - SERIAL_ECHOLNPGM("> homing not needed, skip"); - SERIAL_ECHOLNPGM("<<< G28"); - } - #endif - return; + if (parser.boolval('O')) { + if ( + #if ENABLED(HOME_AFTER_DEACTIVATE) + all_axes_known() // homing needed anytime steppers deactivate + #else + all_axes_homed() // homing needed only if never homed + #endif + ) { + #if ENABLED(DEBUG_LEVELING_FEATURE) + if (DEBUGGING(LEVELING)) { + SERIAL_ECHOLNPGM("> homing not needed, skip"); + SERIAL_ECHOLNPGM("<<< G28"); + } + #endif + return; + } } // Wait for planner moves to finish! @@ -210,7 +218,6 @@ void GcodeSuite::G28(const bool always_home_all) { // Cancel the active G29 session #if ENABLED(PROBE_MANUALLY) - extern bool g29_in_progress; g29_in_progress = false; #endif @@ -418,7 +425,7 @@ void GcodeSuite::G28(const bool always_home_all) { tool_change(old_tool_index, 0, NO_FETCH); #endif - lcd_refresh(); + ui.refresh(); report_current_position(); #if ENABLED(NANODLP_Z_SYNC) diff --git a/Marlin/src/gcode/calibrate/G33.cpp b/Marlin/src/gcode/calibrate/G33.cpp index c2aac6d1ae..359f7dfe30 100644 --- a/Marlin/src/gcode/calibrate/G33.cpp +++ b/Marlin/src/gcode/calibrate/G33.cpp @@ -108,7 +108,7 @@ void ac_cleanup( #endif } -void print_signed_float(const char * const prefix, const float &f) { +void print_signed_float(PGM_P const prefix, const float &f) { SERIAL_PROTOCOLPGM(" "); serialprintPGM(prefix); SERIAL_PROTOCOLCHAR(':'); @@ -204,7 +204,7 @@ static float calibration_probe(const float &nx, const float &ny, const bool stow #endif } -#if HAS_BED_PROBE && ENABLED(ULTIPANEL) +#if HAS_BED_PROBE && HAS_LCD_MENU static float probe_z_shift(const float center) { STOW_PROBE(); endstops.enable_z_probe(false); @@ -517,12 +517,12 @@ void GcodeSuite::G33() { } // Report settings - const char* checkingac = PSTR("Checking... AC"); + PGM_P checkingac = PSTR("Checking... AC"); serialprintPGM(checkingac); if (verbose_level == 0) SERIAL_PROTOCOLPGM(" (DRY-RUN)"); if (set_up) SERIAL_PROTOCOLPGM(" (SET-UP)"); SERIAL_EOL(); - lcd_setstatusPGM(checkingac); + ui.set_status_P(checkingac); print_calibration_settings(_endstop_results, _angle_results); @@ -588,7 +588,7 @@ void GcodeSuite::G33() { switch (probe_points) { case -1: - #if HAS_BED_PROBE && ENABLED(ULTIPANEL) + #if HAS_BED_PROBE && HAS_LCD_MENU zprobe_zoffset += probe_z_shift(z_at_pt[CEN]); #endif @@ -643,7 +643,7 @@ void GcodeSuite::G33() { if (verbose_level != 0) { // !dry run - // normalise angles to least squares + // Normalize angles to least-squares if (_angle_results) { float a_sum = 0.0; LOOP_XYZ(axis) a_sum += delta_tower_angle_trim[axis]; @@ -651,7 +651,7 @@ void GcodeSuite::G33() { } // adjust delta_height and endstops by the max amount - const float z_temp = MAX3(delta_endstop_adj[A_AXIS], delta_endstop_adj[B_AXIS], delta_endstop_adj[C_AXIS]); + const float z_temp = MAX(delta_endstop_adj[A_AXIS], delta_endstop_adj[B_AXIS], delta_endstop_adj[C_AXIS]); delta_height -= z_temp; LOOP_XYZ(axis) delta_endstop_adj[axis] -= z_temp; } @@ -683,7 +683,7 @@ void GcodeSuite::G33() { sprintf_P(&mess[15], PSTR("0.%03i"), (int)LROUND(zero_std_dev_min * 1000.0)); else sprintf_P(&mess[15], PSTR("%03i.x"), (int)LROUND(zero_std_dev_min)); - lcd_setstatus(mess); + ui.set_status(mess); print_calibration_settings(_endstop_results, _angle_results); serialprintPGM(save_message); SERIAL_EOL(); @@ -699,13 +699,13 @@ void GcodeSuite::G33() { SERIAL_PROTOCOLPGM("std dev:"); SERIAL_PROTOCOL_F(zero_std_dev, 3); SERIAL_EOL(); - lcd_setstatus(mess); + ui.set_status(mess); if (verbose_level > 1) print_calibration_settings(_endstop_results, _angle_results); } } else { // dry run - const char *enddryrun = PSTR("End DRY-RUN"); + PGM_P enddryrun = PSTR("End DRY-RUN"); serialprintPGM(enddryrun); SERIAL_PROTOCOL_SP(35); SERIAL_PROTOCOLPGM("std dev:"); @@ -719,7 +719,7 @@ void GcodeSuite::G33() { sprintf_P(&mess[15], PSTR("0.%03i"), (int)LROUND(zero_std_dev * 1000.0)); else sprintf_P(&mess[15], PSTR("%03i.x"), (int)LROUND(zero_std_dev)); - lcd_setstatus(mess); + ui.set_status(mess); } ac_home(); } diff --git a/Marlin/src/gcode/calibrate/G34_M422.cpp b/Marlin/src/gcode/calibrate/G34_M422.cpp new file mode 100644 index 0000000000..fbeb7b8669 --- /dev/null +++ b/Marlin/src/gcode/calibrate/G34_M422.cpp @@ -0,0 +1,286 @@ +/** + * 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 "../../inc/MarlinConfig.h" + +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + +#include "../gcode.h" +#include "../../module/delta.h" +#include "../../module/motion.h" +#include "../../module/stepper.h" +#include "../../module/endstops.h" + +#if HOTENDS > 1 + #include "../../module/tool_change.h" +#endif + +#if HAS_BED_PROBE + #include "../../module/probe.h" +#endif + +#if HAS_LEVELING + #include "../../feature/bedlevel/bedlevel.h" +#endif + +float z_auto_align_xpos[Z_STEPPER_COUNT] = Z_STEPPER_ALIGN_X, + z_auto_align_ypos[Z_STEPPER_COUNT] = Z_STEPPER_ALIGN_Y; + +inline void set_all_z_lock(const bool lock) { + stepper.set_z_lock(lock); + stepper.set_z2_lock(lock); + #if ENABLED(Z_TRIPLE_STEPPER_DRIVERS) + stepper.set_z3_lock(lock); + #endif +} + +/** + * G34: Z-Stepper automatic alignment + * + * Parameters: I T A + */ +void GcodeSuite::G34() { + #if ENABLED(DEBUG_LEVELING_FEATURE) + if (DEBUGGING(LEVELING)) { + SERIAL_ECHOLNPGM(">>> G34"); + log_machine_info(); + } + #endif + + do { // break out on error + + if (!TEST(axis_known_position, X_AXIS) || !TEST(axis_known_position, Y_AXIS)) { + #if ENABLED(DEBUG_LEVELING_FEATURE) + if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> XY homing required."); + #endif + break; + } + + const int8_t z_auto_align_iterations = parser.intval('I', Z_STEPPER_ALIGN_ITERATIONS); + if (!WITHIN(z_auto_align_iterations, 1, 30)) { + SERIAL_ECHOLNPGM("?(I)teration out of bounds (1-30)."); + break; + } + + const float z_auto_align_accuracy = parser.floatval('T', Z_STEPPER_ALIGN_ACC); + if (!WITHIN(z_auto_align_accuracy, 0.01f, 1.0f)) { + SERIAL_ECHOLNPGM("?(T)arget accuracy out of bounds (0.01-1.0)."); + break; + } + + const float z_auto_align_amplification = parser.floatval('A', Z_STEPPER_ALIGN_AMP); + if (!WITHIN(z_auto_align_amplification, 0.5f, 2.0f)) { + SERIAL_ECHOLNPGM("?(A)mplification out of bounds (0.5-2.0)."); + break; + } + + // Wait for planner moves to finish! + planner.synchronize(); + + // Disable the leveling matrix before auto-aligning + #if HAS_LEVELING + #if ENABLED(RESTORE_LEVELING_AFTER_G34) + const bool leveling_was_active = planner.leveling_active; + #endif + set_bed_leveling_enabled(false); + #endif + + #if ENABLED(CNC_WORKSPACE_PLANES) + workspace_plane = PLANE_XY; + #endif + + #if ENABLED(BLTOUCH) + bltouch_command(BLTOUCH_RESET); + set_bltouch_deployed(false); + #endif + + // Always home with tool 0 active + #if HOTENDS > 1 + const uint8_t old_tool_index = active_extruder; + tool_change(0, 0, true); + #endif + + #if ENABLED(DUAL_X_CARRIAGE) || ENABLED(DUAL_NOZZLE_DUPLICATION_MODE) + extruder_duplication_enabled = false; + #endif + + // Remember corrections to determine errors on each iteration + float last_z_align_move[Z_STEPPER_COUNT] = ARRAY_N(Z_STEPPER_COUNT, 10000.0f, 10000.0f, 10000.0f), + z_measured[Z_STEPPER_COUNT] = { 0 }; + bool err_break = false; + for (uint8_t iteration = 0; iteration < z_auto_align_iterations; ++iteration) { + #if ENABLED(DEBUG_LEVELING_FEATURE) + if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> probing all positions."); + #endif + + // Reset minimum value + float z_measured_min = 100000.0f; + // For each iteration go through all probe positions (one per Z-Stepper) + for (uint8_t zstepper = 0; zstepper < Z_STEPPER_COUNT; ++zstepper) { + // Probe a Z height for each stepper + z_measured[zstepper] = probe_pt(z_auto_align_xpos[zstepper], z_auto_align_ypos[zstepper], PROBE_PT_RAISE, false); + + // Stop on error + if (isnan(z_measured[zstepper])) { + #if ENABLED(DEBUG_LEVELING_FEATURE) + if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> PROBING FAILED!"); + #endif + err_break = true; + break; + } + + #if ENABLED(DEBUG_LEVELING_FEATURE) + if (DEBUGGING(LEVELING)) { + SERIAL_ECHOPAIR("> Z", int(zstepper + 1)); + SERIAL_ECHOLNPAIR(" measured position is ", z_measured[zstepper]); + } + #endif + + // Remember the maximum position to calculate the correction + z_measured_min = MIN(z_measured_min, z_measured[zstepper]); + } + + if (err_break) break; + + // Remember the current z position to return to + float z_original_position = current_position[Z_AXIS]; + + // Iterations can stop early if all corrections are below required accuracy + bool success_break = true; + // Correct stepper offsets and re-iterate + for (uint8_t zstepper = 0; zstepper < Z_STEPPER_COUNT; ++zstepper) { + stepper.set_separate_multi_axis(true); + set_all_z_lock(true); // Steppers will be enabled separately + + // Calculate current stepper move + const float z_align_move = z_measured[zstepper] - z_measured_min, + z_align_abs = ABS(z_align_move); + + // Check for lost accuracy compared to last move + if (last_z_align_move[zstepper] < z_align_abs - 1.0) { + // Stop here + #if ENABLED(DEBUG_LEVELING_FEATURE) + if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> detected decreasing accuracy."); + #endif + err_break = true; + break; + } + else + last_z_align_move[zstepper] = z_align_abs; + + // Only stop early if all measured points achieve accuracy target + if (z_align_abs > z_auto_align_accuracy) success_break = false; + + #if ENABLED(DEBUG_LEVELING_FEATURE) + if (DEBUGGING(LEVELING)) { + SERIAL_ECHOPAIR("> Z", int(zstepper + 1)); + SERIAL_ECHOLNPAIR(" corrected by ", z_align_move); + } + #endif + + switch (zstepper) { + case 0: stepper.set_z_lock(false); break; + case 1: stepper.set_z2_lock(false); break; + #if ENABLED(Z_TRIPLE_STEPPER_DRIVERS) + case 2: stepper.set_z3_lock(false); break; + #endif + } + + // This will lose home position and require re-homing + do_blocking_move_to_z(z_auto_align_amplification * z_align_move + current_position[Z_AXIS]); + } + + if (err_break) break; + + // Move Z back to previous position + set_all_z_lock(true); + do_blocking_move_to_z(z_original_position); + set_all_z_lock(false); + + stepper.set_separate_multi_axis(false); + + if (success_break) { + #if ENABLED(DEBUG_LEVELING_FEATURE) + if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> achieved target accuracy."); + #endif + break; + } + } + + if (err_break) break; + + // Restore the active tool after homing + #if HOTENDS > 1 + tool_change(old_tool_index, 0, + #if ENABLED(PARKING_EXTRUDER) + false // Fetch the previous toolhead + #else + true + #endif + ); + #endif + + #if HAS_LEVELING + #if ENABLED(RESTORE_LEVELING_AFTER_G34) + set_bed_leveling_enabled(leveling_was_active); + #endif + #endif + + // After this operation the z position needs correction + set_axis_is_not_at_home(Z_AXIS); + + gcode.G28(false); + + } while(0); + + #if ENABLED(DEBUG_LEVELING_FEATURE) + if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("<<< G34"); + #endif +} + +/** + * M422: Z-Stepper automatic alignment parameter selection + */ +void GcodeSuite::M422() { + const int8_t zstepper = parser.intval('S') - 1; + if (!WITHIN(zstepper, 0, Z_STEPPER_COUNT - 1)) { + SERIAL_PROTOCOLLNPGM("?(S) Z-Stepper index invalid."); + return; + } + + const float x_pos = parser.floatval('X', z_auto_align_xpos[zstepper]); + if (!WITHIN(x_pos, X_MIN_POS, X_MAX_POS)) { + SERIAL_PROTOCOLLNPGM("?(X) out of bounds."); + return; + } + + const float y_pos = parser.floatval('Y', z_auto_align_ypos[zstepper]); + if (!WITHIN(y_pos, Y_MIN_POS, Y_MAX_POS)) { + SERIAL_PROTOCOLLNPGM("?(Y) out of bounds."); + return; + } + + z_auto_align_xpos[zstepper] = x_pos; + z_auto_align_ypos[zstepper] = y_pos; +} + +#endif // Z_STEPPER_AUTO_ALIGN diff --git a/Marlin/src/gcode/calibrate/M100.cpp b/Marlin/src/gcode/calibrate/M100.cpp index fe6e586897..e24c2c23d9 100644 --- a/Marlin/src/gcode/calibrate/M100.cpp +++ b/Marlin/src/gcode/calibrate/M100.cpp @@ -50,8 +50,8 @@ * * Also, there are two support functions that can be called from a developer's C code. * - * uint16_t check_for_free_memory_corruption(const char * const ptr); - * void M100_dump_routine(const char * const title, const char *start, const char *end); + * uint16_t check_for_free_memory_corruption(PGM_P const ptr); + * void M100_dump_routine(PGM_P const title, const char *start, const char *end); * * Initial version by Roxy-3D */ @@ -80,7 +80,7 @@ char* top_of_stack() { // Count the number of test bytes at the specified location. inline int32_t count_test_bytes(const char * const ptr) { for (uint32_t i = 0; i < 32000; i++) - if (((char) ptr[i]) != TEST_BYTE) + if (char(ptr[i]) != TEST_BYTE) return i - 1; return -1; @@ -136,8 +136,9 @@ inline int32_t count_test_bytes(const char * const ptr) { } } - void M100_dump_routine(const char * const title, const char *start, const char *end) { - SERIAL_ECHOLN(title); + void M100_dump_routine(PGM_P const title, const char *start, const char *end) { + serialprintPGM(title); + SERIAL_EOL(); // // Round the start and end locations to produce full lines of output // @@ -148,8 +149,8 @@ inline int32_t count_test_bytes(const char * const ptr) { #endif // M100_FREE_MEMORY_DUMPER -inline int check_for_free_memory_corruption(const char * const title) { - SERIAL_ECHO(title); +inline int check_for_free_memory_corruption(PGM_P const title) { + serialprintPGM(title); char *ptr = END_OF_HEAP(), *sp = top_of_stack(); int n = sp - ptr; @@ -171,7 +172,7 @@ inline int check_for_free_memory_corruption(const char * const title) { // idle(); safe_delay(20); #if ENABLED(M100_FREE_MEMORY_DUMPER) - M100_dump_routine(" Memory corruption detected with sp 1) { - SERIAL_ERROR_START(); - SERIAL_ERRORLNPGM("Only one of A, P, or X is allowed."); - return; - } + #if HAS_SCARA_OFFSET - const bool hasB = parser.seen('B'), hasT = parser.seen('T'), hasY = parser.seen('Y'); - const uint8_t sumBTY = hasB + hasT + hasY; - if (sumBTY == 1) - home_offset[B_AXIS] = parser.value_float(); - else if (sumBTY > 1) { - SERIAL_ERROR_START(); - SERIAL_ERRORLNPGM("Only one of B, T, or Y is allowed."); - return; - } + if (parser.seenval('Z')) scara_home_offset[Z_AXIS] = parser.value_linear_units(); + + const bool hasA = parser.seenval('A'), hasP = parser.seenval('P'), hasX = parser.seenval('X'); + const uint8_t sumAPX = hasA + hasP + hasX; + if (sumAPX) { + if (sumAPX == 1) + scara_home_offset[A_AXIS] = parser.value_float(); + else { + SERIAL_ERROR_START(); + SERIAL_ERRORLNPGM("Only one of A, P, or X is allowed."); + return; + } + } + + const bool hasB = parser.seenval('B'), hasT = parser.seenval('T'), hasY = parser.seenval('Y'); + const uint8_t sumBTY = hasB + hasT + hasY; + if (sumBTY) { + if (sumBTY == 1) + scara_home_offset[B_AXIS] = parser.value_float(); + else { + SERIAL_ERROR_START(); + SERIAL_ERRORLNPGM("Only one of B, T, or Y is allowed."); + return; + } + } + + #endif // HAS_SCARA_OFFSET } #endif diff --git a/Marlin/src/gcode/calibrate/M666.cpp b/Marlin/src/gcode/calibrate/M666.cpp index 0f82338055..31d07185c8 100644 --- a/Marlin/src/gcode/calibrate/M666.cpp +++ b/Marlin/src/gcode/calibrate/M666.cpp @@ -22,7 +22,7 @@ #include "../../inc/MarlinConfig.h" -#if ENABLED(DELTA) || ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || ENABLED(Z_DUAL_ENDSTOPS) +#if ENABLED(DELTA) || ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS #include "../gcode.h" @@ -73,34 +73,23 @@ * Set Both: M666 Z */ void GcodeSuite::M666() { - bool report = true; #if ENABLED(X_DUAL_ENDSTOPS) - if (parser.seen('X')) { - endstops.x2_endstop_adj = parser.value_linear_units(); - report = false; - } + if (parser.seenval('X')) endstops.x2_endstop_adj = parser.value_linear_units(); #endif #if ENABLED(Y_DUAL_ENDSTOPS) - if (parser.seen('Y')) { - endstops.y2_endstop_adj = parser.value_linear_units(); - report = false; - } + if (parser.seenval('Y')) endstops.y2_endstop_adj = parser.value_linear_units(); #endif #if ENABLED(Z_TRIPLE_ENDSTOPS) - if (parser.seen('Z')) { - const int ind = parser.intval('S'); + if (parser.seenval('Z')) { const float z_adj = parser.value_linear_units(); + const int ind = parser.intval('S'); if (!ind || ind == 2) endstops.z2_endstop_adj = z_adj; if (!ind || ind == 3) endstops.z3_endstop_adj = z_adj; - report = false; } #elif Z_MULTI_ENDSTOPS - if (parser.seen('Z')) { - endstops.z2_endstop_adj = parser.value_linear_units(); - report = false; - } + if (parser.seen('Z')) endstops.z2_endstop_adj = parser.value_linear_units(); #endif - if (report) { + if (!parser.seen("XYZ")) { SERIAL_ECHOPGM("Dual Endstop Adjustment (mm): "); #if ENABLED(X_DUAL_ENDSTOPS) SERIAL_ECHOPAIR(" X2:", endstops.x2_endstop_adj); diff --git a/Marlin/src/gcode/calibrate/M852.cpp b/Marlin/src/gcode/calibrate/M852.cpp index 927c0838e4..71805a5b1a 100644 --- a/Marlin/src/gcode/calibrate/M852.cpp +++ b/Marlin/src/gcode/calibrate/M852.cpp @@ -42,8 +42,8 @@ void GcodeSuite::M852() { ++ijk; const float value = parser.value_linear_units(); if (WITHIN(value, SKEW_FACTOR_MIN, SKEW_FACTOR_MAX)) { - if (planner.xy_skew_factor != value) { - planner.xy_skew_factor = value; + if (planner.skew_factor.xy != value) { + planner.skew_factor.xy = value; ++setval; } } @@ -57,8 +57,8 @@ void GcodeSuite::M852() { ++ijk; const float value = parser.value_linear_units(); if (WITHIN(value, SKEW_FACTOR_MIN, SKEW_FACTOR_MAX)) { - if (planner.xz_skew_factor != value) { - planner.xz_skew_factor = value; + if (planner.skew_factor.xz != value) { + planner.skew_factor.xz = value; ++setval; } } @@ -70,8 +70,8 @@ void GcodeSuite::M852() { ++ijk; const float value = parser.value_linear_units(); if (WITHIN(value, SKEW_FACTOR_MIN, SKEW_FACTOR_MAX)) { - if (planner.yz_skew_factor != value) { - planner.yz_skew_factor = value; + if (planner.skew_factor.yz != value) { + planner.skew_factor.yz = value; ++setval; } } @@ -94,11 +94,11 @@ void GcodeSuite::M852() { if (!ijk) { SERIAL_ECHO_START(); SERIAL_ECHOPGM(MSG_SKEW_FACTOR " XY: "); - SERIAL_ECHO_F(planner.xy_skew_factor, 6); + SERIAL_ECHO_F(planner.skew_factor.xy, 6); SERIAL_EOL(); #if ENABLED(SKEW_CORRECTION_FOR_Z) - SERIAL_ECHOPAIR(" XZ: ", planner.xz_skew_factor); - SERIAL_ECHOLNPAIR(" YZ: ", planner.yz_skew_factor); + SERIAL_ECHOPAIR(" XZ: ", planner.skew_factor.xz); + SERIAL_ECHOLNPAIR(" YZ: ", planner.skew_factor.yz); #else SERIAL_EOL(); #endif diff --git a/Marlin/src/gcode/config/M200-M205.cpp b/Marlin/src/gcode/config/M200-M205.cpp index 132cfc9ae1..f806fd19d1 100644 --- a/Marlin/src/gcode/config/M200-M205.cpp +++ b/Marlin/src/gcode/config/M200-M205.cpp @@ -34,7 +34,8 @@ */ void GcodeSuite::M200() { - if (get_target_extruder_from_command()) return; + const int8_t target_extruder = get_target_extruder_from_command(); + if (target_extruder < 0) return; if (parser.seen('D')) { // setting any extruder filament size disables volumetric on the assumption that @@ -55,12 +56,13 @@ */ void GcodeSuite::M201() { - GET_TARGET_EXTRUDER(); + const int8_t target_extruder = get_target_extruder_from_command(); + if (target_extruder < 0) return; LOOP_XYZE(i) { if (parser.seen(axis_codes[i])) { - const uint8_t a = i + (i == E_AXIS ? TARGET_EXTRUDER : 0); - planner.max_acceleration_mm_per_s2[a] = parser.value_axis_units((AxisEnum)a); + const uint8_t a = (i == E_AXIS ? E_AXIS_N(target_extruder) : i); + planner.settings.max_acceleration_mm_per_s2[a] = parser.value_axis_units((AxisEnum)a); } } // steps per sq second need to be updated to agree with the units per sq second (as they are what is used in the planner) @@ -74,12 +76,13 @@ void GcodeSuite::M201() { */ void GcodeSuite::M203() { - GET_TARGET_EXTRUDER(); + const int8_t target_extruder = get_target_extruder_from_command(); + if (target_extruder < 0) return; LOOP_XYZE(i) if (parser.seen(axis_codes[i])) { - const uint8_t a = i + (i == E_AXIS ? TARGET_EXTRUDER : 0); - planner.max_feedrate_mm_s[a] = parser.value_axis_units((AxisEnum)a); + const uint8_t a = (i == E_AXIS ? E_AXIS_N(target_extruder) : i); + planner.settings.max_feedrate_mm_s[a] = parser.value_axis_units((AxisEnum)a); } } @@ -91,27 +94,18 @@ void GcodeSuite::M203() { * T = Travel (non printing) moves */ void GcodeSuite::M204() { - bool report = true; - if (parser.seenval('S')) { // Kept for legacy compatibility. Should NOT BE USED for new developments. - planner.travel_acceleration = planner.acceleration = parser.value_linear_units(); - report = false; + if (!parser.seen("PRST")) { + SERIAL_ECHOPAIR("Acceleration: P", planner.settings.acceleration); + SERIAL_ECHOPAIR(" R", planner.settings.retract_acceleration); + SERIAL_ECHOLNPAIR(" T", planner.settings.travel_acceleration); } - if (parser.seenval('P')) { - planner.acceleration = parser.value_linear_units(); - report = false; - } - if (parser.seenval('R')) { - planner.retract_acceleration = parser.value_linear_units(); - report = false; - } - if (parser.seenval('T')) { - planner.travel_acceleration = parser.value_linear_units(); - report = false; - } - if (report) { - SERIAL_ECHOPAIR("Acceleration: P", planner.acceleration); - SERIAL_ECHOPAIR(" R", planner.retract_acceleration); - SERIAL_ECHOLNPAIR(" T", planner.travel_acceleration); + else { + //planner.synchronize(); + // 'S' for legacy compatibility. Should NOT BE USED for new development + if (parser.seenval('S')) planner.settings.travel_acceleration = planner.settings.acceleration = parser.value_linear_units(); + if (parser.seenval('P')) planner.settings.acceleration = parser.value_linear_units(); + if (parser.seenval('R')) planner.settings.retract_acceleration = parser.value_linear_units(); + if (parser.seenval('T')) planner.settings.travel_acceleration = parser.value_linear_units(); } } @@ -128,9 +122,22 @@ void GcodeSuite::M204() { * J = Junction Deviation (mm) (Requires JUNCTION_DEVIATION) */ void GcodeSuite::M205() { - if (parser.seen('B')) planner.min_segment_time_us = parser.value_ulong(); - if (parser.seen('S')) planner.min_feedrate_mm_s = parser.value_linear_units(); - if (parser.seen('T')) planner.min_travel_feedrate_mm_s = parser.value_linear_units(); + #if ENABLED(JUNCTION_DEVIATION) + #define J_PARAM "J" + #else + #define J_PARAM + #endif + #if HAS_CLASSIC_JERK + #define XYZE_PARAM "XYZE" + #else + #define XYZE_PARAM + #endif + if (!parser.seen("BST" J_PARAM XYZE_PARAM)) return; + + //planner.synchronize(); + if (parser.seen('B')) planner.settings.min_segment_time_us = parser.value_ulong(); + if (parser.seen('S')) planner.settings.min_feedrate_mm_s = parser.value_linear_units(); + if (parser.seen('T')) planner.settings.min_travel_feedrate_mm_s = parser.value_linear_units(); #if ENABLED(JUNCTION_DEVIATION) if (parser.seen('J')) { const float junc_dev = parser.value_linear_units(); diff --git a/Marlin/src/gcode/config/M217.cpp b/Marlin/src/gcode/config/M217.cpp new file mode 100644 index 0000000000..c9e2c56a5f --- /dev/null +++ b/Marlin/src/gcode/config/M217.cpp @@ -0,0 +1,92 @@ +/** + * 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 "../../inc/MarlinConfigPre.h" + +#if EXTRUDERS > 1 + +#include "../gcode.h" +#include "../../module/tool_change.h" + +#if NUM_SERIAL > 1 + #include "../../gcode/queue.h" +#endif + +void M217_report(const bool eeprom=false) { + + #if NUM_SERIAL > 1 + const int16_t port = command_queue_port[cmd_queue_index_r]; + #endif + + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + serialprintPGM_P(port, eeprom ? PSTR(" M217") : PSTR("Singlenozzle:")); + SERIAL_ECHOPAIR_P(port, " S", LINEAR_UNIT(toolchange_settings.swap_length)); + SERIAL_ECHOPAIR_P(port, " P", LINEAR_UNIT(toolchange_settings.prime_speed)); + SERIAL_ECHOPAIR_P(port, " R", LINEAR_UNIT(toolchange_settings.retract_speed)); + + #if ENABLED(TOOLCHANGE_PARK) + SERIAL_ECHOPAIR_P(port, " X", LINEAR_UNIT(toolchange_settings.change_point.x)); + SERIAL_ECHOPAIR_P(port, " Y", LINEAR_UNIT(toolchange_settings.change_point.y)); + #endif + + #endif + + SERIAL_ECHOPAIR_P(port, " Z", LINEAR_UNIT(toolchange_settings.z_raise)); + SERIAL_EOL(); +} + +/** + * M217 - Set SINGLENOZZLE toolchange parameters + * + * S[linear] Swap length + * P[linear/m] Prime speed + * R[linear/m] Retract speed + * X[linear] Park X (Requires TOOLCHANGE_PARK) + * Y[linear] Park Y (Requires TOOLCHANGE_PARK) + * Z[linear] Z Raise + */ +void GcodeSuite::M217() { + + #define SPR_PARAM + #define XY_PARAM + + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + + #undef SPR_PARAM + #define SPR_PARAM "SPR" + + if (parser.seenval('S')) { const float v = parser.value_linear_units(); toolchange_settings.swap_length = constrain(v, 0, 500); } + if (parser.seenval('P')) { const int16_t v = parser.value_linear_units(); toolchange_settings.prime_speed = constrain(v, 10, 5400); } + if (parser.seenval('R')) { const int16_t v = parser.value_linear_units(); toolchange_settings.retract_speed = constrain(v, 10, 5400); } + #endif + #if ENABLED(TOOLCHANGE_PARK) + #undef XY_PARAM + #define XY_PARAM "XY" + if (parser.seenval('X')) { toolchange_settings.change_point.x = parser.value_linear_units(); } + if (parser.seenval('Y')) { toolchange_settings.change_point.y = parser.value_linear_units(); } + #endif + if (parser.seenval('Z')) { toolchange_settings.z_raise = parser.value_linear_units(); } + + if (!parser.seen(SPR_PARAM XY_PARAM "Z")) M217_report(); +} + +#endif // EXTRUDERS > 1 diff --git a/Marlin/src/gcode/config/M218.cpp b/Marlin/src/gcode/config/M218.cpp index 6093c19c81..df17bd5647 100644 --- a/Marlin/src/gcode/config/M218.cpp +++ b/Marlin/src/gcode/config/M218.cpp @@ -40,23 +40,15 @@ * Z */ void GcodeSuite::M218() { - if (get_target_extruder_from_command() || target_extruder == 0) return; - bool report = true; - if (parser.seenval('X')) { - hotend_offset[X_AXIS][target_extruder] = parser.value_linear_units(); - report = false; - } - if (parser.seenval('Y')) { - hotend_offset[Y_AXIS][target_extruder] = parser.value_linear_units(); - report = false; - } - if (parser.seenval('Z')) { - hotend_offset[Z_AXIS][target_extruder] = parser.value_linear_units(); - report = false; - } + const int8_t target_extruder = get_target_extruder_from_command(); + if (target_extruder < 0) return; - if (report) { + if (parser.seenval('X')) hotend_offset[X_AXIS][target_extruder] = parser.value_linear_units(); + if (parser.seenval('Y')) hotend_offset[Y_AXIS][target_extruder] = parser.value_linear_units(); + if (parser.seenval('Z')) hotend_offset[Z_AXIS][target_extruder] = parser.value_linear_units(); + + if (!parser.seen("XYZ")) { SERIAL_ECHO_START(); SERIAL_ECHOPGM(MSG_HOTEND_OFFSET); HOTEND_LOOP() { @@ -72,7 +64,7 @@ void GcodeSuite::M218() { #if ENABLED(DELTA) if (target_extruder == active_extruder) - do_blocking_move_to_xy(current_position[X_AXIS], current_position[Y_AXIS], planner.max_feedrate_mm_s[X_AXIS]); + do_blocking_move_to_xy(current_position[X_AXIS], current_position[Y_AXIS], planner.settings.max_feedrate_mm_s[X_AXIS]); #endif } diff --git a/Marlin/src/gcode/config/M221.cpp b/Marlin/src/gcode/config/M221.cpp index e5d4204f5e..7129427862 100644 --- a/Marlin/src/gcode/config/M221.cpp +++ b/Marlin/src/gcode/config/M221.cpp @@ -27,7 +27,10 @@ * M221: Set extrusion percentage (M221 T0 S95) */ void GcodeSuite::M221() { - if (get_target_extruder_from_command()) return; + + const int8_t target_extruder = get_target_extruder_from_command(); + if (target_extruder < 0) return; + if (parser.seenval('S')) { planner.flow_percentage[target_extruder] = parser.value_int(); planner.refresh_e_factor(target_extruder); diff --git a/Marlin/src/gcode/config/M304.cpp b/Marlin/src/gcode/config/M304.cpp index 3bc645903f..a4251482ae 100644 --- a/Marlin/src/gcode/config/M304.cpp +++ b/Marlin/src/gcode/config/M304.cpp @@ -28,14 +28,14 @@ #include "../../module/temperature.h" void GcodeSuite::M304() { - if (parser.seen('P')) thermalManager.bedKp = parser.value_float(); - if (parser.seen('I')) thermalManager.bedKi = scalePID_i(parser.value_float()); - if (parser.seen('D')) thermalManager.bedKd = scalePID_d(parser.value_float()); + if (parser.seen('P')) thermalManager.bed_pid.Kp = parser.value_float(); + if (parser.seen('I')) thermalManager.bed_pid.Ki = scalePID_i(parser.value_float()); + if (parser.seen('D')) thermalManager.bed_pid.Kd = scalePID_d(parser.value_float()); SERIAL_ECHO_START(); - SERIAL_ECHOPAIR(" p:", thermalManager.bedKp); - SERIAL_ECHOPAIR(" i:", unscalePID_i(thermalManager.bedKi)); - SERIAL_ECHOLNPAIR(" d:", unscalePID_d(thermalManager.bedKd)); + SERIAL_ECHOPAIR(" p:", thermalManager.bed_pid.Kp); + SERIAL_ECHOPAIR(" i:", unscalePID_i(thermalManager.bed_pid.Ki)); + SERIAL_ECHOLNPAIR(" d:", unscalePID_d(thermalManager.bed_pid.Kd)); } #endif // PIDTEMPBED diff --git a/Marlin/src/gcode/config/M43.cpp b/Marlin/src/gcode/config/M43.cpp index 62863e0028..2115a1d26e 100644 --- a/Marlin/src/gcode/config/M43.cpp +++ b/Marlin/src/gcode/config/M43.cpp @@ -38,7 +38,7 @@ inline void toggle_pins() { const bool ignore_protection = parser.boolval('I'); const int repeat = parser.intval('R', 1), start = PARSED_PIN_INDEX('S', 0), - end = PARSED_PIN_INDEX('E', NUM_DIGITAL_PINS - 1), + end = PARSED_PIN_INDEX('L', NUM_DIGITAL_PINS - 1), wait = parser.intval('W', 500); for (uint8_t i = start; i <= end; i++) { diff --git a/Marlin/src/gcode/config/M92.cpp b/Marlin/src/gcode/config/M92.cpp index 2ac913e701..cb438d4142 100644 --- a/Marlin/src/gcode/config/M92.cpp +++ b/Marlin/src/gcode/config/M92.cpp @@ -31,24 +31,25 @@ */ void GcodeSuite::M92() { - GET_TARGET_EXTRUDER(); + const int8_t target_extruder = get_target_extruder_from_command(); + if (target_extruder < 0) return; LOOP_XYZE(i) { if (parser.seen(axis_codes[i])) { if (i == E_AXIS) { - const float value = parser.value_per_axis_unit((AxisEnum)(E_AXIS + TARGET_EXTRUDER)); + const float value = parser.value_per_axis_units((AxisEnum)(E_AXIS_N(target_extruder))); if (value < 20) { - float factor = planner.axis_steps_per_mm[E_AXIS + TARGET_EXTRUDER] / value; // increase e constants if M92 E14 is given for netfab. + float factor = planner.settings.axis_steps_per_mm[E_AXIS_N(target_extruder)] / value; // increase e constants if M92 E14 is given for netfab. #if HAS_CLASSIC_JERK && (DISABLED(JUNCTION_DEVIATION) || DISABLED(LIN_ADVANCE)) planner.max_jerk[E_AXIS] *= factor; #endif - planner.max_feedrate_mm_s[E_AXIS + TARGET_EXTRUDER] *= factor; - planner.max_acceleration_steps_per_s2[E_AXIS + TARGET_EXTRUDER] *= factor; + planner.settings.max_feedrate_mm_s[E_AXIS_N(target_extruder)] *= factor; + planner.max_acceleration_steps_per_s2[E_AXIS_N(target_extruder)] *= factor; } - planner.axis_steps_per_mm[E_AXIS + TARGET_EXTRUDER] = value; + planner.settings.axis_steps_per_mm[E_AXIS_N(target_extruder)] = value; } else { - planner.axis_steps_per_mm[i] = parser.value_per_axis_unit((AxisEnum)i); + planner.settings.axis_steps_per_mm[i] = parser.value_per_axis_units((AxisEnum)i); } } } diff --git a/Marlin/src/gcode/control/M108_M112_M410.cpp b/Marlin/src/gcode/control/M108_M112_M410.cpp index 7b49951266..6e376bcc24 100644 --- a/Marlin/src/gcode/control/M108_M112_M410.cpp +++ b/Marlin/src/gcode/control/M108_M112_M410.cpp @@ -31,6 +31,9 @@ * M108: Stop the waiting for heaters in M109, M190, M303. Does not affect the target temperature. */ void GcodeSuite::M108() { + #if HAS_RESUME_CONTINUE + wait_for_user = false; + #endif wait_for_heatup = false; } @@ -38,7 +41,7 @@ void GcodeSuite::M108() { * M112: Emergency Stop */ void GcodeSuite::M112() { - kill(PSTR(MSG_KILLED)); + kill(); } /** diff --git a/Marlin/src/gcode/control/M111.cpp b/Marlin/src/gcode/control/M111.cpp index 96587a1fc1..1410356789 100644 --- a/Marlin/src/gcode/control/M111.cpp +++ b/Marlin/src/gcode/control/M111.cpp @@ -38,7 +38,7 @@ void GcodeSuite::M111() { #endif ; - static const char* const debug_strings[] PROGMEM = { + static PGM_P const debug_strings[] PROGMEM = { str_debug_1, str_debug_2, str_debug_4, str_debug_8, str_debug_16 #if ENABLED(DEBUG_LEVELING_FEATURE) , str_debug_32 @@ -60,19 +60,19 @@ void GcodeSuite::M111() { SERIAL_ECHOPGM(MSG_DEBUG_OFF); #if !defined(__AVR__) || !defined(USBCON) #if ENABLED(SERIAL_STATS_RX_BUFFER_OVERRUNS) - SERIAL_ECHOPAIR("\nBuffer Overruns: ", customizedSerial.buffer_overruns()); + SERIAL_ECHOPAIR("\nBuffer Overruns: ", MYSERIAL0.buffer_overruns()); #endif #if ENABLED(SERIAL_STATS_RX_FRAMING_ERRORS) - SERIAL_ECHOPAIR("\nFraming Errors: ", customizedSerial.framing_errors()); + SERIAL_ECHOPAIR("\nFraming Errors: ", MYSERIAL0.framing_errors()); #endif #if ENABLED(SERIAL_STATS_DROPPED_RX) - SERIAL_ECHOPAIR("\nDropped bytes: ", customizedSerial.dropped()); + SERIAL_ECHOPAIR("\nDropped bytes: ", MYSERIAL0.dropped()); #endif #if ENABLED(SERIAL_STATS_MAX_RX_QUEUED) - SERIAL_ECHOPAIR("\nMax RX Queue Size: ", customizedSerial.rxMaxEnqueued()); + SERIAL_ECHOPAIR("\nMax RX Queue Size: ", MYSERIAL0.rxMaxEnqueued()); #endif #endif // !defined(__AVR__) || !defined(USBCON) } diff --git a/Marlin/src/gcode/control/M17_M18_M84.cpp b/Marlin/src/gcode/control/M17_M18_M84.cpp index c428a87877..33a6eae5ff 100644 --- a/Marlin/src/gcode/control/M17_M18_M84.cpp +++ b/Marlin/src/gcode/control/M17_M18_M84.cpp @@ -54,13 +54,17 @@ void GcodeSuite::M18_M84() { if (parser.seen('X')) disable_X(); if (parser.seen('Y')) disable_Y(); if (parser.seen('Z')) disable_Z(); - #if E0_ENABLE_PIN != X_ENABLE_PIN && E1_ENABLE_PIN != Y_ENABLE_PIN // Only disable on boards that have separate ENABLE_PINS + // Only disable on boards that have separate ENABLE_PINS or another method for disabling the driver + #if (E0_ENABLE_PIN != X_ENABLE_PIN && E1_ENABLE_PIN != Y_ENABLE_PIN) || AXIS_DRIVER_TYPE(E0, TMC2660) || AXIS_DRIVER_TYPE(E1, TMC2660) || AXIS_DRIVER_TYPE(E2, TMC2660) || AXIS_DRIVER_TYPE(E3, TMC2660) || AXIS_DRIVER_TYPE(E4, TMC2660) || AXIS_DRIVER_TYPE(E5, TMC2660) if (parser.seen('E')) disable_e_steppers(); #endif } - #if ENABLED(AUTO_BED_LEVELING_UBL) && ENABLED(ULTIPANEL) // Only needed with an LCD - if (ubl.lcd_map_control) ubl.lcd_map_control = defer_return_to_status = false; + #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 } } diff --git a/Marlin/src/gcode/control/M211.cpp b/Marlin/src/gcode/control/M211.cpp index 1f3be868a7..83db00a3bd 100644 --- a/Marlin/src/gcode/control/M211.cpp +++ b/Marlin/src/gcode/control/M211.cpp @@ -20,6 +20,10 @@ * */ +#include "../../inc/MarlinConfigPre.h" + +#if HAS_SOFTWARE_ENDSTOPS + #include "../gcode.h" #include "../../module/motion.h" @@ -31,12 +35,8 @@ void GcodeSuite::M211() { SERIAL_ECHO_START(); SERIAL_ECHOPGM(MSG_SOFT_ENDSTOPS); - #if HAS_SOFTWARE_ENDSTOPS - if (parser.seen('S')) soft_endstops_enabled = parser.value_bool(); - serialprintPGM(soft_endstops_enabled ? PSTR(MSG_ON) : PSTR(MSG_OFF)); - #else - SERIAL_ECHOPGM(MSG_OFF); - #endif + if (parser.seen('S')) soft_endstops_enabled = parser.value_bool(); + serialprint_onoff(soft_endstops_enabled); SERIAL_ECHOPGM(MSG_SOFT_MIN); SERIAL_ECHOPAIR( MSG_X, LOGICAL_X_POSITION(soft_endstop_min[X_AXIS])); SERIAL_ECHOPAIR(" " MSG_Y, LOGICAL_Y_POSITION(soft_endstop_min[Y_AXIS])); @@ -46,3 +46,5 @@ void GcodeSuite::M211() { SERIAL_ECHOPAIR(" " MSG_Y, LOGICAL_Y_POSITION(soft_endstop_max[Y_AXIS])); SERIAL_ECHOLNPAIR(" " MSG_Z, LOGICAL_Z_POSITION(soft_endstop_max[Z_AXIS])); } + +#endif diff --git a/Marlin/src/gcode/control/M350_M351.cpp b/Marlin/src/gcode/control/M350_M351.cpp index cd75e7b2b1..a83823f315 100644 --- a/Marlin/src/gcode/control/M350_M351.cpp +++ b/Marlin/src/gcode/control/M350_M351.cpp @@ -41,17 +41,21 @@ void GcodeSuite::M350() { /** * M351: Toggle MS1 MS2 pins directly with axis codes X Y Z E B - * S# determines MS1 or MS2, X# sets the pin high/low. + * S# determines MS1, MS2 or MS3, X# sets the pin high/low. */ void GcodeSuite::M351() { if (parser.seenval('S')) switch (parser.value_byte()) { case 1: - LOOP_XYZE(i) if (parser.seenval(axis_codes[i])) stepper.microstep_ms(i, parser.value_byte(), -1); - if (parser.seenval('B')) stepper.microstep_ms(4, parser.value_byte(), -1); + LOOP_XYZE(i) if (parser.seenval(axis_codes[i])) stepper.microstep_ms(i, parser.value_byte(), -1, -1); + if (parser.seenval('B')) stepper.microstep_ms(4, parser.value_byte(), -1, -1); break; case 2: - LOOP_XYZE(i) if (parser.seenval(axis_codes[i])) stepper.microstep_ms(i, -1, parser.value_byte()); - if (parser.seenval('B')) stepper.microstep_ms(4, -1, parser.value_byte()); + LOOP_XYZE(i) if (parser.seenval(axis_codes[i])) stepper.microstep_ms(i, -1, parser.value_byte(), -1); + if (parser.seenval('B')) stepper.microstep_ms(4, -1, parser.value_byte(), -1); + break; + case 3: + LOOP_XYZE(i) if (parser.seenval(axis_codes[i])) stepper.microstep_ms(i, -1, -1, parser.value_byte()); + if (parser.seenval('B')) stepper.microstep_ms(4, -1, -1, parser.value_byte()); break; } stepper.microstep_readings(); diff --git a/Marlin/src/gcode/control/M380_M381.cpp b/Marlin/src/gcode/control/M380_M381.cpp index 5ebca12657..7f4a3afc52 100644 --- a/Marlin/src/gcode/control/M380_M381.cpp +++ b/Marlin/src/gcode/control/M380_M381.cpp @@ -22,19 +22,28 @@ #include "../../inc/MarlinConfig.h" -#if ENABLED(EXT_SOLENOID) +#if ENABLED(EXT_SOLENOID) || ENABLED(MANUAL_SOLENOID_CONTROL) #include "../gcode.h" #include "../../feature/solenoid.h" +#include "../../module/motion.h" /** * M380: Enable solenoid on the active extruder + * + * S to specify a solenoid (Requires MANUAL_SOLENOID_CONTROL) */ -void GcodeSuite::M380() { enable_solenoid_on_active_extruder(); } +void GcodeSuite::M380() { + #if ENABLED(MANUAL_SOLENOID_CONTROL) + enable_solenoid(parser.seenval('S') ? parser.value_int() : active_extruder); + #else + enable_solenoid_on_active_extruder(); + #endif +} /** * M381: Disable all solenoids */ void GcodeSuite::M381() { disable_all_solenoids(); } -#endif // EXT_SOLENOID +#endif // EXT_SOLENOID || MANUAL_SOLENOID_CONTROL diff --git a/Marlin/src/gcode/control/M42.cpp b/Marlin/src/gcode/control/M42.cpp index 6e84dc475f..2a7323a861 100644 --- a/Marlin/src/gcode/control/M42.cpp +++ b/Marlin/src/gcode/control/M42.cpp @@ -52,13 +52,13 @@ void GcodeSuite::M42() { #if FAN_COUNT > 0 switch (pin) { #if HAS_FAN0 - case FAN_PIN: fanSpeeds[0] = pin_status; break; + case FAN_PIN: fan_speed[0] = pin_status; break; #endif #if HAS_FAN1 - case FAN1_PIN: fanSpeeds[1] = pin_status; break; + case FAN1_PIN: fan_speed[1] = pin_status; break; #endif #if HAS_FAN2 - case FAN2_PIN: fanSpeeds[2] = pin_status; break; + case FAN2_PIN: fan_speed[2] = pin_status; break; #endif } #endif diff --git a/Marlin/src/gcode/control/M605.cpp b/Marlin/src/gcode/control/M605.cpp index 780a7f57b5..bcd0cf7b76 100644 --- a/Marlin/src/gcode/control/M605.cpp +++ b/Marlin/src/gcode/control/M605.cpp @@ -22,10 +22,10 @@ #include "../../inc/MarlinConfig.h" -#define DEBUG_DXC_MODE - #if ENABLED(DUAL_X_CARRIAGE) || ENABLED(DUAL_NOZZLE_DUPLICATION_MODE) +//#define DEBUG_DXC_MODE + #include "../gcode.h" #include "../../module/motion.h" #include "../../module/stepper.h" @@ -99,50 +99,52 @@ else if (!parser.seen('W')) // if no S or W parameter, the DXC mode gets reset to the user's default dual_x_carriage_mode = DEFAULT_DUAL_X_CARRIAGE_MODE; - if (parser.seen('W')) { - SERIAL_ECHO_START(); - SERIAL_ECHOPGM("IDEX mode: "); - switch (dual_x_carriage_mode) { - case DXC_FULL_CONTROL_MODE: SERIAL_ECHOPGM("DXC_FULL_CONTROL_MODE"); break; - case DXC_AUTO_PARK_MODE: SERIAL_ECHOPGM("DXC_AUTO_PARK_MODE"); break; - case DXC_DUPLICATION_MODE: SERIAL_ECHOPGM("DXC_DUPLICATION_MODE"); break; - case DXC_SCALED_DUPLICATION_MODE: SERIAL_ECHOPGM("DXC_SCALED_DUPLICATION_MODE"); break; - } - SERIAL_ECHOPAIR("\nActive Ext: ", int(active_extruder)); - if (!active_extruder_parked) SERIAL_ECHOPGM(" NOT "); - SERIAL_ECHOPGM(" parked."); - SERIAL_ECHOPAIR("\nactive_extruder_x_pos: ", current_position[X_AXIS]); - SERIAL_ECHOPAIR("\ninactive_extruder_x_pos: ", inactive_extruder_x_pos); - SERIAL_ECHOPAIR("\nextruder_duplication_enabled: ", int(extruder_duplication_enabled)); - SERIAL_ECHOPAIR("\nduplicate_extruder_x_offset: ", duplicate_extruder_x_offset); - SERIAL_ECHOPAIR("\nduplicate_extruder_temp_offset: ", duplicate_extruder_temp_offset); - SERIAL_ECHOPAIR("\ndelayed_move_time: ", delayed_move_time); - SERIAL_ECHOPAIR("\nX1 Home X: ", x_home_pos(0)); - SERIAL_ECHOPAIR("\nX1_MIN_POS=", int(X1_MIN_POS)); - SERIAL_ECHOPAIR("\nX1_MAX_POS=", int(X1_MAX_POS)); - SERIAL_ECHOPAIR("\nX2 Home X: ", x_home_pos(1)); - SERIAL_ECHOPAIR("\nX2_MIN_POS=", int(X2_MIN_POS)); - SERIAL_ECHOPAIR("\nX2_MAX_POS=", int(X2_MAX_POS)); - SERIAL_ECHOPAIR("\nX2_HOME_DIR=", int(X2_HOME_DIR)); - SERIAL_ECHOPAIR("\nX2_HOME_POS=", int(X2_HOME_POS)); - SERIAL_ECHOPAIR("\nDEFAULT_DUAL_X_CARRIAGE_MODE=", STRINGIFY(DEFAULT_DUAL_X_CARRIAGE_MODE)); - SERIAL_ECHOPAIR("\nTOOLCHANGE_PARK_ZLIFT=", float(TOOLCHANGE_PARK_ZLIFT)); - SERIAL_ECHOPAIR("\nTOOLCHANGE_UNPARK_ZLIFT=", float(TOOLCHANGE_UNPARK_ZLIFT)); - SERIAL_ECHOPAIR("\nDEFAULT_DUPLICATION_X_OFFSET=", int(DEFAULT_DUPLICATION_X_OFFSET)); + #ifdef DEBUG_DXC_MODE - SERIAL_EOL(); - for (uint8_t i = 0; i < 2; i++) { - SERIAL_ECHOPAIR(" nozzle:", int(i)); - LOOP_XYZ(j) { - SERIAL_ECHOPGM(" hotend_offset["); - SERIAL_CHAR(axis_codes[j]); - SERIAL_ECHOPAIR("_AXIS][", int(i)); - SERIAL_ECHOPAIR("]=", hotend_offset[j][i]); + if (parser.seen('W')) { + SERIAL_ECHO_START(); + SERIAL_ECHOPGM("IDEX mode: "); + switch (dual_x_carriage_mode) { + case DXC_FULL_CONTROL_MODE: SERIAL_ECHOPGM("DXC_FULL_CONTROL_MODE"); break; + case DXC_AUTO_PARK_MODE: SERIAL_ECHOPGM("DXC_AUTO_PARK_MODE"); break; + case DXC_DUPLICATION_MODE: SERIAL_ECHOPGM("DXC_DUPLICATION_MODE"); break; + case DXC_SCALED_DUPLICATION_MODE: SERIAL_ECHOPGM("DXC_SCALED_DUPLICATION_MODE"); break; + } + SERIAL_ECHOPAIR("\nActive Ext: ", int(active_extruder)); + if (!active_extruder_parked) SERIAL_ECHOPGM(" NOT "); + SERIAL_ECHOPGM(" parked."); + SERIAL_ECHOPAIR("\nactive_extruder_x_pos: ", current_position[X_AXIS]); + SERIAL_ECHOPAIR("\ninactive_extruder_x_pos: ", inactive_extruder_x_pos); + SERIAL_ECHOPAIR("\nextruder_duplication_enabled: ", int(extruder_duplication_enabled)); + SERIAL_ECHOPAIR("\nduplicate_extruder_x_offset: ", duplicate_extruder_x_offset); + SERIAL_ECHOPAIR("\nduplicate_extruder_temp_offset: ", duplicate_extruder_temp_offset); + SERIAL_ECHOPAIR("\ndelayed_move_time: ", delayed_move_time); + SERIAL_ECHOPAIR("\nX1 Home X: ", x_home_pos(0)); + SERIAL_ECHOPAIR("\nX1_MIN_POS=", int(X1_MIN_POS)); + SERIAL_ECHOPAIR("\nX1_MAX_POS=", int(X1_MAX_POS)); + SERIAL_ECHOPAIR("\nX2 Home X: ", x_home_pos(1)); + SERIAL_ECHOPAIR("\nX2_MIN_POS=", int(X2_MIN_POS)); + SERIAL_ECHOPAIR("\nX2_MAX_POS=", int(X2_MAX_POS)); + SERIAL_ECHOPAIR("\nX2_HOME_DIR=", int(X2_HOME_DIR)); + SERIAL_ECHOPAIR("\nX2_HOME_POS=", int(X2_HOME_POS)); + SERIAL_ECHOPAIR("\nDEFAULT_DUAL_X_CARRIAGE_MODE=", STRINGIFY(DEFAULT_DUAL_X_CARRIAGE_MODE)); + SERIAL_ECHOPAIR("\nTOOLCHANGE_ZRAISE=", float(TOOLCHANGE_ZRAISE)); + SERIAL_ECHOPAIR("\nDEFAULT_DUPLICATION_X_OFFSET=", int(DEFAULT_DUPLICATION_X_OFFSET)); + SERIAL_EOL(); + + for (uint8_t i = 0; i < 2; i++) { + SERIAL_ECHOPAIR(" nozzle:", int(i)); + LOOP_XYZ(j) { + SERIAL_ECHOPGM(" hotend_offset["); + SERIAL_CHAR(axis_codes[j]); + SERIAL_ECHOPAIR("_AXIS][", int(i)); + SERIAL_ECHOPAIR("]=", hotend_offset[j][i]); + } + SERIAL_EOL(); } SERIAL_EOL(); } - SERIAL_EOL(); - } + #endif // DEBUG_DXC_MODE } #elif ENABLED(DUAL_NOZZLE_DUPLICATION_MODE) @@ -151,7 +153,8 @@ planner.synchronize(); extruder_duplication_enabled = parser.intval('S') == (int)DXC_DUPLICATION_MODE; SERIAL_ECHO_START(); - SERIAL_ECHOLNPAIR(MSG_DUPLICATION_MODE, extruder_duplication_enabled ? MSG_ON : MSG_OFF); + SERIAL_ECHOPGM(MSG_DUPLICATION_MODE); + serialprintln_onoff(extruder_duplication_enabled); } #endif // DUAL_NOZZLE_DUPLICATION_MODE diff --git a/Marlin/src/gcode/control/M80_M81.cpp b/Marlin/src/gcode/control/M80_M81.cpp index 4047049f54..3dbf15a794 100644 --- a/Marlin/src/gcode/control/M80_M81.cpp +++ b/Marlin/src/gcode/control/M80_M81.cpp @@ -23,10 +23,11 @@ #include "../gcode.h" #include "../../module/temperature.h" #include "../../module/stepper.h" +#include "../../module/printcounter.h" // for print_job_timer #include "../../inc/MarlinConfig.h" -#if ENABLED(ULTIPANEL) +#if HAS_LCD_MENU #include "../../lcd/ultralcd.h" #endif @@ -81,8 +82,8 @@ restore_stepper_drivers(); #endif - #if ENABLED(ULTIPANEL) - lcd_reset_status(); + #if HAS_LCD_MENU + ui.reset_status(); #endif } @@ -95,13 +96,14 @@ */ void GcodeSuite::M81() { thermalManager.disable_all_heaters(); + print_job_timer.stop(); planner.finish_and_disable(); #if FAN_COUNT > 0 - for (uint8_t i = 0; i < FAN_COUNT; i++) fanSpeeds[i] = 0; + zero_fan_speeds(); #if ENABLED(PROBING_FANS_OFF) fans_paused = false; - ZERO(paused_fanSpeeds); + ZERO(paused_fan_speed); #endif #endif @@ -113,7 +115,7 @@ void GcodeSuite::M81() { PSU_OFF(); #endif - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU LCD_MESSAGEPGM(MACHINE_NAME " " MSG_OFF "."); #endif } diff --git a/Marlin/src/gcode/control/M999.cpp b/Marlin/src/gcode/control/M999.cpp index 12c2cfdc59..18a7287aed 100644 --- a/Marlin/src/gcode/control/M999.cpp +++ b/Marlin/src/gcode/control/M999.cpp @@ -38,7 +38,7 @@ */ void GcodeSuite::M999() { Running = true; - lcd_reset_alert_level(); + ui.reset_alert_level(); if (parser.boolval('S')) return; diff --git a/Marlin/src/gcode/control/T.cpp b/Marlin/src/gcode/control/T.cpp index 3911b8fbc4..ba6db22440 100644 --- a/Marlin/src/gcode/control/T.cpp +++ b/Marlin/src/gcode/control/T.cpp @@ -23,7 +23,7 @@ #include "../gcode.h" #include "../../module/tool_change.h" -#if ENABLED(DEBUG_LEVELING_FEATURE) || HOTENDS > 1 +#if ENABLED(DEBUG_LEVELING_FEATURE) || EXTRUDERS > 1 #include "../../module/motion.h" #endif @@ -33,27 +33,27 @@ * F[units/min] Set the movement feedrate * S1 Don't move the tool in XY after change */ -void GcodeSuite::T(const uint8_t tmp_extruder) { +void GcodeSuite::T(const uint8_t tool_index) { #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) { - SERIAL_ECHOPAIR(">>> T(", tmp_extruder); + SERIAL_ECHOPAIR(">>> T(", tool_index); SERIAL_CHAR(')'); SERIAL_EOL(); DEBUG_POS("BEFORE", current_position); } #endif - #if HOTENDS == 1 || (ENABLED(MIXING_EXTRUDER) && MIXING_VIRTUAL_TOOLS > 1) + #if EXTRUDERS < 2 - tool_change(tmp_extruder); + tool_change(tool_index); - #elif HOTENDS > 1 + #else tool_change( - tmp_extruder, + tool_index, MMM_TO_MMS(parser.linearval('F')), - (tmp_extruder == active_extruder) || parser.boolval('S') + (tool_index == active_extruder) || parser.boolval('S') ); #endif diff --git a/Marlin/src/gcode/eeprom/M500-M504.cpp b/Marlin/src/gcode/eeprom/M500-M504.cpp index 8c5e3af9df..caa139b17d 100644 --- a/Marlin/src/gcode/eeprom/M500-M504.cpp +++ b/Marlin/src/gcode/eeprom/M500-M504.cpp @@ -25,6 +25,10 @@ #include "../../core/serial.h" #include "../../inc/MarlinConfig.h" +#if ENABLED(EXTENSIBLE_UI) + #include "../../lcd/extensible_ui/ui_api.h" +#endif + #if NUM_SERIAL > 1 #include "../../gcode/queue.h" #endif @@ -40,6 +44,9 @@ */ void GcodeSuite::M500() { (void)settings.save(CHAT_PORT); + #if ENABLED(EXTENSIBLE_UI) + ExtUI::onStoreSettings(); + #endif } /** @@ -51,6 +58,9 @@ void GcodeSuite::M501() { CHAT_PORT #endif ); + #if ENABLED(EXTENSIBLE_UI) + ExtUI::onLoadSettings(); + #endif } /** @@ -58,6 +68,9 @@ void GcodeSuite::M501() { */ void GcodeSuite::M502() { (void)settings.reset(CHAT_PORT); + #if ENABLED(EXTENSIBLE_UI) + ExtUI::onFactoryReset(); + #endif } #if DISABLED(DISABLE_M503) diff --git a/Marlin/src/gcode/feature/camera/M240.cpp b/Marlin/src/gcode/feature/camera/M240.cpp index 9d729acf33..1a1fb5cf65 100644 --- a/Marlin/src/gcode/feature/camera/M240.cpp +++ b/Marlin/src/gcode/feature/camera/M240.cpp @@ -22,20 +22,24 @@ #include "../../../inc/MarlinConfig.h" -#if defined(CHDK) || HAS_PHOTOGRAPH +#if PIN_EXISTS(CHDK) || HAS_PHOTOGRAPH #include "../../gcode.h" +bool chdk_active; // = false +millis_t chdk_timeout; + /** * M240: Trigger a camera by emulating a Canon RC-1 * See http://www.doc-diy.net/photo/rc-1_hacked/ */ void GcodeSuite::M240() { - #ifdef CHDK - OUT_WRITE(CHDK, HIGH); - chdkHigh = millis(); - chdkActive = true; + #if PIN_EXISTS(CHDK) + + OUT_WRITE(CHDK_PIN, HIGH); + chdk_timeout = millis() + CHDK_DELAY; + chdk_active = true; #elif HAS_PHOTOGRAPH @@ -58,4 +62,4 @@ void GcodeSuite::M240() { #endif } -#endif // CHDK || HAS_PHOTOGRAPH +#endif // CHDK_PIN || HAS_PHOTOGRAPH diff --git a/Marlin/src/gcode/feature/fwretract/M207-M209.cpp b/Marlin/src/gcode/feature/fwretract/M207-M209.cpp index fb214ed737..b6f94f2edf 100644 --- a/Marlin/src/gcode/feature/fwretract/M207-M209.cpp +++ b/Marlin/src/gcode/feature/fwretract/M207-M209.cpp @@ -33,13 +33,13 @@ * S[+units] retract_length * W[+units] swap_retract_length (multi-extruder) * F[units/min] retract_feedrate_mm_s - * Z[units] retract_zlift + * Z[units] retract_zraise */ void GcodeSuite::M207() { - if (parser.seen('S')) fwretract.retract_length = parser.value_axis_units(E_AXIS); - if (parser.seen('F')) fwretract.retract_feedrate_mm_s = MMM_TO_MMS(parser.value_axis_units(E_AXIS)); - if (parser.seen('Z')) fwretract.retract_zlift = parser.value_linear_units(); - if (parser.seen('W')) fwretract.swap_retract_length = parser.value_axis_units(E_AXIS); + if (parser.seen('S')) fwretract.settings.retract_length = parser.value_axis_units(E_AXIS); + if (parser.seen('F')) fwretract.settings.retract_feedrate_mm_s = MMM_TO_MMS(parser.value_axis_units(E_AXIS)); + if (parser.seen('Z')) fwretract.settings.retract_zraise = parser.value_linear_units(); + if (parser.seen('W')) fwretract.settings.swap_retract_length = parser.value_axis_units(E_AXIS); } /** @@ -51,10 +51,10 @@ void GcodeSuite::M207() { * R[units/min] swap_retract_recover_feedrate_mm_s */ void GcodeSuite::M208() { - if (parser.seen('S')) fwretract.retract_recover_length = parser.value_axis_units(E_AXIS); - if (parser.seen('F')) fwretract.retract_recover_feedrate_mm_s = MMM_TO_MMS(parser.value_axis_units(E_AXIS)); - if (parser.seen('R')) fwretract.swap_retract_recover_feedrate_mm_s = MMM_TO_MMS(parser.value_axis_units(E_AXIS)); - if (parser.seen('W')) fwretract.swap_retract_recover_length = parser.value_axis_units(E_AXIS); + if (parser.seen('S')) fwretract.settings.retract_recover_length = parser.value_axis_units(E_AXIS); + if (parser.seen('F')) fwretract.settings.retract_recover_feedrate_mm_s = MMM_TO_MMS(parser.value_axis_units(E_AXIS)); + if (parser.seen('R')) fwretract.settings.swap_retract_recover_feedrate_mm_s = MMM_TO_MMS(parser.value_axis_units(E_AXIS)); + if (parser.seen('W')) fwretract.settings.swap_retract_recover_length = parser.value_axis_units(E_AXIS); } #if ENABLED(FWRETRACT_AUTORETRACT) diff --git a/Marlin/src/gcode/feature/macro/M810-M819.cpp b/Marlin/src/gcode/feature/macro/M810-M819.cpp new file mode 100644 index 0000000000..3e8a0e04b4 --- /dev/null +++ b/Marlin/src/gcode/feature/macro/M810-M819.cpp @@ -0,0 +1,67 @@ +/** + * 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 "../../../inc/MarlinConfig.h" + +#if ENABLED(GCODE_MACROS) + +#include "../../gcode.h" +#include "../../queue.h" +#include "../../parser.h" + +char gcode_macros[GCODE_MACROS_SLOTS][GCODE_MACROS_SLOT_SIZE + 1] = {{ 0 }}; + +/** + * M810_819: Set/execute a G-code macro. + * + * Usage: + * M810 |... Set Macro 0 to the given commands, separated by the pipe character + * M810 Execute Macro 0 + */ +void GcodeSuite::M810_819() { + const uint8_t index = parser.codenum - 810; + if (index >= GCODE_MACROS_SLOTS) return; + + const size_t len = strlen(parser.string_arg); + + if (len) { + // Set a macro + if (len > GCODE_MACROS_SLOT_SIZE) { + SERIAL_ERROR_START(); + SERIAL_ERRORLNPGM("Macro too long."); + } + else { + char c, *s = parser.string_arg, *d = gcode_macros[index]; + do { + c = *s++; + *d++ = c == '|' ? '\n' : c; + } while (c); + } + } + else { + // Execute a macro + char * const cmd = gcode_macros[index]; + if (strlen(cmd)) process_subcommands_now(cmd); + } +} + +#endif // GCODE_MACROS diff --git a/Marlin/src/gcode/feature/mixing/M163-M165.cpp b/Marlin/src/gcode/feature/mixing/M163-M165.cpp index 3fa478b834..2e744d70f1 100644 --- a/Marlin/src/gcode/feature/mixing/M163-M165.cpp +++ b/Marlin/src/gcode/feature/mixing/M163-M165.cpp @@ -30,7 +30,7 @@ /** * M163: Set a single mix factor for a mixing extruder * This is called "weight" by some systems. - * The 'P' values must sum to 1.0 or must be followed by M164 to normalize them. + * Must be followed by M164 to normalize and commit them. * * S[index] The channel index to set * P[float] The mix value @@ -38,32 +38,33 @@ void GcodeSuite::M163() { const int mix_index = parser.intval('S'); if (mix_index < MIXING_STEPPERS) - mixing_factor[mix_index] = MAX(parser.floatval('P'), 0.0); + mixer.set_M163_collector(mix_index, MAX(parser.floatval('P'), 0.0)); } /** * M164: Normalize and commit the mix. - * If 'S' is given store as a virtual tool. (Requires MIXING_VIRTUAL_TOOLS > 1) * * S[index] The virtual tool to store + * If 'S' is omitted update the active virtual tool. */ void GcodeSuite::M164() { - normalize_mix(); #if MIXING_VIRTUAL_TOOLS > 1 const int tool_index = parser.intval('S', -1); - if (WITHIN(tool_index, 0, MIXING_VIRTUAL_TOOLS - 1)) { - for (uint8_t i = 0; i < MIXING_STEPPERS; i++) - mixing_virtual_tool_mix[tool_index][i] = mixing_factor[i]; - } + #else + constexpr int tool_index = 0; #endif + if (WITHIN(tool_index, 0, MIXING_VIRTUAL_TOOLS - 1)) + mixer.normalize(tool_index); + else + mixer.normalize(mixer.get_current_v_tool()); } #if ENABLED(DIRECT_MIXING_IN_G1) /** * M165: Set multiple mix factors for a mixing extruder. - * Factors that are left out will be set to 0. - * All factors should sum to 1.0, but they will be normalized regardless. + * Omitted factors will be set to 0. + * The mix is normalized and stored in the current virtual tool. * * A[factor] Mix factor for extruder stepper 1 * B[factor] Mix factor for extruder stepper 2 @@ -72,7 +73,39 @@ void GcodeSuite::M164() { * H[factor] Mix factor for extruder stepper 5 * I[factor] Mix factor for extruder stepper 6 */ - void GcodeSuite::M165() { gcode_get_mix(); } + void GcodeSuite::M165() { + // Get mixing parameters from the GCode + // The total "must" be 1.0 (but it will be normalized) + // If no mix factors are given, the old mix is preserved + const char mixing_codes[] = { 'A', 'B' + #if MIXING_STEPPERS > 2 + , 'C' + #if MIXING_STEPPERS > 3 + , 'D' + #if MIXING_STEPPERS > 4 + , 'H' + #if MIXING_STEPPERS > 5 + , 'I' + #endif // MIXING_STEPPERS > 5 + #endif // MIXING_STEPPERS > 4 + #endif // MIXING_STEPPERS > 3 + #endif // MIXING_STEPPERS > 2 + }; + uint8_t mix_bits = 0; + MIXER_STEPPER_LOOP(i) { + if (parser.seenval(mixing_codes[i])) { + SBI(mix_bits, i); + mixer.set_M163_collector(i, MAX(parser.value_float(), 0.0f)); + } + } + // If any mixing factors were included, clear the rest + // If none were included, preserve the last mix + if (mix_bits) { + MIXER_STEPPER_LOOP(i) + if (!TEST(mix_bits, i)) mixer.set_M163_collector(i, 0.0f); + mixer.normalize(mixer.get_current_v_tool()); + } + } #endif // DIRECT_MIXING_IN_G1 diff --git a/Marlin/src/gcode/feature/pause/M125.cpp b/Marlin/src/gcode/feature/pause/M125.cpp index 7143392465..ed98b8fc2c 100644 --- a/Marlin/src/gcode/feature/pause/M125.cpp +++ b/Marlin/src/gcode/feature/pause/M125.cpp @@ -28,10 +28,8 @@ #include "../../parser.h" #include "../../../feature/pause.h" #include "../../../module/motion.h" - -#if DISABLED(SDSUPPORT) - #include "../../../module/printcounter.h" -#endif +#include "../../../sd/cardreader.h" +#include "../../../module/printcounter.h" /** * M125: Store current position and move to filament change position. @@ -70,20 +68,15 @@ void GcodeSuite::M125() { park_point.y += (active_extruder ? hotend_offset[Y_AXIS][active_extruder] : 0); #endif - #if DISABLED(SDSUPPORT) - const bool job_running = print_job_timer.isRunning(); - #endif + const bool job_running = print_job_timer.isRunning(), + sd_printing = IS_SD_PRINTING(); if (pause_print(retract, park_point)) { - #if DISABLED(SDSUPPORT) - // Wait for lcd click or M108 - wait_for_filament_reload(); - - // Return to print position and continue + if (!sd_printing) { + wait_for_confirmation(); resume_print(); - - if (job_running) print_job_timer.start(); - #endif + } + if (job_running) print_job_timer.start(); } } diff --git a/Marlin/src/gcode/feature/pause/M600.cpp b/Marlin/src/gcode/feature/pause/M600.cpp index c471e03c6d..850bbb3441 100644 --- a/Marlin/src/gcode/feature/pause/M600.cpp +++ b/Marlin/src/gcode/feature/pause/M600.cpp @@ -33,7 +33,7 @@ #include "../../../module/tool_change.h" #endif -#if ENABLED(ULTIPANEL) +#if HAS_LCD_MENU #include "../../../lcd/ultralcd.h" #endif @@ -54,7 +54,8 @@ void GcodeSuite::M600() { point_t park_point = NOZZLE_PARK_POINT; - if (get_target_extruder_from_command()) return; + const int8_t target_extruder = get_target_extruder_from_command(); + if (target_extruder < 0) return; #if ENABLED(DUAL_X_CARRIAGE) int8_t DXC_ext = target_extruder; @@ -70,7 +71,7 @@ void GcodeSuite::M600() { #endif // Show initial "wait for start" message - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INIT, ADVANCED_PAUSE_MODE_PAUSE_PRINT, target_extruder); #endif @@ -111,14 +112,14 @@ void GcodeSuite::M600() { // Unload filament const float unload_length = -ABS(parser.seen('U') ? parser.value_axis_units(E_AXIS) - : filament_change_unload_length[active_extruder]); + : fc_settings[active_extruder].unload_length); // Slow load filament constexpr float slow_load_length = FILAMENT_CHANGE_SLOW_LOAD_LENGTH; // Fast load filament const float fast_load_length = ABS(parser.seen('L') ? parser.value_axis_units(E_AXIS) - : filament_change_load_length[active_extruder]); + : fc_settings[active_extruder].load_length); const int beep_count = parser.intval('B', #ifdef FILAMENT_CHANGE_ALERT_BEEPS @@ -131,7 +132,7 @@ void GcodeSuite::M600() { const bool job_running = print_job_timer.isRunning(); if (pause_print(retract, park_point, unload_length, true DXC_PASS)) { - wait_for_filament_reload(beep_count DXC_PASS); + wait_for_confirmation(true, beep_count DXC_PASS); resume_print(slow_load_length, fast_load_length, ADVANCED_PAUSE_PURGE_LENGTH, beep_count DXC_PASS); } diff --git a/Marlin/src/gcode/feature/pause/M603.cpp b/Marlin/src/gcode/feature/pause/M603.cpp index a6231c3169..e4a5e5eaa9 100644 --- a/Marlin/src/gcode/feature/pause/M603.cpp +++ b/Marlin/src/gcode/feature/pause/M603.cpp @@ -43,21 +43,22 @@ */ void GcodeSuite::M603() { - if (get_target_extruder_from_command()) return; + const int8_t target_extruder = get_target_extruder_from_command(); + if (target_extruder < 0) return; // Unload length if (parser.seen('U')) { - filament_change_unload_length[target_extruder] = ABS(parser.value_axis_units(E_AXIS)); + fc_settings[target_extruder].unload_length = ABS(parser.value_axis_units(E_AXIS)); #if ENABLED(PREVENT_LENGTHY_EXTRUDE) - NOMORE(filament_change_unload_length[target_extruder], EXTRUDE_MAXLENGTH); + NOMORE(fc_settings[target_extruder].unload_length, EXTRUDE_MAXLENGTH); #endif } // Load length if (parser.seen('L')) { - filament_change_load_length[target_extruder] = ABS(parser.value_axis_units(E_AXIS)); + fc_settings[target_extruder].load_length = ABS(parser.value_axis_units(E_AXIS)); #if ENABLED(PREVENT_LENGTHY_EXTRUDE) - NOMORE(filament_change_load_length[target_extruder], EXTRUDE_MAXLENGTH); + NOMORE(fc_settings[target_extruder].load_length, EXTRUDE_MAXLENGTH); #endif } } diff --git a/Marlin/src/gcode/feature/pause/M701_M702.cpp b/Marlin/src/gcode/feature/pause/M701_M702.cpp index 1203b6bd09..fa9be253e2 100644 --- a/Marlin/src/gcode/feature/pause/M701_M702.cpp +++ b/Marlin/src/gcode/feature/pause/M701_M702.cpp @@ -34,7 +34,7 @@ #include "../../../module/tool_change.h" #endif -#if ENABLED(ULTIPANEL) +#if HAS_LCD_MENU #include "../../../lcd/ultralcd.h" #endif @@ -55,13 +55,15 @@ void GcodeSuite::M701() { if (axis_unhomed_error()) park_point.z = 0; #endif - if (get_target_extruder_from_command()) return; + const int8_t target_extruder = get_target_extruder_from_command(); + if (target_extruder < 0) return; + // Z axis lift if (parser.seenval('Z')) park_point.z = parser.linearval('Z'); // Show initial "wait for load" message - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_LOAD, ADVANCED_PAUSE_MODE_LOAD_FILAMENT, target_extruder); #endif @@ -79,9 +81,9 @@ void GcodeSuite::M701() { // Load filament 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) - : filament_change_load_length[active_extruder]); + : fc_settings[active_extruder].load_length); load_filament(slow_load_length, fast_load_length, ADVANCED_PAUSE_PURGE_LENGTH, FILAMENT_CHANGE_ALERT_BEEPS, - true, thermalManager.wait_for_heating(target_extruder), ADVANCED_PAUSE_MODE_LOAD_FILAMENT + true, thermalManager.still_heating(target_extruder), ADVANCED_PAUSE_MODE_LOAD_FILAMENT #if ENABLED(DUAL_X_CARRIAGE) , target_extruder #endif @@ -98,7 +100,7 @@ void GcodeSuite::M701() { #endif // Show status screen - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_STATUS); #endif } @@ -121,13 +123,14 @@ void GcodeSuite::M702() { if (axis_unhomed_error()) park_point.z = 0; #endif - if (get_target_extruder_from_command()) return; + const int8_t target_extruder = get_target_extruder_from_command(); + if (target_extruder < 0) return; // Z axis lift if (parser.seenval('Z')) park_point.z = parser.linearval('Z'); // Show initial "wait for unload" message - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_UNLOAD, ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT, target_extruder); #endif @@ -147,15 +150,15 @@ void GcodeSuite::M702() { if (!parser.seenval('T')) { HOTEND_LOOP() { if (e != active_extruder) tool_change(e, 0, true); - unload_filament(-filament_change_unload_length[e], true, ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT); + unload_filament(-fc_settings[e].unload_length, true, ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT); } } else #endif { // Unload length - const float unload_length = -ABS(parser.seen('U') ? parser.value_axis_units(E_AXIS) : - filament_change_unload_length[target_extruder]); + const float unload_length = -ABS(parser.seen('U') ? parser.value_axis_units(E_AXIS) + : fc_settings[target_extruder].unload_length); unload_filament(unload_length, true, ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT); } @@ -171,7 +174,7 @@ void GcodeSuite::M702() { #endif // Show status screen - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_STATUS); #endif } diff --git a/Marlin/src/gcode/feature/powerloss/M1000.cpp b/Marlin/src/gcode/feature/powerloss/M1000.cpp new file mode 100644 index 0000000000..21862aa552 --- /dev/null +++ b/Marlin/src/gcode/feature/powerloss/M1000.cpp @@ -0,0 +1,65 @@ +/** + * 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 "../../../inc/MarlinConfig.h" + +#if ENABLED(POWER_LOSS_RECOVERY) + +#include "../../gcode.h" +#include "../../../feature/power_loss_recovery.h" +#include "../../../module/motion.h" +#include "../../../lcd/ultralcd.h" + +void menu_job_recovery(); + +#if ENABLED(DEBUG_POWER_LOSS_RECOVERY) + + inline void plr_error(PGM_P const prefix) { + SERIAL_ECHO_START(); + serialprintPGM(prefix); + SERIAL_ECHOLNPGM(" Power-Loss Recovery Data"); + } + +#endif + +/** + * M1000: Resume from power-loss (undocumented) + * - With 'S' go to the Resume/Cancel menu + * - With no parameters, run recovery commands + */ +void GcodeSuite::M1000() { + + if (recovery.valid()) { + if (parser.seen('S')) + ui.goto_screen(menu_job_recovery); + else + recovery.resume(); + } + else { + #if ENABLED(DEBUG_POWER_LOSS_RECOVERY) + plr_error(recovery.info.valid_head ? PSTR("No") : PSTR("Invalid")); + #endif + } + +} + +#endif // POWER_LOSS_RECOVERY diff --git a/Marlin/src/gcode/feature/powerloss/M413.cpp b/Marlin/src/gcode/feature/powerloss/M413.cpp new file mode 100644 index 0000000000..b63645a2a6 --- /dev/null +++ b/Marlin/src/gcode/feature/powerloss/M413.cpp @@ -0,0 +1,58 @@ +/** + * 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 "../../../inc/MarlinConfig.h" + +#if ENABLED(POWER_LOSS_RECOVERY) + +#include "../../gcode.h" +#include "../../../feature/power_loss_recovery.h" +#include "../../../module/motion.h" +#include "../../../lcd/ultralcd.h" + +/** + * M413: Enable / Disable power-loss recovery + * + * Parameters + * S[bool] - Flag to enable / disable. + * If omitted, report current state. + */ +void GcodeSuite::M413() { + + if (parser.seen('S')) + recovery.enable(parser.value_bool()); + else { + SERIAL_ECHO_START(); + SERIAL_ECHOPGM("Power-loss recovery "); + serialprintln_onoff(recovery.enabled); + } + + #if ENABLED(DEBUG_POWER_LOSS_RECOVERY) + if (parser.seen('R') || parser.seen('L')) recovery.load(); + if (parser.seen('W')) recovery.save(true); + if (parser.seen('P')) recovery.purge(); + if (parser.seen('E')) serialprintPGM(recovery.exists() ? PSTR("BIN Exists\n") : PSTR("No BIN\n")); + if (parser.seen('V')) serialprintPGM(recovery.valid() ? PSTR("Valid\n") : PSTR("Invalid\n")); + #endif +} + +#endif // POWER_LOSS_RECOVERY diff --git a/Marlin/src/gcode/feature/runout/M412.cpp b/Marlin/src/gcode/feature/runout/M412.cpp new file mode 100644 index 0000000000..577f9d705d --- /dev/null +++ b/Marlin/src/gcode/feature/runout/M412.cpp @@ -0,0 +1,45 @@ +/** + * 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 "../../../inc/MarlinConfig.h" + +#if ENABLED(FILAMENT_RUNOUT_SENSOR) + +#include "../../gcode.h" +#include "../../../feature/runout.h" + +/** + * M412: Enable / Disable filament runout detection + */ +void GcodeSuite::M412() { + if (parser.seen('S')) { + runout.reset(); + runout.enabled = parser.value_bool(); + } + else { + SERIAL_ECHO_START(); + SERIAL_ECHOPGM("Filament runout "); + serialprintln_onoff(runout.enabled); + } +} + +#endif // FILAMENT_RUNOUT_SENSOR diff --git a/Marlin/src/gcode/feature/trinamic/M122.cpp b/Marlin/src/gcode/feature/trinamic/M122.cpp index 42899613d3..73e6b3c846 100644 --- a/Marlin/src/gcode/feature/trinamic/M122.cpp +++ b/Marlin/src/gcode/feature/trinamic/M122.cpp @@ -31,10 +31,14 @@ * M122: Debug TMC drivers */ void GcodeSuite::M122() { - if (parser.seen('S')) - tmc_set_report_status(parser.value_bool()); - else - tmc_report_all(); + + #if ENABLED(MONITOR_DRIVER_STATUS) + if (parser.seen('S')) + tmc_set_report_status(parser.value_bool()); + else + #endif + tmc_report_all(); + } #endif // TMC_DEBUG diff --git a/Marlin/src/gcode/feature/trinamic/M906.cpp b/Marlin/src/gcode/feature/trinamic/M906.cpp index e727d3e30a..1ff2825466 100644 --- a/Marlin/src/gcode/feature/trinamic/M906.cpp +++ b/Marlin/src/gcode/feature/trinamic/M906.cpp @@ -33,11 +33,15 @@ * Report driver currents when no axis specified */ void GcodeSuite::M906() { - #define TMC_SAY_CURRENT(Q) tmc_get_current(stepper##Q, TMC_##Q) + #define TMC_SAY_CURRENT(Q) tmc_get_current(stepper##Q) #define TMC_SET_CURRENT(Q) tmc_set_current(stepper##Q, value) bool report = true; - const uint8_t index = parser.byteval('I'); + + #if AXIS_IS_TMC(X) || AXIS_IS_TMC(X2) || AXIS_IS_TMC(Y) || AXIS_IS_TMC(Y2) || AXIS_IS_TMC(Z) || AXIS_IS_TMC(Z2) || AXIS_IS_TMC(Z3) + const uint8_t index = parser.byteval('I'); + #endif + LOOP_XYZE(i) if (uint16_t value = parser.intval(axis_codes[i])) { report = false; switch (i) { @@ -69,7 +73,8 @@ void GcodeSuite::M906() { #endif break; case E_AXIS: { - if (get_target_extruder_from_command()) return; + const int8_t target_extruder = get_target_extruder_from_command(); + if (target_extruder < 0) return; switch (target_extruder) { #if AXIS_IS_TMC(E0) case 0: TMC_SET_CURRENT(E0); break; diff --git a/Marlin/src/gcode/feature/trinamic/M911-M915.cpp b/Marlin/src/gcode/feature/trinamic/M911-M915.cpp index b24e901f82..ee134067e3 100644 --- a/Marlin/src/gcode/feature/trinamic/M911-M915.cpp +++ b/Marlin/src/gcode/feature/trinamic/M911-M915.cpp @@ -30,142 +30,177 @@ #include "../../../module/planner.h" #include "../../queue.h" -#define M91x_USE(ST) (AXIS_DRIVER_TYPE(ST, TMC2130) || (AXIS_DRIVER_TYPE(ST, TMC2208) && PIN_EXISTS(ST##_SERIAL_RX))) -#define M91x_USE_E(N) (E_STEPPERS > N && M91x_USE(E##N)) +#if ENABLED(MONITOR_DRIVER_STATUS) -/** - * M911: Report TMC stepper driver overtemperature pre-warn flag - * This flag is held by the library, persisting until cleared by M912 - */ -void GcodeSuite::M911() { - #if M91x_USE(X) - tmc_report_otpw(stepperX, TMC_X); - #endif - #if M91x_USE(X2) - tmc_report_otpw(stepperX2, TMC_X2); - #endif - #if M91x_USE(Y) - tmc_report_otpw(stepperY, TMC_Y); - #endif - #if M91x_USE(Y2) - tmc_report_otpw(stepperY2, TMC_Y2); - #endif - #if M91x_USE(Z) - tmc_report_otpw(stepperZ, TMC_Z); - #endif - #if M91x_USE(Z2) - tmc_report_otpw(stepperZ2, TMC_Z2); - #endif - #if M91x_USE(Z3) - tmc_report_otpw(stepperZ3, TMC_Z3); - #endif - #if M91x_USE_E(0) - tmc_report_otpw(stepperE0, TMC_E0); - #endif - #if M91x_USE_E(1) - tmc_report_otpw(stepperE1, TMC_E1); - #endif - #if M91x_USE_E(2) - tmc_report_otpw(stepperE2, TMC_E2); - #endif - #if M91x_USE_E(3) - tmc_report_otpw(stepperE3, TMC_E3); - #endif - #if M91x_USE_E(4) - tmc_report_otpw(stepperE4, TMC_E4); - #endif - #if M91x_USE_E(5) - tmc_report_otpw(stepperE5, TMC_E5); - #endif -} + #define M91x_USE(ST) (AXIS_DRIVER_TYPE(ST, TMC2130) || AXIS_DRIVER_TYPE(ST, TMC2208) || AXIS_DRIVER_TYPE(ST, TMC2660)) + #define M91x_USE_E(N) (E_STEPPERS > N && M91x_USE(E##N)) -/** - * M912: Clear TMC stepper driver overtemperature pre-warn flag held by the library - * Specify one or more axes with X, Y, Z, X1, Y1, Z1, X2, Y2, Z2, Z3 and E[index]. - * If no axes are given, clear all. - * - * Examples: - * M912 X ; clear X and X2 - * M912 X1 ; clear X1 only - * M912 X2 ; clear X2 only - * M912 X E ; clear X, X2, and all E - * M912 E1 ; clear E1 only - */ -void GcodeSuite::M912() { - const bool hasX = parser.seen(axis_codes[X_AXIS]), - hasY = parser.seen(axis_codes[Y_AXIS]), - hasZ = parser.seen(axis_codes[Z_AXIS]), - hasE = parser.seen(axis_codes[E_AXIS]), - hasNone = !hasX && !hasY && !hasZ && !hasE; + #define M91x_SOME_X (M91x_USE(X) || M91x_USE(X2)) + #define M91x_SOME_Y (M91x_USE(Y) || M91x_USE(Y2)) + #define M91x_SOME_Z (M91x_USE(Z) || M91x_USE(Z2) || M91x_USE(Z3)) + #define M91x_SOME_E (M91x_USE_E(0) || M91x_USE_E(1) || M91x_USE_E(2) || M91x_USE_E(3) || M91x_USE_E(4) || M91x_USE_E(5)) - #if M91x_USE(X) || M91x_USE(X2) + #if !M91x_SOME_X && !M91x_SOME_Y && !M91x_SOME_Z && !M91x_SOME_E + #error "MONITOR_DRIVER_STATUS requires at least one TMC2130, TMC2208, or TMC2660." + #endif + + /** + * M911: Report TMC stepper driver overtemperature pre-warn flag + * This flag is held by the library, persisting until cleared by M912 + */ + void GcodeSuite::M911() { + #if M91x_USE(X) + tmc_report_otpw(stepperX); + #endif + #if M91x_USE(X2) + tmc_report_otpw(stepperX2); + #endif + #if M91x_USE(Y) + tmc_report_otpw(stepperY); + #endif + #if M91x_USE(Y2) + tmc_report_otpw(stepperY2); + #endif + #if M91x_USE(Z) + tmc_report_otpw(stepperZ); + #endif + #if M91x_USE(Z2) + tmc_report_otpw(stepperZ2); + #endif + #if M91x_USE(Z3) + tmc_report_otpw(stepperZ3); + #endif + #if M91x_USE_E(0) + tmc_report_otpw(stepperE0); + #endif + #if M91x_USE_E(1) + tmc_report_otpw(stepperE1); + #endif + #if M91x_USE_E(2) + tmc_report_otpw(stepperE2); + #endif + #if M91x_USE_E(3) + tmc_report_otpw(stepperE3); + #endif + #if M91x_USE_E(4) + tmc_report_otpw(stepperE4); + #endif + #if M91x_USE_E(5) + tmc_report_otpw(stepperE5); + #endif + } + + /** + * M912: Clear TMC stepper driver overtemperature pre-warn flag held by the library + * Specify one or more axes with X, Y, Z, X1, Y1, Z1, X2, Y2, Z2, Z3 and E[index]. + * If no axes are given, clear all. + * + * Examples: + * M912 X ; clear X and X2 + * M912 X1 ; clear X1 only + * M912 X2 ; clear X2 only + * M912 X E ; clear X, X2, and all E + * M912 E1 ; clear E1 only + */ + void GcodeSuite::M912() { + #if M91x_SOME_X + const bool hasX = parser.seen(axis_codes[X_AXIS]); + #else + constexpr bool hasX = false; + #endif + + #if M91x_SOME_Y + const bool hasY = parser.seen(axis_codes[Y_AXIS]); + #else + constexpr bool hasY = false; + #endif + + #if M91x_SOME_Z + const bool hasZ = parser.seen(axis_codes[Z_AXIS]); + #else + constexpr bool hasZ = false; + #endif + + #if M91x_SOME_E + const bool hasE = parser.seen(axis_codes[E_AXIS]); + #else + constexpr bool hasE = false; + #endif + + const bool hasNone = !hasX && !hasY && !hasZ && !hasE; + + #if M91x_SOME_X const int8_t xval = int8_t(parser.byteval(axis_codes[X_AXIS], 0xFF)); #if M91x_USE(X) - if (hasNone || xval == 1 || (hasX && xval < 0)) tmc_clear_otpw(stepperX, TMC_X); + if (hasNone || xval == 1 || (hasX && xval < 0)) tmc_clear_otpw(stepperX); #endif #if M91x_USE(X2) - if (hasNone || xval == 2 || (hasX && xval < 0)) tmc_clear_otpw(stepperX2, TMC_X2); + if (hasNone || xval == 2 || (hasX && xval < 0)) tmc_clear_otpw(stepperX2); #endif #endif - #if M91x_USE(Y) || M91x_USE(Y2) + #if M91x_SOME_Y const int8_t yval = int8_t(parser.byteval(axis_codes[Y_AXIS], 0xFF)); #if M91x_USE(Y) - if (hasNone || yval == 1 || (hasY && yval < 0)) tmc_clear_otpw(stepperY, TMC_Y); + if (hasNone || yval == 1 || (hasY && yval < 0)) tmc_clear_otpw(stepperY); #endif #if M91x_USE(Y2) - if (hasNone || yval == 2 || (hasY && yval < 0)) tmc_clear_otpw(stepperY2, TMC_Y2); + if (hasNone || yval == 2 || (hasY && yval < 0)) tmc_clear_otpw(stepperY2); #endif #endif - #if M91x_USE(Z) || M91x_USE(Z2) || M91x_USE(Z3) + #if M91x_SOME_Z const int8_t zval = int8_t(parser.byteval(axis_codes[Z_AXIS], 0xFF)); #if M91x_USE(Z) - if (hasNone || zval == 1 || (hasZ && zval < 0)) tmc_clear_otpw(stepperZ, TMC_Z); + if (hasNone || zval == 1 || (hasZ && zval < 0)) tmc_clear_otpw(stepperZ); #endif #if M91x_USE(Z2) - if (hasNone || zval == 2 || (hasZ && zval < 0)) tmc_clear_otpw(stepperZ2, TMC_Z2); + if (hasNone || zval == 2 || (hasZ && zval < 0)) tmc_clear_otpw(stepperZ2); #endif #if M91x_USE(Z3) - if (hasNone || zval == 3 || (hasZ && zval < 0)) tmc_clear_otpw(stepperZ3, TMC_Z3); + if (hasNone || zval == 3 || (hasZ && zval < 0)) tmc_clear_otpw(stepperZ3); #endif #endif - #if M91x_USE_E(0) || M91x_USE_E(1) || M91x_USE_E(2) || M91x_USE_E(3) || M91x_USE_E(4) || M91x_USE_E(5) - const uint8_t eval = int8_t(parser.byteval(axis_codes[E_AXIS], 0xFF)); + #if M91x_SOME_E + const int8_t eval = int8_t(parser.byteval(axis_codes[E_AXIS], 0xFF)); #if M91x_USE_E(0) - if (hasNone || eval == 0 || (hasE && eval < 0)) tmc_clear_otpw(stepperE0, TMC_E0); + if (hasNone || eval == 0 || (hasE && eval < 0)) tmc_clear_otpw(stepperE0); #endif #if M91x_USE_E(1) - if (hasNone || eval == 1 || (hasE && eval < 0)) tmc_clear_otpw(stepperE1, TMC_E1); + if (hasNone || eval == 1 || (hasE && eval < 0)) tmc_clear_otpw(stepperE1); #endif #if M91x_USE_E(2) - if (hasNone || eval == 2 || (hasE && eval < 0)) tmc_clear_otpw(stepperE2, TMC_E2); + if (hasNone || eval == 2 || (hasE && eval < 0)) tmc_clear_otpw(stepperE2); #endif #if M91x_USE_E(3) - if (hasNone || eval == 3 || (hasE && eval < 0)) tmc_clear_otpw(stepperE3, TMC_E3); + if (hasNone || eval == 3 || (hasE && eval < 0)) tmc_clear_otpw(stepperE3); #endif #if M91x_USE_E(4) - if (hasNone || eval == 4 || (hasE && eval < 0)) tmc_clear_otpw(stepperE4, TMC_E4); + if (hasNone || eval == 4 || (hasE && eval < 0)) tmc_clear_otpw(stepperE4); #endif #if M91x_USE_E(5) - if (hasNone || eval == 5 || (hasE && eval < 0)) tmc_clear_otpw(stepperE5, TMC_E5); + if (hasNone || eval == 5 || (hasE && eval < 0)) tmc_clear_otpw(stepperE5); #endif #endif -} + } + +#endif // MONITOR_DRIVER_STATUS /** * M913: Set HYBRID_THRESHOLD speed. */ #if ENABLED(HYBRID_THRESHOLD) void GcodeSuite::M913() { - #define TMC_SAY_PWMTHRS(A,Q) tmc_get_pwmthrs(stepper##Q, TMC_##Q, planner.axis_steps_per_mm[_AXIS(A)]) - #define TMC_SET_PWMTHRS(A,Q) tmc_set_pwmthrs(stepper##Q, value, planner.axis_steps_per_mm[_AXIS(A)]) - #define TMC_SAY_PWMTHRS_E(E) do{ constexpr uint8_t extruder = E; tmc_get_pwmthrs(stepperE##E, TMC_E##E, planner.axis_steps_per_mm[E_AXIS_N]); UNUSED(extruder); }while(0) - #define TMC_SET_PWMTHRS_E(E) do{ constexpr uint8_t extruder = E; tmc_set_pwmthrs(stepperE##E, value, planner.axis_steps_per_mm[E_AXIS_N]); UNUSED(extruder); }while(0) + #define TMC_SAY_PWMTHRS(A,Q) tmc_get_pwmthrs(stepper##Q, planner.settings.axis_steps_per_mm[_AXIS(A)]) + #define TMC_SET_PWMTHRS(A,Q) tmc_set_pwmthrs(stepper##Q, value, planner.settings.axis_steps_per_mm[_AXIS(A)]) + #define TMC_SAY_PWMTHRS_E(E) tmc_get_pwmthrs(stepperE##E, planner.settings.axis_steps_per_mm[E_AXIS_N(E)]) + #define TMC_SET_PWMTHRS_E(E) tmc_set_pwmthrs(stepperE##E, value, planner.settings.axis_steps_per_mm[E_AXIS_N(E)]) bool report = true; - const uint8_t index = parser.byteval('I'); + #if AXIS_IS_TMC(X) || AXIS_IS_TMC(X2) || AXIS_IS_TMC(Y) || AXIS_IS_TMC(Y2) || AXIS_IS_TMC(Z) || AXIS_IS_TMC(Z2) || AXIS_IS_TMC(Z3) + const uint8_t index = parser.byteval('I'); + #endif LOOP_XYZE(i) if (int32_t value = parser.longval(axis_codes[i])) { report = false; switch (i) { @@ -197,7 +232,8 @@ void GcodeSuite::M912() { #endif break; case E_AXIS: { - if (get_target_extruder_from_command()) return; + const int8_t target_extruder = get_target_extruder_from_command(); + if (target_extruder < 0) return; switch (target_extruder) { #if AXIS_HAS_STEALTHCHOP(E0) case 0: TMC_SET_PWMTHRS_E(0); break; @@ -267,11 +303,11 @@ void GcodeSuite::M912() { #endif // HYBRID_THRESHOLD /** - * M914: Set SENSORLESS_HOMING sensitivity. + * M914: Set StallGuard sensitivity. */ -#if ENABLED(SENSORLESS_HOMING) +#if USE_SENSORLESS void GcodeSuite::M914() { - #define TMC_SAY_SGT(Q) tmc_get_sgt(stepper##Q, TMC_##Q) + #define TMC_SAY_SGT(Q) tmc_get_sgt(stepper##Q) #define TMC_SET_SGT(Q) tmc_set_sgt(stepper##Q, value) bool report = true; @@ -346,7 +382,7 @@ void GcodeSuite::M912() { #endif } } -#endif // SENSORLESS_HOMING +#endif // USE_SENSORLESS /** * TMC Z axis calibration routine @@ -362,16 +398,16 @@ void GcodeSuite::M912() { } #if AXIS_IS_TMC(Z) - const uint16_t Z_current_1 = stepperZ.getCurrent(); - stepperZ.setCurrent(_rms, R_SENSE, HOLD_MULTIPLIER); + const uint16_t Z_current_1 = stepperZ.getMilliamps(); + stepperZ.rms_current(_rms); #endif #if AXIS_IS_TMC(Z2) - const uint16_t Z2_current_1 = stepperZ2.getCurrent(); - stepperZ2.setCurrent(_rms, R_SENSE, HOLD_MULTIPLIER); + const uint16_t Z2_current_1 = stepperZ2.getMilliamps(); + stepperZ2.rms_current(_rms); #endif - #if Z3_IS_TRINAMIC - const uint16_t Z3_current_1 = stepperZ3.getCurrent(); - stepperZ3.setCurrent(_rms, R_SENSE, HOLD_MULTIPLIER); + #if AXIS_IS_TMC(Z3) + const uint16_t Z3_current_1 = stepperZ3.getMilliamps(); + stepperZ3.rms_current(_rms); #endif SERIAL_ECHOPAIR("\nCalibration current: Z", _rms); @@ -381,13 +417,13 @@ void GcodeSuite::M912() { do_blocking_move_to_z(Z_MAX_POS+_z); #if AXIS_IS_TMC(Z) - stepperZ.setCurrent(Z_current_1, R_SENSE, HOLD_MULTIPLIER); + stepperZ.rms_current(Z_current_1); #endif #if AXIS_IS_TMC(Z2) - stepperZ2.setCurrent(Z2_current_1, R_SENSE, HOLD_MULTIPLIER); + stepperZ2.rms_current(Z2_current_1); #endif #if AXIS_IS_TMC(Z3) - stepperZ3.setCurrent(Z3_current_1, R_SENSE, HOLD_MULTIPLIER); + stepperZ3.rms_current(Z3_current_1); #endif do_blocking_move_to_z(Z_MAX_POS); diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index 09786f81aa..e1e3f10658 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -36,13 +36,8 @@ GcodeSuite gcode; #include "../module/printcounter.h" #endif -#if ENABLED(DIRECT_MIXING_IN_G1) - #include "../feature/mixing.h" -#endif - #include "../Marlin.h" // for idle() and suspend_auto_report -uint8_t GcodeSuite::target_extruder; millis_t GcodeSuite::previous_move_ms; bool GcodeSuite::axis_relative_modes[] = AXIS_RELATIVE_MODES; @@ -62,26 +57,21 @@ bool GcodeSuite::axis_relative_modes[] = AXIS_RELATIVE_MODES; #endif /** - * Set target_extruder from the T parameter or the active_extruder - * - * Returns TRUE if the target is invalid + * Get the target extruder from the T parameter or the active_extruder + * Return -1 if the T parameter is out of range */ -bool GcodeSuite::get_target_extruder_from_command() { +int8_t GcodeSuite::get_target_extruder_from_command() { if (parser.seenval('T')) { const int8_t e = parser.value_byte(); if (e >= EXTRUDERS) { SERIAL_ECHO_START(); - SERIAL_CHAR('M'); - SERIAL_ECHO(parser.codenum); - SERIAL_ECHOLNPAIR(" " MSG_INVALID_EXTRUDER " ", e); - return true; + SERIAL_CHAR('M'); SERIAL_ECHO(parser.codenum); + SERIAL_ECHOLNPAIR(" " MSG_INVALID_EXTRUDER " ", int(e)); + return -1; } - target_extruder = e; + return e; } - else - target_extruder = active_extruder; - - return false; + return active_extruder; } /** @@ -113,7 +103,7 @@ void GcodeSuite::get_destination_from_command() { // Get ABCDHI mixing factors #if ENABLED(MIXING_EXTRUDER) && ENABLED(DIRECT_MIXING_IN_G1) - gcode_get_mix(); + M165(); #endif } @@ -170,14 +160,14 @@ void GcodeSuite::dwell(millis_t time) { // Placeholders for non-migrated codes // #if ENABLED(M100_FREE_MEMORY_WATCHER) - extern void M100_dump_routine(const char * const title, const char *start, const char *end); + extern void M100_dump_routine(PGM_P const title, const char *start, const char *end); #endif /** * Process the parsed command and dispatch it to its handler */ void GcodeSuite::process_parsed_command( - #if ENABLED(USE_EXECUTE_COMMANDS_IMMEDIATE) + #if USE_EXECUTE_COMMANDS_IMMEDIATE const bool no_ok #endif ) { @@ -188,7 +178,7 @@ void GcodeSuite::process_parsed_command( case 'G': switch (parser.codenum) { case 0: case 1: G0_G1( // G0: Fast Move, G1: Linear Move - #if IS_SCARA + #if IS_SCARA || defined(G0_FEEDRATE) parser.codenum == 0 #endif ); @@ -256,13 +246,21 @@ void GcodeSuite::process_parsed_command( case 33: G33(); break; // G33: Delta Auto-Calibration #endif + #if ENABLED(Z_STEPPER_AUTO_ALIGN) + case 34: G34(); break; // G34: Z Stepper automatic alignment using probe + #endif + #if ENABLED(G38_PROBE_TARGET) - case 38: // G38.2 & G38.3 + case 38: // G38.2 & G38.3: Probe towards target if (parser.subcode == 2 || parser.subcode == 3) G38(parser.subcode == 2); break; #endif + #if ENABLED(GCODE_MOTION_MODES) + case 80: G80(); break; // G80: Reset the current motion mode + #endif + case 90: relative_mode = false; break; // G90: Relative Mode case 91: relative_mode = true; break; // G91: Absolute Mode @@ -423,7 +421,7 @@ void GcodeSuite::process_parsed_command( case 120: M120(); break; // M120: Enable endstops case 121: M121(); break; // M121: Disable endstops - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU case 145: M145(); break; // M145: Set material heatup parameters #endif @@ -437,9 +435,7 @@ void GcodeSuite::process_parsed_command( #if ENABLED(MIXING_EXTRUDER) case 163: M163(); break; // M163: Set a component weight for mixing extruder - #if MIXING_VIRTUAL_TOOLS > 1 - case 164: M164(); break; // M164: Save current mix as a virtual extruder - #endif + case 164: M164(); break; // M164: Save current mix as a virtual extruder #if ENABLED(DIRECT_MIXING_IN_G1) case 165: M165(); break; // M165: Set multiple mix weights #endif @@ -481,7 +477,13 @@ void GcodeSuite::process_parsed_command( #endif #endif - case 211: M211(); break; // M211: Enable, Disable, and/or Report software endstops + #if HAS_SOFTWARE_ENDSTOPS + case 211: M211(); break; // M211: Enable, Disable, and/or Report software endstops + #endif + + #if EXTRUDERS > 1 + case 217: M217(); break; // M217: Set filament swap parameters + #endif #if HOTENDS > 1 case 218: M218(); break; // M218: Set a tool offset @@ -514,7 +516,7 @@ void GcodeSuite::process_parsed_command( case 304: M304(); break; // M304: Set bed PID parameters #endif - #if defined(CHDK) || HAS_PHOTOGRAPH + #if PIN_EXISTS(CHDK) || HAS_PHOTOGRAPH case 240: M240(); break; // M240: Trigger a camera by emulating a Canon RC-1 : http://www.doc-diy.net/photo/rc-1_hacked/ #endif @@ -531,7 +533,9 @@ void GcodeSuite::process_parsed_command( case 302: M302(); break; // M302: Allow cold extrudes (set the minimum extrude temperature) #endif - case 303: M303(); break; // M303: PID autotune + #if HAS_PID_HEATING + case 303: M303(); break; // M303: PID autotune + #endif #if ENABLED(MORGAN_SCARA) case 360: if (M360()) return; break; // M360: SCARA Theta pos1 @@ -541,8 +545,8 @@ void GcodeSuite::process_parsed_command( case 364: if (M364()) return; break; // M364: SCARA Psi pos3 (90 deg to Theta) #endif - #if ENABLED(EXT_SOLENOID) - case 380: M380(); break; // M380: Activate solenoid on active extruder + #if ENABLED(EXT_SOLENOID) || ENABLED(MANUAL_SOLENOID_CONTROL) + case 380: M380(); break; // M380: Activate solenoid on active (or specified) extruder case 381: M381(); break; // M381: Disable all solenoids #endif @@ -560,6 +564,10 @@ void GcodeSuite::process_parsed_command( case 407: M407(); break; // M407: Display measured filament diameter #endif + #if ENABLED(FILAMENT_RUNOUT_SENSOR) + case 412: M412(); break; // M412: Enable/Disable filament runout detection + #endif + #if HAS_LEVELING case 420: M420(); break; // M420: Enable/Disable Bed Leveling #endif @@ -582,6 +590,10 @@ void GcodeSuite::process_parsed_command( case 504: M504(); break; // M504: Validate EEPROM contents #endif + #if ENABLED(SDSUPPORT) + case 524: M524(); break; // M524: Abort the current SD print job + #endif + #if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED) case 540: M540(); break; // M540: Set abort on endstop hit for SD printing #endif @@ -612,6 +624,12 @@ void GcodeSuite::process_parsed_command( case 7219: M7219(); break; // M7219: Set LEDs, columns, and rows #endif + #if ENABLED(GCODE_MACROS) + case 810: case 811: case 812: case 813: case 814: + case 815: case 816: case 817: case 818: case 819: + M810_819(); break; // M810-M819: Define/execute G-code macro + #endif + #if ENABLED(LIN_ADVANCE) case 900: M900(); break; // M900: Set advance K factor. #endif @@ -632,13 +650,15 @@ void GcodeSuite::process_parsed_command( case 122: M122(); break; #endif case 906: M906(); break; // M906: Set motor current in milliamps using axis codes X, Y, Z, E - case 911: M911(); break; // M911: Report TMC2130 prewarn triggered flags - case 912: M912(); break; // M912: Clear TMC2130 prewarn triggered flags + #if ENABLED(MONITOR_DRIVER_STATUS) + case 911: M911(); break; // M911: Report TMC2130 prewarn triggered flags + case 912: M912(); break; // M912: Clear TMC2130 prewarn triggered flags + #endif #if ENABLED(HYBRID_THRESHOLD) case 913: M913(); break; // M913: Set HYBRID_THRESHOLD speed. #endif - #if ENABLED(SENSORLESS_HOMING) - case 914: M914(); break; // M914: Set SENSORLESS_HOMING sensitivity. + #if USE_SENSORLESS + case 914: M914(); break; // M914: Set StallGuard sensitivity. #endif #if ENABLED(TMC_Z_CALIBRATION) case 915: M915(); break; // M915: TMC Z axis calibration. @@ -669,8 +689,17 @@ void GcodeSuite::process_parsed_command( case 869: M869(); break; // M869: Report axis error #endif + #if ENABLED(Z_STEPPER_AUTO_ALIGN) + case 422: M422(); break; // M422: Set Z Stepper automatic alignment position using probe + #endif + case 999: M999(); break; // M999: Restart after being Stopped + #if ENABLED(POWER_LOSS_RECOVERY) + case 413: M413(); break; // M413: Enable/disable/query Power-Loss Recovery + case 1000: M1000(); break; // M1000: Resume from power-loss + #endif + default: parser.unknown_command_error(); break; } break; @@ -682,7 +711,7 @@ void GcodeSuite::process_parsed_command( KEEPALIVE_STATE(NOT_BUSY); - #if ENABLED(USE_EXECUTE_COMMANDS_IMMEDIATE) + #if USE_EXECUTE_COMMANDS_IMMEDIATE if (!no_ok) #endif ok_to_send(); @@ -700,7 +729,7 @@ void GcodeSuite::process_next_command() { SERIAL_ECHOLN(current_command); #if ENABLED(M100_FREE_MEMORY_WATCHER) SERIAL_ECHOPAIR("slot:", cmd_queue_index_r); - M100_dump_routine(" Command Queue:", (const char*)command_queue, (const char*)(command_queue + sizeof(command_queue))); + M100_dump_routine(PSTR(" Command Queue:"), (const char*)command_queue, (const char*)(command_queue + sizeof(command_queue))); #endif } @@ -709,35 +738,43 @@ void GcodeSuite::process_next_command() { process_parsed_command(); } -#if ENABLED(USE_EXECUTE_COMMANDS_IMMEDIATE) +#if USE_EXECUTE_COMMANDS_IMMEDIATE + /** * Run a series of commands, bypassing the command queue to allow * G-code "macros" to be called from within other G-code handlers. */ - void GcodeSuite::process_subcommands_now_P(const char *pgcode) { - // Save the parser state - char * const saved_cmd = parser.command_ptr; - // Process individual commands in string - while (pgm_read_byte_near(pgcode)) { - // Break up string at '\n' delimiters - const char *delim = strchr_P(pgcode, '\n'); - size_t len = delim ? delim - pgcode : strlen_P(pgcode); - char cmd[len + 1]; - strncpy_P(cmd, pgcode, len); - cmd[len] = '\0'; - pgcode += len; - if (delim) pgcode++; - - // Parse the next command in the string - parser.parse(cmd); - process_parsed_command(true); + void GcodeSuite::process_subcommands_now_P(PGM_P pgcode) { + char * const saved_cmd = parser.command_ptr; // Save the parser state + for (;;) { + PGM_P const delim = strchr_P(pgcode, '\n'); // Get address of next newline + const size_t len = delim ? delim - pgcode : strlen_P(pgcode); // Get the command length + char cmd[len + 1]; // Allocate a stack buffer + strncpy_P(cmd, pgcode, len); // Copy the command to the stack + cmd[len] = '\0'; // End with a nul + parser.parse(cmd); // Parse the command + process_parsed_command(true); // Process it + if (!delim) break; // Last command? + pgcode = delim + 1; // Get the next command } - - // Restore the parser state - parser.parse(saved_cmd); + parser.parse(saved_cmd); // Restore the parser state } -#endif + + void GcodeSuite::process_subcommands_now(char * gcode) { + char * const saved_cmd = parser.command_ptr; // Save the parser state + for (;;) { + char * const delim = strchr(gcode, '\n'); // Get address of next newline + if (delim) *delim = '\0'; // Replace with nul + parser.parse(gcode); // Parse the current command + process_parsed_command(true); // Process it + if (!delim) break; // Last command? + gcode = delim + 1; // Get the next command + } + parser.parse(saved_cmd); // Restore the parser state + } + +#endif // USE_EXECUTE_COMMANDS_IMMEDIATE #if ENABLED(HOST_KEEPALIVE_FEATURE) diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h index 908ac9e2f7..42671b6243 100644 --- a/Marlin/src/gcode/gcode.h +++ b/Marlin/src/gcode/gcode.h @@ -63,8 +63,10 @@ * G31 - Dock sled (Z_PROBE_SLED only) * G32 - Undock sled (Z_PROBE_SLED only) * G33 - Delta Auto-Calibration (Requires DELTA_AUTO_CALIBRATION) + * G34 - Z Stepper automatic alignment using probe: I T A (Requires Z_STEPPER_AUTO_ALIGN) * G38 - Probe in any direction using the Z_MIN_PROBE (Requires G38_PROBE_TARGET) * G42 - Coordinated move to a mesh point (Requires MESH_BED_LEVELING, AUTO_BED_LEVELING_BLINEAR, or AUTO_BED_LEVELING_UBL) + * G80 - Cancel current motion mode (Requires GCODE_MOTION_MODES) * G90 - Use Absolute Coordinates * G91 - Use Relative Coordinates * G92 - Set current position to coordinates given @@ -76,7 +78,7 @@ * M3 - Turn laser/spindle on, set spindle/laser speed/power, set rotation to clockwise * M4 - Turn laser/spindle on, set spindle/laser speed/power, set rotation to counter-clockwise * M5 - Turn laser/spindle off - * M12 - Set up closed loop control system. More features coming soon. (Requires EXTERNAL_CLOSED_LOOP_CONTROLLER) + * M12 - Set up closed loop control system. (Requires EXTERNAL_CLOSED_LOOP_CONTROLLER) * M17 - Enable/Power all stepper motors * M18 - Disable all stepper motors; same as M84 * M20 - List SD card. (Requires SDSUPPORT) @@ -112,7 +114,7 @@ * M84 - Disable steppers until next move, or use S to specify an idle * duration after which steppers should turn off. S0 disables the timeout. * M85 - Set inactivity shutdown timer with parameter S. To disable set zero (default) - * M92 - Set planner.axis_steps_per_mm for one or more axes. + * M92 - Set planner.settings.axis_steps_per_mm for one or more axes. * M100 - Watch Free Memory (for debugging) (Requires M100_FREE_MEMORY_WATCHER) * M104 - Set extruder target temp. * M105 - Report current temperatures. @@ -145,8 +147,8 @@ * M150 - Set Status LED Color as R U B P. Values 0-255. (Requires BLINKM, RGB_LED, RGBW_LED, NEOPIXEL_LED, or PCA9632). * M155 - Auto-report temperatures with interval of S. (Requires AUTO_REPORT_TEMPERATURES) * M163 - Set a single proportion for a mixing extruder. (Requires MIXING_EXTRUDER) - * M164 - Commit the mix (Req. MIXING_EXTRUDER) and optionally save as a virtual tool (Req. MIXING_VIRTUAL_TOOLS > 1) - * M165 - Set the mix for a mixing extruder wuth parameters ABCDHI. (Requires MIXING_EXTRUDER and DIRECT_MIXING_IN_G1) + * M164 - Commit the mix and save to a virtual tool (current, or as specified by 'S'). (Requires MIXING_EXTRUDER) + * M165 - Set the mix for the mixing extruder (and current virtual tool) with parameters ABCDHI. (Requires MIXING_EXTRUDER and DIRECT_MIXING_IN_G1) * M190 - Sxxx Wait for bed current temp to reach target temp. ** Waits only when heating! ** * Rxxx Wait for bed current temp to reach target temp. ** Waits for heating or cooling. ** * M200 - Set filament diameter, D, setting E axis units to cubic. (Use S0 to revert to linear units.) @@ -164,11 +166,12 @@ * M209 - Turn Automatic Retract Detection on/off: S<0|1> (For slicers that don't support G10/11). (Requires FWRETRACT_AUTORETRACT) Every normal extrude-only move will be classified as retract depending on the direction. * M211 - Enable, Disable, and/or Report software endstops: S<0|1> (Requires MIN_SOFTWARE_ENDSTOPS or MAX_SOFTWARE_ENDSTOPS) + * M217 - Set filament swap parameters: "M217 S P R". (Requires SINGLENOZZLE) * M218 - Set/get a tool offset: "M218 T X Y". (Requires 2 or more extruders) * M220 - Set Feedrate Percentage: "M220 S" (i.e., "FR" on the LCD) * M221 - Set Flow Percentage: "M221 S" * M226 - Wait until a pin is in a given state: "M226 P S" - * M240 - Trigger a camera to take a photograph. (Requires CHDK or PHOTOGRAPH_PIN) + * M240 - Trigger a camera to take a photograph. (Requires CHDK_PIN or PHOTOGRAPH_PIN) * M250 - Set LCD contrast: "M250 C" (0-63). (Requires LCD support) * M260 - i2c Send Data (Requires EXPERIMENTAL_I2CBUS) * M261 - i2c Request Data (Requires EXPERIMENTAL_I2CBUS) @@ -193,21 +196,26 @@ * M406 - Disable Filament Sensor flow control. (Requires FILAMENT_WIDTH_SENSOR) * M407 - Display measured filament diameter in millimeters. (Requires FILAMENT_WIDTH_SENSOR) * M410 - Quickstop. Abort all planned moves. + * M412 - Enable / Disable Filament Runout Detection. (Requires FILAMENT_RUNOUT_SENSOR) + * M413 - Enable / Disable Power-Loss Recovery. (Requires POWER_LOSS_RECOVERY) * M420 - Enable/Disable Leveling (with current values) S1=enable S0=disable (Requires MESH_BED_LEVELING or ABL) * M421 - Set a single Z coordinate in the Mesh Leveling grid. X Y Z (Requires MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, or AUTO_BED_LEVELING_UBL) + * M422 - Set Z Stepper automatic alignment position using probe. X Y A (Requires Z_STEPPER_AUTO_ALIGN) * M428 - Set the home_offset based on the current_position. Nearest edge applies. (Disabled by NO_WORKSPACE_OFFSETS or DELTA) * M500 - Store parameters in EEPROM. (Requires EEPROM_SETTINGS) * M501 - Restore parameters from EEPROM. (Requires EEPROM_SETTINGS) * M502 - Revert to the default "factory settings". ** Does not write them to EEPROM! ** * M503 - Print the current settings (in memory): "M503 S". S0 specifies compact output. + * M524 - Abort the current SD print job (started with M24) * M540 - Enable/disable SD card abort on endstop hit: "M540 S". (Requires ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED) * M600 - Pause for filament change: "M600 X Y Z E L". (Requires ADVANCED_PAUSE_FEATURE) * M603 - Configure filament change: "M603 T U L". (Requires ADVANCED_PAUSE_FEATURE) * M605 - Set Dual X-Carriage movement mode: "M605 S [X] [R]". (Requires DUAL_X_CARRIAGE) * M665 - Set delta configurations: "M665 H L R S B X Y Z (Requires DELTA) * M666 - Set/get offsets for delta (Requires DELTA) or dual endstops (Requires [XYZ]_DUAL_ENDSTOPS). - * M701 - Load filament (requires FILAMENT_LOAD_UNLOAD_GCODES) - * M702 - Unload filament (requires FILAMENT_LOAD_UNLOAD_GCODES) + * M701 - Load filament (Requires FILAMENT_LOAD_UNLOAD_GCODES) + * M702 - Unload filament (Requires FILAMENT_LOAD_UNLOAD_GCODES) + * M810-M819 - Define/execute a G-code macro (Requires GCODE_MACROS) * M851 - Set Z probe's Z offset in current units. (Negative = below the nozzle.) * M852 - Set skew factors: "M852 [I] [J] [K]". (Requires SKEW_CORRECTION_GCODE, and SKEW_CORRECTION_FOR_Z for IJ) * M860 - Report the position of position encoder modules. @@ -229,7 +237,7 @@ * M911 - Report stepper driver overtemperature pre-warn condition. (Requires at least one _DRIVER_TYPE defined as TMC2130/TMC2208/TMC2660) * M912 - Clear stepper driver overtemperature pre-warn condition flag. (Requires at least one _DRIVER_TYPE defined as TMC2130/TMC2208/TMC2660) * M913 - Set HYBRID_THRESHOLD speed. (Requires HYBRID_THRESHOLD) - * M914 - Set SENSORLESS_HOMING sensitivity. (Requires SENSORLESS_HOMING) + * M914 - Set StallGuard sensitivity. (Requires SENSORLESS_HOMING or SENSORLESS_PROBING) * * M360 - SCARA calibration: Move to cal-position ThetaA (0 deg calibration) * M361 - SCARA calibration: Move to cal-position ThetaB (90 deg calibration - steps per degree) @@ -246,9 +254,7 @@ * T0-T3 - Select an extruder (tool) by index: "T F" * */ - -#ifndef _GCODE_H_ -#define _GCODE_H_ +#pragma once #include "../inc/MarlinConfig.h" #include "parser.h" @@ -262,8 +268,6 @@ public: GcodeSuite() {} - static uint8_t target_extruder; - static bool axis_relative_modes[]; #if ENABLED(CNC_WORKSPACE_PLANES) @@ -285,32 +289,23 @@ public: static millis_t previous_move_ms; FORCE_INLINE static void reset_stepper_timeout() { previous_move_ms = millis(); } - static bool get_target_extruder_from_command(); + static int8_t get_target_extruder_from_command(); static void get_destination_from_command(); + static void process_parsed_command( - #if ENABLED(USE_EXECUTE_COMMANDS_IMMEDIATE) + #if USE_EXECUTE_COMMANDS_IMMEDIATE const bool no_ok = false #endif ); static void process_next_command(); - #if ENABLED(USE_EXECUTE_COMMANDS_IMMEDIATE) - static void process_subcommands_now_P(const char *pgcode); + #if USE_EXECUTE_COMMANDS_IMMEDIATE + static void process_subcommands_now_P(PGM_P pgcode); + static void process_subcommands_now(char * gcode); #endif FORCE_INLINE static void home_all_axes() { G28(true); } - /** - * Multi-stepper support for M92, M201, M203 - */ - #if ENABLED(DISTINCT_E_FACTORS) - #define GET_TARGET_EXTRUDER() if (gcode.get_target_extruder_from_command()) return - #define TARGET_EXTRUDER gcode.target_extruder - #else - #define GET_TARGET_EXTRUDER() NOOP - #define TARGET_EXTRUDER 0 - #endif - #if ENABLED(HOST_KEEPALIVE_FEATURE) /** * States for managing Marlin and host communication @@ -334,16 +329,12 @@ public: #define KEEPALIVE_STATE(n) NOOP #endif - #if ENABLED(PRINTER_EVENT_LEDS) && ENABLED(SDSUPPORT) && HAS_RESUME_CONTINUE - static bool lights_off_after_print; - #endif - static void dwell(millis_t time); private: static void G0_G1( - #if IS_SCARA + #if IS_SCARA || defined(G0_FEEDRATE) bool fast_move=false #endif ); @@ -410,6 +401,11 @@ private: static void G33(); #endif + #if ENABLED(Z_STEPPER_AUTO_ALIGN) + static void G34(); + static void M422(); + #endif + #if ENABLED(G38_PROBE_TARGET) static void G38(const bool is_38_2); #endif @@ -428,6 +424,10 @@ private: static void G59(); #endif + #if ENABLED(GCODE_MOTION_MODES) + static void G80(); + #endif + static void G92(); #if HAS_RESUME_CONTINUE @@ -561,7 +561,7 @@ private: static void M190(); #endif - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU static void M145(); #endif @@ -579,9 +579,7 @@ private: #if ENABLED(MIXING_EXTRUDER) static void M163(); - #if MIXING_VIRTUAL_TOOLS > 1 - static void M164(); - #endif + static void M164(); #if ENABLED(DIRECT_MIXING_IN_G1) static void M165(); #endif @@ -612,6 +610,10 @@ private: static void M211(); + #if EXTRUDERS > 1 + static void M217(); + #endif + #if HOTENDS > 1 static void M218(); #endif @@ -620,7 +622,7 @@ private: static void M221(); static void M226(); - #if defined(CHDK) || HAS_PHOTOGRAPH + #if PIN_EXISTS(CHDK) || HAS_PHOTOGRAPH static void M240(); #endif @@ -656,7 +658,9 @@ private: static void M302(); #endif - static void M303(); + #if HAS_PID_HEATING + static void M303(); + #endif #if ENABLED(PIDTEMPBED) static void M304(); @@ -677,7 +681,7 @@ private: static bool M364(); #endif - #if ENABLED(EXT_SOLENOID) + #if ENABLED(EXT_SOLENOID) || ENABLED(MANUAL_SOLENOID_CONTROL) static void M380(); static void M381(); #endif @@ -696,6 +700,10 @@ private: static void M407(); #endif + #if ENABLED(FILAMENT_RUNOUT_SENSOR) + static void M412(); + #endif + #if HAS_LEVELING static void M420(); static void M421(); @@ -715,6 +723,10 @@ private: static void M504(); #endif + #if ENABLED(SDSUPPORT) + static void M524(); + #endif + #if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED) static void M540(); #endif @@ -732,7 +744,7 @@ private: static void M665(); #endif - #if ENABLED(DELTA) || ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || ENABLED(Z_DUAL_ENDSTOPS) + #if ENABLED(DELTA) || ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS static void M666(); #endif @@ -745,6 +757,10 @@ private: static void M7219(); #endif + #if ENABLED(GCODE_MACROS) + static void M810_819(); + #endif + #if HAS_BED_PROBE static void M851(); #endif @@ -775,12 +791,14 @@ private: static void M122(); #endif static void M906(); - static void M911(); - static void M912(); + #if ENABLED(MONITOR_DRIVER_STATUS) + static void M911(); + static void M912(); + #endif #if ENABLED(HYBRID_THRESHOLD) static void M913(); #endif - #if ENABLED(SENSORLESS_HOMING) + #if USE_SENSORLESS static void M914(); #endif #if ENABLED(TMC_Z_CALIBRATION) @@ -805,10 +823,13 @@ private: static void M999(); - static void T(const uint8_t tmp_extruder); + #if ENABLED(POWER_LOSS_RECOVERY) + static void M413(); + static void M1000(); + #endif + + static void T(const uint8_t tool_index); }; extern GcodeSuite gcode; - -#endif // _GCODE_H_ diff --git a/Marlin/src/gcode/geometry/G53-G59.cpp b/Marlin/src/gcode/geometry/G53-G59.cpp index 09708c03ea..f1e9ff27d0 100644 --- a/Marlin/src/gcode/geometry/G53-G59.cpp +++ b/Marlin/src/gcode/geometry/G53-G59.cpp @@ -44,7 +44,7 @@ bool GcodeSuite::select_coordinate_system(const int8_t _new) { const float diff = new_offset[i] - old_offset[i]; if (diff) { position_shift[i] += diff; - update_software_endstops((AxisEnum)i); + update_workspace_offset((AxisEnum)i); } } return true; diff --git a/Marlin/src/gcode/geometry/G92.cpp b/Marlin/src/gcode/geometry/G92.cpp index 721c8b73c3..8e0b341316 100644 --- a/Marlin/src/gcode/geometry/G92.cpp +++ b/Marlin/src/gcode/geometry/G92.cpp @@ -42,7 +42,7 @@ void GcodeSuite::G92() { const float v = position_shift[i]; if (v) { position_shift[i] = 0; - update_software_endstops((AxisEnum)i); + update_workspace_offset((AxisEnum)i); } } #endif // Not SCARA @@ -79,7 +79,7 @@ void GcodeSuite::G92() { } else { position_shift[i] += d; // Other axes simply offset the coordinate space - update_software_endstops((AxisEnum)i); + update_workspace_offset((AxisEnum)i); } #endif } diff --git a/Marlin/src/gcode/geometry/M206_M428.cpp b/Marlin/src/gcode/geometry/M206_M428.cpp index 88a60d545b..086108b18f 100644 --- a/Marlin/src/gcode/geometry/M206_M428.cpp +++ b/Marlin/src/gcode/geometry/M206_M428.cpp @@ -28,7 +28,6 @@ #include "../../module/motion.h" #include "../../lcd/ultralcd.h" #include "../../libs/buzzer.h" -#include "../../Marlin.h" // for axis_homed /** * M206: Set Additional Homing Offset (X Y Z). SCARA aliases T=X, P=Y diff --git a/Marlin/src/gcode/host/M115.cpp b/Marlin/src/gcode/host/M115.cpp index c828e519e0..8b4758808a 100644 --- a/Marlin/src/gcode/host/M115.cpp +++ b/Marlin/src/gcode/host/M115.cpp @@ -28,7 +28,7 @@ #endif #if ENABLED(EXTENDED_CAPABILITIES_REPORT) - static void cap_line(const char * const name, bool ena=false) { + static void cap_line(PGM_P const name, bool ena=false) { SERIAL_PROTOCOLPGM("Cap:"); serialprintPGM(name); SERIAL_CHAR(':'); @@ -153,5 +153,12 @@ void GcodeSuite::M115() { #endif ); + // MOTION_MODES (M80-M89) + cap_line(PSTR("MOTION_MODES") + #if ENABLED(GCODE_MOTION_MODES) + , true + #endif + ); + #endif // EXTENDED_CAPABILITIES_REPORT } diff --git a/Marlin/src/gcode/lcd/M0_M1.cpp b/Marlin/src/gcode/lcd/M0_M1.cpp index 7563f85ff6..04ee285ce5 100644 --- a/Marlin/src/gcode/lcd/M0_M1.cpp +++ b/Marlin/src/gcode/lcd/M0_M1.cpp @@ -27,15 +27,14 @@ #include "../gcode.h" #include "../../module/stepper.h" -#if ENABLED(ULTIPANEL) +#if HAS_LCD_MENU #include "../../lcd/ultralcd.h" #endif #include "../../sd/cardreader.h" -#if ENABLED(PRINTER_EVENT_LEDS) && ENABLED(SDSUPPORT) - bool GcodeSuite::lights_off_after_print; - #include "../../feature/leds/leds.h" +#if HAS_LEDS_OFF_FLAG + #include "../../feature/leds/printer_event_leds.h" #endif /** @@ -60,14 +59,14 @@ void GcodeSuite::M0_M1() { planner.synchronize(); - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU if (has_message) - lcd_setstatus(args, true); + ui.set_status(args, true); else { LCD_MESSAGEPGM(MSG_USERWAIT); #if ENABLED(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0 - dontExpireStatus(); + ui.reset_progress_bar_timeout(); #endif } @@ -90,15 +89,12 @@ void GcodeSuite::M0_M1() { else while (wait_for_user) idle(); - #if ENABLED(PRINTER_EVENT_LEDS) && ENABLED(SDSUPPORT) - if (lights_off_after_print) { - leds.set_off(); - lights_off_after_print = false; - } + #if HAS_LEDS_OFF_FLAG + printerEventLEDs.onResumeAfterWait(); #endif - #if ENABLED(ULTIPANEL) - lcd_reset_status(); + #if HAS_LCD_MENU + ui.reset_status(); #endif wait_for_user = false; diff --git a/Marlin/src/gcode/lcd/M117.cpp b/Marlin/src/gcode/lcd/M117.cpp index 0f508d8eb9..1db6b004f9 100644 --- a/Marlin/src/gcode/lcd/M117.cpp +++ b/Marlin/src/gcode/lcd/M117.cpp @@ -28,6 +28,6 @@ */ void GcodeSuite::M117() { - lcd_setstatus(parser.string_arg); + ui.set_status(parser.string_arg); } diff --git a/Marlin/src/gcode/lcd/M145.cpp b/Marlin/src/gcode/lcd/M145.cpp index 3fda5bb047..35fb525f48 100644 --- a/Marlin/src/gcode/lcd/M145.cpp +++ b/Marlin/src/gcode/lcd/M145.cpp @@ -22,7 +22,7 @@ #include "../../inc/MarlinConfig.h" -#if ENABLED(ULTIPANEL) +#if HAS_LCD_MENU #include "../gcode.h" #include "../../lcd/ultralcd.h" @@ -30,14 +30,14 @@ /** * M145: Set the heatup state for a material in the LCD menu * - * S (0=PLA, 1=ABS) + * S * H * B * F */ void GcodeSuite::M145() { const uint8_t material = (uint8_t)parser.intval('S'); - if (material >= COUNT(lcd_preheat_hotend_temp)) { + if (material >= COUNT(ui.preheat_hotend_temp)) { SERIAL_ERROR_START(); SERIAL_ERRORLNPGM(MSG_ERR_MATERIAL_INDEX); } @@ -45,19 +45,19 @@ void GcodeSuite::M145() { int v; if (parser.seenval('H')) { v = parser.value_int(); - lcd_preheat_hotend_temp[material] = constrain(v, EXTRUDE_MINTEMP, HEATER_0_MAXTEMP - 15); + ui.preheat_hotend_temp[material] = constrain(v, EXTRUDE_MINTEMP, HEATER_0_MAXTEMP - 15); } if (parser.seenval('F')) { v = parser.value_int(); - lcd_preheat_fan_speed[material] = constrain(v, 0, 255); + ui.preheat_fan_speed[material] = (uint8_t)constrain(v, 0, 255); } #if TEMP_SENSOR_BED != 0 if (parser.seenval('B')) { v = parser.value_int(); - lcd_preheat_bed_temp[material] = constrain(v, BED_MINTEMP, BED_MAXTEMP - 15); + ui.preheat_bed_temp[material] = constrain(v, BED_MINTEMP, BED_MAXTEMP - 15); } #endif } } -#endif // ULTIPANEL +#endif // HAS_LCD_MENU diff --git a/Marlin/src/gcode/lcd/M250.cpp b/Marlin/src/gcode/lcd/M250.cpp index bede88126a..9444779f54 100644 --- a/Marlin/src/gcode/lcd/M250.cpp +++ b/Marlin/src/gcode/lcd/M250.cpp @@ -31,10 +31,8 @@ * M250: Read and optionally set the LCD contrast */ void GcodeSuite::M250() { - if (parser.seen('C')) set_lcd_contrast(parser.value_int()); - SERIAL_PROTOCOLPGM("lcd contrast value: "); - SERIAL_PROTOCOL(lcd_contrast); - SERIAL_EOL(); + if (parser.seen('C')) ui.set_contrast(parser.value_int()); + SERIAL_PROTOCOLLNPAIR("LCD Contrast: ", ui.contrast); } #endif // HAS_LCD_CONTRAST diff --git a/Marlin/src/gcode/lcd/M73.cpp b/Marlin/src/gcode/lcd/M73.cpp index 1c1deee9f9..78697aecf3 100644 --- a/Marlin/src/gcode/lcd/M73.cpp +++ b/Marlin/src/gcode/lcd/M73.cpp @@ -38,10 +38,8 @@ * This has no effect during an SD print job */ void GcodeSuite::M73() { - if (!IS_SD_PRINTING && parser.seen('P')) { - progress_bar_percent = parser.value_byte(); - NOMORE(progress_bar_percent, 100); - } + if (parser.seen('P') && !IS_SD_PRINTING()) + ui.set_progress(parser.value_byte()); } #endif // ULTRA_LCD && LCD_SET_PROGRESS_MANUALLY diff --git a/Marlin/src/gcode/motion/G0_G1.cpp b/Marlin/src/gcode/motion/G0_G1.cpp index 223bd87fb7..32e9e6f6a5 100644 --- a/Marlin/src/gcode/motion/G0_G1.cpp +++ b/Marlin/src/gcode/motion/G0_G1.cpp @@ -37,23 +37,48 @@ extern float destination[XYZE]; -#if ENABLED(NO_MOTION_BEFORE_HOMING) - #define G0_G1_CONDITION !axis_unhomed_error(parser.seen('X'), parser.seen('Y'), parser.seen('Z')) -#else - #define G0_G1_CONDITION true +#if ENABLED(VARIABLE_G0_FEEDRATE) + float saved_g0_feedrate_mm_s = MMM_TO_MMS(G0_FEEDRATE); #endif /** * G0, G1: Coordinated movement of X Y Z E axes */ void GcodeSuite::G0_G1( - #if IS_SCARA + #if IS_SCARA || defined(G0_FEEDRATE) bool fast_move/*=false*/ #endif ) { - if (IsRunning() && G0_G1_CONDITION) { + + if (IsRunning() + #if ENABLED(NO_MOTION_BEFORE_HOMING) + && !axis_unhomed_error(parser.seen('X'), parser.seen('Y'), parser.seen('Z')) + #endif + ) { + + #ifdef G0_FEEDRATE + float saved_feedrate_mm_s; + #if ENABLED(VARIABLE_G0_FEEDRATE) + if (fast_move) { + saved_feedrate_mm_s = feedrate_mm_s; // Back up the (old) motion mode feedrate + feedrate_mm_s = saved_g0_feedrate_mm_s; // Get G0 feedrate from last usage + } + #endif + #endif + get_destination_from_command(); // For X Y Z E F + #ifdef G0_FEEDRATE + if (fast_move) { + #if ENABLED(VARIABLE_G0_FEEDRATE) + saved_g0_feedrate_mm_s = feedrate_mm_s; // Save feedrate for the next G0 + #else + saved_feedrate_mm_s = feedrate_mm_s; // Back up the (new) motion mode feedrate + feedrate_mm_s = MMM_TO_MMS(G0_FEEDRATE); // Get the fixed G0 feedrate + #endif + } + #endif + #if ENABLED(FWRETRACT) && ENABLED(FWRETRACT_AUTORETRACT) if (MIN_AUTORETRACT <= MAX_AUTORETRACT) { @@ -77,6 +102,11 @@ void GcodeSuite::G0_G1( prepare_move_to_destination(); #endif + #ifdef G0_FEEDRATE + // Restore the motion mode feedrate + if (fast_move) feedrate_mm_s = saved_feedrate_mm_s; + #endif + #if ENABLED(NANODLP_Z_SYNC) #if ENABLED(NANODLP_ALL_AXIS) #define _MOVE_SYNC parser.seenval('X') || parser.seenval('Y') || parser.seenval('Z') // For any move wait and output sync message diff --git a/Marlin/src/gcode/motion/G2_G3.cpp b/Marlin/src/gcode/motion/G2_G3.cpp index 0ae3f8574f..b592b31baa 100644 --- a/Marlin/src/gcode/motion/G2_G3.cpp +++ b/Marlin/src/gcode/motion/G2_G3.cpp @@ -70,6 +70,9 @@ void plan_arc( float r_P = -offset[0], r_Q = -offset[1]; const float radius = HYPOT(r_P, r_Q), + #if ENABLED(AUTO_BED_LEVELING_UBL) + start_L = current_position[l_axis], + #endif center_P = current_position[p_axis] - r_P, center_Q = current_position[q_axis] - r_Q, rt_X = cart[p_axis] - center_P, @@ -179,7 +182,11 @@ void plan_arc( // Update raw location raw[p_axis] = center_P + r_P; raw[q_axis] = center_Q + r_Q; - raw[l_axis] += linear_per_segment; + #if ENABLED(AUTO_BED_LEVELING_UBL) + raw[l_axis] = start_L; + #else + raw[l_axis] += linear_per_segment; + #endif raw[E_AXIS] += extruder_per_segment; clamp_to_software_endstops(raw); @@ -198,6 +205,9 @@ void plan_arc( // Ensure last segment arrives at target location. COPY(raw, cart); + #if ENABLED(AUTO_BED_LEVELING_UBL) + raw[l_axis] = start_L; + #endif #if HAS_LEVELING && !PLANNER_LEVELING planner.apply_leveling(raw); @@ -209,6 +219,9 @@ void plan_arc( #endif ); + #if ENABLED(AUTO_BED_LEVELING_UBL) + raw[l_axis] = start_L; + #endif COPY(current_position, raw); } // plan_arc diff --git a/Marlin/src/gcode/motion/G4.cpp b/Marlin/src/gcode/motion/G4.cpp index 7d53cb0304..fcee5df401 100644 --- a/Marlin/src/gcode/motion/G4.cpp +++ b/Marlin/src/gcode/motion/G4.cpp @@ -38,7 +38,7 @@ void GcodeSuite::G4() { SERIAL_ECHOLNPGM(MSG_Z_MOVE_COMP); #endif - if (!lcd_hasstatus()) LCD_MESSAGEPGM(MSG_DWELL); + if (!ui.has_status()) LCD_MESSAGEPGM(MSG_DWELL); dwell(dwell_ms); } diff --git a/Marlin/src/gcode/motion/G80.cpp b/Marlin/src/gcode/motion/G80.cpp new file mode 100644 index 0000000000..e51bf1e8cb --- /dev/null +++ b/Marlin/src/gcode/motion/G80.cpp @@ -0,0 +1,38 @@ +/** + * 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 "../../inc/MarlinConfigPre.h" + +#if ENABLED(GCODE_MOTION_MODES) + +#include "../gcode.h" + +/** + * G80: Cancel current motion mode + */ +void GcodeSuite::G80() { + + parser.cancel_motion_mode(); + +} + +#endif // GCODE_MOTION_MODES diff --git a/Marlin/src/gcode/motion/M290.cpp b/Marlin/src/gcode/motion/M290.cpp index a15b177b5c..1647e00710 100644 --- a/Marlin/src/gcode/motion/M290.cpp +++ b/Marlin/src/gcode/motion/M290.cpp @@ -64,7 +64,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.axis_steps_per_mm[a]); + thermalManager.babystep_axis((AxisEnum)a, offs * planner.settings.axis_steps_per_mm[a]); #if ENABLED(BABYSTEP_ZPROBE_OFFSET) if (a == Z_AXIS && (!parser.seen('P') || parser.value_bool())) mod_zprobe_zoffset(offs); #endif @@ -72,7 +72,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.axis_steps_per_mm[Z_AXIS]); + thermalManager.babystep_axis(Z_AXIS, offs * planner.settings.axis_steps_per_mm[Z_AXIS]); #if ENABLED(BABYSTEP_ZPROBE_OFFSET) if (!parser.seen('P') || parser.value_bool()) mod_zprobe_zoffset(offs); #endif diff --git a/Marlin/src/gcode/parser.cpp b/Marlin/src/gcode/parser.cpp index 392532646c..2b678d7e20 100644 --- a/Marlin/src/gcode/parser.cpp +++ b/Marlin/src/gcode/parser.cpp @@ -50,10 +50,18 @@ char *GCodeParser::command_ptr, *GCodeParser::value_ptr; char GCodeParser::command_letter; int GCodeParser::codenum; + #if USE_GCODE_SUBCODES uint8_t GCodeParser::subcode; #endif +#if ENABLED(GCODE_MOTION_MODES) + int16_t GCodeParser::motion_mode_codenum = -1; + #if USE_GCODE_SUBCODES + uint8_t GCodeParser::motion_mode_subcode; + #endif +#endif + #if ENABLED(FASTER_GCODE_PARSER) // Optimized Parameters uint32_t GCodeParser::codebits; // found bits @@ -117,36 +125,82 @@ void GCodeParser::parse(char *p) { starpos[1] = '\0'; } - // Bail if the letter is not G, M, or T - switch (letter) { case 'G': case 'M': case 'T': break; default: return; } - - // Skip spaces to get the numeric part - while (*p == ' ') p++; - - // Bail if there's no command code number - if (!NUMERIC(*p)) return; - - // Save the command letter at this point - // A '?' signifies an unknown command - command_letter = letter; - - // Get the code number - integer digits only - codenum = 0; - do { - codenum *= 10, codenum += *p++ - '0'; - } while (NUMERIC(*p)); - - // Allow for decimal point in command - #if USE_GCODE_SUBCODES - if (*p == '.') { - p++; - while (NUMERIC(*p)) - subcode *= 10, subcode += *p++ - '0'; - } + #if ENABLED(GCODE_MOTION_MODES) + #if ENABLED(ARC_SUPPORT) + #define GTOP 3 + #else + #define GTOP 1 + #endif #endif - // Skip all spaces to get to the first argument, or nul - while (*p == ' ') p++; + // Bail if the letter is not G, M, or T + // (or a valid parameter for the current motion mode) + switch (letter) { + + case 'G': case 'M': case 'T': + + // Skip spaces to get the numeric part + while (*p == ' ') p++; + + // Bail if there's no command code number + if (!NUMERIC(*p)) return; + + // Save the command letter at this point + // A '?' signifies an unknown command + command_letter = letter; + + // Get the code number - integer digits only + codenum = 0; + do { codenum *= 10, codenum += *p++ - '0'; } while (NUMERIC(*p)); + + // Allow for decimal point in command + #if USE_GCODE_SUBCODES + if (*p == '.') { + p++; + while (NUMERIC(*p)) + subcode *= 10, subcode += *p++ - '0'; + } + #endif + + // Skip all spaces to get to the first argument, or nul + while (*p == ' ') p++; + + #if ENABLED(GCODE_MOTION_MODES) + if (letter == 'G' && (codenum <= GTOP || codenum == 5 + #if ENABLED(G38_PROBE_TARGET) + || codenum == 38 + #endif + ) + ) { + motion_mode_codenum = codenum; + #if USE_GCODE_SUBCODES + motion_mode_subcode = subcode; + #endif + } + #endif + + break; + + #if ENABLED(GCODE_MOTION_MODES) + #if ENABLED(ARC_SUPPORT) + case 'I': case 'J': case 'R': + if (motion_mode_codenum != 2 && motion_mode_codenum != 3) return; + #endif + case 'P': case 'Q': + if (motion_mode_codenum != 5) return; + case 'X': case 'Y': case 'Z': case 'E': case 'F': + if (motion_mode_codenum < 0) return; + command_letter = 'G'; + codenum = motion_mode_codenum; + #if USE_GCODE_SUBCODES + subcode = motion_mode_subcode; + #endif + p--; // Back up one character to use the current parameter + break; + #endif // GCODE_MOTION_MODES + + default: return; + } // The command parameters (if any) start here, for sure! @@ -155,7 +209,14 @@ void GCodeParser::parse(char *p) { #endif // Only use string_arg for these M codes - if (letter == 'M') switch (codenum) { case 23: case 28: case 30: case 117: case 118: case 928: string_arg = p; return; default: break; } + if (letter == 'M') switch (codenum) { + #if ENABLED(GCODE_MACROS) + case 810: case 811: case 812: case 813: case 814: + case 815: case 816: case 817: case 818: case 819: + #endif + case 23: case 28: case 30: case 117: case 118: case 928: string_arg = p; return; + default: break; + } #if ENABLED(DEBUG_GCODE_PARSER) const bool debug = codenum == 800; diff --git a/Marlin/src/gcode/parser.h b/Marlin/src/gcode/parser.h index 1665304f77..c13da8a28c 100644 --- a/Marlin/src/gcode/parser.h +++ b/Marlin/src/gcode/parser.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * parser.h - Parser for a GCode line, providing a parameter interface. @@ -26,9 +27,6 @@ * so settings for these codes are located in this class. */ -#ifndef _PARSER_H_ -#define _PARSER_H_ - #include "../inc/MarlinConfig.h" //#define DEBUG_GCODE_PARSER @@ -76,14 +74,21 @@ public: // Command line state static char *command_ptr, // The command, so it can be echoed - *string_arg; // string of command line - - static char command_letter; // G, M, or T + *string_arg, // string of command line + command_letter; // G, M, or T static int codenum; // 123 #if USE_GCODE_SUBCODES static uint8_t subcode; // .1 #endif + #if ENABLED(GCODE_MOTION_MODES) + static int16_t motion_mode_codenum; + #if USE_GCODE_SUBCODES + static uint8_t motion_mode_subcode; + #endif + FORCE_INLINE static void cancel_motion_mode() { motion_mode_codenum = -1; } + #endif + #if ENABLED(DEBUG_GCODE_PARSER) static void debug(); #endif @@ -108,7 +113,7 @@ public: } // Set the flag and pointer for a parameter - static void set(const char c, char * const ptr) { + static inline void set(const char c, char * const ptr) { const uint8_t ind = LETTER_BIT(c); if (ind >= COUNT(param)) return; // Only A-Z SBI32(codebits, ind); // parameter exists @@ -125,7 +130,7 @@ public: // Code seen bit was set. If not found, value_ptr is unchanged. // This allows "if (seen('A')||seen('B'))" to use the last-found value. - static bool seen(const char c) { + static inline bool seen(const char c) { const uint8_t ind = LETTER_BIT(c); if (ind >= COUNT(param)) return false; // Only A-Z const bool b = TEST32(codebits, ind); @@ -136,7 +141,34 @@ public: return b; } - static bool seen_any() { return !!codebits; } + FORCE_INLINE static constexpr uint32_t letter_bits(const char * const str) { + return (str[0] ? _BV32(LETTER_BIT(str[0])) | + (str[1] ? _BV32(LETTER_BIT(str[1])) | + (str[2] ? _BV32(LETTER_BIT(str[2])) | + (str[3] ? _BV32(LETTER_BIT(str[3])) | + (str[4] ? _BV32(LETTER_BIT(str[4])) | + (str[5] ? _BV32(LETTER_BIT(str[5])) | + (str[6] ? _BV32(LETTER_BIT(str[6])) | + (str[7] ? _BV32(LETTER_BIT(str[7])) | + (str[8] ? _BV32(LETTER_BIT(str[8])) | + (str[9] ? _BV32(LETTER_BIT(str[9])) + : 0) : 0) : 0) : 0) : 0) : 0) : 0) : 0) : 0) : 0); + } + + // At least one of a list of code letters was seen + #ifdef CPU_32_BIT + FORCE_INLINE static bool seen(const char * const str) { return !!(codebits & letter_bits(str)); } + #else + // At least one of a list of code letters was seen + FORCE_INLINE static bool seen(const char * const str) { + const uint32_t letrbits = letter_bits(str); + const uint8_t * const cb = (uint8_t*)&codebits; + const uint8_t * const lb = (uint8_t*)&letrbits; + return (cb[0] & lb[0]) || (cb[1] & lb[1]) || (cb[2] & lb[2]) || (cb[3] & lb[3]); + } + #endif + + static inline bool seen_any() { return !!codebits; } #define SEEN_TEST(L) TEST32(codebits, LETTER_BIT(L)) @@ -144,21 +176,28 @@ public: // Code is found in the string. If not found, value_ptr is unchanged. // This allows "if (seen('A')||seen('B'))" to use the last-found value. - static bool seen(const char c) { + static inline bool seen(const char c) { char *p = strchr(command_args, c); const bool b = !!p; if (b) value_ptr = valid_float(&p[1]) ? &p[1] : (char*)NULL; return b; } - static bool seen_any() { return *command_args == '\0'; } + static inline bool seen_any() { return *command_args == '\0'; } #define SEEN_TEST(L) !!strchr(command_args, L) + // At least one of a list of code letters was seen + static inline bool seen(const char * const str) { + for (uint8_t i = 0; const char c = str[i]; i++) + if (SEEN_TEST(c)) return true; + return false; + } + #endif // !FASTER_GCODE_PARSER // Seen any axis parameter - static bool seen_axis() { + static inline bool seen_axis() { return SEEN_TEST('X') || SEEN_TEST('Y') || SEEN_TEST('Z') || SEEN_TEST('E'); } @@ -202,12 +241,12 @@ public: static inline uint32_t value_ulong() { return value_ptr ? strtoul(value_ptr, NULL, 10) : 0UL; } // Code value for use as time - FORCE_INLINE static millis_t value_millis() { return value_ulong(); } - FORCE_INLINE static millis_t value_millis_from_seconds() { return (millis_t)(value_float() * 1000); } + static inline millis_t value_millis() { return value_ulong(); } + static inline millis_t value_millis_from_seconds() { return (millis_t)(value_float() * 1000); } // Reduce to fewer bits - FORCE_INLINE static int16_t value_int() { return (int16_t)value_long(); } - FORCE_INLINE static uint16_t value_ushort() { return (uint16_t)value_long(); } + static inline int16_t value_int() { return (int16_t)value_long(); } + static inline uint16_t value_ushort() { return (uint16_t)value_long(); } static inline uint8_t value_byte() { return (uint8_t)constrain(value_long(), 0, 255); } // Bool is true with no value or non-zero @@ -217,6 +256,9 @@ public: #if ENABLED(INCH_MODE_SUPPORT) + static inline float mm_to_linear_unit(const float mm) { return mm / linear_unit_factor; } + static inline float mm_to_volumetric_unit(const float mm) { return mm / (volumetric_enabled ? volumetric_unit_factor : linear_unit_factor); } + // Init linear units by constructor GCodeParser() { set_input_linear_units(LINEARUNIT_MM); } @@ -237,28 +279,38 @@ public: return (axis >= E_AXIS && volumetric_enabled ? volumetric_unit_factor : linear_unit_factor); } - static inline float value_linear_units() { return value_float() * linear_unit_factor; } - static inline float value_axis_units(const AxisEnum axis) { return value_float() * axis_unit_factor(axis); } - static inline float value_per_axis_unit(const AxisEnum axis) { return value_float() / axis_unit_factor(axis); } + static inline float linear_value_to_mm(const float v) { return v * linear_unit_factor; } + static inline float axis_value_to_mm(const AxisEnum axis, const float v) { return v * axis_unit_factor(axis); } + static inline float per_axis_value(const AxisEnum axis, const float v) { return v / axis_unit_factor(axis); } #else - FORCE_INLINE static float value_linear_units() { return value_float(); } - FORCE_INLINE static float value_axis_units(const AxisEnum a) { UNUSED(a); return value_float(); } - FORCE_INLINE static float value_per_axis_unit(const AxisEnum a) { UNUSED(a); return value_float(); } + static inline float mm_to_linear_unit(const float mm) { return mm; } + static inline float mm_to_volumetric_unit(const float mm) { return mm; } + + static inline float linear_value_to_mm(const float v) { return v; } + static inline float axis_value_to_mm(const AxisEnum axis, const float v) { UNUSED(axis); return v; } + static inline float per_axis_value(const AxisEnum axis, const float v) { UNUSED(axis); return v; } #endif + #define LINEAR_UNIT(V) parser.mm_to_linear_unit(V) + #define VOLUMETRIC_UNIT(V) parser.mm_to_volumetric_unit(V) + + static inline float value_linear_units() { return linear_value_to_mm(value_float()); } + static inline float value_axis_units(const AxisEnum axis) { return axis_value_to_mm(axis, value_float()); } + static inline float value_per_axis_units(const AxisEnum axis) { return per_axis_value(axis, value_float()); } + #if ENABLED(TEMPERATURE_UNITS_SUPPORT) static inline void set_input_temp_units(TempUnit units) { input_temp_units = units; } - #if ENABLED(ULTIPANEL) && DISABLED(DISABLE_M503) + #if HAS_LCD_MENU && DISABLED(DISABLE_M503) - FORCE_INLINE static char temp_units_code() { + static inline char temp_units_code() { return input_temp_units == TEMPUNIT_K ? 'K' : input_temp_units == TEMPUNIT_F ? 'F' : 'C'; } - FORCE_INLINE static const char* temp_units_name() { + static inline PGM_P temp_units_name() { return input_temp_units == TEMPUNIT_K ? PSTR("Kelvin") : input_temp_units == TEMPUNIT_F ? PSTR("Fahrenheit") : PSTR("Celsius"); } static inline float to_temp_units(const float &f) { @@ -273,7 +325,7 @@ public: } } - #endif // ULTIPANEL && !DISABLE_M503 + #endif // HAS_LCD_MENU && !DISABLE_M503 static inline float value_celsius() { const float f = value_float(); @@ -299,30 +351,32 @@ public: } } + #define TEMP_UNIT(N) parser.to_temp_units(N) + #else // !TEMPERATURE_UNITS_SUPPORT - FORCE_INLINE static float value_celsius() { return value_float(); } - FORCE_INLINE static float value_celsius_diff() { return value_float(); } + static inline float value_celsius() { return value_float(); } + static inline float value_celsius_diff() { return value_float(); } + + #define TEMP_UNIT(N) (N) #endif // !TEMPERATURE_UNITS_SUPPORT - FORCE_INLINE static float value_feedrate() { return value_linear_units(); } + static inline float value_feedrate() { return value_linear_units(); } void unknown_command_error(); // Provide simple value accessors with default option - FORCE_INLINE static float floatval(const char c, const float dval=0.0) { return seenval(c) ? value_float() : dval; } - FORCE_INLINE static bool boolval(const char c, const bool dval=false) { return seenval(c) ? value_bool() : (seen(c) ? true : dval); } - FORCE_INLINE static uint8_t byteval(const char c, const uint8_t dval=0) { return seenval(c) ? value_byte() : dval; } - FORCE_INLINE static int16_t intval(const char c, const int16_t dval=0) { return seenval(c) ? value_int() : dval; } - FORCE_INLINE static uint16_t ushortval(const char c, const uint16_t dval=0) { return seenval(c) ? value_ushort() : dval; } - FORCE_INLINE static int32_t longval(const char c, const int32_t dval=0) { return seenval(c) ? value_long() : dval; } - FORCE_INLINE static uint32_t ulongval(const char c, const uint32_t dval=0) { return seenval(c) ? value_ulong() : dval; } - FORCE_INLINE static float linearval(const char c, const float dval=0) { return seenval(c) ? value_linear_units() : dval; } - FORCE_INLINE static float celsiusval(const char c, const float dval=0){ return seenval(c) ? value_celsius() : dval; } + static inline float floatval(const char c, const float dval=0.0) { return seenval(c) ? value_float() : dval; } + static inline bool boolval(const char c, const bool dval=false) { return seenval(c) ? value_bool() : (seen(c) ? true : dval); } + static inline uint8_t byteval(const char c, const uint8_t dval=0) { return seenval(c) ? value_byte() : dval; } + static inline int16_t intval(const char c, const int16_t dval=0) { return seenval(c) ? value_int() : dval; } + static inline uint16_t ushortval(const char c, const uint16_t dval=0) { return seenval(c) ? value_ushort() : dval; } + static inline int32_t longval(const char c, const int32_t dval=0) { return seenval(c) ? value_long() : dval; } + static inline uint32_t ulongval(const char c, const uint32_t dval=0) { return seenval(c) ? value_ulong() : dval; } + static inline float linearval(const char c, const float dval=0) { return seenval(c) ? value_linear_units() : dval; } + static inline float celsiusval(const char c, const float dval=0) { return seenval(c) ? value_celsius() : dval; } }; extern GCodeParser parser; - -#endif // _PARSER_H_ diff --git a/Marlin/src/gcode/queue.cpp b/Marlin/src/gcode/queue.cpp index 8eafd13990..0b6bb4ba77 100644 --- a/Marlin/src/gcode/queue.cpp +++ b/Marlin/src/gcode/queue.cpp @@ -33,8 +33,8 @@ #include "../module/temperature.h" #include "../Marlin.h" -#if HAS_COLOR_LEDS - #include "../feature/leds/leds.h" +#if ENABLED(PRINTER_EVENT_LEDS) + #include "../feature/leds/printer_event_leds.h" #endif #if ENABLED(POWER_LOSS_RECOVERY) @@ -84,7 +84,7 @@ bool send_ok[BUFSIZE]; * Used by Marlin internally to ensure that commands initiated from within * are enqueued ahead of any pending serial or sd card commands. */ -static const char *injected_commands_P = NULL; +static PGM_P injected_commands_P = NULL; void queue_setup() { // Send "ok" after commands by default @@ -181,14 +181,15 @@ static bool drain_injected_commands_P() { * Aborts the current queue, if any. * Note: drain_injected_commands_P() must be called repeatedly to drain the commands afterwards */ -void enqueue_and_echo_commands_P(const char * const pgcode) { +void enqueue_and_echo_commands_P(PGM_P const pgcode) { injected_commands_P = pgcode; (void)drain_injected_commands_P(); // first command executed asap (when possible) } #if HAS_QUEUE_NOW /** - * Enqueue and return only when commands are actually enqueued + * Enqueue and return only when commands are actually enqueued. + * Never call this from a G-code handler! */ void enqueue_and_echo_command_now(const char* cmd) { while (!enqueue_and_echo_command(cmd)) idle(); @@ -196,8 +197,9 @@ void enqueue_and_echo_commands_P(const char * const pgcode) { #if HAS_LCD_QUEUE_NOW /** * Enqueue from program memory and return only when commands are actually enqueued + * Never call this from a G-code handler! */ - void enqueue_and_echo_commands_now_P(const char * const pgcode) { + void enqueue_and_echo_commands_now_P(PGM_P const pgcode) { enqueue_and_echo_commands_P(pgcode); while (drain_injected_commands_P()) idle(); } @@ -249,7 +251,7 @@ void flush_and_request_resend() { ok_to_send(); } -void gcode_line_error(const char* err, uint8_t port) { +void gcode_line_error(PGM_P err, uint8_t port) { SERIAL_ERROR_START_P(port); serialprintPGM_P(port, err); SERIAL_ERRORLN_P(port, gcode_LastN); @@ -258,14 +260,15 @@ void gcode_line_error(const char* err, uint8_t port) { } static bool serial_data_available() { - return (MYSERIAL0.available() ? true : + return false + || MYSERIAL0.available() #if NUM_SERIAL > 1 - MYSERIAL1.available() ? true : + || MYSERIAL1.available() #endif - false); + ; } -static int read_serial(const int index) { +static int read_serial(const uint8_t index) { switch (index) { case 0: return MYSERIAL0.read(); #if NUM_SERIAL > 1 @@ -275,6 +278,263 @@ static int read_serial(const int index) { } } +#if ENABLED(FAST_FILE_TRANSFER) + + #if ENABLED(SDSUPPORT) + #define CARD_CHAR_P(C) SERIAL_CHAR_P(card.transfer_port, C) + #define CARD_ECHO_P(V) SERIAL_ECHO_P(card.transfer_port, V) + #define CARD_ECHOLN_P(V) SERIAL_ECHOLN_P(card.transfer_port, V) + #endif + + static bool serial_data_available(const uint8_t index) { + switch (index) { + case 0: return MYSERIAL0.available(); + #if NUM_SERIAL > 1 + case 1: return MYSERIAL1.available(); + #endif + default: return false; + } + } + + class BinaryStream { + public: + enum class StreamState : uint8_t { + STREAM_RESET, + PACKET_RESET, + STREAM_HEADER, + PACKET_HEADER, + PACKET_DATA, + PACKET_VALIDATE, + PACKET_RESEND, + PACKET_FLUSHRX, + PACKET_TIMEOUT, + STREAM_COMPLETE, + STREAM_FAILED, + }; + + #pragma pack(push, 1) + + struct StreamHeader { + uint16_t token; + uint32_t filesize; + }; + union { + uint8_t stream_header_bytes[sizeof(StreamHeader)]; + StreamHeader stream_header; + }; + + struct Packet { + struct Header { + uint32_t id; + uint16_t size, checksum; + }; + union { + uint8_t header_bytes[sizeof(Header)]; + Header header; + }; + uint32_t bytes_received; + uint16_t checksum; + millis_t timeout; + } packet{}; + + #pragma pack(pop) + + void packet_reset() { + packet.header.id = 0; + packet.header.size = 0; + packet.header.checksum = 0; + packet.bytes_received = 0; + packet.checksum = 0x53A2; + packet.timeout = millis() + STREAM_MAX_WAIT; + } + + void stream_reset() { + packets_received = 0; + bytes_received = 0; + packet_retries = 0; + buffer_next_index = 0; + stream_header.token = 0; + stream_header.filesize = 0; + } + + uint32_t checksum(uint32_t seed, uint8_t value) { + return ((seed ^ value) ^ (seed << 8)) & 0xFFFF; + } + + // read the next byte from the data stream keeping track of + // whether the stream times out from data starvation + // takes the data variable by reference in order to return status + bool stream_read(uint8_t& data) { + if (ELAPSED(millis(), packet.timeout)) { + stream_state = StreamState::PACKET_TIMEOUT; + return false; + } + if (!serial_data_available(card.transfer_port)) return false; + data = read_serial(card.transfer_port); + packet.timeout = millis() + STREAM_MAX_WAIT; + return true; + } + + template + void receive(char (&buffer)[buffer_size]) { + uint8_t data = 0; + millis_t tranfer_timeout = millis() + RX_TIMESLICE; + while (PENDING(millis(), tranfer_timeout)) { + switch (stream_state) { + case StreamState::STREAM_RESET: + stream_reset(); + case StreamState::PACKET_RESET: + packet_reset(); + stream_state = StreamState::PACKET_HEADER; + break; + case StreamState::STREAM_HEADER: // we could also transfer the filename in this packet, rather than handling it in the gcode + for (size_t i = 0; i < sizeof(stream_header); ++i) { + stream_header_bytes[i] = buffer[i]; + } + if (stream_header.token == 0x1234) { + stream_state = StreamState::PACKET_RESET; + bytes_received = 0; + time_stream_start = millis(); + CARD_ECHO_P("echo: Datastream initialized ("); + CARD_ECHO_P(stream_header.filesize); + CARD_ECHOLN_P("Bytes expected)"); + CARD_ECHO_P("so"); // confirm active stream and the maximum block size supported + CARD_CHAR_P(static_cast(buffer_size & 0xFF)); + CARD_CHAR_P(static_cast((buffer_size >> 8) & 0xFF)); + CARD_CHAR_P('\n'); + } + else { + CARD_ECHOLN_P("echo: Datastream initialization error (invalid token)"); + stream_state = StreamState::STREAM_FAILED; + } + buffer_next_index = 0; + break; + case StreamState::PACKET_HEADER: + if (!stream_read(data)) break; + + packet.header_bytes[packet.bytes_received++] = data; + if (packet.bytes_received == sizeof(Packet::Header)) { + if (packet.header.id == packets_received) { + buffer_next_index = 0; + packet.bytes_received = 0; + stream_state = StreamState::PACKET_DATA; + } + else { + CARD_ECHO_P("echo: Datastream packet out of order"); + stream_state = StreamState::PACKET_FLUSHRX; + } + } + break; + case StreamState::PACKET_DATA: + if (!stream_read(data)) break; + + if (buffer_next_index < buffer_size) { + buffer[buffer_next_index] = data; + } + else { + CARD_ECHO_P("echo: Datastream packet data buffer overrun"); + stream_state = StreamState::STREAM_FAILED; + break; + } + + packet.checksum = checksum(packet.checksum, data); + packet.bytes_received ++; + buffer_next_index ++; + + if (packet.bytes_received == packet.header.size) { + stream_state = StreamState::PACKET_VALIDATE; + } + break; + case StreamState::PACKET_VALIDATE: + if (packet.header.checksum == packet.checksum) { + packet_retries = 0; + packets_received ++; + bytes_received += packet.header.size; + + if (packet.header.id == 0) { // id 0 is always the stream descriptor + stream_state = StreamState::STREAM_HEADER; // defer packet confirmation to STREAM_HEADER state + } + else { + if (bytes_received < stream_header.filesize) { + stream_state = StreamState::PACKET_RESET; // reset and receive next packet + CARD_ECHOLN_P("ok"); // transmit confirm packet received and valid token + } + else { + stream_state = StreamState::STREAM_COMPLETE; // no more data required + } + if (card.write(buffer, buffer_next_index) < 0) { + stream_state = StreamState::STREAM_FAILED; + CARD_ECHO_P("echo: IO ERROR"); + break; + }; + } + } + else { + CARD_ECHO_P("echo: Block("); + CARD_ECHO_P(packet.header.id); + CARD_ECHOLN_P(") Corrupt"); + stream_state = StreamState::PACKET_FLUSHRX; + } + break; + case StreamState::PACKET_RESEND: + if (packet_retries < MAX_RETRIES) { + packet_retries ++; + stream_state = StreamState::PACKET_RESET; + CARD_ECHO_P("echo: Resend request "); + CARD_ECHOLN_P(packet_retries); + CARD_ECHOLN_P("rs"); // transmit resend packet token + } + else { + stream_state = StreamState::STREAM_FAILED; + } + break; + case StreamState::PACKET_FLUSHRX: + if (ELAPSED(millis(), packet.timeout)) { + stream_state = StreamState::PACKET_RESEND; + break; + } + if (!serial_data_available(card.transfer_port)) break; + read_serial(card.transfer_port); // throw away data + packet.timeout = millis() + STREAM_MAX_WAIT; + break; + case StreamState::PACKET_TIMEOUT: + CARD_ECHOLN_P("echo: Datastream timeout"); + stream_state = StreamState::PACKET_RESEND; + break; + case StreamState::STREAM_COMPLETE: + stream_state = StreamState::STREAM_RESET; + card.flag.binary_mode = false; + card.closefile(); + CARD_ECHO_P("echo: "); + CARD_ECHO_P(card.filename); + CARD_ECHO_P(" transfer completed @ "); + CARD_ECHO_P(((bytes_received / (millis() - time_stream_start) * 1000) / 1024 )); + CARD_ECHOLN_P("KiB/s"); + CARD_ECHOLN_P("sc"); // transmit stream complete token + return; + case StreamState::STREAM_FAILED: + stream_state = StreamState::STREAM_RESET; + card.flag.binary_mode = false; + card.closefile(); + card.removeFile(card.filename); + CARD_ECHOLN_P("echo: File transfer failed"); + CARD_ECHOLN_P("sf"); // transmit stream failed token + return; + } + } + } + + static const uint16_t STREAM_MAX_WAIT = 500, RX_TIMESLICE = 20, MAX_RETRIES = 3; + uint8_t packet_retries; + uint16_t buffer_next_index; + uint32_t packets_received, bytes_received; + millis_t time_stream_start; + StreamState stream_state = StreamState::STREAM_RESET; + + } binaryStream{}; + +#endif // FAST_FILE_TRANSFER + /** * Get all commands waiting on the serial port and queue them. * Exit when the buffer is full or when no more characters are @@ -282,7 +542,23 @@ static int read_serial(const int index) { */ inline void get_serial_commands() { static char serial_line_buffer[NUM_SERIAL][MAX_CMD_SIZE]; - static bool serial_comment_mode[NUM_SERIAL] = { false }; + static bool serial_comment_mode[NUM_SERIAL] = { false } + #if ENABLED(PAREN_COMMENTS) + , serial_comment_paren_mode[NUM_SERIAL] = { false } + #endif + ; + + #if ENABLED(FAST_FILE_TRANSFER) + if (card.flag.saving && card.flag.binary_mode) { + /** + * For binary stream file transfer, use serial_line_buffer as the working + * receive buffer (which limits the packet size to MAX_CMD_SIZE). + * The receive buffer also limits the packet size for reliable transmission. + */ + binaryStream.receive(serial_line_buffer[card.transfer_port]); + return; + } + #endif // If the command buffer is empty for too long, // send "wait" to indicate Marlin is still waiting. @@ -310,7 +586,11 @@ inline void get_serial_commands() { */ if (serial_char == '\n' || serial_char == '\r') { - serial_comment_mode[i] = false; // end of line == end of comment + // Start with comment mode off + serial_comment_mode[i] = false; + #if ENABLED(PAREN_COMMENTS) + serial_comment_paren_mode[i] = false; + #endif // Skip empty lines and comments if (!serial_count[i]) { thermalManager.manage_heater(); continue; } @@ -350,7 +630,7 @@ inline void get_serial_commands() { gcode_LastN = gcode_N; } #if ENABLED(SDSUPPORT) - else if (card.saving && strcmp(command, "M29") != 0) // No line number with M29 in Pronterface + else if (card.flag.saving && strcmp(command, "M29") != 0) // No line number with M29 in Pronterface return gcode_line_error(PSTR(MSG_ERR_NO_CHECKSUM), i); #endif @@ -379,11 +659,11 @@ inline void get_serial_commands() { // Process critical commands early if (strcmp(command, "M108") == 0) { wait_for_heatup = false; - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU wait_for_user = false; #endif } - if (strcmp(command, "M112") == 0) kill(PSTR(MSG_KILLED)); + if (strcmp(command, "M112") == 0) kill(); if (strcmp(command, "M410") == 0) quickstop_stepper(); #endif @@ -404,12 +684,24 @@ inline void get_serial_commands() { } else if (serial_char == '\\') { // Handle escapes // if we have one more character, copy it over - if ((c = read_serial(i)) >= 0 && !serial_comment_mode[i]) + if ((c = read_serial(i)) >= 0 && !serial_comment_mode[i] + #if ENABLED(PAREN_COMMENTS) + && !serial_comment_paren_mode[i] + #endif + ) serial_line_buffer[i][serial_count[i]++] = (char)c; } else { // it's not a newline, carriage return or escape char if (serial_char == ';') serial_comment_mode[i] = true; - if (!serial_comment_mode[i]) serial_line_buffer[i][serial_count[i]++] = serial_char; + #if ENABLED(PAREN_COMMENTS) + else if (serial_char == '(') serial_comment_paren_mode[i] = true; + else if (serial_char == ')') serial_comment_paren_mode[i] = false; + #endif + else if (!serial_comment_mode[i] + #if ENABLED(PAREN_COMMENTS) + && ! serial_comment_paren_mode[i] + #endif + ) serial_line_buffer[i][serial_count[i]++] = serial_char; } } // for NUM_SERIAL } // queue has space, serial has data @@ -424,9 +716,13 @@ inline void get_serial_commands() { */ inline void get_sdcard_commands() { static bool stop_buffering = false, - sd_comment_mode = false; + sd_comment_mode = false + #if ENABLED(PAREN_COMMENTS) + , sd_comment_paren_mode = false + #endif + ; - if (!IS_SD_PRINTING) return; + if (!IS_SD_PRINTING()) return; /** * '#' stops reading from SD to the buffer prematurely, so procedural @@ -445,31 +741,30 @@ inline void get_serial_commands() { card_eof = card.eof(); if (card_eof || n == -1 || sd_char == '\n' || sd_char == '\r' - || ((sd_char == '#' || sd_char == ':') && !sd_comment_mode) + || ((sd_char == '#' || sd_char == ':') && !sd_comment_mode + #if ENABLED(PAREN_COMMENTS) + && !sd_comment_paren_mode + #endif + ) ) { if (card_eof) { card.printingHasFinished(); - if (card.sdprinting) + if (IS_SD_PRINTING()) sd_count = 0; // If a sub-file was printing, continue from call point else { SERIAL_PROTOCOLLNPGM(MSG_FILE_PRINTED); #if ENABLED(PRINTER_EVENT_LEDS) - LCD_MESSAGEPGM(MSG_INFO_COMPLETED_PRINTS); - leds.set_green(); + printerEventLEDs.onPrintCompleted(); #if HAS_RESUME_CONTINUE - gcode.lights_off_after_print = true; enqueue_and_echo_commands_P(PSTR("M0 S" - #if ENABLED(NEWPANEL) + #if HAS_LCD_MENU "1800" #else "60" #endif )); - #else - safe_delay(2000); - leds.set_off(); #endif #endif // PRINTER_EVENT_LEDS } @@ -481,6 +776,9 @@ inline void get_serial_commands() { if (sd_char == '#') stop_buffering = true; sd_comment_mode = false; // for new command + #if ENABLED(PAREN_COMMENTS) + sd_comment_paren_mode = false; + #endif // Skip empty lines and comments if (!sd_count) { thermalManager.manage_heater(); continue; } @@ -498,27 +796,19 @@ inline void get_serial_commands() { } else { if (sd_char == ';') sd_comment_mode = true; - if (!sd_comment_mode) command_queue[cmd_queue_index_w][sd_count++] = sd_char; + #if ENABLED(PAREN_COMMENTS) + else if (sd_char == '(') sd_comment_paren_mode = true; + else if (sd_char == ')') sd_comment_paren_mode = false; + #endif + else if (!sd_comment_mode + #if ENABLED(PAREN_COMMENTS) + && ! sd_comment_paren_mode + #endif + ) command_queue[cmd_queue_index_w][sd_count++] = sd_char; } } } - #if ENABLED(POWER_LOSS_RECOVERY) - - inline bool drain_job_recovery_commands() { - static uint8_t job_recovery_commands_index = 0; // Resets on reboot - if (job_recovery_commands_count) { - if (_enqueuecommand(job_recovery_commands[job_recovery_commands_index])) { - ++job_recovery_commands_index; - if (!--job_recovery_commands_count) job_recovery_phase = JOB_RECOVERY_DONE; - } - return true; - } - return false; - } - - #endif - #endif // SDSUPPORT /** @@ -534,11 +824,6 @@ void get_available_commands() { get_serial_commands(); - #if ENABLED(POWER_LOSS_RECOVERY) - // Commands for power-loss recovery take precedence - if (job_recovery_phase == JOB_RECOVERY_YES && drain_job_recovery_commands()) return; - #endif - #if ENABLED(SDSUPPORT) get_sdcard_commands(); #endif @@ -553,7 +838,7 @@ void advance_command_queue() { #if ENABLED(SDSUPPORT) - if (card.saving) { + if (card.flag.saving) { char* command = command_queue[cmd_queue_index_r]; if (strstr_P(command, PSTR("M29"))) { // M29 closes the file @@ -562,11 +847,11 @@ void advance_command_queue() { #if !defined(__AVR__) || !defined(USBCON) #if ENABLED(SERIAL_STATS_DROPPED_RX) - SERIAL_ECHOLNPAIR("Dropped bytes: ", customizedSerial.dropped()); + SERIAL_ECHOLNPAIR("Dropped bytes: ", MYSERIAL0.dropped()); #endif #if ENABLED(SERIAL_STATS_MAX_RX_QUEUED) - SERIAL_ECHOLNPAIR("Max RX Queue Size: ", customizedSerial.rxMaxEnqueued()); + SERIAL_ECHOLNPAIR("Max RX Queue Size: ", MYSERIAL0.rxMaxEnqueued()); #endif #endif // !defined(__AVR__) || !defined(USBCON) @@ -575,7 +860,7 @@ void advance_command_queue() { else { // Write the string from the read buffer to SD card.write_command(command); - if (card.logging) + if (card.flag.logging) gcode.process_next_command(); // The card is saving because it's logging else ok_to_send(); @@ -584,7 +869,7 @@ void advance_command_queue() { else { gcode.process_next_command(); #if ENABLED(POWER_LOSS_RECOVERY) - if (card.cardOK && card.sdprinting) save_job_recovery_info(); + if (IS_SD_PRINTING()) recovery.save(); #endif } diff --git a/Marlin/src/gcode/queue.h b/Marlin/src/gcode/queue.h index 5b37f14ae0..0f4f95cd0f 100644 --- a/Marlin/src/gcode/queue.h +++ b/Marlin/src/gcode/queue.h @@ -19,15 +19,13 @@ * along with this program. If not, see . * */ +#pragma once /** * queue.h - The G-code command queue, which holds commands before they * go to the parser and dispatcher. */ -#ifndef GCODE_QUEUE_H -#define GCODE_QUEUE_H - #include "../inc/MarlinConfig.h" /** @@ -90,14 +88,14 @@ void ok_to_send(); * Aborts the current queue, if any. * Note: drain_injected_commands_P() must be called repeatedly to drain the commands afterwards */ -void enqueue_and_echo_commands_P(const char * const pgcode); +void enqueue_and_echo_commands_P(PGM_P const pgcode); /** * Enqueue with Serial Echo */ bool enqueue_and_echo_command(const char* cmd); -#define HAS_LCD_QUEUE_NOW (ENABLED(MALYAN_LCD) || (ENABLED(ULTIPANEL) && (ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(PID_AUTOTUNE_MENU) || ENABLED(ADVANCED_PAUSE_FEATURE)))) +#define HAS_LCD_QUEUE_NOW (ENABLED(MALYAN_LCD) || (HAS_LCD_MENU && (ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(PID_AUTOTUNE_MENU) || ENABLED(ADVANCED_PAUSE_FEATURE)))) #define HAS_QUEUE_NOW (ENABLED(SDSUPPORT) || HAS_LCD_QUEUE_NOW) #if HAS_QUEUE_NOW @@ -109,7 +107,7 @@ bool enqueue_and_echo_command(const char* cmd); /** * Enqueue from program memory and return only when commands are actually enqueued */ - void enqueue_and_echo_commands_now_P(const char * const cmd); + void enqueue_and_echo_commands_now_P(PGM_P const cmd); #endif #endif @@ -125,5 +123,3 @@ void get_available_commands(); * Get the next command in the queue, optionally log it to SD, then dispatch it */ void advance_command_queue(); - -#endif // GCODE_QUEUE_H diff --git a/Marlin/src/gcode/sdcard/M20-M30_M32-M34_M928.cpp b/Marlin/src/gcode/sdcard/M20-M30_M32-M34_M524_M928.cpp similarity index 82% rename from Marlin/src/gcode/sdcard/M20-M30_M32-M34_M928.cpp rename to Marlin/src/gcode/sdcard/M20-M30_M32-M34_M524_M928.cpp index 6a982b74b0..eac8707f99 100644 --- a/Marlin/src/gcode/sdcard/M20-M30_M32-M34_M928.cpp +++ b/Marlin/src/gcode/sdcard/M20-M30_M32-M34_M524_M928.cpp @@ -28,6 +28,7 @@ #include "../../sd/cardreader.h" #include "../../module/printcounter.h" #include "../../module/stepper.h" +#include "../../lcd/ultralcd.h" #if ENABLED(POWER_LOSS_RECOVERY) #include "../../feature/power_loss_recovery.h" @@ -100,6 +101,8 @@ void GcodeSuite::M24() { else #endif print_job_timer.start(); + + ui.reset_status(); } /** @@ -118,7 +121,7 @@ void GcodeSuite::M25() { * M26: Set SD Card file index */ void GcodeSuite::M26() { - if (card.cardOK && parser.seenval('S')) + if (card.flag.cardOK && parser.seenval('S')) card.setIndex(parser.value_long()); } @@ -157,21 +160,59 @@ void GcodeSuite::M27() { /** * M28: Start SD Write */ -void GcodeSuite::M28() { card.openFile(parser.string_arg, false); } +void GcodeSuite::M28() { + + #if ENABLED(FAST_FILE_TRANSFER) + + const int16_t port = + #if NUM_SERIAL > 1 + command_queue_port[cmd_queue_index_r] + #else + 0 + #endif + ; + + bool binary_mode = false; + char *p = parser.string_arg; + if (p[0] == 'B' && NUMERIC(p[1])) { + binary_mode = p[1] > '0'; + p += 2; + while (*p == ' ') ++p; + } + + // Binary transfer mode + if ((card.flag.binary_mode = binary_mode)) { + SERIAL_ECHO_START_P(port); + SERIAL_ECHO_P(port, " preparing to receive: "); + SERIAL_ECHOLN_P(port, p); + card.openFile(p, false); + #if NUM_SERIAL > 1 + card.transfer_port = port; + #endif + } + else + card.openFile(p, false); + + #else + + card.openFile(parser.string_arg, false); + + #endif +} /** * M29: Stop SD Write * Processed in write to file routine */ void GcodeSuite::M29() { - // card.saving = false; + // card.flag.saving = false; } /** * M30 : Delete SD Card file */ void GcodeSuite::M30() { - if (card.cardOK) { + if (card.flag.cardOK) { card.closefile(); card.removeFile(parser.string_arg); } @@ -188,9 +229,9 @@ void GcodeSuite::M30() { * */ void GcodeSuite::M32() { - if (card.sdprinting) planner.synchronize(); + if (IS_SD_PRINTING()) planner.synchronize(); - if (card.cardOK) { + if (card.flag.cardOK) { const bool call_procedure = parser.boolval('P'); card.openFile(parser.string_arg, true, call_procedure); @@ -244,6 +285,13 @@ void GcodeSuite::M32() { #endif // SDCARD_SORT_ALPHA && SDSORT_GCODE +/** + * M524: Abort the current SD print job (started with M24) + */ +void GcodeSuite::M524() { + if (IS_SD_PRINTING()) card.flag.abort_sd_printing = true; +} + /** * M928: Start SD Write */ diff --git a/Marlin/src/gcode/stats/M31.cpp b/Marlin/src/gcode/stats/M31.cpp index 958556e544..98eb3a973b 100644 --- a/Marlin/src/gcode/stats/M31.cpp +++ b/Marlin/src/gcode/stats/M31.cpp @@ -40,7 +40,7 @@ void GcodeSuite::M31() { char buffer[21]; duration_t elapsed = print_job_timer.duration(); elapsed.toString(buffer); - lcd_setstatus(buffer); + ui.set_status(buffer); SERIAL_ECHO_START_P(port); SERIAL_ECHOLNPAIR_P(port, "Print time: ", buffer); diff --git a/Marlin/src/gcode/stats/M75-M78.cpp b/Marlin/src/gcode/stats/M75-M78.cpp index 351efd10c7..0f06b8a6df 100644 --- a/Marlin/src/gcode/stats/M75-M78.cpp +++ b/Marlin/src/gcode/stats/M75-M78.cpp @@ -23,20 +23,39 @@ #include "../gcode.h" #include "../../module/printcounter.h" +#if ENABLED(EXTENSIBLE_UI) + #include "../../lcd/extensible_ui/ui_api.h" +#endif + /** * M75: Start print timer */ -void GcodeSuite::M75() { print_job_timer.start(); } +void GcodeSuite::M75() { + print_job_timer.start(); + #if ENABLED(EXTENSIBLE_UI) + ExtUI::onPrintTimerStarted(); + #endif +} /** * M76: Pause print timer */ -void GcodeSuite::M76() { print_job_timer.pause(); } +void GcodeSuite::M76() { + print_job_timer.pause(); + #if ENABLED(EXTENSIBLE_UI) + ExtUI::onPrintTimerPaused(); + #endif +} /** * M77: Stop print timer */ -void GcodeSuite::M77() { print_job_timer.stop(); } +void GcodeSuite::M77() { + print_job_timer.stop(); + #if ENABLED(EXTENSIBLE_UI) + ExtUI::onPrintTimerStopped(); + #endif +} #if ENABLED(PRINTCOUNTER) diff --git a/Marlin/src/gcode/temperature/M104_M109.cpp b/Marlin/src/gcode/temperature/M104_M109.cpp index 07859ca21e..39d65dc1a6 100644 --- a/Marlin/src/gcode/temperature/M104_M109.cpp +++ b/Marlin/src/gcode/temperature/M104_M109.cpp @@ -31,29 +31,34 @@ #include "../../module/printcounter.h" #endif -#if ENABLED(PRINTER_EVENT_LEDS) - #include "../../feature/leds/leds.h" +#if ENABLED(SINGLENOZZLE) + #include "../../module/tool_change.h" #endif /** * M104: Set hot end temperature */ void GcodeSuite::M104() { - if (get_target_extruder_from_command()) return; + if (DEBUGGING(DRYRUN)) return; - const uint8_t e = target_extruder; - - #if ENABLED(SINGLENOZZLE) - if (e != active_extruder) return; + #if ENABLED(MIXING_EXTRUDER) && MIXING_VIRTUAL_TOOLS > 1 + constexpr int8_t target_extruder = 0; + #else + const int8_t target_extruder = get_target_extruder_from_command(); + if (target_extruder < 0) return; #endif if (parser.seenval('S')) { const int16_t temp = parser.value_celsius(); - thermalManager.setTargetHotend(temp, e); + #if ENABLED(SINGLENOZZLE) + singlenozzle_temp[target_extruder] = temp; + if (target_extruder != active_extruder) return; + #endif + thermalManager.setTargetHotend(temp, target_extruder); #if ENABLED(DUAL_X_CARRIAGE) - if (dxc_is_duplicating() && e == 0) + if (dxc_is_duplicating() && target_extruder == 0) thermalManager.setTargetHotend(temp ? temp + duplicate_extruder_temp_offset : 0, 1); #endif @@ -66,7 +71,7 @@ void GcodeSuite::M104() { */ if (temp <= (EXTRUDE_MINTEMP) / 2) { print_job_timer.stop(); - lcd_reset_status(); + ui.reset_status(); } #endif } @@ -80,26 +85,25 @@ void GcodeSuite::M104() { * M109: Sxxx Wait for extruder(s) to reach temperature. Waits only when heating. * Rxxx Wait for extruder(s) to reach temperature. Waits when heating and cooling. */ - -#ifndef MIN_COOLING_SLOPE_DEG - #define MIN_COOLING_SLOPE_DEG 1.50 -#endif -#ifndef MIN_COOLING_SLOPE_TIME - #define MIN_COOLING_SLOPE_TIME 60 -#endif - void GcodeSuite::M109() { - if (get_target_extruder_from_command()) return; if (DEBUGGING(DRYRUN)) return; - #if ENABLED(SINGLENOZZLE) - if (target_extruder != active_extruder) return; + #if ENABLED(MIXING_EXTRUDER) && MIXING_VIRTUAL_TOOLS > 1 + constexpr int8_t target_extruder = 0; + #else + const int8_t target_extruder = get_target_extruder_from_command(); + if (target_extruder < 0) return; #endif - const bool no_wait_for_cooling = parser.seenval('S'); - if (no_wait_for_cooling || parser.seenval('R')) { + const bool no_wait_for_cooling = parser.seenval('S'), + set_temp = no_wait_for_cooling || parser.seenval('R'); + if (set_temp) { const int16_t temp = parser.value_celsius(); + #if ENABLED(SINGLENOZZLE) + singlenozzle_temp[target_extruder] = temp; + if (target_extruder != active_extruder) return; + #endif thermalManager.setTargetHotend(temp, target_extruder); #if ENABLED(DUAL_X_CARRIAGE) @@ -115,132 +119,22 @@ void GcodeSuite::M109() { */ if (parser.value_celsius() <= (EXTRUDE_MINTEMP) / 2) { print_job_timer.stop(); - lcd_reset_status(); + ui.reset_status(); } else print_job_timer.start(); #endif #if ENABLED(ULTRA_LCD) - const bool heating = thermalManager.isHeatingHotend(target_extruder); - if (heating || !no_wait_for_cooling) - #if HOTENDS > 1 - lcd_status_printf_P(0, heating ? PSTR("E%i " MSG_HEATING) : PSTR("E%i " MSG_COOLING), target_extruder + 1); - #else - lcd_setstatusPGM(heating ? PSTR("E " MSG_HEATING) : PSTR("E " MSG_COOLING)); - #endif + if (thermalManager.isHeatingHotend(target_extruder) || !no_wait_for_cooling) + thermalManager.set_heating_message(target_extruder); #endif } - else return; #if ENABLED(AUTOTEMP) planner.autotemp_M104_M109(); #endif - #if TEMP_RESIDENCY_TIME > 0 - millis_t residency_start_ms = 0; - // Loop until the temperature has stabilized - #define TEMP_CONDITIONS (!residency_start_ms || PENDING(now, residency_start_ms + (TEMP_RESIDENCY_TIME) * 1000UL)) - #else - // Loop until the temperature is very close target - #define TEMP_CONDITIONS (wants_to_cool ? thermalManager.isCoolingHotend(target_extruder) : thermalManager.isHeatingHotend(target_extruder)) - #endif - - float target_temp = -1.0, old_temp = 9999.0; - bool wants_to_cool = false; - wait_for_heatup = true; - millis_t now, next_temp_ms = 0, next_cool_check_ms = 0; - - #if DISABLED(BUSY_WHILE_HEATING) - KEEPALIVE_STATE(NOT_BUSY); - #endif - - #if ENABLED(PRINTER_EVENT_LEDS) - const float start_temp = thermalManager.degHotend(target_extruder); - uint8_t old_blue = 0; - #endif - - do { - // Target temperature might be changed during the loop - if (target_temp != thermalManager.degTargetHotend(target_extruder)) { - wants_to_cool = thermalManager.isCoolingHotend(target_extruder); - target_temp = thermalManager.degTargetHotend(target_extruder); - - // Exit if S, continue if S, R, or R - if (no_wait_for_cooling && wants_to_cool) break; - } - - now = millis(); - if (ELAPSED(now, next_temp_ms)) { //Print temp & remaining time every 1s while waiting - next_temp_ms = now + 1000UL; - thermalManager.print_heaterstates(); - #if TEMP_RESIDENCY_TIME > 0 - SERIAL_PROTOCOLPGM(" W:"); - if (residency_start_ms) - SERIAL_PROTOCOL(long((((TEMP_RESIDENCY_TIME) * 1000UL) - (now - residency_start_ms)) / 1000UL)); - else - SERIAL_PROTOCOLCHAR('?'); - #endif - SERIAL_EOL(); - } - - idle(); - reset_stepper_timeout(); // Keep steppers powered - - const float temp = thermalManager.degHotend(target_extruder); - - #if ENABLED(PRINTER_EVENT_LEDS) - // Gradually change LED strip from violet to red as nozzle heats up - if (!wants_to_cool) { - const uint8_t blue = map(constrain(temp, start_temp, target_temp), start_temp, target_temp, 255, 0); - if (blue != old_blue) { - old_blue = blue; - leds.set_color( - MakeLEDColor(255, 0, blue, 0, pixels.getBrightness()) - #if ENABLED(NEOPIXEL_IS_SEQUENTIAL) - , true - #endif - ); - } - } - #endif - - #if TEMP_RESIDENCY_TIME > 0 - - const float temp_diff = ABS(target_temp - temp); - - if (!residency_start_ms) { - // Start the TEMP_RESIDENCY_TIME timer when we reach target temp for the first time. - if (temp_diff < TEMP_WINDOW) residency_start_ms = now; - } - else if (temp_diff > TEMP_HYSTERESIS) { - // Restart the timer whenever the temperature falls outside the hysteresis. - residency_start_ms = now; - } - - #endif - - // Prevent a wait-forever situation if R is misused i.e. M109 R0 - if (wants_to_cool) { - // break after MIN_COOLING_SLOPE_TIME seconds - // if the temperature did not drop at least MIN_COOLING_SLOPE_DEG - if (!next_cool_check_ms || ELAPSED(now, next_cool_check_ms)) { - if (old_temp - temp < float(MIN_COOLING_SLOPE_DEG)) break; - next_cool_check_ms = now + 1000UL * MIN_COOLING_SLOPE_TIME; - old_temp = temp; - } - } - - } while (wait_for_heatup && TEMP_CONDITIONS); - - if (wait_for_heatup) { - lcd_reset_status(); - #if ENABLED(PRINTER_EVENT_LEDS) - leds.set_white(); - #endif - } - - #if DISABLED(BUSY_WHILE_HEATING) - KEEPALIVE_STATE(IN_HANDLER); - #endif + if (set_temp) + (void)thermalManager.wait_for_hotend(target_extruder, no_wait_for_cooling); } diff --git a/Marlin/src/gcode/temperature/M105.cpp b/Marlin/src/gcode/temperature/M105.cpp index 4216c417e7..c0678c03c6 100644 --- a/Marlin/src/gcode/temperature/M105.cpp +++ b/Marlin/src/gcode/temperature/M105.cpp @@ -31,7 +31,9 @@ * M105: Read hot end and bed temperature */ void GcodeSuite::M105() { - if (get_target_extruder_from_command()) return; + + const int8_t target_extruder = get_target_extruder_from_command(); + if (target_extruder < 0) return; #if NUM_SERIAL > 1 const int16_t port = command_queue_port[cmd_queue_index_r]; @@ -39,9 +41,9 @@ void GcodeSuite::M105() { #if HAS_TEMP_SENSOR SERIAL_PROTOCOLPGM_P(port, MSG_OK); - thermalManager.print_heaterstates( + thermalManager.print_heater_states(target_extruder #if NUM_SERIAL > 1 - port + , port #endif ); #else // !HAS_TEMP_SENSOR diff --git a/Marlin/src/gcode/temperature/M106_M107.cpp b/Marlin/src/gcode/temperature/M106_M107.cpp index b8bdc03d61..12e2dc4f26 100644 --- a/Marlin/src/gcode/temperature/M106_M107.cpp +++ b/Marlin/src/gcode/temperature/M106_M107.cpp @@ -25,7 +25,12 @@ #if FAN_COUNT > 0 #include "../gcode.h" -#include "../../Marlin.h" // for fanSpeeds — should move those to Planner +#include "../../Marlin.h" // for fan_speed — should move those to Planner + +#if ENABLED(SINGLENOZZLE) + #include "../../module/motion.h" + #include "../../module/tool_change.h" +#endif /** * M106: Set Fan Speed @@ -42,27 +47,35 @@ */ void GcodeSuite::M106() { const uint8_t p = parser.byteval('P'); + const uint16_t s = parser.ushortval('S', 255); + + #if ENABLED(SINGLENOZZLE) + if (p != active_extruder) { + if (p < EXTRUDERS) singlenozzle_fan_speed[p] = MIN(s, 255U); + return; + } + #endif + if (p < FAN_COUNT) { #if ENABLED(EXTRA_FAN_SPEED) const int16_t t = parser.intval('T'); if (t > 0) { switch (t) { case 1: - fanSpeeds[p] = old_fanSpeeds[p]; + fan_speed[p] = old_fan_speed[p]; break; case 2: - old_fanSpeeds[p] = fanSpeeds[p]; - fanSpeeds[p] = new_fanSpeeds[p]; + old_fan_speed[p] = fan_speed[p]; + fan_speed[p] = new_fan_speed[p]; break; default: - new_fanSpeeds[p] = MIN(t, 255); + new_fan_speed[p] = MIN(t, 255U); break; } return; } #endif // EXTRA_FAN_SPEED - const uint16_t s = parser.ushortval('S', 255); - fanSpeeds[p] = MIN(s, 255U); + fan_speed[p] = MIN(s, 255U); } } @@ -71,7 +84,14 @@ void GcodeSuite::M106() { */ void GcodeSuite::M107() { const uint16_t p = parser.ushortval('P'); - if (p < FAN_COUNT) fanSpeeds[p] = 0; + #if ENABLED(SINGLENOZZLE) + if (p != active_extruder) { + if (p < EXTRUDERS) singlenozzle_fan_speed[p] = 0; + return; + } + #endif + + if (p < FAN_COUNT) fan_speed[p] = 0; } #endif // FAN_COUNT > 0 diff --git a/Marlin/src/gcode/temperature/M140_M190.cpp b/Marlin/src/gcode/temperature/M140_M190.cpp index c51c643288..2da964f05a 100644 --- a/Marlin/src/gcode/temperature/M140_M190.cpp +++ b/Marlin/src/gcode/temperature/M140_M190.cpp @@ -47,13 +47,6 @@ void GcodeSuite::M140() { if (parser.seenval('S')) thermalManager.setTargetBed(parser.value_celsius()); } -#ifndef MIN_COOLING_SLOPE_DEG_BED - #define MIN_COOLING_SLOPE_DEG_BED 1.50 -#endif -#ifndef MIN_COOLING_SLOPE_TIME_BED - #define MIN_COOLING_SLOPE_TIME_BED 60 -#endif - /** * M190: Sxxx Wait for bed current temp to reach target temp. Waits only when heating * Rxxx Wait for bed current temp to reach target temp. Waits when heating and cooling @@ -71,110 +64,9 @@ void GcodeSuite::M190() { } else return; - lcd_setstatusPGM(thermalManager.isHeatingBed() ? PSTR(MSG_BED_HEATING) : PSTR(MSG_BED_COOLING)); + ui.set_status_P(thermalManager.isHeatingBed() ? PSTR(MSG_BED_HEATING) : PSTR(MSG_BED_COOLING)); - #if TEMP_BED_RESIDENCY_TIME > 0 - millis_t residency_start_ms = 0; - // Loop until the temperature has stabilized - #define TEMP_BED_CONDITIONS (!residency_start_ms || PENDING(now, residency_start_ms + (TEMP_BED_RESIDENCY_TIME) * 1000UL)) - #else - // Loop until the temperature is very close target - #define TEMP_BED_CONDITIONS (wants_to_cool ? thermalManager.isCoolingBed() : thermalManager.isHeatingBed()) - #endif - - float target_temp = -1, old_temp = 9999; - bool wants_to_cool = false; - wait_for_heatup = true; - millis_t now, next_temp_ms = 0, next_cool_check_ms = 0; - - #if DISABLED(BUSY_WHILE_HEATING) - KEEPALIVE_STATE(NOT_BUSY); - #endif - - target_extruder = active_extruder; // for print_heaterstates - - #if ENABLED(PRINTER_EVENT_LEDS) - const float start_temp = thermalManager.degBed(); - uint8_t old_red = 127; - #endif - - do { - // Target temperature might be changed during the loop - if (target_temp != thermalManager.degTargetBed()) { - wants_to_cool = thermalManager.isCoolingBed(); - target_temp = thermalManager.degTargetBed(); - - // Exit if S, continue if S, R, or R - if (no_wait_for_cooling && wants_to_cool) break; - } - - now = millis(); - if (ELAPSED(now, next_temp_ms)) { //Print Temp Reading every 1 second while heating up. - next_temp_ms = now + 1000UL; - thermalManager.print_heaterstates(); - #if TEMP_BED_RESIDENCY_TIME > 0 - SERIAL_PROTOCOLPGM(" W:"); - if (residency_start_ms) - SERIAL_PROTOCOL(long((((TEMP_BED_RESIDENCY_TIME) * 1000UL) - (now - residency_start_ms)) / 1000UL)); - else - SERIAL_PROTOCOLCHAR('?'); - #endif - SERIAL_EOL(); - } - - idle(); - reset_stepper_timeout(); // Keep steppers powered - - const float temp = thermalManager.degBed(); - - #if ENABLED(PRINTER_EVENT_LEDS) - // Gradually change LED strip from blue to violet as bed heats up - if (!wants_to_cool) { - const uint8_t red = map(constrain(temp, start_temp, target_temp), start_temp, target_temp, 0, 255); - if (red != old_red) { - old_red = red; - leds.set_color( - MakeLEDColor(red, 0, 255, 0, pixels.getBrightness()) - #if ENABLED(NEOPIXEL_IS_SEQUENTIAL) - , true - #endif - ); - } - } - #endif - - #if TEMP_BED_RESIDENCY_TIME > 0 - - const float temp_diff = ABS(target_temp - temp); - - if (!residency_start_ms) { - // Start the TEMP_BED_RESIDENCY_TIME timer when we reach target temp for the first time. - if (temp_diff < TEMP_BED_WINDOW) residency_start_ms = now; - } - else if (temp_diff > TEMP_BED_HYSTERESIS) { - // Restart the timer whenever the temperature falls outside the hysteresis. - residency_start_ms = now; - } - - #endif // TEMP_BED_RESIDENCY_TIME > 0 - - // Prevent a wait-forever situation if R is misused i.e. M190 R0 - if (wants_to_cool) { - // Break after MIN_COOLING_SLOPE_TIME_BED seconds - // if the temperature did not drop at least MIN_COOLING_SLOPE_DEG_BED - if (!next_cool_check_ms || ELAPSED(now, next_cool_check_ms)) { - if (old_temp - temp < float(MIN_COOLING_SLOPE_DEG_BED)) break; - next_cool_check_ms = now + 1000UL * MIN_COOLING_SLOPE_TIME_BED; - old_temp = temp; - } - } - - } while (wait_for_heatup && TEMP_BED_CONDITIONS); - - if (wait_for_heatup) lcd_reset_status(); - #if DISABLED(BUSY_WHILE_HEATING) - KEEPALIVE_STATE(IN_HANDLER); - #endif + thermalManager.wait_for_bed(no_wait_for_cooling); } #endif // HAS_HEATED_BED diff --git a/Marlin/src/gcode/temperature/M303.cpp b/Marlin/src/gcode/temperature/M303.cpp index 583ea9d7e4..f701277854 100644 --- a/Marlin/src/gcode/temperature/M303.cpp +++ b/Marlin/src/gcode/temperature/M303.cpp @@ -20,6 +20,10 @@ * */ +#include "../../inc/MarlinConfig.h" + +#if HAS_PID_HEATING + #include "../gcode.h" #include "../../module/temperature.h" @@ -32,26 +36,36 @@ * U with a non-zero value will apply the result to current settings */ void GcodeSuite::M303() { - #if HAS_PID_HEATING - const int e = parser.intval('E'), c = parser.intval('C', 5); - const bool u = parser.boolval('U'); - int16_t temp = parser.celsiusval('S', e < 0 ? 70 : 150); + const int8_t e = parser.intval('E'); - if (WITHIN(e, 0, HOTENDS - 1)) - target_extruder = e; - - #if DISABLED(BUSY_WHILE_HEATING) - KEEPALIVE_STATE(NOT_BUSY); + if (!WITHIN(e, 0 + #if ENABLED(PIDTEMPBED) + -1 #endif - - thermalManager.PID_autotune(temp, e, c, u); - - #if DISABLED(BUSY_WHILE_HEATING) - KEEPALIVE_STATE(IN_HANDLER); + , + #if ENABLED(PIDTEMP) + HOTENDS #endif - #else - SERIAL_ERROR_START(); - SERIAL_ERRORLNPGM(MSG_ERR_M303_DISABLED); + -1 + )) { + SERIAL_ECHOLNPGM(MSG_PID_BAD_EXTRUDER_NUM); + return; + } + + const int c = parser.intval('C', 5); + const bool u = parser.boolval('U'); + const int16_t temp = parser.celsiusval('S', e < 0 ? 70 : 150); + + #if DISABLED(BUSY_WHILE_HEATING) + KEEPALIVE_STATE(NOT_BUSY); + #endif + + thermalManager.PID_autotune(temp, e, c, u); + + #if DISABLED(BUSY_WHILE_HEATING) + KEEPALIVE_STATE(IN_HANDLER); #endif } + +#endif // HAS_PID_HEATING diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index aaa6d5462d..ad0a8d35d0 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -19,17 +19,13 @@ * along with this program. If not, see . * */ +#pragma once /** * Conditionals_LCD.h * Conditionals that need to be set before Configuration_adv.h or pins.h */ -#ifndef CONDITIONALS_LCD_H // Get the LCD defines which are needed first -#define CONDITIONALS_LCD_H - -#define LCD_HAS_DIRECTIONAL_BUTTONS (BUTTON_EXISTS(UP) || BUTTON_EXISTS(DWN) || BUTTON_EXISTS(LFT) || BUTTON_EXISTS(RT)) - #if ENABLED(CARTESIO_UI) #define DOGLCD @@ -44,17 +40,17 @@ #elif ENABLED(ZONESTAR_LCD) + #define ADC_KEYPAD #define REPRAPWORLD_KEYPAD #define REPRAPWORLD_KEYPAD_MOVE_STEP 10.0 - #define ADC_KEYPAD #define ADC_KEY_NUM 8 #define ULTIPANEL // this helps to implement ADC_KEYPAD menus + #define REVERSE_MENU_DIRECTION #define ENCODER_PULSES_PER_STEP 1 #define ENCODER_STEPS_PER_MENU_ITEM 1 #define ENCODER_FEEDRATE_DEADZONE 2 - #define REVERSE_MENU_DIRECTION #elif ENABLED(RADDS_DISPLAY) #define ULTIPANEL @@ -298,88 +294,37 @@ #define ULTIPANEL #endif -#if ENABLED(DOGLCD) // Change number of lines to match the DOG graphic display - #ifndef LCD_WIDTH - #ifdef LCD_WIDTH_OVERRIDE - #define LCD_WIDTH LCD_WIDTH_OVERRIDE - #else - #define LCD_WIDTH 22 - #endif - #endif - #ifndef LCD_HEIGHT - #define LCD_HEIGHT 5 - #endif -#endif - -#if ENABLED(NO_LCD_MENUS) - #undef ULTIPANEL -#endif - #if ENABLED(ULTIPANEL) #define NEWPANEL // Disable this if you actually have no click-encoder panel #define ULTRA_LCD - #ifndef LCD_WIDTH - #define LCD_WIDTH 20 - #endif - #ifndef LCD_HEIGHT - #define LCD_HEIGHT 4 - #endif -#elif ENABLED(ULTRA_LCD) // no panel but just LCD - #ifndef LCD_WIDTH - #define LCD_WIDTH 16 - #endif - #ifndef LCD_HEIGHT - #define LCD_HEIGHT 2 - #endif #endif -#if ENABLED(DOGLCD) - /* Custom characters defined in font Marlin_symbols.fon which was merged to ISO10646-0-3.bdf */ - // \x00 intentionally skipped to avoid problems in strings - #define LCD_STR_REFRESH "\x01" - #define LCD_STR_FOLDER "\x02" - #define LCD_STR_ARROW_RIGHT "\x03" - #define LCD_STR_UPLEVEL "\x04" - #define LCD_STR_CLOCK "\x05" - #define LCD_STR_FEEDRATE "\x06" - #define LCD_STR_BEDTEMP "\x07" - #define LCD_STR_THERMOMETER "\x08" - #define LCD_STR_DEGREE "\x09" +// Aliases for LCD features +#define HAS_SPI_LCD ENABLED(ULTRA_LCD) +#define HAS_GRAPHICAL_LCD ENABLED(DOGLCD) +#define HAS_CHARACTER_LCD (HAS_SPI_LCD && !HAS_GRAPHICAL_LCD) +#define HAS_LCD_MENU (ENABLED(ULTIPANEL) && DISABLED(NO_LCD_MENUS)) - #define LCD_STR_SPECIAL_MAX '\x09' - // Maximum here is 0x1F because 0x20 is ' ' (space) and the normal charsets begin. - // Better stay below 0x10 because DISPLAY_CHARSET_HD44780_WESTERN begins here. +#define HAS_ADC_BUTTONS ENABLED(ADC_KEYPAD) +#define HAS_DIGITAL_BUTTONS (!HAS_ADC_BUTTONS && ENABLED(NEWPANEL)) +#define HAS_SHIFT_ENCODER (!HAS_ADC_BUTTONS && (ENABLED(REPRAPWORLD_KEYPAD) || (HAS_SPI_LCD && DISABLED(NEWPANEL)))) +#define HAS_ENCODER_WHEEL (!HAS_ADC_BUTTONS && ENABLED(NEWPANEL)) - // Symbol characters - #define LCD_STR_FILAM_DIA "\xf8" - #define LCD_STR_FILAM_MUL "\xa4" -#else - // Custom characters defined in the first 8 characters of the LCD - #define LCD_BEDTEMP_CHAR 0x00 // Print only as a char. This will have 'unexpected' results when used in a string! - #define LCD_DEGREE_CHAR 0x01 - #define LCD_STR_THERMOMETER "\x02" // Still used with string concatenation - #define LCD_UPLEVEL_CHAR 0x03 - #define LCD_STR_REFRESH "\x04" - #define LCD_STR_FOLDER "\x05" - #define LCD_FEEDRATE_CHAR 0x06 - #define LCD_CLOCK_CHAR 0x07 - #define LCD_STR_ARROW_RIGHT ">" /* from the default character set */ -#endif +// I2C buttons must be read in the main thread +#define HAS_SLOW_BUTTONS (ENABLED(LCD_I2C_VIKI) || ENABLED(LCD_I2C_PANELOLU2)) -/** - * Default LCD contrast for dogm-like LCD displays - */ -#if ENABLED(DOGLCD) - - #define HAS_LCD_CONTRAST ( \ - ENABLED(MAKRPANEL) \ - || ENABLED(CARTESIO_UI) \ - || ENABLED(VIKI2) \ - || ENABLED(AZSMZ_12864) \ - || ENABLED(miniVIKI) \ - || ENABLED(ELB_FULL_GRAPHIC_CONTROLLER) \ +#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 @@ -394,14 +339,12 @@ #endif // Boot screens -#if DISABLED(ULTRA_LCD) +#if !HAS_SPI_LCD #undef SHOW_BOOTSCREEN #elif !defined(BOOTSCREEN_TIMEOUT) #define BOOTSCREEN_TIMEOUT 2500 #endif -#define HAS_DEBUG_MENU (ENABLED(ULTIPANEL) && ENABLED(LCD_PROGRESS_BAR_TEST)) - /** * Extruders have some combination of stepper motors and hotends * so we separate these concepts into the defines: @@ -472,11 +415,11 @@ */ #if ENABLED(DISTINCT_E_FACTORS) && E_STEPPERS > 1 #define XYZE_N (XYZ + E_STEPPERS) - #define E_AXIS_N (E_AXIS + extruder) + #define E_AXIS_N(E) (uint8_t(E_AXIS) + E) #else #undef DISTINCT_E_FACTORS #define XYZE_N XYZE - #define E_AXIS_N E_AXIS + #define E_AXIS_N(E) uint8_t(E_AXIS) #endif /** @@ -520,6 +463,14 @@ #endif #endif +#ifndef PREHEAT_1_LABEL + #define PREHEAT_1_LABEL "PLA" +#endif + +#ifndef PREHEAT_2_LABEL + #define PREHEAT_2_LABEL "ABS" +#endif + /** * Set a flag for a servo probe */ @@ -528,25 +479,37 @@ /** * Set flags for enabled probes */ -#define HAS_BED_PROBE (ENABLED(FIX_MOUNTED_PROBE) || ENABLED(Z_PROBE_ALLEN_KEY) || HAS_Z_SERVO_PROBE || ENABLED(Z_PROBE_SLED) || ENABLED(SOLENOID_PROBE)) +#define HAS_BED_PROBE (ENABLED(FIX_MOUNTED_PROBE) || ENABLED(Z_PROBE_ALLEN_KEY) || HAS_Z_SERVO_PROBE || ENABLED(Z_PROBE_SLED) || ENABLED(SOLENOID_PROBE) || ENABLED(SENSORLESS_PROBING) || ENABLED(RACK_AND_PINION_PROBE)) #define PROBE_SELECTED (HAS_BED_PROBE || ENABLED(PROBE_MANUALLY) || ENABLED(MESH_BED_LEVELING)) -#if !HAS_BED_PROBE +#if HAS_BED_PROBE + #ifndef Z_PROBE_LOW_POINT + #define Z_PROBE_LOW_POINT -5 + #endif + #if ENABLED(Z_PROBE_ALLEN_KEY) + #define PROBE_TRIGGERED_WHEN_STOWED_TEST // Extra test for Allen Key Probe + #endif +#else // Clear probe pin settings when no probe is selected #undef Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN #undef Z_MIN_PROBE_ENDSTOP -#elif ENABLED(Z_PROBE_ALLEN_KEY) - // Extra test for Allen Key Probe - #define PROBE_IS_TRIGGERED_WHEN_STOWED_TEST #endif #define HOMING_Z_WITH_PROBE (HAS_BED_PROBE && Z_HOME_DIR < 0 && ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)) +#ifdef GRID_MAX_POINTS_X + #define GRID_MAX_POINTS ((GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y)) +#endif + #define HAS_SOFTWARE_ENDSTOPS (ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS)) -#define HAS_RESUME_CONTINUE (ENABLED(NEWPANEL) || ENABLED(EMERGENCY_PARSER)) +#define HAS_RESUME_CONTINUE (ENABLED(EXTENSIBLE_UI) || ENABLED(NEWPANEL) || ENABLED(EMERGENCY_PARSER)) #define HAS_COLOR_LEDS (ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632) || ENABLED(NEOPIXEL_LED)) +#define HAS_LEDS_OFF_FLAG (ENABLED(PRINTER_EVENT_LEDS) && ENABLED(SDSUPPORT) && HAS_RESUME_CONTINUE) +#define HAS_PRINT_PROGRESS (ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY)) #define Z_MULTI_STEPPER_DRIVERS (ENABLED(Z_DUAL_STEPPER_DRIVERS) || ENABLED(Z_TRIPLE_STEPPER_DRIVERS)) #define Z_MULTI_ENDSTOPS (ENABLED(Z_DUAL_ENDSTOPS) || ENABLED(Z_TRIPLE_ENDSTOPS)) -#endif // CONDITIONALS_LCD_H +#define IS_SCARA (ENABLED(MORGAN_SCARA) || ENABLED(MAKERARM_SCARA)) +#define IS_KINEMATIC (ENABLED(DELTA) || IS_SCARA) +#define IS_CARTESIAN !IS_KINEMATIC diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h index 289f174373..edafe6e23d 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -19,30 +19,26 @@ * along with this program. If not, see . * */ +#pragma once /** * Conditionals_adv.h * Defines that depend on advanced configuration. */ -#ifndef CONDITIONALS_ADV_H -#define CONDITIONALS_ADV_H - - #if !defined(__AVR__) || !defined(USBCON) - // Define constants and variables for buffering serial data. - // Use only 0 or powers of 2 greater than 1 - // : [0, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, ...] - #ifndef RX_BUFFER_SIZE - #define RX_BUFFER_SIZE 128 - #endif - // 256 is the max TX buffer limit due to uint8_t head and tail - // : [0, 4, 8, 16, 32, 64, 128, 256] - #ifndef TX_BUFFER_SIZE - #define TX_BUFFER_SIZE 32 - #endif - #else - // SERIAL_XON_XOFF not supported on USB-native devices - #undef SERIAL_XON_XOFF +#if !defined(__AVR__) || !defined(USBCON) + // Define constants and variables for buffering serial data. + // Use only 0 or powers of 2 greater than 1 + // : [0, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, ...] + #ifndef RX_BUFFER_SIZE + #define RX_BUFFER_SIZE 128 #endif - -#endif // CONDITIONALS_ADV_H + // 256 is the max TX buffer limit due to uint8_t head and tail + // : [0, 4, 8, 16, 32, 64, 128, 256] + #ifndef TX_BUFFER_SIZE + #define TX_BUFFER_SIZE 32 + #endif +#else + // SERIAL_XON_XOFF not supported on USB-native devices + #undef SERIAL_XON_XOFF +#endif diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 2591da4913..4d4cf07a0a 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -19,15 +19,13 @@ * along with this program. If not, see . * */ +#pragma once /** * Conditionals_post.h * Defines that depend on configuration but are not editable. */ -#ifndef CONDITIONALS_POST_H -#define CONDITIONALS_POST_H - #define AVR_ATmega2560_FAMILY_PLUS_70 ( \ MB(BQ_ZUM_MEGA_3D) \ || MB(MIGHTYBOARD_REVE) \ @@ -45,10 +43,6 @@ #define NOT_A_PIN 0 // For PINS_DEBUGGING #endif -#define IS_SCARA (ENABLED(MORGAN_SCARA) || ENABLED(MAKERARM_SCARA)) -#define IS_KINEMATIC (ENABLED(DELTA) || IS_SCARA) -#define IS_CARTESIAN !IS_KINEMATIC - #define HAS_CLASSIC_JERK (IS_KINEMATIC || DISABLED(JUNCTION_DEVIATION)) /** @@ -236,30 +230,10 @@ #define MAX_AUTORETRACT 99 #endif -// MS1 MS2 Stepper Driver Microstepping mode table -#define MICROSTEP1 LOW,LOW -#if ENABLED(HEROIC_STEPPER_DRIVERS) - #define MICROSTEP128 LOW,HIGH -#else - #define MICROSTEP2 HIGH,LOW - #define MICROSTEP4 LOW,HIGH -#endif -#define MICROSTEP8 HIGH,HIGH -#ifdef __SAM3X8E__ - #if MB(ALLIGATOR) - #define MICROSTEP16 LOW,LOW - #define MICROSTEP32 HIGH,HIGH - #else - #define MICROSTEP16 HIGH,HIGH - #endif -#else - #define MICROSTEP16 HIGH,HIGH -#endif - /** * Override here because this is set in Configuration_adv.h */ -#if ENABLED(ULTIPANEL) && DISABLED(ELB_FULL_GRAPHIC_CONTROLLER) +#if HAS_LCD_MENU && DISABLED(ELB_FULL_GRAPHIC_CONTROLLER) #undef SD_DETECT_INVERTED #endif @@ -301,12 +275,12 @@ #elif TEMP_SENSOR_0 == -3 #define HEATER_0_USES_MAX6675 #define MAX6675_IS_MAX31855 - #define MAX6675_TMIN -270 - #define MAX6675_TMAX 1800 + #define HEATER_0_MAX6675_TMIN -270 + #define HEATER_0_MAX6675_TMAX 1800 #elif TEMP_SENSOR_0 == -2 #define HEATER_0_USES_MAX6675 - #define MAX6675_TMIN 0 - #define MAX6675_TMAX 1024 + #define HEATER_0_MAX6675_TMIN 0 + #define HEATER_0_MAX6675_TMAX 1024 #elif TEMP_SENSOR_0 == -1 #define HEATER_0_USES_AD595 #elif TEMP_SENSOR_0 == 0 @@ -320,9 +294,19 @@ #if TEMP_SENSOR_1 == -4 #define HEATER_1_USES_AD8495 #elif TEMP_SENSOR_1 == -3 - #error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_1." + #if TEMP_SENSOR_0 == -2 + #error "If MAX31855 Thermocouple (-3) is used for TEMP_SENSOR_1 then TEMP_SENSOR_0 must match." + #endif + #define HEATER_1_USES_MAX6675 + #define HEATER_1_MAX6675_TMIN -270 + #define HEATER_1_MAX6675_TMAX 1800 #elif TEMP_SENSOR_1 == -2 - #error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_1." + #if TEMP_SENSOR_0 == -3 + #error "If MAX31855 Thermocouple (-3) is used for TEMP_SENSOR_0 then TEMP_SENSOR_1 must match." + #endif + #define HEATER_1_USES_MAX6675 + #define HEATER_1_MAX6675_TMIN 0 + #define HEATER_1_MAX6675_TMAX 1024 #elif TEMP_SENSOR_1 == -1 #define HEATER_1_USES_AD595 #elif TEMP_SENSOR_1 == 0 @@ -460,6 +444,9 @@ * NOTE: Driver timing order is longest-to-shortest duration. * Preserve this ordering when adding new drivers. */ + +#define TRINAMICS (HAS_TRINAMIC || HAS_DRIVER(TMC2130_STANDALONE) || HAS_DRIVER(TMC2208_STANDALONE) || HAS_DRIVER(TMC26X_STANDALONE) || HAS_DRIVER(TMC2660_STANDALONE)) + #ifndef MINIMUM_STEPPER_DIR_DELAY #if HAS_DRIVER(TB6560) #define MINIMUM_STEPPER_DIR_DELAY 15000 @@ -473,7 +460,7 @@ #define MINIMUM_STEPPER_DIR_DELAY 400 #elif HAS_DRIVER(A4988) #define MINIMUM_STEPPER_DIR_DELAY 200 - #elif HAS_TRINAMIC || HAS_DRIVER(TMC2660) || HAS_DRIVER(TMC2130_STANDALONE) || HAS_DRIVER(TMC2208_STANDALONE) || HAS_DRIVER(TMC26X_STANDALONE) || HAS_DRIVER(TMC2660_STANDALONE) + #elif TRINAMICS #define MINIMUM_STEPPER_DIR_DELAY 20 #else #define MINIMUM_STEPPER_DIR_DELAY 0 // Expect at least 10µS since one Stepper ISR must transpire @@ -489,7 +476,7 @@ #define MINIMUM_STEPPER_PULSE 2 #elif HAS_DRIVER(A4988) || HAS_DRIVER(LV8729) || HAS_DRIVER(A5984) #define MINIMUM_STEPPER_PULSE 1 - #elif HAS_TRINAMIC || HAS_DRIVER(TMC2660) || HAS_DRIVER(TMC2130_STANDALONE) || HAS_DRIVER(TMC2208_STANDALONE) || HAS_DRIVER(TMC26X_STANDALONE) || HAS_DRIVER(TMC2660_STANDALONE) + #elif TRINAMICS #define MINIMUM_STEPPER_PULSE 0 #else #define MINIMUM_STEPPER_PULSE 2 @@ -505,7 +492,7 @@ #define MAXIMUM_STEPPER_RATE 150000 #elif HAS_DRIVER(DRV8825) #define MAXIMUM_STEPPER_RATE 250000 - #elif HAS_TRINAMIC || HAS_DRIVER(TMC2660) || HAS_DRIVER(TMC2130_STANDALONE) || HAS_DRIVER(TMC2208_STANDALONE) || HAS_DRIVER(TMC26X_STANDALONE) || HAS_DRIVER(TMC2660_STANDALONE) + #elif TRINAMICS #define MAXIMUM_STEPPER_RATE 400000 #elif HAS_DRIVER(A4988) #define MAXIMUM_STEPPER_RATE 500000 @@ -825,6 +812,7 @@ #define HAS_Z3_ENABLE (PIN_EXISTS(Z3_ENABLE)) #define HAS_Z3_DIR (PIN_EXISTS(Z3_DIR)) #define HAS_Z3_STEP (PIN_EXISTS(Z3_STEP)) +#define HAS_Z3_MICROSTEPS (PIN_EXISTS(Z3_MS1)) // Extruder steppers and solenoids #define HAS_E0_ENABLE (PIN_EXISTS(E0_ENABLE)) @@ -864,19 +852,22 @@ #define HAS_SOLENOID_5 (PIN_EXISTS(SOL5)) // Trinamic Stepper Drivers -#define HAS_STEALTHCHOP (HAS_DRIVER(TMC2130) || HAS_DRIVER(TMC2208)) -#define HAS_STALLGUARD HAS_DRIVER(TMC2130) -#define AXIS_HAS_STEALTHCHOP(ST) ( AXIS_DRIVER_TYPE(ST, TMC2130) || AXIS_DRIVER_TYPE(ST, TMC2208) ) -#define AXIS_HAS_STALLGUARD(ST) AXIS_DRIVER_TYPE(ST, TMC2130) +#if HAS_TRINAMIC + #define TMC_HAS_SPI (HAS_DRIVER(TMC2130) || HAS_DRIVER(TMC2660)) + #define HAS_STALLGUARD (HAS_DRIVER(TMC2130) || HAS_DRIVER(TMC2660)) + #define HAS_STEALTHCHOP (HAS_DRIVER(TMC2130) || HAS_DRIVER(TMC2208)) + #define AXIS_HAS_SPI(ST) (AXIS_DRIVER_TYPE(ST, TMC2130) || AXIS_DRIVER_TYPE(ST, TMC2660)) + #define AXIS_HAS_STALLGUARD(ST) (AXIS_DRIVER_TYPE(ST, TMC2130) || AXIS_DRIVER_TYPE(ST, TMC2660)) + #define AXIS_HAS_STEALTHCHOP(ST) (AXIS_DRIVER_TYPE(ST, TMC2130) || AXIS_DRIVER_TYPE(ST, TMC2208)) -#if ENABLED(SENSORLESS_HOMING) + #define USE_SENSORLESS (ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING)) // Disable Z axis sensorless homing if a probe is used to home the Z axis #if HOMING_Z_WITH_PROBE - #undef Z_HOMING_SENSITIVITY + #undef Z_STALL_SENSITIVITY #endif - #define X_SENSORLESS (AXIS_HAS_STALLGUARD(X) && defined(X_HOMING_SENSITIVITY)) - #define Y_SENSORLESS (AXIS_HAS_STALLGUARD(Y) && defined(Y_HOMING_SENSITIVITY)) - #define Z_SENSORLESS (AXIS_HAS_STALLGUARD(Z) && defined(Z_HOMING_SENSITIVITY)) + #define X_SENSORLESS (AXIS_HAS_STALLGUARD(X) && defined(X_STALL_SENSITIVITY)) + #define Y_SENSORLESS (AXIS_HAS_STALLGUARD(Y) && defined(Y_STALL_SENSITIVITY)) + #define Z_SENSORLESS (AXIS_HAS_STALLGUARD(Z) && defined(Z_STALL_SENSITIVITY)) #endif // Endstops and bed probe @@ -995,11 +986,63 @@ #define HAS_CASE_LIGHT (PIN_EXISTS(CASE_LIGHT) && ENABLED(CASE_LIGHT_ENABLE)) // Digital control -#define HAS_MICROSTEPS (HAS_X_MICROSTEPS || HAS_Y_MICROSTEPS || HAS_Z_MICROSTEPS || HAS_E0_MICROSTEPS || HAS_E1_MICROSTEPS || HAS_E2_MICROSTEPS || HAS_E3_MICROSTEPS || HAS_E4_MICROSTEPS || HAS_E5_MICROSTEPS) #define HAS_STEPPER_RESET (PIN_EXISTS(STEPPER_RESET)) #define HAS_DIGIPOTSS (PIN_EXISTS(DIGIPOTSS)) #define HAS_MOTOR_CURRENT_PWM (PIN_EXISTS(MOTOR_CURRENT_PWM_XY) || PIN_EXISTS(MOTOR_CURRENT_PWM_Z) || PIN_EXISTS(MOTOR_CURRENT_PWM_E)) +#define HAS_MICROSTEPS (HAS_X_MICROSTEPS || HAS_X2_MICROSTEPS || HAS_Y_MICROSTEPS || HAS_Y2_MICROSTEPS || HAS_Z_MICROSTEPS || HAS_Z2_MICROSTEPS || HAS_Z3_MICROSTEPS || HAS_E0_MICROSTEPS || HAS_E1_MICROSTEPS || HAS_E2_MICROSTEPS || HAS_E3_MICROSTEPS || HAS_E4_MICROSTEPS || HAS_E5_MICROSTEPS) + +#if HAS_MICROSTEPS + + // MS1 MS2 MS3 Stepper Driver Microstepping mode table + #ifndef MICROSTEP1 + #define MICROSTEP1 LOW,LOW,LOW + #endif + #if ENABLED(HEROIC_STEPPER_DRIVERS) + #ifndef MICROSTEP128 + #define MICROSTEP128 LOW,HIGH,LOW + #endif + #else + #ifndef MICROSTEP2 + #define MICROSTEP2 HIGH,LOW,LOW + #endif + #ifndef MICROSTEP4 + #define MICROSTEP4 LOW,HIGH,LOW + #endif + #endif + #ifndef MICROSTEP8 + #define MICROSTEP8 HIGH,HIGH,LOW + #endif + #ifdef __SAM3X8E__ + #if MB(ALLIGATOR) + #ifndef MICROSTEP16 + #define MICROSTEP16 LOW,LOW,LOW + #endif + #ifndef MICROSTEP32 + #define MICROSTEP32 HIGH,HIGH,LOW + #endif + #else + #ifndef MICROSTEP16 + #define MICROSTEP16 HIGH,HIGH,LOW + #endif + #endif + #else + #ifndef MICROSTEP16 + #define MICROSTEP16 HIGH,HIGH,LOW + #endif + #endif + + #define HAS_MICROSTEP1 defined(MICROSTEP1) + #define HAS_MICROSTEP2 defined(MICROSTEP2) + #define HAS_MICROSTEP4 defined(MICROSTEP4) + #define HAS_MICROSTEP8 defined(MICROSTEP8) + #define HAS_MICROSTEP16 defined(MICROSTEP16) + #define HAS_MICROSTEP32 defined(MICROSTEP32) + #define HAS_MICROSTEP64 defined(MICROSTEP64) + #define HAS_MICROSTEP128 defined(MICROSTEP128) + +#endif // HAS_MICROSTEPS + #if !HAS_TEMP_SENSOR #undef AUTO_REPORT_TEMPERATURES #endif @@ -1254,7 +1297,7 @@ #define _PROBE_RADIUS (DELTA_PRINTABLE_RADIUS - (MIN_PROBE_EDGE)) #ifndef DELTA_CALIBRATION_RADIUS #ifdef X_PROBE_OFFSET_FROM_EXTRUDER - #define DELTA_CALIBRATION_RADIUS (DELTA_PRINTABLE_RADIUS - MAX3(abs(X_PROBE_OFFSET_FROM_EXTRUDER), abs(Y_PROBE_OFFSET_FROM_EXTRUDER), abs(MIN_PROBE_EDGE))) + #define DELTA_CALIBRATION_RADIUS (DELTA_PRINTABLE_RADIUS - MAX(ABS(X_PROBE_OFFSET_FROM_EXTRUDER), ABS(Y_PROBE_OFFSET_FROM_EXTRUDER), ABS(MIN_PROBE_EDGE))) #else #define DELTA_CALIBRATION_RADIUS _PROBE_RADIUS #endif @@ -1488,20 +1531,19 @@ // Updated G92 behavior shifts the workspace #define HAS_POSITION_SHIFT DISABLED(NO_WORKSPACE_OFFSETS) // The home offset also shifts the coordinate space -#define HAS_HOME_OFFSET (DISABLED(NO_WORKSPACE_OFFSETS) && DISABLED(DELTA)) -// Either offset yields extra calculations on all moves -#define HAS_WORKSPACE_OFFSET (HAS_POSITION_SHIFT || HAS_HOME_OFFSET) -// M206 doesn't apply to DELTA -#define HAS_M206_COMMAND (HAS_HOME_OFFSET && DISABLED(DELTA)) +#define HAS_HOME_OFFSET (DISABLED(NO_WORKSPACE_OFFSETS) && IS_CARTESIAN) +// The SCARA home offset applies only on G28 +#define HAS_SCARA_OFFSET (DISABLED(NO_WORKSPACE_OFFSETS) && IS_SCARA) +// Cumulative offset to workspace to save some calculation +#define HAS_WORKSPACE_OFFSET (HAS_POSITION_SHIFT && HAS_HOME_OFFSET) +// M206 sets the home offset for Cartesian machines +#define HAS_M206_COMMAND (HAS_HOME_OFFSET && !IS_SCARA) // LCD timeout to status screen default is 15s #ifndef LCD_TIMEOUT_TO_STATUS #define LCD_TIMEOUT_TO_STATUS 15000 #endif -// Shorthand -#define GRID_MAX_POINTS ((GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y)) - // Add commands that need sub-codes to this list #define USE_GCODE_SUBCODES ENABLED(G38_PROBE_TARGET) || ENABLED(CNC_COORDINATE_SYSTEMS) || ENABLED(POWER_LOSS_RECOVERY) @@ -1587,8 +1629,36 @@ // If platform requires early initialization of watchdog to properly boot #define EARLY_WATCHDOG (ENABLED(USE_WATCHDOG) && defined(ARDUINO_ARCH_SAM)) -#if ENABLED(G29_RETRY_AND_RECOVER) - #define USE_EXECUTE_COMMANDS_IMMEDIATE +#define USE_EXECUTE_COMMANDS_IMMEDIATE (ENABLED(G29_RETRY_AND_RECOVER) || ENABLED(GCODE_MACROS) || ENABLED(POWER_LOSS_RECOVERY)) + +#if ENABLED(Z_TRIPLE_STEPPER_DRIVERS) + #define Z_STEPPER_COUNT 3 +#elif ENABLED(Z_DUAL_STEPPER_DRIVERS) + #define Z_STEPPER_COUNT 2 +#else + #define Z_STEPPER_COUNT 1 #endif -#endif // CONDITIONALS_POST_H +// Get LCD character width/height, which may be overridden by pins, configs, etc. +#ifndef LCD_WIDTH + #if ENABLED(LIGHTWEIGHT_UI) + #define LCD_WIDTH 16 + #elif HAS_GRAPHICAL_LCD + #define LCD_WIDTH 22 + #elif ENABLED(ULTIPANEL) + #define LCD_WIDTH 20 + #elif HAS_SPI_LCD + #define LCD_WIDTH 16 + #endif +#endif +#ifndef LCD_HEIGHT + #if ENABLED(LIGHTWEIGHT_UI) + #define LCD_HEIGHT 4 + #elif HAS_GRAPHICAL_LCD + #define LCD_HEIGHT 5 + #elif ENABLED(ULTIPANEL) + #define LCD_HEIGHT 4 + #elif HAS_SPI_LCD + #define LCD_HEIGHT 2 + #endif +#endif diff --git a/Marlin/src/inc/MarlinConfig.h b/Marlin/src/inc/MarlinConfig.h index 539726e405..226af65a2d 100644 --- a/Marlin/src/inc/MarlinConfig.h +++ b/Marlin/src/inc/MarlinConfig.h @@ -19,9 +19,11 @@ * along with this program. If not, see . * */ +#pragma once -#ifndef _MARLIN_CONFIG_H_ -#define _MARLIN_CONFIG_H_ +// +// Prefix header for all Marlin sources +// #include "MarlinConfigPre.h" @@ -29,6 +31,8 @@ #include "../pins/pins.h" +#include HAL_PATH(../HAL, spi_pins.h) + #if defined(__AVR__) && !defined(USBCON) #define HardwareSerial_h // trick to disable the standard HWserial #endif @@ -43,5 +47,4 @@ #include "../core/language.h" #include "../core/utility.h" #include "../core/serial.h" - -#endif // _MARLIN_CONFIG_H_ +#include "../core/minmax.h" diff --git a/Marlin/src/inc/MarlinConfigPre.h b/Marlin/src/inc/MarlinConfigPre.h index 7f9b50eb01..3bca46ed09 100644 --- a/Marlin/src/inc/MarlinConfigPre.h +++ b/Marlin/src/inc/MarlinConfigPre.h @@ -19,19 +19,21 @@ * along with this program. If not, see . * */ +#pragma once -#ifndef _MARLIN_CONFIGPRE_H_ -#define _MARLIN_CONFIGPRE_H_ +#define __MARLIN_FIRMWARE__ + +// +// Prefix header to acquire configurations +// #include "../HAL/platforms.h" #include "../core/boards.h" #include "../core/macros.h" -#include "../core/types.h" +#include "../core/millis_t.h" #include "Version.h" #include "../../Configuration.h" #include "Conditionals_LCD.h" #include "../core/drivers.h" #include "../../Configuration_adv.h" #include "Conditionals_adv.h" - -#endif // _MARLIN_CONFIGPRE_H_ diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 3272d6cd37..9892303012 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * SanityCheck.h @@ -26,9 +27,6 @@ * Test configuration values for errors at compile-time. */ -#ifndef _SANITYCHECK_H_ -#define _SANITYCHECK_H_ - /** * Require gcc 4.7 or newer (first included with Arduino 1.6.8) for C++11 features. */ @@ -144,7 +142,7 @@ #error "FILAMENT_CHANGE_NOZZLE_TIMEOUT is now PAUSE_PARK_NOZZLE_TIMEOUT. Please update your configuration." #elif defined(FILAMENT_CHANGE_NUMBER_OF_ALERT_BEEPS) #error "FILAMENT_CHANGE_NUMBER_OF_ALERT_BEEPS is now FILAMENT_CHANGE_ALERT_BEEPS. Please update your configuration." -#elif ENABLED(FILAMENT_CHANGE_NO_STEPPER_TIMEOUT) +#elif defined(FILAMENT_CHANGE_NO_STEPPER_TIMEOUT) #error "FILAMENT_CHANGE_NO_STEPPER_TIMEOUT is now PAUSE_PARK_NO_STEPPER_TIMEOUT. Please update your configuration." #elif defined(PLA_PREHEAT_HOTEND_TEMP) #error "PLA_PREHEAT_HOTEND_TEMP is now PREHEAT_1_TEMP_HOTEND. Please update your configuration." @@ -309,6 +307,38 @@ #error "MAX7219_DEBUG_STEPPER_QUEUE is now MAX7219_DEBUG_PLANNER_QUEUE. Please update your configuration." #elif defined(ENDSTOP_NOISE_FILTER) #error "ENDSTOP_NOISE_FILTER is now ENDSTOP_NOISE_THRESHOLD [2-7]. Please update your configuration." +#elif defined(RETRACT_ZLIFT) + #error "RETRACT_ZLIFT is now RETRACT_ZRAISE. Please update your Configuration_adv.h." +#elif defined(TOOLCHANGE_PARK_ZLIFT) || defined(TOOLCHANGE_UNPARK_ZLIFT) + #error "TOOLCHANGE_PARK_ZLIFT and TOOLCHANGE_UNPARK_ZLIFT are now TOOLCHANGE_ZRAISE. Please update your configuration." +#elif defined(SINGLENOZZLE_TOOLCHANGE_ZRAISE) + #error "SINGLENOZZLE_TOOLCHANGE_ZRAISE is now TOOLCHANGE_ZRAISE. Please update your configuration." +#elif defined(SINGLENOZZLE_SWAP_LENGTH) + #error "SINGLENOZZLE_SWAP_LENGTH is now TOOLCHANGE_FIL_SWAP_LENGTH. Please update your configuration." +#elif defined(SINGLENOZZLE_SWAP_RETRACT_SPEED) + #error "SINGLENOZZLE_SWAP_RETRACT_SPEED is now TOOLCHANGE_FIL_SWAP_RETRACT_SPEED. Please update your configuration." +#elif defined(SINGLENOZZLE_SWAP_PRIME_SPEED) + #error "SINGLENOZZLE_SWAP_PRIME_SPEED is now TOOLCHANGE_FIL_SWAP_PRIME_SPEED. Please update your configuration." +#elif defined(SINGLENOZZLE_SWAP_PARK) + #error "SINGLENOZZLE_SWAP_PARK is now TOOLCHANGE_PARK. Please update your configuration." +#elif defined(SINGLENOZZLE_TOOLCHANGE_XY) + #error "SINGLENOZZLE_TOOLCHANGE_XY is now TOOLCHANGE_PARK_XY. Please update your configuration." +#elif defined(SINGLENOZZLE_PARK_XY_FEEDRATE) + #error "SINGLENOZZLE_PARK_XY_FEEDRATE is now TOOLCHANGE_PARK_XY_FEEDRATE. Please update your configuration." +#elif defined(PARKING_EXTRUDER_SECURITY_RAISE) + #error "PARKING_EXTRUDER_SECURITY_RAISE is now TOOLCHANGE_ZRAISE. Please update your configuration." +#elif defined(SWITCHING_TOOLHEAD_SECURITY_RAISE) + #error "SWITCHING_TOOLHEAD_SECURITY_RAISE is now TOOLCHANGE_ZRAISE. Please update your configuration." +#elif defined(G0_FEEDRATE) && G0_FEEDRATE == 0 + #error "G0_FEEDRATE is now used to set the G0 feedrate. Please update your configuration." +#elif defined(MBL_Z_STEP) + #error "MBL_Z_STEP is now MESH_EDIT_Z_STEP. Please update your configuration." +#elif defined(CHDK) + #error "CHDK is now CHDK_PIN. Please update your Configuration_adv.h." +#elif defined(MAX6675_SS) + #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." #endif #define BOARD_MKS_13 -47 @@ -365,7 +395,7 @@ #error "Set SERIAL_PORT to the port on your board. Usually this is 0." #endif -#if SERIAL_PORT_2 && NUM_SERIAL < 2 +#if defined(SERIAL_PORT_2) && NUM_SERIAL < 2 #error "SERIAL_PORT_2 is not supported for your MOTHERBOARD. Disable it to continue." #endif @@ -442,20 +472,33 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, #error "Enable only one of ENDSTOPPULLUP_Z_MIN or ENDSTOPPULLDOWN_Z_MIN." #endif +/** + * LCD Info Screen Style + */ +#if LCD_INFO_SCREEN_STYLE > 0 + #if HAS_GRAPHICAL_LCD || LCD_WIDTH < 20 || LCD_HEIGHT < 4 + #error "Alternative LCD_INFO_SCREEN_STYLE requires 20x4 Character LCD." + #elif LCD_INFO_SCREEN_STYLE > 1 + #error "LCD_INFO_SCREEN_STYLE only has options 0 and 1 at this time." + #endif +#endif + /** * Progress Bar */ #if ENABLED(LCD_PROGRESS_BAR) #if DISABLED(SDSUPPORT) && DISABLED(LCD_SET_PROGRESS_MANUALLY) #error "LCD_PROGRESS_BAR requires SDSUPPORT or LCD_SET_PROGRESS_MANUALLY." - #elif DISABLED(ULTRA_LCD) + #elif !HAS_CHARACTER_LCD #error "LCD_PROGRESS_BAR requires a character LCD." - #elif ENABLED(DOGLCD) + #elif HAS_GRAPHICAL_LCD #error "LCD_PROGRESS_BAR does not apply to graphical displays." #elif ENABLED(FILAMENT_LCD_DISPLAY) #error "LCD_PROGRESS_BAR and FILAMENT_LCD_DISPLAY are not fully compatible. Comment out this line to use both." + #elif PROGRESS_MSG_EXPIRE < 0 + #error "PROGRESS_MSG_EXPIRE must be greater than or equal to 0." #endif -#elif ENABLED(LCD_SET_PROGRESS_MANUALLY) && DISABLED(DOGLCD) +#elif ENABLED(LCD_SET_PROGRESS_MANUALLY) && !HAS_GRAPHICAL_LCD #error "LCD_SET_PROGRESS_MANUALLY requires LCD_PROGRESS_BAR or Graphical LCD." #endif @@ -590,8 +633,8 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, */ #if EXTRUDERS > 1 - #if EXTRUDERS > 5 - #error "Marlin supports a maximum of 5 EXTRUDERS." + #if EXTRUDERS > 6 + #error "Marlin supports a maximum of 6 EXTRUDERS." #endif #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT) @@ -602,6 +645,27 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, #error "EXTRUDERS must be 1 with HEATERS_PARALLEL." #endif + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + #ifndef TOOLCHANGE_FIL_SWAP_LENGTH + #error "TOOLCHANGE_FILAMENT_SWAP requires TOOLCHANGE_FIL_SWAP_LENGTH. Please update your Configuration." + #elif !defined(TOOLCHANGE_FIL_SWAP_RETRACT_SPEED) + #error "TOOLCHANGE_FILAMENT_SWAP requires TOOLCHANGE_FIL_SWAP_RETRACT_SPEED. Please update your Configuration." + #elif !defined(TOOLCHANGE_FIL_SWAP_PRIME_SPEED) + #error "TOOLCHANGE_FILAMENT_SWAP requires TOOLCHANGE_FIL_SWAP_PRIME_SPEED. Please update your Configuration." + #endif + #endif + #if ENABLED(TOOLCHANGE_PARK) + #ifndef TOOLCHANGE_PARK_XY + #error "TOOLCHANGE_PARK requires TOOLCHANGE_PARK_XY. Please update your Configuration." + #elif !defined(TOOLCHANGE_PARK_XY_FEEDRATE) + #error "TOOLCHANGE_PARK requires TOOLCHANGE_PARK_XY_FEEDRATE. Please update your Configuration." + #endif + #endif + + #ifndef TOOLCHANGE_ZRAISE + #error "TOOLCHANGE_ZRAISE required for EXTRUDERS > 1. Please update your Configuration." + #endif + #elif ENABLED(MK2_MULTIPLEXER) #error "MK2_MULTIPLEXER requires 2 or more EXTRUDERS." #elif ENABLED(SINGLENOZZLE) @@ -684,8 +748,6 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, #error "Please select either MIXING_EXTRUDER or SWITCHING_EXTRUDER, not both." #elif ENABLED(SINGLENOZZLE) #error "MIXING_EXTRUDER is incompatible with SINGLENOZZLE." - #elif ENABLED(LIN_ADVANCE) - #error "MIXING_EXTRUDER is incompatible with LIN_ADVANCE." #endif #endif @@ -715,10 +777,10 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, #error "PARKING_EXTRUDER requires SOL0_PIN and SOL1_PIN." #elif !defined(PARKING_EXTRUDER_PARKING_X) #error "PARKING_EXTRUDER requires PARKING_EXTRUDER_PARKING_X." - #elif !defined(PARKING_EXTRUDER_SECURITY_RAISE) - #error "PARKING_EXTRUDER requires PARKING_EXTRUDER_SECURITY_RAISE." - #elif PARKING_EXTRUDER_SECURITY_RAISE < 0 - #error "PARKING_EXTRUDER_SECURITY_RAISE must be 0 or higher." + #elif !defined(TOOLCHANGE_ZRAISE) + #error "PARKING_EXTRUDER requires TOOLCHANGE_ZRAISE." + #elif TOOLCHANGE_ZRAISE < 0 + #error "TOOLCHANGE_ZRAISE must be 0 or higher." #elif !defined(PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE) || !WITHIN(PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE, LOW, HIGH) #error "PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE must be defined as HIGH or LOW." #elif !defined(PARKING_EXTRUDER_SOLENOIDS_DELAY) || !WITHIN(PARKING_EXTRUDER_SOLENOIDS_DELAY, 0, 2000) @@ -750,10 +812,10 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, #elif SWITCHING_TOOLHEAD_SERVO_NR == 3 #error "A SWITCHING_TOOLHEAD_SERVO_NR of 3 requires NUM_SERVOS >= 4." #endif - #elif !defined(SWITCHING_TOOLHEAD_SECURITY_RAISE) - #error "SWITCHING_TOOLHEAD requires SWITCHING_TOOLHEAD_SECURITY_RAISE." - #elif SWITCHING_TOOLHEAD_SECURITY_RAISE < 0 - #error "SWITCHING_TOOLHEAD _SECURITY_RAISE must be 0 or higher." + #elif !defined(TOOLCHANGE_ZRAISE) + #error "SWITCHING_TOOLHEAD requires TOOLCHANGE_ZRAISE." + #elif TOOLCHANGE_ZRAISE < 0 + #error "TOOLCHANGE_ZRAISE must be 0 or higher." #endif #endif @@ -824,7 +886,7 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, #error "You probably want to use Max Endstops for DELTA!" #elif ENABLED(ENABLE_LEVELING_FADE_HEIGHT) && DISABLED(AUTO_BED_LEVELING_BILINEAR) && !UBL_SEGMENTED #error "ENABLE_LEVELING_FADE_HEIGHT on DELTA requires AUTO_BED_LEVELING_BILINEAR or AUTO_BED_LEVELING_UBL." - #elif ENABLED(DELTA_AUTO_CALIBRATION) && !(HAS_BED_PROBE || ENABLED(ULTIPANEL)) + #elif ENABLED(DELTA_AUTO_CALIBRATION) && !(HAS_BED_PROBE || HAS_LCD_MENU) #error "DELTA_AUTO_CALIBRATION requires a probe or LCD Controller." #elif ABL_GRID #if (GRID_MAX_POINTS_X & 1) == 0 || (GRID_MAX_POINTS_Y & 1) == 0 @@ -849,7 +911,8 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, + ENABLED(BLTOUCH) \ + ENABLED(SOLENOID_PROBE) \ + ENABLED(Z_PROBE_ALLEN_KEY) \ - + ENABLED(Z_PROBE_SLED) + + ENABLED(Z_PROBE_SLED) \ + + ENABLED(RACK_AND_PINION_PROBE) #error "Please enable only one probe option: PROBE_MANUALLY, FIX_MOUNTED_PROBE, BLTOUCH, SOLENOID_PROBE, Z_PROBE_ALLEN_KEY, Z_PROBE_SLED, or Z Servo." #endif @@ -892,17 +955,27 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, #endif #endif + #if ENABLED(RACK_AND_PINION_PROBE) && !(defined(Z_PROBE_DEPLOY_X) && defined(Z_PROBE_RETRACT_X)) + #error "RACK_AND_PINION_PROBE requires Z_PROBE_DEPLOY_X and Z_PROBE_RETRACT_X." + #endif + /** * Require pin options and pins to be defined */ - #if ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) + #if ENABLED(SENSORLESS_PROBING) + #if ENABLED(DELTA) && (!AXIS_DRIVER_TYPE_X(TMC2130) || !AXIS_DRIVER_TYPE_Y(TMC2130) || !AXIS_DRIVER_TYPE_Z(TMC2130)) + #error "SENSORLESS_PROBING requires TMC2130 drivers on X, Y, and Z." + #elif !AXIS_DRIVER_TYPE_Z(TMC2130) + #error "SENSORLESS_PROBING requires a TMC2130 driver on Z." + #endif + #elif ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) #if ENABLED(Z_MIN_PROBE_ENDSTOP) #error "Enable only one option: Z_MIN_PROBE_ENDSTOP or Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN." #elif DISABLED(USE_ZMIN_PLUG) #error "Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN requires USE_ZMIN_PLUG to be enabled." #elif !HAS_Z_MIN #error "Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN requires the Z_MIN_PIN to be defined." - #elif ENABLED(Z_MIN_PROBE_ENDSTOP_INVERTING) != ENABLED(Z_MIN_ENDSTOP_INVERTING) + #elif Z_MIN_PROBE_ENDSTOP_INVERTING != Z_MIN_ENDSTOP_INVERTING #error "Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN requires Z_MIN_ENDSTOP_INVERTING to match Z_MIN_PROBE_ENDSTOP_INVERTING." #endif #elif ENABLED(Z_MIN_PROBE_ENDSTOP) @@ -936,9 +1009,6 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, #error "Z_PROBE_LOW_POINT must be less than or equal to 0." #endif - static_assert(int(X_PROBE_OFFSET_FROM_EXTRUDER) == (X_PROBE_OFFSET_FROM_EXTRUDER), "X_PROBE_OFFSET_FROM_EXTRUDER must be an integer value."); - static_assert(int(Y_PROBE_OFFSET_FROM_EXTRUDER) == (Y_PROBE_OFFSET_FROM_EXTRUDER), "Y_PROBE_OFFSET_FROM_EXTRUDER must be an integer value."); - #else /** @@ -1060,8 +1130,8 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, * LCD_BED_LEVELING requirements */ #if ENABLED(LCD_BED_LEVELING) - #if DISABLED(ULTIPANEL) - #error "LCD_BED_LEVELING requires an LCD controller." + #if !HAS_LCD_MENU + #error "LCD_BED_LEVELING requires a programmable LCD controller." #elif !(ENABLED(MESH_BED_LEVELING) || OLDSCHOOL_ABL) #error "LCD_BED_LEVELING requires MESH_BED_LEVELING or AUTO_BED_LEVELING." #endif @@ -1102,7 +1172,7 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, #if ENABLED(HOME_AFTER_DEACTIVATE) || ENABLED(Z_SAFE_HOMING) #error "DISABLE_[XYZ] is not compatible with HOME_AFTER_DEACTIVATE or Z_SAFE_HOMING." #endif -#endif // DISABLE_[XYZ] +#endif /** * Filament Width Sensor @@ -1199,12 +1269,19 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, #endif #endif +/** + * Test case light not using the same pin as the fan + */ +#if ENABLED(CASE_LIGHT_ENABLE) && CASE_LIGHT_PIN == FAN_PIN + #error "You cannot set CASE_LIGHT_PIN equal to FAN_PIN." +#endif + /** * Test Heater, Temp Sensor, and Extruder Pins; Sensor Type must also be set. */ #if !HAS_HEATER_0 #error "HEATER_0_PIN not defined for this board." -#elif !PIN_EXISTS(TEMP_0) && !(defined(MAX6675_SS) && MAX6675_SS >= 0) +#elif !PIN_EXISTS(TEMP_0) && !PIN_EXISTS(MAX6675_SS) #error "TEMP_0_PIN not defined for this board." #elif ((defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284P__)) && (!PIN_EXISTS(E0_STEP) || !PIN_EXISTS(E0_DIR))) #error "E0_STEP_PIN or E0_DIR_PIN not defined for this board." @@ -1215,16 +1292,18 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, #endif // Pins are required for heaters -#if ENABLED(HEATER_0_USES_MAX6675) && !(defined(MAX6675_SS) && MAX6675_SS >= 0) - #error "MAX6675_SS (required for TEMP_SENSOR_0) not defined for this board." +#if ENABLED(HEATER_0_USES_MAX6675) && !PIN_EXISTS(MAX6675_SS) + #error "MAX6675_SS_PIN (required for TEMP_SENSOR_0) not defined for this board." #elif (HOTENDS > 1 || ENABLED(HEATERS_PARALLEL)) && !HAS_HEATER_1 #error "HEATER_1_PIN not defined for this board." #endif #if HOTENDS > 1 - #if TEMP_SENSOR_1 == 0 + #if ENABLED(HEATER_1_USES_MAX6675) && !PIN_EXISTS(MAX6675_SS2) + #error "MAX6675_SS2_PIN (required for TEMP_SENSOR_1) not defined for this board." + #elif TEMP_SENSOR_1 == 0 #error "TEMP_SENSOR_1 is required with 2 or more HOTENDS." - #elif !PIN_EXISTS(TEMP_1) + #elif !PIN_EXISTS(TEMP_1) && !PIN_EXISTS(MAX6675_SS2) #error "TEMP_1_PIN not defined for this board." #endif #if HOTENDS > 2 @@ -1245,7 +1324,7 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, #endif #if HOTENDS > 4 #if TEMP_SENSOR_4 == 0 - #error "TEMP_SENSOR_4 is required with 5 HOTENDS." + #error "TEMP_SENSOR_4 is required with 5 or more HOTENDS." #elif !HAS_HEATER_4 #error "HEATER_4_PIN not defined for this board." #elif !PIN_EXISTS(TEMP_4) @@ -1253,7 +1332,7 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, #endif #if HOTENDS > 5 #if TEMP_SENSOR_5 == 0 - #error "TEMP_SENSOR_5 is required with 5 HOTENDS." + #error "TEMP_SENSOR_5 is required with 6 HOTENDS." #elif !HAS_HEATER_5 #error "HEATER_5_PIN not defined for this board." #elif !PIN_EXISTS(TEMP_5) @@ -1265,14 +1344,14 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, #elif TEMP_SENSOR_4 != 0 #error "TEMP_SENSOR_4 shouldn't be set with only 4 HOTENDS." #elif TEMP_SENSOR_5 != 0 - #error "TEMP_SENSOR_5 shouldn't be set with only 5 HOTENDS." + #error "TEMP_SENSOR_5 shouldn't be set with only 4 HOTENDS." #endif #elif TEMP_SENSOR_3 != 0 #error "TEMP_SENSOR_3 shouldn't be set with only 3 HOTENDS." #elif TEMP_SENSOR_4 != 0 #error "TEMP_SENSOR_4 shouldn't be set with only 3 HOTENDS." #elif TEMP_SENSOR_5 != 0 - #error "TEMP_SENSOR_5 shouldn't be set with only 4 HOTENDS." + #error "TEMP_SENSOR_5 shouldn't be set with only 3 HOTENDS." #endif #elif TEMP_SENSOR_2 != 0 #error "TEMP_SENSOR_2 shouldn't be set with only 2 HOTENDS." @@ -1544,7 +1623,9 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, * RGB_LED Requirements */ #define _RGB_TEST (PIN_EXISTS(RGB_LED_R) && PIN_EXISTS(RGB_LED_G) && PIN_EXISTS(RGB_LED_B)) -#if ENABLED(RGB_LED) +#if ENABLED(PRINTER_EVENT_LEDS) && !HAS_COLOR_LEDS + #error "PRINTER_EVENT_LEDS requires BLINKM, PCA9632, RGB_LED, RGBW_LED or NEOPIXEL_LED." +#elif ENABLED(RGB_LED) #if !_RGB_TEST #error "RGB_LED requires RGB_LED_R_PIN, RGB_LED_G_PIN, and RGB_LED_B_PIN." #elif ENABLED(RGBW_LED) @@ -1558,8 +1639,6 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, #if !(PIN_EXISTS(NEOPIXEL) && NEOPIXEL_PIXELS > 0) #error "NEOPIXEL_LED requires NEOPIXEL_PIN and NEOPIXEL_PIXELS." #endif -#elif ENABLED(PRINTER_EVENT_LEDS) && DISABLED(BLINKM) && DISABLED(PCA9632) && DISABLED(NEOPIXEL_LED) - #error "PRINTER_EVENT_LEDS requires BLINKM, PCA9632, RGB_LED, RGBW_LED or NEOPIXEL_LED." #endif /** @@ -1611,6 +1690,7 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, && DISABLED(MKS_12864OLED_SSD1306) ) \ + (ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) && DISABLED(BQ_LCD_SMART_CONTROLLER)) \ + ENABLED(LCD_FOR_MELZI) \ + + ENABLED(MALYAN_LCD) \ + ENABLED(MKS_12864OLED) \ + ENABLED(MKS_12864OLED_SSD1306) \ + ENABLED(MAKEBOARD_MINI_2_LINE_DISPLAY_1602) \ @@ -1646,33 +1726,68 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, /** * Check existing CS pins against enabled TMC SPI drivers. */ -#if AXIS_DRIVER_TYPE(X, TMC2130) && !PIN_EXISTS(X_CS) - #error "X_CS_PIN is required for TMC2130. Define X_CS_PIN in Configuration_adv.h." -#elif AXIS_DRIVER_TYPE(X2, TMC2130) && !PIN_EXISTS(X2_CS) - #error "X2_CS_PIN is required for X2. Define X2_CS_PIN in Configuration_adv.h." -#elif AXIS_DRIVER_TYPE(Y, TMC2130) && !PIN_EXISTS(Y_CS) - #error "Y_CS_PIN is required for TMC2130. Define Y_CS_PIN in Configuration_adv.h." -#elif AXIS_DRIVER_TYPE(Y2, TMC2130) && !PIN_EXISTS(Y2_CS) - #error "Y2_CS_PIN is required for TMC2130. Define Y2_CS_PIN in Configuration_adv.h." -#elif AXIS_DRIVER_TYPE(Z, TMC2130) && !PIN_EXISTS(Z_CS) - #error "Z_CS_PIN is required for TMC2130. Define Z_CS_PIN in Configuration_adv.h." -#elif AXIS_DRIVER_TYPE(Z2, TMC2130) && !PIN_EXISTS(Z2_CS) - #error "Z2_CS_PIN is required for TMC2130. Define Z2_CS_PIN in Configuration_adv.h." -#elif AXIS_DRIVER_TYPE(Z3, TMC2130) && !PIN_EXISTS(Z3_CS) - #error "Z3_CS_PIN is required for TMC2130. Define Z3_CS_PIN in Configuration_adv.h." -#elif AXIS_DRIVER_TYPE(E0, TMC2130) && !PIN_EXISTS(E0_CS) - #error "E0_CS_PIN is required for TMC2130. Define E0_CS_PIN in Configuration_adv.h." -#elif AXIS_DRIVER_TYPE(E1, TMC2130) && !PIN_EXISTS(E1_CS) - #error "E1_CS_PIN is required for TMC2130. Define E1_CS_PIN in Configuration_adv.h." -#elif AXIS_DRIVER_TYPE(E2, TMC2130) && !PIN_EXISTS(E2_CS) - #error "E2_CS_PIN is required for TMC2130. Define E2_CS_PIN in Configuration_adv.h." -#elif AXIS_DRIVER_TYPE(E3, TMC2130) && !PIN_EXISTS(E3_CS) - #error "E3_CS_PIN is required for TMC2130. Define E3_CS_PIN in Configuration_adv.h." -#elif AXIS_DRIVER_TYPE(E4, TMC2130) && !PIN_EXISTS(E4_CS) - #error "E4_CS_PIN is required for TMC2130. Define E4_CS_PIN in Configuration_adv.h." -#elif AXIS_DRIVER_TYPE(E5, TMC2130) && !PIN_EXISTS(E5_CS) - #error "E5_CS_PIN is required for TMC2130. Define E5_CS_PIN in Configuration_adv.h." +#define INVALID_TMC2130(ST) (AXIS_DRIVER_TYPE(ST, TMC2130) && !PIN_EXISTS(ST##_CS)) +#if INVALID_TMC2130(X) + #error "TMC2130 on X requires X_CS_PIN." +#elif INVALID_TMC2130(X2) + #error "TMC2130 on X2 requires X2_CS_PIN." +#elif INVALID_TMC2130(Y) + #error "TMC2130 on Y requires Y_CS_PIN." +#elif INVALID_TMC2130(Y2) + #error "TMC2130 on Y2 requires Y2_CS_PIN." +#elif INVALID_TMC2130(Z) + #error "TMC2130 on Z requires Z_CS_PIN." +#elif INVALID_TMC2130(Z2) + #error "TMC2130 on Z2 requires Z2_CS_PIN." +#elif INVALID_TMC2130(Z3) + #error "TMC2130 on Z3 requires Z3_CS_PIN." +#elif INVALID_TMC2130(E0) + #error "TMC2130 on E0 requires E0_CS_PIN." +#elif INVALID_TMC2130(E1) + #error "TMC2130 on E1 requires E1_CS_PIN." +#elif INVALID_TMC2130(E2) + #error "TMC2130 on E2 requires E2_CS_PIN." +#elif INVALID_TMC2130(E3) + #error "TMC2130 on E3 requires E3_CS_PIN." +#elif INVALID_TMC2130(E4) + #error "TMC2130 on E4 requires E4_CS_PIN." +#elif INVALID_TMC2130(E5) + #error "TMC2130 on E5 requires E5_CS_PIN." #endif +#undef INVALID_TMC2130 + +/** + * Check existing RX/TX pins against enable TMC UART drivers. + */ +#define INVALID_TMC2208(ST) (AXIS_DRIVER_TYPE(ST, TMC2208) && !(defined(ST##_HARDWARE_SERIAL) || (PIN_EXISTS(ST##_SERIAL_RX) && PIN_EXISTS(ST##_SERIAL_TX)))) +#if INVALID_TMC2208(X) + #error "TMC2208 on X requires X_HARDWARE_SERIAL or X_SERIAL_(RX|TX)_PIN." +#elif INVALID_TMC2208(X2) + #error "TMC2208 on X2 requires X2_HARDWARE_SERIAL or X2_SERIAL_(RX|TX)_PIN." +#elif INVALID_TMC2208(Y) + #error "TMC2208 on Y requires Y_HARDWARE_SERIAL or Y_SERIAL_(RX|TX)_PIN." +#elif INVALID_TMC2208(Y2) + #error "TMC2208 on Y2 requires Y2_HARDWARE_SERIAL or Y2_SERIAL_(RX|TX)_PIN." +#elif INVALID_TMC2208(Z) + #error "TMC2208 on Z requires Z_HARDWARE_SERIAL or Z_SERIAL_(RX|TX)_PIN." +#elif INVALID_TMC2208(Z2) + #error "TMC2208 on Z2 requires Z2_HARDWARE_SERIAL or Z2_SERIAL_(RX|TX)_PIN." +#elif INVALID_TMC2208(Z3) + #error "TMC2208 on Z3 requires Z3_HARDWARE_SERIAL or Z3_SERIAL_(RX|TX)_PIN." +#elif INVALID_TMC2208(E0) + #error "TMC2208 on E0 requires E0_HARDWARE_SERIAL or E0_SERIAL_(RX|TX)_PIN." +#elif INVALID_TMC2208(E1) + #error "TMC2208 on E1 requires E1_HARDWARE_SERIAL or E1_SERIAL_(RX|TX)_PIN." +#elif INVALID_TMC2208(E2) + #error "TMC2208 on E2 requires E2_HARDWARE_SERIAL or E2_SERIAL_(RX|TX)_PIN." +#elif INVALID_TMC2208(E3) + #error "TMC2208 on E3 requires E3_HARDWARE_SERIAL or E3_SERIAL_(RX|TX)_PIN." +#elif INVALID_TMC2208(E4) + #error "TMC2208 on E4 requires E4_HARDWARE_SERIAL or E4_SERIAL_(RX|TX)_PIN." +#elif INVALID_TMC2208(E5) + #error "TMC2208 on E5 requires E5_HARDWARE_SERIAL or E5_SERIAL_(RX|TX)_PIN." +#endif +#undef INVALID_TMC2208 /** * TMC2208 software UART and ENDSTOP_INTERRUPTS both use pin change interrupts (PCI) @@ -1720,23 +1835,32 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, // clearing the stallGuard activated status is found. #if ENABLED(DELTA) && DISABLED(STEALTHCHOP) #error "SENSORLESS_HOMING on DELTA currently requires STEALTHCHOP." - #elif X_SENSORLESS && X_HOME_DIR == -1 && (DISABLED(X_MIN_ENDSTOP_INVERTING) || DISABLED(ENDSTOPPULLUP_XMIN)) + #elif X_SENSORLESS && X_HOME_DIR == -1 && (!X_MIN_ENDSTOP_INVERTING || DISABLED(ENDSTOPPULLUP_XMIN)) #error "SENSORLESS_HOMING requires X_MIN_ENDSTOP_INVERTING and ENDSTOPPULLUP_XMIN when homing to X_MIN." - #elif X_SENSORLESS && X_HOME_DIR == 1 && (DISABLED(X_MAX_ENDSTOP_INVERTING) || DISABLED(ENDSTOPPULLUP_XMAX)) + #elif X_SENSORLESS && X_HOME_DIR == 1 && (!X_MAX_ENDSTOP_INVERTING || DISABLED(ENDSTOPPULLUP_XMAX)) #error "SENSORLESS_HOMING requires X_MAX_ENDSTOP_INVERTING and ENDSTOPPULLUP_XMAX when homing to X_MAX." - #elif Y_SENSORLESS && Y_HOME_DIR == -1 && (DISABLED(Y_MIN_ENDSTOP_INVERTING) || DISABLED(ENDSTOPPULLUP_YMIN)) + #elif Y_SENSORLESS && Y_HOME_DIR == -1 && (!Y_MIN_ENDSTOP_INVERTING || DISABLED(ENDSTOPPULLUP_YMIN)) #error "SENSORLESS_HOMING requires Y_MIN_ENDSTOP_INVERTING and ENDSTOPPULLUP_YMIN when homing to Y_MIN." - #elif Y_SENSORLESS && Y_HOME_DIR == 1 && (DISABLED(Y_MAX_ENDSTOP_INVERTING) || DISABLED(ENDSTOPPULLUP_YMAX)) + #elif Y_SENSORLESS && Y_HOME_DIR == 1 && (!Y_MAX_ENDSTOP_INVERTING || DISABLED(ENDSTOPPULLUP_YMAX)) #error "SENSORLESS_HOMING requires Y_MAX_ENDSTOP_INVERTING and ENDSTOPPULLUP_YMAX when homing to Y_MAX." - #elif Z_SENSORLESS && Z_HOME_DIR == -1 && (DISABLED(Z_MIN_ENDSTOP_INVERTING) || DISABLED(ENDSTOPPULLUP_ZMIN)) + #elif Z_SENSORLESS && Z_HOME_DIR == -1 && (!Z_MIN_ENDSTOP_INVERTING || DISABLED(ENDSTOPPULLUP_ZMIN)) #error "SENSORLESS_HOMING requires Z_MIN_ENDSTOP_INVERTING and ENDSTOPPULLUP_ZMIN when homing to Z_MIN." - #elif Z_SENSORLESS && Z_HOME_DIR == 1 && (DISABLED(Z_MAX_ENDSTOP_INVERTING) || DISABLED(ENDSTOPPULLUP_ZMAX)) + #elif Z_SENSORLESS && Z_HOME_DIR == 1 && (!Z_MAX_ENDSTOP_INVERTING || DISABLED(ENDSTOPPULLUP_ZMAX)) #error "SENSORLESS_HOMING requires Z_MAX_ENDSTOP_INVERTING and ENDSTOPPULLUP_ZMAX when homing to Z_MAX." #elif ENDSTOP_NOISE_THRESHOLD #error "SENSORLESS_HOMING is incompatible with ENDSTOP_NOISE_THRESHOLD." #endif #endif +// Sensorless homing/probing requirements +#if ENABLED(SENSORLESS_HOMING) && !(X_SENSORLESS || Y_SENSORLESS || Z_SENSORLESS) + #error "SENSORLESS_HOMING requires a TMC stepper driver with StallGuard on X, Y, or Z axes." +#elif ENABLED(SENSORLESS_PROBING) && ENABLED(DELTA) && !(X_SENSORLESS && Y_SENSORLESS && Z_SENSORLESS) + #error "SENSORLESS_PROBING for DELTA requires TMC stepper drivers with StallGuard on X, Y, and Z axes." +#elif ENABLED(SENSORLESS_PROBING) && !Z_SENSORLESS + #error "SENSORLESS_PROBING requires a TMC stepper driver with StallGuard on Z." +#endif + // Sensorless homing is required for both combined steppers in an H-bot #if CORE_IS_XY && X_SENSORLESS != Y_SENSORLESS #error "CoreXY requires both X and Y to use sensorless homing if either does." @@ -1746,19 +1870,18 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, #error "CoreYZ requires both Y and Z to use sensorless homing if either does." #endif +// Other TMC feature requirements #if ENABLED(HYBRID_THRESHOLD) && DISABLED(STEALTHCHOP) #error "Enable STEALTHCHOP to use HYBRID_THRESHOLD." -#endif -#if ENABLED(TMC_Z_CALIBRATION) && !AXIS_IS_TMC(Z) && !AXIS_IS_TMC(Z2) && !AXIS_IS_TMC(Z3) +#elif ENABLED(TMC_Z_CALIBRATION) && !AXIS_IS_TMC(Z) && !AXIS_IS_TMC(Z2) && !AXIS_IS_TMC(Z3) #error "TMC_Z_CALIBRATION requires at least one TMC driver on Z axis" -#endif - -#if ENABLED(SENSORLESS_HOMING) && !HAS_STALLGUARD - #error "SENSORLESS_HOMING requires TMC2130 or TMC2660 stepper drivers." -#endif -#if ENABLED(STEALTHCHOP) && !HAS_STEALTHCHOP +#elif ENABLED(SENSORLESS_HOMING) && !HAS_STALLGUARD + #error "SENSORLESS_HOMING requires TMC2130 stepper drivers." +#elif ENABLED(SENSORLESS_PROBING) && !HAS_STALLGUARD + #error "SENSORLESS_PROBING requires TMC2130 stepper drivers." +#elif ENABLED(STEALTHCHOP) && !HAS_STEALTHCHOP #error "STEALTHCHOP requires TMC2130 or TMC2208 stepper drivers." - #endif +#endif /** * Digipot requirement @@ -1779,9 +1902,9 @@ constexpr float sanity_arr_1[] = DEFAULT_AXIS_STEPS_PER_UNIT, static_assert(COUNT(sanity_arr_1) >= XYZE, "DEFAULT_AXIS_STEPS_PER_UNIT requires 4 (or more) elements."); static_assert(COUNT(sanity_arr_2) >= XYZE, "DEFAULT_MAX_FEEDRATE requires 4 (or more) elements."); static_assert(COUNT(sanity_arr_3) >= XYZE, "DEFAULT_MAX_ACCELERATION requires 4 (or more) elements."); -static_assert(COUNT(sanity_arr_1) <= XYZE_N, "DEFAULT_AXIS_STEPS_PER_UNIT has too many elements."); -static_assert(COUNT(sanity_arr_2) <= XYZE_N, "DEFAULT_MAX_FEEDRATE has too many elements."); -static_assert(COUNT(sanity_arr_3) <= XYZE_N, "DEFAULT_MAX_ACCELERATION has too many elements."); +static_assert(COUNT(sanity_arr_1) <= XYZE_N, "DEFAULT_AXIS_STEPS_PER_UNIT has too many elements. (Did you forget to enable DISTINCT_E_FACTORS?)"); +static_assert(COUNT(sanity_arr_2) <= XYZE_N, "DEFAULT_MAX_FEEDRATE has too many elements. (Did you forget to enable DISTINCT_E_FACTORS?)"); +static_assert(COUNT(sanity_arr_3) <= XYZE_N, "DEFAULT_MAX_ACCELERATION has too many elements. (Did you forget to enable DISTINCT_E_FACTORS?)"); #if ENABLED(CNC_COORDINATE_SYSTEMS) && ENABLED(NO_WORKSPACE_OFFSETS) #error "CNC_COORDINATE_SYSTEMS is incompatible with NO_WORKSPACE_OFFSETS." @@ -1821,8 +1944,31 @@ static_assert(COUNT(sanity_arr_3) <= XYZE_N, "DEFAULT_MAX_ACCELERATION has too m #error "FAST_PWM_FAN only supported by 8 bit CPUs." #endif +#if ENABLED(Z_STEPPER_AUTO_ALIGN) + #if !Z_MULTI_STEPPER_DRIVERS + #error "Z_STEPPER_AUTO_ALIGN requires Z_DUAL_STEPPER_DRIVERS or Z_TRIPLE_STEPPER_DRIVERS." + #elif !HAS_BED_PROBE + #error "Z_STEPPER_AUTO_ALIGN requires a Z-bed probe." + #endif + constexpr float sanity_arr_z_align_x[] = Z_STEPPER_ALIGN_X, sanity_arr_z_align_y[] = Z_STEPPER_ALIGN_Y; + static_assert( + COUNT(sanity_arr_z_align_x) == Z_STEPPER_COUNT && COUNT(sanity_arr_z_align_y) == Z_STEPPER_COUNT, + "Z_STEPPER_ALIGN_[XY]POS settings require one element per Z stepper." + ); +#endif + #if ENABLED(PRINTCOUNTER) && DISABLED(EEPROM_SETTINGS) #error "PRINTCOUNTER requires EEPROM_SETTINGS. Please update your Configuration." #endif -#endif // _SANITYCHECK_H_ +#if ENABLED(USB_FLASH_DRIVE_SUPPORT) && !(PIN_EXISTS(USB_CS) && PIN_EXISTS(USB_INTR)) + #error "USB_CS_PIN and USB_INTR_PIN are required for USB_FLASH_DRIVE_SUPPORT." +#endif + +#if ENABLED(SD_FIRMWARE_UPDATE) && !defined(__AVR_ATmega2560__) + #error "SD_FIRMWARE_UPDATE requires an ATmega2560-based (Arduino Mega) board." +#endif + +#if ENABLED(GCODE_MACROS) && !WITHIN(GCODE_MACROS_SLOTS, 1, 10) + #error "GCODE_MACROS_SLOTS must be a number from 1 to 10." +#endif diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index f15c2538af..087745091c 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -40,7 +40,7 @@ /** * Marlin release version identifier */ - #define SHORT_BUILD_VERSION "2.0.x_R2" + #define SHORT_BUILD_VERSION "2.0.x_R4" /** * Verbose version identifier which should contain a reference to the location @@ -53,7 +53,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ - #define STRING_DISTRIBUTION_DATE "2018-09-28" + #define STRING_DISTRIBUTION_DATE "2018-11-23" /** * Required minimum Configuration.h and Configuration_adv.h file versions. diff --git a/Marlin/src/lcd/lcdprint_hd44780.cpp b/Marlin/src/lcd/HD44780/lcdprint_hd44780.cpp similarity index 88% rename from Marlin/src/lcd/lcdprint_hd44780.cpp rename to Marlin/src/lcd/HD44780/lcdprint_hd44780.cpp index 03bc70fd32..38e06ec96a 100644 --- a/Marlin/src/lcd/lcdprint_hd44780.cpp +++ b/Marlin/src/lcd/HD44780/lcdprint_hd44780.cpp @@ -1,5 +1,5 @@ /** - * @file lcdprint_hd44780.c + * @file lcdprint_hd44780.cpp * @brief LCD print api for HD44780 * @author Yunhui Fu (yhfudev@gmail.com) * @version 1.0 @@ -12,36 +12,32 @@ * Western(English), Cyrillic(Russian), Kana(Japanese) charsets. */ -#include "../inc/MarlinConfigPre.h" -#include "../inc/MarlinConfig.h" +#include "../../inc/MarlinConfigPre.h" -#if ENABLED(ULTRA_LCD) -#include "ultralcd.h" -#include "../Marlin.h" +#if HAS_CHARACTER_LCD + +#include "../ultralcd.h" +#include "../../Marlin.h" + +#include "ultralcd_HD44780.h" -#if DISABLED(DOGLCD) #include -#include "fontutils.h" -#include "lcdprint.h" -#include "ultralcd_common_HD44780.h" #ifndef LCD_CLASS #include #define LCD_CLASS LiquidCrystal #endif extern LCD_CLASS lcd; -LCD_CLASS *plcd = &lcd; int lcd_glyph_height(void) { return 1; } -//////////////////////////////////////////////////////////// typedef struct _hd44780_charmap_t { wchar_t uchar; // the unicode char uint8_t idx; // the glyph of the char in the ROM uint8_t idx2; // the char used to be combined with the idx to simulate a single char } hd44780_charmap_t; -#if defined(__AVR__) +#ifdef __AVR__ #define IV(a) U##a #else #define IV(a) L##a @@ -871,11 +867,7 @@ static const hd44780_charmap_t g_hd44780_charmap_common[] PROGMEM = { /* return v1 - v2 */ static int hd44780_charmap_compare(hd44780_charmap_t * v1, hd44780_charmap_t * v2) { - if (v1->uchar < v2->uchar) - return -1; - else if (v1->uchar > v2->uchar) - return 1; - return 0; + return (v1->uchar < v2->uchar) ? -1 : (v1->uchar > v2->uchar) ? 1 : 0; } static int pf_bsearch_cb_comp_hd4map_pgm(void *userdata, size_t idx, void * data_pin) { @@ -885,83 +877,9 @@ static int pf_bsearch_cb_comp_hd4map_pgm(void *userdata, size_t idx, void * data return hd44780_charmap_compare(&localval, (hd44780_charmap_t *)data_pin); } -#if DEBUG +void lcd_moveto(const uint8_t col, const uint8_t row) { lcd.setCursor(col, row); } -int test_hd44780_charmap(hd44780_charmap_t *data, size_t size, char *name, char flg_show_contents) { - int ret; - size_t idx = 0; - hd44780_charmap_t preval = {0, 0, 0}; - hd44780_charmap_t pinval = {0, 0, 0}; - char flg_error = 0; - - int i; - - TRACE("Test %s\n", name); - - for (i = 0; i < size; i ++) { - memcpy_P (&pinval, &(data[i]), sizeof(pinval)); - - if (flg_show_contents) { - #if 1 - TRACE("[% 4d] % 6" PRIu32 "(0x%04" PRIX32 ") --> 0x%02X,0x%02X%s\n", i, pinval.uchar, pinval.uchar, (unsigned int)(pinval.idx), (unsigned int)(pinval.idx2), (preval.uchar < pinval.uchar?"":" <--- ERROR")); - #else - TRACE("[% 4d]", i); - TRACE("% 6" PRIu32 "(0x%04" PRIX32 "),", pinval.uchar, pinval.uchar); - TRACE("0x%02X,", (unsigned int)(pinval.idx)); - TRACE("0x%02X,", (unsigned int)(pinval.idx2)); - TRACE("%s", (preval.uchar < pinval.uchar?"":" <--- ERROR")); - #endif - } - if (preval.uchar >= pinval.uchar) { - flg_error = 1; - // TRACE("Error: out of order in array %s: idx=%d, val=%d(0x%x)\n", name, i, pinval.uchar, pinval.uchar); - // return -1; - } - memcpy (&preval, &pinval, sizeof(pinval)); - - ret = pf_bsearch_r((void *)data, size, pf_bsearch_cb_comp_hd4map_pgm, (void *)&pinval, &idx); - if (ret < 0) { - flg_error = 1; - TRACE("Error: not found item in array %s: idx=%d, val=%d(0x%x)\n", name, i, pinval.uchar, pinval.uchar); - //return -1; - } - if (idx != i) { - flg_error = 1; - TRACE("Error: wrong index found item in array %s: idx=%d, val=%d(0x%x)\n", name, i, pinval.uchar, pinval.uchar); - //return -1; - } - } - if (flg_error) { - TRACE("\nError: in array %s\n\n", name); - return -1; - } - TRACE("\nPASS array %s\n\n", name); - return 0; -} - -int test_hd44780_charmap_all(void) { - int flg_error = 0; - if (test_hd44780_charmap(g_hd44780_charmap_device, NUM_ARRAY(g_hd44780_charmap_device), "g_hd44780_charmap_device", 0) < 0) { - flg_error = 1; - test_hd44780_charmap(g_hd44780_charmap_device, NUM_ARRAY(g_hd44780_charmap_device), "g_hd44780_charmap_device", 1); - } - if (test_hd44780_charmap(g_hd44780_charmap_common, NUM_ARRAY(g_hd44780_charmap_common), "g_hd44780_charmap_common", 0) < 0) { - flg_error = 1; - test_hd44780_charmap(g_hd44780_charmap_common, NUM_ARRAY(g_hd44780_charmap_common), "g_hd44780_charmap_common", 1); - } - if (flg_error) { - TRACE("\nFAILED in hd44780 tests!\n"); - return -1; - } - TRACE("\nPASS in hd44780 tests.\n"); - return 0; -} - -#endif // DEBUG - -void lcd_moveto(int col, int row) { - plcd->setCursor(col, row); -} +void lcd_put_int(const int i) { lcd.print(i); } // return < 0 on error // return the advanced cols @@ -979,7 +897,7 @@ int lcd_put_wchar_max(wchar_t c, pixel_len_t max_length) { // TODO: fix the '\\' that doesnt exist in the HD44870 if (c < 128) { - plcd->write((uint8_t)c); + lcd.write((uint8_t)c); return 1; } copy_address = NULL; @@ -996,30 +914,30 @@ int lcd_put_wchar_max(wchar_t c, pixel_len_t max_length) { hd44780_charmap_t localval; // found memcpy_P(&localval, copy_address, sizeof(localval)); - plcd->write(localval.idx); + lcd.write(localval.idx); if (max_length >= 2 && localval.idx2 > 0) { - plcd->write(localval.idx2); + lcd.write(localval.idx2); return 2; } return 1; } // Not found, print '?' instead - plcd->write((uint8_t)'?'); + lcd.write((uint8_t)'?'); return 1; } /** -* @brief Draw a UTF-8 string -* -* @param utf8_str : the UTF-8 string -* @param cb_read_byte : the callback function to read one byte from the utf8_str (from RAM or ROM) -* @param max_length : the pixel length of the string allowed (or number of slots in HD44780) -* -* @return the number of pixels advanced -* -* Draw a UTF-8 string -*/ + * @brief Draw a UTF-8 string + * + * @param utf8_str : the UTF-8 string + * @param cb_read_byte : the callback function to read one byte from the utf8_str (from RAM or ROM) + * @param max_length : the pixel length of the string allowed (or number of slots in HD44780) + * + * @return the number of pixels advanced + * + * Draw a UTF-8 string + */ static int lcd_put_u8str_max_cb(const char * utf8_str, uint8_t (*cb_read_byte)(uint8_t * str), pixel_len_t max_length) { pixel_len_t ret = 0; uint8_t *p = (uint8_t *)utf8_str; @@ -1036,9 +954,82 @@ int lcd_put_u8str_max(const char * utf8_str, pixel_len_t max_length) { return lcd_put_u8str_max_cb(utf8_str, read_byte_ram, max_length); } -int lcd_put_u8str_max_P(const char * utf8_str_P, pixel_len_t max_length) { +int lcd_put_u8str_max_P(PGM_P utf8_str_P, pixel_len_t max_length) { return lcd_put_u8str_max_cb(utf8_str_P, read_byte_rom, max_length); } -#endif // DOGLCD -#endif // ULTRA_LCD +#if ENABLED(DEBUG_LCDPRINT) + + int test_hd44780_charmap(hd44780_charmap_t *data, size_t size, char *name, char flg_show_contents) { + int ret; + size_t idx = 0; + hd44780_charmap_t preval = {0, 0, 0}; + hd44780_charmap_t pinval = {0, 0, 0}; + char flg_error = 0; + + int i; + + TRACE("Test %s\n", name); + + for (i = 0; i < size; i ++) { + memcpy_P(&pinval, &(data[i]), sizeof(pinval)); + + if (flg_show_contents) { + #if 1 + TRACE("[% 4d] % 6" PRIu32 "(0x%04" PRIX32 ") --> 0x%02X,0x%02X%s\n", i, pinval.uchar, pinval.uchar, (unsigned int)(pinval.idx), (unsigned int)(pinval.idx2), (preval.uchar < pinval.uchar?"":" <--- ERROR")); + #else + TRACE("[% 4d]", i); + TRACE("% 6" PRIu32 "(0x%04" PRIX32 "),", pinval.uchar, pinval.uchar); + TRACE("0x%02X,", (unsigned int)(pinval.idx)); + TRACE("0x%02X,", (unsigned int)(pinval.idx2)); + TRACE("%s", (preval.uchar < pinval.uchar?"":" <--- ERROR")); + #endif + } + if (preval.uchar >= pinval.uchar) { + flg_error = 1; + //TRACE("Error: out of order in array %s: idx=%d, val=%d(0x%x)\n", name, i, pinval.uchar, pinval.uchar); + //return -1; + } + memcpy(&preval, &pinval, sizeof(pinval)); + + ret = pf_bsearch_r((void *)data, size, pf_bsearch_cb_comp_hd4map_pgm, (void *)&pinval, &idx); + if (ret < 0) { + flg_error = 1; + TRACE("Error: not found item in array %s: idx=%d, val=%d(0x%x)\n", name, i, pinval.uchar, pinval.uchar); + //return -1; + } + if (idx != i) { + flg_error = 1; + TRACE("Error: wrong index found item in array %s: idx=%d, val=%d(0x%x)\n", name, i, pinval.uchar, pinval.uchar); + //return -1; + } + } + if (flg_error) { + TRACE("\nError: in array %s\n\n", name); + return -1; + } + TRACE("\nPASS array %s\n\n", name); + return 0; + } + + int test_hd44780_charmap_all(void) { + int flg_error = 0; + if (test_hd44780_charmap(g_hd44780_charmap_device, NUM_ARRAY(g_hd44780_charmap_device), "g_hd44780_charmap_device", 0) < 0) { + flg_error = 1; + test_hd44780_charmap(g_hd44780_charmap_device, NUM_ARRAY(g_hd44780_charmap_device), "g_hd44780_charmap_device", 1); + } + if (test_hd44780_charmap(g_hd44780_charmap_common, NUM_ARRAY(g_hd44780_charmap_common), "g_hd44780_charmap_common", 0) < 0) { + flg_error = 1; + test_hd44780_charmap(g_hd44780_charmap_common, NUM_ARRAY(g_hd44780_charmap_common), "g_hd44780_charmap_common", 1); + } + if (flg_error) { + TRACE("\nFAILED in hd44780 tests!\n"); + return -1; + } + TRACE("\nPASS in hd44780 tests.\n"); + return 0; + } + +#endif // DEBUG_LCDPRINT + +#endif // HAS_CHARACTER_LCD diff --git a/Marlin/src/lcd/ultralcd_impl_HD44780.h b/Marlin/src/lcd/HD44780/ultralcd_HD44780.cpp similarity index 55% rename from Marlin/src/lcd/ultralcd_impl_HD44780.h rename to Marlin/src/lcd/HD44780/ultralcd_HD44780.cpp index 61437f5c3f..c309500b13 100644 --- a/Marlin/src/lcd/ultralcd_impl_HD44780.h +++ b/Marlin/src/lcd/HD44780/ultralcd_HD44780.cpp @@ -20,67 +20,75 @@ * */ -#ifndef ULTRALCD_IMPL_HD44780_H -#define ULTRALCD_IMPL_HD44780_H +#include "../../inc/MarlinConfigPre.h" + +#if HAS_CHARACTER_LCD /** - * Implementation of the LCD display routines for a Hitachi HD44780 display. + * ultralcd_HD44780.cpp + * + * LCD display implementations for Hitachi HD44780. * These are the most common LCD character displays. */ -#include "ultralcd_common_HD44780.h" +#include "ultralcd_HD44780.h" +#include "../ultralcd.h" + +#include "../../sd/cardreader.h" +#include "../../module/temperature.h" +#include "../../module/printcounter.h" +#include "../../module/planner.h" +#include "../../module/motion.h" + +#if DISABLED(LCD_PROGRESS_BAR) && ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT) + #include "../../feature/filwidth.h" + #include "../../gcode/parser.h" +#endif + +#if ENABLED(AUTO_BED_LEVELING_UBL) + #include "../../feature/bedlevel/ubl/ubl.h" +#endif + +// +// Create LCD instance and chipset-specific information +// -//////////////////////////////////// -// Create LCD class instance and chipset-specific information #if ENABLED(LCD_I2C_TYPE_PCF8575) + LCD_CLASS lcd(LCD_I2C_ADDRESS, LCD_I2C_PIN_EN, LCD_I2C_PIN_RW, LCD_I2C_PIN_RS, LCD_I2C_PIN_D4, LCD_I2C_PIN_D5, LCD_I2C_PIN_D6, LCD_I2C_PIN_D7); -#elif ENABLED(LCD_I2C_TYPE_MCP23017) - #if ENABLED(DETECT_DEVICE) - LCD_CLASS lcd(LCD_I2C_ADDRESS, 1); - #else - LCD_CLASS lcd(LCD_I2C_ADDRESS); - #endif +#elif ENABLED(LCD_I2C_TYPE_MCP23017) || ENABLED(LCD_I2C_TYPE_MCP23008) -#elif ENABLED(LCD_I2C_TYPE_MCP23008) - #if ENABLED(DETECT_DEVICE) - LCD_CLASS lcd(LCD_I2C_ADDRESS, 1); - #else - LCD_CLASS lcd(LCD_I2C_ADDRESS); - #endif + LCD_CLASS lcd(LCD_I2C_ADDRESS + #ifdef DETECT_DEVICE + , 1 + #endif + ); #elif ENABLED(LCD_I2C_TYPE_PCA8574) + LCD_CLASS lcd(LCD_I2C_ADDRESS, LCD_WIDTH, LCD_HEIGHT); -// 2 wire Non-latching LCD SR from: -// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection #elif ENABLED(SR_LCD_2W_NL) - #if PIN_EXISTS(SR_STROBE) - LCD_CLASS lcd(SR_DATA_PIN, SR_CLK_PIN, SR_STROBE_PIN); - #else - LCD_CLASS lcd(SR_DATA_PIN, SR_CLK_PIN); - #endif + + // 2 wire Non-latching LCD SR from: + // https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection + + LCD_CLASS lcd(SR_DATA_PIN, SR_CLK_PIN + #if PIN_EXISTS(SR_STROBE) + , SR_STROBE_PIN + #endif + ); #elif ENABLED(LCM1602) + LCD_CLASS lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); #else - // Standard directly connected LCD implementations - LCD_CLASS lcd(LCD_PINS_RS, LCD_PINS_ENABLE, LCD_PINS_D4, LCD_PINS_D5, LCD_PINS_D6, LCD_PINS_D7); //RS,Enable,D4,D5,D6,D7 -#endif -#include "fontutils.h" -#include "lcdprint.h" + // Standard direct-connected LCD implementations + LCD_CLASS lcd(LCD_PINS_RS, LCD_PINS_ENABLE, LCD_PINS_D4, LCD_PINS_D5, LCD_PINS_D6, LCD_PINS_D7); -#if ENABLED(LCD_PROGRESS_BAR) - static millis_t progress_bar_ms = 0; // Start millis of the current progress bar cycle - #if PROGRESS_MSG_EXPIRE > 0 - static millis_t expire_status_ms = 0; // millis at which to expire the status message - #endif -#endif - -#if ENABLED(LCD_HAS_STATUS_INDICATORS) - static void lcd_implementation_update_indicators(); #endif static void createChar_P(const char c, const byte * const ptr) { @@ -90,11 +98,15 @@ static void createChar_P(const char c, const byte * const ptr) { lcd.createChar(c, temp); } -static void lcd_set_custom_characters( - #if ENABLED(LCD_PROGRESS_BAR) || ENABLED(SHOW_BOOTSCREEN) - const uint8_t screen_charset=CHARSET_INFO +#if ENABLED(LCD_PROGRESS_BAR) + #define LCD_STR_PROGRESS "\x03\x04\x05" +#endif + +void MarlinUI::set_custom_characters(const HD44780CharSet screen_charset/*=CHARSET_INFO*/) { + #if DISABLED(LCD_PROGRESS_BAR) && DISABLED(SHOW_BOOTSCREEN) + UNUSED(screen_charset); #endif -) { + // CHARSET_BOOT #if ENABLED(SHOW_BOOTSCREEN) const static PROGMEM byte corner[4][8] = { { @@ -182,14 +194,25 @@ static void lcd_set_custom_characters( }; const static PROGMEM byte feedrate[8] = { - B11100, - B10000, - B11000, - B10111, - B00101, - B00110, - B00101, - B00000 + #if LCD_INFO_SCREEN_STYLE == 1 + B00000, + B00100, + B10010, + B01001, + B10010, + B00100, + B00000, + B00000 + #else + B11100, + B10000, + B11000, + B10111, + B00101, + B00110, + B00101, + B00000 + #endif }; const static PROGMEM byte clock[8] = { @@ -272,11 +295,11 @@ static void lcd_set_custom_characters( else #endif { // Info Screen uses 5 special characters - createChar_P(LCD_BEDTEMP_CHAR, bedTemp); - createChar_P(LCD_DEGREE_CHAR, degree); + createChar_P(LCD_STR_BEDTEMP[0], bedTemp); + createChar_P(LCD_STR_DEGREE[0], degree); createChar_P(LCD_STR_THERMOMETER[0], thermometer); - createChar_P(LCD_FEEDRATE_CHAR, feedrate); - createChar_P(LCD_CLOCK_CHAR, clock); + createChar_P(LCD_STR_FEEDRATE[0], feedrate); + createChar_P(LCD_STR_CLOCK[0], clock); #if ENABLED(LCD_PROGRESS_BAR) if (screen_charset == CHARSET_INFO) { // 3 Progress bar characters for info screen @@ -286,7 +309,7 @@ static void lcd_set_custom_characters( else #endif { - createChar_P(LCD_UPLEVEL_CHAR, uplevel); + createChar_P(LCD_STR_UPLEVEL[0], uplevel); #if ENABLED(SDSUPPORT) // SD Card sub-menu special characters createChar_P(LCD_STR_REFRESH[0], refresh); @@ -297,11 +320,7 @@ static void lcd_set_custom_characters( } -static void lcd_implementation_init( - #if ENABLED(LCD_PROGRESS_BAR) - const uint8_t screen_charset=CHARSET_INFO - #endif -) { +void MarlinUI::init_lcd() { #if ENABLED(LCD_I2C_TYPE_PCF8575) lcd.begin(LCD_WIDTH, LCD_HEIGHT); @@ -313,7 +332,7 @@ static void lcd_implementation_init( #elif ENABLED(LCD_I2C_TYPE_MCP23017) lcd.setMCPType(LTI_TYPE_MCP23017); lcd.begin(LCD_WIDTH, LCD_HEIGHT); - lcd_implementation_update_indicators(); + update_indicators(); #elif ENABLED(LCD_I2C_TYPE_MCP23008) lcd.setMCPType(LTI_TYPE_MCP23008); @@ -327,16 +346,12 @@ static void lcd_implementation_init( lcd.begin(LCD_WIDTH, LCD_HEIGHT); #endif - lcd_set_custom_characters( - #if ENABLED(LCD_PROGRESS_BAR) - screen_charset - #endif - ); + set_custom_characters(on_status_screen() ? CHARSET_INFO : CHARSET_MENU); lcd.clear(); } -void lcd_implementation_clear() { lcd.clear(); } +void MarlinUI::clear_lcd() { lcd.clear(); } #if ENABLED(SHOW_BOOTSCREEN) @@ -347,20 +362,17 @@ void lcd_implementation_clear() { lcd.clear(); } } // Scroll the PSTR 'text' in a 'len' wide field for 'time' milliseconds at position col,line - void lcd_scroll(const uint8_t col, const uint8_t line, const char* const text, const uint8_t len, const int16_t time) { + void lcd_scroll(const uint8_t col, const uint8_t line, PGM_P const text, const uint8_t len, const int16_t time) { uint8_t slen = utf8_strlen_P(text); if (slen < len) { // Fits into, lcd_moveto(col, line); lcd_put_u8str_max_P(text, len); - while (slen < len) { - lcd_put_wchar(' '); - ++slen; - } + for (; slen < len; ++slen) lcd_put_wchar(' '); safe_delay(time); } else { - const char* p = text; + PGM_P p = text; int dly = time / MAX(slen, 1); for (uint8_t i = 0; i <= slen; i++) { @@ -371,11 +383,7 @@ void lcd_implementation_clear() { lcd.clear(); } lcd_put_u8str_max_P(p, len); // Fill with spaces - uint8_t ix = slen - i; - while (ix < len) { - lcd_put_wchar(' '); - ++ix; - } + for (uint8_t ix = slen - i; ix < len; ++ix) lcd_put_wchar(' '); // Delay safe_delay(dly); @@ -387,15 +395,15 @@ void lcd_implementation_clear() { lcd.clear(); } } } - static void logo_lines(const char* const extra) { + static void logo_lines(PGM_P const extra) { int16_t indent = (LCD_WIDTH - 8 - utf8_strlen_P(extra)) / 2; lcd_moveto(indent, 0); lcd_put_wchar('\x00'); lcd_put_u8str_P(PSTR( "------" )); lcd_put_wchar('\x01'); lcd_moveto(indent, 1); lcd_put_u8str_P(PSTR("|Marlin|")); lcd_put_u8str_P(extra); lcd_moveto(indent, 2); lcd_put_wchar('\x02'); lcd_put_u8str_P(PSTR( "------" )); lcd_put_wchar('\x03'); } - void lcd_bootscreen() { - lcd_set_custom_characters(CHARSET_BOOT); + void MarlinUI::show_bootscreen() { + set_custom_characters(CHARSET_BOOT); lcd.clear(); #define LCD_EXTRA_SPACE (LCD_WIDTH-8) @@ -440,6 +448,9 @@ void lcd_implementation_clear() { lcd.clear(); } CENTER_OR_SCROLL(STRING_SPLASH_LINE1, _SPLASH_WAIT_1); #ifdef STRING_SPLASH_LINE2 CENTER_OR_SCROLL(STRING_SPLASH_LINE2, 1500); + #ifdef STRING_SPLASH_LINE3 + CENTER_OR_SCROLL(STRING_SPLASH_LINE3, 1500); + #endif #endif } #elif defined(STRING_SPLASH_LINE2) @@ -464,15 +475,15 @@ void lcd_implementation_clear() { lcd.clear(); } lcd.clear(); safe_delay(100); - lcd_set_custom_characters(); + set_custom_characters(CHARSET_INFO); lcd.clear(); } #endif // SHOW_BOOTSCREEN -void lcd_kill_screen() { +void MarlinUI::draw_kill_screen() { lcd_moveto(0, 0); - lcd_put_u8str(lcd_status_message); + lcd_put_u8str(status_message); #if LCD_HEIGHT < 4 lcd_moveto(0, 2); #else @@ -540,15 +551,44 @@ FORCE_INLINE void _draw_heater_status(const int8_t heater, const char prefix, co lcd_put_u8str(itostr3left(t2 + 0.5)); if (prefix >= 0) { - lcd_put_wchar(LCD_DEGREE_CHAR); + lcd_put_wchar(LCD_STR_DEGREE[0]); lcd_put_wchar(' '); if (t2 < 10) lcd_put_wchar(' '); } } +FORCE_INLINE void _draw_bed_status(const bool blink) { + _draw_heater_status(-1, ( + #if HAS_LEVELING + planner.leveling_active && blink ? '_' : + #endif + LCD_STR_BEDTEMP[0] + ), blink); +} + +#if HAS_PRINT_PROGRESS + + FORCE_INLINE void _draw_print_progress() { + const uint8_t progress = ui.get_progress(); + lcd_put_u8str_P(PSTR( + #if ENABLED(SDSUPPORT) + "SD" + #elif ENABLED(LCD_SET_PROGRESS_MANUALLY) + "P:" + #endif + )); + if (progress) + lcd_put_u8str(itostr3(progress)); + else + lcd_put_u8str_P(PSTR("---")); + lcd_put_wchar('%'); + } + +#endif + #if ENABLED(LCD_PROGRESS_BAR) - inline void lcd_draw_progress_bar(const uint8_t percent) { + void MarlinUI::draw_progress_bar(const uint8_t percent) { const int16_t tix = (int16_t)(percent * (LCD_WIDTH) * 3) / 100, cel = tix / 3, rem = tix % 3; @@ -567,185 +607,7 @@ FORCE_INLINE void _draw_heater_status(const int8_t heater, const char prefix, co #endif // LCD_PROGRESS_BAR -/** -Possible status screens: -16x2 |000/000 B000/000| - |0123456789012345| - -16x4 |000/000 B000/000| - |SD100% Z 000.00| - |F100% T--:--| - |0123456789012345| - -20x2 |T000/000D B000/000D | - |01234567890123456789| - -20x4 |T000/000D B000/000D | - |X 000 Y 000 Z 000.00| - |F100% SD100% T--:--| - |01234567890123456789| - -20x4 |T000/000D B000/000D | - |T000/000D Z 000.00| - |F100% SD100% T--:--| - |01234567890123456789| -*/ -static void lcd_implementation_status_screen() { - const bool blink = lcd_blink(); - - // - // Line 1 - // - - lcd_moveto(0, 0); - - #if LCD_WIDTH < 20 - - // - // Hotend 0 Temperature - // - _draw_heater_status(0, -1, blink); - - // - // Hotend 1 or Bed Temperature - // - #if HOTENDS > 1 || HAS_HEATED_BED - - lcd_moveto(8, 0); - #if HOTENDS > 1 - lcd_put_wchar((char)LCD_STR_THERMOMETER[0]); - _draw_heater_status(1, -1, blink); - #else - lcd_put_wchar((char)LCD_BEDTEMP_CHAR); - _draw_heater_status(-1, -1, blink); - #endif - - #endif // HOTENDS > 1 || HAS_HEATED_BED - - #else // LCD_WIDTH >= 20 - - // - // Hotend 0 Temperature - // - _draw_heater_status(0, LCD_STR_THERMOMETER[0], blink); - - // - // Hotend 1 or Bed Temperature - // - #if HOTENDS > 1 || HAS_HEATED_BED - lcd_moveto(10, 0); - #if HOTENDS > 1 - _draw_heater_status(1, LCD_STR_THERMOMETER[0], blink); - #else - _draw_heater_status(-1, ( - #if HAS_LEVELING - planner.leveling_active && blink ? '_' : - #endif - LCD_BEDTEMP_CHAR - ), blink); - #endif - - #endif // HOTENDS > 1 || HAS_HEATED_BED - - #endif // LCD_WIDTH >= 20 - - // - // Line 2 - // - - #if LCD_HEIGHT > 2 - - #if LCD_WIDTH < 20 - - #if ENABLED(SDSUPPORT) - lcd_moveto(0, 2); - lcd_put_u8str_P(PSTR("SD")); - if (IS_SD_PRINTING) - lcd_put_u8str(itostr3(card.percentDone())); - else - lcd_put_u8str_P(PSTR("---")); - lcd_put_wchar('%'); - #endif // SDSUPPORT - - #else // LCD_WIDTH >= 20 - - lcd_moveto(0, 1); - - // If the first line has two extruder temps, - // show more temperatures on the next line - - #if HOTENDS > 2 || (HOTENDS > 1 && HAS_HEATED_BED) - - #if HOTENDS > 2 - _draw_heater_status(2, LCD_STR_THERMOMETER[0], blink); - lcd_moveto(10, 1); - #endif - - _draw_heater_status(-1, ( - #if HAS_LEVELING - planner.leveling_active && blink ? '_' : - #endif - LCD_BEDTEMP_CHAR - ), blink); - - #else // HOTENDS <= 2 && (HOTENDS <= 1 || !HAS_HEATED_BED) - - _draw_axis_value(X_AXIS, ftostr4sign(LOGICAL_X_POSITION(current_position[X_AXIS])), blink); - - lcd_put_wchar(' '); - - _draw_axis_value(Y_AXIS, ftostr4sign(LOGICAL_Y_POSITION(current_position[Y_AXIS])), blink); - - #endif // HOTENDS <= 2 && (HOTENDS <= 1 || !HAS_HEATED_BED) - - #endif // LCD_WIDTH >= 20 - - lcd_moveto(LCD_WIDTH - 8, 1); - _draw_axis_value(Z_AXIS, ftostr52sp(LOGICAL_Z_POSITION(current_position[Z_AXIS])), blink); - - #if HAS_LEVELING && !HAS_HEATED_BED - lcd_put_wchar(planner.leveling_active || blink ? '_' : ' '); - #endif - - #endif // LCD_HEIGHT > 2 - - // - // Line 3 - // - - #if LCD_HEIGHT > 3 - - lcd_moveto(0, 2); - lcd_put_wchar(LCD_FEEDRATE_CHAR); - lcd_put_u8str(itostr3(feedrate_percentage)); - lcd_put_wchar('%'); - - #if LCD_WIDTH >= 20 && ENABLED(SDSUPPORT) - - lcd_moveto(7, 2); - lcd_put_u8str_P(PSTR("SD")); - if (IS_SD_PRINTING) - lcd_put_u8str(itostr3(card.percentDone())); - else - lcd_put_u8str_P(PSTR("---")); - lcd_put_wchar('%'); - - #endif // LCD_WIDTH >= 20 && SDSUPPORT - - char buffer[10]; - duration_t elapsed = print_job_timer.duration(); - uint8_t len = elapsed.toDigital(buffer); - - lcd_moveto(LCD_WIDTH - len - 1, 2); - lcd_put_wchar(LCD_CLOCK_CHAR); - lcd_put_u8str(buffer); - - #endif // LCD_HEIGHT > 3 - - // - // Last Line - // Status Message (which may be a Progress Bar or Filament display) - // +void MarlinUI::draw_status_message(const bool blink) { lcd_moveto(0, LCD_HEIGHT - 1); @@ -753,17 +615,15 @@ static void lcd_implementation_status_screen() { // Draw the progress bar if the message has shown long enough // or if there is no message set. - #if DISABLED(LCD_SET_PROGRESS_MANUALLY) - const uint8_t progress_bar_percent = card.percentDone(); - #endif - if (progress_bar_percent > 2 && (ELAPSED(millis(), progress_bar_ms + PROGRESS_BAR_MSG_TIME) || !lcd_status_message[0])) - return lcd_draw_progress_bar(progress_bar_percent); + if (ELAPSED(millis(), progress_bar_ms + PROGRESS_BAR_MSG_TIME) || !has_status()) { + const uint8_t progress = get_progress(); + if (progress > 2) return draw_progress_bar(progress); + } #elif ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT) - // Show Filament Diameter and Volumetric Multiplier % - // After allowing lcd_status_message to show for 5 seconds - if (ELAPSED(millis(), previous_lcd_status_ms + 5000UL)) { + // Alternate Status message and Filament display + if (ELAPSED(millis(), next_filament_display)) { lcd_put_u8str_P(PSTR("Dia ")); lcd_put_u8str(ftostr12ns(filament_width_meas)); lcd_put_u8str_P(PSTR(" V")); @@ -783,13 +643,13 @@ static void lcd_implementation_status_screen() { static bool last_blink = false; // Get the UTF8 character count of the string - uint8_t slen = utf8_strlen(lcd_status_message); + uint8_t slen = utf8_strlen(status_message); // If the string fits into the LCD, just print it and do not scroll it if (slen <= LCD_WIDTH) { // The string isn't scrolling and may not fill the screen - lcd_put_u8str(lcd_status_message); + lcd_put_u8str(status_message); // Fill the rest with spaces while (slen < LCD_WIDTH) { @@ -801,7 +661,7 @@ static void lcd_implementation_status_screen() { // String is larger than the available space in screen. // Get a pointer to the next valid UTF8 character - const char *stat = lcd_status_message + status_scroll_offset; + const char *stat = status_message + status_scroll_offset; // Get the string remaining length const uint8_t rlen = utf8_strlen(stat); @@ -821,7 +681,7 @@ static void lcd_implementation_status_screen() { if (--chars) { // Draw a second dot if there's space lcd_put_wchar('.'); if (--chars) - lcd_put_u8str_max(lcd_status_message, chars); // Print a second copy of the message + lcd_put_u8str_max(status_message, chars); // Print a second copy of the message } } if (last_blink != blink) { @@ -830,7 +690,7 @@ static void lcd_implementation_status_screen() { // Adjust by complete UTF8 characters if (status_scroll_offset < slen) { status_scroll_offset++; - while (!START_OF_UTF8_CHAR(lcd_status_message[status_scroll_offset])) + while (!START_OF_UTF8_CHAR(status_message[status_scroll_offset])) status_scroll_offset++; } else @@ -841,10 +701,10 @@ static void lcd_implementation_status_screen() { UNUSED(blink); // Get the UTF8 character count of the string - uint8_t slen = utf8_strlen(lcd_status_message); + uint8_t slen = utf8_strlen(status_message); // Just print the string to the LCD - lcd_put_u8str_max(lcd_status_message, LCD_WIDTH); + lcd_put_u8str_max(status_message, LCD_WIDTH); // Fill the rest with spaces if there are missing spaces while (slen < LCD_WIDTH) { @@ -854,20 +714,268 @@ static void lcd_implementation_status_screen() { #endif } -#if ENABLED(ULTIPANEL) +/** + * LCD_INFO_SCREEN_STYLE 0 : Classic Status Screen + * + * 16x2 |000/000 B000/000| + * |0123456789012345| + * + * 16x4 |000/000 B000/000| + * |SD---% Z 000.00| + * |F---% T--:--| + * |0123456789012345| + * + * 20x2 |T000/000° B000/000° | + * |01234567890123456789| + * + * 20x4 |T000/000° B000/000° | + * |X 000 Y 000 Z000.000| + * |F---% SD---% T--:--| + * |01234567890123456789| + * + * LCD_INFO_SCREEN_STYLE 1 : Prusa-style Status Screen + * + * |T000/000° Z 000.00 | + * |B000/000° F---% | + * |SD---% T--:-- | + * |01234567890123456789| + * + * |T000/000° Z 000.00 | + * |T000/000° F---% | + * |B000/000° SD---% | + * |01234567890123456789| + */ + +void MarlinUI::draw_status_screen() { + + const bool blink = get_blink(); + lcd_moveto(0, 0); + + #if LCD_INFO_SCREEN_STYLE == 0 + + // ========== Line 1 ========== + + #if LCD_WIDTH < 20 + + // + // Hotend 0 Temperature + // + _draw_heater_status(0, -1, blink); + + // + // Hotend 1 or Bed Temperature + // + #if HOTENDS > 1 + lcd_moveto(8, 0); + lcd_put_wchar(LCD_STR_THERMOMETER[0]); + _draw_heater_status(1, -1, blink); + #elif HAS_HEATED_BED + lcd_moveto(8, 0); + lcd_put_wchar(LCD_STR_BEDTEMP[0]); + _draw_heater_status(-1, -1, blink); + #endif + + #else // LCD_WIDTH >= 20 + + // + // Hotend 0 Temperature + // + _draw_heater_status(0, LCD_STR_THERMOMETER[0], blink); + + // + // Hotend 1 or Bed Temperature + // + #if HOTENDS > 1 + lcd_moveto(10, 0); + _draw_heater_status(1, LCD_STR_THERMOMETER[0], blink); + #elif HAS_HEATED_BED + lcd_moveto(10, 0); + _draw_bed_status(blink); + #endif + + #endif // LCD_WIDTH >= 20 + + // ========== Line 2 ========== + + #if LCD_HEIGHT > 2 + + #if LCD_WIDTH < 20 + + #if HAS_PRINT_PROGRESS + lcd_moveto(0, 2); + _draw_print_progress(); + #endif + + #else // LCD_WIDTH >= 20 + + lcd_moveto(0, 1); + + // If the first line has two extruder temps, + // show more temperatures on the next line + + #if HOTENDS > 2 || (HOTENDS > 1 && HAS_HEATED_BED) + + #if HOTENDS > 2 + _draw_heater_status(2, LCD_STR_THERMOMETER[0], blink); + lcd_moveto(10, 1); + #endif + + _draw_bed_status(blink); + + #else // HOTENDS <= 2 && (HOTENDS <= 1 || !HAS_HEATED_BED) + + _draw_axis_value(X_AXIS, ftostr4sign(LOGICAL_X_POSITION(current_position[X_AXIS])), blink); + + lcd_put_wchar(' '); + + _draw_axis_value(Y_AXIS, ftostr4sign(LOGICAL_Y_POSITION(current_position[Y_AXIS])), blink); + + #endif // HOTENDS <= 2 && (HOTENDS <= 1 || !HAS_HEATED_BED) + + #endif // LCD_WIDTH >= 20 + + lcd_moveto(LCD_WIDTH - 8, 1); + _draw_axis_value(Z_AXIS, ftostr52sp(LOGICAL_Z_POSITION(current_position[Z_AXIS])), blink); + + #if HAS_LEVELING && !HAS_HEATED_BED + lcd_put_wchar(planner.leveling_active || blink ? '_' : ' '); + #endif + + #endif // LCD_HEIGHT > 2 + + // ========== Line 3 ========== + + #if LCD_HEIGHT > 3 + + lcd_moveto(0, 2); + lcd_put_wchar(LCD_STR_FEEDRATE[0]); + lcd_put_u8str(itostr3(feedrate_percentage)); + lcd_put_wchar('%'); + + char buffer[14]; + duration_t elapsed = print_job_timer.duration(); + const uint8_t len = elapsed.toDigital(buffer), + timepos = LCD_WIDTH - len - 1; + lcd_moveto(timepos, 2); + lcd_put_wchar(LCD_STR_CLOCK[0]); + lcd_put_u8str(buffer); + + #if LCD_WIDTH >= 20 + lcd_moveto(timepos - 7, 2); + #if HAS_PRINT_PROGRESS + _draw_print_progress(); + #else + char c; + int per; + #if HAS_FAN0 + if (blink) { + c = 'F'; + per = ((int(fan_speed[0]) + 1) * 100) / 256; + } + else + #endif + { + c = 'E'; + per = planner.flow_percentage[0]; + } + lcd_put_wchar(c); + lcd_put_u8str(itostr3(per)); + lcd_put_wchar('%'); + #endif + #endif + + #endif // LCD_HEIGHT > 3 + + #elif LCD_INFO_SCREEN_STYLE == 1 + + // ========== Line 1 ========== + + // + // Hotend 0 Temperature + // + _draw_heater_status(0, LCD_STR_THERMOMETER[0], blink); + + // + // Z Coordinate + // + lcd_moveto(LCD_WIDTH - 9, 0); + _draw_axis_value(Z_AXIS, ftostr52sp(LOGICAL_Z_POSITION(current_position[Z_AXIS])), blink); + + #if HAS_LEVELING && (HOTENDS > 1 || !HAS_HEATED_BED) + lcd_moveto(LCD_WIDTH - 1, 0); + lcd_put_wchar(planner.leveling_active || blink ? '_' : ' '); + #endif + + // ========== Line 2 ========== + + // + // Hotend 1 or Bed Temperature + // + lcd_moveto(0, 1); + #if HOTENDS > 1 + _draw_heater_status(1, LCD_STR_THERMOMETER[0], blink); + #elif HAS_HEATED_BED + _draw_bed_status(blink); + #endif + + lcd_moveto(LCD_WIDTH - 9, 1); + lcd_put_wchar(LCD_STR_FEEDRATE[0]); + lcd_put_u8str(itostr3(feedrate_percentage)); + lcd_put_wchar('%'); + + // ========== Line 3 ========== + + // + // SD Percent, Hotend 2, or Bed + // + lcd_moveto(0, 2); + #if HOTENDS > 2 + _draw_heater_status(2, LCD_STR_THERMOMETER[0], blink); + #elif HOTENDS > 1 && HAS_HEATED_BED + _draw_bed_status(blink); + #elif HAS_PRINT_PROGRESS + #define DREW_PRINT_PROGRESS + _draw_print_progress(); + #endif + + // + // Elapsed Time or SD Percent + // + lcd_moveto(LCD_WIDTH - 9, 2); + #if HAS_PRINT_PROGRESS && !defined(DREW_PRINT_PROGRESS) + _draw_print_progress(); + #else + duration_t elapsed = print_job_timer.duration(); + char buffer[14]; + (void)elapsed.toDigital(buffer); + lcd_put_wchar(LCD_STR_CLOCK[0]); + lcd_put_u8str(buffer); + #endif + + #endif // LCD_INFO_SCREEN_STYLE 1 + + // ========= Last Line ======== + + // + // Status Message (which may be a Progress Bar or Filament display) + // + draw_status_message(blink); +} + +#if HAS_LCD_MENU #if ENABLED(ADVANCED_PAUSE_FEATURE) - static void lcd_implementation_hotend_status(const uint8_t row, const uint8_t extruder=active_extruder) { + void MarlinUI::draw_hotend_status(const uint8_t row, const uint8_t extruder) { if (row < LCD_HEIGHT) { lcd_moveto(LCD_WIDTH - 9, row); - _draw_heater_status(extruder, LCD_STR_THERMOMETER[0], lcd_blink()); + _draw_heater_status(extruder, LCD_STR_THERMOMETER[0], ui.get_blink()); } } #endif // ADVANCED_PAUSE_FEATURE - static void lcd_implementation_drawmenu_static(const uint8_t row, const char* pstr, const bool center=true, const bool invert=false, const char *valstr=NULL) { + void draw_menu_item_static(const uint8_t row, PGM_P pstr, const bool center/*=true*/, const bool invert/*=false*/, const char *valstr/*=NULL*/) { UNUSED(invert); int8_t n = LCD_WIDTH; lcd_moveto(0, row); @@ -880,123 +988,56 @@ static void lcd_implementation_status_screen() { for (; n > 0; --n) lcd_put_wchar(' '); } - static void lcd_implementation_drawmenu_generic(const bool sel, const uint8_t row, const char* pstr, const char pre_char, const char post_char) { + void draw_menu_item(const bool sel, const uint8_t row, PGM_P pstr, const char pre_char, const char post_char) { uint8_t n = LCD_WIDTH - 2; lcd_moveto(0, row); lcd_put_wchar(sel ? pre_char : ' '); n -= lcd_put_u8str_max_P(pstr, n); - while (n--) lcd_put_wchar(' '); + for (; n; --n) lcd_put_wchar(' '); lcd_put_wchar(post_char); } - static void lcd_implementation_drawmenu_setting_edit_generic(const bool sel, const uint8_t row, const char* pstr, const char pre_char, const char* const data) { - uint8_t n = LCD_WIDTH - 2 - utf8_strlen(data); + void _draw_menu_item_edit(const bool sel, const uint8_t row, PGM_P pstr, const char* const data, const bool pgm) { + uint8_t n = LCD_WIDTH - 2 - (pgm ? utf8_strlen_P(data) : utf8_strlen(data)); lcd_moveto(0, row); - lcd_put_wchar(sel ? pre_char : ' '); + lcd_put_wchar(sel ? LCD_STR_ARROW_RIGHT[0] : ' '); n -= lcd_put_u8str_max_P(pstr, n); lcd_put_wchar(':'); - while (n--) lcd_put_wchar(' '); - lcd_put_u8str(data); - } - static void lcd_implementation_drawmenu_setting_edit_generic_P(const bool sel, const uint8_t row, const char* pstr, const char pre_char, const char* const data) { - uint8_t n = LCD_WIDTH - 2 - utf8_strlen_P(data); - lcd_moveto(0, row); - lcd_put_wchar(sel ? pre_char : ' '); - n -= lcd_put_u8str_max_P(pstr, n); - lcd_put_wchar(':'); - while (n--) lcd_put_wchar(' '); - lcd_put_u8str_P(data); + for (; n; --n) lcd_put_wchar(' '); + if (pgm) lcd_put_u8str_P(data); else lcd_put_u8str(data); } - #define DRAWMENU_SETTING_EDIT_GENERIC(_src) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', _src) - #define DRAW_BOOL_SETTING(sel, row, pstr, data) lcd_implementation_drawmenu_setting_edit_generic_P(sel, row, pstr, '>', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF)) - - void lcd_implementation_drawedit(const char* pstr, const char* const value=NULL) { + void draw_edit_screen(PGM_P const pstr, const char* const value/*=NULL*/) { lcd_moveto(1, 1); lcd_put_u8str_P(pstr); if (value != NULL) { lcd_put_wchar(':'); int len = utf8_strlen(value); - const uint8_t valrow = (utf8_strlen_P(pstr) + 1 + len + 1) > (LCD_WIDTH - 2) ? 2 : 1; // Value on the next row if it won't fit - lcd_moveto((LCD_WIDTH - 1) - (len + 1), valrow); // Right-justified, padded by spaces - lcd_put_wchar(' '); // overwrite char if value gets shorter + const uint8_t valrow = (utf8_strlen_P(pstr) + 1 + len + 1) > (LCD_WIDTH - 2) ? 2 : 1; // Value on the next row if it won't fit + lcd_moveto((LCD_WIDTH - 1) - (len + 1), valrow); // Right-justified, padded by spaces + lcd_put_wchar(' '); // Overwrite char if value gets shorter lcd_put_u8str(value); } } #if ENABLED(SDSUPPORT) - static void lcd_implementation_drawmenu_sd(const bool sel, const uint8_t row, const char* const pstr, CardReader &theCard, const uint8_t concat, const char post_char) { + void draw_sd_menu_item(const bool sel, const uint8_t row, PGM_P const pstr, CardReader &theCard, const bool isDir) { UNUSED(pstr); - lcd_moveto(0, row); - lcd_put_wchar(sel ? '>' : ' '); - - uint8_t n = LCD_WIDTH - concat; - const char *outstr = theCard.longest_filename(); - if (theCard.longFilename[0]) { - #if ENABLED(SCROLL_LONG_FILENAMES) - if (sel) { - uint8_t name_hash = row; - for (uint8_t l = FILENAME_LENGTH; l--;) - name_hash = ((name_hash << 1) | (name_hash >> 7)) ^ theCard.filename[l]; // rotate, xor - if (filename_scroll_hash != name_hash) { // If the hash changed... - filename_scroll_hash = name_hash; // Save the new hash - filename_scroll_max = MAX(0, utf8_strlen(theCard.longFilename) - n); // Update the scroll limit - filename_scroll_pos = 0; // Reset scroll to the start - lcd_status_update_delay = 8; // Don't scroll right away - } - outstr += filename_scroll_pos; - } - #else - theCard.longFilename[n] = '\0'; // cutoff at screen edge - #endif - } lcd_moveto(0, row); - lcd_put_wchar(sel ? '>' : ' '); - n -= lcd_put_u8str_max(outstr, n); - - while (n) { --n; lcd_put_wchar(' '); } - lcd_put_wchar(post_char); - } - - static void lcd_implementation_drawmenu_sdfile(const bool sel, const uint8_t row, const char* pstr, CardReader &theCard) { - lcd_implementation_drawmenu_sd(sel, row, pstr, theCard, 2, ' '); - } - - static void lcd_implementation_drawmenu_sddirectory(const bool sel, const uint8_t row, const char* pstr, CardReader &theCard) { - lcd_implementation_drawmenu_sd(sel, row, pstr, theCard, 2, LCD_STR_FOLDER[0]); + lcd_put_wchar(sel ? LCD_STR_ARROW_RIGHT[0] : ' '); + constexpr uint8_t maxlen = LCD_WIDTH - 2; + uint8_t n = maxlen - lcd_put_u8str_max(ui.scrolled_filename(theCard, maxlen, row, sel), maxlen); + for (; n; --n) lcd_put_wchar(' '); + lcd_put_wchar(isDir ? LCD_STR_FOLDER[0] : ' '); } #endif // SDSUPPORT - #define lcd_implementation_drawmenu_back(sel, row, pstr, dummy) lcd_implementation_drawmenu_generic(sel, row, pstr, LCD_UPLEVEL_CHAR, LCD_UPLEVEL_CHAR) - #define lcd_implementation_drawmenu_submenu(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', LCD_STR_ARROW_RIGHT[0]) - #define lcd_implementation_drawmenu_gcode(sel, row, pstr, gcode) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ') - #define lcd_implementation_drawmenu_function(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ') - - #if ENABLED(LCD_HAS_SLOW_BUTTONS) - - extern millis_t next_button_update_ms; - - static uint8_t lcd_implementation_read_slow_buttons() { - #if ENABLED(LCD_I2C_TYPE_MCP23017) - // Reading these buttons this is likely to be too slow to call inside interrupt context - // so they are called during normal lcd_update - uint8_t slow_bits = lcd.readButtons() << B_I2C_BTN_OFFSET; - #if ENABLED(LCD_I2C_VIKI) - if ((slow_bits & (B_MI | B_RI)) && PENDING(millis(), next_button_update_ms)) // LCD clicked - slow_bits &= ~(B_MI | B_RI); // Disable LCD clicked buttons if screen is updated - #endif // LCD_I2C_VIKI - return slow_bits; - #endif // LCD_I2C_TYPE_MCP23017 - } - - #endif // LCD_HAS_SLOW_BUTTONS - #if ENABLED(LCD_HAS_STATUS_INDICATORS) - static void lcd_implementation_update_indicators() { + static void MarlinUI::update_indicators() { // Set the LEDS - referred to as backlights by the LiquidTWI2 library static uint8_t ledsprev = 0; uint8_t leds = 0; @@ -1008,13 +1049,13 @@ static void lcd_implementation_status_screen() { #if FAN_COUNT > 0 if (0 #if HAS_FAN0 - || fanSpeeds[0] + || fan_speed[0] #endif #if HAS_FAN1 - || fanSpeeds[1] + || fan_speed[1] #endif #if HAS_FAN2 - || fanSpeeds[2] + || fan_speed[2] #endif ) leds |= LED_C; #endif // FAN_COUNT > 0 @@ -1033,69 +1074,73 @@ static void lcd_implementation_status_screen() { #if ENABLED(AUTO_BED_LEVELING_UBL) + #define HD44780_CHAR_WIDTH 5 + #define HD44780_CHAR_HEIGHT 8 + #define MESH_MAP_COLS 7 + #define MESH_MAP_ROWS 4 + + #define CHAR_LINE_TOP 0 + #define CHAR_LINE_BOT 1 + #define CHAR_EDGE_L 2 + #define CHAR_EDGE_R 3 + #define CHAR_UL_UL 4 + #define CHAR_LR_UL 5 + #define CHAR_UL_LR 6 + #define CHAR_LR_LR 7 + + #define TOP_LEFT _BV(0) + #define TOP_RIGHT _BV(1) + #define LOWER_LEFT _BV(2) + #define LOWER_RIGHT _BV(3) + /** - Possible map screens: - - 16x2 |X000.00 Y000.00| - |(00,00) Z00.000| - - 20x2 | X:000.00 Y:000.00 | - | (00,00) Z:00.000 | - - 16x4 |+-------+(00,00)| - || |X000.00| - || |Y000.00| - |+-------+Z00.000| - - 20x4 | +-------+ (00,00) | - | | | X:000.00| - | | | Y:000.00| - | +-------+ Z:00.000| - */ + * Possible map screens: + * + * 16x2 |X000.00 Y000.00| + * |(00,00) Z00.000| + * + * 20x2 | X:000.00 Y:000.00 | + * | (00,00) Z:00.000 | + * + * 16x4 |+-------+(00,00)| + * || |X000.00| + * || |Y000.00| + * |+-------+Z00.000| + * + * 20x4 | +-------+ (00,00) | + * | | | X:000.00| + * | | | Y:000.00| + * | +-------+ Z:00.000| + */ typedef struct { - uint8_t custom_char_bits[ULTRA_Y_PIXELS_PER_CHAR]; + uint8_t custom_char_bits[HD44780_CHAR_HEIGHT]; } custom_char; typedef struct { - uint8_t column, row; - uint8_t y_pixel_offset, x_pixel_offset; - uint8_t x_pixel_mask; + uint8_t column, row, + x_pixel_offset, y_pixel_offset, + x_pixel_mask; } coordinate; - void add_edges_to_custom_char(custom_char * const custom, coordinate * const ul, coordinate * const lr, coordinate * const brc, const uint8_t cell_location); + void add_edges_to_custom_char(custom_char &custom, const coordinate &ul, const coordinate &lr, const coordinate &brc, const uint8_t cell_location); FORCE_INLINE static void clear_custom_char(custom_char * const cc) { ZERO(cc->custom_char_bits); } - /* - // This debug routine should be deleted by anybody that sees it. It doesn't belong here - // But I'm leaving it for now until we know the 20x4 Radar Map is working right. - // We may need it again if any funny lines show up on the mesh points. - void dump_custom_char(char *title, custom_char *c) { - SERIAL_PROTOCOLLN(title); - for (uint8_t j = 0; j < 8; j++) { - for (uint8_t i = 7; i >= 0; i--) - SERIAL_PROTOCOLCHAR(TEST(c->custom_char_bits[j], i) ? '1' : '0'); - SERIAL_EOL(); - } - SERIAL_EOL(); - } - //*/ - coordinate pixel_location(int16_t x, int16_t y) { coordinate ret_val; int16_t xp, yp, r, c; x++; y++; // +1 because lines on the left and top - c = x / (ULTRA_X_PIXELS_PER_CHAR); - r = y / (ULTRA_Y_PIXELS_PER_CHAR); + c = x / (HD44780_CHAR_WIDTH); + r = y / (HD44780_CHAR_HEIGHT); ret_val.column = c; ret_val.row = r; - xp = x - c * (ULTRA_X_PIXELS_PER_CHAR); // get the pixel offsets into the character cell - xp = ULTRA_X_PIXELS_PER_CHAR - 1 - xp; // column within relevant character cell (0 on the right) - yp = y - r * (ULTRA_Y_PIXELS_PER_CHAR); + xp = x - c * (HD44780_CHAR_WIDTH); // Get the pixel offsets into the character cell + xp = HD44780_CHAR_WIDTH - 1 - xp; // Column within relevant character cell (0 on the right) + yp = y - r * (HD44780_CHAR_HEIGHT); ret_val.x_pixel_mask = _BV(xp); ret_val.x_pixel_offset = xp; @@ -1105,7 +1150,14 @@ static void lcd_implementation_status_screen() { inline coordinate pixel_location(const uint8_t x, const uint8_t y) { return pixel_location((int16_t)x, (int16_t)y); } - void lcd_implementation_ubl_plot(const uint8_t x, const uint8_t inverted_y) { + void prep_and_put_map_char(custom_char &chrdata, const coordinate &ul, const coordinate &lr, const coordinate &brc, const uint8_t cl, const char c, const uint8_t x, const uint8_t y) { + add_edges_to_custom_char(chrdata, ul, lr, brc, cl); + lcd.createChar(c, (uint8_t*)&chrdata); + lcd_moveto(x, y); + lcd_put_wchar(c); + } + + void MarlinUI::ubl_plot(const uint8_t x, const uint8_t inverted_y) { #if LCD_WIDTH >= 20 #define _LCD_W_POS 12 @@ -1155,46 +1207,45 @@ static void lcd_implementation_status_screen() { lower_right.column = 0; lower_right.row = 0; - lcd_implementation_clear(); + clear_lcd(); - x_map_pixels = (ULTRA_X_PIXELS_PER_CHAR) * (ULTRA_COLUMNS_FOR_MESH_MAP) - 2; // minus 2 because we are drawing a box around the map - y_map_pixels = (ULTRA_Y_PIXELS_PER_CHAR) * (ULTRA_ROWS_FOR_MESH_MAP) - 2; + x_map_pixels = (HD44780_CHAR_WIDTH) * (MESH_MAP_COLS) - 2; // Minus 2 because we are drawing a box around the map + y_map_pixels = (HD44780_CHAR_HEIGHT) * (MESH_MAP_ROWS) - 2; pixels_per_x_mesh_pnt = x_map_pixels / (GRID_MAX_POINTS_X); pixels_per_y_mesh_pnt = y_map_pixels / (GRID_MAX_POINTS_Y); - if (pixels_per_x_mesh_pnt >= ULTRA_X_PIXELS_PER_CHAR) { // There are only 2 custom characters available, so the X - pixels_per_x_mesh_pnt = ULTRA_X_PIXELS_PER_CHAR; // size of the mesh point needs to fit within them independent - suppress_x_offset = 1; // of where the starting pixel is located. + if (pixels_per_x_mesh_pnt >= HD44780_CHAR_WIDTH) { // There are only 2 custom characters available, so the X + pixels_per_x_mesh_pnt = HD44780_CHAR_WIDTH; // Size of the mesh point needs to fit within them independent + suppress_x_offset = 1; // Of where the starting pixel is located. } - if (pixels_per_y_mesh_pnt >= ULTRA_Y_PIXELS_PER_CHAR) { // There are only 2 custom characters available, so the Y - pixels_per_y_mesh_pnt = ULTRA_Y_PIXELS_PER_CHAR; // size of the mesh point needs to fit within them independent - suppress_y_offset = 1; // of where the starting pixel is located. + if (pixels_per_y_mesh_pnt >= HD44780_CHAR_HEIGHT) { // There are only 2 custom characters available, so the Y + pixels_per_y_mesh_pnt = HD44780_CHAR_HEIGHT; // Size of the mesh point needs to fit within them independent + suppress_y_offset = 1; // Of where the starting pixel is located. } - x_map_pixels = pixels_per_x_mesh_pnt * (GRID_MAX_POINTS_X); // now we have the right number of pixels to make both - y_map_pixels = pixels_per_y_mesh_pnt * (GRID_MAX_POINTS_Y); // directions fit nicely + x_map_pixels = pixels_per_x_mesh_pnt * (GRID_MAX_POINTS_X); // Now we have the right number of pixels to make both + y_map_pixels = pixels_per_y_mesh_pnt * (GRID_MAX_POINTS_Y); // Directions fit nicely - right_edge = pixels_per_x_mesh_pnt * (GRID_MAX_POINTS_X) + 1; // find location of right edge within the character cell - bottom_line= pixels_per_y_mesh_pnt * (GRID_MAX_POINTS_Y) + 1; // find location of bottome line within the character cell + right_edge = pixels_per_x_mesh_pnt * (GRID_MAX_POINTS_X) + 1; // Find location of right edge within the character cell + bottom_line = pixels_per_y_mesh_pnt * (GRID_MAX_POINTS_Y) + 1; // Find location of bottome line within the character cell - n_rows = bottom_line / (ULTRA_Y_PIXELS_PER_CHAR) + 1; - n_cols = right_edge / (ULTRA_X_PIXELS_PER_CHAR) + 1; + n_rows = bottom_line / (HD44780_CHAR_HEIGHT) + 1; + n_cols = right_edge / (HD44780_CHAR_WIDTH) + 1; for (i = 0; i < n_cols; i++) { lcd_moveto(i, 0); - lcd_put_wchar((char)0x00); // top line of the box - + lcd_put_wchar(CHAR_LINE_TOP); // Box Top line lcd_moveto(i, n_rows - 1); - lcd_put_wchar(0x01); // bottom line of the box + lcd_put_wchar(CHAR_LINE_BOT); // Box Bottom line } for (j = 0; j < n_rows; j++) { lcd_moveto(0, j); - lcd_put_wchar(0x02); // Left edge of the box + lcd_put_wchar(CHAR_EDGE_L); // Box Left edge lcd_moveto(n_cols - 1, j); - lcd_put_wchar(0x03); // right edge of the box + lcd_put_wchar(CHAR_EDGE_R); // Box Right edge } /** @@ -1202,36 +1253,36 @@ static void lcd_implementation_status_screen() { */ k = pixels_per_y_mesh_pnt * (GRID_MAX_POINTS_Y) + 2; - l = (ULTRA_Y_PIXELS_PER_CHAR) * n_rows; - if (l > k && l - k >= (ULTRA_Y_PIXELS_PER_CHAR) / 2) { - lcd_moveto(0, n_rows - 1); // left edge of the box + l = (HD44780_CHAR_HEIGHT) * n_rows; + if (l > k && l - k >= (HD44780_CHAR_HEIGHT) / 2) { + lcd_moveto(0, n_rows - 1); // Box Left edge lcd_put_wchar(' '); - lcd_moveto(n_cols - 1, n_rows - 1); // right edge of the box + lcd_moveto(n_cols - 1, n_rows - 1); // Box Right edge lcd_put_wchar(' '); } clear_custom_char(&new_char); - new_char.custom_char_bits[0] = 0b11111U; // char #0 is used for the top line of the box - lcd.createChar(0, (uint8_t*)&new_char); + new_char.custom_char_bits[0] = 0b11111U; // Char #0 is used for the box top line + lcd.createChar(CHAR_LINE_TOP, (uint8_t*)&new_char); clear_custom_char(&new_char); - k = (GRID_MAX_POINTS_Y) * pixels_per_y_mesh_pnt + 1; // row of pixels for the bottom box line - l = k % (ULTRA_Y_PIXELS_PER_CHAR); // row within relevant character cell - new_char.custom_char_bits[l] = 0b11111U; // char #1 is used for the bottom line of the box - lcd.createChar(1, (uint8_t*)&new_char); + k = (GRID_MAX_POINTS_Y) * pixels_per_y_mesh_pnt + 1; // Row of pixels for the bottom box line + l = k % (HD44780_CHAR_HEIGHT); // Row within relevant character cell + new_char.custom_char_bits[l] = 0b11111U; // Char #1 is used for the box bottom line + lcd.createChar(CHAR_LINE_BOT, (uint8_t*)&new_char); clear_custom_char(&new_char); - for (j = 0; j < ULTRA_Y_PIXELS_PER_CHAR; j++) - new_char.custom_char_bits[j] = 0b10000U; // char #2 is used for the left edge of the box - lcd.createChar(2, (uint8_t*)&new_char); + for (j = 0; j < HD44780_CHAR_HEIGHT; j++) + new_char.custom_char_bits[j] = 0b10000U; // Char #2 is used for the box left edge + lcd.createChar(CHAR_EDGE_L, (uint8_t*)&new_char); clear_custom_char(&new_char); - m = (GRID_MAX_POINTS_X) * pixels_per_x_mesh_pnt + 1; // Column of pixels for the right box line - n = m % (ULTRA_X_PIXELS_PER_CHAR); // Column within relevant character cell - i = ULTRA_X_PIXELS_PER_CHAR - 1 - n; // Column within relevant character cell (0 on the right) - for (j = 0; j < ULTRA_Y_PIXELS_PER_CHAR; j++) - new_char.custom_char_bits[j] = (uint8_t)_BV(i); // Char #3 is used for the right edge of the box - lcd.createChar(3, (uint8_t*)&new_char); + m = (GRID_MAX_POINTS_X) * pixels_per_x_mesh_pnt + 1; // Column of pixels for the right box line + n = m % (HD44780_CHAR_WIDTH); // Column within relevant character cell + i = HD44780_CHAR_WIDTH - 1 - n; // Column within relevant character cell (0 on the right) + for (j = 0; j < HD44780_CHAR_HEIGHT; j++) + new_char.custom_char_bits[j] = (uint8_t)_BV(i); // Char #3 is used for the box right edge + lcd.createChar(CHAR_EDGE_R, (uint8_t*)&new_char); i = x * pixels_per_x_mesh_pnt - suppress_x_offset; j = y * pixels_per_y_mesh_pnt - suppress_y_offset; @@ -1249,10 +1300,8 @@ static void lcd_implementation_status_screen() { * and deal with that next. */ - //dump_custom_char("at entry:", &new_char); - clear_custom_char(&new_char); - const uint8_t ypix = MIN(upper_left.y_pixel_offset + pixels_per_y_mesh_pnt, ULTRA_Y_PIXELS_PER_CHAR); + const uint8_t ypix = MIN(upper_left.y_pixel_offset + pixels_per_y_mesh_pnt, HD44780_CHAR_HEIGHT); for (j = upper_left.y_pixel_offset; j < ypix; j++) { i = upper_left.x_pixel_mask; for (k = 0; k < pixels_per_x_mesh_pnt; k++) { @@ -1260,15 +1309,8 @@ static void lcd_implementation_status_screen() { i >>= 1; } } - //dump_custom_char("after loops:", &new_char); - add_edges_to_custom_char(&new_char, &upper_left, &lower_right, &bottom_right_corner, TOP_LEFT); - //dump_custom_char("after add edges", &new_char); - lcd.createChar(4, (uint8_t*)&new_char); - - lcd_moveto(upper_left.column, upper_left.row); - lcd_put_wchar(0x04); - //dump_custom_char("after lcd update:", &new_char); + prep_and_put_map_char(new_char, upper_left, lower_right, bottom_right_corner, TOP_LEFT, CHAR_UL_UL, upper_left.column, upper_left.row); /** * Next, check for two side by side character cells being used to display the Mesh Point @@ -1278,39 +1320,30 @@ static void lcd_implementation_status_screen() { l = upper_left.x_pixel_offset; clear_custom_char(&new_char); for (j = upper_left.y_pixel_offset; j < ypix; j++) { - i = _BV(ULTRA_X_PIXELS_PER_CHAR - 1); // Fill in the left side of the right character cell + i = _BV(HD44780_CHAR_WIDTH - 1); // Fill in the left side of the right character cell for (k = 0; k < pixels_per_x_mesh_pnt - 1 - l; k++) { new_char.custom_char_bits[j] |= i; i >>= 1; } } - add_edges_to_custom_char(&new_char, &upper_left, &lower_right, &bottom_right_corner, TOP_RIGHT); - - lcd.createChar(5, (uint8_t *) &new_char); - - lcd_moveto(lower_right.column, upper_left.row); - lcd_put_wchar(0x05); + prep_and_put_map_char(new_char, upper_left, lower_right, bottom_right_corner, TOP_RIGHT, CHAR_LR_UL, lower_right.column, upper_left.row); } /** * Next, check for two character cells stacked on top of each other being used to display the Mesh Point */ if (upper_left.row == lower_right.row - 1) { - l = ULTRA_Y_PIXELS_PER_CHAR - upper_left.y_pixel_offset; // Number of pixel rows in top character cell - k = pixels_per_y_mesh_pnt - l; // Number of pixel rows in bottom character cell + l = HD44780_CHAR_HEIGHT - upper_left.y_pixel_offset; // Number of pixel rows in top character cell + k = pixels_per_y_mesh_pnt - l; // Number of pixel rows in bottom character cell clear_custom_char(&new_char); for (j = 0; j < k; j++) { i = upper_left.x_pixel_mask; - for (m = 0; m < pixels_per_x_mesh_pnt; m++) { // Fill in the top side of the bottom character cell + for (m = 0; m < pixels_per_x_mesh_pnt; m++) { // Fill in the top side of the bottom character cell new_char.custom_char_bits[j] |= i; if (!(i >>= 1)) break; } } - add_edges_to_custom_char(&new_char, &upper_left, &lower_right, &bottom_right_corner, LOWER_LEFT); - lcd.createChar(6, (uint8_t *) &new_char); - - lcd_moveto(upper_left.column, lower_right.row); - lcd_put_wchar(0x06); + prep_and_put_map_char(new_char, upper_left, lower_right, bottom_right_corner, LOWER_LEFT, CHAR_UL_LR, upper_left.column, lower_right.row); } /** @@ -1320,22 +1353,18 @@ static void lcd_implementation_status_screen() { */ if (upper_left.column == lower_right.column - 1 && upper_left.row == lower_right.row - 1) { - l = ULTRA_Y_PIXELS_PER_CHAR - upper_left.y_pixel_offset; // Number of pixel rows in top character cell - k = pixels_per_y_mesh_pnt - l; // Number of pixel rows in bottom character cell + l = HD44780_CHAR_HEIGHT - upper_left.y_pixel_offset; // Number of pixel rows in top character cell + k = pixels_per_y_mesh_pnt - l; // Number of pixel rows in bottom character cell clear_custom_char(&new_char); for (j = 0; j < k; j++) { l = upper_left.x_pixel_offset; - i = _BV(ULTRA_X_PIXELS_PER_CHAR - 1); // Fill in the left side of the right character cell - for (m = 0; m < pixels_per_x_mesh_pnt - 1 - l; m++) { // Fill in the top side of the bottom character cell + i = _BV(HD44780_CHAR_WIDTH - 1); // Fill in the left side of the right character cell + for (m = 0; m < pixels_per_x_mesh_pnt - 1 - l; m++) { // Fill in the top side of the bottom character cell new_char.custom_char_bits[j] |= i; i >>= 1; } } - add_edges_to_custom_char(&new_char, &upper_left, &lower_right, &bottom_right_corner, LOWER_RIGHT); - lcd.createChar(7, (uint8_t*)&new_char); - - lcd_moveto(lower_right.column, lower_right.row); - lcd_put_wchar(0x07); + prep_and_put_map_char(new_char, upper_left, lower_right, bottom_right_corner, LOWER_RIGHT, CHAR_LR_LR, lower_right.column, lower_right.row); } #endif @@ -1383,38 +1412,39 @@ static void lcd_implementation_status_screen() { #endif // LCD_HEIGHT > 3 } - void add_edges_to_custom_char(custom_char * const custom, coordinate * const ul, coordinate * const lr, coordinate * const brc, uint8_t cell_location) { + void add_edges_to_custom_char(custom_char &custom, const coordinate &ul, const coordinate &lr, const coordinate &brc, const uint8_t cell_location) { uint8_t i, k; - int16_t n_rows = lr->row - ul->row + 1, - n_cols = lr->column - ul->column + 1; + int16_t n_rows = lr.row - ul.row + 1, + n_cols = lr.column - ul.column + 1; /** * Check if Top line of box needs to be filled in */ - if (ul->row == 0 && ((cell_location & TOP_LEFT) || (cell_location & TOP_RIGHT))) { // Only fill in the top line for the top character cells + + if (ul.row == 0 && (cell_location & (TOP_LEFT|TOP_RIGHT))) { // Only fill in the top line for the top character cells if (n_cols == 1) { - if (ul->column != brc->column) - custom->custom_char_bits[0] = 0xFF; // Single column in middle + if (ul.column != brc.column) + custom.custom_char_bits[0] = 0xFF; // Single column in middle else - for (i = brc->x_pixel_offset; i < ULTRA_X_PIXELS_PER_CHAR; i++) // Single column on right side - SBI(custom->custom_char_bits[0], i); + for (i = brc.x_pixel_offset; i < HD44780_CHAR_WIDTH; i++) // Single column on right side + SBI(custom.custom_char_bits[0], i); } - else if ((cell_location & TOP_LEFT) || lr->column != brc->column) // Multiple column in the middle or with right cell in middle - custom->custom_char_bits[0] = 0xFF; + else if ((cell_location & TOP_LEFT) || lr.column != brc.column) // Multiple column in the middle or with right cell in middle + custom.custom_char_bits[0] = 0xFF; else - for (i = brc->x_pixel_offset; i < ULTRA_X_PIXELS_PER_CHAR; i++) - SBI(custom->custom_char_bits[0], i); + for (i = brc.x_pixel_offset; i < HD44780_CHAR_WIDTH; i++) + SBI(custom.custom_char_bits[0], i); } /** * Check if left line of box needs to be filled in */ - if ((cell_location & TOP_LEFT) || (cell_location & LOWER_LEFT)) { - if (ul->column == 0) { // Left column of characters on LCD Display - k = ul->row == brc->row ? brc->y_pixel_offset : ULTRA_Y_PIXELS_PER_CHAR; // If it isn't the last row... do the full character cell + if (cell_location & (TOP_LEFT|LOWER_LEFT)) { + if (ul.column == 0) { // Left column of characters on LCD Display + k = ul.row == brc.row ? brc.y_pixel_offset : HD44780_CHAR_HEIGHT; // If it isn't the last row... do the full character cell for (i = 0; i < k; i++) - SBI(custom->custom_char_bits[i], ULTRA_X_PIXELS_PER_CHAR - 1); + SBI(custom.custom_char_bits[i], HD44780_CHAR_WIDTH - 1); } } @@ -1423,30 +1453,30 @@ static void lcd_implementation_status_screen() { */ // Single row of mesh plot cells - if (n_rows == 1 /* && (cell_location == TOP_LEFT || cell_location == TOP_RIGHT) */ && ul->row == brc->row) { + if (n_rows == 1 /* && (cell_location & (TOP_LEFT|TOP_RIGHT)) */ && ul.row == brc.row) { if (n_cols == 1) // Single row, single column case - k = ul->column == brc->column ? brc->x_pixel_mask : 0x01; + k = ul.column == brc.column ? brc.x_pixel_mask : 0x01; else if (cell_location & TOP_RIGHT) // Single row, multiple column case - k = lr->column == brc->column ? brc->x_pixel_mask : 0x01; + k = lr.column == brc.column ? brc.x_pixel_mask : 0x01; else // Single row, left of multiple columns k = 0x01; - while (k < _BV(ULTRA_X_PIXELS_PER_CHAR)) { - custom->custom_char_bits[brc->y_pixel_offset] |= k; + while (k < _BV(HD44780_CHAR_WIDTH)) { + custom.custom_char_bits[brc.y_pixel_offset] |= k; k <<= 1; } } // Double row of characters on LCD Display // And this is a bottom custom character - if (n_rows == 2 && (cell_location == LOWER_LEFT || cell_location == LOWER_RIGHT) && lr->row == brc->row) { - if (n_cols == 1) // Double row, single column case - k = ul->column == brc->column ? brc->x_pixel_mask : 0x01; - else if (cell_location & LOWER_RIGHT) // Double row, multiple column case - k = lr->column == brc->column ? brc->x_pixel_mask : 0x01; - else // Double row, left of multiple columns + if (n_rows == 2 && (cell_location & (LOWER_LEFT|LOWER_RIGHT)) && lr.row == brc.row) { + if (n_cols == 1) // Double row, single column case + k = ul.column == brc.column ? brc.x_pixel_mask : 0x01; + else if (cell_location & LOWER_RIGHT) // Double row, multiple column case + k = lr.column == brc.column ? brc.x_pixel_mask : 0x01; + else // Double row, left of multiple columns k = 0x01; - while (k < _BV(ULTRA_X_PIXELS_PER_CHAR)) { - custom->custom_char_bits[brc->y_pixel_offset] |= k; + while (k < _BV(HD44780_CHAR_WIDTH)) { + custom.custom_char_bits[brc.y_pixel_offset] |= k; k <<= 1; } } @@ -1454,19 +1484,20 @@ static void lcd_implementation_status_screen() { /** * Check if right line of box needs to be filled in */ + // Nothing to do if the lower right part of the mesh pnt isn't in the same column as the box line - if (lr->column == brc->column) { + if (lr.column == brc.column) { // This mesh point is in the same character cell as the right box line - if (ul->column == brc->column || (cell_location & TOP_RIGHT) || (cell_location & LOWER_RIGHT)) { + if (ul.column == brc.column || (cell_location & (TOP_RIGHT|LOWER_RIGHT))) { // If not the last row... do the full character cell - k = ul->row == brc->row ? brc->y_pixel_offset : ULTRA_Y_PIXELS_PER_CHAR; - for (i = 0; i < k; i++) custom->custom_char_bits[i] |= brc->x_pixel_mask; + k = ul.row == brc.row ? brc.y_pixel_offset : HD44780_CHAR_HEIGHT; + for (i = 0; i < k; i++) custom.custom_char_bits[i] |= brc.x_pixel_mask; } } } #endif // AUTO_BED_LEVELING_UBL -#endif // ULTIPANEL +#endif // HAS_LCD_MENU -#endif // ULTRALCD_IMPL_HD44780_H +#endif // HAS_CHARACTER_LCD diff --git a/Marlin/src/lcd/HD44780/ultralcd_HD44780.h b/Marlin/src/lcd/HD44780/ultralcd_HD44780.h new file mode 100644 index 0000000000..9829619f54 --- /dev/null +++ b/Marlin/src/lcd/HD44780/ultralcd_HD44780.h @@ -0,0 +1,101 @@ +/** + * 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 . + * + */ +#pragma once + +/** + * Implementation of the LCD display routines for a Hitachi HD44780 display. + * These are the most common LCD character displays. + */ + +#include "../../inc/MarlinConfig.h" + +#if LCD_HEIGHT > 3 + #include "../../libs/duration_t.h" +#endif + +//////////////////////////////////// +// Setup button and encode mappings for each panel (into 'buttons' variable +// +// This is just to map common functions (across different panels) onto the same +// macro name. The mapping is independent of whether the button is directly connected or +// via a shift/i2c register. + +//////////////////////////////////// +// Create LCD class instance and chipset-specific information +#if ENABLED(LCD_I2C_TYPE_PCF8575) + // NOTE: These are register-mapped pins on the PCF8575 controller, not Arduino pins. + #define LCD_I2C_PIN_BL 3 + #define LCD_I2C_PIN_EN 2 + #define LCD_I2C_PIN_RW 1 + #define LCD_I2C_PIN_RS 0 + #define LCD_I2C_PIN_D4 4 + #define LCD_I2C_PIN_D5 5 + #define LCD_I2C_PIN_D6 6 + #define LCD_I2C_PIN_D7 7 + + #include + #include + #include + #define LCD_CLASS LiquidCrystal_I2C + +#elif ENABLED(LCD_I2C_TYPE_MCP23017) + // For the LED indicators (which may be mapped to different events in update_indicators()) + #define LCD_HAS_STATUS_INDICATORS + #define LED_A 0x04 //100 + #define LED_B 0x02 //010 + #define LED_C 0x01 //001 + + #include + #include + #define LCD_CLASS LiquidTWI2 + +#elif ENABLED(LCD_I2C_TYPE_MCP23008) + #include + #include + #define LCD_CLASS LiquidTWI2 + +#elif ENABLED(LCD_I2C_TYPE_PCA8574) + #include + #define LCD_CLASS LiquidCrystal_I2C + +#elif ENABLED(SR_LCD_2W_NL) + // 2 wire Non-latching LCD SR from: + // https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection + extern "C" void __cxa_pure_virtual() { while (1); } + #include + #include + #define LCD_CLASS LiquidCrystal_SR + +#elif ENABLED(LCM1602) + #include + #include + #include + #define LCD_CLASS LiquidCrystal_I2C + +#else + // Standard directly connected LCD implementations + #include + #define LCD_CLASS LiquidCrystal +#endif + +#include "../fontutils.h" +#include "../lcdprint.h" diff --git a/Marlin/src/lcd/dogm/HAL_LCD_class_defines.h b/Marlin/src/lcd/dogm/HAL_LCD_class_defines.h index 4b860a1f6e..e1a2ea9806 100644 --- a/Marlin/src/lcd/dogm/HAL_LCD_class_defines.h +++ b/Marlin/src/lcd/dogm/HAL_LCD_class_defines.h @@ -19,63 +19,65 @@ * along with this program. If not, see . * */ +#pragma once +#include "../../inc/MarlinConfig.h" // use this file to create the public interface for device drivers that are NOT in the U8G library extern u8g_dev_t u8g_dev_st7565_64128n_HAL_2x_sw_spi; extern u8g_dev_t u8g_dev_st7565_64128n_HAL_2x_hw_spi; -class U8GLIB_64128N_2X_HAL : public U8GLIB -{ - public: - U8GLIB_64128N_2X_HAL(pin_t sck, pin_t mosi, pin_t cs, pin_t a0, pin_t reset = U8G_PIN_NONE) - : U8GLIB(&u8g_dev_st7565_64128n_HAL_2x_sw_spi, (uint8_t)sck, (uint8_t)mosi, (uint8_t)cs, (uint8_t)a0, (uint8_t)reset) - { } - U8GLIB_64128N_2X_HAL(pin_t cs, pin_t a0, pin_t reset = U8G_PIN_NONE) - : U8GLIB(&u8g_dev_st7565_64128n_HAL_2x_hw_spi, (uint8_t)cs, (uint8_t)a0, (uint8_t)reset) - { } -}; +class U8GLIB_64128N_2X_HAL : public U8GLIB { +public: + U8GLIB_64128N_2X_HAL(pin_t sck, pin_t mosi, pin_t cs, pin_t a0, pin_t reset = U8G_PIN_NONE) + : U8GLIB(&u8g_dev_st7565_64128n_HAL_2x_sw_spi, (uint8_t)sck, (uint8_t)mosi, (uint8_t)cs, (uint8_t)a0, (uint8_t)reset) + { } + U8GLIB_64128N_2X_HAL(pin_t cs, pin_t a0, pin_t reset = U8G_PIN_NONE) + : U8GLIB(&u8g_dev_st7565_64128n_HAL_2x_hw_spi, (uint8_t)cs, (uint8_t)a0, (uint8_t)reset) + { } +}; extern u8g_dev_t u8g_dev_st7920_128x64_HAL_4x_sw_spi; extern u8g_dev_t u8g_dev_st7920_128x64_HAL_4x_hw_spi; -class U8GLIB_ST7920_128X64_4X_HAL : public U8GLIB -{ - public: - U8GLIB_ST7920_128X64_4X_HAL(pin_t sck, pin_t mosi, pin_t cs, pin_t reset = U8G_PIN_NONE) - : U8GLIB(&u8g_dev_st7920_128x64_HAL_4x_sw_spi, (uint8_t)sck, (uint8_t)mosi, (uint8_t)cs, U8G_PIN_NONE, (uint8_t)reset) // a0 = U8G_PIN_NONE - { } - U8GLIB_ST7920_128X64_4X_HAL(pin_t cs, pin_t reset = U8G_PIN_NONE) - : U8GLIB(&u8g_dev_st7920_128x64_HAL_4x_hw_spi, (uint8_t)cs, U8G_PIN_NONE, (uint8_t)reset) // a0 = U8G_PIN_NONE - { } + +class U8GLIB_ST7920_128X64_4X_HAL : public U8GLIB { +public: + U8GLIB_ST7920_128X64_4X_HAL(pin_t sck, pin_t mosi, pin_t cs, pin_t reset = U8G_PIN_NONE) + : U8GLIB(&u8g_dev_st7920_128x64_HAL_4x_sw_spi, (uint8_t)sck, (uint8_t)mosi, (uint8_t)cs, U8G_PIN_NONE, (uint8_t)reset) // a0 = U8G_PIN_NONE + { } + U8GLIB_ST7920_128X64_4X_HAL(pin_t cs, pin_t reset = U8G_PIN_NONE) + : U8GLIB(&u8g_dev_st7920_128x64_HAL_4x_hw_spi, (uint8_t)cs, U8G_PIN_NONE, (uint8_t)reset) // a0 = U8G_PIN_NONE + { } }; - -// AVR version uses ultralcd_st7920_u8glib_rrd_AVR.cpp, HAL version uses u8g_dev_st7920_128x64_HAL.cpp +// +// AVR version uses ultralcd_st7920_u8glib_rrd_AVR.cpp +// HAL version uses u8g_dev_st7920_128x64_HAL.cpp +// extern u8g_dev_t u8g_dev_st7920_128x64_rrd_sw_spi; -class U8GLIB_ST7920_128X64_RRD : public U8GLIB -{ - public: - U8GLIB_ST7920_128X64_RRD(pin_t sck, pin_t mosi, pin_t cs, pin_t reset = U8G_PIN_NONE) - : U8GLIB(&u8g_dev_st7920_128x64_rrd_sw_spi, (uint8_t)sck, (uint8_t)mosi, (uint8_t)cs, U8G_PIN_NONE, (uint8_t)reset) // a0 = U8G_PIN_NONE - { } -}; +class U8GLIB_ST7920_128X64_RRD : public U8GLIB { +public: + U8GLIB_ST7920_128X64_RRD(pin_t sck, pin_t mosi, pin_t cs, pin_t reset = U8G_PIN_NONE) + : U8GLIB(&u8g_dev_st7920_128x64_rrd_sw_spi, (uint8_t)sck, (uint8_t)mosi, (uint8_t)cs, U8G_PIN_NONE, (uint8_t)reset) // a0 = U8G_PIN_NONE + { } +}; extern u8g_dev_t u8g_dev_sh1106_128x64_2x_i2c_2_wire; + class U8GLIB_SH1106_128X64_2X_I2C_2_WIRE : public U8GLIB { - public: - U8GLIB_SH1106_128X64_2X_I2C_2_WIRE(uint8_t options = U8G_I2C_OPT_NONE) - : U8GLIB(&u8g_dev_sh1106_128x64_2x_i2c_2_wire, options) - { } +public: + U8GLIB_SH1106_128X64_2X_I2C_2_WIRE(uint8_t options = U8G_I2C_OPT_NONE) + : U8GLIB(&u8g_dev_sh1106_128x64_2x_i2c_2_wire, options) + { } }; - - extern u8g_dev_t u8g_dev_ssd1306_128x64_2x_i2c_2_wire; + class U8GLIB_SSD1306_128X64_2X_I2C_2_WIRE : public U8GLIB { - public: - U8GLIB_SSD1306_128X64_2X_I2C_2_WIRE(uint8_t options = U8G_I2C_OPT_NONE) - : U8GLIB(&u8g_dev_ssd1306_128x64_2x_i2c_2_wire, options) - { } +public: + U8GLIB_SSD1306_128X64_2X_I2C_2_WIRE(uint8_t options = U8G_I2C_OPT_NONE) + : U8GLIB(&u8g_dev_ssd1306_128x64_2x_i2c_2_wire, options) + { } }; diff --git a/Marlin/src/lcd/dogm/HAL_LCD_com_defines.h b/Marlin/src/lcd/dogm/HAL_LCD_com_defines.h index 1f3c280421..7095307ceb 100644 --- a/Marlin/src/lcd/dogm/HAL_LCD_com_defines.h +++ b/Marlin/src/lcd/dogm/HAL_LCD_com_defines.h @@ -20,8 +20,7 @@ * */ -// use this file to select the com driver for device drivers that are NOT in the U8G library - +// Use this file to select the com driver for device drivers that are NOT in the U8G library #ifndef U8G_HAL_LINKS @@ -71,4 +70,4 @@ #define U8G_COM_ST7920_HAL_SW_SPI u8g_com_null_fn #define U8G_COM_ST7920_HAL_HW_SPI u8g_com_null_fn #define U8G_COM_SSD_I2C_HAL u8g_com_null_fn -#endif \ No newline at end of file +#endif diff --git a/Marlin/src/lcd/dogm/dogm_Bootscreen.h b/Marlin/src/lcd/dogm/dogm_Bootscreen.h new file mode 100644 index 0000000000..efb299b359 --- /dev/null +++ b/Marlin/src/lcd/dogm/dogm_Bootscreen.h @@ -0,0 +1,137 @@ +/** + * 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 . + * + */ + +/** + * Standard Marlin Boot Screen bitmaps + * + * Use the Marlin Bitmap Converter to make your own: + * http://marlinfw.org/tools/u8glib/converter.html + */ + +#include + +#include "../../inc/MarlinConfig.h" + +#if ENABLED(SHOW_BOOTSCREEN) + + //#define START_BMPHIGH // Costs 399 bytes more flash + + #if ENABLED(SHOW_CUSTOM_BOOTSCREEN) + + #include "../../../_Bootscreen.h" + + #ifndef CUSTOM_BOOTSCREEN_TIMEOUT + #define CUSTOM_BOOTSCREEN_TIMEOUT 2500 + #endif + + #endif + + #if ENABLED(START_BMPHIGH) + + #define START_BMPWIDTH 112 + + const unsigned char start_bmp[] PROGMEM = { + B00000001,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111, + B00001111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111, + B00011110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11111111,B11111111, + B00111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,B11111111,B11111111, + B01110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111111,B11111111, + B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11111111, + B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111111,B11111111, + B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111000,B00000000,B00000000,B00111111,B11111111, + B11000000,B00001111,B11000000,B11111100,B00000000,B00000000,B00000000,B00000000,B00000000,B01111000,B00011000,B00000000,B00011111,B11111111, + B11000000,B00111111,B11100001,B11111111,B00000000,B00000000,B00000000,B00000000,B00000000,B01111000,B00111100,B00000000,B00001111,B11111111, + B11000000,B01111111,B11110011,B11111111,B10000000,B00000000,B00000000,B00000000,B00000000,B01111000,B00111100,B00000000,B00000111,B11111111, + B11000000,B11111111,B11111111,B11111111,B11000000,B00000000,B00000000,B00000000,B00000000,B01111000,B00111100,B00000000,B00000011,B11111111, + B11000001,B11111000,B01111111,B10000111,B11100000,B00000000,B00000000,B00000000,B00000000,B01111000,B00000000,B00000000,B00000001,B11111111, + B11000001,B11110000,B00111111,B00000011,B11100000,B00000000,B00000000,B00000000,B00000000,B01111000,B00000000,B00000000,B00000000,B11111111, + B11000001,B11100000,B00011110,B00000001,B11100000,B00011111,B00000000,B00000011,B11100000,B01111000,B00111100,B00000011,B11110000,B01111111, + B11000001,B11100000,B00011110,B00000001,B11100000,B01111111,B11000000,B00001111,B11111000,B01111000,B00111100,B00000111,B11111100,B00111111, + B11000001,B11100000,B00011110,B00000001,B11100001,B11111111,B11100000,B00011111,B11111100,B01111000,B00111100,B00001111,B11111110,B00011111, + B11000001,B11100000,B00011110,B00000001,B11100011,B11111111,B11110000,B00111111,B11111110,B01111000,B00111100,B00011111,B11111110,B00001111, + B11000001,B11100000,B00011110,B00000001,B11100011,B11110011,B11111000,B00111111,B00111110,B01111000,B00111100,B00111111,B00111111,B00000111, + B11000001,B11100000,B00011110,B00000001,B11100111,B11100000,B11111100,B01111100,B00011111,B01111000,B00111100,B00111110,B00011111,B00000111, + B11000001,B11100000,B00011110,B00000001,B11100111,B11000000,B01111100,B01111100,B00001111,B01111000,B00111100,B00111100,B00001111,B00000011, + B11000001,B11100000,B00011110,B00000001,B11100111,B10000000,B01111100,B01111000,B00001111,B01111000,B00111100,B00111100,B00001111,B00000011, + B11000001,B11100000,B00011110,B00000001,B11100111,B10000000,B00111100,B01111000,B00000000,B01111000,B00111100,B00111100,B00001111,B00000011, + B11000001,B11100000,B00011110,B00000001,B11100111,B10000000,B00111100,B01111000,B00000000,B01111000,B00111100,B00111100,B00001111,B00000011, + B11000001,B11100000,B00011110,B00000001,B11100111,B10000000,B00111100,B01111000,B00000000,B01111000,B00111100,B00111100,B00001111,B00000011, + B11000001,B11100000,B00011110,B00000001,B11100111,B11000000,B00111100,B01111000,B00000000,B01111000,B00111100,B00111100,B00001111,B00000011, + B11000001,B11100000,B00011110,B00000001,B11100011,B11100000,B00111100,B01111000,B00000000,B01111100,B00111100,B00111100,B00001111,B00000011, + B11000001,B11100000,B00011110,B00000001,B11100011,B11111111,B00111111,B11111000,B00000000,B01111111,B10111100,B00111100,B00001111,B00000011, + B11000001,B11100000,B00011110,B00000001,B11100001,B11111111,B00111111,B11111000,B00000000,B00111111,B10111111,B11111100,B00001111,B00000011, + B11000001,B11100000,B00011110,B00000001,B11100000,B11111111,B00111111,B11111000,B00000000,B00011111,B10111111,B11111100,B00001111,B00000011, + B11000001,B11100000,B00011110,B00000001,B11100000,B01111111,B00111111,B11111000,B00000000,B00001111,B10111111,B11111100,B00001111,B00000011, + B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111, + B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110, + B01110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00001110, + B00111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00011100, + B00011110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111000, + B00001111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11110000, + 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 + #define START_BMP_BYTEWIDTH ((START_BMPWIDTH + 7) / 8) + #endif + #ifndef START_BMPHEIGHT + #define START_BMPHEIGHT (sizeof(start_bmp) / (START_BMP_BYTEWIDTH)) + #endif + + static_assert(sizeof(start_bmp) == (START_BMP_BYTEWIDTH) * (START_BMPHEIGHT), "Bootscreen (start_bmp) dimensions don't match data."); + +#endif + +#ifndef CUSTOM_BOOTSCREEN_BMP_BYTEWIDTH + #define CUSTOM_BOOTSCREEN_BMP_BYTEWIDTH ((CUSTOM_BOOTSCREEN_BMPWIDTH + 7) / 8) +#endif +#ifndef CUSTOM_BOOTSCREEN_BMPHEIGHT + #define CUSTOM_BOOTSCREEN_BMPHEIGHT (sizeof(custom_start_bmp) / (CUSTOM_BOOTSCREEN_BMP_BYTEWIDTH)) +#endif diff --git a/Marlin/src/lcd/dogm/dogm_Statusscreen.h b/Marlin/src/lcd/dogm/dogm_Statusscreen.h new file mode 100644 index 0000000000..544fe1afce --- /dev/null +++ b/Marlin/src/lcd/dogm/dogm_Statusscreen.h @@ -0,0 +1,1168 @@ +/** + * 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 . + * + */ + +/** + * Standard Marlin Status Screen bitmaps + * + * Use the Marlin Bitmap Converter to make your own: + * http://marlinfw.org/tools/u8glib/converter.html + */ + +#include + +#include "../../inc/MarlinConfig.h" + +#if ENABLED(CUSTOM_STATUS_SCREEN_IMAGE) + + /** + * Custom _Statusscreen.h files can define: + * - A custom logo image + * - A custom heater bitmap + * - A custom fan bitmap / animation + * + * See the included examples for guidance + */ + #include "../../../_Statusscreen.h" + + #ifdef STATUS_SCREENWIDTH + #error "Your custom _Statusscreen.h needs to be converted for Marlin 2.0." + #endif + +#else // !CUSTOM_STATUS_SCREEN_IMAGE + + //#define STATUS_COMBINE_HEATERS + //#define STATUS_HOTEND_NUMBERLESS + #define STATUS_HOTEND_INVERTED + #define STATUS_HOTEND_ANIM + #define STATUS_BED_ANIM + //#define ALTERNATE_BED_BITMAP + +#endif // !CUSTOM_STATUS_SCREEN_IMAGE + +// +// Default Status Screen Heater or Hotends bitmaps +// + +#if !STATUS_HEATERS_WIDTH && !STATUS_HOTEND1_WIDTH + + #ifdef STATUS_COMBINE_HEATERS + + // + // Status Screen Combined Heater bitmaps + // + + #if HAS_HEATED_BED && HOTENDS == 0 + #define STATUS_HEATERS_X 80 + #endif + + #if HAS_HEATED_BED && HOTENDS <= 3 + + #if HOTENDS == 0 + + #define STATUS_HEATERS_WIDTH 18 + + const unsigned char status_heaters_bmp[] PROGMEM = { + B00100000,B10000010,B00000000, + B00010000,B01000001,B00000000, + B00010000,B01000001,B00000000, + B00100000,B10000010,B00000000, + B01000001,B00000100,B00000000, + B10000010,B00001000,B00000000, + B10000010,B00001000,B00000000, + B01000001,B00000100,B00000000, + B00100000,B10000010,B00000000, + B00000000,B00000000,B00000000, + B11111111,B11111111,B11000000, + B11111111,B11111111,B11000000 + }; + + #elif HOTENDS == 1 + + #define STATUS_HEATERS_WIDTH 90 + + const unsigned char status_heaters_bmp[] PROGMEM = { + B00011111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B10000010,B00000000, + B00111111,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00010000,B01000001,B00000000, + B00111111,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00010000,B01000001,B00000000, + B00111111,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B10000010,B00000000, + B00011111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01000001,B00000100,B00000000, + B00011111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B10000010,B00001000,B00000000, + B00111111,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B10000010,B00001000,B00000000, + B00111111,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01000001,B00000100,B00000000, + B00111111,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B10000010,B00000000, + B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000111,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000, + B00000011,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000 + }; + + #elif HOTENDS == 2 + + #define STATUS_HEATERS_WIDTH 90 + + const unsigned char status_heaters_bmp[] PROGMEM = { + B00011111,B11100000,B00000000,B00011111,B11100000,B00000000,B00000000,B00000000,B00000000,B00100000,B10000010,B00000000, + B00111110,B11110000,B00000000,B00111100,B11110000,B00000000,B00000000,B00000000,B00000000,B00010000,B01000001,B00000000, + B00111100,B11110000,B00000000,B00111011,B01110000,B00000000,B00000000,B00000000,B00000000,B00010000,B01000001,B00000000, + B00111010,B11110000,B00000000,B00111111,B01110000,B00000000,B00000000,B00000000,B00000000,B00100000,B10000010,B00000000, + B00011110,B11100000,B00000000,B00011110,B11100000,B00000000,B00000000,B00000000,B00000000,B01000001,B00000100,B00000000, + B00011110,B11100000,B00000000,B00011101,B11100000,B00000000,B00000000,B00000000,B00000000,B10000010,B00001000,B00000000, + B00111110,B11110000,B00000000,B00111011,B11110000,B00000000,B00000000,B00000000,B00000000,B10000010,B00001000,B00000000, + B00111110,B11110000,B00000000,B00111000,B01110000,B00000000,B00000000,B00000000,B00000000,B01000001,B00000100,B00000000, + B00111111,B11110000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000000,B00000000,B00100000,B10000010,B00000000, + B00001111,B11000000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000111,B10000000,B00000000,B00000111,B10000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000, + B00000011,B00000000,B00000000,B00000011,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000 + }; + + #else // HOTENDS > 2 + + #define STATUS_HEATERS_WIDTH 90 + + const unsigned char status_heaters_bmp[] PROGMEM = { + B00011111,B11100000,B00000000,B00011111,B11100000,B00000000,B00011111,B11100000,B00000000,B00100000,B10000010,B00000000, + B00111110,B11110000,B00000000,B00111100,B11110000,B00000000,B00111100,B11110000,B00000000,B00010000,B01000001,B00000000, + B00111100,B11110000,B00000000,B00111011,B01110000,B00000000,B00111011,B01110000,B00000000,B00010000,B01000001,B00000000, + B00111010,B11110000,B00000000,B00111111,B01110000,B00000000,B00111111,B01110000,B00000000,B00100000,B10000010,B00000000, + B00011110,B11100000,B00000000,B00011110,B11100000,B00000000,B00011100,B11100000,B00000000,B01000001,B00000100,B00000000, + B00011110,B11100000,B00000000,B00011101,B11100000,B00000000,B00011111,B01100000,B00000000,B10000010,B00001000,B00000000, + B00111110,B11110000,B00000000,B00111011,B11110000,B00000000,B00111011,B01110000,B00000000,B10000010,B00001000,B00000000, + B00111110,B11110000,B00000000,B00111000,B01110000,B00000000,B00111100,B11110000,B00000000,B01000001,B00000100,B00000000, + B00111111,B11110000,B00000000,B00111111,B11110000,B00000000,B00111111,B11110000,B00000000,B00100000,B10000010,B00000000, + B00001111,B11000000,B00000000,B00001111,B11000000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000, + B00000111,B10000000,B00000000,B00000111,B10000000,B00000000,B00000111,B10000000,B00000000,B11111111,B11111111,B11000000, + B00000011,B00000000,B00000000,B00000011,B00000000,B00000000,B00000011,B00000000,B00000000,B11111111,B11111111,B11000000 + }; + + #endif // HOTENDS + + #else // !HAS_HEATED_BED || HOTENDS > 3 + + #if HOTENDS == 1 + + #define STATUS_HEATERS_WIDTH 11 + + const unsigned char status_heaters_bmp[] PROGMEM = { + B00011111,B11100000, + B00111111,B11110000, + B00111111,B11110000, + B00111111,B11110000, + B00011111,B11100000, + B00011111,B11100000, + B00111111,B11110000, + B00111111,B11110000, + B00111111,B11110000, + B00001111,B11000000, + B00000111,B10000000, + B00000011,B00000000 + }; + + #elif HOTENDS == 2 + + #define STATUS_HEATERS_WIDTH 36 + + const unsigned char status_heaters_bmp[] PROGMEM = { + B00011111,B11100000,B00000000,B00011111,B11100000, + B00111110,B11110000,B00000000,B00111100,B11110000, + B00111100,B11110000,B00000000,B00111011,B01110000, + B00111010,B11110000,B00000000,B00111111,B01110000, + B00011110,B11100000,B00000000,B00011110,B11100000, + B00011110,B11100000,B00000000,B00011101,B11100000, + B00111110,B11110000,B00000000,B00111011,B11110000, + B00111110,B11110000,B00000000,B00111000,B01110000, + B00111111,B11110000,B00000000,B00111111,B11110000, + B00001111,B11000000,B00000000,B00001111,B11000000, + B00000111,B10000000,B00000000,B00000111,B10000000, + B00000011,B00000000,B00000000,B00000011,B00000000 + }; + + #elif HOTENDS == 3 + + #define STATUS_HEATERS_WIDTH 60 + + const unsigned char status_heaters_bmp[] PROGMEM = { + B00011111,B11100000,B00000000,B00011111,B11100000,B00000000,B00011111,B11100000, + B00111110,B11110000,B00000000,B00111100,B11110000,B00000000,B00111100,B11110000, + B00111100,B11110000,B00000000,B00111011,B01110000,B00000000,B00111011,B01110000, + B00111010,B11110000,B00000000,B00111111,B01110000,B00000000,B00111111,B01110000, + B00011110,B11100000,B00000000,B00011110,B11100000,B00000000,B00011100,B11100000, + B00011110,B11100000,B00000000,B00011101,B11100000,B00000000,B00011111,B01100000, + B00111110,B11110000,B00000000,B00111011,B11110000,B00000000,B00111011,B01110000, + B00111110,B11110000,B00000000,B00111000,B01110000,B00000000,B00111100,B11110000, + B00111111,B11110000,B00000000,B00111111,B11110000,B00000000,B00111111,B11110000, + B00001111,B11000000,B00000000,B00001111,B11000000,B00000000,B00001111,B11000000, + B00000111,B10000000,B00000000,B00000111,B10000000,B00000000,B00000111,B10000000, + B00000011,B00000000,B00000000,B00000011,B00000000,B00000000,B00000011,B00000000 + }; + + #elif HOTENDS > 3 + + #define STATUS_HEATERS_WIDTH 84 + + const unsigned char status_heaters_bmp[] PROGMEM = { + B00011111,B11100000,B00000000,B00011111,B11100000,B00000000,B00011111,B11100000,B00000000,B00011111,B11100000, + B00111110,B11110000,B00000000,B00111100,B11110000,B00000000,B00111100,B11110000,B00000000,B00111011,B01110000, + B00111100,B11110000,B00000000,B00111011,B01110000,B00000000,B00111011,B01110000,B00000000,B00111011,B01110000, + B00111010,B11110000,B00000000,B00111111,B01110000,B00000000,B00111111,B01110000,B00000000,B00111011,B01110000, + B00011110,B11100000,B00000000,B00011110,B11100000,B00000000,B00011100,B11100000,B00000000,B00011011,B01100000, + B00011110,B11100000,B00000000,B00011101,B11100000,B00000000,B00011111,B01100000,B00000000,B00011000,B00100000, + B00111110,B11110000,B00000000,B00111011,B11110000,B00000000,B00111011,B01110000,B00000000,B00111111,B01110000, + B00111110,B11110000,B00000000,B00111000,B01110000,B00000000,B00111100,B11110000,B00000000,B00111111,B01110000, + B00111111,B11110000,B00000000,B00111111,B11110000,B00000000,B00111111,B11110000,B00000000,B00111111,B11110000, + B00001111,B11000000,B00000000,B00001111,B11000000,B00000000,B00001111,B11000000,B00000000,B00001111,B11000000, + B00000111,B10000000,B00000000,B00000111,B10000000,B00000000,B00000111,B10000000,B00000000,B00000111,B10000000, + B00000011,B00000000,B00000000,B00000011,B00000000,B00000000,B00000011,B00000000,B00000000,B00000011,B00000000 + }; + + #endif // HOTENDS + + #endif // !HAS_HEATED_BED || HOTENDS > 3 + + #else // !STATUS_COMBINE_HEATERS + + // + // Status Screen Hotends bitmaps + // + + #if HOTENDS + + #define STATUS_HOTEND1_WIDTH 12 + + #if HOTENDS == 1 || defined(STATUS_HOTEND_NUMBERLESS) + + const unsigned char status_hotend_a_bmp[] PROGMEM = { + B00011111,B11100000, + B00111111,B11110000, + B00111111,B11110000, + B00111111,B11110000, + B00011111,B11100000, + B00011111,B11100000, + B00111111,B11110000, + B00111111,B11110000, + B00111111,B11110000, + B00001111,B11000000, + B00000111,B10000000, + B00000011,B00000000 + }; + + #ifdef STATUS_HOTEND_ANIM + + const unsigned char status_hotend_b_bmp[] PROGMEM = { + B00011111,B11100000, + B00100000,B00010000, + B00100000,B00010000, + B00100000,B00010000, + B00010000,B00100000, + B00010000,B00100000, + B00100000,B00010000, + B00100000,B00010000, + B00110000,B00110000, + B00001000,B01000000, + B00000100,B10000000, + B00000011,B00000000 + }; + + #endif + + #else + + #if HOTENDS >= 2 + + #if HAS_HEATED_BED + #define MAX_HOTEND_BITMAPS 3 + #else + #define MAX_HOTEND_BITMAPS 4 + #endif + #if HOTENDS > MAX_HOTEND_BITMAPS + #define STATUS_HOTEND_BITMAPS MAX_HOTEND_BITMAPS + #else + #define STATUS_HOTEND_BITMAPS HOTENDS + #endif + + #ifdef STATUS_HOTEND_ANIM + + const unsigned char status_hotend1_a_bmp[] PROGMEM = { + B00011111,B11100000, + B00111111,B11110000, + B00111110,B11110000, + B00111100,B11110000, + B00011010,B11100000, + B00011110,B11100000, + B00111110,B11110000, + B00111110,B11110000, + B00111110,B11110000, + B00001111,B11000000, + B00000111,B10000000, + B00000011,B00000000 + }; + + const unsigned char status_hotend1_b_bmp[] PROGMEM = { + B00011111,B11100000, + B00100000,B00010000, + B00100001,B00010000, + B00100011,B00010000, + B00010101,B00100000, + B00010001,B00100000, + B00100001,B00010000, + B00100001,B00010000, + B00110001,B00110000, + B00001000,B01000000, + B00000100,B10000000, + B00000011,B00000000 + }; + + const unsigned char status_hotend2_a_bmp[] PROGMEM = { + B00011111,B11100000, + B00111111,B11110000, + B00111100,B11110000, + B00111011,B01110000, + B00011111,B01100000, + B00011110,B11100000, + B00111101,B11110000, + B00111011,B11110000, + B00111000,B01110000, + B00001111,B11000000, + B00000111,B10000000, + B00000011,B00000000 + }; + + const unsigned char status_hotend2_b_bmp[] PROGMEM = { + B00011111,B11100000, + B00100000,B00010000, + B00100011,B00010000, + B00100100,B10010000, + B00010000,B10100000, + B00010001,B00100000, + B00100010,B00010000, + B00100100,B00010000, + B00110111,B10110000, + B00001000,B01000000, + B00000100,B10000000, + B00000011,B00000000 + }; + + #else + + const unsigned char status_hotend1_a_bmp[] PROGMEM = { + B00011111,B11100000, + B00111110,B11110000, + B00111100,B11110000, + B00111010,B11110000, + B00011110,B11100000, + B00011110,B11100000, + B00111110,B11110000, + B00111110,B11110000, + B00111111,B11110000, + B00001111,B11000000, + B00000111,B10000000, + B00000011,B00000000 + }; + + const unsigned char status_hotend2_a_bmp[] PROGMEM = { + B00011111,B11100000, + B00111100,B11110000, + B00111011,B01110000, + B00111111,B01110000, + B00011110,B11100000, + B00011101,B11100000, + B00111011,B11110000, + B00111000,B01110000, + B00111111,B11110000, + B00001111,B11000000, + B00000111,B10000000, + B00000011,B00000000 + }; + + #endif + + #endif + + #if STATUS_HOTEND_BITMAPS >= 3 + + #ifdef STATUS_HOTEND_ANIM + + const unsigned char status_hotend3_a_bmp[] PROGMEM = { + B00011111,B11100000, + B00111111,B11110000, + B00111100,B11110000, + B00111011,B01110000, + B00011111,B01100000, + B00011100,B11100000, + B00111111,B01110000, + B00111011,B01110000, + B00111100,B11110000, + B00001111,B11000000, + B00000111,B10000000, + B00000011,B00000000 + }; + + const unsigned char status_hotend3_b_bmp[] PROGMEM = { + B00011111,B11100000, + B00100000,B00010000, + B00100011,B00010000, + B00100100,B10010000, + B00010000,B10100000, + B00010011,B00100000, + B00100000,B10010000, + B00100100,B10010000, + B00110011,B00110000, + B00001000,B01000000, + B00000100,B10000000, + B00000011,B00000000 + }; + + #else + + const unsigned char status_hotend3_a_bmp[] PROGMEM = { + B00011111,B11100000, + B00111100,B11110000, + B00111011,B01110000, + B00111111,B01110000, + B00011100,B11100000, + B00011111,B01100000, + B00111011,B01110000, + B00111100,B11110000, + B00111111,B11110000, + B00001111,B11000000, + B00000111,B10000000, + B00000011,B00000000 + }; + + #endif + + #endif + + #if STATUS_HOTEND_BITMAPS >= 4 && !HAS_HEATED_BED + + #ifdef STATUS_HOTEND_ANIM + + const unsigned char status_hotend4_a_bmp[] PROGMEM = { + B00011111,B11100000, + B00111111,B11110000, + B00111011,B01110000, + B00111011,B01110000, + B00011011,B01100000, + B00011011,B01100000, + B00111000,B00110000, + B00111111,B01110000, + B00111111,B01110000, + B00001111,B11000000, + B00000111,B10000000, + B00000011,B00000000 + }; + + const unsigned char status_hotend4_b_bmp[] PROGMEM = { + B00011111,B11100000, + B00100000,B00010000, + B00100100,B10010000, + B00100100,B10010000, + B00010100,B10100000, + B00010100,B10100000, + B00100111,B11010000, + B00100000,B10010000, + B00110000,B10110000, + B00001000,B01000000, + B00000100,B10000000, + B00000011,B00000000 + }; + + #else + + const unsigned char status_hotend4_a_bmp[] PROGMEM = { + B00011111,B11100000, + B00111011,B01110000, + B00111011,B01110000, + B00111011,B01110000, + B00011011,B01100000, + B00011000,B00100000, + B00111111,B01110000, + B00111111,B01110000, + B00111111,B11110000, + B00001111,B11000000, + B00000111,B10000000, + B00000011,B00000000 + }; + + #endif + + #endif + + #if STATUS_HOTEND_BITMAPS >= 5 && !HAS_HEATED_BED + + #ifdef STATUS_HOTEND_ANIM + + const unsigned char status_hotend5_a_bmp[] PROGMEM = { + B00011111,B11100000, + B00111111,B11110000, + B00111000,B01110000, + B00111011,B11110000, + B00011000,B11100000, + B00011111,B01100000, + B00111111,B01110000, + B00111011,B01110000, + B00111100,B11110000, + B00001111,B11000000, + B00000111,B10000000, + B00000011,B00000000 + }; + + const unsigned char status_hotend5_b_bmp[] PROGMEM = { + B00011111,B11100000, + B00100000,B00010000, + B00100111,B10010000, + B00100100,B00010000, + B00010111,B00100000, + B00010000,B10100000, + B00100000,B10010000, + B00100100,B10010000, + B00110011,B00110000, + B00001000,B01000000, + B00000100,B10000000, + B00000011,B00000000 + }; + + #else + + const unsigned char status_hotend5_a_bmp[] PROGMEM = { + B00011111,B11100000, + B00111000,B01110000, + B00111011,B11110000, + B00111000,B11110000, + B00011111,B01100000, + B00011111,B01100000, + B00111011,B01110000, + B00111100,B11110000, + B00111111,B11110000, + B00001111,B11000000, + B00000111,B10000000, + B00000011,B00000000 + }; + + #endif + + #endif + + #endif + + #endif + + #endif + +#endif // !STATUS_HEATERS_WIDTH && !STATUS_HOTEND1_WIDTH + +// +// Default Status Screen Bed bitmaps +// + +#if !STATUS_BED_WIDTH && !defined(STATUS_COMBINE_HEATERS) && HAS_HEATED_BED && HOTENDS < 4 + + #ifdef ALTERNATE_BED_BITMAP + + #define STATUS_BED_ANIM + #define STATUS_BED_WIDTH 24 + #ifndef STATUS_BED_X + #define STATUS_BED_X 72 + #endif + #define STATUS_BED_TEXT_X STATUS_BED_X + 13 + + const unsigned char status_bed_bmp[] PROGMEM = { + B11111111,B11111111,B11000000, + B01000000,B00000000,B00100000, + B00100000,B00000000,B00010000, + B00010000,B00000000,B00001000, + B00001000,B00000000,B00000100, + B00000100,B00000000,B00000010, + B00000011,B11111111,B11111111 + }; + + const unsigned char status_bed_on_bmp[] PROGMEM = { + B00000010,B00100010,B00000000, + B00000100,B01000100,B00000000, + B00000100,B01000100,B00000000, + B00000010,B00100010,B00000000, + B00000001,B00010001,B00000000, + B11111111,B11111111,B11000000, + B01000000,B10001000,B10100000, + B00100001,B00010001,B00010000, + B00010010,B00100010,B00001000, + B00001000,B00000000,B00000100, + B00000100,B00000000,B00000010, + B00000011,B11111111,B11111111 + }; + + #else + + #define STATUS_BED_WIDTH 18 + #ifndef STATUS_BED_X + #define STATUS_BED_X 80 + #endif + + #ifdef STATUS_BED_ANIM + + const unsigned char status_bed_bmp[] PROGMEM = { + B11111111,B11111111,B11000000, + B11111111,B11111111,B11000000 + }; + + const unsigned char status_bed_on_bmp[] PROGMEM = { + B00100000,B10000010,B00000000, + B00010000,B01000001,B00000000, + B00010000,B01000001,B00000000, + B00100000,B10000010,B00000000, + B01000001,B00000100,B00000000, + B10000010,B00001000,B00000000, + B10000010,B00001000,B00000000, + B01000001,B00000100,B00000000, + B00100000,B10000010,B00000000, + B00000000,B00000000,B00000000, + B11111111,B11111111,B11000000, + B11111111,B11111111,B11000000 + }; + + #else + + const unsigned char status_bed_bmp[] PROGMEM = { + B00100000,B10000010,B00000000, + B00010000,B01000001,B00000000, + B00010000,B01000001,B00000000, + B00100000,B10000010,B00000000, + B01000001,B00000100,B00000000, + B10000010,B00001000,B00000000, + B10000010,B00001000,B00000000, + B01000001,B00000100,B00000000, + B00100000,B10000010,B00000000, + B00000000,B00000000,B00000000, + B11111111,B11111111,B11000000, + B11111111,B11111111,B11000000 + }; + + #endif + + #endif + +#endif // !STATUS_BED_WIDTH && !STATUS_COMBINE_HEATERS && HAS_HEATED_BED && HOTENDS < 4 + +// Can also be overridden in Configuration.h +// If you can afford it, try the 3-frame fan animation! +#ifndef FAN_ANIM_FRAMES + #define FAN_ANIM_FRAMES 2 +#elif FAN_ANIM_FRAMES > 3 + #error "Only 3 fan animation frames currently supported." +#endif + +// Don't compile in the fan animation with no fan +#if !HAS_FAN0 + #undef FAN_ANIM_FRAMES +#endif + +// +// Provide default Fan Bitmaps +// +#if !defined(STATUS_FAN_WIDTH) && FAN_ANIM_FRAMES > 0 + + // Provide a fan animation if none exists + + #if FAN_ANIM_FRAMES <= 2 + + #define STATUS_FAN_Y 2 + #define STATUS_FAN_WIDTH 20 + + const unsigned char status_fan0_bmp[] PROGMEM = { + B00111111,B11111111,B11110000, + B00111000,B00000000,B01110000, + B00110000,B11111100,B00110000, + B00100000,B11111100,B00010000, + B00100000,B01111000,B00010000, + B00100000,B00110000,B00010000, + B00101100,B00000000,B11010000, + B00101110,B00110001,B11010000, + B00101111,B01111011,B11010000, + B00101111,B01111011,B11010000, + B00101110,B00110001,B11010000, + B00101100,B00000000,B11010000, + B00100000,B00110000,B00010000, + B00100000,B01111000,B00010000, + B00100000,B11111100,B00010000, + B00110000,B11111100,B00110000, + B00111000,B00000000,B01110000, + B00111111,B11111111,B11110000 + }; + + #if FAN_ANIM_FRAMES == 2 + const unsigned char status_fan1_bmp[] PROGMEM = { + B00111111,B11111111,B11110000, + B00111000,B00000000,B01110000, + B00110001,B10000110,B00110000, + B00100011,B10000111,B00010000, + B00100111,B10000111,B10010000, + B00101111,B10000111,B11010000, + B00101111,B00000011,B11010000, + B00100000,B00110000,B00010000, + B00100000,B01111000,B00010000, + B00100000,B01111000,B00010000, + B00100000,B00110000,B00010000, + B00101111,B00000011,B11010000, + B00101111,B10000111,B11010000, + B00100111,B10000111,B10010000, + B00100011,B10000111,B00010000, + B00110001,B10000110,B00110000, + B00111000,B00000000,B01110000, + B00111111,B11111111,B11110000 + }; + #endif + + #elif FAN_ANIM_FRAMES == 3 + + #define STATUS_FAN_WIDTH 21 + + const unsigned char status_fan0_bmp[] PROGMEM = { + B00111111,B11111111,B11111000, + B00111110,B00000000,B11111000, + B00111001,B00000001,B00111000, + B00110111,B10000011,B11011000, + B00110111,B10000011,B11011000, + B00101111,B11000111,B11101000, + B00100111,B11000111,B11001000, + B00100001,B11111111,B00001000, + B00100000,B01111100,B00001000, + B00100000,B01111100,B00001000, + B00100000,B01111100,B00001000, + B00100001,B11111111,B00001000, + B00100111,B11000111,B11001000, + B00101111,B11000111,B11101000, + B00110111,B10000011,B11011000, + B00110111,B10000011,B11011000, + B00111001,B00000001,B00111000, + B00111110,B00000000,B11111000, + B00111111,B11111111,B11111000 + }; + const unsigned char status_fan1_bmp[] PROGMEM = { + B00111111,B11111111,B11111000, + B00111110,B00110000,B11111000, + B00111001,B11110000,B00111000, + B00110001,B11110000,B00011000, + B00110000,B11110000,B00011000, + B00100000,B11110000,B01101000, + B00100000,B00110001,B11101000, + B00100000,B00111001,B11101000, + B00100000,B01111111,B11111000, + B00111111,B11111111,B11111000, + B00111111,B11111100,B00001000, + B00101111,B00111000,B00001000, + B00101110,B00011000,B00001000, + B00101100,B00011110,B00001000, + B00110000,B00011110,B00011000, + B00110000,B00011111,B00011000, + B00111000,B00011111,B00111000, + B00111110,B00011000,B11111000, + B00111111,B11111111,B11111000 + }; + const unsigned char status_fan2_bmp[] PROGMEM = { + B00111111,B11111111,B11111000, + B00111110,B00011000,B11111000, + B00111000,B00011111,B00111000, + B00110000,B00011111,B10011000, + B00110100,B00011111,B00011000, + B00101110,B00011110,B00001000, + B00101111,B00011100,B00001000, + B00101111,B10111000,B00001000, + B00111111,B11111100,B00001000, + B00111111,B11111111,B11111000, + B00100000,B01111111,B11111000, + B00100000,B00111011,B11101000, + B00100000,B01110001,B11101000, + B00100000,B11110000,B11101000, + B00110001,B11110000,B01011000, + B00110011,B11110000,B00011000, + B00111001,B11110000,B00111000, + B00111110,B00110000,B11111000, + B00111111,B11111111,B11111000 + }; + + #elif FAN_ANIM_FRAMES == 4 + + #define STATUS_FAN_WIDTH 21 + + const unsigned char status_fan0_bmp[] PROGMEM = { + B00111111,B11111111,B11111000, + B00111110,B00000000,B11111000, + B00111000,B00111111,B00111000, + B00110000,B01111110,B00011000, + B00110000,B01111100,B00011000, + B00101000,B01111100,B00001000, + B00101100,B00111000,B00001000, + B00101111,B00111001,B11001000, + B00101111,B11111111,B11101000, + B00101111,B11000111,B11101000, + B00101111,B11111111,B11101000, + B00100111,B00111001,B11101000, + B00100000,B00111000,B01101000, + B00100000,B01111100,B00101000, + B00110000,B01111100,B00011000, + B00110000,B11111100,B00011000, + B00111001,B11111000,B00111000, + B00111110,B00000000,B11111000, + B00111111,B11111111,B11111000 + }; + const unsigned char status_fan1_bmp[] PROGMEM = { + B00111111,B11111111,B11111000, + B00111110,B00000000,B11111000, + B00111000,B00001111,B00111000, + B00110100,B00011111,B11011000, + B00110110,B00011111,B10011000, + B00101111,B00011111,B00001000, + B00101111,B10011110,B00001000, + B00101111,B11111100,B00001000, + B00101111,B11011100,B00001000, + B00100111,B11101111,B11001000, + B00100000,B01110111,B11101000, + B00100000,B01111111,B11101000, + B00100000,B11110011,B11101000, + B00100001,B11110001,B11101000, + B00110011,B11110000,B11011000, + B00110111,B11110000,B01011000, + B00111001,B11100000,B00111000, + B00111110,B00000000,B11111000, + B00111111,B11111111,B11111000 + }; + const unsigned char status_fan2_bmp[] PROGMEM = { + B00111111,B11111111,B11111000, + B00111110,B10000000,B11111000, + B00111001,B10000000,B00111000, + B00110111,B10000001,B11011000, + B00110111,B11000011,B11011000, + B00100111,B11000111,B11101000, + B00100011,B11000111,B11111000, + B00100001,B11111111,B10001000, + B00100000,B01101100,B00001000, + B00100000,B01101100,B00001000, + B00100000,B01101100,B00001000, + B00100011,B11111111,B00001000, + B00111111,B11000111,B10001000, + B00101111,B11000111,B11001000, + B00110111,B10000111,B11011000, + B00110111,B00000011,B11011000, + B00111000,B00000011,B00111000, + B00111110,B00000010,B11111000, + B00111111,B11111111,B11111000 + }; + const unsigned char status_fan3_bmp[] PROGMEM = { + B00111111,B11111111,B11111000, + B00111110,B00000000,B11111000, + B00111001,B11110000,B00111000, + B00110001,B11100000,B00011000, + B00110001,B11100000,B00011000, + B00100001,B11100001,B11101000, + B00100000,B11110011,B11101000, + B00100000,B01111111,B11101000, + B00100000,B01110111,B11101000, + B00101000,B11101110,B00101000, + B00101111,B11011100,B00001000, + B00101111,B11111100,B00001000, + B00101111,B10011110,B00001000, + B00101111,B00001111,B00001000, + B00110000,B00001111,B00011000, + B00110000,B00001111,B00011000, + B00111000,B00011111,B00111000, + B00111110,B00000000,B11111000, + B00111111,B11111111,B11111000 + }; + + #endif + +#endif + +// +// Custom Logo Bitmap Properties +// +#ifndef STATUS_LOGO_WIDTH + #define STATUS_LOGO_WIDTH 0 +#endif +#ifndef STATUS_LOGO_BYTEWIDTH + #define STATUS_LOGO_BYTEWIDTH ((STATUS_LOGO_WIDTH + 7) / 8) +#endif +#if STATUS_LOGO_WIDTH + #ifndef STATUS_LOGO_X + #define STATUS_LOGO_X 0 + #endif + #ifndef STATUS_LOGO_Y + #define STATUS_LOGO_Y MIN(0, 10 - (STATUS_LOGO_HEIGHT) / 2) + #endif + #ifndef STATUS_LOGO_HEIGHT + #define STATUS_LOGO_HEIGHT (sizeof(status_logo_bmp) / (STATUS_LOGO_BYTEWIDTH)) + #endif + static_assert( + sizeof(status_logo_bmp) == (STATUS_LOGO_BYTEWIDTH) * (STATUS_LOGO_HEIGHT), + "Status logo bitmap (status_logo_bmp) dimensions don't match data." + ); +#endif + +// +// Heater Bitmap Properties +// +#if STATUS_HOTEND1_WIDTH || STATUS_HEATERS_WIDTH + + #ifndef STATUS_HEATERS_XSPACE + #define STATUS_HEATERS_XSPACE 24 // Like the included bitmaps + #endif + + #ifndef STATUS_HEATERS_X + #if STATUS_LOGO_BYTEWIDTH + #define STATUS_HEATERS_X ((STATUS_LOGO_BYTEWIDTH + 0) * 8) + #else + #define STATUS_HEATERS_X 8 // Like the included bitmaps + #endif + #endif + +#endif + +#if STATUS_HOTEND1_WIDTH + + // + // Hotend images. A base hotend image and optional "ON" state image. + // + + #ifndef STATUS_HOTEND_BITMAPS + #define STATUS_HOTEND_BITMAPS 1 + #endif + + #ifndef STATUS_HOTEND2_WIDTH + #define STATUS_HOTEND2_WIDTH STATUS_HOTEND1_WIDTH + #endif + #ifndef STATUS_HOTEND3_WIDTH + #define STATUS_HOTEND3_WIDTH STATUS_HOTEND2_WIDTH + #endif + #ifndef STATUS_HOTEND4_WIDTH + #define STATUS_HOTEND4_WIDTH STATUS_HOTEND3_WIDTH + #endif + #ifndef STATUS_HOTEND5_WIDTH + #define STATUS_HOTEND5_WIDTH STATUS_HOTEND5_WIDTH + #endif + #ifndef STATUS_HOTEND6_WIDTH + #define STATUS_HOTEND6_WIDTH STATUS_HOTEND6_WIDTH + #endif + + constexpr uint8_t status_hotend_width[HOTENDS] = ARRAY_N(HOTENDS, STATUS_HOTEND1_WIDTH, STATUS_HOTEND2_WIDTH, STATUS_HOTEND3_WIDTH, STATUS_HOTEND4_WIDTH, STATUS_HOTEND5_WIDTH, STATUS_HOTEND6_WIDTH); + #define STATUS_HOTEND_WIDTH(N) status_hotend_width[N] + + #ifndef STATUS_HOTEND1_BYTEWIDTH + #define STATUS_HOTEND1_BYTEWIDTH ((STATUS_HOTEND1_WIDTH + 7) / 8) + #endif + #ifndef STATUS_HOTEND2_BYTEWIDTH + #define STATUS_HOTEND2_BYTEWIDTH ((STATUS_HOTEND2_WIDTH + 7) / 8) + #endif + #ifndef STATUS_HOTEND3_BYTEWIDTH + #define STATUS_HOTEND3_BYTEWIDTH ((STATUS_HOTEND3_WIDTH + 7) / 8) + #endif + #ifndef STATUS_HOTEND4_BYTEWIDTH + #define STATUS_HOTEND4_BYTEWIDTH ((STATUS_HOTEND4_WIDTH + 7) / 8) + #endif + #ifndef STATUS_HOTEND5_BYTEWIDTH + #define STATUS_HOTEND5_BYTEWIDTH ((STATUS_HOTEND5_WIDTH + 7) / 8) + #endif + #ifndef STATUS_HOTEND6_BYTEWIDTH + #define STATUS_HOTEND6_BYTEWIDTH ((STATUS_HOTEND6_WIDTH + 7) / 8) + #endif + + constexpr uint8_t status_hotend_bytewidth[HOTENDS] = ARRAY_N(HOTENDS, STATUS_HOTEND1_BYTEWIDTH, STATUS_HOTEND2_BYTEWIDTH, STATUS_HOTEND3_BYTEWIDTH, STATUS_HOTEND4_BYTEWIDTH, STATUS_HOTEND5_BYTEWIDTH, STATUS_HOTEND6_BYTEWIDTH); + #define STATUS_HOTEND_BYTEWIDTH(N) status_hotend_bytewidth[N] + + #ifndef STATUS_HOTEND1_X + #define STATUS_HOTEND1_X STATUS_HEATERS_X + #endif + #ifndef STATUS_HOTEND2_X + #define STATUS_HOTEND2_X STATUS_HOTEND1_X + STATUS_HEATERS_XSPACE + #endif + #ifndef STATUS_HOTEND3_X + #define STATUS_HOTEND3_X STATUS_HOTEND2_X + STATUS_HEATERS_XSPACE + #endif + #ifndef STATUS_HOTEND4_X + #define STATUS_HOTEND4_X STATUS_HOTEND3_X + STATUS_HEATERS_XSPACE + #endif + #ifndef STATUS_HOTEND5_X + #define STATUS_HOTEND5_X STATUS_HOTEND5_X + STATUS_HEATERS_XSPACE + #endif + #ifndef STATUS_HOTEND6_X + #define STATUS_HOTEND6_X STATUS_HOTEND6_X + STATUS_HEATERS_XSPACE + #endif + + #if HOTENDS > 2 + constexpr uint8_t status_hotend_x[HOTENDS] = ARRAY_N(HOTENDS, STATUS_HOTEND1_X, STATUS_HOTEND2_X, STATUS_HOTEND3_X, STATUS_HOTEND4_X, STATUS_HOTEND5_X, STATUS_HOTEND6_X); + #define STATUS_HOTEND_X(N) status_hotend_x[N] + #elif HOTENDS > 1 + #define STATUS_HOTEND_X(N) ((N) ? STATUS_HOTEND2_X : STATUS_HOTEND1_X) + #else + #define STATUS_HOTEND_X(N) STATUS_HOTEND1_X + #endif + + #ifndef STATUS_HOTEND_TEXT_X + #ifdef STATUS_HOTEND1_TEXT_X + #ifndef STATUS_HOTEND2_TEXT_X + #define STATUS_HOTEND2_TEXT_X STATUS_HOTEND1_TEXT_X + STATUS_HEATERS_XSPACE + #endif + #ifndef STATUS_HOTEND3_TEXT_X + #define STATUS_HOTEND3_TEXT_X STATUS_HOTEND2_TEXT_X + STATUS_HEATERS_XSPACE + #endif + #ifndef STATUS_HOTEND4_TEXT_X + #define STATUS_HOTEND4_TEXT_X STATUS_HOTEND3_TEXT_X + STATUS_HEATERS_XSPACE + #endif + #ifndef STATUS_HOTEND5_TEXT_X + #define STATUS_HOTEND5_TEXT_X STATUS_HOTEND5_TEXT_X + STATUS_HEATERS_XSPACE + #endif + #ifndef STATUS_HOTEND6_TEXT_X + #define STATUS_HOTEND6_TEXT_X STATUS_HOTEND6_TEXT_X + STATUS_HEATERS_XSPACE + #endif + constexpr uint8_t status_hotend_text_x[] = ARRAY_N(HOTENDS, STATUS_HOTEND1_TEXT_X, STATUS_HOTEND2_TEXT_X, STATUS_HOTEND3_TEXT_X, STATUS_HOTEND4_TEXT_X, STATUS_HOTEND5_TEXT_X, STATUS_HOTEND6_TEXT_X); + #define STATUS_HOTEND_TEXT_X(N) status_hotend_text_x[N] + #else + #define STATUS_HOTEND_TEXT_X(N) (STATUS_HOTEND1_X + 6 + (N) * (STATUS_HEATERS_XSPACE)) + #endif + #endif + + #if STATUS_HOTEND_BITMAPS > 1 + #define TEST_BITMAP_OFF status_hotend1_a_bmp + #define TEST_BITMAP_ON status_hotend1_b_bmp + #else + #define TEST_BITMAP_OFF status_hotend_a_bmp + #define TEST_BITMAP_ON status_hotend_b_bmp + #endif + #ifndef STATUS_HEATERS_HEIGHT + #define STATUS_HEATERS_HEIGHT (sizeof(TEST_BITMAP_OFF) / (STATUS_HOTEND1_BYTEWIDTH)) + #endif + #ifndef STATUS_HEATERS_Y + #define STATUS_HEATERS_Y (20 - (STATUS_HEATERS_HEIGHT)) + #endif + + #define HOTEND0_BITMAP_SIZE (STATUS_HOTEND1_BYTEWIDTH) * (STATUS_HEATERS_HEIGHT) + static_assert( + sizeof(TEST_BITMAP_OFF) == HOTEND0_BITMAP_SIZE, + "Status hotend bitmap (" STRINGIFY(TEST_BITMAP_OFF) ") dimensions don't match data." + ); + #ifdef STATUS_HOTEND_ANIM + static_assert( + sizeof(TEST_BITMAP_ON) == HOTEND0_BITMAP_SIZE, + "Status hotend bitmaps (" STRINGIFY(TEST_BITMAP_OFF) " and " STRINGIFY(TEST_BITMAP_ON) ") dimensions don't match." + ); + #endif + +#elif STATUS_HEATERS_WIDTH + + #ifndef STATUS_HOTEND_TEXT_X + #define STATUS_HOTEND_TEXT_X(N) (STATUS_HEATERS_X + 6 + (N) * (STATUS_HEATERS_XSPACE)) + #endif + #ifndef STATUS_HEATERS_BYTEWIDTH + #define STATUS_HEATERS_BYTEWIDTH ((STATUS_HEATERS_WIDTH + 7) / 8) + #endif + #ifndef STATUS_HEATERS_HEIGHT + #define STATUS_HEATERS_HEIGHT (sizeof(status_heaters_bmp) / (STATUS_HEATERS_BYTEWIDTH)) + #endif + #ifndef STATUS_HEATERS_Y + #define STATUS_HEATERS_Y (20 - (STATUS_HEATERS_HEIGHT)) + #endif + + static_assert( + sizeof(status_heaters_bmp) == (STATUS_HEATERS_BYTEWIDTH) * (STATUS_HEATERS_HEIGHT), + "Status heaters bitmap (status_heaters_bmp) dimensions don't match data." + ); + +#endif + +// +// Bed Bitmap Properties +// +#ifndef STATUS_BED_WIDTH + #define STATUS_BED_WIDTH 0 +#endif +#ifndef STATUS_BED_BYTEWIDTH + #define STATUS_BED_BYTEWIDTH ((STATUS_BED_WIDTH + 7) / 8) +#endif +#if STATUS_BED_WIDTH + + #ifndef STATUS_BED_X + #define STATUS_BED_X (128 - (STATUS_FAN_BYTEWIDTH + STATUS_BED_BYTEWIDTH) * 8) + #endif + + #ifndef STATUS_BED_HEIGHT + #ifdef STATUS_BED_ANIM + #define STATUS_BED_HEIGHT(S) ((S) ? sizeof(status_bed_on_bmp) / (STATUS_BED_BYTEWIDTH) : sizeof(status_bed_bmp) / (STATUS_BED_BYTEWIDTH)) + #else + #define STATUS_BED_HEIGHT(S) (sizeof(status_bed_bmp) / (STATUS_BED_BYTEWIDTH)) + #endif + #endif + + #ifndef STATUS_BED_Y + #define STATUS_BED_Y(S) (20 - STATUS_BED_HEIGHT(S)) + #endif + + #ifndef STATUS_BED_TEXT_X + #define STATUS_BED_TEXT_X (STATUS_BED_X + 8) + #endif + + static_assert( + sizeof(status_bed_bmp) == (STATUS_BED_BYTEWIDTH) * (STATUS_BED_HEIGHT(0)), + "Status bed bitmap (status_bed_bmp) dimensions don't match data." + ); + #ifdef STATUS_BED_ANIM + static_assert( + sizeof(status_bed_on_bmp) == (STATUS_BED_BYTEWIDTH) * (STATUS_BED_HEIGHT(1)), + "Status bed bitmap (status_bed_on_bmp) dimensions don't match data." + ); + #endif + +#endif + +// +// Fan Bitmap Properties +// +#ifndef STATUS_FAN_WIDTH + #define STATUS_FAN_WIDTH 0 +#endif +#ifndef STATUS_FAN_BYTEWIDTH + #define STATUS_FAN_BYTEWIDTH ((STATUS_FAN_WIDTH + 7) / 8) +#endif +#if FAN_ANIM_FRAMES + #ifndef STATUS_FAN_X + #define STATUS_FAN_X (128 - (STATUS_FAN_BYTEWIDTH) * 8) + #endif + #ifndef STATUS_FAN_Y + #define STATUS_FAN_Y 1 + #endif + #ifndef STATUS_FAN_TEXT_X + #define STATUS_FAN_TEXT_X 103 + #endif + #ifndef STATUS_FAN_TEXT_Y + #define STATUS_FAN_TEXT_Y 28 + #endif + #ifndef STATUS_FAN_HEIGHT + #define STATUS_FAN_HEIGHT (sizeof(status_fan0_bmp) / (STATUS_FAN_BYTEWIDTH)) + #endif + #define FAN_BMP_SIZE (STATUS_FAN_BYTEWIDTH) * (STATUS_FAN_HEIGHT) + static_assert(sizeof(status_fan0_bmp) == FAN_BMP_SIZE, "Status fan bitmap (status_fan0_bmp) dimensions don't match data."); + #if FAN_ANIM_FRAMES > 1 + static_assert(sizeof(status_fan1_bmp) == FAN_BMP_SIZE, "Status fan bitmap (status_fan1_bmp) dimensions don't match data."); + #if FAN_ANIM_FRAMES > 2 + static_assert(sizeof(status_fan2_bmp) == FAN_BMP_SIZE, "Status fan bitmap (status_fan2_bmp) dimensions don't match data."); + #if FAN_ANIM_FRAMES > 3 + static_assert(sizeof(status_fan3_bmp) == FAN_BMP_SIZE, "Status fan bitmap (status_fan3_bmp) dimensions don't match data."); + #endif + #endif + #endif +#endif diff --git a/Marlin/src/lcd/dogm/dogm_bitmaps.h b/Marlin/src/lcd/dogm/dogm_bitmaps.h deleted file mode 100644 index d138aa75a5..0000000000 --- a/Marlin/src/lcd/dogm/dogm_bitmaps.h +++ /dev/null @@ -1,1193 +0,0 @@ -/** - * 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 . - * - */ - -/** - * Standard Marlin Boot and Status Screen bitmaps - * - * Use the Marlin Bitmap Converter to make your own: - * http://marlinfw.org/tools/u8glib/converter.html - */ - -#include - -#include "../../inc/MarlinConfig.h" - -#if ENABLED(SHOW_BOOTSCREEN) - - //#define START_BMPHIGH // Costs 399 bytes more flash - - #if ENABLED(SHOW_CUSTOM_BOOTSCREEN) - - #include "../../../_Bootscreen.h" - - #ifndef CUSTOM_BOOTSCREEN_TIMEOUT - #define CUSTOM_BOOTSCREEN_TIMEOUT 2500 - #endif - - #endif - - #if ENABLED(START_BMPHIGH) - - #define START_BMPWIDTH 112 - - const unsigned char start_bmp[] PROGMEM = { - B00000001,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111, - B00001111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111, - B00011110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11111111,B11111111, - B00111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,B11111111,B11111111, - B01110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111111,B11111111, - B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11111111, - B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111111,B11111111, - B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111000,B00000000,B00000000,B00111111,B11111111, - B11000000,B00001111,B11000000,B11111100,B00000000,B00000000,B00000000,B00000000,B00000000,B01111000,B00011000,B00000000,B00011111,B11111111, - B11000000,B00111111,B11100001,B11111111,B00000000,B00000000,B00000000,B00000000,B00000000,B01111000,B00111100,B00000000,B00001111,B11111111, - B11000000,B01111111,B11110011,B11111111,B10000000,B00000000,B00000000,B00000000,B00000000,B01111000,B00111100,B00000000,B00000111,B11111111, - B11000000,B11111111,B11111111,B11111111,B11000000,B00000000,B00000000,B00000000,B00000000,B01111000,B00111100,B00000000,B00000011,B11111111, - B11000001,B11111000,B01111111,B10000111,B11100000,B00000000,B00000000,B00000000,B00000000,B01111000,B00000000,B00000000,B00000001,B11111111, - B11000001,B11110000,B00111111,B00000011,B11100000,B00000000,B00000000,B00000000,B00000000,B01111000,B00000000,B00000000,B00000000,B11111111, - B11000001,B11100000,B00011110,B00000001,B11100000,B00011111,B00000000,B00000011,B11100000,B01111000,B00111100,B00000011,B11110000,B01111111, - B11000001,B11100000,B00011110,B00000001,B11100000,B01111111,B11000000,B00001111,B11111000,B01111000,B00111100,B00000111,B11111100,B00111111, - B11000001,B11100000,B00011110,B00000001,B11100001,B11111111,B11100000,B00011111,B11111100,B01111000,B00111100,B00001111,B11111110,B00011111, - B11000001,B11100000,B00011110,B00000001,B11100011,B11111111,B11110000,B00111111,B11111110,B01111000,B00111100,B00011111,B11111110,B00001111, - B11000001,B11100000,B00011110,B00000001,B11100011,B11110011,B11111000,B00111111,B00111110,B01111000,B00111100,B00111111,B00111111,B00000111, - B11000001,B11100000,B00011110,B00000001,B11100111,B11100000,B11111100,B01111100,B00011111,B01111000,B00111100,B00111110,B00011111,B00000111, - B11000001,B11100000,B00011110,B00000001,B11100111,B11000000,B01111100,B01111100,B00001111,B01111000,B00111100,B00111100,B00001111,B00000011, - B11000001,B11100000,B00011110,B00000001,B11100111,B10000000,B01111100,B01111000,B00001111,B01111000,B00111100,B00111100,B00001111,B00000011, - B11000001,B11100000,B00011110,B00000001,B11100111,B10000000,B00111100,B01111000,B00000000,B01111000,B00111100,B00111100,B00001111,B00000011, - B11000001,B11100000,B00011110,B00000001,B11100111,B10000000,B00111100,B01111000,B00000000,B01111000,B00111100,B00111100,B00001111,B00000011, - B11000001,B11100000,B00011110,B00000001,B11100111,B10000000,B00111100,B01111000,B00000000,B01111000,B00111100,B00111100,B00001111,B00000011, - B11000001,B11100000,B00011110,B00000001,B11100111,B11000000,B00111100,B01111000,B00000000,B01111000,B00111100,B00111100,B00001111,B00000011, - B11000001,B11100000,B00011110,B00000001,B11100011,B11100000,B00111100,B01111000,B00000000,B01111100,B00111100,B00111100,B00001111,B00000011, - B11000001,B11100000,B00011110,B00000001,B11100011,B11111111,B00111111,B11111000,B00000000,B01111111,B10111100,B00111100,B00001111,B00000011, - B11000001,B11100000,B00011110,B00000001,B11100001,B11111111,B00111111,B11111000,B00000000,B00111111,B10111111,B11111100,B00001111,B00000011, - B11000001,B11100000,B00011110,B00000001,B11100000,B11111111,B00111111,B11111000,B00000000,B00011111,B10111111,B11111100,B00001111,B00000011, - B11000001,B11100000,B00011110,B00000001,B11100000,B01111111,B00111111,B11111000,B00000000,B00001111,B10111111,B11111100,B00001111,B00000011, - B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111, - B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110, - B01110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00001110, - B00111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00011100, - B00011110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111000, - B00001111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11110000, - 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 - #define START_BMP_BYTEWIDTH ((START_BMPWIDTH + 7) / 8) - #endif - #ifndef START_BMPHEIGHT - #define START_BMPHEIGHT (sizeof(start_bmp) / (START_BMP_BYTEWIDTH)) - #endif - - static_assert(sizeof(start_bmp) == (START_BMP_BYTEWIDTH) * (START_BMPHEIGHT), "Bootscreen (start_bmp) dimensions don't match data."); - -#endif - -#if ENABLED(CUSTOM_STATUS_SCREEN_IMAGE) - - // This file must define STATUS_SCREENWIDTH and status_screen[012]_bmp. - // It can also define STATUS_SCREEN_X, STATUS_SCREEN_{BED,FAN}_TEXT_X and - // STATUS_SCREEN_HOTEND_TEXT_X(i) to modify draw locations. - #include "../../../_Statusscreen.h" - -#else // !CUSTOM_STATUS_SCREEN_IMAGE - - // Can also be overridden in Configuration.h - // If you can afford it, try the 3-frame fan animation! - #ifndef FAN_ANIM_FRAMES - #define FAN_ANIM_FRAMES 2 - #endif - - #if HAS_HEATED_BED - - #define STATUS_SCREEN_X ( 8 + (HOTENDS ? 0 : 64)) - #define STATUS_SCREENWIDTH (120 - (HOTENDS ? 0 : 64)) - - #if HOTENDS == 0 - - #if FAN_ANIM_FRAMES == 3 - const unsigned char status_screen0_bmp[] PROGMEM = { - B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B00000000,B00000000,B00000000,B00000000,B00111110,B00000000,B11111000, - B00000000,B00000000,B00000000,B00000000,B00111001,B00000001,B00111000, - B00000000,B00000000,B00000000,B00000000,B00110111,B10000011,B11011000, - B00000000,B00000000,B00000000,B00000000,B00110111,B10000011,B11011000, - B00000000,B00000000,B00000000,B00000000,B00101111,B11000111,B11101000, - B00000000,B00000000,B00000000,B00000000,B00100111,B11000111,B11001000, - B00000000,B00100000,B10000010,B00000000,B00100001,B11111111,B00001000, - B00000000,B00010000,B01000001,B00000000,B00100000,B01111100,B00001000, - B00000000,B00010000,B01000001,B00000000,B00100000,B01111100,B00001000, - B00000000,B00100000,B10000010,B00000000,B00100000,B01111100,B00001000, - B00000000,B01000001,B00000100,B00000000,B00100001,B11111111,B00001000, - B00000000,B10000010,B00001000,B00000000,B00100111,B11000111,B11001000, - B00000000,B10000010,B00001000,B00000000,B00101111,B11000111,B11101000, - B00000000,B01000001,B00000100,B00000000,B00110111,B10000011,B11011000, - B00000000,B00100000,B10000010,B00000000,B00110111,B10000011,B11011000, - B00000000,B00000000,B00000000,B00000000,B00111001,B00000001,B00111000, - B00000000,B11111111,B11111111,B11000000,B00111110,B00000000,B11111000, - B00000000,B11111111,B11111111,B11000000,B00111111,B11111111,B11111000 - }; - const unsigned char status_screen1_bmp[] PROGMEM = { - B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B00000000,B00000000,B00000000,B00000000,B00111110,B00110000,B11111000, - B00000000,B00000000,B00000000,B00000000,B00111001,B11110000,B00111000, - B00000000,B00000000,B00000000,B00000000,B00110001,B11110000,B00011000, - B00000000,B00000000,B00000000,B00000000,B00110000,B11110000,B00011000, - B00000000,B00000000,B00000000,B00000000,B00100000,B11110000,B01101000, - B00000000,B00000000,B00000000,B00000000,B00100000,B00110001,B11101000, - B00000000,B00100000,B10000010,B00000000,B00100000,B00111001,B11101000, - B00000000,B00010000,B01000001,B00000000,B00100000,B01111111,B11111000, - B00000000,B00010000,B01000001,B00000000,B00111111,B11111111,B11111000, - B00000000,B00100000,B10000010,B00000000,B00111111,B11111100,B00001000, - B00000000,B01000001,B00000100,B00000000,B00101111,B00111000,B00001000, - B00000000,B10000010,B00001000,B00000000,B00101110,B00011000,B00001000, - B00000000,B10000010,B00001000,B00000000,B00101100,B00011110,B00001000, - B00000000,B01000001,B00000100,B00000000,B00110000,B00011110,B00011000, - B00000000,B00100000,B10000010,B00000000,B00110000,B00011111,B00011000, - B00000000,B00000000,B00000000,B00000000,B00111000,B00011111,B00111000, - B00000000,B11111111,B11111111,B11000000,B00111110,B00011000,B11111000, - B00000000,B11111111,B11111111,B11000000,B00111111,B11111111,B11111000 - }; - const unsigned char status_screen2_bmp[] PROGMEM = { - B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B00000000,B00000000,B00000000,B00000000,B00111110,B00011000,B11111000, - B00000000,B00000000,B00000000,B00000000,B00111000,B00011111,B00111000, - B00000000,B00000000,B00000000,B00000000,B00110000,B00011111,B10011000, - B00000000,B00000000,B00000000,B00000000,B00110100,B00011111,B00011000, - B00000000,B00000000,B00000000,B00000000,B00101110,B00011110,B00001000, - B00000000,B00000000,B00000000,B00000000,B00101111,B00011100,B00001000, - B00000000,B00100000,B10000010,B00000000,B00101111,B10111000,B00001000, - B00000000,B00010000,B01000001,B00000000,B00111111,B11111100,B00001000, - B00000000,B00010000,B01000001,B00000000,B00111111,B11111111,B11111000, - B00000000,B00100000,B10000010,B00000000,B00100000,B01111111,B11111000, - B00000000,B01000001,B00000100,B00000000,B00100000,B00111011,B11101000, - B00000000,B10000010,B00001000,B00000000,B00100000,B01110001,B11101000, - B00000000,B10000010,B00001000,B00000000,B00100000,B11110000,B11101000, - B00000000,B01000001,B00000100,B00000000,B00110001,B11110000,B01011000, - B00000000,B00100000,B10000010,B00000000,B00110011,B11110000,B00011000, - B00000000,B00000000,B00000000,B00000000,B00111001,B11110000,B00111000, - B00000000,B11111111,B11111111,B11000000,B00111110,B00110000,B11111000, - B00000000,B11111111,B11111111,B11000000,B00111111,B11111111,B11111000 - }; - #else - const unsigned char status_screen0_bmp[] PROGMEM = { - B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11110000, - B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00000000,B00000000,B00000000,B00000000,B00110000,B11111100,B00110000, - B00000000,B00000000,B00000000,B00000000,B00100000,B11111100,B00010000, - B00000000,B00000000,B00000000,B00000000,B00100000,B01111000,B00010000, - B00000000,B00000000,B00000000,B00000000,B00100000,B00110000,B00010000, - B00000000,B00000000,B00000000,B00000000,B00101100,B00000000,B11010000, - B00000000,B00100000,B10000010,B00000000,B00101110,B00110001,B11010000, - B00000000,B00010000,B01000001,B00000000,B00101111,B01111011,B11010000, - B00000000,B00010000,B01000001,B00000000,B00101111,B01111011,B11010000, - B00000000,B00100000,B10000010,B00000000,B00101110,B00110001,B11010000, - B00000000,B01000001,B00000100,B00000000,B00101100,B00000000,B11010000, - B00000000,B10000010,B00001000,B00000000,B00100000,B00110000,B00010000, - B00000000,B10000010,B00001000,B00000000,B00100000,B01111000,B00010000, - B00000000,B01000001,B00000100,B00000000,B00100000,B11111100,B00010000, - B00000000,B00100000,B10000010,B00000000,B00110000,B11111100,B00110000, - B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00000000,B11111111,B11111111,B11000000,B00111111,B11111111,B11110000, - B00000000,B11111111,B11111111,B11000000,B00000000,B00000000,B00000000 - }; - const unsigned char status_screen1_bmp[] PROGMEM = { - B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11110000, - B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00000000,B00000000,B00000000,B00000000,B00110001,B10000110,B00110000, - B00000000,B00000000,B00000000,B00000000,B00100011,B10000111,B00010000, - B00000000,B00000000,B00000000,B00000000,B00100111,B10000111,B10010000, - B00000000,B00000000,B00000000,B00000000,B00101111,B10000111,B11010000, - B00000000,B00000000,B00000000,B00000000,B00101111,B00000011,B11010000, - B00000000,B00100000,B10000010,B00000000,B00100000,B00110000,B00010000, - B00000000,B00010000,B01000001,B00000000,B00100000,B01111000,B00010000, - B00000000,B00010000,B01000001,B00000000,B00100000,B01111000,B00010000, - B00000000,B00100000,B10000010,B00000000,B00100000,B00110000,B00010000, - B00000000,B01000001,B00000100,B00000000,B00101111,B00000011,B11010000, - B00000000,B10000010,B00001000,B00000000,B00101111,B10000111,B11010000, - B00000000,B10000010,B00001000,B00000000,B00100111,B10000111,B10010000, - B00000000,B01000001,B00000100,B00000000,B00100011,B10000111,B00010000, - B00000000,B00100000,B10000010,B00000000,B00110001,B10000110,B00110000, - B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00000000,B11111111,B11111111,B11000000,B00111111,B11111111,B11110000, - B00000000,B11111111,B11111111,B11000000,B00000000,B00000000,B00000000 - }; - #endif - - #elif HOTENDS == 1 - - #if FAN_ANIM_FRAMES == 3 - const unsigned char status_screen0_bmp[] PROGMEM = { - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B00000000,B11111000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111001,B00000001,B00111000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110111,B10000011,B11011000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110111,B10000011,B11011000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B11000111,B11101000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100111,B11000111,B11001000, - B00111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B10000010,B00000000,B00100001,B11111111,B00001000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00010000,B01000001,B00000000,B00100000,B01111100,B00001000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00010000,B01000001,B00000000,B00100000,B01111100,B00001000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B10000010,B00000000,B00100000,B01111100,B00001000, - B00111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01000001,B00000100,B00000000,B00100001,B11111111,B00001000, - B00111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B10000010,B00001000,B00000000,B00100111,B11000111,B11001000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B10000010,B00001000,B00000000,B00101111,B11000111,B11101000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01000001,B00000100,B00000000,B00110111,B10000011,B11011000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B10000010,B00000000,B00110111,B10000011,B11011000, - B00011111,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111001,B00000001,B00111000, - B00001111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00111110,B00000000,B11111000, - B00000110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00111111,B11111111,B11111000 - }; - const unsigned char status_screen1_bmp[] PROGMEM = { - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B00110000,B11111000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111001,B11110000,B00111000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110001,B11110000,B00011000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B11110000,B00011000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B11110000,B01101000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B00110001,B11101000, - B00111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B10000010,B00000000,B00100000,B00111001,B11101000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00010000,B01000001,B00000000,B00100000,B01111111,B11111000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00010000,B01000001,B00000000,B00111111,B11111111,B11111000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B10000010,B00000000,B00111111,B11111100,B00001000, - B00111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01000001,B00000100,B00000000,B00101111,B00111000,B00001000, - B00111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B10000010,B00001000,B00000000,B00101110,B00011000,B00001000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B10000010,B00001000,B00000000,B00101100,B00011110,B00001000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01000001,B00000100,B00000000,B00110000,B00011110,B00011000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B10000010,B00000000,B00110000,B00011111,B00011000, - B00011111,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00011111,B00111000, - B00001111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00111110,B00011000,B11111000, - B00000110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00111111,B11111111,B11111000 - }; - const unsigned char status_screen2_bmp[] PROGMEM = { - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B00011000,B11111000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00011111,B00111000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B00011111,B10011000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110100,B00011111,B00011000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101110,B00011110,B00001000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B00011100,B00001000, - B00111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B10000010,B00000000,B00101111,B10111000,B00001000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00010000,B01000001,B00000000,B00111111,B11111100,B00001000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00010000,B01000001,B00000000,B00111111,B11111111,B11111000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B10000010,B00000000,B00100000,B01111111,B11111000, - B00111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01000001,B00000100,B00000000,B00100000,B00111011,B11101000, - B00111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B10000010,B00001000,B00000000,B00100000,B01110001,B11101000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B10000010,B00001000,B00000000,B00100000,B11110000,B11101000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01000001,B00000100,B00000000,B00110001,B11110000,B01011000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B10000010,B00000000,B00110011,B11110000,B00011000, - B00011111,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111001,B11110000,B00111000, - B00001111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00111110,B00110000,B11111000, - B00000110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00111111,B11111111,B11111000 - }; - #else - const unsigned char status_screen0_bmp[] PROGMEM = { - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B11111100,B00110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B11111100,B00010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B01111000,B00010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B00110000,B00010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101100,B00000000,B11010000, - B00111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B10000010,B00000000,B00101110,B00110001,B11010000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00010000,B01000001,B00000000,B00101111,B01111011,B11010000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00010000,B01000001,B00000000,B00101111,B01111011,B11010000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B10000010,B00000000,B00101110,B00110001,B11010000, - B00111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01000001,B00000100,B00000000,B00101100,B00000000,B11010000, - B00111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B10000010,B00001000,B00000000,B00100000,B00110000,B00010000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B10000010,B00001000,B00000000,B00100000,B01111000,B00010000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01000001,B00000100,B00000000,B00100000,B11111100,B00010000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B10000010,B00000000,B00110000,B11111100,B00110000, - B00011111,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00001111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00111111,B11111111,B11110000, - B00000110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00000000,B00000000 - }; - const unsigned char status_screen1_bmp[] PROGMEM = { - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110001,B10000110,B00110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100011,B10000111,B00010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100111,B10000111,B10010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B10000111,B11010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B00000011,B11010000, - B00111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B10000010,B00000000,B00100000,B00110000,B00010000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00010000,B01000001,B00000000,B00100000,B01111000,B00010000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00010000,B01000001,B00000000,B00100000,B01111000,B00010000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B10000010,B00000000,B00100000,B00110000,B00010000, - B00111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01000001,B00000100,B00000000,B00101111,B00000011,B11010000, - B00111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B10000010,B00001000,B00000000,B00101111,B10000111,B11010000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B10000010,B00001000,B00000000,B00100111,B10000111,B10010000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01000001,B00000100,B00000000,B00100011,B10000111,B00010000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B10000010,B00000000,B00110001,B10000110,B00110000, - B00011111,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00001111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00111111,B11111111,B11110000, - B00000110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00000000,B00000000 - }; - #endif - - #elif HOTENDS == 2 - - #if FAN_ANIM_FRAMES == 3 - const unsigned char status_screen0_bmp[] PROGMEM = { - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B00000000,B11111000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111001,B00000001,B00111000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110111,B10000011,B11011000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110111,B10000011,B11011000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B11000111,B11101000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100111,B11000111,B11001000, - B00111111,B11000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00000000,B00000000,B00100000,B10000010,B00000000,B00100001,B11111111,B00001000, - B01111101,B11100000,B00000000,B00111100,B11110000,B00000000,B00000000,B00000000,B00000000,B00010000,B01000001,B00000000,B00100000,B01111100,B00001000, - B01111001,B11100000,B00000000,B00111011,B01110000,B00000000,B00000000,B00000000,B00000000,B00010000,B01000001,B00000000,B00100000,B01111100,B00001000, - B01110101,B11100000,B00000000,B00111111,B01110000,B00000000,B00000000,B00000000,B00000000,B00100000,B10000010,B00000000,B00100000,B01111100,B00001000, - B00111101,B11000000,B00000000,B00011110,B11100000,B00000000,B00000000,B00000000,B00000000,B01000001,B00000100,B00000000,B00100001,B11111111,B00001000, - B00111101,B11000000,B00000000,B00011101,B11100000,B00000000,B00000000,B00000000,B00000000,B10000010,B00001000,B00000000,B00100111,B11000111,B11001000, - B01111101,B11100000,B00000000,B00111011,B11110000,B00000000,B00000000,B00000000,B00000000,B10000010,B00001000,B00000000,B00101111,B11000111,B11101000, - B01111101,B11100000,B00000000,B00111000,B01110000,B00000000,B00000000,B00000000,B00000000,B01000001,B00000100,B00000000,B00110111,B10000011,B11011000, - B01111111,B11100000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000000,B00000000,B00100000,B10000010,B00000000,B00110111,B10000011,B11011000, - B00011111,B10000000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111001,B00000001,B00111000, - B00001111,B00000000,B00000000,B00000111,B10000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00111110,B00000000,B11111000, - B00000110,B00000000,B00000000,B00000011,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00111111,B11111111,B11111000 - }; - const unsigned char status_screen1_bmp[] PROGMEM = { - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B00110000,B11111000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111001,B11110000,B00111000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110001,B11110000,B00011000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B11110000,B00011000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B11110000,B01101000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B00110001,B11101000, - B00111111,B11000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00000000,B00000000,B00100000,B10000010,B00000000,B00100000,B00111001,B11101000, - B01111101,B11100000,B00000000,B00111100,B11110000,B00000000,B00000000,B00000000,B00000000,B00010000,B01000001,B00000000,B00100000,B01111111,B11111000, - B01111001,B11100000,B00000000,B00111011,B01110000,B00000000,B00000000,B00000000,B00000000,B00010000,B01000001,B00000000,B00111111,B11111111,B11111000, - B01110101,B11100000,B00000000,B00111111,B01110000,B00000000,B00000000,B00000000,B00000000,B00100000,B10000010,B00000000,B00111111,B11111100,B00001000, - B00111101,B11000000,B00000000,B00011110,B11100000,B00000000,B00000000,B00000000,B00000000,B01000001,B00000100,B00000000,B00101111,B00111000,B00001000, - B00111101,B11000000,B00000000,B00011101,B11100000,B00000000,B00000000,B00000000,B00000000,B10000010,B00001000,B00000000,B00101110,B00011000,B00001000, - B01111101,B11100000,B00000000,B00111011,B11110000,B00000000,B00000000,B00000000,B00000000,B10000010,B00001000,B00000000,B00101100,B00011110,B00001000, - B01111101,B11100000,B00000000,B00111000,B01110000,B00000000,B00000000,B00000000,B00000000,B01000001,B00000100,B00000000,B00110000,B00011110,B00011000, - B01111111,B11100000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000000,B00000000,B00100000,B10000010,B00000000,B00110000,B00011111,B00011000, - B00011111,B10000000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00011111,B00111000, - B00001111,B00000000,B00000000,B00000111,B10000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00111110,B00011000,B11111000, - B00000110,B00000000,B00000000,B00000011,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00111111,B11111111,B11111000 - }; - const unsigned char status_screen2_bmp[] PROGMEM = { - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B00011000,B11111000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00011111,B00111000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B00011111,B10011000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110100,B00011111,B00011000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101110,B00011110,B00001000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B00011100,B00001000, - B00111111,B11000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00000000,B00000000,B00100000,B10000010,B00000000,B00101111,B10111000,B00001000, - B01111101,B11100000,B00000000,B00111100,B11110000,B00000000,B00000000,B00000000,B00000000,B00010000,B01000001,B00000000,B00111111,B11111100,B00001000, - B01111001,B11100000,B00000000,B00111011,B01110000,B00000000,B00000000,B00000000,B00000000,B00010000,B01000001,B00000000,B00111111,B11111111,B11111000, - B01110101,B11100000,B00000000,B00111111,B01110000,B00000000,B00000000,B00000000,B00000000,B00100000,B10000010,B00000000,B00100000,B01111111,B11111000, - B00111101,B11000000,B00000000,B00011110,B11100000,B00000000,B00000000,B00000000,B00000000,B01000001,B00000100,B00000000,B00100000,B00111011,B11101000, - B00111101,B11000000,B00000000,B00011101,B11100000,B00000000,B00000000,B00000000,B00000000,B10000010,B00001000,B00000000,B00100000,B01110001,B11101000, - B01111101,B11100000,B00000000,B00111011,B11110000,B00000000,B00000000,B00000000,B00000000,B10000010,B00001000,B00000000,B00100000,B11110000,B11101000, - B01111101,B11100000,B00000000,B00111000,B01110000,B00000000,B00000000,B00000000,B00000000,B01000001,B00000100,B00000000,B00110001,B11110000,B01011000, - B01111111,B11100000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000000,B00000000,B00100000,B10000010,B00000000,B00110011,B11110000,B00011000, - B00011111,B10000000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111001,B11110000,B00111000, - B00001111,B00000000,B00000000,B00000111,B10000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00111110,B00110000,B11111000, - B00000110,B00000000,B00000000,B00000011,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00111111,B11111111,B11111000 - }; - #else - const unsigned char status_screen0_bmp[] PROGMEM = { - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B11111100,B00110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B11111100,B00010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B01111000,B00010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B00110000,B00010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101100,B00000000,B11010000, - B00111111,B11000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00000000,B00000000,B00100000,B10000010,B00000000,B00101110,B00110001,B11010000, - B01111101,B11100000,B00000000,B00111100,B11110000,B00000000,B00000000,B00000000,B00000000,B00010000,B01000001,B00000000,B00101111,B01111011,B11010000, - B01111001,B11100000,B00000000,B00111011,B01110000,B00000000,B00000000,B00000000,B00000000,B00010000,B01000001,B00000000,B00101111,B01111011,B11010000, - B01110101,B11100000,B00000000,B00111111,B01110000,B00000000,B00000000,B00000000,B00000000,B00100000,B10000010,B00000000,B00101110,B00110001,B11010000, - B00111101,B11000000,B00000000,B00011110,B11100000,B00000000,B00000000,B00000000,B00000000,B01000001,B00000100,B00000000,B00101100,B00000000,B11010000, - B00111101,B11000000,B00000000,B00011101,B11100000,B00000000,B00000000,B00000000,B00000000,B10000010,B00001000,B00000000,B00100000,B00110000,B00010000, - B01111101,B11100000,B00000000,B00111011,B11110000,B00000000,B00000000,B00000000,B00000000,B10000010,B00001000,B00000000,B00100000,B01111000,B00010000, - B01111101,B11100000,B00000000,B00111000,B01110000,B00000000,B00000000,B00000000,B00000000,B01000001,B00000100,B00000000,B00100000,B11111100,B00010000, - B01111111,B11100000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000000,B00000000,B00100000,B10000010,B00000000,B00110000,B11111100,B00110000, - B00011111,B10000000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00001111,B00000000,B00000000,B00000111,B10000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00111111,B11111111,B11110000, - B00000110,B00000000,B00000000,B00000011,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00000000,B00000000 - }; - const unsigned char status_screen1_bmp[] PROGMEM = { - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110001,B10000110,B00110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100011,B10000111,B00010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100111,B10000111,B10010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B10000111,B11010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B00000011,B11010000, - B00111111,B11000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00000000,B00000000,B00100000,B10000010,B00000000,B00100000,B00110000,B00010000, - B01111101,B11100000,B00000000,B00111100,B11110000,B00000000,B00000000,B00000000,B00000000,B00010000,B01000001,B00000000,B00100000,B01111000,B00010000, - B01111001,B11100000,B00000000,B00111011,B01110000,B00000000,B00000000,B00000000,B00000000,B00010000,B01000001,B00000000,B00100000,B01111000,B00010000, - B01110101,B11100000,B00000000,B00111111,B01110000,B00000000,B00000000,B00000000,B00000000,B00100000,B10000010,B00000000,B00100000,B00110000,B00010000, - B00111101,B11000000,B00000000,B00011110,B11100000,B00000000,B00000000,B00000000,B00000000,B01000001,B00000100,B00000000,B00101111,B00000011,B11010000, - B00111101,B11000000,B00000000,B00011101,B11100000,B00000000,B00000000,B00000000,B00000000,B10000010,B00001000,B00000000,B00101111,B10000111,B11010000, - B01111101,B11100000,B00000000,B00111011,B11110000,B00000000,B00000000,B00000000,B00000000,B10000010,B00001000,B00000000,B00100111,B10000111,B10010000, - B01111101,B11100000,B00000000,B00111000,B01110000,B00000000,B00000000,B00000000,B00000000,B01000001,B00000100,B00000000,B00100011,B10000111,B00010000, - B01111111,B11100000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000000,B00000000,B00100000,B10000010,B00000000,B00110001,B10000110,B00110000, - B00011111,B10000000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00001111,B00000000,B00000000,B00000111,B10000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00111111,B11111111,B11110000, - B00000110,B00000000,B00000000,B00000011,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00000000,B00000000 - }; - #endif - - #else // HOTENDS > 2 - - #if FAN_ANIM_FRAMES == 3 - const unsigned char status_screen0_bmp[] PROGMEM = { - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B00000000,B11111000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111001,B00000001,B00111000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110111,B10000011,B11011000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110111,B10000011,B11011000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B11000111,B11101000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100111,B11000111,B11001000, - B00111111,B11000000,B00000000,B00011111,B11100000,B00000000,B00011111,B11100000,B00000000,B00100000,B10000010,B00000000,B00100001,B11111111,B00001000, - B01111101,B11100000,B00000000,B00111100,B11110000,B00000000,B00111100,B11110000,B00000000,B00010000,B01000001,B00000000,B00100000,B01111100,B00001000, - B01111001,B11100000,B00000000,B00111011,B01110000,B00000000,B00111011,B01110000,B00000000,B00010000,B01000001,B00000000,B00100000,B01111100,B00001000, - B01110101,B11100000,B00000000,B00111111,B01110000,B00000000,B00111111,B01110000,B00000000,B00100000,B10000010,B00000000,B00100000,B01111100,B00001000, - B00111101,B11000000,B00000000,B00011110,B11100000,B00000000,B00011100,B11100000,B00000000,B01000001,B00000100,B00000000,B00100001,B11111111,B00001000, - B00111101,B11000000,B00000000,B00011101,B11100000,B00000000,B00011111,B01100000,B00000000,B10000010,B00001000,B00000000,B00100111,B11000111,B11001000, - B01111101,B11100000,B00000000,B00111011,B11110000,B00000000,B00111011,B01110000,B00000000,B10000010,B00001000,B00000000,B00101111,B11000111,B11101000, - B01111101,B11100000,B00000000,B00111000,B01110000,B00000000,B00111100,B11110000,B00000000,B01000001,B00000100,B00000000,B00110111,B10000011,B11011000, - B01111111,B11100000,B00000000,B00111111,B11110000,B00000000,B00111111,B11110000,B00000000,B00100000,B10000010,B00000000,B00110111,B10000011,B11011000, - B00011111,B10000000,B00000000,B00001111,B11000000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00111001,B00000001,B00111000, - B00001111,B00000000,B00000000,B00000111,B10000000,B00000000,B00000111,B10000000,B00000000,B11111111,B11111111,B11000000,B00111110,B00000000,B11111000, - B00000110,B00000000,B00000000,B00000011,B00000000,B00000000,B00000011,B00000000,B00000000,B11111111,B11111111,B11000000,B00111111,B11111111,B11111000 - }; - const unsigned char status_screen1_bmp[] PROGMEM = { - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B00110000,B11111000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111001,B11110000,B00111000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110001,B11110000,B00011000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B11110000,B00011000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B11110000,B01101000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B00110001,B11101000, - B00111111,B11000000,B00000000,B00011111,B11100000,B00000000,B00011111,B11100000,B00000000,B00100000,B10000010,B00000000,B00100000,B00111001,B11101000, - B01111101,B11100000,B00000000,B00111100,B11110000,B00000000,B00111100,B11110000,B00000000,B00010000,B01000001,B00000000,B00100000,B01111111,B11111000, - B01111001,B11100000,B00000000,B00111011,B01110000,B00000000,B00111011,B01110000,B00000000,B00010000,B01000001,B00000000,B00111111,B11111111,B11111000, - B01110101,B11100000,B00000000,B00111111,B01110000,B00000000,B00111111,B01110000,B00000000,B00100000,B10000010,B00000000,B00111111,B11111100,B00001000, - B00111101,B11000000,B00000000,B00011110,B11100000,B00000000,B00011100,B11100000,B00000000,B01000001,B00000100,B00000000,B00101111,B00111000,B00001000, - B00111101,B11000000,B00000000,B00011101,B11100000,B00000000,B00011111,B01100000,B00000000,B10000010,B00001000,B00000000,B00101110,B00011000,B00001000, - B01111101,B11100000,B00000000,B00111011,B11110000,B00000000,B00111011,B01110000,B00000000,B10000010,B00001000,B00000000,B00101100,B00011110,B00001000, - B01111101,B11100000,B00000000,B00111000,B01110000,B00000000,B00111100,B11110000,B00000000,B01000001,B00000100,B00000000,B00110000,B00011110,B00011000, - B01111111,B11100000,B00000000,B00111111,B11110000,B00000000,B00111111,B11110000,B00000000,B00100000,B10000010,B00000000,B00110000,B00011111,B00011000, - B00011111,B10000000,B00000000,B00001111,B11000000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00011111,B00111000, - B00001111,B00000000,B00000000,B00000111,B10000000,B00000000,B00000111,B10000000,B00000000,B11111111,B11111111,B11000000,B00111110,B00011000,B11111000, - B00000110,B00000000,B00000000,B00000011,B00000000,B00000000,B00000011,B00000000,B00000000,B11111111,B11111111,B11000000,B00111111,B11111111,B11111000 - }; - const unsigned char status_screen2_bmp[] PROGMEM = { - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B00011000,B11111000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00011111,B00111000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B00011111,B10011000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110100,B00011111,B00011000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101110,B00011110,B00001000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B00011100,B00001000, - B00111111,B11000000,B00000000,B00011111,B11100000,B00000000,B00011111,B11100000,B00000000,B00100000,B10000010,B00000000,B00101111,B10111000,B00001000, - B01111101,B11100000,B00000000,B00111100,B11110000,B00000000,B00111100,B11110000,B00000000,B00010000,B01000001,B00000000,B00111111,B11111100,B00001000, - B01111001,B11100000,B00000000,B00111011,B01110000,B00000000,B00111011,B01110000,B00000000,B00010000,B01000001,B00000000,B00111111,B11111111,B11111000, - B01110101,B11100000,B00000000,B00111111,B01110000,B00000000,B00111111,B01110000,B00000000,B00100000,B10000010,B00000000,B00100000,B01111111,B11111000, - B00111101,B11000000,B00000000,B00011110,B11100000,B00000000,B00011100,B11100000,B00000000,B01000001,B00000100,B00000000,B00100000,B00111011,B11101000, - B00111101,B11000000,B00000000,B00011101,B11100000,B00000000,B00011111,B01100000,B00000000,B10000010,B00001000,B00000000,B00100000,B01110001,B11101000, - B01111101,B11100000,B00000000,B00111011,B11110000,B00000000,B00111011,B01110000,B00000000,B10000010,B00001000,B00000000,B00100000,B11110000,B11101000, - B01111101,B11100000,B00000000,B00111000,B01110000,B00000000,B00111100,B11110000,B00000000,B01000001,B00000100,B00000000,B00110001,B11110000,B01011000, - B01111111,B11100000,B00000000,B00111111,B11110000,B00000000,B00111111,B11110000,B00000000,B00100000,B10000010,B00000000,B00110011,B11110000,B00011000, - B00011111,B10000000,B00000000,B00001111,B11000000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00111001,B11110000,B00111000, - B00001111,B00000000,B00000000,B00000111,B10000000,B00000000,B00000111,B10000000,B00000000,B11111111,B11111111,B11000000,B00111110,B00110000,B11111000, - B00000110,B00000000,B00000000,B00000011,B00000000,B00000000,B00000011,B00000000,B00000000,B11111111,B11111111,B11000000,B00111111,B11111111,B11111000 - }; - #else - const unsigned char status_screen0_bmp[] PROGMEM = { - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B11111100,B00110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B11111100,B00010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B01111000,B00010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B00110000,B00010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101100,B00000000,B11010000, - B00111111,B11000000,B00000000,B00011111,B11100000,B00000000,B00011111,B11100000,B00000000,B00100000,B10000010,B00000000,B00101110,B00110001,B11010000, - B01111101,B11100000,B00000000,B00111100,B11110000,B00000000,B00111100,B11110000,B00000000,B00010000,B01000001,B00000000,B00101111,B01111011,B11010000, - B01111001,B11100000,B00000000,B00111011,B01110000,B00000000,B00111011,B01110000,B00000000,B00010000,B01000001,B00000000,B00101111,B01111011,B11010000, - B01110101,B11100000,B00000000,B00111111,B01110000,B00000000,B00111111,B01110000,B00000000,B00100000,B10000010,B00000000,B00101110,B00110001,B11010000, - B00111101,B11000000,B00000000,B00011110,B11100000,B00000000,B00011100,B11100000,B00000000,B01000001,B00000100,B00000000,B00101100,B00000000,B11010000, - B00111101,B11000000,B00000000,B00011101,B11100000,B00000000,B00011111,B01100000,B00000000,B10000010,B00001000,B00000000,B00100000,B00110000,B00010000, - B01111101,B11100000,B00000000,B00111011,B11110000,B00000000,B00111011,B01110000,B00000000,B10000010,B00001000,B00000000,B00100000,B01111000,B00010000, - B01111101,B11100000,B00000000,B00111000,B01110000,B00000000,B00111100,B11110000,B00000000,B01000001,B00000100,B00000000,B00100000,B11111100,B00010000, - B01111111,B11100000,B00000000,B00111111,B11110000,B00000000,B00111111,B11110000,B00000000,B00100000,B10000010,B00000000,B00110000,B11111100,B00110000, - B00011111,B10000000,B00000000,B00001111,B11000000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00001111,B00000000,B00000000,B00000111,B10000000,B00000000,B00000111,B10000000,B00000000,B11111111,B11111111,B11000000,B00111111,B11111111,B11110000, - B00000110,B00000000,B00000000,B00000011,B00000000,B00000000,B00000011,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00000000,B00000000 - }; - const unsigned char status_screen1_bmp[] PROGMEM = { - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110001,B10000110,B00110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100011,B10000111,B00010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100111,B10000111,B10010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B10000111,B11010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B00000011,B11010000, - B00111111,B11000000,B00000000,B00011111,B11100000,B00000000,B00011111,B11100000,B00000000,B00100000,B10000010,B00000000,B00100000,B00110000,B00010000, - B01111101,B11100000,B00000000,B00111100,B11110000,B00000000,B00111100,B11110000,B00000000,B00010000,B01000001,B00000000,B00100000,B01111000,B00010000, - B01111001,B11100000,B00000000,B00111011,B01110000,B00000000,B00111011,B01110000,B00000000,B00010000,B01000001,B00000000,B00100000,B01111000,B00010000, - B01110101,B11100000,B00000000,B00111111,B01110000,B00000000,B00111111,B01110000,B00000000,B00100000,B10000010,B00000000,B00100000,B00110000,B00010000, - B00111101,B11000000,B00000000,B00011110,B11100000,B00000000,B00011100,B11100000,B00000000,B01000001,B00000100,B00000000,B00101111,B00000011,B11010000, - B00111101,B11000000,B00000000,B00011101,B11100000,B00000000,B00011111,B01100000,B00000000,B10000010,B00001000,B00000000,B00101111,B10000111,B11010000, - B01111101,B11100000,B00000000,B00111011,B11110000,B00000000,B00111011,B01110000,B00000000,B10000010,B00001000,B00000000,B00100111,B10000111,B10010000, - B01111101,B11100000,B00000000,B00111000,B01110000,B00000000,B00111100,B11110000,B00000000,B01000001,B00000100,B00000000,B00100011,B10000111,B00010000, - B01111111,B11100000,B00000000,B00111111,B11110000,B00000000,B00111111,B11110000,B00000000,B00100000,B10000010,B00000000,B00110001,B10000110,B00110000, - B00011111,B10000000,B00000000,B00001111,B11000000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00001111,B00000000,B00000000,B00000111,B10000000,B00000000,B00000111,B10000000,B00000000,B11111111,B11111111,B11000000,B00111111,B11111111,B11110000, - B00000110,B00000000,B00000000,B00000011,B00000000,B00000000,B00000011,B00000000,B00000000,B11111111,B11111111,B11000000,B00000000,B00000000,B00000000 - }; - #endif - - #endif // HOTENDS - - #else // !HAS_HEATED_BED - - #define STATUS_SCREEN_X ( 8 + (HOTENDS ? 0 : 96)) - #define STATUS_SCREENWIDTH (120 - (HOTENDS ? 0 : 96)) - - #if HOTENDS == 0 - - #if FAN_ANIM_FRAMES == 3 - const unsigned char status_screen0_bmp[] PROGMEM = { - B00111111,B11111111,B11111000, - B00111110,B00000000,B11111000, - B00111001,B00000001,B00111000, - B00110111,B10000011,B11011000, - B00110111,B10000011,B11011000, - B00101111,B11000111,B11101000, - B00100111,B11000111,B11001000, - B00100001,B11111111,B00001000, - B00100000,B01111100,B00001000, - B00100000,B01111100,B00001000, - B00100000,B01111100,B00001000, - B00100001,B11111111,B00001000, - B00100111,B11000111,B11001000, - B00101111,B11000111,B11101000, - B00110111,B10000011,B11011000, - B00110111,B10000011,B11011000, - B00111001,B00000001,B00111000, - B00111110,B00000000,B11111000, - B00111111,B11111111,B11111000 - }; - const unsigned char status_screen1_bmp[] PROGMEM = { - B00111111,B11111111,B11111000, - B00111110,B00110000,B11111000, - B00111001,B11110000,B00111000, - B00110001,B11110000,B00011000, - B00110000,B11110000,B00011000, - B00100000,B11110000,B01101000, - B00100000,B00110001,B11101000, - B00100000,B00111001,B11101000, - B00100000,B01111111,B11111000, - B00111111,B11111111,B11111000, - B00111111,B11111100,B00001000, - B00101111,B00111000,B00001000, - B00101110,B00011000,B00001000, - B00101100,B00011110,B00001000, - B00110000,B00011110,B00011000, - B00110000,B00011111,B00011000, - B00111000,B00011111,B00111000, - B00111110,B00011000,B11111000, - B00111111,B11111111,B11111000 - }; - const unsigned char status_screen2_bmp[] PROGMEM = { - B00111111,B11111111,B11111000, - B00111110,B00011000,B11111000, - B00111000,B00011111,B00111000, - B00110000,B00011111,B10011000, - B00110100,B00011111,B00011000, - B00101110,B00011110,B00001000, - B00101111,B00011100,B00001000, - B00101111,B10111000,B00001000, - B00111111,B11111100,B00001000, - B00111111,B11111111,B11111000, - B00100000,B01111111,B11111000, - B00100000,B00111011,B11101000, - B00100000,B01110001,B11101000, - B00100000,B11110000,B11101000, - B00110001,B11110000,B01011000, - B00110011,B11110000,B00011000, - B00111001,B11110000,B00111000, - B00111110,B00110000,B11111000, - B00111111,B11111111,B11111000 - }; - #else - const unsigned char status_screen0_bmp[] PROGMEM = { - B00111111,B11111111,B11110000, - B00111000,B00000000,B01110000, - B00110000,B11111100,B00110000, - B00100000,B11111100,B00010000, - B00100000,B01111000,B00010000, - B00100000,B00110000,B00010000, - B00101100,B00000000,B11010000, - B00101110,B00110001,B11010000, - B00101111,B01111011,B11010000, - B00101111,B01111011,B11010000, - B00101110,B00110001,B11010000, - B00101100,B00000000,B11010000, - B00100000,B00110000,B00010000, - B00100000,B01111000,B00010000, - B00100000,B11111100,B00010000, - B00110000,B11111100,B00110000, - B00111000,B00000000,B01110000, - B00111111,B11111111,B11110000, - B00000000,B00000000,B00000000 - }; - const unsigned char status_screen1_bmp[] PROGMEM = { - B00111111,B11111111,B11110000, - B00111000,B00000000,B01110000, - B00110001,B10000110,B00110000, - B00100011,B10000111,B00010000, - B00100111,B10000111,B10010000, - B00101111,B10000111,B11010000, - B00101111,B00000011,B11010000, - B00100000,B00110000,B00010000, - B00100000,B01111000,B00010000, - B00100000,B01111000,B00010000, - B00100000,B00110000,B00010000, - B00101111,B00000011,B11010000, - B00101111,B10000111,B11010000, - B00100111,B10000111,B10010000, - B00100011,B10000111,B00010000, - B00110001,B10000110,B00110000, - B00111000,B00000000,B01110000, - B00111111,B11111111,B11110000, - B00000000,B00000000,B00000000 - }; - #endif - - #elif HOTENDS == 1 - - #if FAN_ANIM_FRAMES == 3 - const unsigned char status_screen0_bmp[] PROGMEM = { - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B00000000,B11111000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111001,B00000001,B00111000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110111,B10000011,B11011000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110111,B10000011,B11011000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B11000111,B11101000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100111,B11000111,B11001000, - B00111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100001,B11111111,B00001000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B01111100,B00001000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B01111100,B00001000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B01111100,B00001000, - B00111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100001,B11111111,B00001000, - B00111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100111,B11000111,B11001000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B11000111,B11101000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110111,B10000011,B11011000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110111,B10000011,B11011000, - B00011111,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111001,B00000001,B00111000, - B00001111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B00000000,B11111000, - B00000110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000 - }; - const unsigned char status_screen1_bmp[] PROGMEM = { - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B00110000,B11111000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111001,B11110000,B00111000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110001,B11110000,B00011000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B11110000,B00011000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B11110000,B01101000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B00110001,B11101000, - B00111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B00111001,B11101000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B01111111,B11111000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111100,B00001000, - B00111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B00111000,B00001000, - B00111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101110,B00011000,B00001000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101100,B00011110,B00001000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B00011110,B00011000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B00011111,B00011000, - B00011111,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00011111,B00111000, - B00001111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B00011000,B11111000, - B00000110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000 - }; - const unsigned char status_screen2_bmp[] PROGMEM = { - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B00011000,B11111000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00011111,B00111000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B00011111,B10011000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110100,B00011111,B00011000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101110,B00011110,B00001000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B00011100,B00001000, - B00111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B10111000,B00001000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111100,B00001000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B01111111,B11111000, - B00111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B00111011,B11101000, - B00111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B01110001,B11101000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B11110000,B11101000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110001,B11110000,B01011000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110011,B11110000,B00011000, - B00011111,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111001,B11110000,B00111000, - B00001111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B00110000,B11111000, - B00000110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000 - }; - #else - const unsigned char status_screen0_bmp[] PROGMEM = { - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B11111100,B00110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B11111100,B00010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B01111000,B00010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B00110000,B00010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101100,B00000000,B11010000, - B00111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101110,B00110001,B11010000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B01111011,B11010000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B01111011,B11010000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101110,B00110001,B11010000, - B00111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101100,B00000000,B11010000, - B00111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B00110000,B00010000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B01111000,B00010000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B11111100,B00010000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B11111100,B00110000, - B00011111,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00001111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11110000, - B00000110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000 - }; - const unsigned char status_screen1_bmp[] PROGMEM = { - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110001,B10000110,B00110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100011,B10000111,B00010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100111,B10000111,B10010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B10000111,B11010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B00000011,B11010000, - B00111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B00110000,B00010000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B01111000,B00010000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B01111000,B00010000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B00110000,B00010000, - B00111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B00000011,B11010000, - B00111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B10000111,B11010000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100111,B10000111,B10010000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100011,B10000111,B00010000, - B01111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110001,B10000110,B00110000, - B00011111,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00001111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11110000, - B00000110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000 - }; - #endif - - #elif HOTENDS == 2 - - #if FAN_ANIM_FRAMES == 3 - const unsigned char status_screen0_bmp[] PROGMEM = { - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B00000000,B11111000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111001,B00000001,B00111000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110111,B10000011,B11011000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110111,B10000011,B11011000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B11000111,B11101000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100111,B11000111,B11001000, - B00111111,B11000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100001,B11111111,B00001000, - B01111101,B11100000,B00000000,B00111100,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B01111100,B00001000, - B01111001,B11100000,B00000000,B00111011,B01110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B01111100,B00001000, - B01110101,B11100000,B00000000,B00111111,B01110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B01111100,B00001000, - B00111101,B11000000,B00000000,B00011110,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100001,B11111111,B00001000, - B00111101,B11000000,B00000000,B00011101,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100111,B11000111,B11001000, - B01111101,B11100000,B00000000,B00111011,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B11000111,B11101000, - B01111101,B11100000,B00000000,B00111000,B01110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110111,B10000011,B11011000, - B01111111,B11100000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110111,B10000011,B11011000, - B00011111,B10000000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111001,B00000001,B00111000, - B00001111,B00000000,B00000000,B00000111,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B00000000,B11111000, - B00000110,B00000000,B00000000,B00000011,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000 - }; - const unsigned char status_screen1_bmp[] PROGMEM = { - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B00110000,B11111000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111001,B11110000,B00111000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110001,B11110000,B00011000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B11110000,B00011000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B11110000,B01101000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B00110001,B11101000, - B00111111,B11000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B00111001,B11101000, - B01111101,B11100000,B00000000,B00111100,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B01111111,B11111000, - B01111001,B11100000,B00000000,B00111011,B01110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B01110101,B11100000,B00000000,B00111111,B01110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111100,B00001000, - B00111101,B11000000,B00000000,B00011110,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B00111000,B00001000, - B00111101,B11000000,B00000000,B00011101,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101110,B00011000,B00001000, - B01111101,B11100000,B00000000,B00111011,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101100,B00011110,B00001000, - B01111101,B11100000,B00000000,B00111000,B01110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B00011110,B00011000, - B01111111,B11100000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B00011111,B00011000, - B00011111,B10000000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00011111,B00111000, - B00001111,B00000000,B00000000,B00000111,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B00011000,B11111000, - B00000110,B00000000,B00000000,B00000011,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000 - }; - const unsigned char status_screen2_bmp[] PROGMEM = { - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B00011000,B11111000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00011111,B00111000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B00011111,B10011000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110100,B00011111,B00011000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101110,B00011110,B00001000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B00011100,B00001000, - B00111111,B11000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B10111000,B00001000, - B01111101,B11100000,B00000000,B00111100,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111100,B00001000, - B01111001,B11100000,B00000000,B00111011,B01110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B01110101,B11100000,B00000000,B00111111,B01110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B01111111,B11111000, - B00111101,B11000000,B00000000,B00011110,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B00111011,B11101000, - B00111101,B11000000,B00000000,B00011101,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B01110001,B11101000, - B01111101,B11100000,B00000000,B00111011,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B11110000,B11101000, - B01111101,B11100000,B00000000,B00111000,B01110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110001,B11110000,B01011000, - B01111111,B11100000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110011,B11110000,B00011000, - B00011111,B10000000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111001,B11110000,B00111000, - B00001111,B00000000,B00000000,B00000111,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B00110000,B11111000, - B00000110,B00000000,B00000000,B00000011,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000 - }; - #else - const unsigned char status_screen0_bmp[] PROGMEM = { - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B11111100,B00110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B11111100,B00010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B01111000,B00010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B00110000,B00010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101100,B00000000,B11010000, - B00111111,B11000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101110,B00110001,B11010000, - B01111101,B11100000,B00000000,B00111100,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B01111011,B11010000, - B01111001,B11100000,B00000000,B00111011,B01110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B01111011,B11010000, - B01110101,B11100000,B00000000,B00111111,B01110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101110,B00110001,B11010000, - B00111101,B11000000,B00000000,B00011110,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101100,B00000000,B11010000, - B00111101,B11000000,B00000000,B00011101,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B00110000,B00010000, - B01111101,B11100000,B00000000,B00111011,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B01111000,B00010000, - B01111101,B11100000,B00000000,B00111000,B01110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B11111100,B00010000, - B01111111,B11100000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B11111100,B00110000, - B00011111,B10000000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00001111,B00000000,B00000000,B00000111,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11110000, - B00000110,B00000000,B00000000,B00000011,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000 - }; - const unsigned char status_screen1_bmp[] PROGMEM = { - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110001,B10000110,B00110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100011,B10000111,B00010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100111,B10000111,B10010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B10000111,B11010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B00000011,B11010000, - B00111111,B11000000,B00000000,B00011111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B00110000,B00010000, - B01111101,B11100000,B00000000,B00111100,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B01111000,B00010000, - B01111001,B11100000,B00000000,B00111011,B01110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B01111000,B00010000, - B01110101,B11100000,B00000000,B00111111,B01110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B00110000,B00010000, - B00111101,B11000000,B00000000,B00011110,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B00000011,B11010000, - B00111101,B11000000,B00000000,B00011101,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B10000111,B11010000, - B01111101,B11100000,B00000000,B00111011,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100111,B10000111,B10010000, - B01111101,B11100000,B00000000,B00111000,B01110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100011,B10000111,B00010000, - B01111111,B11100000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110001,B10000110,B00110000, - B00011111,B10000000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00001111,B00000000,B00000000,B00000111,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11110000, - B00000110,B00000000,B00000000,B00000011,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000 - }; - #endif - - #else // HOTENDS > 2 - - #if FAN_ANIM_FRAMES == 3 - const unsigned char status_screen0_bmp[] PROGMEM = { - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B00000000,B11111000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111001,B00000001,B00111000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110111,B10000011,B11011000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110111,B10000011,B11011000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B11000111,B11101000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100111,B11000111,B11001000, - B00111111,B11000000,B00000000,B00011111,B11100000,B00000000,B00011111,B11100000,B00000000,B00000000,B00000000,B00000000,B00100001,B11111111,B00001000, - B01111101,B11100000,B00000000,B00111100,B11110000,B00000000,B00111100,B11110000,B00000000,B00000000,B00000000,B00000000,B00100000,B01111100,B00001000, - B01111001,B11100000,B00000000,B00111011,B01110000,B00000000,B00111011,B01110000,B00000000,B00000000,B00000000,B00000000,B00100000,B01111100,B00001000, - B01110101,B11100000,B00000000,B00111111,B01110000,B00000000,B00111111,B01110000,B00000000,B00000000,B00000000,B00000000,B00100000,B01111100,B00001000, - B00111101,B11000000,B00000000,B00011110,B11100000,B00000000,B00011100,B11100000,B00000000,B00000000,B00000000,B00000000,B00100001,B11111111,B00001000, - B00111101,B11000000,B00000000,B00011101,B11100000,B00000000,B00011111,B01100000,B00000000,B00000000,B00000000,B00000000,B00100111,B11000111,B11001000, - B01111101,B11100000,B00000000,B00111011,B11110000,B00000000,B00111011,B01110000,B00000000,B00000000,B00000000,B00000000,B00101111,B11000111,B11101000, - B01111101,B11100000,B00000000,B00111000,B01110000,B00000000,B00111100,B11110000,B00000000,B00000000,B00000000,B00000000,B00110111,B10000011,B11011000, - B01111111,B11100000,B00000000,B00111111,B11110000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000000,B00000000,B00110111,B10000011,B11011000, - B00011111,B10000000,B00000000,B00001111,B11000000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00111001,B00000001,B00111000, - B00001111,B00000000,B00000000,B00000111,B10000000,B00000000,B00000111,B10000000,B00000000,B00000000,B00000000,B00000000,B00111110,B00000000,B11111000, - B00000110,B00000000,B00000000,B00000011,B00000000,B00000000,B00000011,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000 - }; - const unsigned char status_screen1_bmp[] PROGMEM = { - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B00110000,B11111000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111001,B11110000,B00111000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110001,B11110000,B00011000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B11110000,B00011000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B11110000,B01101000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B00110001,B11101000, - B00111111,B11000000,B00000000,B00011111,B11100000,B00000000,B00011111,B11100000,B00000000,B00000000,B00000000,B00000000,B00100000,B00111001,B11101000, - B01111101,B11100000,B00000000,B00111100,B11110000,B00000000,B00111100,B11110000,B00000000,B00000000,B00000000,B00000000,B00100000,B01111111,B11111000, - B01111001,B11100000,B00000000,B00111011,B01110000,B00000000,B00111011,B01110000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B01110101,B11100000,B00000000,B00111111,B01110000,B00000000,B00111111,B01110000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111100,B00001000, - B00111101,B11000000,B00000000,B00011110,B11100000,B00000000,B00011100,B11100000,B00000000,B00000000,B00000000,B00000000,B00101111,B00111000,B00001000, - B00111101,B11000000,B00000000,B00011101,B11100000,B00000000,B00011111,B01100000,B00000000,B00000000,B00000000,B00000000,B00101110,B00011000,B00001000, - B01111101,B11100000,B00000000,B00111011,B11110000,B00000000,B00111011,B01110000,B00000000,B00000000,B00000000,B00000000,B00101100,B00011110,B00001000, - B01111101,B11100000,B00000000,B00111000,B01110000,B00000000,B00111100,B11110000,B00000000,B00000000,B00000000,B00000000,B00110000,B00011110,B00011000, - B01111111,B11100000,B00000000,B00111111,B11110000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000000,B00000000,B00110000,B00011111,B00011000, - B00011111,B10000000,B00000000,B00001111,B11000000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00011111,B00111000, - B00001111,B00000000,B00000000,B00000111,B10000000,B00000000,B00000111,B10000000,B00000000,B00000000,B00000000,B00000000,B00111110,B00011000,B11111000, - B00000110,B00000000,B00000000,B00000011,B00000000,B00000000,B00000011,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000 - }; - const unsigned char status_screen2_bmp[] PROGMEM = { - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111110,B00011000,B11111000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00011111,B00111000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B00011111,B10011000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110100,B00011111,B00011000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101110,B00011110,B00001000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B00011100,B00001000, - B00111111,B11000000,B00000000,B00011111,B11100000,B00000000,B00011111,B11100000,B00000000,B00000000,B00000000,B00000000,B00101111,B10111000,B00001000, - B01111101,B11100000,B00000000,B00111100,B11110000,B00000000,B00111100,B11110000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111100,B00001000, - B01111001,B11100000,B00000000,B00111011,B01110000,B00000000,B00111011,B01110000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000, - B01110101,B11100000,B00000000,B00111111,B01110000,B00000000,B00111111,B01110000,B00000000,B00000000,B00000000,B00000000,B00100000,B01111111,B11111000, - B00111101,B11000000,B00000000,B00011110,B11100000,B00000000,B00011100,B11100000,B00000000,B00000000,B00000000,B00000000,B00100000,B00111011,B11101000, - B00111101,B11000000,B00000000,B00011101,B11100000,B00000000,B00011111,B01100000,B00000000,B00000000,B00000000,B00000000,B00100000,B01110001,B11101000, - B01111101,B11100000,B00000000,B00111011,B11110000,B00000000,B00111011,B01110000,B00000000,B00000000,B00000000,B00000000,B00100000,B11110000,B11101000, - B01111101,B11100000,B00000000,B00111000,B01110000,B00000000,B00111100,B11110000,B00000000,B00000000,B00000000,B00000000,B00110001,B11110000,B01011000, - B01111111,B11100000,B00000000,B00111111,B11110000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000000,B00000000,B00110011,B11110000,B00011000, - B00011111,B10000000,B00000000,B00001111,B11000000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00111001,B11110000,B00111000, - B00001111,B00000000,B00000000,B00000111,B10000000,B00000000,B00000111,B10000000,B00000000,B00000000,B00000000,B00000000,B00111110,B00110000,B11111000, - B00000110,B00000000,B00000000,B00000011,B00000000,B00000000,B00000011,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111000 - }; - #else - const unsigned char status_screen0_bmp[] PROGMEM = { - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B11111100,B00110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B11111100,B00010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B01111000,B00010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B00110000,B00010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101100,B00000000,B11010000, - B00111111,B11000000,B00000000,B00011111,B11100000,B00000000,B00011111,B11100000,B00000000,B00000000,B00000000,B00000000,B00101110,B00110001,B11010000, - B01111101,B11100000,B00000000,B00111100,B11110000,B00000000,B00111100,B11110000,B00000000,B00000000,B00000000,B00000000,B00101111,B01111011,B11010000, - B01111001,B11100000,B00000000,B00111011,B01110000,B00000000,B00111011,B01110000,B00000000,B00000000,B00000000,B00000000,B00101111,B01111011,B11010000, - B01110101,B11100000,B00000000,B00111111,B01110000,B00000000,B00111111,B01110000,B00000000,B00000000,B00000000,B00000000,B00101110,B00110001,B11010000, - B00111101,B11000000,B00000000,B00011110,B11100000,B00000000,B00011100,B11100000,B00000000,B00000000,B00000000,B00000000,B00101100,B00000000,B11010000, - B00111101,B11000000,B00000000,B00011101,B11100000,B00000000,B00011111,B01100000,B00000000,B00000000,B00000000,B00000000,B00100000,B00110000,B00010000, - B01111101,B11100000,B00000000,B00111011,B11110000,B00000000,B00111011,B01110000,B00000000,B00000000,B00000000,B00000000,B00100000,B01111000,B00010000, - B01111101,B11100000,B00000000,B00111000,B01110000,B00000000,B00111100,B11110000,B00000000,B00000000,B00000000,B00000000,B00100000,B11111100,B00010000, - B01111111,B11100000,B00000000,B00111111,B11110000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000000,B00000000,B00110000,B11111100,B00110000, - B00011111,B10000000,B00000000,B00001111,B11000000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00001111,B00000000,B00000000,B00000111,B10000000,B00000000,B00000111,B10000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11110000, - B00000110,B00000000,B00000000,B00000011,B00000000,B00000000,B00000011,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000 - }; - const unsigned char status_screen1_bmp[] PROGMEM = { - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110001,B10000110,B00110000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100011,B10000111,B00010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100111,B10000111,B10010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B10000111,B11010000, - B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00101111,B00000011,B11010000, - B00111111,B11000000,B00000000,B00011111,B11100000,B00000000,B00011111,B11100000,B00000000,B00000000,B00000000,B00000000,B00100000,B00110000,B00010000, - B01111101,B11100000,B00000000,B00111100,B11110000,B00000000,B00111100,B11110000,B00000000,B00000000,B00000000,B00000000,B00100000,B01111000,B00010000, - B01111001,B11100000,B00000000,B00111011,B01110000,B00000000,B00111011,B01110000,B00000000,B00000000,B00000000,B00000000,B00100000,B01111000,B00010000, - B01110101,B11100000,B00000000,B00111111,B01110000,B00000000,B00111111,B01110000,B00000000,B00000000,B00000000,B00000000,B00100000,B00110000,B00010000, - B00111101,B11000000,B00000000,B00011110,B11100000,B00000000,B00011100,B11100000,B00000000,B00000000,B00000000,B00000000,B00101111,B00000011,B11010000, - B00111101,B11000000,B00000000,B00011101,B11100000,B00000000,B00011111,B01100000,B00000000,B00000000,B00000000,B00000000,B00101111,B10000111,B11010000, - B01111101,B11100000,B00000000,B00111011,B11110000,B00000000,B00111011,B01110000,B00000000,B00000000,B00000000,B00000000,B00100111,B10000111,B10010000, - B01111101,B11100000,B00000000,B00111000,B01110000,B00000000,B00111100,B11110000,B00000000,B00000000,B00000000,B00000000,B00100011,B10000111,B00010000, - B01111111,B11100000,B00000000,B00111111,B11110000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000000,B00000000,B00110001,B10000110,B00110000, - B00011111,B10000000,B00000000,B00001111,B11000000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B01110000, - B00001111,B00000000,B00000000,B00000111,B10000000,B00000000,B00000111,B10000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11110000, - B00000110,B00000000,B00000000,B00000011,B00000000,B00000000,B00000011,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000 - }; - #endif - - #endif // HOTENDS - - #endif // !HAS_HEATED_BED - -#endif // !CUSTOM_STATUS_SCREEN_IMAGE - -#if ENABLED(BABYSTEP_ZPROBE_GFX_OVERLAY) || ENABLED(MESH_EDIT_GFX_OVERLAY) - - const unsigned char cw_bmp[] PROGMEM = { - B00000011,B11111000,B00000000, - B00001111,B11111110,B00000000, - B00011110,B00001111,B00000000, - B00111000,B00000111,B00000000, - B00111000,B00000011,B10000000, - B01110000,B00000011,B10000000, - B01110000,B00001111,B11100000, - B01110000,B00000111,B11000000, - B01110000,B00000011,B10000000, - B01110000,B00000001,B00000000, - B01110000,B00000000,B00000000, - B00111000,B00000000,B00000000, - B00111000,B00000111,B00000000, - B00011110,B00001111,B00000000, - B00001111,B11111110,B00000000, - B00000011,B11111000,B00000000 - }; - - const unsigned char ccw_bmp[] PROGMEM = { - B00000000,B11111110,B00000000, - B00000011,B11111111,B10000000, - B00000111,B10000011,B11000000, - B00001110,B00000001,B11000000, - B00001110,B00000000,B11100000, - B00011100,B00000000,B11100000, - B01111111,B00000000,B11100000, - B00111110,B00000000,B11100000, - B00011100,B00000000,B11100000, - B00001000,B00000000,B11100000, - B00000000,B00000000,B11100000, - B00000000,B00000001,B11000000, - B00001110,B00000001,B11000000, - B00001111,B00000111,B10000000, - B00000111,B11111111,B00000000, - B00000001,B11111100,B00000000 - }; - - const unsigned char up_arrow_bmp[] PROGMEM = { - B00000100,B00000000, - B00001110,B00000000, - B00011111,B00000000, - B00111111,B10000000, - B01111111,B11000000, - B00001110,B00000000, - B00001110,B00000000, - B00001110,B00000000, - B00001110,B00000000, - B00001110,B00000000, - B00001110,B00000000, - B00001110,B00000000, - B00001110,B00000000 - }; - - const unsigned char down_arrow_bmp[] PROGMEM = { - B00001110,B00000000, - B00001110,B00000000, - B00001110,B00000000, - B00001110,B00000000, - B00001110,B00000000, - B00001110,B00000000, - B00001110,B00000000, - B00001110,B00000000, - B01111111,B11000000, - B00111111,B10000000, - B00011111,B00000000, - B00001110,B00000000, - B00000100,B00000000 - }; - - const unsigned char offset_bedline_bmp[] PROGMEM = { - B11111111,B11111111,B11111111 - }; - - const unsigned char nozzle_bmp[] PROGMEM = { - B01111111,B10000000, - B11111111,B11000000, - B11111111,B11000000, - B11111111,B11000000, - B01111111,B10000000, - B01111111,B10000000, - B11111111,B11000000, - B11111111,B11000000, - B11111111,B11000000, - B00111111,B00000000, - B00011110,B00000000, - B00001100,B00000000 - }; - -#endif // BABYSTEP_ZPROBE_GFX_OVERLAY || MESH_EDIT_GFX_OVERLAY - -#ifndef CUSTOM_BOOTSCREEN_BMP_BYTEWIDTH - #define CUSTOM_BOOTSCREEN_BMP_BYTEWIDTH ((CUSTOM_BOOTSCREEN_BMPWIDTH + 7) / 8) -#endif -#ifndef CUSTOM_BOOTSCREEN_BMPHEIGHT - #define CUSTOM_BOOTSCREEN_BMPHEIGHT (sizeof(custom_start_bmp) / (CUSTOM_BOOTSCREEN_BMP_BYTEWIDTH)) -#endif - -#ifndef FAN_ANIM_FRAMES - #define FAN_ANIM_FRAMES 2 -#elif FAN_ANIM_FRAMES > 3 - #error "Only 3 fan animation frames currently supported." -#endif -#ifndef STATUS_SCREEN_X - #define STATUS_SCREEN_X 0 -#endif -#ifndef STATUS_SCREEN_Y - #define STATUS_SCREEN_Y 1 -#endif -#ifndef STATUS_BMP_BYTEWIDTH - #define STATUS_BMP_BYTEWIDTH ((STATUS_SCREENWIDTH + 7) / 8) -#endif -#ifndef STATUS_SCREENHEIGHT - #define STATUS_SCREENHEIGHT (sizeof(status_screen0_bmp) / (STATUS_BMP_BYTEWIDTH)) -#endif -#ifndef STATUS_SCREEN_HOTEND_TEXT_X - #define STATUS_SCREEN_HOTEND_TEXT_X(i) (5 + (i) * 25) -#endif -#ifndef STATUS_SCREEN_BED_TEXT_X - #define STATUS_SCREEN_BED_TEXT_X 81 -#endif -#ifndef STATUS_SCREEN_FAN_TEXT_X - #define STATUS_SCREEN_FAN_TEXT_X 104 -#endif -#ifndef STATUS_SCREEN_FAN_TEXT_Y - #define STATUS_SCREEN_FAN_TEXT_Y (FAN_ANIM_FRAMES > 2 ? 28 : 27) -#endif - -#define BMP_SIZE (STATUS_BMP_BYTEWIDTH) * (STATUS_SCREENHEIGHT) -static_assert(sizeof(status_screen0_bmp) == BMP_SIZE, "Status header (status_screen0_bmp) dimensions don't match data."); -#if FAN_ANIM_FRAMES > 1 - static_assert(sizeof(status_screen1_bmp) == BMP_SIZE, "Status header (status_screen1_bmp) dimensions don't match data."); - #if FAN_ANIM_FRAMES > 2 - static_assert(sizeof(status_screen2_bmp) == BMP_SIZE, "Status header (status_screen2_bmp) dimensions don't match data."); - #if FAN_ANIM_FRAMES > 3 - static_assert(sizeof(status_screen3_bmp) == BMP_SIZE, "Status header (status_screen3_bmp) dimensions don't match data."); - #endif - #endif -#endif diff --git a/Marlin/src/lcd/dogm/dogm_font_data_6x9_marlin.h b/Marlin/src/lcd/dogm/fontdata/fontdata_6x9_marlin.h similarity index 100% rename from Marlin/src/lcd/dogm/dogm_font_data_6x9_marlin.h rename to Marlin/src/lcd/dogm/fontdata/fontdata_6x9_marlin.h diff --git a/Marlin/src/lcd/dogm/dogm_font_data_ISO10646_1.h b/Marlin/src/lcd/dogm/fontdata/fontdata_ISO10646_1.h similarity index 100% rename from Marlin/src/lcd/dogm/dogm_font_data_ISO10646_1.h rename to Marlin/src/lcd/dogm/fontdata/fontdata_ISO10646_1.h diff --git a/Marlin/src/lcd/dogm/language_data_an.h b/Marlin/src/lcd/dogm/fontdata/langdata_an.h similarity index 100% rename from Marlin/src/lcd/dogm/language_data_an.h rename to Marlin/src/lcd/dogm/fontdata/langdata_an.h diff --git a/Marlin/src/lcd/dogm/language_data_bg.h b/Marlin/src/lcd/dogm/fontdata/langdata_bg.h similarity index 100% rename from Marlin/src/lcd/dogm/language_data_bg.h rename to Marlin/src/lcd/dogm/fontdata/langdata_bg.h diff --git a/Marlin/src/lcd/dogm/language_data_ca.h b/Marlin/src/lcd/dogm/fontdata/langdata_ca.h similarity index 100% rename from Marlin/src/lcd/dogm/language_data_ca.h rename to Marlin/src/lcd/dogm/fontdata/langdata_ca.h diff --git a/Marlin/src/lcd/dogm/language_data_cz.h b/Marlin/src/lcd/dogm/fontdata/langdata_cz.h similarity index 100% rename from Marlin/src/lcd/dogm/language_data_cz.h rename to Marlin/src/lcd/dogm/fontdata/langdata_cz.h diff --git a/Marlin/src/lcd/dogm/language_data_da.h b/Marlin/src/lcd/dogm/fontdata/langdata_da.h similarity index 100% rename from Marlin/src/lcd/dogm/language_data_da.h rename to Marlin/src/lcd/dogm/fontdata/langdata_da.h diff --git a/Marlin/src/lcd/dogm/language_data_de.h b/Marlin/src/lcd/dogm/fontdata/langdata_de.h similarity index 100% rename from Marlin/src/lcd/dogm/language_data_de.h rename to Marlin/src/lcd/dogm/fontdata/langdata_de.h diff --git a/Marlin/src/lcd/dogm/language_data_el-gr.h b/Marlin/src/lcd/dogm/fontdata/langdata_el-gr.h similarity index 100% rename from Marlin/src/lcd/dogm/language_data_el-gr.h rename to Marlin/src/lcd/dogm/fontdata/langdata_el-gr.h diff --git a/Marlin/src/lcd/dogm/language_data_el.h b/Marlin/src/lcd/dogm/fontdata/langdata_el.h similarity index 100% rename from Marlin/src/lcd/dogm/language_data_el.h rename to Marlin/src/lcd/dogm/fontdata/langdata_el.h diff --git a/Marlin/src/lcd/dogm/language_data_en.h b/Marlin/src/lcd/dogm/fontdata/langdata_en.h similarity index 100% rename from Marlin/src/lcd/dogm/language_data_en.h rename to Marlin/src/lcd/dogm/fontdata/langdata_en.h diff --git a/Marlin/src/lcd/dogm/language_data_es.h b/Marlin/src/lcd/dogm/fontdata/langdata_es.h similarity index 100% rename from Marlin/src/lcd/dogm/language_data_es.h rename to Marlin/src/lcd/dogm/fontdata/langdata_es.h diff --git a/Marlin/src/lcd/dogm/language_data_eu.h b/Marlin/src/lcd/dogm/fontdata/langdata_eu.h similarity index 100% rename from Marlin/src/lcd/dogm/language_data_eu.h rename to Marlin/src/lcd/dogm/fontdata/langdata_eu.h diff --git a/Marlin/src/lcd/dogm/language_data_fi.h b/Marlin/src/lcd/dogm/fontdata/langdata_fi.h similarity index 100% rename from Marlin/src/lcd/dogm/language_data_fi.h rename to Marlin/src/lcd/dogm/fontdata/langdata_fi.h diff --git a/Marlin/src/lcd/dogm/language_data_fr.h b/Marlin/src/lcd/dogm/fontdata/langdata_fr.h similarity index 100% rename from Marlin/src/lcd/dogm/language_data_fr.h rename to Marlin/src/lcd/dogm/fontdata/langdata_fr.h diff --git a/Marlin/src/lcd/dogm/language_data_gl.h b/Marlin/src/lcd/dogm/fontdata/langdata_gl.h similarity index 100% rename from Marlin/src/lcd/dogm/language_data_gl.h rename to Marlin/src/lcd/dogm/fontdata/langdata_gl.h diff --git a/Marlin/src/lcd/dogm/language_data_hr.h b/Marlin/src/lcd/dogm/fontdata/langdata_hr.h similarity index 100% rename from Marlin/src/lcd/dogm/language_data_hr.h rename to Marlin/src/lcd/dogm/fontdata/langdata_hr.h diff --git a/Marlin/src/lcd/dogm/language_data_it.h b/Marlin/src/lcd/dogm/fontdata/langdata_it.h similarity index 100% rename from Marlin/src/lcd/dogm/language_data_it.h rename to Marlin/src/lcd/dogm/fontdata/langdata_it.h diff --git a/Marlin/src/lcd/dogm/language_data_jp-kana.h b/Marlin/src/lcd/dogm/fontdata/langdata_jp-kana.h similarity index 100% rename from Marlin/src/lcd/dogm/language_data_jp-kana.h rename to Marlin/src/lcd/dogm/fontdata/langdata_jp-kana.h diff --git a/Marlin/src/lcd/dogm/fontdata/langdata_ko_KR.h b/Marlin/src/lcd/dogm/fontdata/langdata_ko_KR.h new file mode 100644 index 0000000000..622a536414 --- /dev/null +++ b/Marlin/src/lcd/dogm/fontdata/langdata_ko_KR.h @@ -0,0 +1,532 @@ +/** + * Generated automatically by buildroot/share/fonts/uxggenpages.sh + * Contents will be REPLACED by future processing! + * Use genallfont.sh to generate font data for updated languages. + */ +#include + +const u8g_fntpgm_uint8_t fontpage_344_240_240[34] U8G_FONT_SECTION("fontpage_344_240_240") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xf0,0xf0,0x00,0x09,0xfe,0x00, + 0x00,0x08,0x0b,0x0b,0x0a,0x01,0xfe,0xf9,0x09,0x09,0x11,0x17,0x21,0x41,0x81,0x01, + 0x01,0x01}; +const u8g_fntpgm_uint8_t fontpage_345_224_224[41] U8G_FONT_SECTION("fontpage_345_224_224") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xe0,0xe0,0x00,0x09,0x00,0x00, + 0x00,0x0a,0x09,0x12,0x0a,0x00,0x00,0x3f,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x08, + 0x80,0x08,0x80,0x09,0x00,0x08,0x00,0xff,0xc0}; +const u8g_fntpgm_uint8_t fontpage_347_248_248[41] U8G_FONT_SECTION("fontpage_347_248_248") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xf8,0xf8,0x00,0x09,0x00,0x00, + 0x00,0x0a,0x09,0x12,0x0a,0x00,0x00,0x3f,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00, + 0x80,0x01,0x00,0x01,0x00,0x01,0x00,0xff,0xc0}; +const u8g_fntpgm_uint8_t fontpage_348_137_137[45] U8G_FONT_SECTION("fontpage_348_137_137") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0x89,0x89,0x00,0x09,0xfe,0x00, + 0x00,0x0a,0x0b,0x16,0x0a,0x00,0xfe,0x3f,0x00,0x00,0x80,0x00,0x80,0x01,0x00,0xff, + 0xc0,0x00,0x00,0x20,0x80,0x20,0x80,0x3f,0x00,0x20,0x80,0x3f,0x00}; +const u8g_fntpgm_uint8_t fontpage_348_176_176[34] U8G_FONT_SECTION("fontpage_348_176_176") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xb0,0xb0,0x00,0x09,0xfe,0x00, + 0x00,0x08,0x0b,0x0b,0x0a,0x01,0xfe,0xf9,0x09,0x09,0x11,0x11,0x21,0x41,0x81,0x01, + 0x01,0x01}; +const u8g_fntpgm_uint8_t fontpage_348_197_197[34] U8G_FONT_SECTION("fontpage_348_197_197") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xc5,0xc5,0x00,0x09,0xfe,0x00, + 0x00,0x08,0x0b,0x0b,0x0a,0x01,0xfe,0xf9,0x09,0x09,0x11,0x21,0xc1,0x1e,0x21,0x41, + 0x21,0x1e}; +const u8g_fntpgm_uint8_t fontpage_352_196_196[41] U8G_FONT_SECTION("fontpage_352_196_196") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xc4,0xc4,0x00,0x09,0x00,0x00, + 0x00,0x0a,0x09,0x12,0x0a,0x00,0x00,0x7f,0x80,0x08,0x80,0x08,0x80,0x08,0x80,0x08, + 0x80,0x08,0x80,0x10,0x80,0x11,0x00,0xff,0xc0}; +const u8g_fntpgm_uint8_t fontpage_353_180_180[34] U8G_FONT_SECTION("fontpage_353_180_180") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xb4,0xb4,0x00,0x09,0xfe,0x00, + 0x00,0x08,0x0b,0x0b,0x0a,0x01,0xfe,0x85,0x85,0x85,0x85,0x87,0x85,0x85,0xfd,0x05, + 0x05,0x05}; +const u8g_fntpgm_uint8_t fontpage_354_248_248[41] U8G_FONT_SECTION("fontpage_354_248_248") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xf8,0xf8,0x00,0x09,0x00,0x00, + 0x00,0x0a,0x09,0x12,0x0a,0x00,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x3f, + 0x80,0x04,0x00,0x04,0x00,0x04,0x00,0xff,0xc0}; +const u8g_fntpgm_uint8_t fontpage_356_132_132[43] U8G_FONT_SECTION("fontpage_356_132_132") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0x84,0x84,0x00,0x09,0xff,0x00, + 0x00,0x0a,0x0a,0x14,0x0a,0x00,0xff,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x3f, + 0x80,0x00,0x00,0xff,0xc0,0x04,0x00,0x04,0x00,0x04,0x00}; +const u8g_fntpgm_uint8_t fontpage_356_244_244[43] U8G_FONT_SECTION("fontpage_356_244_244") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xf4,0xf4,0x00,0x09,0xff,0x00, + 0x00,0x0a,0x0a,0x14,0x0a,0x00,0xff,0x20,0x00,0x20,0x00,0x20,0x00,0x3f,0x80,0x00, + 0x00,0x00,0x00,0xff,0xc0,0x12,0x00,0x12,0x00,0x12,0x00}; +const u8g_fntpgm_uint8_t fontpage_357_200_200[34] U8G_FONT_SECTION("fontpage_357_200_200") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xc8,0xc8,0x00,0x09,0xfe,0x00, + 0x00,0x08,0x0b,0x0b,0x0a,0x01,0xfe,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x7d,0x01, + 0x01,0x01}; +const u8g_fntpgm_uint8_t fontpage_357_228_228[45] U8G_FONT_SECTION("fontpage_357_228_228") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xe4,0xe4,0x00,0x09,0xfe,0x00, + 0x00,0x09,0x0b,0x16,0x0a,0x01,0xfe,0xf9,0x00,0x81,0x00,0x81,0x00,0x81,0x00,0x81, + 0x80,0x81,0x00,0x81,0x00,0xfd,0x00,0x01,0x00,0x01,0x00,0x01,0x00}; +const u8g_fntpgm_uint8_t fontpage_357_249_249[45] U8G_FONT_SECTION("fontpage_357_249_249") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xf9,0xf9,0x00,0x09,0xfe,0x00, + 0x00,0x09,0x0b,0x16,0x0a,0x01,0xfe,0xf9,0x00,0x81,0x00,0x81,0x00,0x81,0x80,0x81, + 0x00,0xfd,0x00,0x00,0x00,0x3e,0x00,0x41,0x00,0x41,0x00,0x3e,0x00}; +const u8g_fntpgm_uint8_t fontpage_359_196_196[41] U8G_FONT_SECTION("fontpage_359_196_196") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xc4,0xc4,0x00,0x09,0x00,0x00, + 0x00,0x0a,0x09,0x12,0x0a,0x00,0x00,0x3f,0x80,0x20,0x00,0x20,0x00,0x20,0x00,0x3f, + 0x80,0x04,0x00,0x04,0x00,0x04,0x00,0xff,0xc0}; +const u8g_fntpgm_uint8_t fontpage_359_204_204[45] U8G_FONT_SECTION("fontpage_359_204_204") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xcc,0xcc,0x00,0x09,0xfe,0x00, + 0x00,0x0a,0x0b,0x16,0x0a,0x00,0xfe,0x3f,0x00,0x20,0x00,0x3f,0x80,0x04,0x00,0xff, + 0xc0,0x00,0x00,0x3f,0x00,0x00,0x80,0x3f,0x00,0x20,0x00,0x3f,0x80}; +const u8g_fntpgm_uint8_t fontpage_359_217_217[45] U8G_FONT_SECTION("fontpage_359_217_217") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xd9,0xd9,0x00,0x09,0xfe,0x00, + 0x00,0x0a,0x0b,0x16,0x0a,0x00,0xfe,0x3f,0x00,0x20,0x00,0x20,0x00,0x3f,0x80,0x04, + 0x00,0xff,0xc0,0x00,0x00,0x1f,0x00,0x20,0x80,0x20,0x80,0x1f,0x00}; +const u8g_fntpgm_uint8_t fontpage_360_152_152[45] U8G_FONT_SECTION("fontpage_360_152_152") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0x98,0x98,0x00,0x09,0xfe,0x00, + 0x00,0x09,0x0b,0x16,0x0a,0x00,0xfe,0x7c,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x7e, + 0x80,0x10,0x80,0x10,0x80,0xff,0x80,0x00,0x80,0x00,0x80,0x00,0x80}; +const u8g_fntpgm_uint8_t fontpage_360_168_168[34] U8G_FONT_SECTION("fontpage_360_168_168") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xa8,0xa8,0x00,0x09,0xfe,0x00, + 0x00,0x08,0x0b,0x0b,0x0a,0x01,0xfe,0xf9,0x81,0x81,0xf9,0x21,0xff,0x00,0x7f,0x41, + 0x41,0x7f}; +const u8g_fntpgm_uint8_t fontpage_360_208_208[43] U8G_FONT_SECTION("fontpage_360_208_208") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xd0,0xd0,0x00,0x09,0xff,0x00, + 0x00,0x0a,0x0a,0x14,0x0a,0x00,0xff,0x3f,0x80,0x20,0x00,0x20,0x00,0x20,0x00,0x3f, + 0x80,0x00,0x00,0xff,0xc0,0x04,0x00,0x04,0x00,0x04,0x00}; +const u8g_fntpgm_uint8_t fontpage_361_164_164[45] U8G_FONT_SECTION("fontpage_361_164_164") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xa4,0xa4,0x00,0x09,0xfe,0x00, + 0x00,0x09,0x0b,0x16,0x0a,0x00,0xfe,0x7c,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x7c, + 0x80,0x00,0x80,0xfe,0x80,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80}; +const u8g_fntpgm_uint8_t fontpage_361_220_220[41] U8G_FONT_SECTION("fontpage_361_220_220") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xdc,0xdc,0x00,0x09,0x00,0x00, + 0x00,0x0a,0x09,0x12,0x0a,0x00,0x00,0x3f,0x80,0x20,0x00,0x20,0x00,0x20,0x00,0x20, + 0x00,0x3f,0x80,0x00,0x00,0x00,0x00,0xff,0xc0}; +const u8g_fntpgm_uint8_t fontpage_362_148_148[34] U8G_FONT_SECTION("fontpage_362_148_148") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0x94,0x94,0x00,0x09,0xfe,0x00, + 0x00,0x08,0x0b,0x0b,0x0a,0x01,0xfe,0xf9,0x81,0x81,0x81,0x81,0x81,0x81,0xfd,0x01, + 0x01,0x01}; +const u8g_fntpgm_uint8_t fontpage_366_252_252[45] U8G_FONT_SECTION("fontpage_366_252_252") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xfc,0xfc,0x00,0x09,0xfe,0x00, + 0x00,0x09,0x0b,0x16,0x0a,0x01,0xfe,0xf9,0x00,0x09,0x00,0x09,0x00,0xf9,0x00,0x81, + 0x80,0x81,0x00,0x81,0x00,0xfd,0x00,0x01,0x00,0x01,0x00,0x01,0x00}; +const u8g_fntpgm_uint8_t fontpage_368_136_136[34] U8G_FONT_SECTION("fontpage_368_136_136") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0x88,0x88,0x00,0x09,0xfe,0x00, + 0x00,0x08,0x0b,0x0b,0x0a,0x01,0xfe,0xf5,0x15,0x15,0xf5,0x8d,0x85,0x85,0xfd,0x05, + 0x05,0x05}; +const u8g_fntpgm_uint8_t fontpage_368_165_165[34] U8G_FONT_SECTION("fontpage_368_165_165") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xa5,0xa5,0x00,0x09,0xfe,0x00, + 0x00,0x08,0x0b,0x0b,0x0a,0x01,0xfe,0xf1,0x17,0xf1,0x87,0x81,0xf9,0x00,0x7f,0x01, + 0x01,0x01}; +const u8g_fntpgm_uint8_t fontpage_368_220_220[41] U8G_FONT_SECTION("fontpage_368_220_220") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xdc,0xdc,0x00,0x09,0x00,0x00, + 0x00,0x0a,0x09,0x12,0x0a,0x00,0x00,0x3f,0x80,0x00,0x80,0x3f,0x80,0x20,0x00,0x20, + 0x00,0x3f,0x80,0x04,0x00,0x04,0x00,0xff,0xc0}; +const u8g_fntpgm_uint8_t fontpage_369_204_204[41] U8G_FONT_SECTION("fontpage_369_204_204") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xcc,0xcc,0x00,0x09,0x00,0x00, + 0x00,0x0a,0x09,0x12,0x0a,0x00,0x00,0x3f,0x80,0x00,0x80,0x3f,0x80,0x20,0x00,0x20, + 0x00,0x3f,0x80,0x12,0x00,0x12,0x00,0xff,0xc0}; +const u8g_fntpgm_uint8_t fontpage_370_244_244[41] U8G_FONT_SECTION("fontpage_370_244_244") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xf4,0xf4,0x00,0x09,0x00,0x00, + 0x00,0x0a,0x09,0x12,0x0a,0x00,0x00,0x3f,0x80,0x00,0x80,0x3f,0x80,0x20,0x00,0x20, + 0x00,0x3f,0x80,0x00,0x00,0x00,0x00,0xff,0xc0}; +const u8g_fntpgm_uint8_t fontpage_371_172_172[34] U8G_FONT_SECTION("fontpage_371_172_172") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xac,0xac,0x00,0x09,0xfe,0x00, + 0x00,0x08,0x0b,0x0b,0x0a,0x01,0xfe,0xf9,0x09,0x09,0xf9,0x81,0x81,0x81,0xfd,0x01, + 0x01,0x01}; +const u8g_fntpgm_uint8_t fontpage_371_189_189[34] U8G_FONT_SECTION("fontpage_371_189_189") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xbd,0xbd,0x00,0x09,0xfe,0x00, + 0x00,0x08,0x0b,0x0b,0x0a,0x01,0xfe,0xf9,0x09,0xf9,0x81,0x81,0xfd,0x00,0x41,0x3f, + 0x41,0x3f}; +const u8g_fntpgm_uint8_t fontpage_371_193_193[34] U8G_FONT_SECTION("fontpage_371_193_193") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xc1,0xc1,0x00,0x09,0xfe,0x00, + 0x00,0x08,0x0b,0x0b,0x0a,0x01,0xfe,0xf9,0x09,0xf9,0x81,0x81,0xfd,0x01,0x3e,0x21, + 0x21,0x3e}; +const u8g_fntpgm_uint8_t fontpage_371_204_204[45] U8G_FONT_SECTION("fontpage_371_204_204") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xcc,0xcc,0x00,0x09,0xfe,0x00, + 0x00,0x09,0x0b,0x16,0x0a,0x01,0xfe,0xf9,0x00,0x89,0x00,0x89,0x00,0x89,0x80,0x89, + 0x00,0xf9,0x00,0x01,0x00,0x41,0x00,0x40,0x00,0x40,0x00,0x7f,0x00}; +const u8g_fntpgm_uint8_t fontpage_372_200_200[34] U8G_FONT_SECTION("fontpage_372_200_200") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xc8,0xc8,0x00,0x09,0xfe,0x00, + 0x00,0x08,0x0b,0x0b,0x0a,0x01,0xfe,0xf9,0x89,0x89,0x8f,0x89,0xf9,0x00,0x3f,0x41, + 0x41,0x3f}; +const u8g_fntpgm_uint8_t fontpage_372_212_212[34] U8G_FONT_SECTION("fontpage_372_212_212") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xd4,0xd4,0x00,0x09,0xfe,0x00, + 0x00,0x08,0x0b,0x0b,0x0a,0x01,0xfe,0xf5,0x95,0x95,0x9d,0x95,0x95,0x95,0xf5,0x05, + 0x05,0x05}; +const u8g_fntpgm_uint8_t fontpage_372_244_244[34] U8G_FONT_SECTION("fontpage_372_244_244") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xf4,0xf4,0x00,0x09,0xfe,0x00, + 0x00,0x08,0x0b,0x0b,0x0a,0x01,0xfe,0xf9,0x89,0x8f,0x89,0x8f,0xf9,0x01,0x21,0x20, + 0x20,0x3f}; +const u8g_fntpgm_uint8_t fontpage_373_168_168[41] U8G_FONT_SECTION("fontpage_373_168_168") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xa8,0xa8,0x00,0x09,0x00,0x00, + 0x00,0x0a,0x09,0x12,0x0a,0x00,0x00,0x3f,0x80,0x20,0x80,0x20,0x80,0x20,0x80,0x3f, + 0x80,0x04,0x00,0x04,0x00,0x04,0x00,0xff,0xc0}; +const u8g_fntpgm_uint8_t fontpage_376_128_128[34] U8G_FONT_SECTION("fontpage_376_128_128") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x00,0x09,0xfe,0x00, + 0x00,0x08,0x0b,0x0b,0x0a,0x01,0xfe,0xf9,0x89,0x89,0x89,0xf9,0x00,0x3f,0x01,0x3f, + 0x40,0x3f}; +const u8g_fntpgm_uint8_t fontpage_376_148_148[45] U8G_FONT_SECTION("fontpage_376_148_148") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0x94,0x94,0x00,0x09,0xfe,0x00, + 0x00,0x09,0x0b,0x16,0x0a,0x01,0xfe,0x89,0x00,0x89,0x00,0x89,0x00,0xf9,0x00,0x89, + 0x80,0x89,0x00,0x89,0x00,0xf9,0x00,0x01,0x00,0x01,0x00,0x01,0x00}; +const u8g_fntpgm_uint8_t fontpage_377_132_132[34] U8G_FONT_SECTION("fontpage_377_132_132") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0x84,0x84,0x00,0x09,0xfe,0x00, + 0x00,0x08,0x0b,0x0b,0x0a,0x01,0xfe,0x89,0x89,0x89,0xff,0x89,0x89,0x89,0xf9,0x01, + 0x01,0x01}; +const u8g_fntpgm_uint8_t fontpage_377_160_160[34] U8G_FONT_SECTION("fontpage_377_160_160") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xa0,0xa0,0x00,0x09,0xfe,0x00, + 0x00,0x08,0x0b,0x0b,0x0a,0x01,0xfe,0x95,0x95,0x95,0xf5,0x9d,0x95,0x95,0xf5,0x05, + 0x05,0x05}; +const u8g_fntpgm_uint8_t fontpage_377_168_168[34] U8G_FONT_SECTION("fontpage_377_168_168") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xa8,0xa8,0x00,0x09,0xfe,0x00, + 0x00,0x08,0x0b,0x0b,0x0a,0x01,0xfe,0x95,0x95,0xfd,0x95,0xf5,0x00,0x3f,0x01,0x3f, + 0x40,0x3f}; +const u8g_fntpgm_uint8_t fontpage_380_140_140[41] U8G_FONT_SECTION("fontpage_380_140_140") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0x8c,0x8c,0x00,0x09,0x00,0x00, + 0x00,0x0a,0x09,0x12,0x0a,0x00,0x00,0x20,0x80,0x20,0x80,0x3f,0x80,0x20,0x80,0x20, + 0x80,0x3f,0x80,0x00,0x00,0x00,0x00,0xff,0xc0}; +const u8g_fntpgm_uint8_t fontpage_380_196_196[34] U8G_FONT_SECTION("fontpage_380_196_196") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xc4,0xc4,0x00,0x09,0xfe,0x00, + 0x00,0x08,0x0b,0x0b,0x0a,0x01,0xfe,0x89,0x89,0x89,0xf9,0x89,0x89,0x89,0xf9,0x01, + 0x01,0x01}; +const u8g_fntpgm_uint8_t fontpage_385_189_189[45] U8G_FONT_SECTION("fontpage_385_189_189") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xbd,0xbd,0x00,0x09,0xfe,0x00, + 0x00,0x09,0x0b,0x16,0x0a,0x01,0xfe,0x21,0x00,0x21,0x00,0x21,0x00,0x51,0x80,0xd9, + 0x00,0x89,0x00,0x00,0x00,0x41,0x00,0x7e,0x00,0x41,0x00,0x7e,0x00}; +const u8g_fntpgm_uint8_t fontpage_385_200_200[34] U8G_FONT_SECTION("fontpage_385_200_200") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xc8,0xc8,0x00,0x09,0xfe,0x00, + 0x00,0x08,0x0b,0x0b,0x0a,0x01,0xfe,0x25,0x25,0x25,0x45,0x67,0x65,0x95,0x95,0x05, + 0x05,0x05}; +const u8g_fntpgm_uint8_t fontpage_386_164_164[34] U8G_FONT_SECTION("fontpage_386_164_164") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xa4,0xa4,0x00,0x09,0xfe,0x00, + 0x00,0x08,0x0b,0x0b,0x0a,0x01,0xfe,0x21,0x21,0x27,0x51,0x89,0x00,0x3f,0x01,0x3f, + 0x40,0x3f}; +const u8g_fntpgm_uint8_t fontpage_386_216_216[34] U8G_FONT_SECTION("fontpage_386_216_216") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xd8,0xd8,0x00,0x09,0xfe,0x00, + 0x00,0x08,0x0b,0x0b,0x0a,0x01,0xfe,0x21,0x27,0x21,0x67,0xd1,0x89,0x01,0x21,0x20, + 0x20,0x3f}; +const u8g_fntpgm_uint8_t fontpage_387_140_141[69] U8G_FONT_SECTION("fontpage_387_140_141") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0x8c,0x8d,0x00,0x09,0xfe,0x00, + 0x00,0x0a,0x09,0x12,0x0a,0x00,0x00,0x04,0x00,0x0c,0x00,0x0c,0x00,0x12,0x00,0x31, + 0x00,0x44,0x80,0x04,0x00,0x04,0x00,0xff,0xc0,0x0a,0x0b,0x16,0x0a,0x00,0xfe,0x04, + 0x00,0x0c,0x00,0x13,0x00,0x65,0x80,0x04,0x00,0xff,0xc0,0x00,0x00,0x3f,0x00,0x00, + 0x80,0x00,0x80,0x00,0x80}; +const u8g_fntpgm_uint8_t fontpage_389_164_164[41] U8G_FONT_SECTION("fontpage_389_164_164") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xa4,0xa4,0x00,0x09,0x00,0x00, + 0x00,0x0a,0x09,0x12,0x0a,0x00,0x00,0x04,0x00,0x0c,0x00,0x0c,0x00,0x12,0x00,0x31, + 0x00,0x40,0x80,0x00,0x00,0x00,0x00,0xff,0xc0}; +const u8g_fntpgm_uint8_t fontpage_389_172_172[45] U8G_FONT_SECTION("fontpage_389_172_172") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xac,0xac,0x00,0x09,0xfe,0x00, + 0x00,0x0a,0x0b,0x16,0x0a,0x00,0xfe,0x04,0x00,0x1a,0x00,0x61,0x80,0x00,0x00,0xff, + 0xc0,0x00,0x00,0x3f,0x00,0x00,0x80,0x3f,0x00,0x20,0x00,0x3f,0x80}; +const u8g_fntpgm_uint8_t fontpage_389_220_221[51] U8G_FONT_SECTION("fontpage_389_220_221") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xdc,0xdd,0x00,0x09,0xfe,0x00, + 0x00,0x08,0x0b,0x0b,0x0a,0x01,0xfe,0x21,0x21,0x21,0x21,0x21,0x51,0xc9,0x89,0x01, + 0x01,0x01,0x08,0x0b,0x0b,0x0a,0x01,0xfe,0x21,0x21,0x21,0x51,0xd9,0x89,0x00,0x7f, + 0x01,0x01,0x01}; +const u8g_fntpgm_uint8_t fontpage_395_180_180[34] U8G_FONT_SECTION("fontpage_395_180_180") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xb4,0xb4,0x00,0x09,0xfe,0x00, + 0x00,0x08,0x0b,0x0b,0x0a,0x01,0xfe,0x71,0x89,0x89,0x8f,0x89,0x89,0x89,0x71,0x01, + 0x01,0x01}; +const u8g_fntpgm_uint8_t fontpage_395_198_198[45] U8G_FONT_SECTION("fontpage_395_198_198") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xc6,0xc6,0x00,0x09,0xfe,0x00, + 0x00,0x09,0x0b,0x16,0x0a,0x01,0xfe,0x71,0x00,0x89,0x00,0x8f,0x00,0x89,0x00,0x89, + 0x00,0x71,0x00,0x00,0x00,0x4a,0x00,0x72,0x00,0x4d,0x00,0x74,0x80}; +const u8g_fntpgm_uint8_t fontpage_395_209_209[34] U8G_FONT_SECTION("fontpage_395_209_209") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xd1,0xd1,0x00,0x09,0xfe,0x00, + 0x00,0x08,0x0b,0x0b,0x0a,0x01,0xfe,0x65,0x95,0x95,0x9d,0x95,0x65,0x00,0x7f,0x01, + 0x01,0x01}; +const u8g_fntpgm_uint8_t fontpage_395_212_212[45] U8G_FONT_SECTION("fontpage_395_212_212") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xd4,0xd4,0x00,0x09,0xfe,0x00, + 0x00,0x09,0x0b,0x16,0x0a,0x01,0xfe,0x65,0x00,0x95,0x00,0x95,0x00,0x9d,0x00,0x95, + 0x00,0x65,0x00,0x05,0x00,0x25,0x00,0x20,0x00,0x20,0x00,0x3f,0x80}; +const u8g_fntpgm_uint8_t fontpage_395_244_244[34] U8G_FONT_SECTION("fontpage_395_244_244") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xf4,0xf4,0x00,0x09,0xfe,0x00, + 0x00,0x08,0x0b,0x0b,0x0a,0x01,0xfe,0x71,0x8f,0x89,0x8f,0x71,0x00,0x3f,0x01,0x3f, + 0x40,0x3f}; +const u8g_fntpgm_uint8_t fontpage_396_136_136[34] U8G_FONT_SECTION("fontpage_396_136_136") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0x88,0x88,0x00,0x09,0xfe,0x00, + 0x00,0x08,0x0b,0x0b,0x0a,0x01,0xfe,0x65,0x95,0x9d,0x95,0x95,0x9d,0x95,0x65,0x05, + 0x05,0x05}; +const u8g_fntpgm_uint8_t fontpage_396_164_164[41] U8G_FONT_SECTION("fontpage_396_164_164") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xa4,0xa4,0x00,0x09,0x00,0x00, + 0x00,0x0a,0x09,0x12,0x0a,0x00,0x00,0x1e,0x00,0x21,0x00,0x20,0x80,0x20,0x80,0x21, + 0x00,0x1e,0x00,0x04,0x00,0x04,0x00,0xff,0xc0}; +const u8g_fntpgm_uint8_t fontpage_396_168_168[45] U8G_FONT_SECTION("fontpage_396_168_168") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xa8,0xa8,0x00,0x09,0xfe,0x00, + 0x00,0x0a,0x0b,0x16,0x0a,0x00,0xfe,0x1f,0x00,0x20,0x80,0x20,0x80,0x1f,0x00,0x04, + 0x00,0x04,0x00,0xff,0xc0,0x00,0x00,0x20,0x00,0x20,0x00,0x3f,0x80}; +const u8g_fntpgm_uint8_t fontpage_396_196_196[45] U8G_FONT_SECTION("fontpage_396_196_196") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xc4,0xc4,0x00,0x09,0xfe,0x00, + 0x00,0x0a,0x0b,0x16,0x0a,0x00,0xfe,0x38,0x80,0x44,0x80,0x44,0x80,0x44,0x80,0x38, + 0xc0,0x10,0x80,0xfe,0x80,0x00,0x80,0x20,0x00,0x20,0x00,0x3f,0x80}; +const u8g_fntpgm_uint8_t fontpage_397_208_208[34] U8G_FONT_SECTION("fontpage_397_208_208") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xd0,0xd0,0x00,0x09,0xfe,0x00, + 0x00,0x08,0x0b,0x0b,0x0a,0x01,0xfe,0x71,0x89,0x89,0x71,0x01,0xff,0x21,0x27,0x41, + 0x40,0x7f}; +const u8g_fntpgm_uint8_t fontpage_398_132_132[45] U8G_FONT_SECTION("fontpage_398_132_132") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0x84,0x84,0x00,0x09,0xfe,0x00, + 0x00,0x09,0x0b,0x16,0x0a,0x00,0xfe,0x38,0x80,0x44,0x80,0x42,0x80,0x44,0x80,0x38, + 0x80,0x00,0x80,0xfe,0x80,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80}; +const u8g_fntpgm_uint8_t fontpage_398_188_188[41] U8G_FONT_SECTION("fontpage_398_188_188") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xbc,0xbc,0x00,0x09,0x00,0x00, + 0x00,0x0a,0x09,0x12,0x0a,0x00,0x00,0x1e,0x00,0x21,0x00,0x20,0x80,0x20,0x80,0x21, + 0x00,0x1e,0x00,0x00,0x00,0x00,0x00,0xff,0xc0}; +const u8g_fntpgm_uint8_t fontpage_398_204_204[45] U8G_FONT_SECTION("fontpage_398_204_204") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xcc,0xcc,0x00,0x09,0xfe,0x00, + 0x00,0x0a,0x0b,0x16,0x0a,0x00,0xfe,0x1e,0x00,0x21,0x00,0x21,0x00,0x1e,0x00,0x00, + 0x00,0xff,0xc0,0x00,0x00,0x3f,0x00,0x20,0x80,0x20,0x80,0x3f,0x00}; +const u8g_fntpgm_uint8_t fontpage_398_244_244[34] U8G_FONT_SECTION("fontpage_398_244_244") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xf4,0xf4,0x00,0x09,0xfe,0x00, + 0x00,0x08,0x0b,0x0b,0x0a,0x01,0xfe,0x71,0x49,0x89,0x89,0x89,0x89,0x49,0x71,0x01, + 0x01,0x01}; +const u8g_fntpgm_uint8_t fontpage_398_252_253[51] U8G_FONT_SECTION("fontpage_398_252_253") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xfc,0xfd,0x00,0x09,0xfe,0x00, + 0x00,0x08,0x0b,0x0b,0x0a,0x01,0xfe,0x71,0x89,0x89,0x89,0x71,0x00,0x3f,0x01,0x3f, + 0x40,0x3f,0x08,0x0b,0x0b,0x0a,0x01,0xfe,0x71,0x89,0x89,0x89,0x71,0x00,0x77,0x11, + 0x71,0x41,0x79}; +const u8g_fntpgm_uint8_t fontpage_399_133_133[34] U8G_FONT_SECTION("fontpage_399_133_133") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0x85,0x85,0x00,0x09,0xfe,0x00, + 0x00,0x08,0x0b,0x0b,0x0a,0x01,0xfe,0x71,0x89,0x89,0x89,0x89,0x71,0x00,0x41,0x3f, + 0x41,0x3f}; +const u8g_fntpgm_uint8_t fontpage_399_144_145[73] U8G_FONT_SECTION("fontpage_399_144_145") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0x90,0x91,0x00,0x09,0xfe,0x00, + 0x00,0x09,0x0b,0x16,0x0a,0x01,0xfe,0xf9,0x00,0x09,0x00,0x11,0x00,0x11,0x00,0x21, + 0x80,0x71,0x00,0xc9,0x00,0x85,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x09,0x0b,0x16, + 0x0a,0x01,0xfe,0xf9,0x00,0x09,0x00,0x11,0x00,0x31,0x80,0x49,0x00,0x85,0x00,0x00, + 0x00,0x7e,0x00,0x01,0x00,0x01,0x00,0x01,0x00}; +const u8g_fntpgm_uint8_t fontpage_399_165_165[45] U8G_FONT_SECTION("fontpage_399_165_165") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xa5,0xa5,0x00,0x09,0xfe,0x00, + 0x00,0x09,0x0b,0x16,0x0a,0x01,0xfe,0xf9,0x00,0x09,0x00,0x11,0x00,0x31,0x80,0x79, + 0x00,0x85,0x00,0x00,0x00,0x3e,0x00,0x41,0x00,0x41,0x00,0x3e,0x00}; +const u8g_fntpgm_uint8_t fontpage_399_172_172[45] U8G_FONT_SECTION("fontpage_399_172_172") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xac,0xac,0x00,0x09,0xfe,0x00, + 0x00,0x09,0x0b,0x16,0x0a,0x00,0xfe,0x7a,0x80,0x0a,0x80,0x0a,0x80,0x12,0x80,0x13, + 0x80,0x2a,0x80,0x6a,0x80,0xc6,0x80,0x02,0x80,0x02,0x80,0x02,0x80}; +const u8g_fntpgm_uint8_t fontpage_400_128_128[34] U8G_FONT_SECTION("fontpage_400_128_128") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x00,0x09,0xfe,0x00, + 0x00,0x08,0x0b,0x0b,0x0a,0x01,0xfe,0xf9,0x09,0x11,0x17,0x31,0x71,0xc9,0x85,0x01, + 0x01,0x01}; +const u8g_fntpgm_uint8_t fontpage_400_132_132[34] U8G_FONT_SECTION("fontpage_400_132_132") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0x84,0x84,0x00,0x09,0xfe,0x00, + 0x00,0x08,0x0b,0x0b,0x0a,0x01,0xfe,0xf9,0x09,0x17,0x31,0x49,0x85,0x01,0x21,0x20, + 0x20,0x3f}; +const u8g_fntpgm_uint8_t fontpage_400_149_149[34] U8G_FONT_SECTION("fontpage_400_149_149") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0x95,0x95,0x00,0x09,0xfe,0x00, + 0x00,0x08,0x0b,0x0b,0x0a,0x01,0xfe,0xf9,0x09,0x17,0x31,0x49,0x85,0x00,0x3e,0x21, + 0x21,0x3e}; +const u8g_fntpgm_uint8_t fontpage_400_156_156[45] U8G_FONT_SECTION("fontpage_400_156_156") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0x9c,0x9c,0x00,0x09,0xfe,0x00, + 0x00,0x09,0x0b,0x16,0x0a,0x00,0xfe,0x7a,0x80,0x0a,0x80,0x0a,0x80,0x16,0x80,0x12, + 0x80,0x2a,0x80,0x4a,0x80,0x86,0x80,0x02,0x80,0x02,0x80,0x02,0x80}; +const u8g_fntpgm_uint8_t fontpage_401_253_253[45] U8G_FONT_SECTION("fontpage_401_253_253") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xfd,0xfd,0x00,0x09,0xfe,0x00, + 0x00,0x0a,0x0b,0x16,0x0a,0x00,0xfe,0x3f,0x00,0x01,0x00,0x0e,0x00,0x71,0x80,0x00, + 0x00,0xff,0xc0,0x04,0x00,0x3f,0x00,0x00,0x80,0x00,0x80,0x00,0x80}; +const u8g_fntpgm_uint8_t fontpage_402_128_128[45] U8G_FONT_SECTION("fontpage_402_128_128") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x00,0x09,0xfe,0x00, + 0x00,0x0a,0x0b,0x16,0x0a,0x00,0xfe,0x3f,0x00,0x01,0x00,0x0e,0x00,0x71,0x80,0x00, + 0x00,0xff,0xc0,0x04,0x00,0x24,0x00,0x24,0x00,0x20,0x00,0x3f,0x80}; +const u8g_fntpgm_uint8_t fontpage_402_145_145[45] U8G_FONT_SECTION("fontpage_402_145_145") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0x91,0x91,0x00,0x09,0xfe,0x00, + 0x00,0x0a,0x0b,0x16,0x0a,0x00,0xfe,0x3f,0x00,0x01,0x00,0x0e,0x00,0x71,0x80,0x00, + 0x00,0xff,0xc0,0x04,0x00,0x1f,0x00,0x20,0x80,0x20,0x80,0x1f,0x00}; +const u8g_fntpgm_uint8_t fontpage_403_144_144[45] U8G_FONT_SECTION("fontpage_403_144_144") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0x90,0x90,0x00,0x09,0xfe,0x00, + 0x00,0x0a,0x0b,0x16,0x0a,0x00,0xfe,0x3f,0x00,0x0e,0x00,0x71,0x80,0x00,0x00,0xff, + 0xc0,0x00,0x00,0x3f,0x00,0x00,0x80,0x3f,0x00,0x20,0x00,0x3f,0x80}; +const u8g_fntpgm_uint8_t fontpage_403_192_192[34] U8G_FONT_SECTION("fontpage_403_192_192") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xc0,0xc0,0x00,0x09,0xfe,0x00, + 0x00,0x08,0x0b,0x0b,0x0a,0x01,0xfe,0xf9,0x09,0x09,0x11,0x31,0x31,0xc9,0x85,0x01, + 0x01,0x01}; +const u8g_fntpgm_uint8_t fontpage_409_152_152[34] U8G_FONT_SECTION("fontpage_409_152_152") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0x98,0x98,0x00,0x09,0xfe,0x00, + 0x00,0x08,0x0b,0x0b,0x0a,0x01,0xfe,0x71,0x01,0xf9,0x11,0x17,0x31,0x49,0x85,0x01, + 0x01,0x01}; +const u8g_fntpgm_uint8_t fontpage_410_136_136[41] U8G_FONT_SECTION("fontpage_410_136_136") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0x88,0x88,0x00,0x09,0x00,0x00, + 0x00,0x0a,0x09,0x12,0x0a,0x00,0x00,0x1e,0x00,0x00,0x00,0x3f,0x00,0x02,0x00,0x0e, + 0x00,0x71,0x80,0x04,0x00,0x04,0x00,0xff,0xc0}; +const u8g_fntpgm_uint8_t fontpage_411_149_149[45] U8G_FONT_SECTION("fontpage_411_149_149") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0x95,0x95,0x00,0x09,0xfe,0x00, + 0x00,0x0a,0x0b,0x16,0x0a,0x00,0xfe,0x1e,0x00,0x00,0x00,0x3f,0x00,0x0c,0x00,0x73, + 0x80,0x00,0x00,0xff,0xc0,0x04,0x00,0x3f,0x00,0x00,0x80,0x00,0x80}; +const u8g_fntpgm_uint8_t fontpage_411_156_156[47] U8G_FONT_SECTION("fontpage_411_156_156") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0x9c,0x9c,0x00,0x09,0xfd,0x00, + 0x00,0x0a,0x0c,0x18,0x0a,0x00,0xfd,0x1e,0x00,0x00,0x00,0x3f,0x00,0x1a,0x00,0x21, + 0x00,0xff,0xc0,0x04,0x00,0x3f,0x00,0x00,0x80,0x3f,0x00,0x20,0x00,0x3f,0x80}; +const u8g_fntpgm_uint8_t fontpage_411_164_164[45] U8G_FONT_SECTION("fontpage_411_164_164") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xa4,0xa4,0x00,0x09,0xfe,0x00, + 0x00,0x0a,0x0b,0x16,0x0a,0x00,0xfe,0x1e,0x00,0x00,0x00,0x3f,0x00,0x0c,0x00,0x73, + 0x80,0x00,0x00,0xff,0xc0,0x04,0x00,0x3f,0x00,0x20,0x80,0x3f,0x00}; +const u8g_fntpgm_uint8_t fontpage_411_232_232[45] U8G_FONT_SECTION("fontpage_411_232_232") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xe8,0xe8,0x00,0x09,0xfe,0x00, + 0x00,0x09,0x0b,0x16,0x0a,0x00,0xfe,0x38,0x80,0x00,0x80,0x7c,0x80,0x18,0x80,0x66, + 0x80,0x00,0x80,0xfe,0x80,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80}; +const u8g_fntpgm_uint8_t fontpage_412_216_216[34] U8G_FONT_SECTION("fontpage_412_216_216") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xd8,0xd8,0x00,0x09,0xfe,0x00, + 0x00,0x08,0x0b,0x0b,0x0a,0x01,0xfe,0x71,0x01,0xf9,0x09,0x11,0x31,0x49,0x85,0x01, + 0x01,0x01}; +const u8g_fntpgm_uint8_t fontpage_412_232_232[34] U8G_FONT_SECTION("fontpage_412_232_232") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xe8,0xe8,0x00,0x09,0xfe,0x00, + 0x00,0x08,0x0b,0x0b,0x0a,0x01,0xfe,0x71,0x01,0xf9,0x09,0x31,0xcd,0x00,0x3f,0x41, + 0x41,0x3f}; +const u8g_fntpgm_uint8_t fontpage_412_244_244[45] U8G_FONT_SECTION("fontpage_412_244_244") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xf4,0xf4,0x00,0x09,0xfe,0x00, + 0x00,0x09,0x0b,0x16,0x0a,0x01,0xfe,0xf9,0x00,0x09,0x00,0x09,0x00,0xf1,0x00,0x11, + 0x80,0x21,0x00,0x41,0x00,0x81,0x00,0x01,0x00,0x01,0x00,0x01,0x00}; +const u8g_fntpgm_uint8_t fontpage_413_152_152[34] U8G_FONT_SECTION("fontpage_413_152_152") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0x98,0x98,0x00,0x09,0xfe,0x00, + 0x00,0x08,0x0b,0x0b,0x0a,0x01,0xfe,0xf5,0x15,0xf7,0x25,0xc5,0x00,0x3f,0x01,0x3f, + 0x40,0x3f}; +const u8g_fntpgm_uint8_t fontpage_414_156_156[34] U8G_FONT_SECTION("fontpage_414_156_156") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0x9c,0x9c,0x00,0x09,0xfe,0x00, + 0x00,0x08,0x0b,0x0b,0x0a,0x01,0xfe,0xf9,0x09,0x0f,0xf1,0x11,0x2f,0x41,0x81,0x01, + 0x01,0x01}; +const u8g_fntpgm_uint8_t fontpage_417_209_209[45] U8G_FONT_SECTION("fontpage_417_209_209") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xd1,0xd1,0x00,0x09,0xfe,0x00, + 0x00,0x09,0x0b,0x16,0x0a,0x01,0xfe,0xf9,0x00,0x81,0x00,0xf9,0x80,0x81,0x00,0x81, + 0x00,0xfd,0x00,0x00,0x00,0x41,0x00,0x7e,0x00,0x41,0x00,0x7e,0x00}; +const u8g_fntpgm_uint8_t fontpage_418_176_176[34] U8G_FONT_SECTION("fontpage_418_176_176") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xb0,0xb0,0x00,0x09,0xfe,0x00, + 0x00,0x08,0x0b,0x0b,0x0a,0x01,0xfe,0xf9,0x81,0x81,0xf7,0x81,0x81,0x81,0xf9,0x01, + 0x01,0x01}; +const u8g_fntpgm_uint8_t fontpage_418_204_204[34] U8G_FONT_SECTION("fontpage_418_204_204") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xcc,0xcc,0x00,0x09,0xfe,0x00, + 0x00,0x08,0x0b,0x0b,0x0a,0x01,0xfe,0xf5,0x85,0x85,0xed,0x85,0x85,0x85,0xfd,0x05, + 0x05,0x05}; +const u8g_fntpgm_uint8_t fontpage_419_160_160[41] U8G_FONT_SECTION("fontpage_419_160_160") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xa0,0xa0,0x00,0x09,0x00,0x00, + 0x00,0x0a,0x09,0x12,0x0a,0x00,0x00,0x3f,0x80,0x20,0x00,0x3f,0x00,0x20,0x00,0x20, + 0x00,0x3f,0x80,0x04,0x00,0x04,0x00,0xff,0xc0}; +const u8g_fntpgm_uint8_t fontpage_421_184_184[41] U8G_FONT_SECTION("fontpage_421_184_184") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xb8,0xb8,0x00,0x09,0x00,0x00, + 0x00,0x0a,0x09,0x12,0x0a,0x00,0x00,0x3f,0x80,0x20,0x00,0x3f,0x00,0x20,0x00,0x20, + 0x00,0x3f,0x80,0x00,0x00,0x00,0x00,0xff,0xc0}; +const u8g_fntpgm_uint8_t fontpage_423_156_156[45] U8G_FONT_SECTION("fontpage_423_156_156") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0x9c,0x9c,0x00,0x09,0xfe,0x00, + 0x00,0x0a,0x0b,0x16,0x0a,0x00,0xfe,0xfa,0x80,0x4a,0x80,0x4e,0x80,0x4a,0x80,0x4a, + 0x80,0xfe,0x80,0x02,0x80,0x12,0x80,0x10,0x00,0x10,0x00,0x1f,0xc0}; +const u8g_fntpgm_uint8_t fontpage_426_132_132[41] U8G_FONT_SECTION("fontpage_426_132_132") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0x84,0x84,0x00,0x09,0x00,0x00, + 0x00,0x0a,0x09,0x12,0x0a,0x00,0x00,0x3f,0x80,0x12,0x00,0x12,0x00,0x12,0x00,0x12, + 0x00,0x7f,0x80,0x00,0x00,0x00,0x00,0xff,0xc0}; +const u8g_fntpgm_uint8_t fontpage_426_216_216[45] U8G_FONT_SECTION("fontpage_426_216_216") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xd8,0xd8,0x00,0x09,0xfe,0x00, + 0x00,0x09,0x0b,0x16,0x0a,0x01,0xfe,0x71,0x00,0x01,0x00,0xfd,0x00,0x01,0x00,0x71, + 0x80,0x89,0x00,0x89,0x00,0x89,0x00,0x71,0x00,0x01,0x00,0x01,0x00}; +const u8g_fntpgm_uint8_t fontpage_426_233_233[45] U8G_FONT_SECTION("fontpage_426_233_233") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xe9,0xe9,0x00,0x09,0xfe,0x00, + 0x00,0x09,0x0b,0x16,0x0a,0x01,0xfe,0x71,0x00,0x01,0x00,0xfd,0x00,0x49,0x80,0x89, + 0x00,0x79,0x00,0x00,0x00,0x41,0x00,0x7e,0x00,0x41,0x00,0x7e,0x00}; +const u8g_fntpgm_uint8_t fontpage_428_200_200[45] U8G_FONT_SECTION("fontpage_428_200_200") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xc8,0xc8,0x00,0x09,0xfe,0x00, + 0x00,0x0a,0x0b,0x16,0x0a,0x00,0xfe,0x0e,0x00,0x00,0x00,0x7f,0x80,0x21,0x00,0x1e, + 0x00,0x04,0x00,0xff,0xc0,0x00,0x00,0x3f,0x00,0x20,0x80,0x3f,0x00}; +const u8g_fntpgm_uint8_t fontpage_428_212_212[45] U8G_FONT_SECTION("fontpage_428_212_212") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0xd4,0xd4,0x00,0x09,0xfe,0x00, + 0x00,0x0a,0x0b,0x16,0x0a,0x00,0xfe,0x38,0x80,0x00,0x80,0x7e,0x80,0x00,0x80,0x38, + 0x80,0x44,0xc0,0x3c,0x80,0x10,0x80,0xfe,0x80,0x00,0x80,0x00,0x80}; +const u8g_fntpgm_uint8_t fontpage_431_136_136[34] U8G_FONT_SECTION("fontpage_431_136_136") = { + 0x00,0x0b,0x0d,0x00,0xfd,0x00,0x00,0x00,0x00,0x00,0x88,0x88,0x00,0x09,0xfe,0x00, + 0x00,0x08,0x0b,0x0b,0x0a,0x01,0xfe,0x71,0x01,0xfd,0x01,0x71,0x49,0x89,0x49,0x71, + 0x01,0x01}; + +#define FONTDATA_ITEM(page, begin, end, data) {page, begin, end, NUM_ARRAY(data), data} +static const uxg_fontinfo_t g_fontinfo[] PROGMEM = { + FONTDATA_ITEM(344, 240, 240, fontpage_344_240_240), // '거' -- '거' + FONTDATA_ITEM(345, 224, 224, fontpage_345_224_224), // '고' -- '고' + FONTDATA_ITEM(347, 248, 248, fontpage_347_248_248), // '그' -- '그' + FONTDATA_ITEM(348, 137, 137, fontpage_348_137_137), // '급' -- '급' + FONTDATA_ITEM(348, 176, 176, fontpage_348_176_176), // '기' -- '기' + FONTDATA_ITEM(348, 197, 197, fontpage_348_197_197), // '깅' -- '깅' + FONTDATA_ITEM(352, 196, 196, fontpage_352_196_196), // '끄' -- '끄' + FONTDATA_ITEM(353, 180, 180, fontpage_353_180_180), // '내' -- '내' + FONTDATA_ITEM(354, 248, 248, fontpage_354_248_248), // '노' -- '노' + FONTDATA_ITEM(356, 132, 132, fontpage_356_132_132), // '누' -- '누' + FONTDATA_ITEM(356, 244, 244, fontpage_356_244_244), // '뉴' -- '뉴' + FONTDATA_ITEM(357, 200, 200, fontpage_357_200_200), // '니' -- '니' + FONTDATA_ITEM(357, 228, 228, fontpage_357_228_228), // '다' -- '다' + FONTDATA_ITEM(357, 249, 249, fontpage_357_249_249), // '당' -- '당' + FONTDATA_ITEM(359, 196, 196, fontpage_359_196_196), // '도' -- '도' + FONTDATA_ITEM(359, 204, 204, fontpage_359_204_204), // '돌' -- '돌' + FONTDATA_ITEM(359, 217, 217, fontpage_359_217_217), // '동' -- '동' + FONTDATA_ITEM(360, 152, 152, fontpage_360_152_152), // '되' -- '되' + FONTDATA_ITEM(360, 168, 168, fontpage_360_168_168), // '됨' -- '됨' + FONTDATA_ITEM(360, 208, 208, fontpage_360_208_208), // '두' -- '두' + FONTDATA_ITEM(361, 164, 164, fontpage_361_164_164), // '뒤' -- '뒤' + FONTDATA_ITEM(361, 220, 220, fontpage_361_220_220), // '드' -- '드' + FONTDATA_ITEM(362, 148, 148, fontpage_362_148_148), // '디' -- '디' + FONTDATA_ITEM(366, 252, 252, fontpage_366_252_252), // '라' -- '라' + FONTDATA_ITEM(368, 136, 136, fontpage_368_136_136), // '레' -- '레' + FONTDATA_ITEM(368, 165, 165, fontpage_368_165_165), // '력' -- '력' + FONTDATA_ITEM(368, 220, 220, fontpage_368_220_220), // '로' -- '로' + FONTDATA_ITEM(369, 204, 204, fontpage_369_204_204), // '료' -- '료' + FONTDATA_ITEM(370, 244, 244, fontpage_370_244_244), // '르' -- '르' + FONTDATA_ITEM(371, 172, 172, fontpage_371_172_172), // '리' -- '리' + FONTDATA_ITEM(371, 189, 189, fontpage_371_189_189), // '립' -- '립' + FONTDATA_ITEM(371, 193, 193, fontpage_371_193_193), // '링' -- '링' + FONTDATA_ITEM(371, 204, 204, fontpage_371_204_204), // '만' -- '만' + FONTDATA_ITEM(372, 200, 200, fontpage_372_200_200), // '멈' -- '멈' + FONTDATA_ITEM(372, 212, 212, fontpage_372_212_212), // '메' -- '메' + FONTDATA_ITEM(372, 244, 244, fontpage_372_244_244), // '면' -- '면' + FONTDATA_ITEM(373, 168, 168, fontpage_373_168_168), // '모' -- '모' + FONTDATA_ITEM(376, 128, 128, fontpage_376_128_128), // '밀' -- '밀' + FONTDATA_ITEM(376, 148, 148, fontpage_376_148_148), // '바' -- '바' + FONTDATA_ITEM(377, 132, 132, fontpage_377_132_132), // '버' -- '버' + FONTDATA_ITEM(377, 160, 160, fontpage_377_160_160), // '베' -- '베' + FONTDATA_ITEM(377, 168, 168, fontpage_377_168_168), // '벨' -- '벨' + FONTDATA_ITEM(380, 140, 140, fontpage_380_140_140), // '브' -- '브' + FONTDATA_ITEM(380, 196, 196, fontpage_380_196_196), // '비' -- '비' + FONTDATA_ITEM(385, 189, 189, fontpage_385_189_189), // '삽' -- '삽' + FONTDATA_ITEM(385, 200, 200, fontpage_385_200_200), // '새' -- '새' + FONTDATA_ITEM(386, 164, 164, fontpage_386_164_164), // '설' -- '설' + FONTDATA_ITEM(386, 216, 216, fontpage_386_216_216), // '션' -- '션' + FONTDATA_ITEM(387, 140, 141, fontpage_387_140_141), // '소' -- '속' + FONTDATA_ITEM(389, 164, 164, fontpage_389_164_164), // '스' -- '스' + FONTDATA_ITEM(389, 172, 172, fontpage_389_172_172), // '슬' -- '슬' + FONTDATA_ITEM(389, 220, 221, fontpage_389_220_221), // '시' -- '식' + FONTDATA_ITEM(395, 180, 180, fontpage_395_180_180), // '어' -- '어' + FONTDATA_ITEM(395, 198, 198, fontpage_395_198_198), // '없' -- '없' + FONTDATA_ITEM(395, 209, 209, fontpage_395_209_209), // '엑' -- '엑' + FONTDATA_ITEM(395, 212, 212, fontpage_395_212_212), // '엔' -- '엔' + FONTDATA_ITEM(395, 244, 244, fontpage_395_244_244), // '열' -- '열' + FONTDATA_ITEM(396, 136, 136, fontpage_396_136_136), // '예' -- '예' + FONTDATA_ITEM(396, 164, 164, fontpage_396_164_164), // '오' -- '오' + FONTDATA_ITEM(396, 168, 168, fontpage_396_168_168), // '온' -- '온' + FONTDATA_ITEM(396, 196, 196, fontpage_396_196_196), // '완' -- '완' + FONTDATA_ITEM(397, 208, 208, fontpage_397_208_208), // '원' -- '원' + FONTDATA_ITEM(398, 132, 132, fontpage_398_132_132), // '위' -- '위' + FONTDATA_ITEM(398, 188, 188, fontpage_398_188_188), // '으' -- '으' + FONTDATA_ITEM(398, 204, 204, fontpage_398_204_204), // '음' -- '음' + FONTDATA_ITEM(398, 244, 244, fontpage_398_244_244), // '이' -- '이' + FONTDATA_ITEM(398, 252, 253, fontpage_398_252_253), // '일' -- '읽' + FONTDATA_ITEM(399, 133, 133, fontpage_399_133_133), // '입' -- '입' + FONTDATA_ITEM(399, 144, 145, fontpage_399_144_145), // '자' -- '작' + FONTDATA_ITEM(399, 165, 165, fontpage_399_165_165), // '장' -- '장' + FONTDATA_ITEM(399, 172, 172, fontpage_399_172_172), // '재' -- '재' + FONTDATA_ITEM(400, 128, 128, fontpage_400_128_128), // '저' -- '저' + FONTDATA_ITEM(400, 132, 132, fontpage_400_132_132), // '전' -- '전' + FONTDATA_ITEM(400, 149, 149, fontpage_400_149_149), // '정' -- '정' + FONTDATA_ITEM(400, 156, 156, fontpage_400_156_156), // '제' -- '제' + FONTDATA_ITEM(401, 253, 253, fontpage_401_253_253), // '죽' -- '죽' + FONTDATA_ITEM(402, 128, 128, fontpage_402_128_128), // '준' -- '준' + FONTDATA_ITEM(402, 145, 145, fontpage_402_145_145), // '중' -- '중' + FONTDATA_ITEM(403, 144, 144, fontpage_403_144_144), // '즐' -- '즐' + FONTDATA_ITEM(403, 192, 192, fontpage_403_192_192), // '지' -- '지' + FONTDATA_ITEM(409, 152, 152, fontpage_409_152_152), // '처' -- '처' + FONTDATA_ITEM(410, 136, 136, fontpage_410_136_136), // '초' -- '초' + FONTDATA_ITEM(411, 149, 149, fontpage_411_149_149), // '축' -- '축' + FONTDATA_ITEM(411, 156, 156, fontpage_411_156_156), // '출' -- '출' + FONTDATA_ITEM(411, 164, 164, fontpage_411_164_164), // '춤' -- '춤' + FONTDATA_ITEM(411, 232, 232, fontpage_411_232_232), // '취' -- '취' + FONTDATA_ITEM(412, 216, 216, fontpage_412_216_216), // '치' -- '치' + FONTDATA_ITEM(412, 232, 232, fontpage_412_232_232), // '침' -- '침' + FONTDATA_ITEM(412, 244, 244, fontpage_412_244_244), // '카' -- '카' + FONTDATA_ITEM(413, 152, 152, fontpage_413_152_152), // '캘' -- '캘' + FONTDATA_ITEM(414, 156, 156, fontpage_414_156_156), // '켜' -- '켜' + FONTDATA_ITEM(417, 209, 209, fontpage_417_209_209), // '탑' -- '탑' + FONTDATA_ITEM(418, 176, 176, fontpage_418_176_176), // '터' -- '터' + FONTDATA_ITEM(418, 204, 204, fontpage_418_204_204), // '테' -- '테' + FONTDATA_ITEM(419, 160, 160, fontpage_419_160_160), // '토' -- '토' + FONTDATA_ITEM(421, 184, 184, fontpage_421_184_184), // '트' -- '트' + FONTDATA_ITEM(423, 156, 156, fontpage_423_156_156), // '펜' -- '펜' + FONTDATA_ITEM(426, 132, 132, fontpage_426_132_132), // '프' -- '프' + FONTDATA_ITEM(426, 216, 216, fontpage_426_216_216), // '하' -- '하' + FONTDATA_ITEM(426, 233, 233, fontpage_426_233_233), // '합' -- '합' + FONTDATA_ITEM(428, 200, 200, fontpage_428_200_200), // '홈' -- '홈' + FONTDATA_ITEM(428, 212, 212, fontpage_428_212_212), // '화' -- '화' + FONTDATA_ITEM(431, 136, 136, fontpage_431_136_136), // '히' -- '히' +}; diff --git a/Marlin/src/lcd/dogm/language_data_nl.h b/Marlin/src/lcd/dogm/fontdata/langdata_nl.h similarity index 100% rename from Marlin/src/lcd/dogm/language_data_nl.h rename to Marlin/src/lcd/dogm/fontdata/langdata_nl.h diff --git a/Marlin/src/lcd/dogm/language_data_pl.h b/Marlin/src/lcd/dogm/fontdata/langdata_pl.h similarity index 100% rename from Marlin/src/lcd/dogm/language_data_pl.h rename to Marlin/src/lcd/dogm/fontdata/langdata_pl.h diff --git a/Marlin/src/lcd/dogm/language_data_pt-br.h b/Marlin/src/lcd/dogm/fontdata/langdata_pt-br.h similarity index 100% rename from Marlin/src/lcd/dogm/language_data_pt-br.h rename to Marlin/src/lcd/dogm/fontdata/langdata_pt-br.h diff --git a/Marlin/src/lcd/dogm/language_data_pt.h b/Marlin/src/lcd/dogm/fontdata/langdata_pt.h similarity index 100% rename from Marlin/src/lcd/dogm/language_data_pt.h rename to Marlin/src/lcd/dogm/fontdata/langdata_pt.h diff --git a/Marlin/src/lcd/dogm/language_data_ru.h b/Marlin/src/lcd/dogm/fontdata/langdata_ru.h similarity index 100% rename from Marlin/src/lcd/dogm/language_data_ru.h rename to Marlin/src/lcd/dogm/fontdata/langdata_ru.h diff --git a/Marlin/src/lcd/dogm/language_data_sk.h b/Marlin/src/lcd/dogm/fontdata/langdata_sk.h similarity index 100% rename from Marlin/src/lcd/dogm/language_data_sk.h rename to Marlin/src/lcd/dogm/fontdata/langdata_sk.h diff --git a/Marlin/src/lcd/dogm/language_data_test.h b/Marlin/src/lcd/dogm/fontdata/langdata_test.h similarity index 100% rename from Marlin/src/lcd/dogm/language_data_test.h rename to Marlin/src/lcd/dogm/fontdata/langdata_test.h diff --git a/Marlin/src/lcd/dogm/language_data_tr.h b/Marlin/src/lcd/dogm/fontdata/langdata_tr.h similarity index 100% rename from Marlin/src/lcd/dogm/language_data_tr.h rename to Marlin/src/lcd/dogm/fontdata/langdata_tr.h diff --git a/Marlin/src/lcd/dogm/language_data_uk.h b/Marlin/src/lcd/dogm/fontdata/langdata_uk.h similarity index 100% rename from Marlin/src/lcd/dogm/language_data_uk.h rename to Marlin/src/lcd/dogm/fontdata/langdata_uk.h diff --git a/Marlin/src/lcd/dogm/language_data_zh_CN.h b/Marlin/src/lcd/dogm/fontdata/langdata_zh_CN.h similarity index 100% rename from Marlin/src/lcd/dogm/language_data_zh_CN.h rename to Marlin/src/lcd/dogm/fontdata/langdata_zh_CN.h diff --git a/Marlin/src/lcd/dogm/language_data_zh_TW.h b/Marlin/src/lcd/dogm/fontdata/langdata_zh_TW.h similarity index 100% rename from Marlin/src/lcd/dogm/language_data_zh_TW.h rename to Marlin/src/lcd/dogm/fontdata/langdata_zh_TW.h diff --git a/Marlin/src/lcd/dogm/lcdprint_u8g.cpp b/Marlin/src/lcd/dogm/lcdprint_u8g.cpp new file mode 100644 index 0000000000..d46eb85903 --- /dev/null +++ b/Marlin/src/lcd/dogm/lcdprint_u8g.cpp @@ -0,0 +1,60 @@ +/** + * @file lcdprint_u8g.cpp + * @brief LCD print api for u8glib + * @author Yunhui Fu (yhfudev@gmail.com) + * @version 1.0 + * @date 2016-08-19 + * @copyright GPL/BSD + */ + +#include "../../inc/MarlinConfigPre.h" + +#if HAS_GRAPHICAL_LCD + +#include "ultralcd_DOGM.h" + +#include "../ultralcd.h" +#include "../../Marlin.h" + +#include "../fontutils.h" +#include "u8g_fontutf8.h" +#include "../lcdprint.h" + +int lcd_glyph_height(void) { return u8g_GetFontBBXHeight(u8g.getU8g()); } + +void lcd_moveto(const uint8_t col, const uint8_t row) { u8g.setPrintPos(col, row); } + +void lcd_put_int(const int i) { u8g.print(i); } + +// return < 0 on error +// return the advanced pixels +int lcd_put_wchar_max(wchar_t c, pixel_len_t max_length) { + if (c < 256) { + u8g.print((char)c); + return u8g_GetFontBBXWidth(u8g.getU8g()); + } + unsigned int x = u8g.getPrintCol(), + y = u8g.getPrintRow(), + ret = uxg_DrawWchar(u8g.getU8g(), x, y, c, max_length); + u8g.setPrintPos(x + ret, y); + + return ret; +} + +int lcd_put_u8str_max(const char * utf8_str, pixel_len_t max_length) { + unsigned int x = u8g.getPrintCol(), + y = u8g.getPrintRow(), + ret = uxg_DrawUtf8Str(u8g.getU8g(), x, y, utf8_str, max_length); + u8g.setPrintPos(x + ret, y); + return ret; +} + +int lcd_put_u8str_max_P(PGM_P utf8_str_P, pixel_len_t max_length) { + unsigned int x = u8g.getPrintCol(), + y = u8g.getPrintRow(), + ret = uxg_DrawUtf8StrP(u8g.getU8g(), x, y, utf8_str_P, max_length); + u8g.setPrintPos(x + ret, y); + return ret; +} + +#endif // HAS_GRAPHICAL_LCD diff --git a/Marlin/src/lcd/dogm/status_screen_DOGM.cpp b/Marlin/src/lcd/dogm/status_screen_DOGM.cpp new file mode 100644 index 0000000000..17b5d1558b --- /dev/null +++ b/Marlin/src/lcd/dogm/status_screen_DOGM.cpp @@ -0,0 +1,604 @@ +/** + * 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 . + * + */ + +// +// status_screen_DOGM.cpp +// Standard Status Screen for Graphical Display +// + +#include "../../inc/MarlinConfigPre.h" + +#if HAS_GRAPHICAL_LCD && DISABLED(LIGHTWEIGHT_UI) + +#include "dogm_Statusscreen.h" +#include "ultralcd_DOGM.h" +#include "../ultralcd.h" +#include "../lcdprint.h" + +#include "../../module/motion.h" +#include "../../module/temperature.h" + +#if ENABLED(FILAMENT_LCD_DISPLAY) + #include "../../feature/filwidth.h" + #include "../../module/planner.h" + #include "../../gcode/parser.h" +#endif + +#if ENABLED(SDSUPPORT) + #include "../../sd/cardreader.h" +#endif + +#if HAS_PRINT_PROGRESS + #include "../../module/printcounter.h" +#endif + +FORCE_INLINE void _draw_centered_temp(const int16_t temp, const uint8_t x, const uint8_t y) { + const char *str = itostr3(temp); + const uint8_t len = str[0] != ' ' ? 3 : str[1] != ' ' ? 2 : 1; + lcd_moveto(x - len * (INFO_FONT_WIDTH) / 2 + 1, y); + lcd_put_u8str(&str[3-len]); + lcd_put_wchar(LCD_STR_DEGREE[0]); +} + +#if ENABLED(MARLIN_DEV_MODE) + #define SHOW_ON_STATE READ(X_MIN_PIN) +#else + #define SHOW_ON_STATE false +#endif + +FORCE_INLINE void _draw_heater_status(const uint8_t x, const int8_t heater, const bool blink) { + #if !HEATER_IDLE_HANDLER + UNUSED(blink); + #endif + + #if HAS_HEATED_BED + const bool isBed = heater < 0; + #else + constexpr bool isBed = false; + #endif + + if (PAGE_UNDER(7)) { + #if HEATER_IDLE_HANDLER + const bool is_idle = ( + #if HAS_HEATED_BED + isBed ? thermalManager.is_bed_idle() : + #endif + thermalManager.is_heater_idle(heater) + ); + + if (blink || !is_idle) + #endif + _draw_centered_temp(0.5 + ( + #if HAS_HEATED_BED + isBed ? thermalManager.degTargetBed() : + #endif + thermalManager.degTargetHotend(heater) + ), x, 7 + ); + } + + if (PAGE_CONTAINS(21, 28)) + _draw_centered_temp(0.5f + ( + #if HAS_HEATED_BED + isBed ? thermalManager.degBed() : + #endif + thermalManager.degHotend(heater) + ), x, 28 + ); + + #ifndef STATUS_HOTEND_ANIM + #define INDICATE_HOTEND true + #define INDICATE_HOTEND_ON (thermalManager.isHeatingHotend(heater) ^ SHOW_ON_STATE) + #else + #define INDICATE_HOTEND false + #define INDICATE_HOTEND_ON false + #endif + + #if HAS_HEATED_BED && !defined(STATUS_BED_ANIM) + #define INDICATE_BED true + #define INDICATE_BED_ON (thermalManager.isHeatingBed() ^ SHOW_ON_STATE) + #else + #define INDICATE_BED false + #define INDICATE_BED_ON false + #endif + + if (isBed ? INDICATE_BED : INDICATE_HOTEND) { + if (PAGE_CONTAINS(17, 20)) { + const uint8_t y = 20 - (isBed ? 2 : 3); + if (isBed ? INDICATE_BED_ON : INDICATE_HOTEND_ON) { + u8g.setColorIndex(0); // set to white on black + u8g.drawBox(x, y, 2, 2); + u8g.setColorIndex(1); // restore black on white + } + else + u8g.drawBox(x, y, 2, 2); + } + } + +} + +// +// Before homing, blink '123' <-> '???'. +// Homed but unknown... '123' <-> ' '. +// Homed and known, display constantly. +// +FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const bool blink) { + if (blink) + lcd_put_u8str(value); + else { + if (!TEST(axis_homed, axis)) + while (const char c = *value++) lcd_put_wchar(c <= '.' ? c : '?'); + else { + #if DISABLED(HOME_AFTER_DEACTIVATE) && DISABLED(DISABLE_REDUCED_ACCURACY_WARNING) + if (!TEST(axis_known_position, axis)) + lcd_put_u8str_P(axis == Z_AXIS ? PSTR(" ") : PSTR(" ")); + else + #endif + lcd_put_u8str(value); + } + } +} + +void MarlinUI::draw_status_message(const bool blink) { + + // Get the UTF8 character count of the string + uint8_t slen = utf8_strlen(status_message); + + #if ENABLED(STATUS_MESSAGE_SCROLLING) + + static bool last_blink = false; + + if (slen <= LCD_WIDTH) { + // The string fits within the line. Print with no scrolling + lcd_put_u8str(status_message); + for (; slen < LCD_WIDTH; ++slen) lcd_put_wchar(' '); + } + else { + // String is longer than the available space + + // Get a pointer to the next valid UTF8 character + const char *stat = status_message + status_scroll_offset; + + // Get the string remaining length + const uint8_t rlen = utf8_strlen(stat); + + if (rlen >= LCD_WIDTH) { + // The remaining string fills the screen - Print it + lcd_put_u8str_max(stat, LCD_PIXEL_WIDTH); + } + else { + // The remaining string does not completely fill the screen + lcd_put_u8str_max(stat, LCD_PIXEL_WIDTH); // The string leaves space + uint8_t chars = LCD_WIDTH - rlen; // Amount of space left in characters + + lcd_put_wchar('.'); // Always at 1+ spaces left, draw a dot + if (--chars) { // Draw a second dot if there's space + lcd_put_wchar('.'); + if (--chars) { + // Print a second copy of the message + lcd_put_u8str_max(status_message, LCD_PIXEL_WIDTH - (rlen + 2) * (MENU_FONT_WIDTH)); + } + } + } + if (last_blink != blink) { + last_blink = blink; + + // Adjust by complete UTF8 characters + if (status_scroll_offset < slen) { + status_scroll_offset++; + while (!START_OF_UTF8_CHAR(status_message[status_scroll_offset])) + status_scroll_offset++; + } + else + status_scroll_offset = 0; + } + } + + #else // !STATUS_MESSAGE_SCROLLING + + UNUSED(blink); + + // Just print the string to the LCD + lcd_put_u8str_max(status_message, LCD_PIXEL_WIDTH); + + // Fill the rest with spaces + for (; slen < LCD_WIDTH; ++slen) lcd_put_wchar(' '); + + #endif // !STATUS_MESSAGE_SCROLLING +} + +void MarlinUI::draw_status_screen() { + + #define DO_DRAW_BED (HAS_HEATED_BED && STATUS_BED_WIDTH) + #define DO_DRAW_FAN (HAS_FAN0 && STATUS_FAN_WIDTH && FAN_ANIM_FRAMES) + #define ANIM_END (HOTENDS && defined(STATUS_HOTEND_ANIM)) + #define ANIM_BED (DO_DRAW_BED && defined(STATUS_BED_ANIM)) + #if ANIM_END || ANIM_BED + static uint8_t heat_bits; + #endif + #if ANIM_END + #define HOTEND_ALT(N) TEST(heat_bits, N) + #else + #define HOTEND_ALT(N) false + #endif + #if ANIM_BED + #define BED_ALT TEST(heat_bits, 7) + #else + #define BED_ALT false + #endif + + static char xstring[5], ystring[5], zstring[8]; + #if ENABLED(FILAMENT_LCD_DISPLAY) + static char wstring[5], mstring[4]; + #endif + + // At the first page, generate new display values + if (first_page) { + #if ANIM_END || ANIM_BED + heat_bits = 0; + #if ANIM_END + HOTEND_LOOP() if (thermalManager.isHeatingHotend(e) ^ SHOW_ON_STATE) SBI(heat_bits, e); + #endif + #if ANIM_BED + if (thermalManager.isHeatingBed() ^ SHOW_ON_STATE) SBI(heat_bits, 7); + #endif + #endif + strcpy(xstring, ftostr4sign(LOGICAL_X_POSITION(current_position[X_AXIS]))); + strcpy(ystring, ftostr4sign(LOGICAL_Y_POSITION(current_position[Y_AXIS]))); + strcpy(zstring, ftostr52sp(LOGICAL_Z_POSITION(current_position[Z_AXIS]))); + #if ENABLED(FILAMENT_LCD_DISPLAY) + strcpy(wstring, ftostr12ns(filament_width_meas)); + strcpy(mstring, itostr3(100.0 * ( + parser.volumetric_enabled + ? planner.volumetric_area_nominal / planner.volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM] + : planner.volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM] + ) + )); + #endif + } + + const bool blink = get_blink(); + + // Status Menu Font + set_font(FONT_STATUSMENU); + + #if STATUS_LOGO_WIDTH + if (PAGE_CONTAINS(STATUS_LOGO_Y, STATUS_LOGO_Y + STATUS_LOGO_HEIGHT - 1)) + u8g.drawBitmapP( + STATUS_LOGO_X, STATUS_LOGO_Y, + STATUS_LOGO_BYTEWIDTH, STATUS_LOGO_HEIGHT, + status_logo_bmp + ); + #endif + + #if STATUS_HEATERS_WIDTH || STATUS_HOTEND1_WIDTH + + if (PAGE_CONTAINS(STATUS_HEATERS_Y, STATUS_HEATERS_Y + STATUS_HEATERS_HEIGHT - 1)) { + + #if STATUS_HEATERS_WIDTH + + // Draw all heaters (and maybe the bed) in one go + u8g.drawBitmapP( + STATUS_HEATERS_X, STATUS_HEATERS_Y, + STATUS_HEATERS_BYTEWIDTH, STATUS_HEATERS_HEIGHT, + status_heaters_bmp + ); + + #else + + #if ANIM_END && defined(STATUS_HOTEND_INVERTED) + #define OFF_BMP(N) status_hotend##N##_b_bmp + #define ON_BMP(N) status_hotend##N##_a_bmp + #else + #define OFF_BMP(N) status_hotend##N##_a_bmp + #define ON_BMP(N) status_hotend##N##_b_bmp + #endif + + #if STATUS_HOTEND_BITMAPS > 1 + static const unsigned char* const status_hotend_gfx[STATUS_HOTEND_BITMAPS] PROGMEM = ARRAY_N(STATUS_HOTEND_BITMAPS, OFF_BMP(1), OFF_BMP(2), OFF_BMP(3), OFF_BMP(4), OFF_BMP(5), OFF_BMP(6)); + #if ANIM_END + static const unsigned char* const status_hotend_on_gfx[STATUS_HOTEND_BITMAPS] PROGMEM = ARRAY_N(STATUS_HOTEND_BITMAPS, ON_BMP(1), ON_BMP(2), ON_BMP(3), ON_BMP(4), ON_BMP(5), ON_BMP(6)); + #define HOTEND_BITMAP(N,S) (unsigned char*)pgm_read_ptr((S) ? &status_hotend_on_gfx[(N) % (STATUS_HOTEND_BITMAPS)] : &status_hotend_gfx[(N) % (STATUS_HOTEND_BITMAPS)]) + #else + #define HOTEND_BITMAP(N,S) (unsigned char*)pgm_read_ptr(&status_hotend_gfx[(N) % (STATUS_HOTEND_BITMAPS)]) + #endif + #elif ANIM_END + #define HOTEND_BITMAP(N,S) ((S) ? ON_BMP() : OFF_BMP()) + #else + #define HOTEND_BITMAP(N,S) status_hotend_a_bmp + #endif + + #define MAX_HOTEND_DRAW MIN(HOTENDS, ((128 - (STATUS_LOGO_BYTEWIDTH + STATUS_FAN_BYTEWIDTH) * 8) / (STATUS_HEATERS_XSPACE))) + + // Draw hotends from one or more individual hotend bitmaps + for (uint8_t h = 0; h < MAX_HOTEND_DRAW; ++h) { + u8g.drawBitmapP( + STATUS_HOTEND_X(h), STATUS_HEATERS_Y, + STATUS_HOTEND_BYTEWIDTH(h), STATUS_HEATERS_HEIGHT, + HOTEND_BITMAP(h, HOTEND_ALT(h)) + ); + } + + #endif + + } // PAGE_CONTAINS + + #endif + + #if DO_DRAW_BED + #if ANIM_BED + #define BED_BITMAP(S) ((S) ? status_bed_on_bmp : status_bed_bmp) + #else + #define BED_BITMAP(S) status_bed_bmp + #endif + const uint8_t bedy = STATUS_BED_Y(BED_ALT), bedh = STATUS_BED_HEIGHT(BED_ALT); + if (PAGE_CONTAINS(bedy, bedy + bedh - 1)) { + u8g.drawBitmapP( + STATUS_BED_X, bedy, + STATUS_BED_BYTEWIDTH, bedh, + BED_BITMAP(BED_ALT) + ); + } + #endif + + #if DO_DRAW_FAN + #if FAN_ANIM_FRAMES > 2 + static bool old_blink; + static uint8_t fan_frame; + if (old_blink != blink) { + old_blink = blink; + if (!fan_speed[0] || ++fan_frame >= FAN_ANIM_FRAMES) fan_frame = 0; + } + #endif + if (PAGE_CONTAINS(STATUS_FAN_Y, STATUS_FAN_Y + STATUS_FAN_HEIGHT - 1)) + u8g.drawBitmapP( + STATUS_FAN_X, STATUS_FAN_Y, + STATUS_FAN_BYTEWIDTH, STATUS_FAN_HEIGHT, + #if FAN_ANIM_FRAMES > 2 + fan_frame == 1 ? status_fan1_bmp : + fan_frame == 2 ? status_fan2_bmp : + #if FAN_ANIM_FRAMES > 3 + fan_frame == 3 ? status_fan3_bmp : + #endif + #elif FAN_ANIM_FRAMES > 1 + blink && fan_speed[0] ? status_fan1_bmp : + #endif + status_fan0_bmp + ); + #endif + + // + // Temperature Graphics and Info + // + + if (PAGE_UNDER(28)) { + // Extruders + HOTEND_LOOP() _draw_heater_status(STATUS_HOTEND_TEXT_X(e), e, blink); + + // Heated bed + #if HOTENDS < 4 && HAS_HEATED_BED + _draw_heater_status(STATUS_BED_TEXT_X, -1, blink); + #endif + + // Fan, if a bitmap was provided + #if DO_DRAW_FAN + if (PAGE_CONTAINS(STATUS_FAN_TEXT_Y - INFO_FONT_ASCENT, STATUS_FAN_TEXT_Y)) { + const int per = ((int(fan_speed[0]) + 1) * 100) / 256; + if (per) { + lcd_moveto(STATUS_FAN_TEXT_X, STATUS_FAN_TEXT_Y); + lcd_put_u8str(itostr3(per)); + lcd_put_wchar('%'); + } + } + #endif + } + + #if ENABLED(SDSUPPORT) + // + // SD Card Symbol + // + if (card.isFileOpen() && PAGE_CONTAINS(42, 51)) { + // Upper box + u8g.drawBox(42, 42, 8, 7); // 42-48 (or 41-47) + // Right edge + u8g.drawBox(50, 44, 2, 5); // 44-48 (or 43-47) + // Bottom hollow box + u8g.drawFrame(42, 49, 10, 4); // 49-52 (or 48-51) + // Corner pixel + u8g.drawPixel(50, 43); // 43 (or 42) + } + #endif // SDSUPPORT + + #if HAS_PRINT_PROGRESS + // + // Progress bar frame + // + #define PROGRESS_BAR_X 54 + #define PROGRESS_BAR_WIDTH (LCD_PIXEL_WIDTH - PROGRESS_BAR_X) + + if (PAGE_CONTAINS(49, 52)) // 49-52 (or 49-51) + u8g.drawFrame( + PROGRESS_BAR_X, 49, + PROGRESS_BAR_WIDTH, 4 + ); + + const uint8_t progress = get_progress(); + + if (progress > 1) { + + // + // Progress bar solid part + // + + if (PAGE_CONTAINS(50, 51)) // 50-51 (or just 50) + u8g.drawBox( + PROGRESS_BAR_X + 1, 50, + (uint16_t)((PROGRESS_BAR_WIDTH - 2) * progress * 0.01), 2 + ); + + // + // SD Percent Complete + // + + #if ENABLED(DOGM_SD_PERCENT) + if (PAGE_CONTAINS(41, 48)) { + // Percent complete + lcd_moveto(55, 48); + lcd_put_u8str(itostr3(progress)); + lcd_put_wchar('%'); + } + #endif + } + + // + // Elapsed Time + // + + #if DISABLED(DOGM_SD_PERCENT) + #define SD_DURATION_X (PROGRESS_BAR_X + (PROGRESS_BAR_WIDTH / 2) - len * (MENU_FONT_WIDTH / 2)) + #else + #define SD_DURATION_X (LCD_PIXEL_WIDTH - len * MENU_FONT_WIDTH) + #endif + + if (PAGE_CONTAINS(41, 48)) { + char buffer[13]; + duration_t elapsed = print_job_timer.duration(); + bool has_days = (elapsed.value >= 60*60*24L); + uint8_t len = elapsed.toDigital(buffer, has_days); + lcd_moveto(SD_DURATION_X, 48); + lcd_put_u8str(buffer); + } + + #endif // HAS_PRINT_PROGRESS + + // + // XYZ Coordinates + // + + #define XYZ_BASELINE (30 + INFO_FONT_ASCENT) + + #define X_LABEL_POS 3 + #define X_VALUE_POS 11 + #define XYZ_SPACING 37 + + #if ENABLED(XYZ_HOLLOW_FRAME) + #define XYZ_FRAME_TOP 29 + #define XYZ_FRAME_HEIGHT INFO_FONT_ASCENT + 3 + #else + #define XYZ_FRAME_TOP 30 + #define XYZ_FRAME_HEIGHT INFO_FONT_ASCENT + 1 + #endif + + if (PAGE_CONTAINS(XYZ_FRAME_TOP, XYZ_FRAME_TOP + XYZ_FRAME_HEIGHT - 1)) { + + #if ENABLED(XYZ_HOLLOW_FRAME) + u8g.drawFrame(0, XYZ_FRAME_TOP, LCD_PIXEL_WIDTH, XYZ_FRAME_HEIGHT); // 8: 29-40 7: 29-39 + #else + u8g.drawBox(0, XYZ_FRAME_TOP, LCD_PIXEL_WIDTH, XYZ_FRAME_HEIGHT); // 8: 30-39 7: 30-37 + #endif + + if (PAGE_CONTAINS(XYZ_BASELINE - (INFO_FONT_ASCENT - 1), XYZ_BASELINE)) { + + #if DISABLED(XYZ_HOLLOW_FRAME) + u8g.setColorIndex(0); // white on black + #endif + + lcd_moveto(0 * XYZ_SPACING + X_LABEL_POS, XYZ_BASELINE); + lcd_put_wchar('X'); + lcd_moveto(0 * XYZ_SPACING + X_VALUE_POS, XYZ_BASELINE); + _draw_axis_value(X_AXIS, xstring, blink); + + lcd_moveto(1 * XYZ_SPACING + X_LABEL_POS, XYZ_BASELINE); + lcd_put_wchar('Y'); + lcd_moveto(1 * XYZ_SPACING + X_VALUE_POS, XYZ_BASELINE); + _draw_axis_value(Y_AXIS, ystring, blink); + + lcd_moveto(2 * XYZ_SPACING + X_LABEL_POS, XYZ_BASELINE); + lcd_put_wchar('Z'); + lcd_moveto(2 * XYZ_SPACING + X_VALUE_POS, XYZ_BASELINE); + _draw_axis_value(Z_AXIS, zstring, blink); + + #if DISABLED(XYZ_HOLLOW_FRAME) + u8g.setColorIndex(1); // black on white + #endif + } + } + + // + // Feedrate + // + #define EXTRAS_BASELINE 50 + + if (PAGE_CONTAINS(EXTRAS_BASELINE - (INFO_FONT_HEIGHT - 1), EXTRAS_BASELINE)) { + set_font(FONT_MENU); + lcd_moveto(3, EXTRAS_BASELINE); + lcd_put_wchar(LCD_STR_FEEDRATE[0]); + + set_font(FONT_STATUSMENU); + lcd_moveto(12, EXTRAS_BASELINE); + lcd_put_u8str(itostr3(feedrate_percentage)); + lcd_put_wchar('%'); + + // + // Filament sensor display if SD is disabled + // + #if ENABLED(FILAMENT_LCD_DISPLAY) && DISABLED(SDSUPPORT) + lcd_moveto(56, EXTRAS_BASELINE); + lcd_put_u8str(wstring); + lcd_moveto(102, EXTRAS_BASELINE); + lcd_put_u8str(mstring); + lcd_put_wchar('%'); + set_font(FONT_MENU); + lcd_moveto(47, EXTRAS_BASELINE); + lcd_put_wchar(LCD_STR_FILAM_DIA[0]); // lcd_put_u8str_P(PSTR(LCD_STR_FILAM_DIA)); + lcd_moveto(93, EXTRAS_BASELINE); + lcd_put_wchar(LCD_STR_FILAM_MUL[0]); + #endif + } + + // + // Status line + // + + #define STATUS_BASELINE (LCD_PIXEL_HEIGHT - INFO_FONT_DESCENT) + + if (PAGE_CONTAINS(STATUS_BASELINE - (INFO_FONT_ASCENT - 1), STATUS_BASELINE)) { + lcd_moveto(0, STATUS_BASELINE); + + #if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT) + // Alternate Status message and Filament display + if (ELAPSED(millis(), next_filament_display)) { + lcd_put_u8str_P(PSTR(LCD_STR_FILAM_DIA)); + lcd_put_wchar(':'); + lcd_put_u8str(wstring); + lcd_put_u8str_P(PSTR(" " LCD_STR_FILAM_MUL)); + lcd_put_wchar(':'); + lcd_put_u8str(mstring); + lcd_put_wchar('%'); + } + else + #endif + draw_status_message(blink); + } +} + +#endif // HAS_GRAPHICAL_LCD && !LIGHTWEIGHT_UI diff --git a/Marlin/src/lcd/dogm/status_screen_DOGM.h b/Marlin/src/lcd/dogm/status_screen_DOGM.h deleted file mode 100644 index d8d8b252d8..0000000000 --- a/Marlin/src/lcd/dogm/status_screen_DOGM.h +++ /dev/null @@ -1,495 +0,0 @@ -/** - * 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 . - * - */ - -/** - * status_screen_DOGM.h - * - * Standard Status Screen for Graphical Display - */ - -#ifndef _STATUS_SCREEN_DOGM_H_ -#define _STATUS_SCREEN_DOGM_H_ - -FORCE_INLINE void _draw_centered_temp(const int16_t temp, const uint8_t x, const uint8_t y) { - const char * const str = itostr3(temp); - lcd_moveto(x - (str[0] != ' ' ? 0 : str[1] != ' ' ? 1 : 2) * DOG_CHAR_WIDTH / 2, y); - lcd_put_u8str(str); - lcd_put_u8str_P(PSTR(LCD_STR_DEGREE " ")); -} - -#ifndef HEAT_INDICATOR_X - #define HEAT_INDICATOR_X 8 -#endif - -FORCE_INLINE void _draw_heater_status(const uint8_t x, const int8_t heater, const bool blink) { - #if !HEATER_IDLE_HANDLER - UNUSED(blink); - #endif - - #if HAS_HEATED_BED - const bool isBed = heater < 0; - #else - constexpr bool isBed = false; - #endif - - if (PAGE_UNDER(7)) { - #if HEATER_IDLE_HANDLER - const bool is_idle = ( - #if HAS_HEATED_BED - isBed ? thermalManager.is_bed_idle() : - #endif - thermalManager.is_heater_idle(heater) - ); - - if (blink || !is_idle) - #endif - _draw_centered_temp(0.5 + ( - #if HAS_HEATED_BED - isBed ? thermalManager.degTargetBed() : - #endif - thermalManager.degTargetHotend(heater) - ), x, 7 - ); - } - - if (PAGE_CONTAINS(21, 28)) { - _draw_centered_temp(0.5f + ( - #if HAS_HEATED_BED - isBed ? thermalManager.degBed() : - #endif - thermalManager.degHotend(heater) - ), x, 28 - ); - - if (PAGE_CONTAINS(17, 20)) { - const uint8_t h = isBed ? 7 : HEAT_INDICATOR_X, - y = isBed ? 18 : 17; - if ( - #if HAS_HEATED_BED - isBed ? thermalManager.isHeatingBed() : - #endif - thermalManager.isHeatingHotend(heater) - ) { - u8g.setColorIndex(0); // white on black - u8g.drawBox(x + h, y, 2, 2); - u8g.setColorIndex(1); // black on white - } - else - u8g.drawBox(x + h, y, 2, 2); - } - } -} - -// -// Before homing, blink '123' <-> '???'. -// Homed but unknown... '123' <-> ' '. -// Homed and known, display constantly. -// -FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const bool blink) { - if (blink) - lcd_put_u8str(value); - else { - if (!TEST(axis_homed, axis)) - while (const char c = *value++) lcd_put_wchar(c <= '.' ? c : '?'); - else { - #if DISABLED(HOME_AFTER_DEACTIVATE) && DISABLED(DISABLE_REDUCED_ACCURACY_WARNING) - if (!TEST(axis_known_position, axis)) - lcd_put_u8str_P(axis == Z_AXIS ? PSTR(" ") : PSTR(" ")); - else - #endif - lcd_put_u8str(value); - } - } -} - -inline void lcd_implementation_status_message(const bool blink) { - #if ENABLED(STATUS_MESSAGE_SCROLLING) - static bool last_blink = false; - - // Get the UTF8 character count of the string - uint8_t slen = utf8_strlen(lcd_status_message); - - // If the string fits into the LCD, just print it and do not scroll it - if (slen <= LCD_WIDTH) { - - // The string isn't scrolling and may not fill the screen - lcd_put_u8str(lcd_status_message); - - // Fill the rest with spaces - while (slen < LCD_WIDTH) { - lcd_put_wchar(' '); - ++slen; - } - } - else { - // String is larger than the available space in screen. - - // Get a pointer to the next valid UTF8 character - const char *stat = lcd_status_message + status_scroll_offset; - - // Get the string remaining length - const uint8_t rlen = utf8_strlen(stat); - - // If we have enough characters to display - if (rlen >= LCD_WIDTH) { - // The remaining string fills the screen - Print it - lcd_put_u8str_max(stat, LCD_PIXEL_WIDTH); - } - else { - // The remaining string does not completely fill the screen - lcd_put_u8str_max(stat, LCD_PIXEL_WIDTH); // The string leaves space - uint8_t chars = LCD_WIDTH - rlen; // Amount of space left in characters - - lcd_put_wchar('.'); // Always at 1+ spaces left, draw a dot - if (--chars) { // Draw a second dot if there's space - lcd_put_wchar('.'); - if (--chars) { - // Print a second copy of the message - lcd_put_u8str_max(lcd_status_message, LCD_PIXEL_WIDTH - ((rlen+2) * DOG_CHAR_WIDTH)); - } - } - } - if (last_blink != blink) { - last_blink = blink; - - // Adjust by complete UTF8 characters - if (status_scroll_offset < slen) { - status_scroll_offset++; - while (!START_OF_UTF8_CHAR(lcd_status_message[status_scroll_offset])) - status_scroll_offset++; - } - else - status_scroll_offset = 0; - } - } - #else - UNUSED(blink); - - // Get the UTF8 character count of the string - uint8_t slen = utf8_strlen(lcd_status_message); - - // Just print the string to the LCD - lcd_put_u8str_max(lcd_status_message, LCD_PIXEL_WIDTH); - - // Fill the rest with spaces if there are missing spaces - while (slen < LCD_WIDTH) { - lcd_put_wchar(' '); - ++slen; - } - #endif -} - -static void lcd_implementation_status_screen() { - - const bool blink = lcd_blink(); - - #if FAN_ANIM_FRAMES > 2 - static bool old_blink; - static uint8_t fan_frame; - if (old_blink != blink) { - old_blink = blink; - if (!fanSpeeds[0] || ++fan_frame >= FAN_ANIM_FRAMES) fan_frame = 0; - } - #endif - - // Status Menu Font - lcd_setFont(FONT_STATUSMENU); - - // - // Fan Animation - // - // Draws the whole heading image as a B/W bitmap rather than - // drawing the elements separately. - // This was done as an optimization, as it was slower to draw - // multiple parts compared to a single bitmap. - // - // The bitmap: - // - May be offset in X - // - Includes all nozzle(s), bed(s), and the fan. - // - // TODO: - // - // - Only draw the whole header on the first - // entry to the status screen. Nozzle, bed, and - // fan outline bits don't change. - // - if (PAGE_UNDER(STATUS_SCREENHEIGHT + 1)) { - - u8g.drawBitmapP( - STATUS_SCREEN_X, STATUS_SCREEN_Y, - (STATUS_SCREENWIDTH + 7) / 8, STATUS_SCREENHEIGHT, - #if HAS_FAN0 - #if FAN_ANIM_FRAMES > 2 - fan_frame == 1 ? status_screen1_bmp : - fan_frame == 2 ? status_screen2_bmp : - #if FAN_ANIM_FRAMES > 3 - fan_frame == 3 ? status_screen3_bmp : - #endif - #else - blink && fanSpeeds[0] ? status_screen1_bmp : - #endif - #endif - status_screen0_bmp - ); - - } - - // - // Temperature Graphics and Info - // - - if (PAGE_UNDER(28)) { - // Extruders - HOTEND_LOOP() _draw_heater_status(STATUS_SCREEN_HOTEND_TEXT_X(e), e, blink); - - // Heated bed - #if HOTENDS < 4 && HAS_HEATED_BED - _draw_heater_status(STATUS_SCREEN_BED_TEXT_X, -1, blink); - #endif - - #if HAS_FAN0 - if (PAGE_CONTAINS(STATUS_SCREEN_FAN_TEXT_Y - 7, STATUS_SCREEN_FAN_TEXT_Y)) { - // Fan - const int16_t per = ((fanSpeeds[0] + 1) * 100) / 256; - if (per) { - lcd_moveto(STATUS_SCREEN_FAN_TEXT_X, STATUS_SCREEN_FAN_TEXT_Y); - lcd_put_u8str(itostr3(per)); - lcd_put_wchar('%'); - } - } - #endif - } - - #if ENABLED(SDSUPPORT) - // - // SD Card Symbol - // - if (card.isFileOpen() && PAGE_CONTAINS(42 - (TALL_FONT_CORRECTION), 51 - (TALL_FONT_CORRECTION))) { - // Upper box - u8g.drawBox(42, 42 - (TALL_FONT_CORRECTION), 8, 7); // 42-48 (or 41-47) - // Right edge - u8g.drawBox(50, 44 - (TALL_FONT_CORRECTION), 2, 5); // 44-48 (or 43-47) - // Bottom hollow box - u8g.drawFrame(42, 49 - (TALL_FONT_CORRECTION), 10, 4); // 49-52 (or 48-51) - // Corner pixel - u8g.drawPixel(50, 43 - (TALL_FONT_CORRECTION)); // 43 (or 42) - } - #endif // SDSUPPORT - - #if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) - // - // Progress bar frame - // - #define PROGRESS_BAR_X 54 - #define PROGRESS_BAR_WIDTH (LCD_PIXEL_WIDTH - PROGRESS_BAR_X) - - if (PAGE_CONTAINS(49, 52 - (TALL_FONT_CORRECTION))) // 49-52 (or 49-51) - u8g.drawFrame( - PROGRESS_BAR_X, 49, - PROGRESS_BAR_WIDTH, 4 - (TALL_FONT_CORRECTION) - ); - - #if DISABLED(LCD_SET_PROGRESS_MANUALLY) - const uint8_t progress_bar_percent = card.percentDone(); - #endif - - if (progress_bar_percent > 1) { - - // - // Progress bar solid part - // - - if (PAGE_CONTAINS(50, 51 - (TALL_FONT_CORRECTION))) // 50-51 (or just 50) - u8g.drawBox( - PROGRESS_BAR_X + 1, 50, - (uint16_t)((PROGRESS_BAR_WIDTH - 2) * progress_bar_percent * 0.01), 2 - (TALL_FONT_CORRECTION) - ); - - // - // SD Percent Complete - // - - #if ENABLED(DOGM_SD_PERCENT) - if (PAGE_CONTAINS(41, 48)) { - // Percent complete - lcd_moveto(55, 48); - lcd_put_u8str(itostr3(progress_bar_percent)); - lcd_put_wchar('%'); - } - #endif - } - - // - // Elapsed Time - // - - #if DISABLED(DOGM_SD_PERCENT) - #define SD_DURATION_X (PROGRESS_BAR_X + (PROGRESS_BAR_WIDTH / 2) - len * (DOG_CHAR_WIDTH / 2)) - #else - #define SD_DURATION_X (LCD_PIXEL_WIDTH - len * DOG_CHAR_WIDTH) - #endif - - if (PAGE_CONTAINS(41, 48)) { - char buffer[10]; - duration_t elapsed = print_job_timer.duration(); - bool has_days = (elapsed.value >= 60*60*24L); - uint8_t len = elapsed.toDigital(buffer, has_days); - lcd_moveto(SD_DURATION_X, 48); - lcd_put_u8str(buffer); - } - - #endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY - - // - // XYZ Coordinates - // - - #define XYZ_BASELINE (30 + INFO_FONT_HEIGHT) - - #define X_LABEL_POS 3 - #define X_VALUE_POS 11 - #define XYZ_SPACING 40 - - #if ENABLED(XYZ_HOLLOW_FRAME) - #define XYZ_FRAME_TOP 29 - #define XYZ_FRAME_HEIGHT INFO_FONT_HEIGHT + 3 - #else - #define XYZ_FRAME_TOP 30 - #define XYZ_FRAME_HEIGHT INFO_FONT_HEIGHT + 1 - #endif - - static char xstring[5], ystring[5], zstring[7]; - #if ENABLED(FILAMENT_LCD_DISPLAY) - static char wstring[5], mstring[4]; - #endif - - // At the first page, regenerate the XYZ strings - if (page.page == 0) { - strcpy(xstring, ftostr4sign(LOGICAL_X_POSITION(current_position[X_AXIS]))); - strcpy(ystring, ftostr4sign(LOGICAL_Y_POSITION(current_position[Y_AXIS]))); - strcpy(zstring, ftostr52sp(LOGICAL_Z_POSITION(current_position[Z_AXIS]))); - #if ENABLED(FILAMENT_LCD_DISPLAY) - strcpy(wstring, ftostr12ns(filament_width_meas)); - strcpy(mstring, itostr3(100.0 * ( - parser.volumetric_enabled - ? planner.volumetric_area_nominal / planner.volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM] - : planner.volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM] - ) - )); - #endif - } - - if (PAGE_CONTAINS(XYZ_FRAME_TOP, XYZ_FRAME_TOP + XYZ_FRAME_HEIGHT - 1)) { - - #if ENABLED(XYZ_HOLLOW_FRAME) - u8g.drawFrame(0, XYZ_FRAME_TOP, LCD_PIXEL_WIDTH, XYZ_FRAME_HEIGHT); // 8: 29-40 7: 29-39 - #else - u8g.drawBox(0, XYZ_FRAME_TOP, LCD_PIXEL_WIDTH, XYZ_FRAME_HEIGHT); // 8: 30-39 7: 30-37 - #endif - - if (PAGE_CONTAINS(XYZ_BASELINE - (INFO_FONT_HEIGHT - 1), XYZ_BASELINE)) { - - #if DISABLED(XYZ_HOLLOW_FRAME) - u8g.setColorIndex(0); // white on black - #endif - - lcd_moveto(0 * XYZ_SPACING + X_LABEL_POS, XYZ_BASELINE); - lcd_put_wchar('X'); - lcd_moveto(0 * XYZ_SPACING + X_VALUE_POS, XYZ_BASELINE); - _draw_axis_value(X_AXIS, xstring, blink); - - lcd_moveto(1 * XYZ_SPACING + X_LABEL_POS, XYZ_BASELINE); - lcd_put_wchar('Y'); - lcd_moveto(1 * XYZ_SPACING + X_VALUE_POS, XYZ_BASELINE); - _draw_axis_value(Y_AXIS, ystring, blink); - - lcd_moveto(2 * XYZ_SPACING + X_LABEL_POS, XYZ_BASELINE); - lcd_put_wchar('Z'); - lcd_moveto(2 * XYZ_SPACING + X_VALUE_POS, XYZ_BASELINE); - _draw_axis_value(Z_AXIS, zstring, blink); - - #if DISABLED(XYZ_HOLLOW_FRAME) - u8g.setColorIndex(1); // black on white - #endif - } - } - - // - // Feedrate - // - - if (PAGE_CONTAINS(51 - INFO_FONT_HEIGHT, 49)) { - lcd_setFont(FONT_MENU); - lcd_moveto(3, 50); - lcd_put_wchar(LCD_STR_FEEDRATE[0]); - - lcd_setFont(FONT_STATUSMENU); - lcd_moveto(12, 50); - lcd_put_u8str(itostr3(feedrate_percentage)); - lcd_put_wchar('%'); - - // - // Filament sensor display if SD is disabled - // - #if ENABLED(FILAMENT_LCD_DISPLAY) && DISABLED(SDSUPPORT) - lcd_moveto(56, 50); - lcd_put_u8str(wstring); - lcd_moveto(102, 50); - lcd_put_u8str(mstring); - lcd_put_wchar('%'); - lcd_setFont(FONT_MENU); - lcd_moveto(47, 50); - lcd_put_wchar(LCD_STR_FILAM_DIA[0]); // lcd_put_u8str_P(PSTR(LCD_STR_FILAM_DIA)); - lcd_moveto(93, 50); - lcd_put_wchar(LCD_STR_FILAM_MUL[0]); - #endif - } - - // - // Status line - // - - #define STATUS_BASELINE (55 + INFO_FONT_HEIGHT) - - if (PAGE_CONTAINS(STATUS_BASELINE - (INFO_FONT_HEIGHT - 1), STATUS_BASELINE)) { - lcd_moveto(0, STATUS_BASELINE); - - #if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT) - if (PENDING(millis(), previous_lcd_status_ms + 5000UL)) { //Display both Status message line and Filament display on the last line - lcd_implementation_status_message(blink); - } - else { - lcd_put_u8str_P(PSTR(LCD_STR_FILAM_DIA)); - lcd_put_wchar(':'); - lcd_put_u8str(wstring); - lcd_put_u8str_P(PSTR(" " LCD_STR_FILAM_MUL)); - lcd_put_wchar(':'); - lcd_put_u8str(mstring); - lcd_put_wchar('%'); - } - #else - lcd_implementation_status_message(blink); - #endif - } -} - -#endif // _STATUS_SCREEN_DOGM_H_ diff --git a/Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp b/Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp new file mode 100644 index 0000000000..126ef00b51 --- /dev/null +++ b/Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp @@ -0,0 +1,968 @@ +/** + * Lightweight Status Screen for the RepRapDiscount Full + * Graphics Smart Controller (ST7920-based 128x64 LCD) + * + * (c) 2017 Aleph Objects, Inc. + * + * The code in this page is free software: you can + * redistribute it and/or modify it under the terms of the GNU + * General Public License (GNU GPL) as published by the Free Software + * Foundation, either version 3 of the License, or (at your option) + * any later version. The code is distributed WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU GPL for more details. + * + */ + +/** + * Implementation of a Status Screen for the RepRapDiscount + * Full Graphics Smart Controller using native ST7920 commands + * instead of U8Glib. + * + * This alternative Status Screen makes use of the built-in character + * generation capabilities of the ST7920 to update the Status Screen + * with less SPI traffic and CPU use. In particular: + * + * - The fan and bed animations are handled using custom characters + * that are stored in CGRAM. This allows for the animation to be + * updated by writing a single character to the text-buffer (DDRAM). + * + * - All the information in the Status Screen is text that is written + * to DDRAM, so the work of generating the bitmaps is offloaded to + * the ST7920 rather than being render by U8Glib on the MCU. + * + * - The graphics buffer (GDRAM) is only used for static graphics + * elements (nozzle and feedrate bitmaps) and for the progress + * bar, so updates are sporadic. + */ + +// +// status_screen_lite_ST7920.cpp +// Lightweight Status Screen for Graphical Display +// + +#include "../../inc/MarlinConfigPre.h" + +#if ENABLED(LIGHTWEIGHT_UI) + +#include "status_screen_lite_ST7920.h" + +#include "../ultralcd.h" +#include "../fontutils.h" +#include "../lcdprint.h" +#include "../../libs/duration_t.h" +#include "../../module/motion.h" +#include "../../module/printcounter.h" +#include "../../module/temperature.h" + +#if ENABLED(SDSUPPORT) + #include "../../sd/cardreader.h" +#endif + +#define BUFFER_WIDTH 256 +#define BUFFER_HEIGHT 32 + +#define DDRAM_LINE_1 0x00 +#define DDRAM_LINE_2 0x10 +#define DDRAM_LINE_3 0x08 +#define DDRAM_LINE_4 0x18 + +ST7920_Lite_Status_Screen::st7920_state_t ST7920_Lite_Status_Screen::current_bits; + +void ST7920_Lite_Status_Screen::cmd(const uint8_t cmd) { + if (!current_bits.synced || !current_bits.cmd) { + current_bits.synced = true; + current_bits.cmd = true; + sync_cmd(); + } + write_byte(cmd); +} + +void ST7920_Lite_Status_Screen::begin_data() { + if (!current_bits.synced || current_bits.cmd) { + current_bits.synced = true; + current_bits.cmd = false; + sync_dat(); + } +} + +void ST7920_Lite_Status_Screen::write_str(const char *str) { + while (*str) write_byte(*str++); +} + +void ST7920_Lite_Status_Screen::write_str(const char *str, uint8_t len) { + while (*str && len--) write_byte(*str++); +} + +void ST7920_Lite_Status_Screen::write_str_P(PGM_P const str) { + PGM_P p_str = (PGM_P)str; + while (char c = pgm_read_byte(p_str++)) write_byte(c); +} + +void ST7920_Lite_Status_Screen::write_number(const int16_t value, const uint8_t digits/*=3*/) { + char str[7]; + PGM_P fmt; + switch (digits) { + case 6: fmt = PSTR("%6d"); break; + case 5: fmt = PSTR("%5d"); break; + case 4: fmt = PSTR("%4d"); break; + case 3: fmt = PSTR("%3d"); break; + case 2: fmt = PSTR("%2d"); break; + case 1: fmt = PSTR("%1d"); break; + default: return; + } + sprintf_P(str, fmt, value); + write_str(str); +} + +void ST7920_Lite_Status_Screen::display_status(const bool display_on, const bool cursor_on, const bool blink_on) { + extended_function_set(false); + cmd(0b00001000 | + (display_on ? 0b0100 : 0) | + (cursor_on ? 0b0010 : 0) | + (blink_on ? 0b0001 : 0) + ); +} + +// Sets the extended and graphics bits simultaneously, regardless of +// the current state. This is a helper function for extended_function_set() +// and graphics() +void ST7920_Lite_Status_Screen::_extended_function_set(const bool extended, const bool graphics) { + cmd( 0b00100000 | + (extended ? 0b00000100 : 0) | + (graphics ? 0b00000010 : 0) + ); + current_bits.extended = extended; + current_bits.graphics = graphics; +} + +void ST7920_Lite_Status_Screen::extended_function_set(const bool extended) { + if (extended != current_bits.extended) + _extended_function_set(extended, current_bits.graphics); +} + +void ST7920_Lite_Status_Screen::graphics(const bool graphics) { + if (graphics != current_bits.graphics) + _extended_function_set(current_bits.extended, graphics); +} + +void ST7920_Lite_Status_Screen::entry_mode_select(const bool ac_increase, const bool shift) { + extended_function_set(false); + cmd(0b00000100 | + (ac_increase ? 0b00000010 : 0) | + (shift ? 0b00000001 : 0) + ); +} + +// Sets the sa bit regardless of the current state. This is a helper +// function for scroll_or_addr_select() +void ST7920_Lite_Status_Screen::_scroll_or_addr_select(const bool sa) { + extended_function_set(true); + cmd(0b00100010 | + (sa ? 0b000001 : 0) + ); + current_bits.sa = sa; +} + +void ST7920_Lite_Status_Screen::scroll_or_addr_select(const bool sa) { + if (sa != current_bits.sa) + _scroll_or_addr_select(sa); +} + +void ST7920_Lite_Status_Screen::set_ddram_address(const uint8_t addr) { + extended_function_set(false); + cmd(0b10000000 | (addr & 0b00111111)); +} + +void ST7920_Lite_Status_Screen::set_cgram_address(const uint8_t addr) { + extended_function_set(false); + cmd(0b01000000 | (addr & 0b00111111)); +} + +void ST7920_Lite_Status_Screen::set_gdram_address(const uint8_t x, const uint8_t y) { + extended_function_set(true); + cmd(0b10000000 | (y & 0b01111111)); + cmd(0b10000000 | (x & 0b00001111)); +} + +void ST7920_Lite_Status_Screen::clear() { + extended_function_set(false); + cmd(0x00000001); + delay(15); //delay for CGRAM clear +} + +void ST7920_Lite_Status_Screen::home() { + extended_function_set(false); + cmd(0x00000010); +} + +/* This fills the entire text buffer with spaces */ +void ST7920_Lite_Status_Screen::clear_ddram() { + set_ddram_address(DDRAM_LINE_1); + begin_data(); + for (uint8_t i = 64; i--;) write_byte(' '); +} + +/* This fills the entire graphics buffer with zeros */ +void ST7920_Lite_Status_Screen::clear_gdram() { + for (uint8_t y = 0; y < BUFFER_HEIGHT; y++) { + set_gdram_address(0, y); + begin_data(); + for (uint8_t i = (BUFFER_WIDTH) / 16; i--;) write_word(0); + } +} + +void ST7920_Lite_Status_Screen::load_cgram_icon(const uint16_t addr, const void *data) { + const uint16_t *p_word = (const uint16_t *)data; + set_cgram_address(addr); + begin_data(); + for (uint8_t i = 16; i--;) + write_word(pgm_read_word(p_word++)); +} + +/** + * Draw an icon in GDRAM. Position specified in DDRAM + * coordinates. i.e., X from 1 to 8, Y from 1 to 4. + */ +void ST7920_Lite_Status_Screen::draw_gdram_icon(uint8_t x, uint8_t y, const void *data) { + const uint16_t *p_word = (const uint16_t *)data; + // Handle display folding + if (y > 1) y -= 2, x += 8; + for (int i = 0; i < 16; i++) { + set_gdram_address(x, i + y * 16); + begin_data(); + write_word(pgm_read_word(p_word++)); + } +} + +/************************** ICON DEFINITIONS *************************************/ + +#define CGRAM_ICON_1_ADDR 0x00 +#define CGRAM_ICON_2_ADDR 0x10 +#define CGRAM_ICON_3_ADDR 0x20 +#define CGRAM_ICON_4_ADDR 0x30 + +#define CGRAM_ICON_1_WORD 0x00 +#define CGRAM_ICON_2_WORD 0x02 +#define CGRAM_ICON_3_WORD 0x04 +#define CGRAM_ICON_4_WORD 0x06 + +const uint8_t degree_symbol_y_top = 1; +PROGMEM const uint8_t degree_symbol[] = { + 0b00110000, + 0b01001000, + 0b01001000, + 0b00110000, +}; + +const uint16_t nozzle_icon[] PROGMEM = { + 0b0000000000000000, + 0b0000000000000000, + 0b0000111111110000, + 0b0001111111111000, + 0b0001111111111000, + 0b0001111111111000, + 0b0000111111110000, + 0b0000111111110000, + 0b0001111111111000, + 0b0001111111111000, + 0b0001111111111000, + 0b0000011111100000, + 0b0000001111000000, + 0b0000000110000000, + 0b0000000000000000, + 0b0000000000000000 +}; + +const uint16_t bed_icon[] PROGMEM = { + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0111111111111110, + 0b0111111111111110, + 0b0110000000000110, + 0b0000000000000000, + 0b0000000000000000 +}; + +const uint16_t heat1_icon[] PROGMEM = { + 0b0000000000000000, + 0b0010001000100000, + 0b0001000100010000, + 0b0000100010001000, + 0b0000100010001000, + 0b0001000100010000, + 0b0010001000100000, + 0b0010001000100000, + 0b0001000100010000, + 0b0000100010001000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000 +}; + +const uint16_t heat2_icon[] PROGMEM = { + 0b0000000000000000, + 0b0000100010001000, + 0b0000100010001000, + 0b0001000100010000, + 0b0010001000100000, + 0b0010001000100000, + 0b0001000100010000, + 0b0000100010001000, + 0b0000100010001000, + 0b0001000100010000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000 +}; + +const uint16_t fan1_icon[] PROGMEM = { + 0b0000000000000000, + 0b0111111111111110, + 0b0111000000001110, + 0b0110001111000110, + 0b0100001111000010, + 0b0100000110000010, + 0b0101100000011010, + 0b0101110110111010, + 0b0101100000011010, + 0b0100000110000010, + 0b0100001111000010, + 0b0110001111000110, + 0b0111000000001110, + 0b0111111111111110, + 0b0000000000000000, + 0b0000000000000000 +}; + +const uint16_t fan2_icon[] PROGMEM = { + 0b0000000000000000, + 0b0111111111111110, + 0b0111000000001110, + 0b0110010000100110, + 0b0100111001110010, + 0b0101111001111010, + 0b0100110000110010, + 0b0100000110000010, + 0b0100110000110010, + 0b0101111001111010, + 0b0100111001110010, + 0b0110010000100110, + 0b0111000000001110, + 0b0111111111111110, + 0b0000000000000000, + 0b0000000000000000 +}; + +const uint16_t feedrate_icon[] PROGMEM = { + 0b0000000000000000, + 0b0111111000000000, + 0b0110000000000000, + 0b0110000000000000, + 0b0110000000000000, + 0b0111111011111000, + 0b0110000011001100, + 0b0110000011001100, + 0b0110000011001100, + 0b0110000011111000, + 0b0000000011001100, + 0b0000000011001100, + 0b0000000011001100, + 0b0000000011001100, + 0b0000000000000000, + 0b0000000000000000 +}; + +/************************** MAIN SCREEN *************************************/ + +/** + * The ST7920 has no degree character, so draw it to GDRAM. + * This function takes character position xy + * i.e., x is [0-15], while the y position is [0-3] + */ +void ST7920_Lite_Status_Screen::draw_degree_symbol(uint8_t x, uint8_t y, const bool draw) { + const uint8_t *p_bytes = degree_symbol; + // Handle display folding + if (y > 1) y -= 2, x += 16; + const bool oddChar = x & 1; + const uint8_t x_word = x >> 1, + y_top = degree_symbol_y_top, + y_bot = y_top + sizeof(degree_symbol)/sizeof(degree_symbol[0]); + for (uint8_t i = y_top; i < y_bot; i++) { + uint8_t byte = pgm_read_byte(p_bytes++); + set_gdram_address(x_word, i + y * 16); + begin_data(); + if (draw) { + write_byte(oddChar ? 0x00 : byte); + write_byte(oddChar ? byte : 0x00); + } + else + write_word(0x0000); + } +} + +void ST7920_Lite_Status_Screen::draw_static_elements() { + scroll_or_addr_select(0); + + // Load the animated bed and fan icons + load_cgram_icon(CGRAM_ICON_1_ADDR, heat1_icon); + load_cgram_icon(CGRAM_ICON_2_ADDR, heat2_icon); + load_cgram_icon(CGRAM_ICON_3_ADDR, fan1_icon); + load_cgram_icon(CGRAM_ICON_4_ADDR, fan2_icon); + + // Draw the static icons in GDRAM + draw_gdram_icon(0, 0, nozzle_icon); + #if HOTENDS > 1 + draw_gdram_icon(0, 1, nozzle_icon); + draw_gdram_icon(0, 2, bed_icon); + #else + draw_gdram_icon(0, 1, bed_icon); + #endif + draw_gdram_icon(5, 1, feedrate_icon); + + // Draw the initial fan icon + draw_fan_icon(false); +} + +/** + * Although this is undocumented, the ST7920 allows the character + * data buffer (DDRAM) to be used in conjunction with the graphics + * bitmap buffer (CGRAM). The contents of the graphics buffer is + * XORed with the data from the character generator. This allows + * us to make the progess bar out of graphical data (the bar) and + * text data (the percentage). + */ +void ST7920_Lite_Status_Screen::draw_progress_bar(const uint8_t value) { + #if HOTENDS == 1 + // If we have only one extruder, draw a long progress bar on the third line + constexpr uint8_t top = 1, // Top in pixels + bottom = 13, // Bottom in pixels + left = 12, // Left edge, in 16-bit words + width = 4; // Width of progress bar, in 16-bit words + #else + constexpr uint8_t top = 16 + 1, + bottom = 16 + 13, + left = 5, + width = 3; + #endif + const uint8_t char_pcnt = 100 / width; // How many percent does each 16-bit word represent? + + // Draw the progress bar as a bitmap in CGRAM + for (uint8_t y = top; y <= bottom; y++) { + set_gdram_address(left, y); + begin_data(); + for (uint8_t x = 0; x < width; x++) { + uint16_t gfx_word = 0x0000; + if ((x + 1) * char_pcnt <= value) + gfx_word = 0xFFFF; // Draw completely filled bytes + else if ((x * char_pcnt) < value) + gfx_word = int(0x8000) >> (value % char_pcnt) * 16 / char_pcnt; // Draw partially filled bytes + + // Draw the frame around the progress bar + if (y == top || y == bottom) + gfx_word = 0xFFFF; // Draw top/bottom border + else if (x == width - 1) + gfx_word |= 0x0001; // Draw right border + else if (x == 0) + gfx_word |= 0x8000; // Draw left border + write_word(gfx_word); + } + } + + // Draw the percentage as text in DDRAM + #if HOTENDS == 1 + set_ddram_address(DDRAM_LINE_3 + 4); + begin_data(); + write_byte(' '); + #else + set_ddram_address(DDRAM_LINE_2 + left); + begin_data(); + #endif + + // Draw centered + if (value > 9) { + write_number(value, 4); + write_str_P(PSTR("% ")); + } + else { + write_number(value, 3); + write_str_P(PSTR("% ")); + } +} + +void ST7920_Lite_Status_Screen::draw_fan_icon(const bool whichIcon) { + set_ddram_address(DDRAM_LINE_1 + 5); + begin_data(); + write_word(whichIcon ? CGRAM_ICON_3_WORD : CGRAM_ICON_4_WORD); +} + +void ST7920_Lite_Status_Screen::draw_heat_icon(const bool whichIcon, const bool heating) { + set_ddram_address( + #if HOTENDS == 1 + DDRAM_LINE_2 + #else + DDRAM_LINE_3 + #endif + ); + begin_data(); + if (heating) + write_word(whichIcon ? CGRAM_ICON_1_WORD : CGRAM_ICON_2_WORD); + else { + write_byte(' '); + write_byte(' '); + } +} + +#define FAR(a,b) (((a > b) ? (a-b) : (b-a)) > 2) + +static struct { + bool E1_show_target : 1; + bool E2_show_target : 1; + #if HAS_HEATED_BED + bool bed_show_target : 1; + #endif +} display_state = { + true, true + #if HAS_HEATED_BED + , true + #endif +}; + +void ST7920_Lite_Status_Screen::draw_temps(uint8_t line, const int16_t temp, const int16_t target, bool showTarget, bool targetStateChange) { + switch (line) { + case 0: set_ddram_address(DDRAM_LINE_1 + 1); break; + case 1: set_ddram_address(DDRAM_LINE_2 + 1); break; + case 2: set_ddram_address(DDRAM_LINE_3 + 1); break; + case 3: set_ddram_address(DDRAM_LINE_3 + 1); break; + } + begin_data(); + write_number(temp); + + if (showTarget) { + write_byte('\x1A'); + write_number(target); + }; + + if (targetStateChange) { + if (!showTarget) write_str_P(PSTR(" ")); + draw_degree_symbol(5, line, !showTarget); + draw_degree_symbol(9, line, showTarget); + } +} + +void ST7920_Lite_Status_Screen::draw_extruder_1_temp(const int16_t temp, const int16_t target, bool forceUpdate) { + const bool show_target = target && FAR(temp, target); + draw_temps(0, temp, target, show_target, display_state.E1_show_target != show_target || forceUpdate); + display_state.E1_show_target = show_target; +} + +void ST7920_Lite_Status_Screen::draw_extruder_2_temp(const int16_t temp, const int16_t target, bool forceUpdate) { + const bool show_target = target && FAR(temp, target); + draw_temps(1, temp, target, show_target, display_state.E2_show_target != show_target || forceUpdate); + display_state.E2_show_target = show_target; +} + +#if HAS_HEATED_BED + void ST7920_Lite_Status_Screen::draw_bed_temp(const int16_t temp, const int16_t target, bool forceUpdate) { + const bool show_target = target && FAR(temp, target); + draw_temps(1 + #if HOTENDS > 1 + + 1 + #endif + , temp, target, show_target, display_state.bed_show_target != show_target || forceUpdate + ); + display_state.bed_show_target = show_target; + } +#endif + +void ST7920_Lite_Status_Screen::draw_fan_speed(const uint8_t value) { + set_ddram_address(DDRAM_LINE_1 + 6); + begin_data(); + write_number(value, 3); + write_byte('%'); +} + +void ST7920_Lite_Status_Screen::draw_print_time(const duration_t &elapsed) { + #if HOTENDS == 1 + set_ddram_address(DDRAM_LINE_3); + #else + set_ddram_address(DDRAM_LINE_3 + 5); + #endif + char str[7]; + str[elapsed.toDigital(str)] = ' '; + begin_data(); + write_str(str, 6); +} + +void ST7920_Lite_Status_Screen::draw_feedrate_percentage(const uint16_t percentage) { + // We only have enough room for the feedrate when + // we have one extruder + #if HOTENDS == 1 + set_ddram_address(DDRAM_LINE_2 + 6); + begin_data(); + write_number(percentage, 3); + write_byte('%'); + #endif +} + +void ST7920_Lite_Status_Screen::draw_status_message() { + const char *str = ui.status_message; + + set_ddram_address(DDRAM_LINE_4); + begin_data(); + #if ENABLED(STATUS_MESSAGE_SCROLLING) + + uint8_t slen = utf8_strlen(str); + + if (slen <= LCD_WIDTH) { + // String fits the LCD, so just print it + write_str(str); + for (; slen < LCD_WIDTH; ++slen) write_byte(' '); + } + else { + // String is larger than the available space in screen. + + // Get a pointer to the next valid UTF8 character + const char *stat = str + ui.status_scroll_offset; + + // Get the string remaining length + const uint8_t rlen = utf8_strlen(stat); + + // If we have enough characters to display + if (rlen >= LCD_WIDTH) { + // The remaining string fills the screen - Print it + write_str(stat, LCD_WIDTH); + } + else { + // The remaining string does not completely fill the screen + write_str(stat); // The string leaves space + uint8_t chars = LCD_WIDTH - rlen; // Amount of space left in characters + + write_byte('.'); // Always at 1+ spaces left, draw a dot + if (--chars) { // Draw a second dot if there's space + write_byte('.'); + if (--chars) + write_str(str, chars); // Print a second copy of the message + } + } + + // Adjust by complete UTF8 characters + if (ui.status_scroll_offset < slen) { + ui.status_scroll_offset++; + while (!START_OF_UTF8_CHAR(str[ui.status_scroll_offset])) + ui.status_scroll_offset++; + } + else + ui.status_scroll_offset = 0; + } + + #else + + uint8_t slen = utf8_strlen(str); + write_str(str, LCD_WIDTH); + for (; slen < LCD_WIDTH; ++slen) write_byte(' '); + + #endif +} + +void ST7920_Lite_Status_Screen::draw_position(const float x, const float y, const float z, bool position_known) { + char str[7]; + set_ddram_address(DDRAM_LINE_4); + begin_data(); + + // If position is unknown, flash the labels. + const unsigned char alt_label = position_known ? 0 : (ui.get_blink() ? ' ' : 0); + + dtostrf(x, -4, 0, str); + write_byte(alt_label ? alt_label : 'X'); + write_str(str, 4); + + dtostrf(y, -4, 0, str); + write_byte(alt_label ? alt_label : 'Y'); + write_str(str, 4); + + dtostrf(z, -5, 1, str); + write_byte(alt_label ? alt_label : 'Z'); + write_str(str, 5); +} + +bool ST7920_Lite_Status_Screen::indicators_changed() { + // We only add the target temperatures to the checksum + // because the actual temps fluctuate so by updating + // them only during blinks we gain a bit of stability. + const bool blink = ui.get_blink(); + const uint16_t feedrate_perc = feedrate_percentage; + const uint8_t fs = (((uint16_t)fan_speed[0] + 1) * 100) / 256; + const int16_t extruder_1_target = thermalManager.degTargetHotend(0); + #if HOTENDS > 1 + const int16_t extruder_2_target = thermalManager.degTargetHotend(1); + #endif + #if HAS_HEATED_BED + const int16_t bed_target = thermalManager.degTargetBed(); + #endif + static uint16_t last_checksum = 0; + const uint16_t checksum = blink ^ feedrate_perc ^ fs ^ extruder_1_target + #if HOTENDS > 1 + ^ extruder_2_target + #endif + #if HAS_HEATED_BED + ^ bed_target + #endif + ; + if (last_checksum == checksum) return false; + last_checksum = checksum; + return true; +} + +void ST7920_Lite_Status_Screen::update_indicators(const bool forceUpdate) { + if (forceUpdate || indicators_changed()) { + const bool blink = ui.get_blink(); + const duration_t elapsed = print_job_timer.duration(); + const uint16_t feedrate_perc = feedrate_percentage; + const uint8_t fs = (((uint16_t)fan_speed[0] + 1) * 100) / 256; + const int16_t extruder_1_temp = thermalManager.degHotend(0), + extruder_1_target = thermalManager.degTargetHotend(0); + #if HOTENDS > 1 + const int16_t extruder_2_temp = thermalManager.degHotend(1), + extruder_2_target = thermalManager.degTargetHotend(1); + #endif + #if HAS_HEATED_BED + const int16_t bed_temp = thermalManager.degBed(), + bed_target = thermalManager.degTargetBed(); + #endif + + draw_extruder_1_temp(extruder_1_temp, extruder_1_target, forceUpdate); + #if HOTENDS > 1 + draw_extruder_2_temp(extruder_2_temp, extruder_2_target, forceUpdate); + #endif + #if HAS_HEATED_BED + draw_bed_temp(bed_temp, bed_target, forceUpdate); + #endif + draw_fan_speed(fs); + draw_print_time(elapsed); + draw_feedrate_percentage(feedrate_perc); + + // Update the fan and bed animations + if (fs) draw_fan_icon(blink); + #if HAS_HEATED_BED + draw_heat_icon(bed_target > 0 && blink, bed_target > 0); + #endif + } +} + +bool ST7920_Lite_Status_Screen::position_changed() { + const float x_pos = current_position[X_AXIS], y_pos = current_position[Y_AXIS], z_pos = current_position[Z_AXIS]; + const uint8_t checksum = uint8_t(x_pos) ^ uint8_t(y_pos) ^ uint8_t(z_pos); + static uint8_t last_checksum = 0, changed = last_checksum != checksum; + if (changed) last_checksum = checksum; + return changed; +} + +bool ST7920_Lite_Status_Screen::status_changed() { + uint8_t checksum = 0; + for (const char *p = ui.status_message; *p; p++) checksum ^= *p; + static uint8_t last_checksum = 0, changed = last_checksum != checksum; + if (changed) last_checksum = checksum; + return changed; +} + +bool ST7920_Lite_Status_Screen::blink_changed() { + static uint8_t last_blink = 0; + const bool blink = ui.get_blink(), changed = last_blink != blink; + if (changed) last_blink = blink; + return changed; +} + +#ifndef STATUS_EXPIRE_SECONDS + #define STATUS_EXPIRE_SECONDS 20 +#endif + +void ST7920_Lite_Status_Screen::update_status_or_position(bool forceUpdate) { + + #if STATUS_EXPIRE_SECONDS + static uint8_t countdown = 0; + #endif + + /** + * There's only enough room for either the status message or the position, + * so draw one or the other. When the status message changes, show it for + * a few seconds, then return to the position display once the head moves. + * + * countdown > 1 -- Show status + * countdown = 1 -- Show status, until movement + * countdown = 0 -- Show position + * + * If STATUS_EXPIRE_SECONDS is zero, only the status is shown. + */ + if (forceUpdate || status_changed()) { + #if ENABLED(STATUS_MESSAGE_SCROLLING) + ui.status_scroll_offset = 0; + #endif + #if STATUS_EXPIRE_SECONDS + countdown = ui.status_message[0] ? STATUS_EXPIRE_SECONDS : 0; + #endif + draw_status_message(); + blink_changed(); // Clear changed flag + } + #if !STATUS_EXPIRE_SECONDS + #if ENABLED(STATUS_MESSAGE_SCROLLING) + else + draw_status_message(); + #endif + #else + else if (blink_changed()) { + if (countdown > 1) { + countdown--; + #if ENABLED(STATUS_MESSAGE_SCROLLING) + draw_status_message(); + #endif + } + else if (countdown > 0) { + if (position_changed()) { + countdown--; + forceUpdate = true; + } + #if ENABLED(STATUS_MESSAGE_SCROLLING) + draw_status_message(); + #endif + } + } + + if (countdown == 0 && (forceUpdate || position_changed() || + #if DISABLED(DISABLE_REDUCED_ACCURACY_WARNING) + blink_changed() + #endif + )) { + draw_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], + #if ENABLED(DISABLE_REDUCED_ACCURACY_WARNING) + true + #else + all_axes_known() + #endif + ); + } + #endif +} + +void ST7920_Lite_Status_Screen::update_progress(const bool forceUpdate) { + #if ENABLED(LCD_SET_PROGRESS_MANUALLY) || ENABLED(SDSUPPORT) + + // Since the progress bar involves writing + // quite a few bytes to GDRAM, only do this + // when an update is actually necessary. + + static uint8_t last_progress = 0; + const uint8_t progress = ui.get_progress(); + if (forceUpdate || last_progress != progress) { + last_progress = progress; + draw_progress_bar(progress); + } + + #else + + UNUSED(forceUpdate); + + #endif // LCD_SET_PROGRESS_MANUALLY || SDSUPPORT +} + +void ST7920_Lite_Status_Screen::update(const bool forceUpdate) { + cs(); + update_indicators(forceUpdate); + update_status_or_position(forceUpdate); + update_progress(forceUpdate); + ncs(); +} + +void ST7920_Lite_Status_Screen::reset_state_from_unknown() { + _extended_function_set(true, true); // Do it twice as only one bit + _extended_function_set(true, true); // get set at a time. + _scroll_or_addr_select(false); +} + +void ST7920_Lite_Status_Screen::on_entry() { + cs(); + reset_state_from_unknown(); + clear(); + clear_gdram(); + draw_static_elements(); + update(true); + ncs(); +} + +void ST7920_Lite_Status_Screen::on_exit() { + cs(); + clear(); + _extended_function_set(true, true); // Restore state to what u8g expects. + ncs(); +} + +// This is called prior to the KILL screen to +// clear the screen, preventing a garbled display. +void ST7920_Lite_Status_Screen::clear_text_buffer() { + cs(); + reset_state_from_unknown(); + clear(); + _extended_function_set(true, true); // Restore state to what u8g expects. + ncs(); +} + +#if ENABLED(U8GLIB_ST7920) && !defined(U8G_HAL_LINKS) && !defined(__SAM3X8E__) + + #include "ultralcd_st7920_u8glib_rrd_AVR.h" + + void ST7920_Lite_Status_Screen::cs() { + ST7920_CS(); + current_bits.synced = false; + } + + void ST7920_Lite_Status_Screen::ncs() { + ST7920_NCS(); + current_bits.synced = false; + } + + void ST7920_Lite_Status_Screen::sync_cmd() { + ST7920_SET_CMD(); + } + + void ST7920_Lite_Status_Screen::sync_dat() { + ST7920_SET_DAT(); + } + + void ST7920_Lite_Status_Screen::write_byte(const uint8_t data) { + ST7920_WRITE_BYTE(data); + } + +#endif + +void MarlinUI::draw_status_screen() { + ST7920_Lite_Status_Screen::update(false); +} + +// This method is called before each screen update and +// fires on_entry() and on_exit() events upon entering +// or exiting the Status Screen. +void MarlinUI::lcd_in_status(const bool inStatus) { + static bool lastInStatus = false; + if (lastInStatus == inStatus) return; + if ((lastInStatus = inStatus)) + ST7920_Lite_Status_Screen::on_entry(); + else + ST7920_Lite_Status_Screen::on_exit(); +} + +#endif // LIGHTWEIGHT_UI diff --git a/Marlin/src/lcd/dogm/status_screen_lite_ST7920.h b/Marlin/src/lcd/dogm/status_screen_lite_ST7920.h index 2ac5c19ccf..8a19030d6b 100644 --- a/Marlin/src/lcd/dogm/status_screen_lite_ST7920.h +++ b/Marlin/src/lcd/dogm/status_screen_lite_ST7920.h @@ -13,960 +13,92 @@ * FOR A PARTICULAR PURPOSE. See the GNU GPL for more details. * */ +#pragma once -/** - * Implementation of a Status Screen for the RepRapDiscount - * Full Graphics Smart Controller using native ST7920 commands - * instead of U8Glib. - * - * This alternative Status Screen makes use of the built-in character - * generation capabilities of the ST7920 to update the Status Screen - * with less SPI traffic and CPU use. In particular: - * - * - The fan and bed animations are handled using custom characters - * that are stored in CGRAM. This allows for the animation to be - * updated by writing a single character to the text-buffer (DDRAM). - * - * - All the information in the Status Screen is text that is written - * to DDRAM, so the work of generating the bitmaps is offloaded to - * the ST7920 rather than being render by U8Glib on the MCU. - * - * - The graphics buffer (GDRAM) is only used for static graphics - * elements (nozzle and feedrate bitmaps) and for the progress - * bar, so updates are sporadic. - */ - -#include "status_screen_lite_ST7920_class.h" - +#include "../../core/macros.h" #include "../../libs/duration_t.h" -#define BUFFER_WIDTH 256 -#define BUFFER_HEIGHT 32 +class ST7920_Lite_Status_Screen { + private: + static struct st7920_state_t { + uint8_t synced : 1; // Whether a sync has been sent + uint8_t cmd : 1; // Whether the sync was cmd or data + uint8_t extended : 1; + uint8_t graphics : 1; + uint8_t sa : 1; + } current_bits; -#define DDRAM_LINE_1 0x00 -#define DDRAM_LINE_2 0x10 -#define DDRAM_LINE_3 0x08 -#define DDRAM_LINE_4 0x18 + static void cs(); + static void ncs(); + static void sync_cmd(); + static void sync_dat(); + static void write_byte(const uint8_t w); -ST7920_Lite_Status_Screen::st7920_state_t ST7920_Lite_Status_Screen::current_bits; - -void ST7920_Lite_Status_Screen::cmd(const uint8_t cmd) { - if (!current_bits.synced || !current_bits.cmd) { - current_bits.synced = true; - current_bits.cmd = true; - sync_cmd(); - } - write_byte(cmd); -} - -void ST7920_Lite_Status_Screen::begin_data() { - if (!current_bits.synced || current_bits.cmd) { - current_bits.synced = true; - current_bits.cmd = false; - sync_dat(); - } -} - -void ST7920_Lite_Status_Screen::write_str(const char *str) { - while (*str) write_byte(*str++); -} - -void ST7920_Lite_Status_Screen::write_str(const char *str, uint8_t len) { - while (*str && len--) write_byte(*str++); -} - -void ST7920_Lite_Status_Screen::write_str_P(const char * const str) { - const char *p_str = (const char *)str; - while (char c = pgm_read_byte_near(p_str++)) write_byte(c); -} - -void ST7920_Lite_Status_Screen::write_str(progmem_str str) { - write_str_P((const char*)str); -} - -void ST7920_Lite_Status_Screen::write_number(const int16_t value, const uint8_t digits/*=3*/) { - char str[7]; - const char *fmt; - switch (digits) { - case 6: fmt = PSTR("%6d"); break; - case 5: fmt = PSTR("%5d"); break; - case 4: fmt = PSTR("%4d"); break; - case 3: fmt = PSTR("%3d"); break; - case 2: fmt = PSTR("%2d"); break; - case 1: fmt = PSTR("%1d"); break; - } - sprintf_P(str, fmt, value); - write_str(str); -} - -void ST7920_Lite_Status_Screen::display_status(const bool display_on, const bool cursor_on, const bool blink_on) { - extended_function_set(false); - cmd(0b00001000 | - (display_on ? 0b0100 : 0) | - (cursor_on ? 0b0010 : 0) | - (blink_on ? 0b0001 : 0) - ); -} - -// Sets the extended and graphics bits simultaneously, regardless of -// the current state. This is a helper function for extended_function_set() -// and graphics() -void ST7920_Lite_Status_Screen::_extended_function_set(const bool extended, const bool graphics) { - cmd( 0b00100000 | - (extended ? 0b00000100 : 0) | - (graphics ? 0b00000010 : 0) - ); - current_bits.extended = extended; - current_bits.graphics = graphics; -} - -void ST7920_Lite_Status_Screen::extended_function_set(const bool extended) { - if (extended != current_bits.extended) - _extended_function_set(extended, current_bits.graphics); -} - -void ST7920_Lite_Status_Screen::graphics(const bool graphics) { - if (graphics != current_bits.graphics) - _extended_function_set(current_bits.extended, graphics); -} - -void ST7920_Lite_Status_Screen::entry_mode_select(const bool ac_increase, const bool shift) { - extended_function_set(false); - cmd(0b00000100 | - (ac_increase ? 0b00000010 : 0) | - (shift ? 0b00000001 : 0) - ); -} - -// Sets the sa bit regardless of the current state. This is a helper -// function for scroll_or_addr_select() -void ST7920_Lite_Status_Screen::_scroll_or_addr_select(const bool sa) { - extended_function_set(true); - cmd(0b00100010 | - (sa ? 0b000001 : 0) - ); - current_bits.sa = sa; -} - -void ST7920_Lite_Status_Screen::scroll_or_addr_select(const bool sa) { - if (sa != current_bits.sa) - _scroll_or_addr_select(sa); -} - -void ST7920_Lite_Status_Screen::set_ddram_address(const uint8_t addr) { - extended_function_set(false); - cmd(0b10000000 | (addr & 0b00111111)); -} - -void ST7920_Lite_Status_Screen::set_cgram_address(const uint8_t addr) { - extended_function_set(false); - cmd(0b01000000 | (addr & 0b00111111)); -} - -void ST7920_Lite_Status_Screen::set_gdram_address(const uint8_t x, const uint8_t y) { - extended_function_set(true); - cmd(0b10000000 | (y & 0b01111111)); - cmd(0b10000000 | (x & 0b00001111)); -} - -void ST7920_Lite_Status_Screen::clear() { - extended_function_set(false); - cmd(0x00000001); - delay(15); //delay for CGRAM clear -} - -void ST7920_Lite_Status_Screen::home() { - extended_function_set(false); - cmd(0x00000010); -} - -/* This fills the entire text buffer with spaces */ -void ST7920_Lite_Status_Screen::clear_ddram() { - set_ddram_address(DDRAM_LINE_1); - begin_data(); - for (uint8_t i = 64; i--;) write_byte(' '); -} - -/* This fills the entire graphics buffer with zeros */ -void ST7920_Lite_Status_Screen::clear_gdram() { - for (uint8_t y = 0; y < BUFFER_HEIGHT; y++) { - set_gdram_address(0, y); - begin_data(); - for (uint8_t i = (BUFFER_WIDTH) / 16; i--;) write_word(0); - } -} - -void ST7920_Lite_Status_Screen::load_cgram_icon(const uint16_t addr, const void *data) { - const uint16_t *p_word = (const uint16_t *)data; - set_cgram_address(addr); - begin_data(); - for (uint8_t i = 16; i--;) - write_word(pgm_read_word_near(p_word++)); -} - -/** - * Draw an icon in GDRAM. Position specified in DDRAM - * coordinates. i.e., X from 1 to 8, Y from 1 to 4. - */ -void ST7920_Lite_Status_Screen::draw_gdram_icon(uint8_t x, uint8_t y, const void *data) { - const uint16_t *p_word = (const uint16_t *)data; - if (y > 2) { // Handle display folding - y -= 2; - x += 8; - } - --x; - --y; - for (int i = 0; i < 16; i++) { - set_gdram_address(x, i + y * 16); - begin_data(); - write_word(pgm_read_word_near(p_word++)); - } -} - -/************************** ICON DEFINITIONS *************************************/ - -#define CGRAM_ICON_1_ADDR 0x00 -#define CGRAM_ICON_2_ADDR 0x10 -#define CGRAM_ICON_3_ADDR 0x20 -#define CGRAM_ICON_4_ADDR 0x30 - -#define CGRAM_ICON_1_WORD 0x00 -#define CGRAM_ICON_2_WORD 0x02 -#define CGRAM_ICON_3_WORD 0x04 -#define CGRAM_ICON_4_WORD 0x06 - -const uint8_t degree_symbol_y_top = 1; -PROGMEM const uint8_t degree_symbol[] = { - 0b00110000, - 0b01001000, - 0b01001000, - 0b00110000, -}; - -const uint16_t nozzle_icon[] PROGMEM = { - 0b0000000000000000, - 0b0000000000000000, - 0b0000111111110000, - 0b0001111111111000, - 0b0001111111111000, - 0b0001111111111000, - 0b0000111111110000, - 0b0000111111110000, - 0b0001111111111000, - 0b0001111111111000, - 0b0001111111111000, - 0b0000011111100000, - 0b0000001111000000, - 0b0000000110000000, - 0b0000000000000000, - 0b0000000000000000 -}; - -const uint16_t bed_icon[] PROGMEM = { - 0b0000000000000000, - 0b0000000000000000, - 0b0000000000000000, - 0b0000000000000000, - 0b0000000000000000, - 0b0000000000000000, - 0b0000000000000000, - 0b0000000000000000, - 0b0000000000000000, - 0b0000000000000000, - 0b0000000000000000, - 0b0111111111111110, - 0b0111111111111110, - 0b0110000000000110, - 0b0000000000000000, - 0b0000000000000000 -}; - -const uint16_t heat1_icon[] PROGMEM = { - 0b0000000000000000, - 0b0010001000100000, - 0b0001000100010000, - 0b0000100010001000, - 0b0000100010001000, - 0b0001000100010000, - 0b0010001000100000, - 0b0010001000100000, - 0b0001000100010000, - 0b0000100010001000, - 0b0000000000000000, - 0b0000000000000000, - 0b0000000000000000, - 0b0000000000000000, - 0b0000000000000000, - 0b0000000000000000 -}; - -const uint16_t heat2_icon[] PROGMEM = { - 0b0000000000000000, - 0b0000100010001000, - 0b0000100010001000, - 0b0001000100010000, - 0b0010001000100000, - 0b0010001000100000, - 0b0001000100010000, - 0b0000100010001000, - 0b0000100010001000, - 0b0001000100010000, - 0b0000000000000000, - 0b0000000000000000, - 0b0000000000000000, - 0b0000000000000000, - 0b0000000000000000, - 0b0000000000000000 -}; - -const uint16_t fan1_icon[] PROGMEM = { - 0b0000000000000000, - 0b0111111111111110, - 0b0111000000001110, - 0b0110001111000110, - 0b0100001111000010, - 0b0100000110000010, - 0b0101100000011010, - 0b0101110110111010, - 0b0101100000011010, - 0b0100000110000010, - 0b0100001111000010, - 0b0110001111000110, - 0b0111000000001110, - 0b0111111111111110, - 0b0000000000000000, - 0b0000000000000000 -}; - -const uint16_t fan2_icon[] PROGMEM = { - 0b0000000000000000, - 0b0111111111111110, - 0b0111000000001110, - 0b0110010000100110, - 0b0100111001110010, - 0b0101111001111010, - 0b0100110000110010, - 0b0100000110000010, - 0b0100110000110010, - 0b0101111001111010, - 0b0100111001110010, - 0b0110010000100110, - 0b0111000000001110, - 0b0111111111111110, - 0b0000000000000000, - 0b0000000000000000 -}; - -const uint16_t feedrate_icon[] PROGMEM = { - 0b0000000000000000, - 0b0111111000000000, - 0b0110000000000000, - 0b0110000000000000, - 0b0110000000000000, - 0b0111111011111000, - 0b0110000011001100, - 0b0110000011001100, - 0b0110000011001100, - 0b0110000011111000, - 0b0000000011001100, - 0b0000000011001100, - 0b0000000011001100, - 0b0000000011001100, - 0b0000000000000000, - 0b0000000000000000 -}; - -/************************** MAIN SCREEN *************************************/ - -// The ST7920 does not have a degree character, but we -// can fake it by writing it to GDRAM. -// This function takes as an argument character positions -// i.e x is [1-16], while the y position is [1-4] -void ST7920_Lite_Status_Screen::draw_degree_symbol(uint8_t x, uint8_t y, bool draw) { - const uint8_t *p_bytes = degree_symbol; - if (y > 2) { - // Handle display folding - y -= 2; - x += 16; + FORCE_INLINE static void write_word(const uint16_t w) { + write_byte((w >> 8) & 0xFF); + write_byte((w >> 0) & 0xFF); } - x -= 1; - y -= 1; - const bool oddChar = x & 1; - const uint8_t x_word = x >> 1; - const uint8_t y_top = degree_symbol_y_top; - const uint8_t y_bot = y_top + sizeof(degree_symbol)/sizeof(degree_symbol[0]); - for(uint8_t i = y_top; i < y_bot; i++) { - uint8_t byte = pgm_read_byte_near(p_bytes++); - set_gdram_address(x_word,i+y*16); - begin_data(); - if (draw) { - write_byte(oddChar ? 0x00 : byte); - write_byte(oddChar ? byte : 0x00); - } - else - write_word(0x0000); - } -} -void ST7920_Lite_Status_Screen::draw_static_elements() { - scroll_or_addr_select(0); + static void cmd(const uint8_t cmd); + static void begin_data(); - // Load the animated bed and fan icons - load_cgram_icon(CGRAM_ICON_1_ADDR, heat1_icon); - load_cgram_icon(CGRAM_ICON_2_ADDR, heat2_icon); - load_cgram_icon(CGRAM_ICON_3_ADDR, fan1_icon); - load_cgram_icon(CGRAM_ICON_4_ADDR, fan2_icon); + static void write_str(const char *str); + static void write_str(const char *str, const uint8_t len); + static void write_str_P(PGM_P const str); + static void write_number(const int16_t value, const uint8_t digits=3); - // Draw the static icons in GDRAM - draw_gdram_icon(1, 1, nozzle_icon); - #if EXTRUDERS == 2 - draw_gdram_icon(1,2,nozzle_icon); - draw_gdram_icon(1,3,bed_icon); - #else - draw_gdram_icon(1,2,bed_icon); - #endif - draw_gdram_icon(6,2,feedrate_icon); + static void _extended_function_set(const bool extended, const bool graphics); + static void _scroll_or_addr_select(const bool sa); + static void reset_state_from_unknown(); - // Draw the initial fan icon - draw_fan_icon(false); -} + static void home(); + static void display_status(const bool display_on, const bool cursor_on, const bool blink_on); + static void extended_function_set(const bool extended); + static void graphics(const bool graphics); + static void entry_mode_select(const bool ac_increase, const bool shift); + static void scroll_or_addr_select(const bool sa); + static void set_ddram_address(const uint8_t addr); + static void set_cgram_address(const uint8_t addr); + static void set_gdram_address(const uint8_t x, const uint8_t y); -/** - * Although this is undocumented, the ST7920 allows the character - * data buffer (DDRAM) to be used in conjunction with the graphics - * bitmap buffer (CGRAM). The contents of the graphics buffer is - * XORed with the data from the character generator. This allows - * us to make the progess bar out of graphical data (the bar) and - * text data (the percentage). - */ -void ST7920_Lite_Status_Screen::draw_progress_bar(const uint8_t value) { - #if EXTRUDERS == 1 - // If we have only one extruder, draw a long progress bar on the third line - const uint8_t top = 1, // Top in pixels - bottom = 13, // Bottom in pixels - left = 12, // Left edge, in 16-bit words - width = 4; // Width of progress bar, in 16-bit words - #else - const uint8_t top = 16 + 1, - bottom = 16 + 13, - left = 5, - width = 3; - #endif - const uint8_t char_pcnt = 100 / width; // How many percent does each 16-bit word represent? + static void clear(); + static void clear_ddram(); + static void clear_gdram(); - // Draw the progress bar as a bitmap in CGRAM - for (uint8_t y = top; y <= bottom; y++) { - set_gdram_address(left, y); - begin_data(); - for (uint8_t x = 0; x < width; x++) { - uint16_t gfx_word = 0x0000; - if ((x + 1) * char_pcnt <= value) - gfx_word = 0xFFFF; // Draw completely filled bytes - else if ((x * char_pcnt) < value) - gfx_word = int(0x8000) >> (value % char_pcnt) * 16 / char_pcnt; // Draw partially filled bytes + static void load_cgram_icon(const uint16_t addr, const void *data); + static void draw_gdram_icon(uint8_t x, uint8_t y, const void *data); - // Draw the frame around the progress bar - if (y == top || y == bottom) - gfx_word = 0xFFFF; // Draw top/bottom border - else if (x == width - 1) - gfx_word |= 0x0001; // Draw right border - else if (x == 0) - gfx_word |= 0x8000; // Draw left border - write_word(gfx_word); - } - } + static uint8_t string_checksum(const char *str); - // Draw the percentage as text in DDRAM - #if EXTRUDERS == 1 - set_ddram_address(DDRAM_LINE_3 + 4); - begin_data(); - write_byte(' '); - #else - set_ddram_address(DDRAM_LINE_2 + left); - begin_data(); - #endif + protected: + static void draw_degree_symbol(uint8_t x, uint8_t y, const bool draw); + static void draw_static_elements(); + static void draw_progress_bar(const uint8_t value); + static void draw_fan_icon(const bool whichIcon); + static void draw_heat_icon(const bool whichIcon, const bool heating); + static void draw_temps(uint8_t line, const int16_t temp, const int16_t target, bool showTarget, bool targetStateChange); + static void draw_extruder_1_temp(const int16_t temp, const int16_t target, bool forceUpdate = false); + static void draw_extruder_2_temp(const int16_t temp, const int16_t target, bool forceUpdate = false); + static void draw_bed_temp(const int16_t temp, const int16_t target, bool forceUpdate = false); + static void draw_fan_speed(const uint8_t value); + static void draw_print_time(const duration_t &elapsed); + static void draw_feedrate_percentage(const uint16_t percentage); + static void draw_status_message(); + static void draw_position(const float x, const float y, const float z, bool position_known = true); - // Draw centered - if (value > 9) { - write_number(value, 4); - write_str(F("% ")); - } - else { - write_number(value, 3); - write_str(F("% ")); - } -} + static bool indicators_changed(); + static bool position_changed(); + static bool blink_changed(); + static bool status_changed(); -void ST7920_Lite_Status_Screen::draw_fan_icon(const bool whichIcon) { - set_ddram_address(DDRAM_LINE_1 + 5); - begin_data(); - write_word(whichIcon ? CGRAM_ICON_3_WORD : CGRAM_ICON_4_WORD); -} + static void update_indicators(const bool forceUpdate); + static void update_position(const bool forceUpdate, bool resetChecksum); + static void update_status_or_position(bool forceUpdate); + static void update_progress(const bool forceUpdate); -void ST7920_Lite_Status_Screen::draw_heat_icon(const bool whichIcon, const bool heating) { - set_ddram_address( - #if EXTRUDERS == 1 - DDRAM_LINE_2 - #else - DDRAM_LINE_3 - #endif - ); - begin_data(); - if (heating) - write_word(whichIcon ? CGRAM_ICON_1_WORD : CGRAM_ICON_2_WORD); - else { - write_byte(' '); - write_byte(' '); - } -} - -#define FAR(a,b) (((a > b) ? (a-b) : (b-a)) > 2) - -static struct { - bool E1_show_target : 1; - bool E2_show_target : 1; - #if HAS_HEATED_BED - bool bed_show_target : 1; - #endif -} display_state = { - true, true - #if HAS_HEATED_BED - , true - #endif + public: + static void update(const bool forceUpdate); + static void on_entry(); + static void on_exit(); + static void clear_text_buffer(); }; - -void ST7920_Lite_Status_Screen::draw_temps(uint8_t line, const int16_t temp, const int16_t target, bool showTarget, bool targetStateChange) { - switch (line) { - case 1: set_ddram_address(DDRAM_LINE_1 + 1); break; - case 2: set_ddram_address(DDRAM_LINE_2 + 1); break; - case 3: set_ddram_address(DDRAM_LINE_3 + 1); break; - case 4: set_ddram_address(DDRAM_LINE_3 + 1); break; - } - begin_data(); - write_number(temp); - - if (showTarget) { - write_str(F("\x1A")); - write_number(target); - }; - - if (targetStateChange) { - if (!showTarget) write_str(F(" ")); - draw_degree_symbol(6, line, !showTarget); - draw_degree_symbol(10, line, showTarget); - } -} - -void ST7920_Lite_Status_Screen::draw_extruder_1_temp(const int16_t temp, const int16_t target, bool forceUpdate) { - const bool show_target = target && FAR(temp, target); - draw_temps(1, temp, target, show_target, display_state.E1_show_target != show_target || forceUpdate); - display_state.E1_show_target = show_target; -} - -void ST7920_Lite_Status_Screen::draw_extruder_2_temp(const int16_t temp, const int16_t target, bool forceUpdate) { - const bool show_target = target && FAR(temp, target); - draw_temps(2, temp, target, show_target, display_state.E2_show_target != show_target || forceUpdate); - display_state.E2_show_target = show_target; -} - -#if HAS_HEATED_BED - void ST7920_Lite_Status_Screen::draw_bed_temp(const int16_t temp, const int16_t target, bool forceUpdate) { - const bool show_target = target && FAR(temp, target); - draw_temps(2 - #if EXTRUDERS > 1 - + 1 - #endif - , temp, target, show_target, display_state.bed_show_target != show_target || forceUpdate - ); - display_state.bed_show_target = show_target; - } -#endif - -void ST7920_Lite_Status_Screen::draw_fan_speed(const uint8_t value) { - set_ddram_address(DDRAM_LINE_1 + 6); - begin_data(); - write_number(value, 3); - write_byte('%'); -} - -void ST7920_Lite_Status_Screen::draw_print_time(const duration_t &elapsed) { - #if EXTRUDERS == 1 - set_ddram_address(DDRAM_LINE_3); - #else - set_ddram_address(DDRAM_LINE_3 + 5); - #endif - char str[7]; - str[elapsed.toDigital(str)] = ' '; - begin_data(); - write_str(str, 6); -} - -void ST7920_Lite_Status_Screen::draw_feedrate_percentage(const uint16_t percentage) { - // We only have enough room for the feedrate when - // we have one extruder - #if EXTRUDERS == 1 - set_ddram_address(DDRAM_LINE_2 + 6); - begin_data(); - write_number(percentage, 3); - write_byte('%'); - #endif -} - -void ST7920_Lite_Status_Screen::draw_status_message(const char *str) { - set_ddram_address(DDRAM_LINE_4); - begin_data(); - const uint8_t lcd_len = 16; - #if ENABLED(STATUS_MESSAGE_SCROLLING) - - uint8_t slen = utf8_strlen(str); - - // If the string fits into the LCD, just print it and do not scroll it - if (slen <= lcd_len) { - - // The string isn't scrolling and may not fill the screen - write_str(str); - - // Fill the rest with spaces - while (slen < lcd_len) { - write_byte(' '); - ++slen; - } - } - else { - // String is larger than the available space in screen. - - // Get a pointer to the next valid UTF8 character - const char *stat = str + status_scroll_offset; - - // Get the string remaining length - const uint8_t rlen = utf8_strlen(stat); - - // If we have enough characters to display - if (rlen >= lcd_len) { - // The remaining string fills the screen - Print it - write_str(stat, lcd_len); - } - else { - // The remaining string does not completely fill the screen - write_str(stat); // The string leaves space - uint8_t chars = lcd_len - rlen; // Amount of space left in characters - - write_byte('.'); // Always at 1+ spaces left, draw a dot - if (--chars) { // Draw a second dot if there's space - write_byte('.'); - if (--chars) - write_str(str, chars); // Print a second copy of the message - } - } - - // Adjust by complete UTF8 characters - if (status_scroll_offset < slen) { - status_scroll_offset++; - while (!START_OF_UTF8_CHAR(str[status_scroll_offset])) - status_scroll_offset++; - } - else - status_scroll_offset = 0; - } - #else - // Get the UTF8 character count of the string - uint8_t slen = utf8_strlen(str); - - // Just print the string to the LCD - write_str(str, lcd_len); - - // Fill the rest with spaces if there are missing spaces - while (slen < lcd_len) { - write_byte(' '); - ++slen; - } - #endif -} - -void ST7920_Lite_Status_Screen::draw_position(const float x, const float y, const float z, bool position_known) { - char str[7]; - set_ddram_address(DDRAM_LINE_4); - begin_data(); - - // If position is unknown, flash the labels. - const unsigned char alt_label = position_known ? 0 : (lcd_blink() ? ' ' : 0); - - dtostrf(x, -4, 0, str); - write_byte(alt_label ? alt_label : 'X'); - write_str(str, 4); - - dtostrf(y, -4, 0, str); - write_byte(alt_label ? alt_label : 'Y'); - write_str(str, 4); - - dtostrf(z, -5, 1, str); - write_byte(alt_label ? alt_label : 'Z'); - write_str(str, 5); -} - -bool ST7920_Lite_Status_Screen::indicators_changed() { - // We only add the target temperatures to the checksum - // because the actual temps fluctuate so by updating - // them only during blinks we gain a bit of stability. - const bool blink = lcd_blink(); - const uint16_t feedrate_perc = feedrate_percentage; - const uint8_t fan_speed = ((fanSpeeds[0] + 1) * 100) / 256; - const int16_t extruder_1_target = thermalManager.degTargetHotend(0); - #if EXTRUDERS == 2 - const int16_t extruder_2_target = thermalManager.degTargetHotend(1); - #endif - #if HAS_HEATED_BED - const int16_t bed_target = thermalManager.degTargetBed(); - #endif - static uint16_t last_checksum = 0; - const uint16_t checksum = blink ^ feedrate_perc ^ fan_speed ^ extruder_1_target - #if EXTRUDERS == 2 - ^ extruder_2_target - #endif - #if HAS_HEATED_BED - ^ bed_target - #endif - ; - if (last_checksum == checksum) return false; - last_checksum = checksum; - return true; -} - -void ST7920_Lite_Status_Screen::update_indicators(const bool forceUpdate) { - if (forceUpdate || indicators_changed()) { - const bool blink = lcd_blink(); - const duration_t elapsed = print_job_timer.duration(); - const uint16_t feedrate_perc = feedrate_percentage; - const uint8_t fan_speed = ((fanSpeeds[0] + 1) * 100) / 256; - const int16_t extruder_1_temp = thermalManager.degHotend(0), - extruder_1_target = thermalManager.degTargetHotend(0); - #if EXTRUDERS == 2 - const int16_t extruder_2_temp = thermalManager.degHotend(1), - extruder_2_target = thermalManager.degTargetHotend(1); - #endif - #if HAS_HEATED_BED - const int16_t bed_temp = thermalManager.degBed(), - bed_target = thermalManager.degTargetBed(); - #endif - - draw_extruder_1_temp(extruder_1_temp, extruder_1_target, forceUpdate); - #if EXTRUDERS == 2 - draw_extruder_2_temp(extruder_2_temp, extruder_2_target, forceUpdate); - #endif - #if HAS_HEATED_BED - draw_bed_temp(bed_temp, bed_target, forceUpdate); - #endif - draw_fan_speed(fan_speed); - draw_print_time(elapsed); - draw_feedrate_percentage(feedrate_perc); - - // Update the fan and bed animations - if (fan_speed > 0) draw_fan_icon(blink); - #if HAS_HEATED_BED - if (bed_target > 0) - draw_heat_icon(blink, true); - else - draw_heat_icon(false, false); - #endif - } -} - -bool ST7920_Lite_Status_Screen::position_changed() { - const float x_pos = current_position[X_AXIS], - y_pos = current_position[Y_AXIS], - z_pos = current_position[Z_AXIS]; - const uint8_t checksum = uint8_t(x_pos) ^ uint8_t(y_pos) ^ uint8_t(z_pos); - - static uint8_t last_checksum = 0; - if (last_checksum == checksum) return false; - last_checksum = checksum; - return true; -} - -bool ST7920_Lite_Status_Screen::status_changed() { - uint8_t checksum = 0; - for (const char *p = lcd_status_message; *p; p++) checksum ^= *p; - static uint8_t last_checksum = 0; - if (last_checksum == checksum) return false; - last_checksum = checksum; - return true; -} - -bool ST7920_Lite_Status_Screen::blink_changed() { - static uint8_t last_blink = 0; - const bool blink = lcd_blink(); - if (last_blink == blink) return false; - last_blink = blink; - return true; -} - -#ifndef STATUS_EXPIRE_SECONDS - #define STATUS_EXPIRE_SECONDS 20 -#endif - -void ST7920_Lite_Status_Screen::update_status_or_position(bool forceUpdate) { - - #if STATUS_EXPIRE_SECONDS - static uint8_t countdown = 0; - #endif - - /** - * There is only enough room in the display for either the - * status message or the position, not both, so we choose - * one or another. Whenever the status message changes, - * we show it for a number of consecutive seconds, but - * then go back to showing the position as soon as the - * head moves, i.e: - * - * countdown > 1 -- Show status - * countdown = 1 -- Show status, until movement - * countdown = 0 -- Show position - * - * If STATUS_EXPIRE_SECONDS is zero, the position display - * will be disabled and only the status will be shown. - */ - if (forceUpdate || status_changed()) { - #if ENABLED(STATUS_MESSAGE_SCROLLING) - status_scroll_offset = 0; - #endif - #if STATUS_EXPIRE_SECONDS - countdown = lcd_status_message[0] ? STATUS_EXPIRE_SECONDS : 0; - #endif - draw_status_message(lcd_status_message); - blink_changed(); // Clear changed flag - } - #if !STATUS_EXPIRE_SECONDS - #if ENABLED(STATUS_MESSAGE_SCROLLING) - else - draw_status_message(lcd_status_message); - #endif - #else - else if (countdown > 1 && blink_changed()) { - countdown--; - #if ENABLED(STATUS_MESSAGE_SCROLLING) - draw_status_message(lcd_status_message); - #endif - } - else if (countdown > 0 && blink_changed()) { - if (position_changed()) { - countdown--; - forceUpdate = true; - } - #if ENABLED(STATUS_MESSAGE_SCROLLING) - draw_status_message(lcd_status_message); - #endif - } - if (countdown == 0 && (forceUpdate || position_changed() || - #if DISABLED(DISABLE_REDUCED_ACCURACY_WARNING) - blink_changed() - #endif - )) { - draw_position( - current_position[X_AXIS], - current_position[Y_AXIS], - current_position[Z_AXIS], - #if ENABLED(DISABLE_REDUCED_ACCURACY_WARNING) - true - #else - all_axes_known() - #endif - ); - } - #endif -} - -void ST7920_Lite_Status_Screen::update_progress(const bool forceUpdate) { - #if ENABLED(LCD_SET_PROGRESS_MANUALLY) || ENABLED(SDSUPPORT) - - #if DISABLED(LCD_SET_PROGRESS_MANUALLY) - uint8_t progress_bar_percent; //=0 - #endif - - #if ENABLED(SDSUPPORT) - // Progress bar % comes from SD when actively printing - if (IS_SD_PRINTING) progress_bar_percent = card.percentDone(); - #endif - - // Since the progress bar involves writing - // quite a few bytes to GDRAM, only do this - // when an update is actually necessary. - - static uint8_t last_progress = 0; - if (!forceUpdate && last_progress == progress_bar_percent) return; - last_progress = progress_bar_percent; - - draw_progress_bar(progress_bar_percent); - - #else - - UNUSED(forceUpdate); - - #endif // LCD_SET_PROGRESS_MANUALLY || SDSUPPORT -} - -void ST7920_Lite_Status_Screen::update(const bool forceUpdate) { - cs(); - update_indicators(forceUpdate); - update_status_or_position(forceUpdate); - update_progress(forceUpdate); - ncs(); -} - -void ST7920_Lite_Status_Screen::reset_state_from_unknown() { - _extended_function_set(true, true); // Do it twice as only one bit - _extended_function_set(true, true); // get set at a time. - _scroll_or_addr_select(false); -} - -void ST7920_Lite_Status_Screen::on_entry() { - cs(); - reset_state_from_unknown(); - clear(); - clear_gdram(); - draw_static_elements(); - update(true); - ncs(); -} - -void ST7920_Lite_Status_Screen::on_exit() { - cs(); - clear(); - _extended_function_set(true, true); // Restore state to what u8g expects. - ncs(); -} - -// This is called prior to the KILL screen to -// clear the screen so we don't end up with a -// garbled display. -void ST7920_Lite_Status_Screen::clear_text_buffer() { - cs(); - reset_state_from_unknown(); - clear(); - _extended_function_set(true, true); // Restore state to what u8g expects. - ncs(); -} - -static void lcd_implementation_status_screen() { - ST7920_Lite_Status_Screen::update(false); -} - -/** - * In order to properly update the lite Status Screen, - * we must know when we have entered and left the - * Status Screen. Since the ultralcd code is not - * set up for doing this, we call this function before - * each update indicating whether the current screen - * is the Status Screen. - * - * This function keeps track of whether we have left or - * entered the Status Screen and calls the on_entry() - * and on_exit() methods for cleanup. - */ -static void lcd_in_status(const bool inStatus) { - static bool lastInStatus = false; - if (lastInStatus == inStatus) return; - if ((lastInStatus = inStatus)) - ST7920_Lite_Status_Screen::on_entry(); - else - ST7920_Lite_Status_Screen::on_exit(); -} diff --git a/Marlin/src/lcd/dogm/status_screen_lite_ST7920_class.h b/Marlin/src/lcd/dogm/status_screen_lite_ST7920_class.h deleted file mode 100644 index 4a96ed9128..0000000000 --- a/Marlin/src/lcd/dogm/status_screen_lite_ST7920_class.h +++ /dev/null @@ -1,111 +0,0 @@ -/** - * Lightweight Status Screen for the RepRapDiscount Full - * Graphics Smart Controller (ST7920-based 128x64 LCD) - * - * (c) 2017 Aleph Objects, Inc. - * - * The code in this page is free software: you can - * redistribute it and/or modify it under the terms of the GNU - * General Public License (GNU GPL) as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) - * any later version. The code is distributed WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU GPL for more details. - * - */ - -#ifndef STATUS_SCREEN_LITE_ST7920_CLASS_H -#define STATUS_SCREEN_LITE_ST7920_CLASS_H - -#include "../../core/macros.h" -#include "../../libs/duration_t.h" - -typedef const __FlashStringHelper *progmem_str; - -class ST7920_Lite_Status_Screen { - private: - static struct st7920_state_t { - uint8_t synced : 1; // Whether a sync has been sent - uint8_t cmd : 1; // Whether the sync was cmd or data - uint8_t extended : 1; - uint8_t graphics : 1; - uint8_t sa : 1; - } current_bits; - - static void cs(); - static void ncs(); - static void sync_cmd(); - static void sync_dat(); - static void write_byte(const uint8_t w); - - FORCE_INLINE static void write_word(const uint16_t w) { - write_byte((w >> 8) & 0xFF); - write_byte((w >> 0) & 0xFF); - } - - static void cmd(const uint8_t cmd); - static void begin_data(); - - static void write_str(const char *str); - static void write_str(const char *str, const uint8_t len); - static void write_str_P(const char * const str); - static void write_str(progmem_str str); - static void write_number(const int16_t value, const uint8_t digits=3); - - static void _extended_function_set(const bool extended, const bool graphics); - static void _scroll_or_addr_select(const bool sa); - static void reset_state_from_unknown(); - - static void home(); - static void display_status(const bool display_on, const bool cursor_on, const bool blink_on); - static void extended_function_set(const bool extended); - static void graphics(const bool graphics); - static void entry_mode_select(const bool ac_increase, const bool shift); - static void scroll_or_addr_select(const bool sa); - static void set_ddram_address(const uint8_t addr); - static void set_cgram_address(const uint8_t addr); - static void set_gdram_address(const uint8_t x, const uint8_t y); - - static void clear(); - static void clear_ddram(); - static void clear_gdram(); - - static void load_cgram_icon(const uint16_t addr, const void *data); - static void draw_gdram_icon(uint8_t x, uint8_t y, const void *data); - - static uint8_t string_checksum(const char *str); - - protected: - static void draw_degree_symbol(uint8_t x, uint8_t y, bool draw); - static void draw_static_elements(); - static void draw_progress_bar(const uint8_t value); - static void draw_fan_icon(const bool whichIcon); - static void draw_heat_icon(const bool whichIcon, const bool heating); - static void draw_temps(uint8_t line, const int16_t temp, const int16_t target, bool showTarget, bool targetStateChange); - static void draw_extruder_1_temp(const int16_t temp, const int16_t target, bool forceUpdate = false); - static void draw_extruder_2_temp(const int16_t temp, const int16_t target, bool forceUpdate = false); - static void draw_bed_temp(const int16_t temp, const int16_t target, bool forceUpdate = false); - static void draw_fan_speed(const uint8_t value); - static void draw_print_time(const duration_t &elapsed); - static void draw_feedrate_percentage(const uint16_t percentage); - static void draw_status_message(const char *str); - static void draw_position(const float x, const float y, const float z, bool position_known = true); - - static bool indicators_changed(); - static bool position_changed(); - static bool blink_changed(); - static bool status_changed(); - - static void update_indicators(const bool forceUpdate); - static void update_position(const bool forceUpdate, bool resetChecksum); - static void update_status_or_position(bool forceUpdate); - static void update_progress(const bool forceUpdate); - - public: - static void update(const bool forceUpdate); - static void on_entry(); - static void on_exit(); - static void clear_text_buffer(); -}; - -#endif // STATUS_SCREEN_LITE_ST7920_CLASS_H diff --git a/Marlin/src/lcd/dogm/status_screen_lite_ST7920_spi.h b/Marlin/src/lcd/dogm/status_screen_lite_ST7920_spi.h deleted file mode 100644 index 9c59068f46..0000000000 --- a/Marlin/src/lcd/dogm/status_screen_lite_ST7920_spi.h +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Lightweight Status Screen for the RepRapDiscount Full - * Graphics Smart Controller (ST7920-based 128x64 LCD) - * - * (c) 2017 Aleph Objects, Inc. - * - * The code in this page is free software: you can - * redistribute it and/or modify it under the terms of the GNU - * General Public License (GNU GPL) as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) - * any later version. The code is distributed WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU GPL for more details. - * - */ - -#include "status_screen_lite_ST7920_class.h" - -void ST7920_Lite_Status_Screen::cs() { - ST7920_CS(); - current_bits.synced = false; -} - -void ST7920_Lite_Status_Screen::ncs() { - ST7920_NCS(); - current_bits.synced = false; -} - -void ST7920_Lite_Status_Screen::sync_cmd() { - ST7920_SET_CMD(); -} - -void ST7920_Lite_Status_Screen::sync_dat() { - ST7920_SET_DAT(); -} - -void ST7920_Lite_Status_Screen::write_byte(const uint8_t data) { - ST7920_WRITE_BYTE(data); -} diff --git a/Marlin/src/lcd/dogm/u8g_dev_ssd1306_sh1106_128x64_I2C.cpp b/Marlin/src/lcd/dogm/u8g_dev_ssd1306_sh1106_128x64_I2C.cpp index 3249068299..c0f8e10d00 100644 --- a/Marlin/src/lcd/dogm/u8g_dev_ssd1306_sh1106_128x64_I2C.cpp +++ b/Marlin/src/lcd/dogm/u8g_dev_ssd1306_sh1106_128x64_I2C.cpp @@ -67,7 +67,7 @@ #include "../../inc/MarlinConfigPre.h" -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD #include #include "HAL_LCD_com_defines.h" @@ -281,4 +281,4 @@ uint8_t u8g_WriteEscSeqP_2_wire(u8g_t *u8g, u8g_dev_t *dev, const uint8_t *esc_s return 1; } -#endif // DOGLCD +#endif // HAS_GRAPHICAL_LCD diff --git a/Marlin/src/lcd/dogm/u8g_dev_st7565_64128n_HAL.cpp b/Marlin/src/lcd/dogm/u8g_dev_st7565_64128n_HAL.cpp index 515ac32f6c..fce915a2b5 100644 --- a/Marlin/src/lcd/dogm/u8g_dev_st7565_64128n_HAL.cpp +++ b/Marlin/src/lcd/dogm/u8g_dev_st7565_64128n_HAL.cpp @@ -55,7 +55,7 @@ #include "../../inc/MarlinConfig.h" -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD #include @@ -233,4 +233,4 @@ u8g_dev_t u8g_dev_st7565_64128n_HAL_2x_sw_spi = { u8g_dev_st7565_64128n_HAL_2x_f U8G_PB_DEV(u8g_dev_st7565_64128n_HAL_hw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_st7565_64128n_HAL_fn, U8G_COM_HAL_HW_SPI_FN); u8g_dev_t u8g_dev_st7565_64128n_HAL_2x_hw_spi = { u8g_dev_st7565_64128n_HAL_2x_fn, &u8g_dev_st7565_64128n_HAL_2x_pb, U8G_COM_HAL_HW_SPI_FN }; -#endif // DOGLCD +#endif // HAS_GRAPHICAL_LCD diff --git a/Marlin/src/lcd/dogm/u8g_dev_st7920_128x64_HAL.cpp b/Marlin/src/lcd/dogm/u8g_dev_st7920_128x64_HAL.cpp index 86a9fd110b..5ad6a6a109 100644 --- a/Marlin/src/lcd/dogm/u8g_dev_st7920_128x64_HAL.cpp +++ b/Marlin/src/lcd/dogm/u8g_dev_st7920_128x64_HAL.cpp @@ -55,15 +55,15 @@ #include "../../inc/MarlinConfigPre.h" -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD #include #include "HAL_LCD_com_defines.h" -#define WIDTH 128 -#define HEIGHT 64 -#define PAGE_HEIGHT 8 +#define LCD_PIXEL_WIDTH 128 +#define LCD_PIXEL_HEIGHT 64 +#define PAGE_HEIGHT 8 /* init sequence from https://github.com/adafruit/ST7565-LCD/blob/master/ST7565/ST7565.cpp */ static const uint8_t u8g_dev_st7920_128x64_HAL_init_seq[] PROGMEM = { @@ -85,17 +85,17 @@ static const uint8_t u8g_dev_st7920_128x64_HAL_init_seq[] PROGMEM = { U8G_ESC_END // end of sequence }; -void clear_graphics_DRAM(u8g_t *u8g, u8g_dev_t *dev){ +void clear_graphics_DRAM(u8g_t *u8g, u8g_dev_t *dev) { u8g_SetChipSelect(u8g, dev, 1); u8g_Delay(1); u8g_SetAddress(u8g, dev, 0); // cmd mode u8g_WriteByte(u8g, dev, 0x08); //display off, cursor+blink off u8g_WriteByte(u8g, dev, 0x3E); //extended mode + GDRAM active - for (uint8_t y = 0; y < (HEIGHT) / 2; y++) { //clear GDRAM + for (uint8_t y = 0; y < (LCD_PIXEL_HEIGHT) / 2; y++) { //clear GDRAM u8g_WriteByte(u8g, dev, 0x80 | y); //set y u8g_WriteByte(u8g, dev, 0x80); //set x = 0 u8g_SetAddress(u8g, dev, 1); /* data mode */ - for (uint8_t i = 0; i < 2 * (WIDTH) / 8; i++) //2x width clears both segments + for (uint8_t i = 0; i < 2 * (LCD_PIXEL_WIDTH) / 8; i++) //2x width clears both segments u8g_WriteByte(u8g, dev, 0); u8g_SetAddress(u8g, dev, 0); /* cmd mode */ } @@ -137,8 +137,8 @@ uint8_t u8g_dev_st7920_128x64_HAL_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, vo } u8g_SetAddress(u8g, dev, 1); /* data mode */ - u8g_WriteSequence(u8g, dev, WIDTH/8, ptr); - ptr += WIDTH/8; + u8g_WriteSequence(u8g, dev, (LCD_PIXEL_WIDTH) / 8, ptr); + ptr += (LCD_PIXEL_WIDTH) / 8; y++; } u8g_SetChipSelect(u8g, dev, 0); @@ -182,8 +182,8 @@ uint8_t u8g_dev_st7920_128x64_HAL_4x_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, } u8g_SetAddress(u8g, dev, 1); /* data mode */ - u8g_WriteSequence(u8g, dev, WIDTH/8, ptr); - ptr += WIDTH/8; + u8g_WriteSequence(u8g, dev, (LCD_PIXEL_WIDTH) / 8, ptr); + ptr += (LCD_PIXEL_WIDTH) / 8; y++; } u8g_SetChipSelect(u8g, dev, 0); @@ -193,14 +193,14 @@ uint8_t u8g_dev_st7920_128x64_HAL_4x_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, return u8g_dev_pb32h1_base_fn(u8g, dev, msg, arg); } -U8G_PB_DEV(u8g_dev_st7920_128x64_HAL_sw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_st7920_128x64_HAL_fn, U8G_COM_ST7920_HAL_SW_SPI); +U8G_PB_DEV(u8g_dev_st7920_128x64_HAL_sw_spi, LCD_PIXEL_WIDTH, LCD_PIXEL_HEIGHT, PAGE_HEIGHT, u8g_dev_st7920_128x64_HAL_fn, U8G_COM_ST7920_HAL_SW_SPI); -#define QWIDTH (WIDTH*4) +#define QWIDTH ((LCD_PIXEL_WIDTH) * 4) uint8_t u8g_dev_st7920_128x64_HAL_4x_buf[QWIDTH] U8G_NOCOMMON ; -u8g_pb_t u8g_dev_st7920_128x64_HAL_4x_pb = { {32, HEIGHT, 0, 0, 0}, WIDTH, u8g_dev_st7920_128x64_HAL_4x_buf}; +u8g_pb_t u8g_dev_st7920_128x64_HAL_4x_pb = { { 32, LCD_PIXEL_HEIGHT, 0, 0, 0 }, LCD_PIXEL_WIDTH, u8g_dev_st7920_128x64_HAL_4x_buf}; u8g_dev_t u8g_dev_st7920_128x64_HAL_4x_sw_spi = { u8g_dev_st7920_128x64_HAL_4x_fn, &u8g_dev_st7920_128x64_HAL_4x_pb, U8G_COM_ST7920_HAL_SW_SPI }; -U8G_PB_DEV(u8g_dev_st7920_128x64_HAL_hw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_st7920_128x64_HAL_fn, U8G_COM_ST7920_HAL_HW_SPI); +U8G_PB_DEV(u8g_dev_st7920_128x64_HAL_hw_spi, LCD_PIXEL_WIDTH, LCD_PIXEL_HEIGHT, PAGE_HEIGHT, u8g_dev_st7920_128x64_HAL_fn, U8G_COM_ST7920_HAL_HW_SPI); u8g_dev_t u8g_dev_st7920_128x64_HAL_4x_hw_spi = { u8g_dev_st7920_128x64_HAL_4x_fn, &u8g_dev_st7920_128x64_HAL_4x_pb, U8G_COM_ST7920_HAL_HW_SPI }; #if defined(U8G_HAL_LINKS) || defined(__SAM3X8E__) @@ -209,4 +209,4 @@ u8g_dev_t u8g_dev_st7920_128x64_HAL_4x_hw_spi = { u8g_dev_st7920_128x64_HAL_4x_f u8g_dev_t u8g_dev_st7920_128x64_rrd_sw_spi = { u8g_dev_st7920_128x64_HAL_4x_fn, &u8g_dev_st7920_128x64_HAL_4x_pb, U8G_COM_ST7920_HAL_SW_SPI }; #endif -#endif // DOGLCD +#endif // HAS_GRAPHICAL_LCD diff --git a/Marlin/src/lcd/dogm/u8g_dev_uc1701_mini12864_HAL.cpp b/Marlin/src/lcd/dogm/u8g_dev_uc1701_mini12864_HAL.cpp index e58bb34fae..03372ece05 100644 --- a/Marlin/src/lcd/dogm/u8g_dev_uc1701_mini12864_HAL.cpp +++ b/Marlin/src/lcd/dogm/u8g_dev_uc1701_mini12864_HAL.cpp @@ -59,7 +59,7 @@ #include "../../inc/MarlinConfigPre.h" -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD #include @@ -114,19 +114,18 @@ uint8_t u8g_dev_uc1701_mini12864_HAL_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS); u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1701_mini12864_HAL_init_seq); break; - case U8G_DEV_MSG_STOP: - break; - case U8G_DEV_MSG_PAGE_NEXT: - { - u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem); - u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1701_mini12864_HAL_data_start); - u8g_WriteByte(u8g, dev, 0x0B0 | pb->p.page); /* select current page */ - u8g_SetAddress(u8g, dev, 1); /* data mode */ - if ( u8g_pb_WriteBuffer(pb, u8g, dev) == 0 ) - return 0; - u8g_SetChipSelect(u8g, dev, 0); - } - break; + + case U8G_DEV_MSG_STOP: break; + + case U8G_DEV_MSG_PAGE_NEXT: { + u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem); + u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1701_mini12864_HAL_data_start); + u8g_WriteByte(u8g, dev, 0x0B0 | pb->p.page); /* select current page */ + u8g_SetAddress(u8g, dev, 1); /* data mode */ + if (!u8g_pb_WriteBuffer(pb, u8g, dev)) return 0; + u8g_SetChipSelect(u8g, dev, 0); + } break; + case U8G_DEV_MSG_CONTRAST: u8g_SetChipSelect(u8g, dev, 1); u8g_SetAddress(u8g, dev, 0); /* instruction mode */ @@ -144,25 +143,25 @@ uint8_t u8g_dev_uc1701_mini12864_HAL_2x_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t m u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS); u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1701_mini12864_HAL_init_seq); break; - case U8G_DEV_MSG_STOP: - break; - case U8G_DEV_MSG_PAGE_NEXT: - { - u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem); - u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1701_mini12864_HAL_data_start); - u8g_WriteByte(u8g, dev, 0x0B0 | (2*pb->p.page)); /* select current page */ - u8g_SetAddress(u8g, dev, 1); /* data mode */ - u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)pb->buf); - u8g_SetChipSelect(u8g, dev, 0); + case U8G_DEV_MSG_STOP: break; + + case U8G_DEV_MSG_PAGE_NEXT: { + u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem); + + u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1701_mini12864_HAL_data_start); + u8g_WriteByte(u8g, dev, 0x0B0 | (2*pb->p.page)); /* select current page */ + u8g_SetAddress(u8g, dev, 1); /* data mode */ + u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)pb->buf); + u8g_SetChipSelect(u8g, dev, 0); + + u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1701_mini12864_HAL_data_start); + u8g_WriteByte(u8g, dev, 0x0B0 | (2*pb->p.page+1)); /* select current page */ + u8g_SetAddress(u8g, dev, 1); /* data mode */ + u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)(pb->buf)+pb->width); + u8g_SetChipSelect(u8g, dev, 0); + } break; - u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1701_mini12864_HAL_data_start); - u8g_WriteByte(u8g, dev, 0x0B0 | (2*pb->p.page+1)); /* select current page */ - u8g_SetAddress(u8g, dev, 1); /* data mode */ - u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)(pb->buf)+pb->width); - u8g_SetChipSelect(u8g, dev, 0); - } - break; case U8G_DEV_MSG_CONTRAST: u8g_SetChipSelect(u8g, dev, 1); u8g_SetAddress(u8g, dev, 0); /* instruction mode */ @@ -182,4 +181,4 @@ u8g_pb_t u8g_dev_uc1701_mini12864_HAL_2x_pb = { {16, HEIGHT, 0, 0, 0}, WIDTH, u u8g_dev_t u8g_dev_uc1701_mini12864_HAL_2x_sw_spi = { u8g_dev_uc1701_mini12864_HAL_2x_fn, &u8g_dev_uc1701_mini12864_HAL_2x_pb, U8G_COM_HAL_SW_SPI_FN }; u8g_dev_t u8g_dev_uc1701_mini12864_HAL_2x_hw_spi = { u8g_dev_uc1701_mini12864_HAL_2x_fn, &u8g_dev_uc1701_mini12864_HAL_2x_pb, U8G_COM_HAL_HW_SPI_FN }; -#endif // DOGLCD \ No newline at end of file +#endif // HAS_GRAPHICAL_LCD diff --git a/Marlin/src/lcd/u8g_fontutf8.cpp b/Marlin/src/lcd/dogm/u8g_fontutf8.cpp similarity index 95% rename from Marlin/src/lcd/u8g_fontutf8.cpp rename to Marlin/src/lcd/dogm/u8g_fontutf8.cpp index b79d9906eb..890cd4217c 100644 --- a/Marlin/src/lcd/u8g_fontutf8.cpp +++ b/Marlin/src/lcd/dogm/u8g_fontutf8.cpp @@ -7,15 +7,14 @@ * @copyright GPL/BSD */ -#include "../inc/MarlinConfigPre.h" +#include "../../inc/MarlinConfigPre.h" -#if ENABLED(DOGLCD) +#if HAS_GRAPHICAL_LCD #include -#include "fontutils.h" +#include "../fontutils.h" #include "u8g_fontutf8.h" -//////////////////////////////////////////////////////////// typedef void font_t; /** @@ -31,7 +30,6 @@ typedef void font_t; */ typedef int (* fontgroup_cb_draw_t)(void *userdata, const font_t *fnt_current, const char *msg); -//////////////////////////////////////////////////////////// /* return v1 - v2 */ static int fontinfo_compare(uxg_fontinfo_t * v1, uxg_fontinfo_t * v2) { if (v1->page < v2->page) return -1; @@ -115,7 +113,6 @@ static void fontgroup_drawstring(font_group_t *group, const font_t *fnt_default, } } -//////////////////////////////////////////////////////////// static bool flag_fontgroup_was_inited = false; static font_group_t g_fontgroup_root = {NULL, 0}; @@ -233,7 +230,7 @@ unsigned int uxg_DrawUtf8Str(u8g_t *pu8g, unsigned int x, unsigned int y, const * * Draw a ROM UTF-8 string at the specified position */ -unsigned int uxg_DrawUtf8StrP(u8g_t *pu8g, unsigned int x, unsigned int y, const char *utf8_msg, pixel_len_t max_width) { +unsigned int uxg_DrawUtf8StrP(u8g_t *pu8g, unsigned int x, unsigned int y, PGM_P utf8_msg, pixel_len_t max_width) { struct _uxg_drawu8_data_t data; font_group_t *group = &g_fontgroup_root; const font_t *fnt_default = uxg_GetFont(pu8g); @@ -302,7 +299,7 @@ int uxg_GetUtf8StrPixelWidth(u8g_t *pu8g, const char *utf8_msg) { * * Get the screen pixel width of a ROM UTF-8 string */ -int uxg_GetUtf8StrPixelWidthP(u8g_t *pu8g, const char *utf8_msg) { +int uxg_GetUtf8StrPixelWidthP(u8g_t *pu8g, PGM_P utf8_msg) { struct _uxg_drawu8_data_t data; font_group_t *group = &g_fontgroup_root; const font_t *fnt_default = uxg_GetFont(pu8g); @@ -317,4 +314,4 @@ int uxg_GetUtf8StrPixelWidthP(u8g_t *pu8g, const char *utf8_msg) { return data.adv; } -#endif // DOGLCD +#endif // HAS_GRAPHICAL_LCD diff --git a/Marlin/src/lcd/u8g_fontutf8.h b/Marlin/src/lcd/dogm/u8g_fontutf8.h similarity index 53% rename from Marlin/src/lcd/u8g_fontutf8.h rename to Marlin/src/lcd/dogm/u8g_fontutf8.h index 80522784c0..34e365cf95 100644 --- a/Marlin/src/lcd/u8g_fontutf8.h +++ b/Marlin/src/lcd/dogm/u8g_fontutf8.h @@ -6,11 +6,10 @@ * @date 2015-02-19 * @copyright GPL/BSD */ -#ifndef _UXG_FONTUTF8_H -#define _UXG_FONTUTF8_H 1 +#pragma once #include -#include "fontutils.h" +#include "../fontutils.h" // the macro to indicate a UTF-8 string // You should to save the C/C++ source in UTF-8 encoding! @@ -25,16 +24,14 @@ typedef struct _uxg_fontinfo_t { const u8g_fntpgm_uint8_t *fntdata; } uxg_fontinfo_t; -int uxg_SetUtf8Fonts (const uxg_fontinfo_t * fntinfo, int number); // fntinfo is type of PROGMEM +int uxg_SetUtf8Fonts(const uxg_fontinfo_t * fntinfo, int number); // fntinfo is type of PROGMEM -unsigned int uxg_DrawWchar (u8g_t *pu8g, unsigned int x, unsigned int y, wchar_t ch, pixel_len_t max_length); +unsigned int uxg_DrawWchar(u8g_t *pu8g, unsigned int x, unsigned int y, wchar_t ch, pixel_len_t max_length); -unsigned int uxg_DrawUtf8Str (u8g_t *pu8g, unsigned int x, unsigned int y, const char *utf8_msg, pixel_len_t max_length); -unsigned int uxg_DrawUtf8StrP (u8g_t *pu8g, unsigned int x, unsigned int y, const char *utf8_msg, pixel_len_t max_length); +unsigned int uxg_DrawUtf8Str(u8g_t *pu8g, unsigned int x, unsigned int y, const char *utf8_msg, pixel_len_t max_length); +unsigned int uxg_DrawUtf8StrP(u8g_t *pu8g, unsigned int x, unsigned int y, PGM_P utf8_msg, pixel_len_t max_length); int uxg_GetUtf8StrPixelWidth(u8g_t *pu8g, const char *utf8_msg); -int uxg_GetUtf8StrPixelWidthP(u8g_t *pu8g, const char *utf8_msg); +int uxg_GetUtf8StrPixelWidthP(u8g_t *pu8g, PGM_P utf8_msg); #define uxg_GetFont(puxg) ((puxg)->font) - -#endif // _UXG_FONTUTF8_H diff --git a/Marlin/src/lcd/dogm/ultralcd_DOGM.cpp b/Marlin/src/lcd/dogm/ultralcd_DOGM.cpp new file mode 100644 index 0000000000..e397a9f8ba --- /dev/null +++ b/Marlin/src/lcd/dogm/ultralcd_DOGM.cpp @@ -0,0 +1,625 @@ +/** + * 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 . + * + */ + +/** + * ultralcd_DOGM.cpp + * + * Implementation of the LCD display routines for a DOGM128 graphic display. + * by STB for ErikZalm/Marlin. Common LCD 128x64 pixel graphic displays. + * + * Demonstrator: http://www.reprap.org/wiki/STB_Electronics + * License: http://opensource.org/licenses/BSD-3-Clause + * + * With the use of: + * u8glib by Oliver Kraus + * https://github.com/olikraus/U8glib_Arduino + * License: http://opensource.org/licenses/BSD-3-Clause + */ + +#include "../../inc/MarlinConfigPre.h" + +#if HAS_GRAPHICAL_LCD + +#include "ultralcd_DOGM.h" +#include "u8g_fontutf8.h" +#include "dogm_Bootscreen.h" + +#include "../lcdprint.h" +#include "../fontutils.h" +#include "../ultralcd.h" + +#include "../../sd/cardreader.h" +#include "../../module/temperature.h" +#include "../../module/printcounter.h" + +#if ENABLED(SDSUPPORT) + #include "../../libs/duration_t.h" +#endif + +#if ENABLED(AUTO_BED_LEVELING_UBL) + #include "../../feature/bedlevel/ubl/ubl.h" +#endif + +#include "fontdata/fontdata_ISO10646_1.h" +#if ENABLED(USE_SMALL_INFOFONT) + #include "fontdata/fontdata_6x9_marlin.h" + #define FONT_STATUSMENU_NAME u8g_font_6x9 +#else + #define FONT_STATUSMENU_NAME MENU_FONT_NAME +#endif + +U8G_CLASS u8g(U8G_PARAM); + +#include LANGUAGE_DATA_INCL(LCD_LANGUAGE) + +#if HAS_LCD_CONTRAST + + int16_t MarlinUI::contrast; // Initialized by settings.load() + + void MarlinUI::set_contrast(const int16_t value) { + contrast = constrain(value, LCD_CONTRAST_MIN, LCD_CONTRAST_MAX); + u8g.setContrast(contrast); + } + +#endif + +void MarlinUI::set_font(const MarlinFont font_nr) { + static char currentfont = 0; + if (font_nr != currentfont) { + switch ((currentfont = font_nr)) { + case FONT_STATUSMENU : u8g.setFont(FONT_STATUSMENU_NAME); break; + case FONT_EDIT : u8g.setFont(EDIT_FONT_NAME); break; + default: + case FONT_MENU : u8g.setFont(MENU_FONT_NAME); break; + } + } +} + +#if ENABLED(SHOW_BOOTSCREEN) + + #if ENABLED(SHOW_CUSTOM_BOOTSCREEN) + + FORCE_INLINE void draw_custom_bootscreen(const u8g_pgm_uint8_t * const bmp, const bool erase=true) { + constexpr u8g_uint_t left = (LCD_PIXEL_WIDTH - (CUSTOM_BOOTSCREEN_BMPWIDTH)) / 2, + top = (LCD_PIXEL_HEIGHT - (CUSTOM_BOOTSCREEN_BMPHEIGHT)) / 2; + #if ENABLED(CUSTOM_BOOTSCREEN_INVERTED) + constexpr u8g_uint_t right = left + CUSTOM_BOOTSCREEN_BMPWIDTH, + bottom = top + CUSTOM_BOOTSCREEN_BMPHEIGHT; + #endif + u8g.firstPage(); + do { + u8g.drawBitmapP( + left, top, + CEILING(CUSTOM_BOOTSCREEN_BMPWIDTH, 8), CUSTOM_BOOTSCREEN_BMPHEIGHT, bmp + ); + #if ENABLED(CUSTOM_BOOTSCREEN_INVERTED) + if (erase) { + u8g.setColorIndex(1); + if (top) u8g.drawBox(0, 0, LCD_PIXEL_WIDTH, top); + if (left) u8g.drawBox(0, top, left, CUSTOM_BOOTSCREEN_BMPHEIGHT); + if (right < LCD_PIXEL_WIDTH) u8g.drawBox(right, top, LCD_PIXEL_WIDTH - right, CUSTOM_BOOTSCREEN_BMPHEIGHT); + if (bottom < LCD_PIXEL_HEIGHT) u8g.drawBox(0, bottom, LCD_PIXEL_WIDTH, LCD_PIXEL_HEIGHT - bottom); + } + #else + UNUSED(erase); + #endif + } while (u8g.nextPage()); + } + + void lcd_custom_bootscreen() { + #if ENABLED(ANIMATED_BOOTSCREEN) + LOOP_L_N(f, COUNT(custom_bootscreen_animation)) { + if (f) safe_delay(CUSTOM_BOOTSCREEN_FRAME_TIME); + draw_custom_bootscreen((u8g_pgm_uint8_t*)pgm_read_ptr(&custom_bootscreen_animation[f]), f == 0); + } + #else + draw_custom_bootscreen(custom_start_bmp); + #endif + safe_delay(CUSTOM_BOOTSCREEN_TIMEOUT); + } + + #endif // SHOW_CUSTOM_BOOTSCREEN + + void MarlinUI::show_bootscreen() { + #if ENABLED(SHOW_CUSTOM_BOOTSCREEN) + lcd_custom_bootscreen(); + #endif + + constexpr uint8_t offy = + #if ENABLED(START_BMPHIGH) + (LCD_PIXEL_HEIGHT - (START_BMPHEIGHT)) / 2 + #else + MENU_FONT_HEIGHT + #endif + ; + + const uint8_t width = u8g.getWidth(), height = u8g.getHeight(), + offx = (width - (START_BMPWIDTH)) / 2; + + u8g.firstPage(); + do { + u8g.drawBitmapP(offx, offy, (START_BMPWIDTH + 7) / 8, START_BMPHEIGHT, start_bmp); + ui.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); + #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); + #endif + } while (u8g.nextPage()); + safe_delay(BOOTSCREEN_TIMEOUT); + } + +#endif // SHOW_BOOTSCREEN + +#if ENABLED(LIGHTWEIGHT_UI) + #include "status_screen_lite_ST7920.h" +#endif + +// Initialize or re-initialize the LCD +void MarlinUI::init_lcd() { + + #if PIN_EXISTS(LCD_BACKLIGHT) // Enable LCD backlight + OUT_WRITE(LCD_BACKLIGHT_PIN, HIGH); + #endif + + #if ENABLED(MKS_12864OLED) || ENABLED(MKS_12864OLED_SSD1306) + SET_OUTPUT(LCD_PINS_DC); + #if !defined(LCD_RESET_PIN) + #define LCD_RESET_PIN LCD_PINS_RS + #endif + #endif + + #if PIN_EXISTS(LCD_RESET) + OUT_WRITE(LCD_RESET_PIN, LOW); // perform a clean hardware reset + _delay_ms(5); + OUT_WRITE(LCD_RESET_PIN, HIGH); + _delay_ms(5); // delay to allow the display to initalize + #endif + + #if PIN_EXISTS(LCD_RESET) + u8g.begin(); + #endif + + #if HAS_LCD_CONTRAST + refresh_contrast(); + #endif + + #if ENABLED(LCD_SCREEN_ROT_90) + u8g.setRot90(); // Rotate screen by 90° + #elif ENABLED(LCD_SCREEN_ROT_180) + u8g.setRot180(); // Rotate screen by 180° + #elif ENABLED(LCD_SCREEN_ROT_270) + u8g.setRot270(); // Rotate screen by 270° + #endif + + uxg_SetUtf8Fonts(g_fontinfo, NUM_ARRAY(g_fontinfo)); +} + +// The kill screen is displayed for unrecoverable conditions +void MarlinUI::draw_kill_screen() { + #if ENABLED(LIGHTWEIGHT_UI) + ST7920_Lite_Status_Screen::clear_text_buffer(); + #endif + const uint8_t h4 = u8g.getHeight() / 4; + u8g.firstPage(); + do { + set_font(FONT_MENU); + lcd_moveto(0, h4 * 1); + lcd_put_u8str(status_message); + lcd_moveto(0, h4 * 2); + lcd_put_u8str_P(PSTR(MSG_HALTED)); + lcd_moveto(0, h4 * 3); + lcd_put_u8str_P(PSTR(MSG_PLEASE_RESET)); + } while (u8g.nextPage()); +} + +void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop + +#if HAS_LCD_MENU + + uint8_t row_y1, row_y2; + + #if ENABLED(ADVANCED_PAUSE_FEATURE) + + void MarlinUI::draw_hotend_status(const uint8_t row, const uint8_t extruder) { + row_y1 = row * (MENU_FONT_HEIGHT) + 1; + row_y2 = row_y1 + MENU_FONT_HEIGHT - 1; + + if (!PAGE_CONTAINS(row_y1 + 1, row_y2 + 2)) return; + + lcd_moveto(LCD_PIXEL_WIDTH - 11 * (MENU_FONT_WIDTH), row_y2); + lcd_put_wchar('E'); + lcd_put_wchar((char)('1' + extruder)); + lcd_put_wchar(' '); + lcd_put_u8str(itostr3(thermalManager.degHotend(extruder))); + lcd_put_wchar('/'); + + if (get_blink() || !thermalManager.is_heater_idle(extruder)) + lcd_put_u8str(itostr3(thermalManager.degTargetHotend(extruder))); + } + + #endif // ADVANCED_PAUSE_FEATURE + + // Set the colors for a menu item based on whether it is selected + static bool mark_as_selected(const uint8_t row, const bool sel) { + row_y1 = row * (MENU_FONT_HEIGHT) + 1; + row_y2 = row_y1 + MENU_FONT_HEIGHT - 1; + + if (!PAGE_CONTAINS(row_y1 + 1, row_y2 + 2)) return false; + + if (sel) { + #if ENABLED(MENU_HOLLOW_FRAME) + u8g.drawHLine(0, row_y1 + 1, LCD_PIXEL_WIDTH); + u8g.drawHLine(0, row_y2 + 2, LCD_PIXEL_WIDTH); + #else + u8g.setColorIndex(1); // black on white + u8g.drawBox(0, row_y1 + 2, LCD_PIXEL_WIDTH, MENU_FONT_HEIGHT - 1); + u8g.setColorIndex(0); // white on black + #endif + } + #if DISABLED(MENU_HOLLOW_FRAME) + else { + u8g.setColorIndex(1); // unmarked text is black on white + } + #endif + + if (!PAGE_CONTAINS(row_y1, row_y2)) return false; + + lcd_moveto(0, row_y2); + return true; + } + + // Draw a static line of text in the same idiom as a menu item + void draw_menu_item_static(const uint8_t row, PGM_P pstr, const bool center/*=true*/, const bool invert/*=false*/, const char* valstr/*=NULL*/) { + + if (mark_as_selected(row, invert)) { + + uint8_t n = LCD_PIXEL_WIDTH; // pixel width of string allowed + + if (center && !valstr) { + int8_t pad = (LCD_WIDTH - utf8_strlen_P(pstr)) / 2; + while (--pad >= 0) { lcd_put_wchar(' '); n--; } + } + n -= lcd_put_u8str_max_P(pstr, n); + if (valstr) n -= lcd_put_u8str_max(valstr, n); + while (n > MENU_FONT_WIDTH) n -= lcd_put_wchar(' '); + } + } + + // Draw a generic menu item + void draw_menu_item(const bool sel, const uint8_t row, PGM_P const pstr, const char pre_char, const char post_char) { + UNUSED(pre_char); + + if (mark_as_selected(row, sel)) { + uint8_t n = (LCD_WIDTH - 2) * (MENU_FONT_WIDTH); + n -= lcd_put_u8str_max_P(pstr, n); + while (n > MENU_FONT_WIDTH) n -= lcd_put_wchar(' '); + lcd_moveto(LCD_PIXEL_WIDTH - (MENU_FONT_WIDTH), row_y2); + lcd_put_wchar(post_char); + lcd_put_wchar(' '); + } + } + + // Draw a menu item with an editable value + void _draw_menu_item_edit(const bool sel, const uint8_t row, PGM_P const pstr, const char* const data, const bool pgm) { + if (mark_as_selected(row, sel)) { + const uint8_t vallen = (pgm ? utf8_strlen_P(data) : utf8_strlen((char*)data)); + uint8_t n = (LCD_WIDTH - 2 - vallen) * (MENU_FONT_WIDTH); + n -= lcd_put_u8str_max_P(pstr, n); + lcd_put_wchar(':'); + while (n > MENU_FONT_WIDTH) n -= lcd_put_wchar(' '); + lcd_moveto(LCD_PIXEL_WIDTH - (MENU_FONT_WIDTH) * vallen, row_y2); + if (pgm) lcd_put_u8str_P(data); else lcd_put_u8str((char*)data); + } + } + + void draw_edit_screen(PGM_P const pstr, const char* const value/*=NULL*/) { + const uint8_t labellen = utf8_strlen_P(pstr), vallen = utf8_strlen(value); + + bool extra_row = labellen > LCD_WIDTH - 2 - vallen; + + #if ENABLED(USE_BIG_EDIT_FONT) + // Use the menu font if the label won't fit on a single line + constexpr uint8_t lcd_edit_width = (LCD_PIXEL_WIDTH) / (EDIT_FONT_WIDTH); + uint8_t lcd_chr_fit, one_chr_width; + if (labellen <= lcd_edit_width - 1) { + if (labellen + vallen + 1 > lcd_edit_width) extra_row = true; + lcd_chr_fit = lcd_edit_width + 1; + one_chr_width = EDIT_FONT_WIDTH; + ui.set_font(FONT_EDIT); + } + else { + lcd_chr_fit = LCD_WIDTH; + one_chr_width = MENU_FONT_WIDTH; + ui.set_font(FONT_MENU); + } + #else + constexpr uint8_t lcd_chr_fit = LCD_WIDTH, + one_chr_width = MENU_FONT_WIDTH; + #endif + + // Center the label and value lines on the middle line + uint8_t baseline = extra_row ? (LCD_PIXEL_HEIGHT) / 2 + : (LCD_PIXEL_HEIGHT + EDIT_FONT_ASCENT) / 2; + + // Assume the label is alpha-numeric (with a descender) + bool onpage = PAGE_CONTAINS(baseline - (EDIT_FONT_ASCENT - 1), baseline + EDIT_FONT_DESCENT); + if (onpage) { + lcd_moveto(0, baseline); + lcd_put_u8str_P(pstr); + } + + // If a value is included, print a colon, then print the value right-justified + if (value != NULL) { + lcd_put_wchar(':'); + if (extra_row) { + // Assume the value is numeric (with no descender) + baseline += EDIT_FONT_ASCENT; + onpage = PAGE_CONTAINS(baseline - (EDIT_FONT_ASCENT - 1), baseline); + } + if (onpage) { + lcd_moveto(((lcd_chr_fit - 1) - (vallen + 1)) * one_chr_width, baseline); // Right-justified, leaving padded by spaces + lcd_put_wchar(' '); // overwrite char if value gets shorter + lcd_put_u8str(value); + } + } + } + + #if ENABLED(SDSUPPORT) + + void draw_sd_menu_item(const bool sel, const uint8_t row, PGM_P const pstr, CardReader &theCard, const bool isDir) { + UNUSED(pstr); + + if (mark_as_selected(row, sel)) { + if (isDir) lcd_put_wchar(LCD_STR_FOLDER[0]); + constexpr uint8_t maxlen = LCD_WIDTH - 1; + const uint8_t pixw = maxlen * (MENU_FONT_WIDTH); + uint8_t n = pixw - lcd_put_u8str_max(ui.scrolled_filename(theCard, maxlen, row, sel), pixw); + while (n > MENU_FONT_WIDTH) n -= lcd_put_wchar(' '); + } + } + + #endif // SDSUPPORT + + #if ENABLED(AUTO_BED_LEVELING_UBL) + + /** + * UBL LCD "radar" map data + */ + #define MAP_UPPER_LEFT_CORNER_X 35 // These probably should be moved to the .h file But for now, + #define MAP_UPPER_LEFT_CORNER_Y 8 // it is easier to play with things having them here + #define MAP_MAX_PIXELS_X 53 + #define MAP_MAX_PIXELS_Y 49 + + void MarlinUI::ubl_plot(const uint8_t x_plot, const uint8_t y_plot) { + // Scale the box pixels appropriately + uint8_t x_map_pixels = ((MAP_MAX_PIXELS_X - 4) / (GRID_MAX_POINTS_X)) * (GRID_MAX_POINTS_X), + y_map_pixels = ((MAP_MAX_PIXELS_Y - 4) / (GRID_MAX_POINTS_Y)) * (GRID_MAX_POINTS_Y), + + pixels_per_x_mesh_pnt = x_map_pixels / (GRID_MAX_POINTS_X), + pixels_per_y_mesh_pnt = y_map_pixels / (GRID_MAX_POINTS_Y), + + x_offset = MAP_UPPER_LEFT_CORNER_X + 1 + (MAP_MAX_PIXELS_X - x_map_pixels - 2) / 2, + y_offset = MAP_UPPER_LEFT_CORNER_Y + 1 + (MAP_MAX_PIXELS_Y - y_map_pixels - 2) / 2; + + // Clear the Mesh Map + + if (PAGE_CONTAINS(y_offset - 2, y_offset + y_map_pixels + 4)) { + u8g.setColorIndex(1); // First draw the bigger box in White so we have a border around the mesh map box + u8g.drawBox(x_offset - 2, y_offset - 2, x_map_pixels + 4, y_map_pixels + 4); + if (PAGE_CONTAINS(y_offset, y_offset + y_map_pixels)) { + u8g.setColorIndex(0); // Now actually clear the mesh map box + u8g.drawBox(x_offset, y_offset, x_map_pixels, y_map_pixels); + } + } + + // Display Mesh Point Locations + + u8g.setColorIndex(1); + const uint8_t sx = x_offset + pixels_per_x_mesh_pnt / 2; + uint8_t y = y_offset + pixels_per_y_mesh_pnt / 2; + for (uint8_t j = 0; j < GRID_MAX_POINTS_Y; j++, y += pixels_per_y_mesh_pnt) + if (PAGE_CONTAINS(y, y)) + for (uint8_t i = 0, x = sx; i < GRID_MAX_POINTS_X; i++, x += pixels_per_x_mesh_pnt) + u8g.drawBox(x, y, 1, 1); + + // Fill in the Specified Mesh Point + + uint8_t inverted_y = GRID_MAX_POINTS_Y - y_plot - 1; // The origin is typically in the lower right corner. We need to + // invert the Y to get it to plot in the right location. + + const uint8_t by = y_offset + inverted_y * pixels_per_y_mesh_pnt; + if (PAGE_CONTAINS(by, by + pixels_per_y_mesh_pnt)) + u8g.drawBox( + x_offset + x_plot * pixels_per_x_mesh_pnt, by, + pixels_per_x_mesh_pnt, pixels_per_y_mesh_pnt + ); + + // Put Relevant Text on Display + + // Show X and Y positions at top of screen + u8g.setColorIndex(1); + if (PAGE_UNDER(7)) { + lcd_moveto(5, 7); + lcd_put_u8str("X:"); + lcd_put_u8str(ftostr52(LOGICAL_X_POSITION(pgm_read_float(&ubl._mesh_index_to_xpos[x_plot])))); + lcd_moveto(74, 7); + lcd_put_u8str("Y:"); + lcd_put_u8str(ftostr52(LOGICAL_Y_POSITION(pgm_read_float(&ubl._mesh_index_to_ypos[y_plot])))); + } + + // Print plot position + if (PAGE_CONTAINS(LCD_PIXEL_HEIGHT - (INFO_FONT_HEIGHT - 1), LCD_PIXEL_HEIGHT)) { + lcd_moveto(5, LCD_PIXEL_HEIGHT); + lcd_put_wchar('('); + u8g.print(x_plot); + lcd_put_wchar(','); + u8g.print(y_plot); + lcd_put_wchar(')'); + + // Show the location value + lcd_moveto(74, LCD_PIXEL_HEIGHT); + lcd_put_u8str("Z:"); + if (!isnan(ubl.z_values[x_plot][y_plot])) + lcd_put_u8str(ftostr43sign(ubl.z_values[x_plot][y_plot])); + else + lcd_put_u8str_P(PSTR(" -----")); + } + + } + + #endif // AUTO_BED_LEVELING_UBL + + #if ENABLED(BABYSTEP_ZPROBE_GFX_OVERLAY) || ENABLED(MESH_EDIT_GFX_OVERLAY) + + const unsigned char cw_bmp[] PROGMEM = { + B00000011,B11111000,B00000000, + B00001111,B11111110,B00000000, + B00011110,B00001111,B00000000, + B00111000,B00000111,B00000000, + B00111000,B00000011,B10000000, + B01110000,B00000011,B10000000, + B01110000,B00001111,B11100000, + B01110000,B00000111,B11000000, + B01110000,B00000011,B10000000, + B01110000,B00000001,B00000000, + B01110000,B00000000,B00000000, + B00111000,B00000000,B00000000, + B00111000,B00000111,B00000000, + B00011110,B00001111,B00000000, + B00001111,B11111110,B00000000, + B00000011,B11111000,B00000000 + }; + + const unsigned char ccw_bmp[] PROGMEM = { + B00000000,B11111110,B00000000, + B00000011,B11111111,B10000000, + B00000111,B10000011,B11000000, + B00001110,B00000001,B11000000, + B00001110,B00000000,B11100000, + B00011100,B00000000,B11100000, + B01111111,B00000000,B11100000, + B00111110,B00000000,B11100000, + B00011100,B00000000,B11100000, + B00001000,B00000000,B11100000, + B00000000,B00000000,B11100000, + B00000000,B00000001,B11000000, + B00001110,B00000001,B11000000, + B00001111,B00000111,B10000000, + B00000111,B11111111,B00000000, + B00000001,B11111100,B00000000 + }; + + const unsigned char up_arrow_bmp[] PROGMEM = { + B00000100,B00000000, + B00001110,B00000000, + B00011111,B00000000, + B00111111,B10000000, + B01111111,B11000000, + B00001110,B00000000, + B00001110,B00000000, + B00001110,B00000000, + B00001110,B00000000, + B00001110,B00000000, + B00001110,B00000000, + B00001110,B00000000, + B00001110,B00000000 + }; + + const unsigned char down_arrow_bmp[] PROGMEM = { + B00001110,B00000000, + B00001110,B00000000, + B00001110,B00000000, + B00001110,B00000000, + B00001110,B00000000, + B00001110,B00000000, + B00001110,B00000000, + B00001110,B00000000, + B01111111,B11000000, + B00111111,B10000000, + B00011111,B00000000, + B00001110,B00000000, + B00000100,B00000000 + }; + + const unsigned char offset_bedline_bmp[] PROGMEM = { + B11111111,B11111111,B11111111 + }; + + const unsigned char nozzle_bmp[] PROGMEM = { + B01111111,B10000000, + B11111111,B11000000, + B11111111,B11000000, + B11111111,B11000000, + B01111111,B10000000, + B01111111,B10000000, + B11111111,B11000000, + B11111111,B11000000, + B11111111,B11000000, + B00111111,B00000000, + B00011110,B00000000, + B00001100,B00000000 + }; + + void _lcd_zoffset_overlay_gfx(const float zvalue) { + // Determine whether the user is raising or lowering the nozzle. + static int8_t dir; + static float old_zvalue; + if (zvalue != old_zvalue) { + dir = zvalue ? zvalue < old_zvalue ? -1 : 1 : 0; + old_zvalue = zvalue; + } + + #if ENABLED(OVERLAY_GFX_REVERSE) + const unsigned char *rot_up = ccw_bmp, *rot_down = cw_bmp; + #else + const unsigned char *rot_up = cw_bmp, *rot_down = ccw_bmp; + #endif + + #if ENABLED(USE_BIG_EDIT_FONT) + const int left = 0, right = 45, nozzle = 95; + #else + const int left = 5, right = 90, nozzle = 60; + #endif + + // Draw a representation of the nozzle + if (PAGE_CONTAINS(3, 16)) u8g.drawBitmapP(nozzle + 6, 4 - dir, 2, 12, nozzle_bmp); + if (PAGE_CONTAINS(20, 20)) u8g.drawBitmapP(nozzle + 0, 20, 3, 1, offset_bedline_bmp); + + // Draw cw/ccw indicator and up/down arrows. + if (PAGE_CONTAINS(47, 62)) { + u8g.drawBitmapP(left + 0, 47, 3, 16, rot_down); + u8g.drawBitmapP(right + 0, 47, 3, 16, rot_up); + u8g.drawBitmapP(right + 20, 48 - dir, 2, 13, up_arrow_bmp); + u8g.drawBitmapP(left + 20, 49 - dir, 2, 13, down_arrow_bmp); + } + } + + #endif // BABYSTEP_ZPROBE_GFX_OVERLAY || MESH_EDIT_GFX_OVERLAY + +#endif // HAS_LCD_MENU + +#endif // HAS_GRAPHICAL_LCD diff --git a/Marlin/src/lcd/dogm/ultralcd_DOGM.h b/Marlin/src/lcd/dogm/ultralcd_DOGM.h new file mode 100644 index 0000000000..4f164ff42d --- /dev/null +++ b/Marlin/src/lcd/dogm/ultralcd_DOGM.h @@ -0,0 +1,175 @@ +/** + * 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 . + * + */ + +/** + * ultralcd_DOGM.h + */ + +#include "../../inc/MarlinConfigPre.h" + +#include +#include "HAL_LCD_class_defines.h" + +// LCD selection +#if ENABLED(REPRAPWORLD_GRAPHICAL_LCD) + #define U8G_CLASS U8GLIB_ST7920_128X64_4X + #if DISABLED(SDSUPPORT) && (LCD_PINS_D4 == SCK_PIN) && (LCD_PINS_ENABLE == MOSI_PIN) + #define U8G_PARAM LCD_PINS_RS + #else + #define U8G_PARAM LCD_PINS_D4, LCD_PINS_ENABLE, LCD_PINS_RS + #endif + +#elif ENABLED(U8GLIB_ST7920) + // RepRap Discount Full Graphics Smart Controller + #if DISABLED(SDSUPPORT) && (LCD_PINS_D4 == SCK_PIN) && (LCD_PINS_ENABLE == MOSI_PIN) + #define U8G_CLASS U8GLIB_ST7920_128X64_4X_HAL + #define U8G_PARAM LCD_PINS_RS // 2 stripes, HW SPI (shared with SD card, on AVR does not use standard LCD adapter) + #else + //#define U8G_CLASS U8GLIB_ST7920_128X64_4X + //#define U8G_PARAM LCD_PINS_D4, LCD_PINS_ENABLE, LCD_PINS_RS // Original u8glib device. 2 stripes, SW SPI + #define U8G_CLASS U8GLIB_ST7920_128X64_RRD + #define U8G_PARAM LCD_PINS_D4, LCD_PINS_ENABLE, LCD_PINS_RS // Number of stripes can be adjusted in ultralcd_st7920_u8glib_rrd.h with PAGE_HEIGHT + // AVR version ignores these pin settings + // HAL version uses these pin settings + #endif + +#elif ENABLED(CARTESIO_UI) + // The CartesioUI display + //#define U8G_CLASS U8GLIB_DOGM128_2X + //#define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0 // 4 stripes + #define U8G_CLASS U8GLIB_DOGM128_2X + #define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // 4 stripes + +#elif ENABLED(U8GLIB_LM6059_AF) + // Based on the Adafruit ST7565 (http://www.adafruit.com/products/250) + //#define U8G_CLASS U8GLIB_LM6059 + //#define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // 8 stripes + #define U8G_CLASS U8GLIB_LM6059_2X + #define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // 4 stripes + +#elif ENABLED(U8GLIB_ST7565_64128N) + // The MaKrPanel, Mini Viki, Viki 2.0 & AZSMZ 12864 ST7565 controller + #define SMART_RAMPS (MB(RAMPS_SMART_EFB) || MB(RAMPS_SMART_EEB) || MB(RAMPS_SMART_EFF) || MB(RAMPS_SMART_EEF) || MB(RAMPS_SMART_SF)) + #if DOGLCD_SCK == SCK_PIN && DOGLCD_MOSI == MOSI_PIN && !SMART_RAMPS + #define U8G_CLASS U8GLIB_64128N_2X_HAL + #define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // using HW-SPI + #else + #define U8G_CLASS U8GLIB_64128N_2X_HAL + #define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0 // using SW-SPI + #endif + +#elif ENABLED(MKS_12864OLED_SSD1306) + // MKS 128x64 (SSD1306) OLED I2C LCD + #define U8G_CLASS U8GLIB_SSD1306_128X64 + #define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0 // 8 stripes + //#define U8G_CLASS U8GLIB_SSD1306_128X64_2X + //#define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0 // 4 stripes + +#elif ENABLED(U8GLIB_SSD1306) + // Generic support for SSD1306 OLED I2C LCDs + //#define U8G_CLASS U8GLIB_SSD1306_128X64_2X_I2C_2_WIRE + //#define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST) // 4 stripes + #define U8G_CLASS U8GLIB_SSD1306_128X64_2X + #define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST) // 4 stripes + +#elif ENABLED(MKS_12864OLED) + // MKS 128x64 (SH1106) OLED I2C LCD + #define U8G_CLASS U8GLIB_SH1106_128X64 + #define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0 // 8 stripes + //#define U8G_CLASS U8GLIB_SH1106_128X64_2X + //#define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0 // 4 stripes +#elif ENABLED(U8GLIB_SH1106) + // Generic support for SH1106 OLED I2C LCDs + //#define U8G_CLASS U8GLIB_SH1106_128X64_2X_I2C_2_WIRE + //#define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST) // 4 stripes + #define U8G_CLASS U8GLIB_SH1106_128X64_2X + #define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST) // 4 stripes +#elif ENABLED(U8GLIB_SSD1309) + // 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) + // The MINIPanel display + //#define U8G_CLASS U8GLIB_MINI12864 + //#define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // 8 stripes + #define U8G_CLASS U8GLIB_MINI12864_2X + #define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // 4 stripes +#elif ENABLED(U8GLIB_SH1106_EINSTART) + // Connected via motherboard header + #define U8G_CLASS U8GLIB_SH1106_128X64 + #define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, LCD_PINS_DC, LCD_PINS_RS +#else + // for regular DOGM128 display with HW-SPI + //#define U8G_CLASS U8GLIB_DOGM128 + //#define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // HW-SPI Com: CS, A0 // 8 stripes + #define U8G_CLASS U8GLIB_DOGM128_2X + #define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // HW-SPI Com: CS, A0 // 4 stripes +#endif + +#ifndef LCD_PIXEL_WIDTH + #define LCD_PIXEL_WIDTH 128 +#endif +#ifndef LCD_PIXEL_HEIGHT + #define LCD_PIXEL_HEIGHT 64 +#endif + +// For selective rendering within a Y range +#define PAGE_UNDER(yb) (u8g.getU8g()->current_page.y0 <= (yb)) +#define PAGE_CONTAINS(ya, yb) (PAGE_UNDER(yb) && u8g.getU8g()->current_page.y1 >= (ya)) + +// Only Western languages support big / small fonts +#if DISABLED(DISPLAY_CHARSET_ISO10646_1) + #undef USE_BIG_EDIT_FONT + #undef USE_SMALL_INFOFONT +#endif + +#define MENU_FONT_NAME ISO10646_1_5x7 +#define MENU_FONT_WIDTH 6 +#define MENU_FONT_ASCENT 10 +#define MENU_FONT_DESCENT 2 +#define MENU_FONT_HEIGHT (MENU_FONT_ASCENT + MENU_FONT_DESCENT) + +#if ENABLED(USE_BIG_EDIT_FONT) + #define EDIT_FONT_NAME u8g_font_9x18 + #define EDIT_FONT_WIDTH 9 + #define EDIT_FONT_ASCENT 10 + #define EDIT_FONT_DESCENT 3 +#else + #define EDIT_FONT_NAME MENU_FONT_NAME + #define EDIT_FONT_WIDTH MENU_FONT_WIDTH + #define EDIT_FONT_ASCENT MENU_FONT_ASCENT + #define EDIT_FONT_DESCENT MENU_FONT_DESCENT +#endif +#define EDIT_FONT_HEIGHT (EDIT_FONT_ASCENT + EDIT_FONT_DESCENT) + +// Get the Ascent, Descent, and total Height for the Info Screen font +#if ENABLED(USE_SMALL_INFOFONT) + extern const u8g_fntpgm_uint8_t u8g_font_6x9[]; + #define INFO_FONT_ASCENT 7 +#else + #define INFO_FONT_ASCENT 8 +#endif +#define INFO_FONT_DESCENT 2 +#define INFO_FONT_HEIGHT (INFO_FONT_ASCENT + INFO_FONT_DESCENT) +#define INFO_FONT_WIDTH 6 + +extern U8G_CLASS u8g; diff --git a/Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.cpp b/Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.cpp index 9d3d68ef46..c3d1942a59 100644 --- a/Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.cpp +++ b/Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.cpp @@ -25,60 +25,9 @@ #include "../../inc/MarlinConfig.h" -#if ENABLED(U8GLIB_ST7920) +#if ENABLED(U8GLIB_ST7920) && !defined(U8G_HAL_LINKS) && !defined(__SAM3X8E__) -#if !(defined(U8G_HAL_LINKS) || defined(__SAM3X8E__)) - -#include "../../HAL/shared/Delay.h" - -#define ST7920_CLK_PIN LCD_PINS_D4 -#define ST7920_DAT_PIN LCD_PINS_ENABLE -#define ST7920_CS_PIN LCD_PINS_RS - -//#define PAGE_HEIGHT 8 //128 byte framebuffer -#define PAGE_HEIGHT 16 //256 byte framebuffer -//#define PAGE_HEIGHT 32 //512 byte framebuffer - -#define LCD_PIXEL_WIDTH 128 -#define LCD_PIXEL_HEIGHT 64 - -#include - -//set optimization so ARDUINO optimizes this file -#pragma GCC optimize (3) - -// If you want you can define your own set of delays in Configuration.h -//#define ST7920_DELAY_1 DELAY_NS(0) -//#define ST7920_DELAY_2 DELAY_NS(0) -//#define ST7920_DELAY_3 DELAY_NS(0) - -#if F_CPU >= 20000000 - #define CPU_ST7920_DELAY_1 DELAY_NS(0) - #define CPU_ST7920_DELAY_2 DELAY_NS(0) - #define CPU_ST7920_DELAY_3 DELAY_NS(50) -#elif MB(3DRAG) || MB(K8200) || MB(K8400) || MB(SILVER_GATE) - #define CPU_ST7920_DELAY_1 DELAY_NS(0) - #define CPU_ST7920_DELAY_2 DELAY_NS(188) - #define CPU_ST7920_DELAY_3 DELAY_NS(0) -#elif MB(MINIRAMBO) || MB(EINSY_RAMBO) - #define CPU_ST7920_DELAY_1 DELAY_NS(0) - #define CPU_ST7920_DELAY_2 DELAY_NS(250) - #define CPU_ST7920_DELAY_3 DELAY_NS(0) -#elif MB(RAMBO) - #define CPU_ST7920_DELAY_1 DELAY_NS(0) - #define CPU_ST7920_DELAY_2 DELAY_NS(0) - #define CPU_ST7920_DELAY_3 DELAY_NS(0) -#elif MB(BQ_ZUM_MEGA_3D) - #define CPU_ST7920_DELAY_1 DELAY_NS(0) - #define CPU_ST7920_DELAY_2 DELAY_NS(0) - #define CPU_ST7920_DELAY_3 DELAY_NS(189) -#elif F_CPU == 16000000 - #define CPU_ST7920_DELAY_1 DELAY_NS(0) - #define CPU_ST7920_DELAY_2 DELAY_NS(0) - #define CPU_ST7920_DELAY_3 DELAY_NS(63) -#else - #error "No valid condition for delays in 'ultralcd_st7920_u8glib_rrd.h'" -#endif +#include "ultralcd_st7920_u8glib_rrd_AVR.h" #ifndef ST7920_DELAY_1 #define ST7920_DELAY_1 CPU_ST7920_DELAY_1 @@ -90,13 +39,19 @@ #define ST7920_DELAY_3 CPU_ST7920_DELAY_3 #endif +// Optimize this code with -O3 +#pragma GCC optimize (3) + #define ST7920_SND_BIT \ WRITE(ST7920_CLK_PIN, LOW); ST7920_DELAY_1; \ WRITE(ST7920_DAT_PIN, val & 0x80); ST7920_DELAY_2; \ WRITE(ST7920_CLK_PIN, HIGH); ST7920_DELAY_3; \ val <<= 1 -static void ST7920_SWSPI_SND_8BIT(uint8_t val) { +// Optimize this code with -O3 +#pragma GCC optimize (3) + +void ST7920_SWSPI_SND_8BIT(uint8_t val) { ST7920_SND_BIT; // 1 ST7920_SND_BIT; // 2 ST7920_SND_BIT; // 3 @@ -107,19 +62,6 @@ static void ST7920_SWSPI_SND_8BIT(uint8_t val) { ST7920_SND_BIT; // 8 } -#if DOGM_SPI_DELAY_US > 0 - #define U8G_DELAY() DELAY_US(DOGM_SPI_DELAY_US) -#else - #define U8G_DELAY() DELAY_US(10) -#endif - -#define ST7920_CS() { WRITE(ST7920_CS_PIN,1); U8G_DELAY(); } -#define ST7920_NCS() { WRITE(ST7920_CS_PIN,0); } -#define ST7920_SET_CMD() { ST7920_SWSPI_SND_8BIT(0xF8); U8G_DELAY(); } -#define ST7920_SET_DAT() { ST7920_SWSPI_SND_8BIT(0xFA); U8G_DELAY(); } -#define ST7920_WRITE_BYTE(a) { ST7920_SWSPI_SND_8BIT((uint8_t)((a)&0xF0u)); ST7920_SWSPI_SND_8BIT((uint8_t)((a)<<4u)); U8G_DELAY(); } -#define ST7920_WRITE_BYTES(p,l) { for (uint8_t i = l + 1; --i;) { ST7920_SWSPI_SND_8BIT(*p&0xF0); ST7920_SWSPI_SND_8BIT(*p<<4); p++; } U8G_DELAY(); } - uint8_t u8g_dev_rrd_st7920_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg) { uint8_t i, y; switch (msg) { @@ -190,14 +132,6 @@ uint8_t u8g_dev_st7920_128x64_rrd_buf[(LCD_PIXEL_WIDTH) * (PAGE_HEIGHT) / 8] U u8g_pb_t u8g_dev_st7920_128x64_rrd_pb = {{PAGE_HEIGHT, LCD_PIXEL_HEIGHT, 0, 0, 0}, LCD_PIXEL_WIDTH, u8g_dev_st7920_128x64_rrd_buf}; u8g_dev_t u8g_dev_st7920_128x64_rrd_sw_spi = {u8g_dev_rrd_st7920_128x64_fn, &u8g_dev_st7920_128x64_rrd_pb, &u8g_com_null_fn}; -#if ENABLED(LIGHTWEIGHT_UI) - // We have to include the code for the lightweight UI here - // as it relies on macros that are only defined in this file. - #include "status_screen_lite_ST7920_spi.h" -#endif - #pragma GCC reset_options -#endif // U8G_HAL_LINKS - -#endif // U8GLIB_ST7920 +#endif // U8GLIB_ST7920 && !U8G_HAL_LINKS && !__SAM3X8E__ diff --git a/Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.h b/Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.h new file mode 100644 index 0000000000..4e601b6179 --- /dev/null +++ b/Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.h @@ -0,0 +1,97 @@ +/** + * 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 . + * + */ + +// NOTE - the HAL version of the rrd device uses a generic ST7920 device. See the +// file u8g_dev_st7920_128x64_HAL.cpp for the HAL version. + +#include "../../inc/MarlinConfig.h" + +#if ENABLED(U8GLIB_ST7920) && !defined(U8G_HAL_LINKS) && !defined(__SAM3X8E__) + +#include "../../HAL/shared/Delay.h" + +#define ST7920_CLK_PIN LCD_PINS_D4 +#define ST7920_DAT_PIN LCD_PINS_ENABLE +#define ST7920_CS_PIN LCD_PINS_RS + +//#define PAGE_HEIGHT 8 //128 byte framebuffer +#define PAGE_HEIGHT 16 //256 byte framebuffer +//#define PAGE_HEIGHT 32 //512 byte framebuffer + +#define LCD_PIXEL_WIDTH 128 +#define LCD_PIXEL_HEIGHT 64 + +#include + +// If you want you can define your own set of delays in Configuration.h +//#define ST7920_DELAY_1 DELAY_NS(0) +//#define ST7920_DELAY_2 DELAY_NS(0) +//#define ST7920_DELAY_3 DELAY_NS(0) + +#if F_CPU >= 20000000 + #define CPU_ST7920_DELAY_1 DELAY_NS(0) + #define CPU_ST7920_DELAY_2 DELAY_NS(0) + #define CPU_ST7920_DELAY_3 DELAY_NS(50) +#elif MB(3DRAG) || MB(K8200) || MB(K8400) || MB(SILVER_GATE) + #define CPU_ST7920_DELAY_1 DELAY_NS(0) + #define CPU_ST7920_DELAY_2 DELAY_NS(188) + #define CPU_ST7920_DELAY_3 DELAY_NS(0) +#elif MB(MINIRAMBO) || MB(EINSY_RAMBO) || MB(EINSY_RETRO) + #define CPU_ST7920_DELAY_1 DELAY_NS(0) + #define CPU_ST7920_DELAY_2 DELAY_NS(250) + #define CPU_ST7920_DELAY_3 DELAY_NS(0) +#elif MB(RAMBO) + #define CPU_ST7920_DELAY_1 DELAY_NS(0) + #define CPU_ST7920_DELAY_2 DELAY_NS(0) + #define CPU_ST7920_DELAY_3 DELAY_NS(0) +#elif MB(BQ_ZUM_MEGA_3D) + #define CPU_ST7920_DELAY_1 DELAY_NS(0) + #define CPU_ST7920_DELAY_2 DELAY_NS(0) + #define CPU_ST7920_DELAY_3 DELAY_NS(189) +#elif defined(ARDUINO_ARCH_STM32) + #define CPU_ST7920_DELAY_1 DELAY_NS(300) + #define CPU_ST7920_DELAY_2 DELAY_NS(40) + #define CPU_ST7920_DELAY_3 DELAY_NS(340) +#elif F_CPU == 16000000 + #define CPU_ST7920_DELAY_1 DELAY_NS(0) + #define CPU_ST7920_DELAY_2 DELAY_NS(0) + #define CPU_ST7920_DELAY_3 DELAY_NS(63) +#else + #error "No valid condition for delays in 'ultralcd_st7920_u8glib_rrd_AVR.h'" +#endif + +void ST7920_SWSPI_SND_8BIT(uint8_t val); + +#if DOGM_SPI_DELAY_US > 0 + #define U8G_DELAY() DELAY_US(DOGM_SPI_DELAY_US) +#else + #define U8G_DELAY() DELAY_US(10) +#endif + +#define ST7920_CS() { WRITE(ST7920_CS_PIN,1); U8G_DELAY(); } +#define ST7920_NCS() { WRITE(ST7920_CS_PIN,0); } +#define ST7920_SET_CMD() { ST7920_SWSPI_SND_8BIT(0xF8); U8G_DELAY(); } +#define ST7920_SET_DAT() { ST7920_SWSPI_SND_8BIT(0xFA); U8G_DELAY(); } +#define ST7920_WRITE_BYTE(a) { ST7920_SWSPI_SND_8BIT((uint8_t)((a)&0xF0u)); ST7920_SWSPI_SND_8BIT((uint8_t)((a)<<4u)); U8G_DELAY(); } +#define ST7920_WRITE_BYTES(p,l) { for (uint8_t i = l + 1; --i;) { ST7920_SWSPI_SND_8BIT(*p&0xF0); ST7920_SWSPI_SND_8BIT(*p<<4); p++; } U8G_DELAY(); } + +#endif // U8GLIB_ST7920 && !U8G_HAL_LINKS && !__SAM3X8E__ diff --git a/Marlin/src/lcd/extensible_ui/lib/example.cpp b/Marlin/src/lcd/extensible_ui/lib/example.cpp new file mode 100644 index 0000000000..51040cde04 --- /dev/null +++ b/Marlin/src/lcd/extensible_ui/lib/example.cpp @@ -0,0 +1,64 @@ +/************* + * dummy.cpp * + *************/ + +/**************************************************************************** + * Written By Marcio Teixeira 2018 - Aleph Objects, Inc. * + * * + * 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. * + * * + * To view a copy of the GNU General Public License, go to the following * + * location: . * + ****************************************************************************/ + +#include "../../../inc/MarlinConfigPre.h" + +#if ENABLED(EXTENSIBLE_UI) + +#include "../ui_api.h" + +// To implement a new UI, complete the functions below and +// read or update Marlin's state using the methods in the +// ExtUI methods in "../ui_api.h" +// +// Although it may be possible to access other state +// variables from Marlin, using the API here possibly +// helps ensure future compatibility. + +namespace ExtUI { + void onStartup() { + /* Initialize the display module here. The following + * routines are available for access to the GPIO pins: + * + * SET_OUTPUT(pin) + * SET_INPUT_PULLUP(pin) + * SET_INPUT(pin) + * WRITE(pin,value) + * READ(pin) + */ + } + void onIdle() {} + void onPrinterKilled(const char* msg) {} + void onMediaInserted() {}; + void onMediaError() {}; + void onMediaRemoved() {}; + void onPlayTone(const uint16_t frequency, const uint16_t duration) {} + void onPrintTimerStarted() {} + void onPrintTimerPaused() {} + void onPrintTimerStopped() {} + void onFilamentRunout() {} + void onStatusChanged(const char * const msg) {} + void onFactoryReset() {} + void onLoadSettings() {} + void onStoreSettings() {} +} + +#endif // EXTENSIBLE_UI diff --git a/Marlin/src/lcd/extensible_ui/ui_api.cpp b/Marlin/src/lcd/extensible_ui/ui_api.cpp new file mode 100644 index 0000000000..a9dabaa0ac --- /dev/null +++ b/Marlin/src/lcd/extensible_ui/ui_api.cpp @@ -0,0 +1,725 @@ +/** + * 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 . + * + */ + +/************** + * ui_api.cpp * + **************/ + +/**************************************************************************** + * Written By Marcio Teixeira 2018 - Aleph Objects, Inc. * + * * + * 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. * + * * + * To view a copy of the GNU General Public License, go to the following * + * location: . * + ****************************************************************************/ + +#include "../../inc/MarlinConfigPre.h" + +#if ENABLED(EXTENSIBLE_UI) + +#include "../ultralcd.h" +#include "../../gcode/queue.h" +#include "../../module/motion.h" +#include "../../module/planner.h" +#include "../../module/probe.h" +#include "../../module/temperature.h" +#include "../../libs/duration_t.h" +#include "../../HAL/shared/Delay.h" + +#if DO_SWITCH_EXTRUDER || ENABLED(SWITCHING_NOZZLE) || ENABLED(PARKING_EXTRUDER) + #include "../../module/tool_change.h" +#endif + +#if ENABLED(SDSUPPORT) + #include "../../sd/cardreader.h" + #include "../../feature/emergency_parser.h" + #define IFSD(A,B) (A) +#else + #define IFSD(A,B) (B) +#endif + +#if ENABLED(PRINTCOUNTER) + #include "../../core/utility.h" + #include "../../module/printcounter.h" +#endif + +#include "ui_api.h" + +#if ENABLED(BACKLASH_GCODE) + extern float backlash_distance_mm[XYZ], backlash_correction; + #ifdef BACKLASH_SMOOTHING_MM + extern float backlash_smoothing_mm; + #endif +#endif + +#if ENABLED(FILAMENT_RUNOUT_SENSOR) + #include "../../feature/runout.h" +#endif + +inline float clamp(const float value, const float minimum, const float maximum) { + return MAX(MIN(value, maximum), minimum); +} + +static struct { + uint8_t printer_killed : 1; + uint8_t manual_motion : 1; +} flags; + +namespace ExtUI { + + #ifdef __SAM3X8E__ + /** + * Implement a special millis() to allow time measurement + * within an ISR (such as when the printer is killed). + * + * To keep proper time, must be called at least every 1s. + */ + uint32_t safe_millis() { + // Not killed? Just call millis() + if (!flags.printer_killed) return millis(); + + static uint32_t currTimeHI = 0; /* Current time */ + + // Machine was killed, reinit SysTick so we are able to compute time without ISRs + if (currTimeHI == 0) { + // Get the last time the Arduino time computed (from CMSIS) and convert it to SysTick + currTimeHI = (uint32_t)((GetTickCount() * (uint64_t)(F_CPU / 8000)) >> 24); + + // Reinit the SysTick timer to maximize its period + SysTick->LOAD = SysTick_LOAD_RELOAD_Msk; // get the full range for the systick timer + SysTick->VAL = 0; // Load the SysTick Counter Value + SysTick->CTRL = // MCLK/8 as source + // No interrupts + SysTick_CTRL_ENABLE_Msk; // Enable SysTick Timer + } + + // Check if there was a timer overflow from the last read + if (SysTick->CTRL & SysTick_CTRL_COUNTFLAG_Msk) { + // There was. This means (SysTick_LOAD_RELOAD_Msk * 1000 * 8)/F_CPU ms has elapsed + currTimeHI++; + } + + // Calculate current time in milliseconds + uint32_t currTimeLO = SysTick_LOAD_RELOAD_Msk - SysTick->VAL; // (in MCLK/8) + uint64_t currTime = ((uint64_t)currTimeLO) | (((uint64_t)currTimeHI) << 24); + + // The ms count is + return (uint32_t)(currTime / (F_CPU / 8000)); + } + #endif // __SAM3X8E__ + + void delay_us(unsigned long us) { + DELAY_US(us); + } + + void delay_ms(unsigned long ms) { + if (flags.printer_killed) + DELAY_US(ms * 1000); + else + safe_delay(ms); + } + + void yield() { + if (!flags.printer_killed) + thermalManager.manage_heater(); + } + + float getActualTemp_celsius(const heater_t heater) { + return heater == BED ? + #if HAS_HEATED_BED + thermalManager.degBed() + #else + 0 + #endif + : thermalManager.degHotend(heater - H0); + } + + float getActualTemp_celsius(const extruder_t extruder) { + return thermalManager.degHotend(extruder - E0); + } + + float getTargetTemp_celsius(const heater_t heater) { + return heater == BED ? + #if HAS_HEATED_BED + thermalManager.degTargetBed() + #else + 0 + #endif + : thermalManager.degTargetHotend(heater - H0); + } + + float getTargetTemp_celsius(const extruder_t extruder) { + return thermalManager.degTargetHotend(extruder - E0); + } + + float getFan_percent(const fan_t fan) { return ((float(fan_speed[fan - FAN0]) + 1) * 100) / 256; } + + float getAxisPosition_mm(const axis_t axis) { + return flags.manual_motion ? destination[axis] : current_position[axis]; + } + + float getAxisPosition_mm(const extruder_t extruder) { + return flags.manual_motion ? destination[E_AXIS] : current_position[E_AXIS]; + } + + void setAxisPosition_mm(const float position, const axis_t axis) { + // Start with no limits to movement + float min = current_position[axis] - 1000, + max = current_position[axis] + 1000; + + // Limit to software endstops, if enabled + #if HAS_SOFTWARE_ENDSTOPS + if (soft_endstops_enabled) switch (axis) { + case X_AXIS: + #if ENABLED(MIN_SOFTWARE_ENDSTOP_X) + min = soft_endstop_min[X_AXIS]; + #endif + #if ENABLED(MAX_SOFTWARE_ENDSTOP_X) + max = soft_endstop_max[X_AXIS]; + #endif + break; + case Y_AXIS: + #if ENABLED(MIN_SOFTWARE_ENDSTOP_Y) + min = soft_endstop_min[Y_AXIS]; + #endif + #if ENABLED(MAX_SOFTWARE_ENDSTOP_Y) + max = soft_endstop_max[Y_AXIS]; + #endif + break; + case Z_AXIS: + #if ENABLED(MIN_SOFTWARE_ENDSTOP_Z) + min = soft_endstop_min[Z_AXIS]; + #endif + #if ENABLED(MAX_SOFTWARE_ENDSTOP_Z) + max = soft_endstop_max[Z_AXIS]; + #endif + default: break; + } + #endif // HAS_SOFTWARE_ENDSTOPS + + // Delta limits XY based on the current offset from center + // This assumes the center is 0,0 + #if ENABLED(DELTA) + if (axis != Z_AXIS) { + max = SQRT(sq((float)(DELTA_PRINTABLE_RADIUS)) - sq(current_position[Y_AXIS - axis])); // (Y_AXIS - axis) == the other axis + min = -max; + } + #endif + + if (!flags.manual_motion) + set_destination_from_current(); + destination[axis] = clamp(position, min, max); + flags.manual_motion = true; + } + + void setAxisPosition_mm(const float position, const extruder_t extruder) { + setActiveTool(extruder, true); + + if (!flags.manual_motion) + set_destination_from_current(); + destination[E_AXIS] = position; + flags.manual_motion = true; + } + + void _processManualMoveToDestination() { + // Lower max_response_lag makes controls more responsive, but makes CPU work harder + constexpr float max_response_lag = 0.1; // seconds + constexpr uint8_t segments_to_buffer = 4; // keep planner filled with this many segments + + if (flags.manual_motion && planner.movesplanned() < segments_to_buffer) { + float saved_destination[XYZ]; + COPY(saved_destination, destination); + // Compute direction vector from current_position towards destination. + destination[X_AXIS] -= current_position[X_AXIS]; + destination[Y_AXIS] -= current_position[Y_AXIS]; + destination[Z_AXIS] -= current_position[Z_AXIS]; + const float inv_length = RSQRT(sq(destination[X_AXIS]) + sq(destination[Y_AXIS]) + sq(destination[Z_AXIS])); + // Find move segment length so that all segments can execute in less time than max_response_lag + const float scale = inv_length * feedrate_mm_s * max_response_lag / segments_to_buffer; + if (scale < 1) { + // Move a small bit towards the destination. + destination[X_AXIS] = scale * destination[X_AXIS] + current_position[X_AXIS]; + destination[Y_AXIS] = scale * destination[Y_AXIS] + current_position[Y_AXIS]; + destination[Z_AXIS] = scale * destination[Z_AXIS] + current_position[Z_AXIS]; + prepare_move_to_destination(); + COPY(destination, saved_destination); + } + else { + // We are close enough to finish off the move. + COPY(destination, saved_destination); + prepare_move_to_destination(); + flags.manual_motion = false; + } + } + } + + void setActiveTool(const extruder_t extruder, bool no_move) { + #if EXTRUDERS > 1 + const uint8_t e = extruder - E0; + #if DO_SWITCH_EXTRUDER || ENABLED(SWITCHING_NOZZLE) || ENABLED(PARKING_EXTRUDER) + if (e != active_extruder) + tool_change(e, 0, no_move); + #endif + active_extruder = e; + #endif + } + + extruder_t getActiveTool() { + switch (active_extruder) { + case 5: return E5; + case 4: return E4; + case 3: return E3; + case 2: return E2; + case 1: return E1; + default: return E0; + } + } + + bool isMoving() { return planner.has_blocks_queued(); } + + bool canMove(const axis_t axis) { + switch (axis) { + #if IS_KINEMATIC || ENABLED(NO_MOTION_BEFORE_HOMING) + case X: return TEST(axis_homed, X_AXIS); + case Y: return TEST(axis_homed, Y_AXIS); + case Z: return TEST(axis_homed, Z_AXIS); + #else + case X: case Y: case Z: return true; + #endif + default: return false; + } + } + + bool canMove(const extruder_t extruder) { + return !thermalManager.tooColdToExtrude(extruder - E0); + } + + float getAxisSteps_per_mm(const axis_t axis) { + return planner.settings.axis_steps_per_mm[axis]; + } + + float getAxisSteps_per_mm(const extruder_t extruder) { + return planner.settings.axis_steps_per_mm[E_AXIS_N(extruder - E0)]; + } + + void setAxisSteps_per_mm(const float value, const axis_t axis) { + planner.settings.axis_steps_per_mm[axis] = value; + } + + void setAxisSteps_per_mm(const float value, const extruder_t extruder) { + planner.settings.axis_steps_per_mm[E_AXIS_N(axis - E0)] = value; + } + + float getAxisMaxFeedrate_mm_s(const axis_t axis) { + return planner.settings.max_feedrate_mm_s[axis]; + } + + float getAxisMaxFeedrate_mm_s(const extruder_t extruder) { + return planner.settings.max_feedrate_mm_s[E_AXIS_N(axis - E0)]; + } + + void setAxisMaxFeedrate_mm_s(const float value, const axis_t axis) { + planner.settings.max_feedrate_mm_s[axis] = value; + } + + void setAxisMaxFeedrate_mm_s(const float value, const extruder_t extruder) { + planner.settings.max_feedrate_mm_s[E_AXIS_N(axis - E0)] = value; + } + + float getAxisMaxAcceleration_mm_s2(const axis_t axis) { + return planner.settings.max_acceleration_mm_per_s2[axis]; + } + + float getAxisMaxAcceleration_mm_s2(const extruder_t extruder) { + return planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(extruder - E0)]; + } + + void setAxisMaxAcceleration_mm_s2(const float value, const axis_t axis) { + planner.settings.max_acceleration_mm_per_s2[axis] = value; + } + + void setAxisMaxAcceleration_mm_s2(const float value, const extruder_t extruder) { + planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(extruder - E0)] = value; + } + + #if ENABLED(FILAMENT_RUNOUT_SENSOR) + bool getFilamentRunoutEnabled() { return runout.enabled; } + void setFilamentRunoutEnabled(const bool value) { runout.enabled = value; } + + #if FILAMENT_RUNOUT_DISTANCE_MM > 0 + float getFilamentRunoutDistance_mm() { + return RunoutResponseDelayed::runout_distance_mm; + } + + void setFilamentRunoutDistance_mm(const float value) { + RunoutResponseDelayed::runout_distance_mm = clamp(value, 0, 999); + } + #endif + #endif + + #if ENABLED(LIN_ADVANCE) + float getLinearAdvance_mm_mm_s(const extruder_t extruder) { + return (extruder < EXTRUDERS) ? planner.extruder_advance_K[extruder - E0] : 0; + } + + void setLinearAdvance_mm_mm_s(const float value, const extruder_t extruder) { + if (extruder < EXTRUDERS) + planner.extruder_advance_K[extruder - E0] = clamp(value, 0, 999); + } + #endif + + #if ENABLED(JUNCTION_DEVIATION) + + float getJunctionDeviation_mm() { + return planner.junction_deviation_mm; + } + + void setJunctionDeviation_mm(const float value) { + planner.junction_deviation_mm = clamp(value, 0.01, 0.3); + planner.recalculate_max_e_jerk(); + } + + #else + + float getAxisMaxJerk_mm_s(const axis_t axis) { + return planner.max_jerk[axis]; + } + + float getAxisMaxJerk_mm_s(const extruder_t extruder) { + return planner.max_jerk[E_AXIS]; + } + + void setAxisMaxJerk_mm_s(const float value, const axis_t axis) { + planner.max_jerk[axis] = value; + } + + void setAxisMaxJerk_mm_s(const float value, const extruder_t extruder) { + planner.max_jerk[E_AXIS] = value; + } + #endif + + float getFeedrate_mm_s() { return feedrate_mm_s; } + float getMinFeedrate_mm_s() { return planner.settings.min_feedrate_mm_s; } + float getMinTravelFeedrate_mm_s() { return planner.settings.min_travel_feedrate_mm_s; } + float getPrintingAcceleration_mm_s2() { return planner.settings.acceleration; } + float getRetractAcceleration_mm_s2() { return planner.settings.retract_acceleration; } + float getTravelAcceleration_mm_s2() { return planner.settings.travel_acceleration; } + void setFeedrate_mm_s(const float fr) { feedrate_mm_s = fr; } + void setMinFeedrate_mm_s(const float fr) { planner.settings.min_feedrate_mm_s = fr; } + void setMinTravelFeedrate_mm_s(const float fr) { planner.settings.min_travel_feedrate_mm_s = fr; } + void setPrintingAcceleration_mm_s2(const float acc) { planner.settings.acceleration = acc; } + void setRetractAcceleration_mm_s2(const float acc) { planner.settings.retract_acceleration = acc; } + void setTravelAcceleration_mm_s2(const float acc) { planner.settings.travel_acceleration = acc; } + + #if ENABLED(BABYSTEP_ZPROBE_OFFSET) + float getZOffset_mm() { + #if ENABLED(BABYSTEP_HOTEND_Z_OFFSET) + if (active_extruder != 0) + return hotend_offset[Z_AXIS][active_extruder]; + else + #endif + return zprobe_zoffset; + } + + void setZOffset_mm(const float value) { + const float diff = (value - getZOffset_mm()) / planner.steps_to_mm[Z_AXIS]; + addZOffset_steps(diff > 0 ? ceil(diff) : floor(diff)); + } + + void addZOffset_steps(int16_t babystep_increment) { + #if ENABLED(BABYSTEP_HOTEND_Z_OFFSET) + const bool do_probe = (active_extruder == 0); + #else + constexpr bool do_probe = true; + #endif + const float diff = planner.steps_to_mm[Z_AXIS] * babystep_increment, + new_probe_offset = zprobe_zoffset + diff, + new_offs = + #if ENABLED(BABYSTEP_HOTEND_Z_OFFSET) + do_probe ? new_probe_offset : hotend_offset[Z_AXIS][active_extruder] - diff + #else + new_probe_offset + #endif + ; + if (WITHIN(new_offs, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) { + + thermalManager.babystep_axis(Z_AXIS, babystep_increment); + + if (do_probe) zprobe_zoffset = new_offs; + #if ENABLED(BABYSTEP_HOTEND_Z_OFFSET) + else hotend_offset[Z_AXIS][active_extruder] = new_offs; + #endif + } + } + #endif // ENABLED(BABYSTEP_ZPROBE_OFFSET) + + #if HOTENDS > 1 + float getNozzleOffset_mm(const axis_t axis, const extruder_t extruder) { + if (extruder - E0 >= HOTENDS) return 0; + return hotend_offset[axis][extruder - E0]; + } + + void setNozzleOffset_mm(const float value, const axis_t axis, const extruder_t extruder) { + if (extruder - E0 >= HOTENDS) return; + hotend_offset[axis][extruder - E0] = value; + } + #endif + + #if ENABLED(BACKLASH_GCODE) + float getAxisBacklash_mm(const axis_t axis) { return backlash_distance_mm[axis]; } + void setAxisBacklash_mm(const float value, const axis_t axis) + { backlash_distance_mm[axis] = clamp(value,0,5); } + + float getBacklashCorrection_percent() { return backlash_correction * 100; } + void setBacklashCorrection_percent(const float value) { backlash_correction = clamp(value, 0, 100) / 100.0f; } + + #ifdef BACKLASH_SMOOTHING_MM + float getBacklashSmoothing_mm() { return backlash_smoothing_mm; } + void setBacklashSmoothing_mm(const float value) { backlash_smoothing_mm = clamp(value, 0, 999); } + #endif + #endif + + uint8_t getProgress_percent() { + return IFSD(card.percentDone(), 0); + } + + uint32_t getProgress_seconds_elapsed() { + const duration_t elapsed = print_job_timer.duration(); + return elapsed.value; + } + + #if ENABLED(PRINTCOUNTER) + char* getTotalPrints_str(char buffer[21]) { strcpy(buffer,itostr3left(print_job_timer.getStats().totalPrints)); return buffer; } + char* getFinishedPrints_str(char buffer[21]) { strcpy(buffer,itostr3left(print_job_timer.getStats().finishedPrints)); return buffer; } + char* getTotalPrintTime_str(char buffer[21]) { duration_t(print_job_timer.getStats().printTime).toString(buffer); return buffer; } + char* getLongestPrint_str(char buffer[21]) { duration_t(print_job_timer.getStats().printTime).toString(buffer); return buffer; } + char* getFilamentUsed_str(char buffer[21]) { + printStatistics stats = print_job_timer.getStats(); + sprintf_P(buffer, PSTR("%ld.%im"), long(stats.filamentUsed / 1000), int16_t(stats.filamentUsed / 100) % 10); + return buffer; + } + #endif + + float getFeedrate_percent() { return feedrate_percentage; } + + void enqueueCommands_P(PGM_P const gcode) { + enqueue_and_echo_commands_P(gcode); + } + + bool isAxisPositionKnown(const axis_t axis) { + return TEST(axis_known_position, axis); + } + + PGM_P getFirmwareName_str() { + static const char firmware_name[] PROGMEM = "Marlin " SHORT_BUILD_VERSION; + return firmware_name; + } + + void setTargetTemp_celsius(float value, const heater_t heater) { + #if HAS_HEATED_BED + if (heater == BED) + thermalManager.setTargetBed(clamp(value,0,200)); + else + #endif + thermalManager.setTargetHotend(clamp(value,0,500), heater - H0); + } + + void setTargetTemp_celsius(float value, const extruder_t extruder) { + thermalManager.setTargetHotend(clamp(value,0,500), extruder - E0); + } + + void setFan_percent(float value, const fan_t fan) { + if (fan < FAN_COUNT) + fan_speed[fan - FAN0] = clamp(round(value * 255 / 100), 0, 255); + } + + void setFeedrate_percent(const float value) { + feedrate_percentage = clamp(value, 10, 500); + } + + void printFile(const char *filename) { + IFSD(card.openAndPrintFile(filename), NOOP); + } + + bool isPrintingFromMediaPaused() { + return IFSD(isPrintingFromMedia() && !IS_SD_PRINTING(), false); + } + + bool isPrintingFromMedia() { + return IFSD(card.flag.cardOK && card.isFileOpen(), false); + } + + bool isPrinting() { + return (planner.movesplanned() || isPrintingFromMedia() || IFSD(IS_SD_PRINTING(), false)); + } + + bool isMediaInserted() { + return IFSD(IS_SD_INSERTED() && card.flag.cardOK, false); + } + + void pausePrint() { + #if ENABLED(SDSUPPORT) + card.pauseSDPrint(); + print_job_timer.pause(); + #if ENABLED(PARK_HEAD_ON_PAUSE) + enqueue_and_echo_commands_P(PSTR("M125")); + #endif + ui.set_status_P(PSTR(MSG_PRINT_PAUSED)); + #endif + } + + void resumePrint() { + #if ENABLED(SDSUPPORT) + ui.set_status_P(PSTR(MSG_FILAMENT_CHANGE_RESUME_1)); + #if ENABLED(PARK_HEAD_ON_PAUSE) + wait_for_heatup = wait_for_user = false; + enqueue_and_echo_commands_P(PSTR("M24")); + #else + card.startFileprint(); + print_job_timer.start(); + #endif + #endif + } + + void stopPrint() { + #if ENABLED(SDSUPPORT) + wait_for_heatup = wait_for_user = false; + card.flag.abort_sd_printing = true; + ui.set_status_P(PSTR(MSG_PRINT_ABORTED)); + #endif + } + + FileList::FileList() { refresh(); } + + void FileList::refresh() { num_files = 0xFFFF; } + + bool FileList::seek(const uint16_t pos, const bool skip_range_check) { + #if ENABLED(SDSUPPORT) + if (!skip_range_check && pos > (count() - 1)) return false; + const uint16_t nr = + #if ENABLED(SDCARD_RATHERRECENTFIRST) && DISABLED(SDCARD_SORT_ALPHA) + count() - 1 - + #endif + pos; + + card.getfilename_sorted(nr); + return card.filename && card.filename[0] != '\0'; + #else + return false; + #endif + } + + const char* FileList::filename() { + return IFSD(card.longFilename && card.longFilename[0] ? card.longFilename : card.filename, ""); + } + + const char* FileList::shortFilename() { + return IFSD(card.filename, ""); + } + + const char* FileList::longFilename() { + return IFSD(card.longFilename, ""); + } + + bool FileList::isDir() { + return IFSD(card.flag.filenameIsDir, false); + } + + uint16_t FileList::count() { + return IFSD((num_files = (num_files == 0xFFFF ? card.get_num_Files() : num_files)), 0); + } + + bool FileList::isAtRootDir() { + #if ENABLED(SDSUPPORT) + card.getWorkDirName(); + return card.filename[0] == '/'; + #else + return true; + #endif + } + + void FileList::upDir() { + #if ENABLED(SDSUPPORT) + card.updir(); + num_files = 0xFFFF; + #endif + } + + void FileList::changeDir(const char * const dirname) { + #if ENABLED(SDSUPPORT) + card.chdir(dirname); + num_files = 0xFFFF; + #endif + } + +} // namespace ExtUI + +// At the moment, we piggy-back off the ultralcd calls, but this could be cleaned up in the future + +void MarlinUI::init() { + #if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT) + SET_INPUT_PULLUP(SD_DETECT_PIN); + #endif + ExtUI::onStartup(); +} + +void MarlinUI::update() { + #if ENABLED(SDSUPPORT) + static bool last_sd_status; + const bool sd_status = IS_SD_INSERTED(); + if (sd_status != last_sd_status) { + last_sd_status = sd_status; + if (sd_status) { + card.initsd(); + if (card.flag.cardOK) + ExtUI::onMediaInserted(); + else + ExtUI::onMediaError(); + } + else { + const bool ok = card.flag.cardOK; + card.release(); + if (ok) ExtUI::onMediaRemoved(); + } + } + #endif // SDSUPPORT + ExtUI::_processManualMoveToDestination(); + ExtUI::onIdle(); +} + +void MarlinUI::kill_screen(PGM_P const msg) { + if (!flags.printer_killed) { + flags.printer_killed = true; + ExtUI::onPrinterKilled(msg); + } +} + +#endif // EXTENSIBLE_UI diff --git a/Marlin/src/lcd/extensible_ui/ui_api.h b/Marlin/src/lcd/extensible_ui/ui_api.h new file mode 100644 index 0000000000..1a86680a1f --- /dev/null +++ b/Marlin/src/lcd/extensible_ui/ui_api.h @@ -0,0 +1,266 @@ +/** + * 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 . + * + */ + +/************ + * ui_api.h * + ************/ + +/**************************************************************************** + * Written By Marcio Teixeira 2018 - Aleph Objects, Inc. * + * * + * 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. * + * * + * To view a copy of the GNU General Public License, go to the following * + * location: . * + ****************************************************************************/ + +#pragma once + +#include "../../inc/MarlinConfig.h" + +namespace ExtUI { + + enum axis_t : uint8_t { X, Y, Z }; + enum extruder_t : uint8_t { E0, E1, E2, E3, E4, E5 }; + enum heater_t : uint8_t { H0, H1, H2, H3, H4, H5, BED }; + enum fan_t : uint8_t { FAN0, FAN1, FAN2, FAN3, FAN4, FAN5 }; + + constexpr uint8_t extruderCount = EXTRUDERS; + constexpr uint8_t hotendCount = HOTENDS; + constexpr uint8_t fanCount = FAN_COUNT; + + bool isMoving(); + bool isAxisPositionKnown(const axis_t); + bool canMove(const axis_t); + bool canMove(const extruder_t); + void enqueueCommands_P(PGM_P const); + + /** + * Getters and setters + * Should be used by the EXTENSIBLE_UI to query or change Marlin's state. + */ + PGM_P getFirmwareName_str(); + + float getActualTemp_celsius(const heater_t); + float getActualTemp_celsius(const extruder_t); + float getTargetTemp_celsius(const heater_t); + float getTargetTemp_celsius(const extruder_t); + float getFan_percent(const fan_t); + float getAxisPosition_mm(const axis_t); + float getAxisPosition_mm(const extruder_t); + float getAxisSteps_per_mm(const axis_t); + float getAxisSteps_per_mm(const extruder_t); + float getAxisMaxFeedrate_mm_s(const axis_t); + float getAxisMaxFeedrate_mm_s(const extruder_t); + float getAxisMaxAcceleration_mm_s2(const axis_t); + float getAxisMaxAcceleration_mm_s2(const extruder_t); + float getMinFeedrate_mm_s(); + float getMinTravelFeedrate_mm_s(); + float getPrintingAcceleration_mm_s2(); + float getRetractAcceleration_mm_s2(); + float getTravelAcceleration_mm_s2(); + float getFeedrate_percent(); + uint8_t getProgress_percent(); + uint32_t getProgress_seconds_elapsed(); + + #if ENABLED(PRINTCOUNTER) + char* getTotalPrints_str(char buffer[21]); + char* getFinishedPrints_str(char buffer[21]); + char* getTotalPrintTime_str(char buffer[21]); + char* getLongestPrint_str(char buffer[21]); + char* getFilamentUsed_str(char buffer[21]); + #endif + + void setTargetTemp_celsius(const float, const heater_t); + void setTargetTemp_celsius(const float, const extruder_t); + void setFan_percent(const float, const fan_t); + void setAxisPosition_mm(const float, const axis_t); + void setAxisPosition_mm(const float, const extruder_t); + void setAxisSteps_per_mm(const float, const axis_t); + void setAxisSteps_per_mm(const float, const extruder_t); + void setAxisMaxFeedrate_mm_s(const float, const axis_t); + void setAxisMaxFeedrate_mm_s(const float, const extruder_t); + void setAxisMaxAcceleration_mm_s2(const float, const axis_t); + void setAxisMaxAcceleration_mm_s2(const float, const extruder_t); + void setFeedrate_mm_s(const float); + void setMinFeedrate_mm_s(const float); + void setMinTravelFeedrate_mm_s(const float); + void setPrintingAcceleration_mm_s2(const float); + void setRetractAcceleration_mm_s2(const float); + void setTravelAcceleration_mm_s2(const float); + void setFeedrate_percent(const float); + + #if ENABLED(LIN_ADVANCE) + float getLinearAdvance_mm_mm_s(const extruder_t); + void setLinearAdvance_mm_mm_s(const float, const extruder_t); + #endif + + #if ENABLED(JUNCTION_DEVIATION) + float getJunctionDeviation_mm(); + void setJunctionDeviation_mm(const float); + #else + float getAxisMaxJerk_mm_s(const axis_t); + float getAxisMaxJerk_mm_s(const extruder_t); + void setAxisMaxJerk_mm_s(const float, const axis_t); + void setAxisMaxJerk_mm_s(const float, const extruder_t); + #endif + + extruder_t getActiveTool(); + void setActiveTool(const extruder_t, bool no_move); + + + #if HOTENDS > 1 + float getNozzleOffset_mm(const axis_t, const extruder_t); + void setNozzleOffset_mm(const float, const axis_t, const extruder_t); + #endif + + #if ENABLED(BABYSTEP_ZPROBE_OFFSET) + float getZOffset_mm(); + void setZOffset_mm(const float); + void addZOffset_steps(const int16_t); + #endif + + #if ENABLED(BACKLASH_GCODE) + float getAxisBacklash_mm(const axis_t); + void setAxisBacklash_mm(const float, const axis_t); + + float getBacklashCorrection_percent(); + void setBacklashCorrection_percent(const float); + + #ifdef BACKLASH_SMOOTHING_MM + float getBacklashSmoothing_mm(); + void setBacklashSmoothing_mm(const float); + #endif + #endif + + #if ENABLED(FILAMENT_RUNOUT_SENSOR) + bool getFilamentRunoutEnabled(); + void setFilamentRunoutEnabled(const bool); + + #if FILAMENT_RUNOUT_DISTANCE_MM > 0 + float getFilamentRunoutDistance_mm(); + void setFilamentRunoutDistance_mm(const float); + #endif + #endif + + /** + * Delay and timing routines + * Should be used by the EXTENSIBLE_UI to safely pause or measure time + * safe_millis must be called at least every 1 sec to guarantee time + * yield should be called within lengthy loops + */ + #ifdef __SAM3X8E__ + uint32_t safe_millis(); + #else + FORCE_INLINE uint32_t safe_millis() { return millis(); } // TODO: Implement for AVR + #endif + + void delay_us(unsigned long us); + void delay_ms(unsigned long ms); + void yield(); + + /** + * Media access routines + * + * Should be used by the EXTENSIBLE_UI to operate on files + */ + bool isMediaInserted(); + bool isPrintingFromMediaPaused(); + bool isPrintingFromMedia(); + bool isPrinting(); + + void printFile(const char *filename); + void stopPrint(); + void pausePrint(); + void resumePrint(); + + class FileList { + private: + uint16_t num_files; + + public: + FileList(); + void refresh(); + bool seek(const uint16_t, const bool skip_range_check = false); + + const char *longFilename(); + const char *shortFilename(); + const char *filename(); + bool isDir(); + + void changeDir(const char * const dirname); + void upDir(); + bool isAtRootDir(); + uint16_t count(); + }; + + /** + * Event callback routines + * + * Should be declared by EXTENSIBLE_UI and will be called by Marlin + */ + void onStartup(); + void onIdle(); + void onMediaInserted(); + void onMediaError(); + void onMediaRemoved(); + void onPlayTone(const uint16_t frequency, const uint16_t duration); + void onPrinterKilled(const char* msg); + void onPrintTimerStarted(); + void onPrintTimerPaused(); + void onPrintTimerStopped(); + void onFilamentRunout(); + void onStatusChanged(const char * const msg); + void onFactoryReset(); + void onStoreSettings(); + void onLoadSettings(); +}; + +/** + * Helper macros to increment or decrement a value. For example: + * + * UI_INCREMENT_BY(TargetTemp_celsius, 10, E0) + * + * Expands to: + * + * setTargetTemp_celsius(getTargetTemp_celsius(E0) + 10, E0); + * + * Or, in the case where a constant increment is desired: + * + * constexpr float increment = 10; + * + * UI_INCREMENT(TargetTemp_celsius, E0) + * + */ +#define UI_INCREMENT_BY(method, inc, ...) ExtUI::set ## method(ExtUI::get ## method (__VA_ARGS__) + inc, ##__VA_ARGS__) +#define UI_DECREMENT_BY(method, inc, ...) ExtUI::set ## method(ExtUI::get ## method (__VA_ARGS__) - inc, ##__VA_ARGS__) + +#define UI_INCREMENT(method, ...) UI_INCREMENT_BY(method, increment, ##__VA_ARGS__) +#define UI_DECREMENT(method, ...) UI_DECREMENT_BY(method, increment, ##__VA_ARGS__) diff --git a/Marlin/src/lcd/fontutils.cpp b/Marlin/src/lcd/fontutils.cpp index 08afb2ed8a..5685e6e4c3 100644 --- a/Marlin/src/lcd/fontutils.cpp +++ b/Marlin/src/lcd/fontutils.cpp @@ -177,7 +177,6 @@ uint8_t utf8_strlen(const char *pstart) { return utf8_strlen_cb(pstart, read_byte_ram); } -uint8_t utf8_strlen_P(const char *pstart) { +uint8_t utf8_strlen_P(PGM_P pstart) { return utf8_strlen_cb(pstart, read_byte_rom); } - diff --git a/Marlin/src/lcd/fontutils.h b/Marlin/src/lcd/fontutils.h index b2eca477a3..183c8ed399 100644 --- a/Marlin/src/lcd/fontutils.h +++ b/Marlin/src/lcd/fontutils.h @@ -6,8 +6,7 @@ * @date 2016-08-19 * @copyright GPL/BSD */ -#ifndef _FONT_UTILS_H -#define _FONT_UTILS_H +#pragma once #include #include @@ -44,6 +43,4 @@ uint8_t* get_utf8_value_cb(uint8_t *pstart, read_byte_cb_t cb_read_byte, wchar_t /* Returns lenght of string in CHARACTERS, NOT BYTES */ uint8_t utf8_strlen(const char *pstart); -uint8_t utf8_strlen_P(const char *pstart); - -#endif // _FONT_UTILS_H +uint8_t utf8_strlen_P(PGM_P pstart); diff --git a/Marlin/src/lcd/language/language_an.h b/Marlin/src/lcd/language/language_an.h index 41bd272510..849f30f9b9 100644 --- a/Marlin/src/lcd/language/language_an.h +++ b/Marlin/src/lcd/language/language_an.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Aragonese @@ -27,8 +28,6 @@ * See also http://marlinfw.org/docs/development/lcd_language.html * */ -#ifndef LANGUAGE_AN_H -#define LANGUAGE_AN_H #define DISPLAY_CHARSET_ISO10646_1 #define NOT_EXTENDED_ISO10646_1_5X7 @@ -52,12 +51,12 @@ #define MSG_SET_HOME_OFFSETS _UxGT("Achustar desfases") #define MSG_HOME_OFFSETS_APPLIED _UxGT("Desfase aplicau") #define MSG_SET_ORIGIN _UxGT("Establir orichen") -#define MSG_PREHEAT_1 _UxGT("Precalentar PLA") +#define MSG_PREHEAT_1 _UxGT("Precalentar " PREHEAT_1_LABEL) #define MSG_PREHEAT_1_N MSG_PREHEAT_1 _UxGT(" ") #define MSG_PREHEAT_1_ALL MSG_PREHEAT_1 _UxGT(" Tot") #define MSG_PREHEAT_1_BEDONLY MSG_PREHEAT_1 _UxGT(" Base") #define MSG_PREHEAT_1_SETTINGS MSG_PREHEAT_1 _UxGT(" Conf") -#define MSG_PREHEAT_2 _UxGT("Precalentar ABS") +#define MSG_PREHEAT_2 _UxGT("Precalentar " PREHEAT_2_LABEL) #define MSG_PREHEAT_2_N MSG_PREHEAT_2 _UxGT(" ") #define MSG_PREHEAT_2_ALL MSG_PREHEAT_2 _UxGT(" Tot") #define MSG_PREHEAT_2_BEDONLY MSG_PREHEAT_2 _UxGT(" Base") @@ -88,8 +87,8 @@ #define MSG_MAX _UxGT(" ") LCD_STR_THERMOMETER _UxGT(" Max") #define MSG_FACTOR _UxGT(" ") LCD_STR_THERMOMETER _UxGT(" Fact") #define MSG_AUTOTEMP _UxGT("Temperatura Auto.") -#define MSG_ON _UxGT("On") -#define MSG_OFF _UxGT("Off") +#define MSG_LCD_ON _UxGT("On") +#define MSG_LCD_OFF _UxGT("Off") #define MSG_PID_P _UxGT("PID-P") #define MSG_PID_I _UxGT("PID-I") #define MSG_PID_D _UxGT("PID-D") @@ -158,14 +157,14 @@ #define MSG_CONTROL_RETRACT _UxGT("Retraer mm") #define MSG_CONTROL_RETRACT_SWAP _UxGT("Swap Retraer mm") #define MSG_CONTROL_RETRACTF _UxGT("Retraer F") -#define MSG_CONTROL_RETRACT_ZLIFT _UxGT("Devantar mm") +#define MSG_CONTROL_RETRACT_ZHOP _UxGT("Devantar mm") #define MSG_CONTROL_RETRACT_RECOVER _UxGT("DesRet mm") #define MSG_CONTROL_RETRACT_RECOVER_SWAP _UxGT("Swap DesRet mm") #define MSG_CONTROL_RETRACT_RECOVERF _UxGT("DesRet F") #define MSG_AUTORETRACT _UxGT("Retraccion auto.") #define MSG_FILAMENTCHANGE _UxGT("Cambear filamento") #define MSG_INIT_SDCARD _UxGT("Encetan. tarcheta") -#define MSG_CNG_SDCARD _UxGT("Cambiar tarcheta") +#define MSG_CHANGE_SDCARD _UxGT("Cambiar tarcheta") #define MSG_ZPROBE_OUT _UxGT("Sonda Z fuera") #define MSG_BLTOUCH_SELFTEST _UxGT("BLTouch Auto-Test") #define MSG_BLTOUCH_RESET _UxGT("Reset BLTouch") @@ -256,5 +255,3 @@ #define MSG_FILAMENT_CHANGE_LOAD_2 _UxGT("cargar filamento") #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Aguardando impre.") #define MSG_FILAMENT_CHANGE_RESUME_2 _UxGT("pa continar") - -#endif // LANGUAGE_AN_H diff --git a/Marlin/src/lcd/language/language_bg.h b/Marlin/src/lcd/language/language_bg.h index 558a98e351..3409e770d5 100644 --- a/Marlin/src/lcd/language/language_bg.h +++ b/Marlin/src/lcd/language/language_bg.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Bulgarian @@ -27,9 +28,6 @@ * See also http://marlinfw.org/docs/development/lcd_language.html * */ -#ifndef LANGUAGE_BG_H -#define LANGUAGE_BG_H - #define DISPLAY_CHARSET_ISO10646_5 #define CHARSIZE 2 @@ -43,16 +41,16 @@ #define MSG_TMC_Z_CALIBRATION _UxGT("Калибровка Z") #define MSG_SET_HOME_OFFSETS _UxGT("Задай Начало") #define MSG_SET_ORIGIN _UxGT("Изходна точка") -#define MSG_PREHEAT_1 _UxGT("Подгряване PLA") -#define MSG_PREHEAT_1_N _UxGT("Подгряване PLA") -#define MSG_PREHEAT_1_ALL _UxGT("Подгр. PLA Всички") -#define MSG_PREHEAT_1_BEDONLY _UxGT("Подгр. PLA Легло") -#define MSG_PREHEAT_1_SETTINGS _UxGT("Настройки PLA") -#define MSG_PREHEAT_2 _UxGT("Подгряване ABS") -#define MSG_PREHEAT_2_N _UxGT("Подгряване ABS") -#define MSG_PREHEAT_2_ALL _UxGT("Подгр. ABS Всички") -#define MSG_PREHEAT_2_BEDONLY _UxGT("Подгр. ABS Легло") -#define MSG_PREHEAT_2_SETTINGS _UxGT("Настройки ABS") +#define MSG_PREHEAT_1 _UxGT("Подгряване " PREHEAT_1_LABEL) +#define MSG_PREHEAT_1_N _UxGT("Подгряване " PREHEAT_1_LABEL) +#define MSG_PREHEAT_1_ALL _UxGT("Подгр. " PREHEAT_1_LABEL " Всички") +#define MSG_PREHEAT_1_BEDONLY _UxGT("Подгр. " PREHEAT_1_LABEL " Легло") +#define MSG_PREHEAT_1_SETTINGS _UxGT("Настройки " PREHEAT_1_LABEL) +#define MSG_PREHEAT_2 _UxGT("Подгряване " PREHEAT_2_LABEL) +#define MSG_PREHEAT_2_N _UxGT("Подгряване " PREHEAT_2_LABEL) +#define MSG_PREHEAT_2_ALL _UxGT("Подгр. " PREHEAT_2_LABEL " Всички") +#define MSG_PREHEAT_2_BEDONLY _UxGT("Подгр. " PREHEAT_2_LABEL " Легло") +#define MSG_PREHEAT_2_SETTINGS _UxGT("Настройки " PREHEAT_2_LABEL) #define MSG_COOLDOWN _UxGT("Охлаждане") #define MSG_SWITCH_PS_ON _UxGT("Вкл. захранване") #define MSG_SWITCH_PS_OFF _UxGT("Изкл. захранване") @@ -79,8 +77,8 @@ #define MSG_MAX LCD_STR_THERMOMETER _UxGT(" Максимум") #define MSG_FACTOR LCD_STR_THERMOMETER _UxGT(" Фактор") #define MSG_AUTOTEMP _UxGT("Авто-темп.") -#define MSG_ON _UxGT("Вкл. ") -#define MSG_OFF _UxGT("Изкл. ") +#define MSG_LCD_ON _UxGT("Вкл.") +#define MSG_LCD_OFF _UxGT("Изкл.") #define MSG_A_RETRACT _UxGT("A-откат") #define MSG_A_TRAVEL _UxGT("A-travel") #define MSG_STEPS_PER_MM _UxGT("Стъпки/mm") @@ -127,14 +125,14 @@ #define MSG_CONTROL_RETRACT _UxGT("Откат mm") #define MSG_CONTROL_RETRACT_SWAP _UxGT("Смяна Откат mm") #define MSG_CONTROL_RETRACTF _UxGT("Откат V") -#define MSG_CONTROL_RETRACT_ZLIFT _UxGT("Скок mm") +#define MSG_CONTROL_RETRACT_ZHOP _UxGT("Скок mm") #define MSG_CONTROL_RETRACT_RECOVER _UxGT("Възврат mm") #define MSG_CONTROL_RETRACT_RECOVER_SWAP _UxGT("Смяна Възврат mm") #define MSG_CONTROL_RETRACT_RECOVERF _UxGT("Възврат V") #define MSG_AUTORETRACT _UxGT("Автоoткат") #define MSG_FILAMENTCHANGE _UxGT("Смяна нишка") #define MSG_INIT_SDCARD _UxGT("Иниц. SD-Карта") -#define MSG_CNG_SDCARD _UxGT("Смяна SD-Карта") +#define MSG_CHANGE_SDCARD _UxGT("Смяна SD-Карта") #define MSG_ZPROBE_OUT _UxGT("Z-сондата е извадена") #define MSG_ZPROBE_ZOFFSET _UxGT("Z Отстояние") #define MSG_BABYSTEP_X _UxGT("Министъпка X") @@ -146,5 +144,3 @@ #define MSG_DELTA_CALIBRATE_Y _UxGT("Калибровка Y") #define MSG_DELTA_CALIBRATE_Z _UxGT("Калибровка Z") #define MSG_DELTA_CALIBRATE_CENTER _UxGT("Калибровка Център") - -#endif // LANGUAGE_BG_H diff --git a/Marlin/src/lcd/language/language_ca.h b/Marlin/src/lcd/language/language_ca.h index d00fe3c768..c871bdee0a 100644 --- a/Marlin/src/lcd/language/language_ca.h +++ b/Marlin/src/lcd/language/language_ca.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Catalan @@ -27,8 +28,6 @@ * See also http://marlinfw.org/docs/development/lcd_language.html * */ -#ifndef LANGUAGE_CA_H -#define LANGUAGE_CA_H #define CHARSIZE 2 @@ -53,12 +52,12 @@ #define MSG_SET_HOME_OFFSETS _UxGT("Ajusta decalatge") #define MSG_HOME_OFFSETS_APPLIED _UxGT("Decalatge aplicat") #define MSG_SET_ORIGIN _UxGT("Estableix origen") -#define MSG_PREHEAT_1 _UxGT("Preescalfa PLA") +#define MSG_PREHEAT_1 _UxGT("Preescalfa " PREHEAT_1_LABEL) #define MSG_PREHEAT_1_N MSG_PREHEAT_1 _UxGT(" ") #define MSG_PREHEAT_1_ALL MSG_PREHEAT_1 _UxGT(" Tot") #define MSG_PREHEAT_1_BEDONLY MSG_PREHEAT_1 _UxGT(" Llit") #define MSG_PREHEAT_1_SETTINGS MSG_PREHEAT_1 _UxGT(" Conf.") -#define MSG_PREHEAT_2 _UxGT("Preescalfa ABS") +#define MSG_PREHEAT_2 _UxGT("Preescalfa " PREHEAT_2_LABEL) #define MSG_PREHEAT_2_N MSG_PREHEAT_2 _UxGT(" ") #define MSG_PREHEAT_2_ALL MSG_PREHEAT_2 _UxGT(" Tot") #define MSG_PREHEAT_2_BEDONLY MSG_PREHEAT_2 _UxGT(" Llit") @@ -92,8 +91,8 @@ #define MSG_MAX LCD_STR_THERMOMETER _UxGT(" Max") #define MSG_FACTOR LCD_STR_THERMOMETER _UxGT(" Fact") #define MSG_AUTOTEMP _UxGT("Autotemp") -#define MSG_ON _UxGT("On ") -#define MSG_OFF _UxGT("Off") +#define MSG_LCD_ON _UxGT("On") +#define MSG_LCD_OFF _UxGT("Off") #define MSG_PID_P _UxGT("PID-P") #define MSG_PID_I _UxGT("PID-I") #define MSG_PID_D _UxGT("PID-D") @@ -161,14 +160,14 @@ #define MSG_CONTROL_RETRACT _UxGT("Retreu mm") #define MSG_CONTROL_RETRACT_SWAP _UxGT("Swap Retreure mm") #define MSG_CONTROL_RETRACTF _UxGT("Retreu V") -#define MSG_CONTROL_RETRACT_ZLIFT _UxGT("Aixeca mm") +#define MSG_CONTROL_RETRACT_ZHOP _UxGT("Aixeca mm") #define MSG_CONTROL_RETRACT_RECOVER _UxGT("DesRet +mm") #define MSG_CONTROL_RETRACT_RECOVER_SWAP _UxGT("Swap DesRet +mm") #define MSG_CONTROL_RETRACT_RECOVERF _UxGT("DesRet V") #define MSG_AUTORETRACT _UxGT("Auto retraccio") #define MSG_FILAMENTCHANGE _UxGT("Canvia filament") #define MSG_INIT_SDCARD _UxGT("Inicialitza SD") -#define MSG_CNG_SDCARD _UxGT("Canvia SD") +#define MSG_CHANGE_SDCARD _UxGT("Canvia SD") #define MSG_ZPROBE_OUT _UxGT("Sonda Z fora") #define MSG_BLTOUCH_RESET _UxGT("Reinicia BLTouch") #define MSG_HOME _UxGT("Home") // Used as MSG_HOME " " MSG_X MSG_Y MSG_Z " " MSG_FIRST @@ -261,5 +260,3 @@ #define MSG_FILAMENT_CHANGE_LOAD_1 _UxGT("Carregant...") #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Reprenent...") #endif // LCD_HEIGHT < 4 - -#endif // LANGUAGE_CA_H diff --git a/Marlin/src/lcd/language/language_cz.h b/Marlin/src/lcd/language/language_cz.h index 5980f61ba9..e2a9256b81 100644 --- a/Marlin/src/lcd/language/language_cz.h +++ b/Marlin/src/lcd/language/language_cz.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Czech @@ -32,8 +33,6 @@ * http://www.zahradniksebavi.cz * */ -#ifndef LANGUAGE_CZ_UTF_H -#define LANGUAGE_CZ_UTF_H #define DISPLAY_CHARSET_ISO10646_CZ #define CHARSIZE 2 @@ -62,13 +61,13 @@ #define MSG_SET_HOME_OFFSETS _UxGT("Nastavit ofsety") #define MSG_HOME_OFFSETS_APPLIED _UxGT("Ofsety nastaveny") #define MSG_SET_ORIGIN _UxGT("Nastavit počátek") -#define MSG_PREHEAT_1 _UxGT("Zahřát PLA") +#define MSG_PREHEAT_1 _UxGT("Zahřát " PREHEAT_1_LABEL) #define MSG_PREHEAT_1_N MSG_PREHEAT_1 _UxGT(" ") #define MSG_PREHEAT_1_ALL MSG_PREHEAT_1 _UxGT(" vše") #define MSG_PREHEAT_1_END MSG_PREHEAT_1 _UxGT(" hotend") #define MSG_PREHEAT_1_BEDONLY MSG_PREHEAT_1 _UxGT(" podlož") #define MSG_PREHEAT_1_SETTINGS MSG_PREHEAT_1 _UxGT(" nast") -#define MSG_PREHEAT_2 _UxGT("Zahřát ABS") +#define MSG_PREHEAT_2 _UxGT("Zahřát " PREHEAT_2_LABEL) #define MSG_PREHEAT_2_N MSG_PREHEAT_2 _UxGT(" ") #define MSG_PREHEAT_2_ALL MSG_PREHEAT_2 _UxGT(" vše") #define MSG_PREHEAT_2_END MSG_PREHEAT_2 _UxGT(" hotend") @@ -97,24 +96,24 @@ #define MSG_UBL_MOVING_TO_NEXT _UxGT("Přesun na další") #define MSG_UBL_ACTIVATE_MESH _UxGT("Aktivovat UBL") #define MSG_UBL_DEACTIVATE_MESH _UxGT("Deaktivovat UBL") -#define MSG_UBL_SET_BED_TEMP _UxGT("Teplota podložky") -#define MSG_UBL_CUSTOM_BED_TEMP MSG_UBL_SET_BED_TEMP -#define MSG_UBL_SET_HOTEND_TEMP _UxGT("Teplota hotendu") -#define MSG_UBL_CUSTOM_HOTEND_TEMP MSG_UBL_SET_HOTEND_TEMP +#define MSG_UBL_SET_TEMP_BED _UxGT("Teplota podložky") +#define MSG_UBL_BED_TEMP_CUSTOM MSG_UBL_SET_TEMP_BED +#define MSG_UBL_SET_TEMP_HOTEND _UxGT("Teplota hotendu") +#define MSG_UBL_HOTEND_TEMP_CUSTOM MSG_UBL_SET_TEMP_HOTEND #define MSG_UBL_MESH_EDIT _UxGT("Úprava sítě bodů") #define MSG_UBL_EDIT_CUSTOM_MESH _UxGT("Upravit vlastní síť") #define MSG_UBL_FINE_TUNE_MESH _UxGT("Doladit síť bodů") #define MSG_UBL_DONE_EDITING_MESH _UxGT("Konec úprav sítě") #define MSG_UBL_BUILD_CUSTOM_MESH _UxGT("Vlastní síť") #define MSG_UBL_BUILD_MESH_MENU _UxGT("Vytvořit síť") -#define MSG_UBL_BUILD_PLA_MESH _UxGT("Síť bodu PLA") -#define MSG_UBL_BUILD_ABS_MESH _UxGT("Síť bodu ABS") +#define MSG_UBL_BUILD_MESH_M1 _UxGT("Síť bodu " PREHEAT_1_LABEL) +#define MSG_UBL_BUILD_MESH_M2 _UxGT("Síť bodu " PREHEAT_2_LABEL) #define MSG_UBL_BUILD_COLD_MESH _UxGT("Studená síť bodů") #define MSG_UBL_MESH_HEIGHT_ADJUST _UxGT("Upravit výšku sítě") #define MSG_UBL_MESH_HEIGHT_AMOUNT _UxGT("Výška") #define MSG_UBL_VALIDATE_MESH_MENU _UxGT("Zkontrolovat síť") -#define MSG_UBL_VALIDATE_PLA_MESH _UxGT("Kontrola sítě PLA") -#define MSG_UBL_VALIDATE_ABS_MESH _UxGT("Kontrola sítě ABS") +#define MSG_UBL_VALIDATE_MESH_M1 _UxGT("Kontrola sítě " PREHEAT_1_LABEL) +#define MSG_UBL_VALIDATE_MESH_M2 _UxGT("Kontrola sítě " PREHEAT_2_LABEL) #define MSG_UBL_VALIDATE_CUSTOM_MESH _UxGT("Kontrola vlast. sítě") #define MSG_UBL_CONTINUE_MESH _UxGT("Pokračovat v síťi") #define MSG_UBL_MESH_LEVELING _UxGT("Síťové rovnání") @@ -128,7 +127,7 @@ #define MSG_UBL_OUTPUT_MAP_CSV _UxGT("Exportovat do CSV") #define MSG_UBL_OUTPUT_MAP_BACKUP _UxGT("Záloha do PC") #define MSG_UBL_INFO_UBL _UxGT("Info o UBL do PC") -#define MSG_UBL_EDIT_MESH_MENU _UxGT("Upravit síť bodů") +#define MSG_EDIT_MESH _UxGT("Upravit síť bodů") #define MSG_UBL_FILLIN_AMOUNT _UxGT("Hustota mřížky") #define MSG_UBL_MANUAL_FILLIN _UxGT("Ruční hustota") #define MSG_UBL_SMART_FILLIN _UxGT("Chytrá hustota") @@ -190,8 +189,8 @@ #define MSG_MAX _UxGT(" ") LCD_STR_THERMOMETER _UxGT(" Max") #define MSG_FACTOR _UxGT(" ") LCD_STR_THERMOMETER _UxGT(" Fakt") #define MSG_AUTOTEMP _UxGT("Autoteplota") -#define MSG_ON _UxGT("Zap") -#define MSG_OFF _UxGT("Vyp") +#define MSG_LCD_ON _UxGT("Zap") +#define MSG_LCD_OFF _UxGT("Vyp") #define MSG_PID_P _UxGT("PID-P") #define MSG_PID_I _UxGT("PID-I") #define MSG_PID_D _UxGT("PID-D") @@ -254,7 +253,7 @@ #define MSG_PAUSE_PRINT _UxGT("Pozastavit tisk") #define MSG_RESUME_PRINT _UxGT("Obnovit tisk") #define MSG_STOP_PRINT _UxGT("Zastavit tisk") -#define MSG_POWER_LOSS_RECOVERY _UxGT("Obnova vypadku") +#define MSG_OUTAGE_RECOVERY _UxGT("Obnova vypadku") #define MSG_CARD_MENU _UxGT("Tisknout z SD") #define MSG_NO_CARD _UxGT("Žádná SD karta") #define MSG_DWELL _UxGT("Uspáno...") @@ -268,7 +267,7 @@ #define MSG_CONTROL_RETRACT _UxGT("Retrakt mm") #define MSG_CONTROL_RETRACT_SWAP _UxGT("Výměna Re.mm") #define MSG_CONTROL_RETRACTF _UxGT("Retraktovat V") -#define MSG_CONTROL_RETRACT_ZLIFT _UxGT("Zvednuti Z mm") +#define MSG_CONTROL_RETRACT_ZHOP _UxGT("Zvednuti Z mm") #define MSG_CONTROL_RETRACT_RECOVER _UxGT("UnRet mm") #define MSG_CONTROL_RETRACT_RECOVER_SWAP _UxGT("S UnRet mm") #define MSG_CONTROL_RETRACT_RECOVERF _UxGT("UnRet V") @@ -280,7 +279,7 @@ #define MSG_FILAMENTUNLOAD_ALL _UxGT("Vysunout vše") #define MSG_INIT_SDCARD _UxGT("Načíst SD kartu") -#define MSG_CNG_SDCARD _UxGT("Vyměnit SD kartu") +#define MSG_CHANGE_SDCARD _UxGT("Vyměnit SD kartu") #define MSG_ZPROBE_OUT _UxGT("Sonda Z mimo podl") #define MSG_SKEW_FACTOR _UxGT("Faktor zkosení") #define MSG_BLTOUCH _UxGT("BLTouch") @@ -406,5 +405,3 @@ #define MSG_FILAMENT_CHANGE_PURGE_1 _UxGT("Vytlačování...") #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Pokračování...") #endif // LCD_HEIGHT < 4 - -#endif // LANGUAGE_CZ_UTF_H diff --git a/Marlin/src/lcd/language/language_da.h b/Marlin/src/lcd/language/language_da.h index 1bd78c332c..2dcea9ee4b 100644 --- a/Marlin/src/lcd/language/language_da.h +++ b/Marlin/src/lcd/language/language_da.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Danish @@ -27,8 +28,6 @@ * See also http://marlinfw.org/docs/development/lcd_language.html * */ -#ifndef LANGUAGE_DA_H -#define LANGUAGE_DA_H #define DISPLAY_CHARSET_ISO10646_1 #define CHARSIZE 2 @@ -52,16 +51,16 @@ #define MSG_SET_HOME_OFFSETS _UxGT("Sæt forsk. af home") #define MSG_HOME_OFFSETS_APPLIED _UxGT("Forsk. er nu aktiv") #define MSG_SET_ORIGIN _UxGT("Sæt origin") -#define MSG_PREHEAT_1 _UxGT("Forvarm PLA") -#define MSG_PREHEAT_1_N _UxGT("Forvarm PLA ") -#define MSG_PREHEAT_1_ALL _UxGT("Forvarm PLA Alle") -#define MSG_PREHEAT_1_BEDONLY _UxGT("Forvarm PLA Bed") -#define MSG_PREHEAT_1_SETTINGS _UxGT("Forvarm PLA conf") -#define MSG_PREHEAT_2 _UxGT("Forvarm ABS") -#define MSG_PREHEAT_2_N _UxGT("Forvarm ABS ") -#define MSG_PREHEAT_2_ALL _UxGT("Forvarm ABS Alle") -#define MSG_PREHEAT_2_BEDONLY _UxGT("Forvarm ABS Bed") -#define MSG_PREHEAT_2_SETTINGS _UxGT("Forvarm ABS conf") +#define MSG_PREHEAT_1 _UxGT("Forvarm " PREHEAT_1_LABEL) +#define MSG_PREHEAT_1_N _UxGT("Forvarm " PREHEAT_1_LABEL " ") +#define MSG_PREHEAT_1_ALL _UxGT("Forvarm " PREHEAT_1_LABEL " Alle") +#define MSG_PREHEAT_1_BEDONLY _UxGT("Forvarm " PREHEAT_1_LABEL " Bed") +#define MSG_PREHEAT_1_SETTINGS _UxGT("Forvarm " PREHEAT_1_LABEL " conf") +#define MSG_PREHEAT_2 _UxGT("Forvarm " PREHEAT_2_LABEL) +#define MSG_PREHEAT_2_N _UxGT("Forvarm " PREHEAT_2_LABEL " ") +#define MSG_PREHEAT_2_ALL _UxGT("Forvarm " PREHEAT_2_LABEL " Alle") +#define MSG_PREHEAT_2_BEDONLY _UxGT("Forvarm " PREHEAT_2_LABEL " Bed") +#define MSG_PREHEAT_2_SETTINGS _UxGT("Forvarm " PREHEAT_2_LABEL " conf") #define MSG_COOLDOWN _UxGT("Afkøl") #define MSG_SWITCH_PS_ON _UxGT("Slå strøm til") #define MSG_SWITCH_PS_OFF _UxGT("Slå strøm fra") @@ -89,8 +88,8 @@ #define MSG_MAX _UxGT(" \002 Max") #define MSG_FACTOR _UxGT(" \002 Fact") #define MSG_AUTOTEMP _UxGT("Autotemp") -#define MSG_ON _UxGT("Til ") -#define MSG_OFF _UxGT("Fra") +#define MSG_LCD_ON _UxGT("Til") +#define MSG_LCD_OFF _UxGT("Fra") #define MSG_PID_P _UxGT("PID-P") #define MSG_PID_I _UxGT("PID-I") #define MSG_PID_D _UxGT("PID-D") @@ -158,14 +157,14 @@ #define MSG_CONTROL_RETRACT _UxGT("Tilbagetræk mm") #define MSG_CONTROL_RETRACT_SWAP _UxGT("Skift Re.mm") #define MSG_CONTROL_RETRACTF _UxGT("Tilbagetræk V") -#define MSG_CONTROL_RETRACT_ZLIFT _UxGT("Hop mm") +#define MSG_CONTROL_RETRACT_ZHOP _UxGT("Hop mm") #define MSG_CONTROL_RETRACT_RECOVER _UxGT("UnRet mm") #define MSG_CONTROL_RETRACT_RECOVER_SWAP _UxGT("Skift UnRet mm") #define MSG_CONTROL_RETRACT_RECOVERF _UxGT("UnRet V") #define MSG_AUTORETRACT _UxGT("AutoRetr.") #define MSG_FILAMENTCHANGE _UxGT("Skift filament") #define MSG_INIT_SDCARD _UxGT("Init. SD card") -#define MSG_CNG_SDCARD _UxGT("Skift SD kort") +#define MSG_CHANGE_SDCARD _UxGT("Skift SD kort") #define MSG_ZPROBE_OUT _UxGT("Probe udenfor plade") #define MSG_BLTOUCH_SELFTEST _UxGT("BLTouch Selv-Test") #define MSG_BLTOUCH_RESET _UxGT("Reset BLTouch") @@ -250,5 +249,3 @@ #define MSG_FILAMENT_CHANGE_LOAD_1 _UxGT("Indtager...") #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Fortsætter...") #endif // LCD_HEIGHT < 4 - -#endif // LANGUAGE_DA_H diff --git a/Marlin/src/lcd/language/language_de.h b/Marlin/src/lcd/language/language_de.h index 3f8ad05fc8..f218efdd0c 100644 --- a/Marlin/src/lcd/language/language_de.h +++ b/Marlin/src/lcd/language/language_de.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * German @@ -27,8 +28,6 @@ * See also http://marlinfw.org/docs/development/lcd_language.html * */ -#ifndef LANGUAGE_DE_H -#define LANGUAGE_DE_H #define CHARSIZE 2 @@ -39,55 +38,154 @@ #define MSG_SD_INSERTED _UxGT("SD-Karte erkannt") #define MSG_SD_REMOVED _UxGT("SD-Karte entfernt") #define MSG_LCD_ENDSTOPS _UxGT("Endstopp") // Max length 8 characters +#define MSG_LCD_SOFT_ENDSTOPS _UxGT("Soft-Endstopp") #define MSG_MAIN _UxGT("Hauptmenü") +#define MSG_ADVANCED_SETTINGS _UxGT("Erw. Einstellungen") +#define MSG_CONFIGURATION _UxGT("Konfiguration") #define MSG_AUTOSTART _UxGT("Autostart") #define MSG_DISABLE_STEPPERS _UxGT("Motoren deaktivieren") // M84 -#define MSG_DEBUG_MENU _UxGT("Debug Menü") -#define MSG_PROGRESS_BAR_TEST _UxGT("Fortschrittsb. Test") -#define MSG_AUTO_HOME _UxGT("Home") // G28 +#define MSG_DEBUG_MENU _UxGT("Debug-Menü") +#define MSG_PROGRESS_BAR_TEST _UxGT("Fortschrittsb.-Test") +#define MSG_AUTO_HOME _UxGT("Home XYZ") // G28 #define MSG_AUTO_HOME_X _UxGT("Home X") #define MSG_AUTO_HOME_Y _UxGT("Home Y") #define MSG_AUTO_HOME_Z _UxGT("Home Z") +#define MSG_AUTO_Z_ALIGN _UxGT("Z-Achsen ausgleichen") #define MSG_TMC_Z_CALIBRATION _UxGT("Kalibriere Z") #define MSG_LEVEL_BED_HOMING _UxGT("Home XYZ") -#define MSG_LEVEL_BED_WAITING _UxGT("Klick für Start") +#define MSG_LEVEL_BED_WAITING _UxGT("Klick zum Starten") #define MSG_LEVEL_BED_NEXT_POINT _UxGT("Nächste Koordinate") -#define MSG_LEVEL_BED_DONE _UxGT("Fertig") +#define MSG_LEVEL_BED_DONE _UxGT("Nivellieren fertig!") #define MSG_Z_FADE_HEIGHT _UxGT("Ausblendhöhe") #define MSG_SET_HOME_OFFSETS _UxGT("Setze Homeversatz") #define MSG_HOME_OFFSETS_APPLIED _UxGT("Homeversatz aktiv") -#define MSG_SET_ORIGIN _UxGT("Setze Nullpunkt") //"G92 X0 Y0 Z0" commented out in ultralcd.cpp -#define MSG_PREHEAT_1 _UxGT("Vorwärmen PLA") -#define MSG_PREHEAT_1_N _UxGT("Vorwärmen PLA ") -#define MSG_PREHEAT_1_ALL _UxGT("Vorw. PLA Alle") -#define MSG_PREHEAT_1_END _UxGT("Vorw. PLA Extr.") -#define MSG_PREHEAT_1_BEDONLY _UxGT("Vorw. PLA Bett") -#define MSG_PREHEAT_1_SETTINGS _UxGT("Vorw. PLA Einst.") -#define MSG_PREHEAT_2 _UxGT("Vorwärmen ABS") -#define MSG_PREHEAT_2_N _UxGT("Vorwärmen ABS ") -#define MSG_PREHEAT_2_ALL _UxGT("Vorw. ABS Alle") -#define MSG_PREHEAT_2_END _UxGT("Vorw. ABS Extr.") -#define MSG_PREHEAT_2_BEDONLY _UxGT("Vorw. ABS Bett") -#define MSG_PREHEAT_2_SETTINGS _UxGT("Vorw. ABS Einst.") +#define MSG_SET_ORIGIN _UxGT("Setze Nullpunkte") //"G92 X0 Y0 Z0" commented out in ultralcd.cpp +#define MSG_PREHEAT_1 _UxGT("Vorwärmen " PREHEAT_1_LABEL) +#define MSG_PREHEAT_1_N _UxGT("Vorwärmen " PREHEAT_1_LABEL " ") +#define MSG_PREHEAT_1_ALL _UxGT("Vorw. " PREHEAT_1_LABEL " Alles") +#define MSG_PREHEAT_1_END _UxGT("Vorw. " PREHEAT_1_LABEL " Extr.") +#define MSG_PREHEAT_1_BEDONLY _UxGT("Vorw. " PREHEAT_1_LABEL " Bett") +#define MSG_PREHEAT_1_SETTINGS _UxGT("Vorw. " PREHEAT_1_LABEL " Einst.") +#define MSG_PREHEAT_2 _UxGT("Vorwärmen " PREHEAT_2_LABEL) +#define MSG_PREHEAT_2_N _UxGT("Vorwärmen " PREHEAT_2_LABEL " ") +#define MSG_PREHEAT_2_ALL _UxGT("Vorw. " PREHEAT_2_LABEL " Alles") +#define MSG_PREHEAT_2_END _UxGT("Vorw. " PREHEAT_2_LABEL " Extr.") +#define MSG_PREHEAT_2_BEDONLY _UxGT("Vorw. " PREHEAT_2_LABEL " Bett") +#define MSG_PREHEAT_2_SETTINGS _UxGT("Vorw. " PREHEAT_2_LABEL " Einst.") +#define MSG_PREHEAT_CUSTOM _UxGT("benutzerdef. Heizen") #define MSG_COOLDOWN _UxGT("Abkühlen") #define MSG_SWITCH_PS_ON _UxGT("Netzteil ein") #define MSG_SWITCH_PS_OFF _UxGT("Netzteil aus") #define MSG_EXTRUDE _UxGT("Extrudieren") -#define MSG_RETRACT _UxGT("Retract") -#define MSG_MOVE_AXIS _UxGT("Bewegen") -#define MSG_BED_LEVELING _UxGT("Bett Nivellierung") +#define MSG_RETRACT _UxGT("Rückzug") +#define MSG_MOVE_AXIS _UxGT("Achse Bewegen") +#define MSG_BED_LEVELING _UxGT("Bett-Nivellierung") #define MSG_LEVEL_BED _UxGT("Bett nivellieren") #define MSG_LEVEL_CORNERS _UxGT("Ecken nivellieren") #define MSG_NEXT_CORNER _UxGT("Nächste Ecke") #define MSG_EDITING_STOPPED _UxGT("Netzbearb. angeh.") -#define MSG_USER_MENU _UxGT("Benutzer Menü") +#define MSG_MESH_X _UxGT("Index X") +#define MSG_MESH_Y _UxGT("Index Y") +#define MSG_MESH_EDIT_Z _UxGT("Z-Wert") +#define MSG_USER_MENU _UxGT("Benutzer-Menü") +#define MSG_UBL_DOING_G29 _UxGT("G29 ausführen") +#define MSG_UBL_UNHOMED _UxGT("Home XYZ zuerst") +#define MSG_UBL_TOOLS _UxGT("UBL-Werkzeuge") +#define MSG_UBL_LEVEL_BED _UxGT("Unified Bed Leveling") +#define MSG_IDEX_MENU _UxGT("IDEX-Modus") +#define MSG_IDEX_MODE_AUTOPARK _UxGT("Autom. Parken") +#define MSG_IDEX_MODE_DUPLICATE _UxGT("Duplizieren") +#define MSG_IDEX_MODE_SCALED_COPY _UxGT("Skalierung kopieren") +#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_UBL_MANUAL_MESH _UxGT("Netz manuell erst.") +#define MSG_UBL_BC_INSERT _UxGT("Unterlegen & messen") +#define MSG_UBL_BC_INSERT2 _UxGT("Messen") +#define MSG_UBL_BC_REMOVE _UxGT("Entfernen & messen") +#define MSG_UBL_MOVING_TO_NEXT _UxGT("Nächster Punkt...") +#define MSG_UBL_ACTIVATE_MESH _UxGT("UBL aktivieren") +#define MSG_UBL_DEACTIVATE_MESH _UxGT("UBL deaktivieren") +#define MSG_UBL_SET_TEMP_BED _UxGT("Betttemperatur") +#define MSG_UBL_BED_TEMP_CUSTOM MSG_UBL_SET_TEMP_BED +#define MSG_UBL_SET_TEMP_HOTEND _UxGT("Hotend-Temp.") +#define MSG_UBL_HOTEND_TEMP_CUSTOM MSG_UBL_SET_TEMP_HOTEND +#define MSG_UBL_MESH_EDIT _UxGT("Netz bearbeiten") +#define MSG_UBL_EDIT_CUSTOM_MESH _UxGT("Eigenes Netz bearb.") +#define MSG_UBL_FINE_TUNE_MESH _UxGT("Feineinstellung...") +#define MSG_UBL_DONE_EDITING_MESH _UxGT("Bearbeitung beendet") +#define MSG_UBL_BUILD_CUSTOM_MESH _UxGT("Eigenes Netz erst.") +#define MSG_UBL_BUILD_MESH_MENU _UxGT("Netz erstellen") +#define MSG_UBL_BUILD_MESH_M1 _UxGT("Netz erstellen " PREHEAT_1_LABEL) +#define MSG_UBL_BUILD_MESH_M2 _UxGT("Netz erstellen " PREHEAT_2_LABEL) +#define MSG_UBL_BUILD_COLD_MESH _UxGT("Netz erstellen kalt") +#define MSG_UBL_MESH_HEIGHT_ADJUST _UxGT("Netzhöhe einst.") +#define MSG_UBL_MESH_HEIGHT_AMOUNT _UxGT("Höhe") +#define MSG_UBL_VALIDATE_MESH_MENU _UxGT("Netz validieren") +#define MSG_UBL_VALIDATE_MESH_M1 _UxGT("Netz validieren " PREHEAT_1_LABEL) +#define MSG_UBL_VALIDATE_MESH_M2 _UxGT("Netz validieren " PREHEAT_2_LABEL) +#define MSG_UBL_VALIDATE_CUSTOM_MESH _UxGT("Eig. Netz validieren") +#define MSG_UBL_CONTINUE_MESH _UxGT("Netzerst. forts.") +#define MSG_UBL_MESH_LEVELING _UxGT("Netz-Nivellierung") +#define MSG_UBL_3POINT_MESH_LEVELING _UxGT("3-Punkt-Nivell.") +#define MSG_UBL_GRID_MESH_LEVELING _UxGT("Gitternetz-Nivell.") +#define MSG_UBL_MESH_LEVEL _UxGT("Netz nivellieren") +#define MSG_UBL_SIDE_POINTS _UxGT("Eckpunkte") +#define MSG_UBL_MAP_TYPE _UxGT("Kartentyp") +#define MSG_UBL_OUTPUT_MAP _UxGT("Karte ausgeben") +#define MSG_UBL_OUTPUT_MAP_HOST _UxGT("Ausgabe für Host") +#define MSG_UBL_OUTPUT_MAP_CSV _UxGT("Ausgabe für CSV") +#define MSG_UBL_OUTPUT_MAP_BACKUP _UxGT("Externe Sicherung") +#define MSG_UBL_INFO_UBL _UxGT("UBL-Info ausgeben") +#define MSG_EDIT_MESH _UxGT("Netz bearbeiten") +#define MSG_UBL_FILLIN_AMOUNT _UxGT("Menge an Füllung") +#define MSG_UBL_MANUAL_FILLIN _UxGT("Manuelles Füllen") +#define MSG_UBL_SMART_FILLIN _UxGT("Cleveres Füllen") +#define MSG_UBL_FILLIN_MESH _UxGT("Netz Füllen") +#define MSG_UBL_INVALIDATE_ALL _UxGT("Alles annullieren") +#define MSG_UBL_INVALIDATE_CLOSEST _UxGT("Nächstlieg. ann.") +#define MSG_UBL_FINE_TUNE_ALL _UxGT("Feineinst. Alles") +#define MSG_UBL_FINE_TUNE_CLOSEST _UxGT("Feineinst. Nächstl.") +#define MSG_UBL_STORAGE_MESH_MENU _UxGT("Netz-Speicherplatz") +#define MSG_UBL_STORAGE_SLOT _UxGT("Speicherort") +#define MSG_UBL_LOAD_MESH _UxGT("Bettnetz laden") +#define MSG_UBL_SAVE_MESH _UxGT("Bettnetz speichern") +#define MSG_MESH_LOADED _UxGT("Netz %i geladen") +#define MSG_MESH_SAVED _UxGT("Netz %i gespeichert") +#define MSG_NO_STORAGE _UxGT("Kein Speicher") +#define MSG_UBL_SAVE_ERROR _UxGT("ERR:UBL speichern") +#define MSG_UBL_RESTORE_ERROR _UxGT("ERR:UBL wiederherst.") +#define MSG_UBL_Z_OFFSET_STOPPED _UxGT("Z-Versatz angehalten") +#define MSG_UBL_STEP_BY_STEP_MENU _UxGT("Schrittweises UBL") + +#define MSG_LED_CONTROL _UxGT("LED-Steuerung") +#define MSG_LEDS _UxGT("Licht") +#define MSG_LED_PRESETS _UxGT("Licht-Einstellungen") +#define MSG_SET_LEDS_RED _UxGT("Rot") +#define MSG_SET_LEDS_ORANGE _UxGT("Orange") +#define MSG_SET_LEDS_YELLOW _UxGT("Gelb") +#define MSG_SET_LEDS_GREEN _UxGT("Grün") +#define MSG_SET_LEDS_BLUE _UxGT("Blau") +#define MSG_SET_LEDS_INDIGO _UxGT("Indigo") +#define MSG_SET_LEDS_VIOLET _UxGT("Violett") +#define MSG_SET_LEDS_WHITE _UxGT("Weiß") +#define MSG_SET_LEDS_DEFAULT _UxGT("Standard") +#define MSG_CUSTOM_LEDS _UxGT("Benutzerdef.") +#define MSG_INTENSITY_R _UxGT("Intensität Rot") +#define MSG_INTENSITY_G _UxGT("Intensität Grün") +#define MSG_INTENSITY_B _UxGT("Intensität Blau") +#define MSG_INTENSITY_W _UxGT("Intensität Weiß") +#define MSG_LED_BRIGHTNESS _UxGT("Helligkeit") #define MSG_MOVING _UxGT("In Bewegung...") #define MSG_FREE_XY _UxGT("Abstand XY") -#define MSG_MOVE_X _UxGT("X") -#define MSG_MOVE_Y _UxGT("Y") -#define MSG_MOVE_Z _UxGT("Z") -#define MSG_MOVE_E _UxGT("Extruder ") +#define MSG_MOVE_X _UxGT("Bewege X") +#define MSG_MOVE_Y _UxGT("Bewege Y") +#define MSG_MOVE_Z _UxGT("Bewege Z") +#define MSG_MOVE_E _UxGT("Bewege Extruder") +#define MSG_HOTEND_TOO_COLD _UxGT("Hotend zu kalt") #define MSG_MOVE_01MM _UxGT(" 0,1 mm") #define MSG_MOVE_1MM _UxGT(" 1,0 mm") #define MSG_MOVE_10MM _UxGT("10,0 mm") @@ -96,21 +194,21 @@ #define MSG_NOZZLE _UxGT("Düse") #define MSG_BED _UxGT("Bett") #define MSG_FAN_SPEED _UxGT("Lüfter") -#define MSG_EXTRA_FAN_SPEED _UxGT("Extra Lüfter") +#define MSG_EXTRA_FAN_SPEED _UxGT("Geschw. Extralüfter") #define MSG_FLOW _UxGT("Flussrate") #define MSG_CONTROL _UxGT("Einstellungen") #define MSG_MIN LCD_STR_THERMOMETER _UxGT(" min") #define MSG_MAX LCD_STR_THERMOMETER _UxGT(" max") #define MSG_FACTOR LCD_STR_THERMOMETER _UxGT(" Faktor") -#define MSG_AUTOTEMP _UxGT("AutoTemp") -#define MSG_ON _UxGT("Ein") -#define MSG_OFF _UxGT("Aus") +#define MSG_AUTOTEMP _UxGT("Auto Temperatur") +#define MSG_LCD_ON _UxGT("Ein") +#define MSG_LCD_OFF _UxGT("Aus") #define MSG_PID_P _UxGT("PID P") #define MSG_PID_I _UxGT("PID I") #define MSG_PID_D _UxGT("PID D") #define MSG_PID_C _UxGT("PID C") #define MSG_SELECT _UxGT("Auswählen") -#define MSG_ACC _UxGT("A") +#define MSG_ACC _UxGT("Beschleunigung") #define MSG_JERK _UxGT("Jerk") #if IS_KINEMATIC #define MSG_VA_JERK _UxGT("V A Jerk") @@ -122,13 +220,14 @@ #define MSG_VC_JERK _UxGT("V Z Jerk") #endif #define MSG_VE_JERK _UxGT("V E Jerk") +#define MSG_JUNCTION_DEVIATION _UxGT("Junction Dev") #define MSG_VELOCITY _UxGT("Geschwindigkeit") -#define MSG_VMAX _UxGT("V max ") // space by purpose +#define MSG_VMAX _UxGT("V max ") // space intentional #define MSG_VMIN _UxGT("V min") #define MSG_VTRAV_MIN _UxGT("V min Leerfahrt") #define MSG_ACCELERATION _UxGT("Beschleunigung") -#define MSG_AMAX _UxGT("A max ") // space by purpose -#define MSG_A_RETRACT _UxGT("A Retract") +#define MSG_AMAX _UxGT("A max ") // space intentional +#define MSG_A_RETRACT _UxGT("A Rückzug") #define MSG_A_TRAVEL _UxGT("A Leerfahrt") #define MSG_STEPS_PER_MM _UxGT("Steps/mm") #if IS_KINEMATIC @@ -151,64 +250,74 @@ #define MSG_MOTION _UxGT("Bewegung") #define MSG_FILAMENT _UxGT("Filament") #define MSG_VOLUMETRIC_ENABLED _UxGT("E in mm³") -#define MSG_FILAMENT_DIAM _UxGT("D Fil.") +#define MSG_FILAMENT_DIAM _UxGT("Durchm. Filament") #define MSG_FILAMENT_UNLOAD _UxGT("Entladen mm") #define MSG_FILAMENT_LOAD _UxGT("Laden mm") -#define MSG_ADVANCE_K _UxGT("Advance Faktor") -#define MSG_CONTRAST _UxGT("LCD Kontrast") +#define MSG_ADVANCE_K _UxGT("Vorschubfaktor") +#define MSG_CONTRAST _UxGT("LCD-Kontrast") #define MSG_STORE_EEPROM _UxGT("Konfig. speichern") #define MSG_LOAD_EEPROM _UxGT("Konfig. laden") #define MSG_RESTORE_FAILSAFE _UxGT("Standardwerte laden") #define MSG_INIT_EEPROM _UxGT("Werkseinstellungen") +#define MSG_SD_UPDATE _UxGT("SD-Firmware-Update") +#define MSG_RESET_PRINTER _UxGT("Drucker neustarten") #define MSG_REFRESH _UxGT("Aktualisieren") #define MSG_WATCH _UxGT("Info") #define MSG_PREPARE _UxGT("Vorbereitung") #define MSG_TUNE _UxGT("Justierung") -#define MSG_PAUSE_PRINT _UxGT("SD-Druck Pause") -#define MSG_RESUME_PRINT _UxGT("SD-Druck Fortsetzung") -#define MSG_STOP_PRINT _UxGT("SD-Druck Abbruch") -#define MSG_CARD_MENU _UxGT("SD-Karte") +#define MSG_PAUSE_PRINT _UxGT("SD-Druck pausieren") +#define MSG_RESUME_PRINT _UxGT("SD-Druck fortsetzen") +#define MSG_STOP_PRINT _UxGT("SD-Druck abbrechen") +#define MSG_OUTAGE_RECOVERY _UxGT("Wiederh. n. Stroma.") +#define MSG_CARD_MENU _UxGT("Druck v. SD-Karte") #define MSG_NO_CARD _UxGT("Keine SD-Karte") #define MSG_DWELL _UxGT("Warten...") -#define MSG_USERWAIT _UxGT("Warte auf Nutzer") -#define MSG_PRINT_PAUSED _UxGT("Druck pausiert") +#define MSG_USERWAIT _UxGT("Klick zum Fortsetzen") +#define MSG_PRINT_PAUSED _UxGT("Druck pausiert...") +#define MSG_PRINTING _UxGT("Druckt...") #define MSG_PRINT_ABORTED _UxGT("Druck abgebrochen") -#define MSG_NO_MOVE _UxGT("Motoren eingeschaltet") +#define MSG_NO_MOVE _UxGT("Motoren angeschaltet") #define MSG_KILLED _UxGT("ABGEBROCHEN") #define MSG_STOPPED _UxGT("ANGEHALTEN") -#define MSG_CONTROL_RETRACT _UxGT("Retract mm") -#define MSG_CONTROL_RETRACT_SWAP _UxGT("Wechs. Retract mm") -#define MSG_CONTROL_RETRACTF _UxGT("Retract V") -#define MSG_CONTROL_RETRACT_ZLIFT _UxGT("Z-Hop mm") +#define MSG_CONTROL_RETRACT _UxGT("Rückzug mm") +#define MSG_CONTROL_RETRACT_SWAP _UxGT("Wechs. Rückzug mm") +#define MSG_CONTROL_RETRACTF _UxGT("Rückzug V") +#define MSG_CONTROL_RETRACT_ZHOP _UxGT("Z-Sprung mm") #define MSG_CONTROL_RETRACT_RECOVER _UxGT("UnRet mm") #define MSG_CONTROL_RETRACT_RECOVER_SWAP _UxGT("Wechs. UnRet mm") #define MSG_CONTROL_RETRACT_RECOVERF _UxGT("UnRet V") #define MSG_CONTROL_RETRACT_RECOVER_SWAPF _UxGT("S UnRet V") -#define MSG_AUTORETRACT _UxGT("Autom. Retract") +#define MSG_AUTORETRACT _UxGT("Autom. Rückzug") +#define MSG_FILAMENT_SWAP_LENGTH _UxGT("Rückzugslänge") +#define MSG_TOOL_CHANGE _UxGT("Werkzeugwechsel") +#define MSG_TOOL_CHANGE_ZLIFT _UxGT("Z anheben") +#define MSG_SINGLENOZZLE_PRIME_SPD _UxGT("Prime-Geschwin.") +#define MSG_SINGLENOZZLE_RETRACT_SPD _UxGT("Rückzug-Geschwin.") #define MSG_FILAMENTCHANGE _UxGT("Filament wechseln") #define MSG_FILAMENTLOAD _UxGT("Filament laden") #define MSG_FILAMENTUNLOAD _UxGT("Filament entladen") #define MSG_FILAMENTUNLOAD_ALL _UxGT("Alles entladen") -#define MSG_INIT_SDCARD _UxGT("SD-Karte erkennen") // Manually initialize the SD-card via user interface -#define MSG_CNG_SDCARD _UxGT("SD-Karte getauscht") // SD-card changed by user. For machines with no autocarddetect. Both send "M21" -#define MSG_ZPROBE_OUT _UxGT("Sensor ausserhalb") -#define MSG_SKEW_FACTOR _UxGT("Skew Faktor") +#define MSG_INIT_SDCARD _UxGT("SD-Karte initialisi.") // Manually initialize the SD-card via user interface +#define MSG_CHANGE_SDCARD _UxGT("SD-Karte getauscht") // SD-card changed by user. For machines with no autocarddetect. Both send "M21" +#define MSG_ZPROBE_OUT _UxGT("Z-Sonde außerhalb") +#define MSG_SKEW_FACTOR _UxGT("Korrekturfaktor") #define MSG_BLTOUCH _UxGT("BLTouch") -#define MSG_BLTOUCH_SELFTEST _UxGT("BLTouch Test") -#define MSG_BLTOUCH_RESET _UxGT("BLTouch Reset") +#define MSG_BLTOUCH_SELFTEST _UxGT("BLTouch Selbsttest") +#define MSG_BLTOUCH_RESET _UxGT("BLTouch zurücks.") #define MSG_BLTOUCH_DEPLOY _UxGT("BLTouch ausfahren") #define MSG_BLTOUCH_STOW _UxGT("BLTouch einfahren") -#define MSG_MANUAL_DEPLOY _UxGT("Z-Sensor anbringen") -#define MSG_MANUAL_STOW _UxGT("Z-Sensor entfernen") -#define MSG_HOME _UxGT("Vorher") // Used as MSG_HOME " " MSG_X MSG_Y MSG_Z " " MSG_FIRST +#define MSG_MANUAL_DEPLOY _UxGT("Z-Sonde ausfahren") +#define MSG_MANUAL_STOW _UxGT("Z-Sonde einfahren") +#define MSG_HOME _UxGT("Vorher") // Used as MSG_HOME " " MSG_X MSG_Y MSG_Z " " MSG_FIRST #define MSG_FIRST _UxGT("homen") -#define MSG_ZPROBE_ZOFFSET _UxGT("Z Versatz") +#define MSG_ZPROBE_ZOFFSET _UxGT("Sondenversatz Z") #define MSG_BABYSTEP_X _UxGT("Babystep X") #define MSG_BABYSTEP_Y _UxGT("Babystep Y") #define MSG_BABYSTEP_Z _UxGT("Babystep Z") -#define MSG_ENDSTOP_ABORT _UxGT("Endstopp-Abbr.") -#define MSG_HEATING_FAILED_LCD _UxGT("HEIZEN FEHLGESCHLAGEN") -#define MSG_ERR_REDUNDANT_TEMP _UxGT("REDUND. TEMPERATURABWEICHUNG") +#define MSG_ENDSTOP_ABORT _UxGT("Endstopp Abbr.") +#define MSG_HEATING_FAILED_LCD _UxGT("HEIZEN ERFOLGLOS") +#define MSG_HEATING_FAILED_LCD_BED _UxGT("Bett heizen fehlge.") +#define MSG_ERR_REDUNDANT_TEMP _UxGT("REDUND. TEMP-ABWEI.") #define MSG_THERMAL_RUNAWAY LCD_STR_THERMOMETER _UxGT(" NICHT ERREICHT") #define MSG_THERMAL_RUNAWAY_BED _UxGT("BETT") MSG_THERMAL_RUNAWAY #define MSG_ERR_MAXTEMP LCD_STR_THERMOMETER _UxGT(" ÜBERSCHRITTEN") @@ -217,12 +326,14 @@ #define MSG_ERR_MINTEMP_BED _UxGT("BETT ") LCD_STR_THERMOMETER _UxGT(" UNTERSCHRITTEN") #define MSG_ERR_Z_HOMING MSG_HOME _UxGT(" ") MSG_X MSG_Y _UxGT(" ") MSG_FIRST #define MSG_HALTED _UxGT("DRUCKER STOPP") -#define MSG_PLEASE_RESET _UxGT("Bitte Resetten") +#define MSG_PLEASE_RESET _UxGT("Bitte neustarten") #define MSG_SHORT_DAY _UxGT("t") // One character only #define MSG_SHORT_HOUR _UxGT("h") // One character only #define MSG_SHORT_MINUTE _UxGT("m") // One character only #define MSG_HEATING _UxGT("Extr. heizt...") +#define MSG_COOLING _UxGT("Extr. kühlt...") #define MSG_BED_HEATING _UxGT("Bett heizt...") +#define MSG_BED_COOLING _UxGT("Bett kühlt...") #define MSG_DELTA_CALIBRATE _UxGT("Delta kalibrieren") #define MSG_DELTA_CALIBRATE_X _UxGT("Kalibriere X") #define MSG_DELTA_CALIBRATE_Y _UxGT("Kalibriere Y") @@ -231,171 +342,99 @@ #define MSG_DELTA_SETTINGS _UxGT("Delta Einst. anzeig.") #define MSG_DELTA_AUTO_CALIBRATE _UxGT("Autom. Kalibrierung") #define MSG_DELTA_HEIGHT_CALIBRATE _UxGT("Delta Höhe setzen") +#define MSG_DELTA_Z_OFFSET_CALIBRATE _UxGT("Sondenversatz Z") #define MSG_DELTA_DIAG_ROD _UxGT("Diag Rod") #define MSG_DELTA_HEIGHT _UxGT("Höhe") #define MSG_DELTA_RADIUS _UxGT("Radius") #define MSG_INFO_MENU _UxGT("Über den Drucker") -#define MSG_INFO_PRINTER_MENU _UxGT("Drucker Info") -#define MSG_3POINT_LEVELING _UxGT("3-Punkt Nivellierung") +#define MSG_INFO_PRINTER_MENU _UxGT("Drucker-Info") +#define MSG_3POINT_LEVELING _UxGT("3-Punkt-Nivellierung") #define MSG_LINEAR_LEVELING _UxGT("Lineare Nivellierung") #define MSG_BILINEAR_LEVELING _UxGT("Bilineare Nivell.") #define MSG_UBL_LEVELING _UxGT("Unified Bed Leveling") -#define MSG_MESH_LEVELING _UxGT("Netz Nivellierung") -#define MSG_INFO_STATS_MENU _UxGT("Drucker Statistik") -#define MSG_INFO_BOARD_MENU _UxGT("Board Info") +#define MSG_MESH_LEVELING _UxGT("Netz-Nivellierung") +#define MSG_INFO_STATS_MENU _UxGT("Drucker-Statistik") +#define MSG_INFO_BOARD_MENU _UxGT("Board-Info") #define MSG_INFO_THERMISTOR_MENU _UxGT("Thermistoren") #define MSG_INFO_EXTRUDERS _UxGT("Extruder") -#define MSG_INFO_BAUDRATE _UxGT("Baud") +#define MSG_INFO_BAUDRATE _UxGT("Baudrate") #define MSG_INFO_PROTOCOL _UxGT("Protokoll") #define MSG_CASE_LIGHT _UxGT("Beleuchtung") #define MSG_CASE_LIGHT_BRIGHTNESS _UxGT("Helligkeit") -#define MSG_UBL_DOING_G29 _UxGT("G29 UBL läuft!") -#define MSG_UBL_UNHOMED _UxGT("Erst XYZ homen") -#define MSG_UBL_TOOLS _UxGT("UBL Werkzeuge") -#define MSG_UBL_LEVEL_BED _UxGT("Unified Bed Leveling") -#define MSG_UBL_MANUAL_MESH _UxGT("Netz manuell erst.") -#define MSG_UBL_BC_INSERT _UxGT("Unterlegen & messen") -#define MSG_UBL_BC_INSERT2 _UxGT("Messen") -#define MSG_UBL_BC_REMOVE _UxGT("Entfernen & messen") -#define MSG_UBL_MOVING_TO_NEXT _UxGT("Nächster Punkt...") -#define MSG_UBL_ACTIVATE_MESH _UxGT("UBL aktivieren") -#define MSG_UBL_DEACTIVATE_MESH _UxGT("UBL deaktivieren") -#define MSG_UBL_SET_BED_TEMP _UxGT("Bett Temp.") -#define MSG_UBL_CUSTOM_BED_TEMP MSG_UBL_SET_BED_TEMP -#define MSG_UBL_SET_HOTEND_TEMP _UxGT("Hotend Temp.") -#define MSG_UBL_CUSTOM_HOTEND_TEMP MSG_UBL_SET_HOTEND_TEMP -#define MSG_UBL_MESH_EDIT _UxGT("Netz bearbeiten") -#define MSG_UBL_EDIT_CUSTOM_MESH _UxGT("Eigenes Netz bearb.") -#define MSG_UBL_FINE_TUNE_MESH _UxGT("Feineinstellung...") -#define MSG_UBL_DONE_EDITING_MESH _UxGT("Bearbeitung beendet") -#define MSG_UBL_BUILD_CUSTOM_MESH _UxGT("Eigenes Netz erst.") -#define MSG_UBL_BUILD_MESH_MENU _UxGT("Netz erstellen") -#define MSG_UBL_BUILD_PLA_MESH _UxGT("Netz erstellen PLA") -#define MSG_UBL_BUILD_ABS_MESH _UxGT("Netz erstellen ABS") -#define MSG_UBL_BUILD_COLD_MESH _UxGT("Netz erstellen kalt") -#define MSG_UBL_MESH_HEIGHT_ADJUST _UxGT("Netz Höhe einst.") -#define MSG_UBL_MESH_HEIGHT_AMOUNT _UxGT("Höhe") -#define MSG_UBL_VALIDATE_MESH_MENU _UxGT("Netz validieren") -#define MSG_UBL_VALIDATE_PLA_MESH _UxGT("Netz validieren PLA") -#define MSG_UBL_VALIDATE_ABS_MESH _UxGT("Netz validieren ABS") -#define MSG_UBL_VALIDATE_CUSTOM_MESH _UxGT("Eig. Netz validieren") -#define MSG_UBL_CONTINUE_MESH _UxGT("Netzerst. forts.") -#define MSG_UBL_MESH_LEVELING _UxGT("Netz Nivellierung") -#define MSG_UBL_3POINT_MESH_LEVELING _UxGT("3-Punkt Nivellierung") -#define MSG_UBL_GRID_MESH_LEVELING _UxGT("Gitternetz Nivell.") -#define MSG_UBL_MESH_LEVEL _UxGT("Netz nivellieren") -#define MSG_UBL_SIDE_POINTS _UxGT("Eckpunkte") -#define MSG_UBL_MAP_TYPE _UxGT("Kartentyp") -#define MSG_UBL_OUTPUT_MAP _UxGT("Karte ausgeben") -#define MSG_UBL_OUTPUT_MAP_HOST _UxGT("Ausgabe für Host") -#define MSG_UBL_OUTPUT_MAP_CSV _UxGT("Ausgabe für CSV") -#define MSG_UBL_OUTPUT_MAP_BACKUP _UxGT("Externe Sicherung") -#define MSG_UBL_INFO_UBL _UxGT("UBL Info ausgeben") -#define MSG_UBL_EDIT_MESH_MENU _UxGT("Netz bearbeiten") -#define MSG_UBL_FILLIN_AMOUNT _UxGT("Menge an Fill-in") -#define MSG_UBL_MANUAL_FILLIN _UxGT("Manuelles Fill-in") -#define MSG_UBL_SMART_FILLIN _UxGT("Kluges Fill-in") -#define MSG_UBL_FILLIN_MESH _UxGT("Fill-in Netz") -#define MSG_UBL_INVALIDATE_ALL _UxGT("Alles annullieren") -#define MSG_UBL_INVALIDATE_CLOSEST _UxGT("Nächstlieg. ann.") -#define MSG_UBL_FINE_TUNE_ALL _UxGT("Feineinstellung Alle") -#define MSG_UBL_FINE_TUNE_CLOSEST _UxGT("Feineinst. Nächstl.") -#define MSG_UBL_STORAGE_MESH_MENU _UxGT("Netz Speicherplatz") -#define MSG_UBL_STORAGE_SLOT _UxGT("Memory Slot") -#define MSG_UBL_LOAD_MESH _UxGT("Bett Netz laden") -#define MSG_UBL_SAVE_MESH _UxGT("Bett Netz speichern") -#define MSG_MESH_LOADED _UxGT("Netz %i geladen") -#define MSG_MESH_SAVED _UxGT("Netz %i gespeichert") -#define MSG_NO_STORAGE _UxGT("Kein Speicher") -#define MSG_UBL_SAVE_ERROR _UxGT("ERR:UBL speichern") -#define MSG_UBL_RESTORE_ERROR _UxGT("ERR:UBL wiederherst.") -#define MSG_UBL_Z_OFFSET_STOPPED _UxGT("Z-Versatz angehalten") -#define MSG_UBL_STEP_BY_STEP_MENU _UxGT("Schrittweises UBL") - -#define MSG_LED_CONTROL _UxGT("LED Kontrolle") -#define MSG_LEDS _UxGT("Licht") -#define MSG_LED_PRESETS _UxGT("Licht Einstellungen") -#define MSG_SET_LEDS_RED _UxGT("Rot") -#define MSG_SET_LEDS_ORANGE _UxGT("Orange") -#define MSG_SET_LEDS_YELLOW _UxGT("Gelb") -#define MSG_SET_LEDS_GREEN _UxGT("Grün") -#define MSG_SET_LEDS_BLUE _UxGT("Blau") -#define MSG_SET_LEDS_INDIGO _UxGT("Indigo") -#define MSG_SET_LEDS_VIOLET _UxGT("Violett") -#define MSG_SET_LEDS_WHITE _UxGT("Weiß") -#define MSG_SET_LEDS_DEFAULT _UxGT("Standard") -#define MSG_CUSTOM_LEDS _UxGT("Benutzerdef.") -#define MSG_INTENSITY_R _UxGT("Intensität Rot") -#define MSG_INTENSITY_G _UxGT("Intensität Grün") -#define MSG_INTENSITY_B _UxGT("Intensität Blau") -#define MSG_INTENSITY_W _UxGT("Intensität Weiß") -#define MSG_LED_BRIGHTNESS _UxGT("Helligkeit") - #if LCD_WIDTH >= 20 #define MSG_INFO_PRINT_COUNT _UxGT("Gesamte Drucke") - #define MSG_INFO_COMPLETED_PRINTS _UxGT("Beendete Drucke") + #define MSG_INFO_COMPLETED_PRINTS _UxGT("Komplette Drucke") #define MSG_INFO_PRINT_TIME _UxGT("Gesamte Druckzeit") - #define MSG_INFO_PRINT_LONGEST _UxGT("Längster Druckjob") + #define MSG_INFO_PRINT_LONGEST _UxGT("Längste Druckzeit") #define MSG_INFO_PRINT_FILAMENT _UxGT("Gesamt Extrudiert") #else #define MSG_INFO_PRINT_COUNT _UxGT("Drucke") - #define MSG_INFO_COMPLETED_PRINTS _UxGT("Komplett") - #define MSG_INFO_PRINT_TIME _UxGT("Gesamt ") - #define MSG_INFO_PRINT_LONGEST _UxGT("Längster") + #define MSG_INFO_COMPLETED_PRINTS _UxGT("Komplette") + #define MSG_INFO_PRINT_TIME _UxGT("Gesamte") + #define MSG_INFO_PRINT_LONGEST _UxGT("Längste") #define MSG_INFO_PRINT_FILAMENT _UxGT("Extrud.") #endif #define MSG_INFO_MIN_TEMP _UxGT("Min Temp") #define MSG_INFO_MAX_TEMP _UxGT("Max Temp") #define MSG_INFO_PSU _UxGT("Netzteil") - -#define MSG_DRIVE_STRENGTH _UxGT("Motorströme") +#define MSG_DRIVE_STRENGTH _UxGT("Treiberstärke") #define MSG_DAC_PERCENT _UxGT("Treiber %") #define MSG_DAC_EEPROM_WRITE _UxGT("Werte speichern") #define MSG_FILAMENT_CHANGE_HEADER_PAUSE _UxGT("DRUCK PAUSIERT") #define MSG_FILAMENT_CHANGE_HEADER_LOAD _UxGT("FILAMENT LADEN") #define MSG_FILAMENT_CHANGE_HEADER_UNLOAD _UxGT("FILAMENT ENTLADEN") #define MSG_FILAMENT_CHANGE_OPTION_HEADER _UxGT("FORTS. OPTIONEN:") -#define MSG_FILAMENT_CHANGE_OPTION_PURGE _UxGT("Mehr entleeren") -#define MSG_FILAMENT_CHANGE_OPTION_RESUME _UxGT("Drucke weiter") +#define MSG_FILAMENT_CHANGE_OPTION_PURGE _UxGT("Mehr entladen") +#define MSG_FILAMENT_CHANGE_OPTION_RESUME _UxGT("Druck weiter") #define MSG_FILAMENT_CHANGE_NOZZLE _UxGT(" Düse: ") +#define MSG_RUNOUT_SENSOR_ENABLE _UxGT("Auslaufsensor") #define MSG_ERR_HOMING_FAILED _UxGT("Homing gescheitert") #define MSG_ERR_PROBING_FAILED _UxGT("Probing gescheitert") -#define MSG_M600_TOO_COLD _UxGT("M600: Zu kalt") -#if LCD_HEIGHT >= 4 - // Up to 3 lines allowed - #define MSG_FILAMENT_CHANGE_INIT_1 _UxGT("Warte auf den") - #define MSG_FILAMENT_CHANGE_INIT_2 _UxGT("Start des") - #define MSG_FILAMENT_CHANGE_INIT_3 _UxGT("Filamentwechsels") - #define MSG_FILAMENT_CHANGE_UNLOAD_1 _UxGT("Warte auf") - #define MSG_FILAMENT_CHANGE_UNLOAD_2 _UxGT("Herausnahme") - #define MSG_FILAMENT_CHANGE_UNLOAD_3 _UxGT("des Filaments...") - #define MSG_FILAMENT_CHANGE_INSERT_1 _UxGT("Filament einlegen") - #define MSG_FILAMENT_CHANGE_INSERT_2 _UxGT("und Knopf") - #define MSG_FILAMENT_CHANGE_INSERT_3 _UxGT("drücken...") - #define MSG_FILAMENT_CHANGE_HEAT_1 _UxGT("Knopf drücken um") - #define MSG_FILAMENT_CHANGE_HEAT_2 _UxGT("Düse aufzuheizen.") - #define MSG_FILAMENT_CHANGE_HEATING_1 _UxGT("Düse heizt auf...") - #define MSG_FILAMENT_CHANGE_HEATING_2 _UxGT("Bitte warten...") - #define MSG_FILAMENT_CHANGE_LOAD_1 _UxGT("Warte auf") - #define MSG_FILAMENT_CHANGE_LOAD_2 _UxGT("Laden des") - #define MSG_FILAMENT_CHANGE_LOAD_3 _UxGT("Filaments") - #define MSG_FILAMENT_CHANGE_PURGE_1 _UxGT("Warte auf") - #define MSG_FILAMENT_CHANGE_PURGE_2 _UxGT("Entleeren des") - #define MSG_FILAMENT_CHANGE_PURGE_3 _UxGT("Filaments") - #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Warte auf") - #define MSG_FILAMENT_CHANGE_RESUME_2 _UxGT("Fortsetzung des") - #define MSG_FILAMENT_CHANGE_RESUME_3 _UxGT("Druckes...") -#else // LCD_HEIGHT < 4 - // Up to 2 lines allowed - #define MSG_FILAMENT_CHANGE_INIT_1 _UxGT("Bitte warten...") - #define MSG_FILAMENT_CHANGE_UNLOAD_1 _UxGT("Auswerfen...") - #define MSG_FILAMENT_CHANGE_INSERT_1 _UxGT("Laden und Klick") - #define MSG_FILAMENT_CHANGE_HEATING_1 _UxGT("Heizen...") - #define MSG_FILAMENT_CHANGE_LOAD_1 _UxGT("Laden...") - #define MSG_FILAMENT_CHANGE_PURGE_1 _UxGT("Entleeren...") - #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Fortsetzen...") -#endif // LCD_HEIGHT < 4 +#define MSG_M600_TOO_COLD _UxGT("M600: zu kalt") -#endif // LANGUAGE_DE_H +// +// Die Filament-Change-Bildschirme können bis zu 3 Zeilen auf einem 4-Zeilen-Display anzeigen +// ...oder 2 Zeilen auf einem 3-Zeilen-Display. +#if LCD_HEIGHT >= 4 + #define MSG_ADVANCED_PAUSE_WAITING_1 _UxGT("Knopf drücken um") + #define MSG_ADVANCED_PAUSE_WAITING_2 _UxGT("Druck fortzusetzen") + #define MSG_FILAMENT_CHANGE_INIT_1 _UxGT("Warte auf den") + #define MSG_FILAMENT_CHANGE_INIT_2 _UxGT("Start des") + #define MSG_FILAMENT_CHANGE_INIT_3 _UxGT("Filamentwechsels...") + #define MSG_FILAMENT_CHANGE_INSERT_1 _UxGT("Filament einlegen") + #define MSG_FILAMENT_CHANGE_INSERT_2 _UxGT("und Knopf drücken") + #define MSG_FILAMENT_CHANGE_INSERT_3 _UxGT("um fortzusetzen") + #define MSG_FILAMENT_CHANGE_HEAT_1 _UxGT("Knopf drücken um") + #define MSG_FILAMENT_CHANGE_HEAT_2 _UxGT("Düse aufzuheizen") + #define MSG_FILAMENT_CHANGE_HEATING_1 _UxGT("Düse heizt auf") + #define MSG_FILAMENT_CHANGE_HEATING_2 _UxGT("bitte warten...") + #define MSG_FILAMENT_CHANGE_UNLOAD_1 _UxGT("Warte auf") + #define MSG_FILAMENT_CHANGE_UNLOAD_2 _UxGT("Herausnahme") + #define MSG_FILAMENT_CHANGE_UNLOAD_3 _UxGT("des Filaments...") + #define MSG_FILAMENT_CHANGE_LOAD_1 _UxGT("Warte auf") + #define MSG_FILAMENT_CHANGE_LOAD_2 _UxGT("Laden des") + #define MSG_FILAMENT_CHANGE_LOAD_3 _UxGT("Filaments...") + #define MSG_FILAMENT_CHANGE_PURGE_1 _UxGT("Warte auf") + #define MSG_FILAMENT_CHANGE_PURGE_2 _UxGT("Entladen des") + #define MSG_FILAMENT_CHANGE_PURGE_3 _UxGT("Filaments...") + #define MSG_FILAMENT_CHANGE_CONT_PURGE_1 _UxGT("Klicke um") + #define MSG_FILAMENT_CHANGE_CONT_PURGE_2 _UxGT("die Fila-Entladung") + #define MSG_FILAMENT_CHANGE_CONT_PURGE_3 _UxGT("zu beenden") + #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Warte auf") + #define MSG_FILAMENT_CHANGE_RESUME_2 _UxGT("Fortsetzen des") + #define MSG_FILAMENT_CHANGE_RESUME_3 _UxGT("Drucks...") +#else // LCD_HEIGHT < 4 + #define MSG_ADVANCED_PAUSE_WAITING_1 MSG_USERWAIT + #define MSG_FILAMENT_CHANGE_INIT_1 _UxGT("Bitte warten...") + #define MSG_FILAMENT_CHANGE_INSERT_1 _UxGT("Laden und Klick") + #define MSG_FILAMENT_CHANGE_HEAT_1 _UxGT("Klick zum Heizen") + #define MSG_FILAMENT_CHANGE_HEATING_1 _UxGT("Heizen...") + #define MSG_FILAMENT_CHANGE_UNLOAD_1 _UxGT("Entladen...") + #define MSG_FILAMENT_CHANGE_LOAD_1 _UxGT("Laden...") + #define MSG_FILAMENT_CHANGE_PURGE_1 _UxGT("Entladen...") + #define MSG_FILAMENT_CHANGE_CONT_PURGE_1 _UxGT("Klick zum beenden") + #define MSG_FILAMENT_CHANGE_CONT_PURGE_2 _UxGT("der Fila-Entladung") + #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Fortsetzen...") +#endif // LCD_HEIGHT < 4 diff --git a/Marlin/src/lcd/language/language_el-gr.h b/Marlin/src/lcd/language/language_el-gr.h index 04a1198f32..85c2b82114 100644 --- a/Marlin/src/lcd/language/language_el-gr.h +++ b/Marlin/src/lcd/language/language_el-gr.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Greek (Greece) @@ -27,8 +28,6 @@ * See also http://marlinfw.org/docs/development/lcd_language.html * */ -#ifndef LANGUAGE_EL_GR_H -#define LANGUAGE_EL_GR_H #define DISPLAY_CHARSET_ISO10646_GREEK #define CHARSIZE 2 @@ -52,12 +51,12 @@ #define MSG_SET_HOME_OFFSETS _UxGT("Ορισμός βασικών μετατοπίσεων") #define MSG_HOME_OFFSETS_APPLIED _UxGT("Εφαρμόστηκαν οι μετατοπίσεις") #define MSG_SET_ORIGIN _UxGT("Ορισμός προέλευσης") -#define MSG_PREHEAT_1 _UxGT("Προθέρμανση PLA") +#define MSG_PREHEAT_1 _UxGT("Προθέρμανση " PREHEAT_1_LABEL) #define MSG_PREHEAT_1_N MSG_PREHEAT_1 _UxGT(" ") #define MSG_PREHEAT_1_ALL MSG_PREHEAT_1 _UxGT(" όλα") #define MSG_PREHEAT_1_BEDONLY MSG_PREHEAT_1 _UxGT(" κλίνη") #define MSG_PREHEAT_1_SETTINGS MSG_PREHEAT_1 _UxGT(" επιβεβαίωση") -#define MSG_PREHEAT_2 _UxGT("Προθέρμανση ABS") +#define MSG_PREHEAT_2 _UxGT("Προθέρμανση " PREHEAT_2_LABEL) #define MSG_PREHEAT_2_N MSG_PREHEAT_2 _UxGT(" ") #define MSG_PREHEAT_2_ALL MSG_PREHEAT_2 _UxGT(" όλα") #define MSG_PREHEAT_2_BEDONLY MSG_PREHEAT_2 _UxGT(" Bed") @@ -88,8 +87,8 @@ #define MSG_MAX _UxGT(" ") LCD_STR_THERMOMETER _UxGT(" Max") #define MSG_FACTOR _UxGT(" ") LCD_STR_THERMOMETER _UxGT(" Fact") #define MSG_AUTOTEMP _UxGT("Αυτομ. ρύθμιση θερμοκρασίας") -#define MSG_ON _UxGT("Ενεργοποιημένο") -#define MSG_OFF _UxGT("Απενεργοποιημένο") +#define MSG_LCD_ON _UxGT("Ενεργοποιημένο") +#define MSG_LCD_OFF _UxGT("Απενεργοποιημένο") #define MSG_PID_P _UxGT("PID-P") #define MSG_PID_I _UxGT("PID-I") #define MSG_PID_D _UxGT("PID-D") @@ -156,14 +155,14 @@ #define MSG_CONTROL_RETRACT _UxGT("Ανάσυρση μμ") #define MSG_CONTROL_RETRACT_SWAP _UxGT("Εναλλαγή ανάσυρσης μμ") #define MSG_CONTROL_RETRACTF _UxGT("Ανάσυρση V") -#define MSG_CONTROL_RETRACT_ZLIFT _UxGT("Μεταπήδηση μμ") +#define MSG_CONTROL_RETRACT_ZHOP _UxGT("Μεταπήδηση μμ") #define MSG_CONTROL_RETRACT_RECOVER _UxGT("UnRet mm") #define MSG_CONTROL_RETRACT_RECOVER_SWAP _UxGT("S UnRet mm") #define MSG_CONTROL_RETRACT_RECOVERF _UxGT("UnRet V") #define MSG_AUTORETRACT _UxGT("Αυτόματη ανάσυρση") #define MSG_FILAMENTCHANGE _UxGT("Αλλαγή νήματος") #define MSG_INIT_SDCARD _UxGT("Προετοιμασία κάρτας SD") -#define MSG_CNG_SDCARD _UxGT("Αλλαγή κάρτας SD") +#define MSG_CHANGE_SDCARD _UxGT("Αλλαγή κάρτας SD") #define MSG_ZPROBE_OUT _UxGT("Διερεύνηση Z εκτός κλίνης") #define MSG_YX_UNHOMED _UxGT("Επαναφορά Χ/Υ πριν από Ζ") #define MSG_XYZ_UNHOMED _UxGT("Επαναφορά ΧΥΖ πρώτα") @@ -186,5 +185,3 @@ #define MSG_DELTA_CALIBRATE_Y _UxGT("Βαθμονόμηση Y") #define MSG_DELTA_CALIBRATE_Z _UxGT("Βαθμονόμηση Z") #define MSG_DELTA_CALIBRATE_CENTER _UxGT("Βαθμονόμηση κέντρου") - -#endif // LANGUAGE_EL_GR_H diff --git a/Marlin/src/lcd/language/language_el.h b/Marlin/src/lcd/language/language_el.h index 2a90098308..38ae18cbfa 100644 --- a/Marlin/src/lcd/language/language_el.h +++ b/Marlin/src/lcd/language/language_el.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Greek @@ -27,8 +28,6 @@ * See also http://marlinfw.org/docs/development/lcd_language.html * */ -#ifndef LANGUAGE_EL_H -#define LANGUAGE_EL_H #define DISPLAY_CHARSET_ISO10646_GREEK #define CHARSIZE 2 @@ -52,12 +51,12 @@ #define MSG_SET_HOME_OFFSETS _UxGT("Ορισμός βασικών μετατοπίσεων") //SHORTEN #define MSG_HOME_OFFSETS_APPLIED _UxGT("Εφαρμόστηκαν οι μετατοπίσεις") //SHORTEN #define MSG_SET_ORIGIN _UxGT("Ορισμός προέλευσης") -#define MSG_PREHEAT_1 _UxGT("Προθέρμανση PLA") +#define MSG_PREHEAT_1 _UxGT("Προθέρμανση " PREHEAT_1_LABEL) #define MSG_PREHEAT_1_N MSG_PREHEAT_1 _UxGT(" ") #define MSG_PREHEAT_1_ALL MSG_PREHEAT_1 _UxGT(" όλα") #define MSG_PREHEAT_1_BEDONLY MSG_PREHEAT_1 _UxGT(" bed") //SHORTEN #define MSG_PREHEAT_1_SETTINGS MSG_PREHEAT_1 _UxGT(" επιβεβαίωση") //SHORTEN -#define MSG_PREHEAT_2 _UxGT("Προθέρμανση ABS") +#define MSG_PREHEAT_2 _UxGT("Προθέρμανση " PREHEAT_2_LABEL) #define MSG_PREHEAT_2_N MSG_PREHEAT_2 _UxGT(" ") #define MSG_PREHEAT_2_ALL MSG_PREHEAT_2 _UxGT(" όλα") #define MSG_PREHEAT_2_BEDONLY MSG_PREHEAT_2 _UxGT(" bed") //SHORTEN @@ -88,8 +87,8 @@ #define MSG_MAX _UxGT(" ") LCD_STR_THERMOMETER _UxGT(" Max") #define MSG_FACTOR _UxGT(" ") LCD_STR_THERMOMETER _UxGT(" Fact") #define MSG_AUTOTEMP _UxGT("Αυτομ ρύθμιση θερ/σίας") //SHORTEN -#define MSG_ON _UxGT("Ενεργοποιημένο") -#define MSG_OFF _UxGT("Απενεργοποιημένο") +#define MSG_LCD_ON _UxGT("Ενεργοποιημένο") +#define MSG_LCD_OFF _UxGT("Απενεργοποιημένο") #define MSG_PID_P _UxGT("PID-P") #define MSG_PID_I _UxGT("PID-I") #define MSG_PID_D _UxGT("PID-D") @@ -156,14 +155,14 @@ #define MSG_CONTROL_RETRACT _UxGT("Ανάσυρση μμ") #define MSG_CONTROL_RETRACT_SWAP _UxGT("Εναλλαγή ανάσυρσης μμ") //SHORTEN #define MSG_CONTROL_RETRACTF _UxGT("Ανάσυρση V") -#define MSG_CONTROL_RETRACT_ZLIFT _UxGT("Μεταπήδηση μμ") +#define MSG_CONTROL_RETRACT_ZHOP _UxGT("Μεταπήδηση μμ") #define MSG_CONTROL_RETRACT_RECOVER _UxGT("UnRet mm") #define MSG_CONTROL_RETRACT_RECOVER_SWAP _UxGT("S UnRet mm") #define MSG_CONTROL_RETRACT_RECOVERF _UxGT("UnRet V") #define MSG_AUTORETRACT _UxGT("Αυτόματη ανάσυρση") #define MSG_FILAMENTCHANGE _UxGT("Αλλαγή νήματος") #define MSG_INIT_SDCARD _UxGT("Προετοιμασία κάρτας SD") //SHORTEN -#define MSG_CNG_SDCARD _UxGT("Αλλαγή κάρτας SD") +#define MSG_CHANGE_SDCARD _UxGT("Αλλαγή κάρτας SD") #define MSG_ZPROBE_OUT _UxGT("Διερεύνηση Z εκτός Επ.Εκτύπωσης") //SHORTEN #define MSG_YX_UNHOMED _UxGT("Επαναφορά Χ/Υ πριν από Ζ") //SHORTEN #define MSG_XYZ_UNHOMED _UxGT("Επαναφορά ΧΥΖ πρώτα") @@ -187,5 +186,3 @@ #define MSG_DELTA_CALIBRATE_Y _UxGT("Βαθμονόμηση Y") #define MSG_DELTA_CALIBRATE_Z _UxGT("Βαθμονόμηση Z") #define MSG_DELTA_CALIBRATE_CENTER _UxGT("Βαθμονόμηση κέντρου") - -#endif // LANGUAGE_EL_H diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index 687d4cc44d..fc030a71cc 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * English @@ -27,12 +28,11 @@ * See also http://marlinfw.org/docs/development/lcd_language.html * */ -#ifndef LANGUAGE_EN_H -#define LANGUAGE_EN_H #define en 1234 #if LCD_LANGUAGE == en #define NOT_EXTENDED_ISO10646_1_5X7 + #define THIS_LANGUAGES_SPECIAL_SYMBOLS _UxGT("³") #endif #undef en @@ -91,6 +91,9 @@ #ifndef MSG_AUTO_HOME_Z #define MSG_AUTO_HOME_Z _UxGT("Home Z") #endif +#ifndef MSG_AUTO_Z_ALIGN + #define MSG_AUTO_Z_ALIGN _UxGT("Auto Z-Align") +#endif #ifndef MSG_TMC_Z_CALIBRATION #define MSG_TMC_Z_CALIBRATION _UxGT("Calibrate Z") #endif @@ -119,7 +122,7 @@ #define MSG_SET_ORIGIN _UxGT("Set origin") #endif #ifndef MSG_PREHEAT_1 - #define MSG_PREHEAT_1 _UxGT("Preheat PLA") + #define MSG_PREHEAT_1 _UxGT("Preheat " PREHEAT_1_LABEL) #endif #ifndef MSG_PREHEAT_1_N #define MSG_PREHEAT_1_N MSG_PREHEAT_1 _UxGT(" ") @@ -137,7 +140,7 @@ #define MSG_PREHEAT_1_SETTINGS MSG_PREHEAT_1 _UxGT(" conf") #endif #ifndef MSG_PREHEAT_2 - #define MSG_PREHEAT_2 _UxGT("Preheat ABS") + #define MSG_PREHEAT_2 _UxGT("Preheat " PREHEAT_2_LABEL) #endif #ifndef MSG_PREHEAT_2_N #define MSG_PREHEAT_2_N MSG_PREHEAT_2 _UxGT(" ") @@ -190,6 +193,15 @@ #ifndef MSG_EDITING_STOPPED #define MSG_EDITING_STOPPED _UxGT("Mesh Editing Stopped") #endif +#ifndef MSG_MESH_X + #define MSG_MESH_X _UxGT("Index X") +#endif +#ifndef MSG_MESH_Y + #define MSG_MESH_Y _UxGT("Index Y") +#endif +#ifndef MSG_MESH_EDIT_Z + #define MSG_MESH_EDIT_Z _UxGT("Z Value") +#endif #ifndef MSG_USER_MENU #define MSG_USER_MENU _UxGT("Custom Commands") #endif @@ -253,17 +265,17 @@ #ifndef MSG_UBL_DEACTIVATE_MESH #define MSG_UBL_DEACTIVATE_MESH _UxGT("Deactivate UBL") #endif -#ifndef MSG_UBL_SET_BED_TEMP - #define MSG_UBL_SET_BED_TEMP _UxGT("Bed Temp") +#ifndef MSG_UBL_SET_TEMP_BED + #define MSG_UBL_SET_TEMP_BED _UxGT("Bed Temp") #endif -#ifndef MSG_UBL_CUSTOM_BED_TEMP - #define MSG_UBL_CUSTOM_BED_TEMP MSG_UBL_SET_BED_TEMP +#ifndef MSG_UBL_BED_TEMP_CUSTOM + #define MSG_UBL_BED_TEMP_CUSTOM MSG_UBL_SET_TEMP_BED #endif -#ifndef MSG_UBL_SET_HOTEND_TEMP - #define MSG_UBL_SET_HOTEND_TEMP _UxGT("Hotend Temp") +#ifndef MSG_UBL_SET_TEMP_HOTEND + #define MSG_UBL_SET_TEMP_HOTEND _UxGT("Hotend Temp") #endif -#ifndef MSG_UBL_CUSTOM_HOTEND_TEMP - #define MSG_UBL_CUSTOM_HOTEND_TEMP MSG_UBL_SET_HOTEND_TEMP +#ifndef MSG_UBL_HOTEND_TEMP_CUSTOM + #define MSG_UBL_HOTEND_TEMP_CUSTOM MSG_UBL_SET_TEMP_HOTEND #endif #ifndef MSG_UBL_MESH_EDIT #define MSG_UBL_MESH_EDIT _UxGT("Mesh Edit") @@ -283,11 +295,11 @@ #ifndef MSG_UBL_BUILD_MESH_MENU #define MSG_UBL_BUILD_MESH_MENU _UxGT("Build Mesh") #endif -#ifndef MSG_UBL_BUILD_PLA_MESH - #define MSG_UBL_BUILD_PLA_MESH _UxGT("Build PLA Mesh") +#ifndef MSG_UBL_BUILD_MESH_M1 + #define MSG_UBL_BUILD_MESH_M1 _UxGT("Build Mesh (" PREHEAT_1_LABEL ")") #endif -#ifndef MSG_UBL_BUILD_ABS_MESH - #define MSG_UBL_BUILD_ABS_MESH _UxGT("Build ABS Mesh") +#ifndef MSG_UBL_BUILD_MESH_M2 + #define MSG_UBL_BUILD_MESH_M2 _UxGT("Build Mesh (" PREHEAT_2_LABEL ")") #endif #ifndef MSG_UBL_BUILD_COLD_MESH #define MSG_UBL_BUILD_COLD_MESH _UxGT("Build Cold Mesh") @@ -301,11 +313,11 @@ #ifndef MSG_UBL_VALIDATE_MESH_MENU #define MSG_UBL_VALIDATE_MESH_MENU _UxGT("Validate Mesh") #endif -#ifndef MSG_UBL_VALIDATE_PLA_MESH - #define MSG_UBL_VALIDATE_PLA_MESH _UxGT("Validate PLA Mesh") +#ifndef MSG_UBL_VALIDATE_MESH_M1 + #define MSG_UBL_VALIDATE_MESH_M1 _UxGT("Validate Mesh (" PREHEAT_1_LABEL ")") #endif -#ifndef MSG_UBL_VALIDATE_ABS_MESH - #define MSG_UBL_VALIDATE_ABS_MESH _UxGT("Validate ABS Mesh") +#ifndef MSG_UBL_VALIDATE_MESH_M2 + #define MSG_UBL_VALIDATE_MESH_M2 _UxGT("Validate Mesh (" PREHEAT_2_LABEL ")") #endif #ifndef MSG_UBL_VALIDATE_CUSTOM_MESH #define MSG_UBL_VALIDATE_CUSTOM_MESH _UxGT("Validate Custom Mesh") @@ -346,8 +358,8 @@ #ifndef MSG_UBL_INFO_UBL #define MSG_UBL_INFO_UBL _UxGT("Output UBL Info") #endif -#ifndef MSG_UBL_EDIT_MESH_MENU - #define MSG_UBL_EDIT_MESH_MENU _UxGT("Edit Mesh") +#ifndef MSG_EDIT_MESH + #define MSG_EDIT_MESH _UxGT("Edit Mesh") #endif #ifndef MSG_UBL_FILLIN_AMOUNT #define MSG_UBL_FILLIN_AMOUNT _UxGT("Fill-in Amount") @@ -480,6 +492,9 @@ #ifndef MSG_MOVE_E #define MSG_MOVE_E _UxGT("Extruder") #endif +#ifndef MSG_HOTEND_TOO_COLD + #define MSG_HOTEND_TOO_COLD _UxGT("Hotend too cold") +#endif #ifndef MSG_MOVE_01MM #define MSG_MOVE_01MM _UxGT("Move 0.1mm") #endif @@ -525,11 +540,11 @@ #ifndef MSG_AUTOTEMP #define MSG_AUTOTEMP _UxGT("Autotemp") #endif -#ifndef MSG_ON - #define MSG_ON _UxGT("On ") +#ifndef MSG_LCD_ON + #define MSG_LCD_ON _UxGT("On") #endif -#ifndef MSG_OFF - #define MSG_OFF _UxGT("Off") +#ifndef MSG_LCD_OFF + #define MSG_LCD_OFF _UxGT("Off") #endif #ifndef MSG_PID_P #define MSG_PID_P _UxGT("PID-P") @@ -648,9 +663,6 @@ #ifndef MSG_E6STEPS #define MSG_E6STEPS _UxGT("E6steps/mm") #endif -#ifndef MSG_E6STEPS - #define MSG_E6STEPS _UxGT("E6steps/mm") -#endif #ifndef MSG_TEMPERATURE #define MSG_TEMPERATURE _UxGT("Temperature") #endif @@ -661,7 +673,7 @@ #define MSG_FILAMENT _UxGT("Filament") #endif #ifndef MSG_VOLUMETRIC_ENABLED - #define MSG_VOLUMETRIC_ENABLED _UxGT("E in mm3") + #define MSG_VOLUMETRIC_ENABLED _UxGT("E in mm³") #endif #ifndef MSG_FILAMENT_DIAM #define MSG_FILAMENT_DIAM _UxGT("Fil. Dia.") @@ -690,6 +702,12 @@ #ifndef MSG_INIT_EEPROM #define MSG_INIT_EEPROM _UxGT("Initialize EEPROM") #endif +#ifndef MSG_SD_UPDATE + #define MSG_SD_UPDATE _UxGT("SD Update") +#endif +#ifndef MSG_RESET_PRINTER + #define MSG_RESET_PRINTER _UxGT("Reset Printer") +#endif #ifndef MSG_REFRESH #define MSG_REFRESH _UxGT("Refresh") #endif @@ -711,8 +729,8 @@ #ifndef MSG_STOP_PRINT #define MSG_STOP_PRINT _UxGT("Stop print") #endif -#ifndef MSG_POWER_LOSS_RECOVERY - #define MSG_POWER_LOSS_RECOVERY _UxGT("Power-Loss Recovery") +#ifndef MSG_OUTAGE_RECOVERY + #define MSG_OUTAGE_RECOVERY _UxGT("Outage Recovery") #endif #ifndef MSG_CARD_MENU #define MSG_CARD_MENU _UxGT("Print from SD") @@ -753,8 +771,8 @@ #ifndef MSG_CONTROL_RETRACTF #define MSG_CONTROL_RETRACTF _UxGT("Retract V") #endif -#ifndef MSG_CONTROL_RETRACT_ZLIFT - #define MSG_CONTROL_RETRACT_ZLIFT _UxGT("Hop mm") +#ifndef MSG_CONTROL_RETRACT_ZHOP + #define MSG_CONTROL_RETRACT_ZHOP _UxGT("Hop mm") #endif #ifndef MSG_CONTROL_RETRACT_RECOVER #define MSG_CONTROL_RETRACT_RECOVER _UxGT("UnRet mm") @@ -771,6 +789,21 @@ #ifndef MSG_AUTORETRACT #define MSG_AUTORETRACT _UxGT("AutoRetr.") #endif +#ifndef MSG_FILAMENT_SWAP_LENGTH + #define MSG_FILAMENT_SWAP_LENGTH _UxGT("Retract Distance") +#endif +#ifndef MSG_TOOL_CHANGE + #define MSG_TOOL_CHANGE _UxGT("Tool Change") +#endif +#ifndef MSG_TOOL_CHANGE_ZLIFT + #define MSG_TOOL_CHANGE_ZLIFT _UxGT("Z Raise") +#endif +#ifndef MSG_SINGLENOZZLE_PRIME_SPD + #define MSG_SINGLENOZZLE_PRIME_SPD _UxGT("Prime Speed") +#endif +#ifndef MSG_SINGLENOZZLE_RETRACT_SPD + #define MSG_SINGLENOZZLE_RETRACT_SPD _UxGT("Retract Speed") +#endif #ifndef MSG_FILAMENTCHANGE #define MSG_FILAMENTCHANGE _UxGT("Change filament") #endif @@ -786,8 +819,8 @@ #ifndef MSG_INIT_SDCARD #define MSG_INIT_SDCARD _UxGT("Init. SD card") #endif -#ifndef MSG_CNG_SDCARD - #define MSG_CNG_SDCARD _UxGT("Change SD card") +#ifndef MSG_CHANGE_SDCARD + #define MSG_CHANGE_SDCARD _UxGT("Change SD card") #endif #ifndef MSG_ZPROBE_OUT #define MSG_ZPROBE_OUT _UxGT("Z Probe past bed") @@ -973,7 +1006,7 @@ #define MSG_CASE_LIGHT _UxGT("Case light") #endif #ifndef MSG_CASE_LIGHT_BRIGHTNESS - #define MSG_CASE_LIGHT_BRIGHTNESS _UxGT("Light BRIGHTNESS") + #define MSG_CASE_LIGHT_BRIGHTNESS _UxGT("Light Brightness") #endif #if LCD_WIDTH >= 20 #ifndef MSG_INFO_PRINT_COUNT @@ -1047,6 +1080,9 @@ #ifndef MSG_FILAMENT_CHANGE_NOZZLE #define MSG_FILAMENT_CHANGE_NOZZLE _UxGT(" Nozzle: ") #endif +#ifndef MSG_RUNOUT_SENSOR_ENABLE + #define MSG_RUNOUT_SENSOR_ENABLE _UxGT("Runout Sensor") +#endif #ifndef MSG_ERR_HOMING_FAILED #define MSG_ERR_HOMING_FAILED _UxGT("Homing failed") #endif @@ -1062,65 +1098,77 @@ // ...or up to 2 lines on a 3-line display // #if LCD_HEIGHT >= 4 - #ifndef MSG_FILAMENT_CHANGE_INIT_1 - #define MSG_FILAMENT_CHANGE_INIT_1 _UxGT("Wait for start") - #define MSG_FILAMENT_CHANGE_INIT_2 _UxGT("of the filament") - #define MSG_FILAMENT_CHANGE_INIT_3 _UxGT("change") + #ifndef MSG_ADVANCED_PAUSE_WAITING_1 + #define MSG_ADVANCED_PAUSE_WAITING_1 _UxGT("Press button") + #define MSG_ADVANCED_PAUSE_WAITING_2 _UxGT("to resume print") #endif - #ifndef MSG_FILAMENT_CHANGE_UNLOAD_1 - #define MSG_FILAMENT_CHANGE_UNLOAD_1 _UxGT("Wait for") - #define MSG_FILAMENT_CHANGE_UNLOAD_2 _UxGT("filament unload") + #ifndef MSG_FILAMENT_CHANGE_INIT_1 + #define MSG_FILAMENT_CHANGE_INIT_1 _UxGT("Wait for") + #define MSG_FILAMENT_CHANGE_INIT_2 _UxGT("filament change") + #define MSG_FILAMENT_CHANGE_INIT_3 _UxGT("to start") #endif #ifndef MSG_FILAMENT_CHANGE_INSERT_1 - #define MSG_FILAMENT_CHANGE_INSERT_1 _UxGT("Insert filament") - #define MSG_FILAMENT_CHANGE_INSERT_2 _UxGT("and press button") - #define MSG_FILAMENT_CHANGE_INSERT_3 _UxGT("to continue...") + #define MSG_FILAMENT_CHANGE_INSERT_1 _UxGT("Insert filament") + #define MSG_FILAMENT_CHANGE_INSERT_2 _UxGT("and press button") + #define MSG_FILAMENT_CHANGE_INSERT_3 _UxGT("to continue") #endif #ifndef MSG_FILAMENT_CHANGE_HEAT_1 - #define MSG_FILAMENT_CHANGE_HEAT_1 _UxGT("Press button to") - #define MSG_FILAMENT_CHANGE_HEAT_2 _UxGT("heat nozzle.") + #define MSG_FILAMENT_CHANGE_HEAT_1 _UxGT("Press button") + #define MSG_FILAMENT_CHANGE_HEAT_2 _UxGT("to heat nozzle") #endif #ifndef MSG_FILAMENT_CHANGE_HEATING_1 - #define MSG_FILAMENT_CHANGE_HEATING_1 _UxGT("Heating nozzle") - #define MSG_FILAMENT_CHANGE_HEATING_2 _UxGT("Please wait...") + #define MSG_FILAMENT_CHANGE_HEATING_1 _UxGT("Nozzle heating") + #define MSG_FILAMENT_CHANGE_HEATING_2 _UxGT("Please wait...") + #endif + #ifndef MSG_FILAMENT_CHANGE_UNLOAD_1 + #define MSG_FILAMENT_CHANGE_UNLOAD_1 _UxGT("Wait for") + #define MSG_FILAMENT_CHANGE_UNLOAD_2 _UxGT("filament unload") #endif #ifndef MSG_FILAMENT_CHANGE_LOAD_1 - #define MSG_FILAMENT_CHANGE_LOAD_1 _UxGT("Wait for") - #define MSG_FILAMENT_CHANGE_LOAD_2 _UxGT("filament load") + #define MSG_FILAMENT_CHANGE_LOAD_1 _UxGT("Wait for") + #define MSG_FILAMENT_CHANGE_LOAD_2 _UxGT("filament load") #endif #ifndef MSG_FILAMENT_CHANGE_PURGE_1 - #define MSG_FILAMENT_CHANGE_PURGE_1 _UxGT("Wait for") - #define MSG_FILAMENT_CHANGE_PURGE_2 _UxGT("filament purge") + #define MSG_FILAMENT_CHANGE_PURGE_1 _UxGT("Wait for") + #define MSG_FILAMENT_CHANGE_PURGE_2 _UxGT("filament purge") + #endif + #ifndef MSG_FILAMENT_CHANGE_CONT_PURGE_1 + #define MSG_FILAMENT_CHANGE_CONT_PURGE_1 _UxGT("Click to finish") + #define MSG_FILAMENT_CHANGE_CONT_PURGE_2 _UxGT("filament purge") #endif #ifndef MSG_FILAMENT_CHANGE_RESUME_1 - #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Wait for print") - #define MSG_FILAMENT_CHANGE_RESUME_2 _UxGT("to resume") + #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Wait for print") + #define MSG_FILAMENT_CHANGE_RESUME_2 _UxGT("to resume...") #endif #else // LCD_HEIGHT < 4 - #ifndef MSG_FILAMENT_CHANGE_INIT_1 - #define MSG_FILAMENT_CHANGE_INIT_1 _UxGT("Please wait...") + #ifndef MSG_ADVANCED_PAUSE_WAITING_1 + #define MSG_ADVANCED_PAUSE_WAITING_1 _UxGT("Click to continue") #endif - #ifndef MSG_FILAMENT_CHANGE_UNLOAD_1 - #define MSG_FILAMENT_CHANGE_UNLOAD_1 _UxGT("Ejecting...") + #ifndef MSG_FILAMENT_CHANGE_INIT_1 + #define MSG_FILAMENT_CHANGE_INIT_1 _UxGT("Please wait...") #endif #ifndef MSG_FILAMENT_CHANGE_INSERT_1 - #define MSG_FILAMENT_CHANGE_INSERT_1 _UxGT("Insert and Click") + #define MSG_FILAMENT_CHANGE_INSERT_1 _UxGT("Insert and Click") #endif #ifndef MSG_FILAMENT_CHANGE_HEAT_1 - #define MSG_FILAMENT_CHANGE_HEAT_1 _UxGT("Click to heat") + #define MSG_FILAMENT_CHANGE_HEAT_1 _UxGT("Click to heat") #endif #ifndef MSG_FILAMENT_CHANGE_HEATING_1 - #define MSG_FILAMENT_CHANGE_HEATING_1 _UxGT("Heating...") + #define MSG_FILAMENT_CHANGE_HEATING_1 _UxGT("Heating...") + #endif + #ifndef MSG_FILAMENT_CHANGE_UNLOAD_1 + #define MSG_FILAMENT_CHANGE_UNLOAD_1 _UxGT("Ejecting...") #endif #ifndef MSG_FILAMENT_CHANGE_LOAD_1 - #define MSG_FILAMENT_CHANGE_LOAD_1 _UxGT("Loading...") + #define MSG_FILAMENT_CHANGE_LOAD_1 _UxGT("Loading...") #endif #ifndef MSG_FILAMENT_CHANGE_PURGE_1 - #define MSG_FILAMENT_CHANGE_PURGE_1 _UxGT("Purging...") + #define MSG_FILAMENT_CHANGE_PURGE_1 _UxGT("Purging...") + #endif + #ifndef MSG_FILAMENT_CHANGE_CONT_PURGE_1 + #define MSG_FILAMENT_CHANGE_CONT_PURGE_1 _UxGT("Click to finish") #endif #ifndef MSG_FILAMENT_CHANGE_RESUME_1 - #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Resuming...") + #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Resuming...") #endif #endif // LCD_HEIGHT < 4 - -#endif // LANGUAGE_EN_H diff --git a/Marlin/src/lcd/language/language_es.h b/Marlin/src/lcd/language/language_es.h index f2626ea8cd..f216db91bf 100644 --- a/Marlin/src/lcd/language/language_es.h +++ b/Marlin/src/lcd/language/language_es.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Spanish @@ -27,8 +28,6 @@ * See also http://marlinfw.org/docs/development/lcd_language.html * */ -#ifndef LANGUAGE_ES_UTF_H -#define LANGUAGE_ES_UTF_H #define DISPLAY_CHARSET_ISO10646_1 #define CHARSIZE 2 @@ -55,13 +54,13 @@ #define MSG_SET_HOME_OFFSETS _UxGT("Ajustar desfases") #define MSG_HOME_OFFSETS_APPLIED _UxGT("Desfase aplicado") #define MSG_SET_ORIGIN _UxGT("Establecer origen") -#define MSG_PREHEAT_1 _UxGT("Precalentar PLA") +#define MSG_PREHEAT_1 _UxGT("Precalentar " PREHEAT_1_LABEL) #define MSG_PREHEAT_1_N MSG_PREHEAT_1 _UxGT(" ") #define MSG_PREHEAT_1_ALL MSG_PREHEAT_1 _UxGT(" Todo") #define MSG_PREHEAT_1_END MSG_PREHEAT_1 _UxGT(" End") #define MSG_PREHEAT_1_BEDONLY MSG_PREHEAT_1 _UxGT(" Cama") #define MSG_PREHEAT_1_SETTINGS MSG_PREHEAT_1 _UxGT(" Config") -#define MSG_PREHEAT_2 _UxGT("Precalentar ABS") +#define MSG_PREHEAT_2 _UxGT("Precalentar " PREHEAT_2_LABEL) #define MSG_PREHEAT_2_N MSG_PREHEAT_2 _UxGT(" ") #define MSG_PREHEAT_2_ALL MSG_PREHEAT_2 _UxGT(" Todo") #define MSG_PREHEAT_2_END MSG_PREHEAT_2 _UxGT(" End") @@ -96,8 +95,8 @@ #define MSG_MAX _UxGT(" ") LCD_STR_THERMOMETER _UxGT(" Max") #define MSG_FACTOR _UxGT(" ") LCD_STR_THERMOMETER _UxGT(" Fact") #define MSG_AUTOTEMP _UxGT("Temperatura Auto.") -#define MSG_ON _UxGT("Encender") -#define MSG_OFF _UxGT("Apagar") +#define MSG_LCD_ON _UxGT("Encender") +#define MSG_LCD_OFF _UxGT("Apagar") #define MSG_PID_P _UxGT("PID-P") #define MSG_PID_I _UxGT("PID-I") #define MSG_PID_D _UxGT("PID-D") @@ -155,14 +154,14 @@ #define MSG_CONTROL_RETRACT _UxGT("Retraer mm") #define MSG_CONTROL_RETRACT_SWAP _UxGT("Interc. Retraer mm") #define MSG_CONTROL_RETRACTF _UxGT("Retraer V") -#define MSG_CONTROL_RETRACT_ZLIFT _UxGT("Levantar mm") +#define MSG_CONTROL_RETRACT_ZHOP _UxGT("Levantar mm") #define MSG_CONTROL_RETRACT_RECOVER _UxGT("DesRet mm") #define MSG_CONTROL_RETRACT_RECOVER_SWAP _UxGT("Interc. DesRet mm") #define MSG_CONTROL_RETRACT_RECOVERF _UxGT("DesRet V") #define MSG_AUTORETRACT _UxGT("Retracción Auto.") #define MSG_FILAMENTCHANGE _UxGT("Cambiar filamento") #define MSG_INIT_SDCARD _UxGT("Iniciando tarjeta") -#define MSG_CNG_SDCARD _UxGT("Cambiar tarjeta") +#define MSG_CHANGE_SDCARD _UxGT("Cambiar tarjeta") #define MSG_ZPROBE_OUT _UxGT("Sonda Z fuera") #define MSG_BLTOUCH_SELFTEST _UxGT("BLTouch Auto-Prueba") #define MSG_BLTOUCH_RESET _UxGT("Reiniciar BLTouch") @@ -205,7 +204,7 @@ #define MSG_INFO_PROTOCOL _UxGT("Protocolo") #define MSG_CASE_LIGHT _UxGT("Luz cabina") -#if LCD_WIDTH > 19 +#if LCD_WIDTH >= 20 #define MSG_INFO_PRINT_COUNT _UxGT("Conteo de impresión") #define MSG_INFO_COMPLETED_PRINTS _UxGT("Completadas") #define MSG_INFO_PRINT_TIME _UxGT("Tiempo total de imp.") @@ -262,5 +261,3 @@ #define MSG_FILAMENT_CHANGE_HEAT_2 _UxGT("Calentar la boquilla") #define MSG_FILAMENT_CHANGE_HEATING_1 _UxGT("Calentando boquilla") #define MSG_FILAMENT_CHANGE_HEATING_2 _UxGT("Espere por favor") - -#endif // LANGUAGE_ES_UTF_H diff --git a/Marlin/src/lcd/language/language_eu.h b/Marlin/src/lcd/language/language_eu.h index 4a8d0e2f49..a1771d9178 100644 --- a/Marlin/src/lcd/language/language_eu.h +++ b/Marlin/src/lcd/language/language_eu.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Basque-Euskera @@ -27,8 +28,6 @@ * See also http://marlinfw.org/docs/development/lcd_language.html * */ -#ifndef LANGUAGE_EU_H -#define LANGUAGE_EU_H #define DISPLAY_CHARSET_ISO10646_1 #define NOT_EXTENDED_ISO10646_1_5X7 @@ -56,13 +55,13 @@ #define MSG_SET_HOME_OFFSETS _UxGT("Etxe. offset eza.") #define MSG_HOME_OFFSETS_APPLIED _UxGT("Offsetak ezarrita") #define MSG_SET_ORIGIN _UxGT("Hasiera ipini") -#define MSG_PREHEAT_1 _UxGT("Berotu PLA") +#define MSG_PREHEAT_1 _UxGT("Berotu " PREHEAT_1_LABEL) #define MSG_PREHEAT_1_N MSG_PREHEAT_1 _UxGT(" ") #define MSG_PREHEAT_1_ALL MSG_PREHEAT_1 _UxGT(" Guztia") #define MSG_PREHEAT_1_END MSG_PREHEAT_1 _UxGT(" Amaia") #define MSG_PREHEAT_1_BEDONLY MSG_PREHEAT_1 _UxGT(" Ohea") #define MSG_PREHEAT_1_SETTINGS MSG_PREHEAT_1 _UxGT(" Ezarp.") -#define MSG_PREHEAT_2 _UxGT("Berotu ABS") +#define MSG_PREHEAT_2 _UxGT("Berotu " PREHEAT_2_LABEL) #define MSG_PREHEAT_2_N MSG_PREHEAT_1 _UxGT(" ") #define MSG_PREHEAT_2_ALL MSG_PREHEAT_1 _UxGT(" Guztia") #define MSG_PREHEAT_2_END MSG_PREHEAT_2 _UxGT(" Amaia") @@ -92,24 +91,24 @@ //#define MSG_UBL_MOVING_TO_NEXT _UxGT("Moving to next") #define MSG_UBL_ACTIVATE_MESH _UxGT("UBL aktibatu") #define MSG_UBL_DEACTIVATE_MESH _UxGT("UBL desaktibatu") -#define MSG_UBL_SET_BED_TEMP _UxGT("Ohearen tenperatura") -#define MSG_UBL_CUSTOM_BED_TEMP MSG_UBL_SET_BED_TEMP -#define MSG_UBL_SET_HOTEND_TEMP _UxGT("Mutur beroaren tenp.") -#define MSG_UBL_CUSTOM_HOTEND_TEMP MSG_UBL_SET_HOTEND_TEMP +#define MSG_UBL_SET_TEMP_BED _UxGT("Ohearen tenperatura") +#define MSG_UBL_BED_TEMP_CUSTOM MSG_UBL_SET_TEMP_BED +#define MSG_UBL_SET_TEMP_HOTEND _UxGT("Mutur beroaren tenp.") +#define MSG_UBL_HOTEND_TEMP_CUSTOM MSG_UBL_SET_TEMP_HOTEND #define MSG_UBL_MESH_EDIT _UxGT("Sarea editatu") //#define MSG_UBL_EDIT_CUSTOM_MESH _UxGT("Edit Custom Mesh") //#define MSG_UBL_FINE_TUNE_MESH _UxGT("Fine Tuning Mesh") #define MSG_UBL_DONE_EDITING_MESH _UxGT("Sarea editatzea eginda") //#define MSG_UBL_BUILD_CUSTOM_MESH _UxGT("Build Custom Mesh") #define MSG_UBL_BUILD_MESH_MENU _UxGT("Sarea sortu") -#define MSG_UBL_BUILD_PLA_MESH _UxGT("PLA sarea sortu") -#define MSG_UBL_BUILD_ABS_MESH _UxGT("ABS sarea sortu") +#define MSG_UBL_BUILD_MESH_M1 _UxGT(PREHEAT_1_LABEL " sarea sortu") +#define MSG_UBL_BUILD_MESH_M2 _UxGT(PREHEAT_2_LABEL " sarea sortu") #define MSG_UBL_BUILD_COLD_MESH _UxGT("Sare hotza sortu") #define MSG_UBL_MESH_HEIGHT_ADJUST _UxGT("Sarearen altuera doitu") //#define MSG_UBL_MESH_HEIGHT_AMOUNT _UxGT("Height Amount") #define MSG_UBL_VALIDATE_MESH_MENU _UxGT("Sarea balioetsi") -#define MSG_UBL_VALIDATE_PLA_MESH _UxGT("PLA sarea balioetsi") -#define MSG_UBL_VALIDATE_ABS_MESH _UxGT("ABS sarea balioetsi") +#define MSG_UBL_VALIDATE_MESH_M1 _UxGT(PREHEAT_1_LABEL " sarea balioetsi") +#define MSG_UBL_VALIDATE_MESH_M2 _UxGT(PREHEAT_2_LABEL " sarea balioetsi") //#define MSG_UBL_VALIDATE_CUSTOM_MESH _UxGT("Validate Custom Mesh") #define MSG_UBL_CONTINUE_MESH _UxGT("Ohe sarea balioetsi") #define MSG_UBL_MESH_LEVELING _UxGT("Sare berdinketa") @@ -123,7 +122,7 @@ //#define MSG_UBL_OUTPUT_MAP_CSV _UxGT("Output for CSV") //#define MSG_UBL_OUTPUT_MAP_BACKUP _UxGT("Off Printer Backup") //#define MSG_UBL_INFO_UBL _UxGT("Output UBL Info") -#define MSG_UBL_EDIT_MESH_MENU _UxGT("Sarea editatu") +#define MSG_EDIT_MESH _UxGT("Sarea editatu") //#define MSG_UBL_FILLIN_AMOUNT _UxGT("Fill-in Amount") //#define MSG_UBL_MANUAL_FILLIN _UxGT("Manual Fill-in") //#define MSG_UBL_SMART_FILLIN _UxGT("Smart Fill-in") @@ -183,8 +182,8 @@ #define MSG_MAX _UxGT(" ") LCD_STR_THERMOMETER _UxGT(" Max") #define MSG_FACTOR _UxGT(" ") LCD_STR_THERMOMETER _UxGT(" Fakt") #define MSG_AUTOTEMP _UxGT("Auto tenperatura") -#define MSG_ON _UxGT("On ") -#define MSG_OFF _UxGT("Off") +#define MSG_LCD_ON _UxGT("On") +#define MSG_LCD_OFF _UxGT("Off") #define MSG_PID_P _UxGT("PID-P") #define MSG_PID_I _UxGT("PID-I") #define MSG_PID_D _UxGT("PID-D") @@ -259,7 +258,7 @@ #define MSG_CONTROL_RETRACT _UxGT("Atzera egin mm") #define MSG_CONTROL_RETRACT_SWAP _UxGT("Swap Atzera mm") #define MSG_CONTROL_RETRACTF _UxGT("Atzera egin V") -#define MSG_CONTROL_RETRACT_ZLIFT _UxGT("Igo mm") +#define MSG_CONTROL_RETRACT_ZHOP _UxGT("Igo mm") #define MSG_CONTROL_RETRACT_RECOVER _UxGT("Atzera egin mm") #define MSG_CONTROL_RETRACT_RECOVER_SWAP _UxGT("Swap Atzera mm") #define MSG_CONTROL_RETRACT_RECOVERF _UxGT("Atzera egin V") @@ -270,7 +269,7 @@ #define MSG_FILAMENTUNLOAD _UxGT("Harizpia deskargatu") #define MSG_FILAMENTUNLOAD_ALL _UxGT("Erabat deskargatu") #define MSG_INIT_SDCARD _UxGT("Hasieratu SD-a") -#define MSG_CNG_SDCARD _UxGT("Aldatu txartela") +#define MSG_CHANGE_SDCARD _UxGT("Aldatu txartela") #define MSG_ZPROBE_OUT _UxGT("Z zunda kanpora") #define MSG_SKEW_FACTOR _UxGT("Okertze faktorea") #define MSG_BLTOUCH _UxGT("BLTouch") @@ -360,32 +359,30 @@ // ...or up to 2 lines on a 3-line display // #if LCD_HEIGHT >= 4 -// #define MSG_FILAMENT_CHANGE_INIT_1 _UxGT("Wait for start") -// #define MSG_FILAMENT_CHANGE_INIT_2 _UxGT("of the filament") -// #define MSG_FILAMENT_CHANGE_INIT_3 _UxGT("change") -// #define MSG_FILAMENT_CHANGE_UNLOAD_1 _UxGT("Wait for") -// #define MSG_FILAMENT_CHANGE_UNLOAD_2 _UxGT("filament unload") -// #define MSG_FILAMENT_CHANGE_INSERT_1 _UxGT("Insert filament") -// #define MSG_FILAMENT_CHANGE_INSERT_2 _UxGT("and press button") -// #define MSG_FILAMENT_CHANGE_INSERT_3 _UxGT("to continue...") -// #define MSG_FILAMENT_CHANGE_HEAT_1 _UxGT("Press button to") -// #define MSG_FILAMENT_CHANGE_HEAT_2 _UxGT("heat nozzle.") -// #define MSG_FILAMENT_CHANGE_HEATING_1 _UxGT("Heating nozzle") -// #define MSG_FILAMENT_CHANGE_HEATING_2 _UxGT("Please wait...") -// #define MSG_FILAMENT_CHANGE_LOAD_1 _UxGT("Wait for") -// #define MSG_FILAMENT_CHANGE_LOAD_2 _UxGT("filament load") -// #define MSG_FILAMENT_CHANGE_PURGE_1 _UxGT("Wait for") -// #define MSG_FILAMENT_CHANGE_PURGE_2 _UxGT("filament purge") -// #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Wait for print") -// #define MSG_FILAMENT_CHANGE_RESUME_2 _UxGT("to resume") + //#define MSG_FILAMENT_CHANGE_INIT_1 _UxGT("Wait for start") + //#define MSG_FILAMENT_CHANGE_INIT_2 _UxGT("of the filament") + //#define MSG_FILAMENT_CHANGE_INIT_3 _UxGT("change") + //#define MSG_FILAMENT_CHANGE_UNLOAD_1 _UxGT("Wait for") + //#define MSG_FILAMENT_CHANGE_UNLOAD_2 _UxGT("filament unload") + //#define MSG_FILAMENT_CHANGE_INSERT_1 _UxGT("Insert filament") + //#define MSG_FILAMENT_CHANGE_INSERT_2 _UxGT("and press button") + //#define MSG_FILAMENT_CHANGE_INSERT_3 _UxGT("to continue...") + //#define MSG_FILAMENT_CHANGE_HEAT_1 _UxGT("Press button to") + //#define MSG_FILAMENT_CHANGE_HEAT_2 _UxGT("heat nozzle.") + //#define MSG_FILAMENT_CHANGE_HEATING_1 _UxGT("Heating nozzle") + //#define MSG_FILAMENT_CHANGE_HEATING_2 _UxGT("Please wait...") + //#define MSG_FILAMENT_CHANGE_LOAD_1 _UxGT("Wait for") + //#define MSG_FILAMENT_CHANGE_LOAD_2 _UxGT("filament load") + //#define MSG_FILAMENT_CHANGE_PURGE_1 _UxGT("Wait for") + //#define MSG_FILAMENT_CHANGE_PURGE_2 _UxGT("filament purge") + //#define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Wait for print") + //#define MSG_FILAMENT_CHANGE_RESUME_2 _UxGT("to resume") #else // LCD_HEIGHT < 4 #define MSG_FILAMENT_CHANGE_INIT_1 _UxGT("Mesedez, itxaron...") #define MSG_FILAMENT_CHANGE_UNLOAD_1 _UxGT("Deskargatzen...") #define MSG_FILAMENT_CHANGE_INSERT_1 _UxGT("Sartu eta click egin") #define MSG_FILAMENT_CHANGE_HEATING_1 _UxGT("Berotzen...") #define MSG_FILAMENT_CHANGE_LOAD_1 _UxGT("Kargatzen...") -// #define MSG_FILAMENT_CHANGE_PURGE_1 _UxGT("Purging...") -// #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Resuming...") + //#define MSG_FILAMENT_CHANGE_PURGE_1 _UxGT("Purging...") + //#define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Resuming...") #endif // LCD_HEIGHT < 4 - -#endif // LANGUAGE_EU_H diff --git a/Marlin/src/lcd/language/language_fi.h b/Marlin/src/lcd/language/language_fi.h index 318d310459..cca996d13c 100644 --- a/Marlin/src/lcd/language/language_fi.h +++ b/Marlin/src/lcd/language/language_fi.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Finnish @@ -27,8 +28,6 @@ * See also http://marlinfw.org/docs/development/lcd_language.html * */ -#ifndef LANGUAGE_FI_H -#define LANGUAGE_FI_H #define DISPLAY_CHARSET_ISO10646_1 #define CHARSIZE 2 @@ -47,16 +46,16 @@ #define MSG_SET_HOME_OFFSETS _UxGT("Set home offsets") #define MSG_HOME_OFFSETS_APPLIED _UxGT("Offsets applied") #define MSG_SET_ORIGIN _UxGT("Aseta origo") -#define MSG_PREHEAT_1 _UxGT("Esilämmitä PLA") -#define MSG_PREHEAT_1_N _UxGT("Esilämmitä PLA ") -#define MSG_PREHEAT_1_ALL _UxGT("Esilä. PLA Kaikki") -#define MSG_PREHEAT_1_BEDONLY _UxGT("Esilä. PLA Alusta") -#define MSG_PREHEAT_1_SETTINGS _UxGT("Esilämm. PLA konf") -#define MSG_PREHEAT_2 _UxGT("Esilämmitä ABS") -#define MSG_PREHEAT_2_N _UxGT("Esilämmitä ABS ") -#define MSG_PREHEAT_2_ALL _UxGT("Esilä. ABS Kaikki") -#define MSG_PREHEAT_2_BEDONLY _UxGT("Esilä. ABS Alusta") -#define MSG_PREHEAT_2_SETTINGS _UxGT("Esilämm. ABS konf") +#define MSG_PREHEAT_1 _UxGT("Esilämmitä " PREHEAT_1_LABEL) +#define MSG_PREHEAT_1_N _UxGT("Esilämmitä " PREHEAT_1_LABEL " ") +#define MSG_PREHEAT_1_ALL _UxGT("Esilä. " PREHEAT_1_LABEL " Kaikki") +#define MSG_PREHEAT_1_BEDONLY _UxGT("Esilä. " PREHEAT_1_LABEL " Alusta") +#define MSG_PREHEAT_1_SETTINGS _UxGT("Esilämm. " PREHEAT_1_LABEL " konf") +#define MSG_PREHEAT_2 _UxGT("Esilämmitä " PREHEAT_2_LABEL) +#define MSG_PREHEAT_2_N _UxGT("Esilämmitä " PREHEAT_2_LABEL " ") +#define MSG_PREHEAT_2_ALL _UxGT("Esilä. " PREHEAT_2_LABEL " Kaikki") +#define MSG_PREHEAT_2_BEDONLY _UxGT("Esilä. " PREHEAT_2_LABEL " Alusta") +#define MSG_PREHEAT_2_SETTINGS _UxGT("Esilämm. " PREHEAT_2_LABEL " konf") #define MSG_COOLDOWN _UxGT("Jäähdytä") #define MSG_SWITCH_PS_ON _UxGT("Virta päälle") #define MSG_SWITCH_PS_OFF _UxGT("Virta pois") @@ -80,8 +79,8 @@ #define MSG_MAX LCD_STR_THERMOMETER _UxGT(" Max") #define MSG_FACTOR LCD_STR_THERMOMETER _UxGT(" Kerr") #define MSG_AUTOTEMP _UxGT("Autotemp") -#define MSG_ON _UxGT("On ") -#define MSG_OFF _UxGT("Off") +#define MSG_LCD_ON _UxGT("On") +#define MSG_LCD_OFF _UxGT("Off") #define MSG_PID_P _UxGT("PID-P") #define MSG_PID_I _UxGT("PID-I") #define MSG_PID_D _UxGT("PID-D") @@ -148,14 +147,14 @@ #define MSG_CONTROL_RETRACT _UxGT("Vedä mm") #define MSG_CONTROL_RETRACT_SWAP _UxGT("Va. Vedä mm") #define MSG_CONTROL_RETRACTF _UxGT("Vedä V") -#define MSG_CONTROL_RETRACT_ZLIFT _UxGT("Z mm") +#define MSG_CONTROL_RETRACT_ZHOP _UxGT("Z mm") #define MSG_CONTROL_RETRACT_RECOVER _UxGT("UnRet mm") #define MSG_CONTROL_RETRACT_RECOVER_SWAP _UxGT("Va. UnRet mm") #define MSG_CONTROL_RETRACT_RECOVERF _UxGT("UnRet V") #define MSG_AUTORETRACT _UxGT("AutoVeto.") #define MSG_FILAMENTCHANGE _UxGT("Change filament") #define MSG_INIT_SDCARD _UxGT("Init. SD-Card") -#define MSG_CNG_SDCARD _UxGT("Change SD-Card") +#define MSG_CHANGE_SDCARD _UxGT("Change SD-Card") #define MSG_ZPROBE_OUT _UxGT("Z probe out. bed") #define MSG_HOME _UxGT("Home") // Used as MSG_HOME " " MSG_X MSG_Y MSG_Z " " MSG_FIRST #define MSG_FIRST _UxGT("first") @@ -169,5 +168,3 @@ #define MSG_DELTA_CALIBRATE_Y _UxGT("Kalibroi Y") #define MSG_DELTA_CALIBRATE_Z _UxGT("Kalibroi Z") #define MSG_DELTA_CALIBRATE_CENTER _UxGT("Kalibroi Center") - -#endif // LANGUAGE_FI_H diff --git a/Marlin/src/lcd/language/language_fr.h b/Marlin/src/lcd/language/language_fr.h index cf6d85e504..386f7cedf4 100644 --- a/Marlin/src/lcd/language/language_fr.h +++ b/Marlin/src/lcd/language/language_fr.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * French @@ -27,8 +28,6 @@ * See also http://marlinfw.org/docs/development/lcd_language.html * */ -#ifndef LANGUAGE_FR_UTF_H -#define LANGUAGE_FR_UTF_H #define DISPLAY_CHARSET_ISO10646_1 #define CHARSIZE 2 @@ -56,18 +55,18 @@ #define MSG_SET_HOME_OFFSETS _UxGT("Régl. décal. origine") #define MSG_HOME_OFFSETS_APPLIED _UxGT("Décalages appliqués") #define MSG_SET_ORIGIN _UxGT("Régler origine") -#define MSG_PREHEAT_1 _UxGT("Préchauffage PLA") -#define MSG_PREHEAT_1_N _UxGT("Préchauff. PLA ") -#define MSG_PREHEAT_1_ALL _UxGT("Préch. PLA Tout") +#define MSG_PREHEAT_1 _UxGT("Préchauffage " PREHEAT_1_LABEL) +#define MSG_PREHEAT_1_N _UxGT("Préchauff. " PREHEAT_1_LABEL " ") +#define MSG_PREHEAT_1_ALL _UxGT("Préch. " PREHEAT_1_LABEL " Tout") #define MSG_PREHEAT_1_END MSG_PREHEAT_1 _UxGT(" buse") -#define MSG_PREHEAT_1_BEDONLY _UxGT("Préch. PLA lit") -#define MSG_PREHEAT_1_SETTINGS _UxGT("Régl. prech. PLA") -#define MSG_PREHEAT_2 _UxGT("Préchauffage ABS") -#define MSG_PREHEAT_2_N _UxGT("Préchauff. ABS ") -#define MSG_PREHEAT_2_ALL _UxGT("Préch. ABS Tout") +#define MSG_PREHEAT_1_BEDONLY _UxGT("Préch. " PREHEAT_1_LABEL " lit") +#define MSG_PREHEAT_1_SETTINGS _UxGT("Régl. prech. " PREHEAT_1_LABEL) +#define MSG_PREHEAT_2 _UxGT("Préchauffage " PREHEAT_2_LABEL) +#define MSG_PREHEAT_2_N _UxGT("Préchauff. " PREHEAT_2_LABEL " ") +#define MSG_PREHEAT_2_ALL _UxGT("Préch. " PREHEAT_2_LABEL " Tout") #define MSG_PREHEAT_2_END MSG_PREHEAT_2 _UxGT(" buse") -#define MSG_PREHEAT_2_BEDONLY _UxGT("Préch. ABS lit") -#define MSG_PREHEAT_2_SETTINGS _UxGT("Régl. prech. ABS") +#define MSG_PREHEAT_2_BEDONLY _UxGT("Préch. " PREHEAT_2_LABEL " lit") +#define MSG_PREHEAT_2_SETTINGS _UxGT("Régl. prech. " PREHEAT_2_LABEL) #define MSG_COOLDOWN _UxGT("Refroidir") #define MSG_SWITCH_PS_ON _UxGT("Allumer alim.") #define MSG_SWITCH_PS_OFF _UxGT("Eteindre alim.") @@ -92,24 +91,24 @@ #define MSG_UBL_MOVING_TO_NEXT _UxGT("Aller au suivant") #define MSG_UBL_ACTIVATE_MESH _UxGT("Activer l'UBL") #define MSG_UBL_DEACTIVATE_MESH _UxGT("Désactiver l'UBL") -#define MSG_UBL_SET_BED_TEMP _UxGT("Température lit") -#define MSG_UBL_CUSTOM_BED_TEMP MSG_UBL_SET_BED_TEMP -#define MSG_UBL_SET_HOTEND_TEMP _UxGT("Température buse") -#define MSG_UBL_CUSTOM_HOTEND_TEMP MSG_UBL_SET_HOTEND_TEMP +#define MSG_UBL_SET_TEMP_BED _UxGT("Température lit") +#define MSG_UBL_BED_TEMP_CUSTOM MSG_UBL_SET_TEMP_BED +#define MSG_UBL_SET_TEMP_HOTEND _UxGT("Température buse") +#define MSG_UBL_HOTEND_TEMP_CUSTOM MSG_UBL_SET_TEMP_HOTEND #define MSG_UBL_MESH_EDIT _UxGT("Editer maille") #define MSG_UBL_EDIT_CUSTOM_MESH _UxGT("Editer maille perso") #define MSG_UBL_FINE_TUNE_MESH _UxGT("Réglage fin maille") #define MSG_UBL_DONE_EDITING_MESH _UxGT("Terminer maille") #define MSG_UBL_BUILD_CUSTOM_MESH _UxGT("Créer maille perso") #define MSG_UBL_BUILD_MESH_MENU _UxGT("Créer maille") -#define MSG_UBL_BUILD_PLA_MESH _UxGT("Créer maille PLA") -#define MSG_UBL_BUILD_ABS_MESH _UxGT("Créer maille ABS") +#define MSG_UBL_BUILD_MESH_M1 _UxGT("Créer maille " PREHEAT_1_LABEL) +#define MSG_UBL_BUILD_MESH_M2 _UxGT("Créer maille " PREHEAT_2_LABEL) #define MSG_UBL_BUILD_COLD_MESH _UxGT("Créer maille froide") #define MSG_UBL_MESH_HEIGHT_ADJUST _UxGT("Ajuster haut. maille") #define MSG_UBL_MESH_HEIGHT_AMOUNT _UxGT("Hauteur") #define MSG_UBL_VALIDATE_MESH_MENU _UxGT("Valider maille") -#define MSG_UBL_VALIDATE_PLA_MESH _UxGT("Valider maille PLA") -#define MSG_UBL_VALIDATE_ABS_MESH _UxGT("Valider maille ABS") +#define MSG_UBL_VALIDATE_MESH_M1 _UxGT("Valider maille " PREHEAT_1_LABEL) +#define MSG_UBL_VALIDATE_MESH_M2 _UxGT("Valider maille " PREHEAT_2_LABEL) #define MSG_UBL_VALIDATE_CUSTOM_MESH _UxGT("Valider maille perso") #define MSG_UBL_CONTINUE_MESH _UxGT("Continuer maille") #define MSG_UBL_MESH_LEVELING _UxGT("Niveau par maille") @@ -123,7 +122,7 @@ #define MSG_UBL_OUTPUT_MAP_CSV _UxGT("Voir pour CSV") #define MSG_UBL_OUTPUT_MAP_BACKUP _UxGT("Voir pour sauveg.") #define MSG_UBL_INFO_UBL _UxGT("Voir info UBL") -#define MSG_UBL_EDIT_MESH_MENU _UxGT("Modifier maille") +#define MSG_EDIT_MESH _UxGT("Modifier maille") #define MSG_UBL_FILLIN_AMOUNT _UxGT("Taux de remplissage") #define MSG_UBL_MANUAL_FILLIN _UxGT("Remplissage manuel") #define MSG_UBL_SMART_FILLIN _UxGT("Remplissage auto") @@ -185,8 +184,8 @@ #define MSG_MAX LCD_STR_THERMOMETER _UxGT(" Max") #define MSG_FACTOR LCD_STR_THERMOMETER _UxGT(" Facteur") #define MSG_AUTOTEMP _UxGT("Temp. Auto.") -#define MSG_ON _UxGT("Marche ") -#define MSG_OFF _UxGT("Arrêt") +#define MSG_LCD_ON _UxGT("Marche") +#define MSG_LCD_OFF _UxGT("Arrêt") #define MSG_PID_P _UxGT("PID-P") #define MSG_PID_I _UxGT("PID-I") #define MSG_PID_D _UxGT("PID-D") @@ -261,7 +260,7 @@ #define MSG_CONTROL_RETRACT _UxGT("Retrait mm") #define MSG_CONTROL_RETRACT_SWAP _UxGT("Ech. Retr. mm") #define MSG_CONTROL_RETRACTF _UxGT("Retrait V") -#define MSG_CONTROL_RETRACT_ZLIFT _UxGT("Saut Z mm") +#define MSG_CONTROL_RETRACT_ZHOP _UxGT("Saut Z mm") #define MSG_CONTROL_RETRACT_RECOVER _UxGT("Rappel mm") #define MSG_CONTROL_RETRACT_RECOVER_SWAP _UxGT("Ech. Rappel mm") #define MSG_CONTROL_RETRACT_RECOVERF _UxGT("Rappel V") @@ -272,7 +271,7 @@ #define MSG_FILAMENTUNLOAD _UxGT("Décharger fil.") #define MSG_FILAMENTUNLOAD_ALL _UxGT("Décharger tout") #define MSG_INIT_SDCARD _UxGT("Init. la carte SD") -#define MSG_CNG_SDCARD _UxGT("Changer de carte") +#define MSG_CHANGE_SDCARD _UxGT("Changer de carte") #define MSG_ZPROBE_OUT _UxGT("Z sonde hors lit") #define MSG_SKEW_FACTOR _UxGT("Facteur écart") #define MSG_BLTOUCH _UxGT("BLTouch") @@ -392,5 +391,3 @@ #define MSG_FILAMENT_CHANGE_LOAD_1 _UxGT("Chargement...") #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Reprise...") #endif // LCD_HEIGHT < 4 - -#endif // LANGUAGE_FR_UTF_H diff --git a/Marlin/src/lcd/language/language_gl.h b/Marlin/src/lcd/language/language_gl.h index 892f8b4a98..6809a2c70c 100644 --- a/Marlin/src/lcd/language/language_gl.h +++ b/Marlin/src/lcd/language/language_gl.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Galician language (ISO "gl") @@ -27,8 +28,6 @@ * See also http://marlinfw.org/docs/development/lcd_language.html * */ -#ifndef LANGUAGE_GL_H -#define LANGUAGE_GL_H #define DISPLAY_CHARSET_ISO10646_1 #define NOT_EXTENDED_ISO10646_1_5X7 @@ -52,16 +51,16 @@ #define MSG_SET_HOME_OFFSETS _UxGT("Offsets na orixe") #define MSG_HOME_OFFSETS_APPLIED _UxGT("Offsets fixados") #define MSG_SET_ORIGIN _UxGT("Fixar orixe") -#define MSG_PREHEAT_1 _UxGT("Prequentar PLA") -#define MSG_PREHEAT_1_N _UxGT("Prequentar PLA ") -#define MSG_PREHEAT_1_ALL _UxGT("Preque. PLA Todo") -#define MSG_PREHEAT_1_BEDONLY _UxGT("Preque. PLA Cama") -#define MSG_PREHEAT_1_SETTINGS _UxGT("Preque. PLA conf") -#define MSG_PREHEAT_2 _UxGT("Prequentar ABS") -#define MSG_PREHEAT_2_N _UxGT("Prequentar ABS ") -#define MSG_PREHEAT_2_ALL _UxGT("Preque. ABS Todo") -#define MSG_PREHEAT_2_BEDONLY _UxGT("Preque. ABS Cama") -#define MSG_PREHEAT_2_SETTINGS _UxGT("Preque. ABS conf") +#define MSG_PREHEAT_1 _UxGT("Prequentar " PREHEAT_1_LABEL) +#define MSG_PREHEAT_1_N _UxGT("Prequentar " PREHEAT_1_LABEL " ") +#define MSG_PREHEAT_1_ALL _UxGT("Preque. " PREHEAT_1_LABEL " Todo") +#define MSG_PREHEAT_1_BEDONLY _UxGT("Preque. " PREHEAT_1_LABEL " Cama") +#define MSG_PREHEAT_1_SETTINGS _UxGT("Preque. " PREHEAT_1_LABEL " conf") +#define MSG_PREHEAT_2 _UxGT("Prequentar " PREHEAT_2_LABEL) +#define MSG_PREHEAT_2_N _UxGT("Prequentar " PREHEAT_2_LABEL " ") +#define MSG_PREHEAT_2_ALL _UxGT("Preque. " PREHEAT_2_LABEL " Todo") +#define MSG_PREHEAT_2_BEDONLY _UxGT("Preque. " PREHEAT_2_LABEL " Cama") +#define MSG_PREHEAT_2_SETTINGS _UxGT("Preque. " PREHEAT_2_LABEL " conf") #define MSG_COOLDOWN _UxGT("Arrefriar") #define MSG_SWITCH_PS_ON _UxGT("Acender") #define MSG_SWITCH_PS_OFF _UxGT("Apagar") @@ -88,8 +87,8 @@ #define MSG_MAX _UxGT(" ") LCD_STR_THERMOMETER _UxGT(" Max") #define MSG_FACTOR _UxGT(" ") LCD_STR_THERMOMETER _UxGT(" Fact") #define MSG_AUTOTEMP _UxGT("Autotemp") -#define MSG_ON _UxGT("On ") -#define MSG_OFF _UxGT("Off") +#define MSG_LCD_ON _UxGT("On") +#define MSG_LCD_OFF _UxGT("Off") #define MSG_PID_P _UxGT("PID-P") #define MSG_PID_I _UxGT("PID-I") #define MSG_PID_D _UxGT("PID-D") @@ -157,14 +156,14 @@ #define MSG_CONTROL_RETRACT _UxGT("Retraccion mm") #define MSG_CONTROL_RETRACT_SWAP _UxGT("Cambio retra. mm") #define MSG_CONTROL_RETRACTF _UxGT("Retraccion V") -#define MSG_CONTROL_RETRACT_ZLIFT _UxGT("Alzar Z mm") +#define MSG_CONTROL_RETRACT_ZHOP _UxGT("Alzar Z mm") #define MSG_CONTROL_RETRACT_RECOVER _UxGT("Recup. retra. mm") #define MSG_CONTROL_RETRACT_RECOVER_SWAP _UxGT("Cambio recup. mm") #define MSG_CONTROL_RETRACT_RECOVERF _UxGT("Recuperacion V") #define MSG_AUTORETRACT _UxGT("Retraccion auto.") #define MSG_FILAMENTCHANGE _UxGT("Cambiar filamen.") #define MSG_INIT_SDCARD _UxGT("Iniciando SD") -#define MSG_CNG_SDCARD _UxGT("Cambiar SD") +#define MSG_CHANGE_SDCARD _UxGT("Cambiar SD") #define MSG_ZPROBE_OUT _UxGT("Sonda-Z sen cama") #define MSG_HOME _UxGT("Home") // Used as MSG_HOME " " MSG_X MSG_Y MSG_Z " " MSG_FIRST #define MSG_BLTOUCH_SELFTEST _UxGT("Comprobar BLTouch") @@ -251,5 +250,3 @@ #define MSG_FILAMENT_CHANGE_LOAD_1 _UxGT("Cargando...") #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Seguindo...") #endif // LCD_HEIGHT < 4 - -#endif // LANGUAGE_GL_H diff --git a/Marlin/src/lcd/language/language_hr.h b/Marlin/src/lcd/language/language_hr.h index 1e972778de..50893a0c82 100644 --- a/Marlin/src/lcd/language/language_hr.h +++ b/Marlin/src/lcd/language/language_hr.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Croatian (Hrvatski) @@ -27,8 +28,6 @@ * See also http://marlinfw.org/docs/development/lcd_language.html * */ -#ifndef LANGUAGE_HR_H -#define LANGUAGE_HR_H #define DISPLAY_CHARSET_ISO10646_1 // use the better font on full graphic displays. #define CHARSIZE 2 @@ -52,12 +51,12 @@ #define MSG_SET_HOME_OFFSETS _UxGT("Postavi home offsete") #define MSG_HOME_OFFSETS_APPLIED _UxGT("Offsets postavljeni") #define MSG_SET_ORIGIN _UxGT("Postavi ishodište") -#define MSG_PREHEAT_1 _UxGT("Predgrij PLA") +#define MSG_PREHEAT_1 _UxGT("Predgrij " PREHEAT_1_LABEL) #define MSG_PREHEAT_1_N MSG_PREHEAT_1 _UxGT(" ") #define MSG_PREHEAT_1_ALL MSG_PREHEAT_1 _UxGT(" Sve") #define MSG_PREHEAT_1_BEDONLY MSG_PREHEAT_1 _UxGT(" Bed") #define MSG_PREHEAT_1_SETTINGS MSG_PREHEAT_1 _UxGT(" conf") -#define MSG_PREHEAT_2 _UxGT("Predgrij ABS") +#define MSG_PREHEAT_2 _UxGT("Predgrij " PREHEAT_2_LABEL) #define MSG_PREHEAT_2_N MSG_PREHEAT_2 _UxGT(" ") #define MSG_PREHEAT_2_ALL MSG_PREHEAT_2 _UxGT(" Sve") #define MSG_PREHEAT_2_BEDONLY MSG_PREHEAT_2 _UxGT(" Bed") @@ -88,8 +87,8 @@ #define MSG_MAX _UxGT(" ") LCD_STR_THERMOMETER _UxGT(" Max") #define MSG_FACTOR _UxGT(" ") LCD_STR_THERMOMETER _UxGT(" Fact") #define MSG_AUTOTEMP _UxGT("Autotemp") -#define MSG_ON _UxGT("On ") -#define MSG_OFF _UxGT("Off") +#define MSG_LCD_ON _UxGT("On") +#define MSG_LCD_OFF _UxGT("Off") #define MSG_PID_P _UxGT("PID-P") #define MSG_PID_I _UxGT("PID-I") #define MSG_PID_D _UxGT("PID-D") @@ -157,14 +156,14 @@ #define MSG_CONTROL_RETRACT _UxGT("Retract mm") #define MSG_CONTROL_RETRACT_SWAP _UxGT("Swap Re.mm") #define MSG_CONTROL_RETRACTF _UxGT("Retract V") -#define MSG_CONTROL_RETRACT_ZLIFT _UxGT("Hop mm") +#define MSG_CONTROL_RETRACT_ZHOP _UxGT("Hop mm") #define MSG_CONTROL_RETRACT_RECOVER _UxGT("UnRet mm") #define MSG_CONTROL_RETRACT_RECOVER_SWAP _UxGT("S UnRet mm") #define MSG_CONTROL_RETRACT_RECOVERF _UxGT("UnRet V") #define MSG_AUTORETRACT _UxGT("AutoRetr.") #define MSG_FILAMENTCHANGE _UxGT("Promijeni filament") #define MSG_INIT_SDCARD _UxGT("Init. SD karticu") -#define MSG_CNG_SDCARD _UxGT("Promijeni SD karticu") +#define MSG_CHANGE_SDCARD _UxGT("Promijeni SD karticu") #define MSG_ZPROBE_OUT _UxGT("Z probe out. bed") #define MSG_BLTOUCH_SELFTEST _UxGT("BLTouch Self-Test") #define MSG_BLTOUCH_RESET _UxGT("Reset BLTouch") @@ -250,5 +249,3 @@ #define MSG_FILAMENT_CHANGE_LOAD_1 _UxGT("Loading...") #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Nastavljam...") #endif // LCD_HEIGHT < 4 - -#endif // LANGUAGE_HR_H diff --git a/Marlin/src/lcd/language/language_it.h b/Marlin/src/lcd/language/language_it.h index 129fa6c5db..4dbabb3b74 100644 --- a/Marlin/src/lcd/language/language_it.h +++ b/Marlin/src/lcd/language/language_it.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Italian @@ -27,8 +28,6 @@ * See also http://marlinfw.org/docs/development/lcd_language.html * */ -#ifndef LANGUAGE_IT_H -#define LANGUAGE_IT_H #define DISPLAY_CHARSET_ISO10646_1 @@ -36,7 +35,8 @@ #define MSG_BACK _UxGT("Indietro") #define MSG_SD_INSERTED _UxGT("SD Card inserita") #define MSG_SD_REMOVED _UxGT("SD Card rimossa") -#define MSG_LCD_ENDSTOPS _UxGT("Endstop") +#define MSG_LCD_ENDSTOPS _UxGT("Finecor.") // Max 8 caratteri +#define MSG_LCD_SOFT_ENDSTOPS _UxGT("Finecorsa Soft") #define MSG_MAIN _UxGT("Menu principale") #define MSG_ADVANCED_SETTINGS _UxGT("Impostaz. avanzate") #define MSG_CONFIGURATION _UxGT("Configurazione") @@ -48,6 +48,7 @@ #define MSG_AUTO_HOME_X _UxGT("Home asse X") #define MSG_AUTO_HOME_Y _UxGT("Home asse Y") #define MSG_AUTO_HOME_Z _UxGT("Home asse Z") +#define MSG_AUTO_Z_ALIGN _UxGT("Allineam.automat. Z") #define MSG_TMC_Z_CALIBRATION _UxGT("Calibra Z") #define MSG_LEVEL_BED_HOMING _UxGT("Home assi XYZ") #define MSG_LEVEL_BED_WAITING _UxGT("Premi per iniziare") @@ -57,18 +58,19 @@ #define MSG_SET_HOME_OFFSETS _UxGT("Imp. offset home") #define MSG_HOME_OFFSETS_APPLIED _UxGT("Offset applicato") #define MSG_SET_ORIGIN _UxGT("Imposta Origine") -#define MSG_PREHEAT_1 _UxGT("Preriscalda PLA") -#define MSG_PREHEAT_1_N _UxGT("Preris.PLA ") +#define MSG_PREHEAT_1 _UxGT("Preriscalda " PREHEAT_1_LABEL) +#define MSG_PREHEAT_1_N _UxGT("Preris." PREHEAT_1_LABEL " ") #define MSG_PREHEAT_1_ALL MSG_PREHEAT_1_N _UxGT("Tutto") #define MSG_PREHEAT_1_END MSG_PREHEAT_1_N _UxGT("Ugello") #define MSG_PREHEAT_1_BEDONLY MSG_PREHEAT_1_N _UxGT("Piatto") #define MSG_PREHEAT_1_SETTINGS MSG_PREHEAT_1_N _UxGT("conf") -#define MSG_PREHEAT_2 _UxGT("Preriscalda ABS") -#define MSG_PREHEAT_2_N _UxGT("Preris.ABS ") +#define MSG_PREHEAT_2 _UxGT("Preriscalda " PREHEAT_2_LABEL) +#define MSG_PREHEAT_2_N _UxGT("Preris." PREHEAT_2_LABEL " ") #define MSG_PREHEAT_2_ALL MSG_PREHEAT_2_N _UxGT("Tutto") #define MSG_PREHEAT_2_END MSG_PREHEAT_2_N _UxGT("Ugello") #define MSG_PREHEAT_2_BEDONLY MSG_PREHEAT_2_N _UxGT("Piatto") #define MSG_PREHEAT_2_SETTINGS MSG_PREHEAT_2_N _UxGT("conf") +#define MSG_PREHEAT_CUSTOM _UxGT("Prerisc.personal.") #define MSG_COOLDOWN _UxGT("Raffredda") #define MSG_SWITCH_PS_ON _UxGT("Accendi aliment.") #define MSG_SWITCH_PS_OFF _UxGT("Spegni aliment.") @@ -76,12 +78,14 @@ #define MSG_RETRACT _UxGT("Ritrai") #define MSG_MOVE_AXIS _UxGT("Muovi Asse") #define MSG_BED_LEVELING _UxGT("Livella piano") -#define MSG_LEVEL_BED _UxGT("Livella piano") +#define MSG_LEVEL_BED MSG_BED_LEVELING #define MSG_LEVEL_CORNERS _UxGT("Livella spigoli") #define MSG_NEXT_CORNER _UxGT("Prossimo spigolo") #define MSG_EDITING_STOPPED _UxGT("Modif. Mesh Fermata") -#define MSG_USER_MENU _UxGT("Comandi Utente") - +#define MSG_MESH_X _UxGT("Indice X") +#define MSG_MESH_Y _UxGT("Indice Y") +#define MSG_MESH_EDIT_Z _UxGT("Valore di Z") +#define MSG_USER_MENU _UxGT("Comandi personaliz.") #define MSG_UBL_DOING_G29 _UxGT("G29 in corso") #define MSG_UBL_UNHOMED _UxGT("Home XYZ prima") #define MSG_UBL_TOOLS _UxGT("Strumenti UBL") @@ -89,7 +93,12 @@ #define MSG_IDEX_MENU _UxGT("Modo IDEX") #define MSG_IDEX_MODE_AUTOPARK _UxGT("Auto-Park") #define MSG_IDEX_MODE_DUPLICATE _UxGT("Duplicazione") +#define MSG_IDEX_MODE_SCALED_COPY _UxGT("Copia scalata") #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_UBL_MANUAL_MESH _UxGT("Mesh Manuale") #define MSG_UBL_BC_INSERT _UxGT("Metti spes. e misura") #define MSG_UBL_BC_INSERT2 _UxGT("Misura") @@ -97,25 +106,25 @@ #define MSG_UBL_MOVING_TO_NEXT _UxGT("Spostamento succes.") #define MSG_UBL_ACTIVATE_MESH _UxGT("Attiva UBL") #define MSG_UBL_DEACTIVATE_MESH _UxGT("Disattiva UBL") -#define MSG_UBL_SET_BED_TEMP _UxGT("Temp Piatto") -#define MSG_UBL_CUSTOM_BED_TEMP MSG_UBL_SET_BED_TEMP -#define MSG_UBL_SET_HOTEND_TEMP _UxGT("Temp Ugello") -#define MSG_UBL_CUSTOM_HOTEND_TEMP MSG_UBL_SET_HOTEND_TEMP +#define MSG_UBL_SET_TEMP_BED _UxGT("Temp. Piatto") +#define MSG_UBL_BED_TEMP_CUSTOM MSG_UBL_SET_TEMP_BED +#define MSG_UBL_SET_TEMP_HOTEND _UxGT("Temp. Ugello") +#define MSG_UBL_HOTEND_TEMP_CUSTOM MSG_UBL_SET_TEMP_HOTEND #define MSG_UBL_MESH_EDIT _UxGT("Modifica Mesh") -#define MSG_UBL_EDIT_CUSTOM_MESH _UxGT("Modif Custom Mesh") +#define MSG_UBL_EDIT_CUSTOM_MESH _UxGT("Modif.Mesh personal.") #define MSG_UBL_FINE_TUNE_MESH _UxGT("Ritocca Mesh") #define MSG_UBL_DONE_EDITING_MESH _UxGT("Modif.Mesh fatta") -#define MSG_UBL_BUILD_CUSTOM_MESH _UxGT("Crea Mesh Custom") +#define MSG_UBL_BUILD_CUSTOM_MESH _UxGT("Crea Mesh personal.") #define MSG_UBL_BUILD_MESH_MENU _UxGT("Crea Mesh") -#define MSG_UBL_BUILD_PLA_MESH _UxGT("Crea Mesh PLA") -#define MSG_UBL_BUILD_ABS_MESH _UxGT("Crea Mesh ABS") +#define MSG_UBL_BUILD_MESH_M1 _UxGT("Crea Mesh " PREHEAT_1_LABEL) +#define MSG_UBL_BUILD_MESH_M2 _UxGT("Crea Mesh " PREHEAT_2_LABEL) #define MSG_UBL_BUILD_COLD_MESH _UxGT("Crea Mesh a freddo") #define MSG_UBL_MESH_HEIGHT_ADJUST _UxGT("Aggiusta Alt. Mesh") #define MSG_UBL_MESH_HEIGHT_AMOUNT _UxGT("Altezza") #define MSG_UBL_VALIDATE_MESH_MENU _UxGT("Valida Mesh") -#define MSG_UBL_VALIDATE_PLA_MESH _UxGT("Valida Mesh PLA") -#define MSG_UBL_VALIDATE_ABS_MESH _UxGT("Valida Mesh ABS") -#define MSG_UBL_VALIDATE_CUSTOM_MESH _UxGT("Valida Mesh Custom") +#define MSG_UBL_VALIDATE_MESH_M1 _UxGT("Valida Mesh " PREHEAT_1_LABEL) +#define MSG_UBL_VALIDATE_MESH_M2 _UxGT("Valida Mesh " PREHEAT_2_LABEL) +#define MSG_UBL_VALIDATE_CUSTOM_MESH _UxGT("Valida Mesh pers.") #define MSG_UBL_CONTINUE_MESH _UxGT("Continua Mesh") #define MSG_UBL_MESH_LEVELING _UxGT("Livell. Mesh") #define MSG_UBL_3POINT_MESH_LEVELING _UxGT("Livell. 3 Punti") @@ -128,7 +137,7 @@ #define MSG_UBL_OUTPUT_MAP_CSV _UxGT("Esporta in CSV") #define MSG_UBL_OUTPUT_MAP_BACKUP _UxGT("Backup esterno") #define MSG_UBL_INFO_UBL _UxGT("Esporta Info UBL") -#define MSG_UBL_EDIT_MESH_MENU _UxGT("Modifica Mesh") +#define MSG_EDIT_MESH _UxGT("Modifica Mesh") #define MSG_UBL_FILLIN_AMOUNT _UxGT("Riempimento") #define MSG_UBL_MANUAL_FILLIN _UxGT("Riempimento Manuale") #define MSG_UBL_SMART_FILLIN _UxGT("Riempimento Smart") @@ -174,6 +183,7 @@ #define MSG_MOVE_Y _UxGT("Muovi Y") #define MSG_MOVE_Z _UxGT("Muovi Z") #define MSG_MOVE_E _UxGT("Estrusore") +#define MSG_HOTEND_TOO_COLD _UxGT("Ugello freddo") #define MSG_MOVE_01MM _UxGT("Muovi di 0.1mm") #define MSG_MOVE_1MM _UxGT("Muovi di 1mm") #define MSG_MOVE_10MM _UxGT("Muovi di 10mm") @@ -189,8 +199,8 @@ #define MSG_MAX LCD_STR_THERMOMETER _UxGT(" Max") #define MSG_FACTOR LCD_STR_THERMOMETER _UxGT(" Fact") #define MSG_AUTOTEMP _UxGT("Autotemp") -#define MSG_ON _UxGT("On ") -#define MSG_OFF _UxGT("Off") +#define MSG_LCD_ON _UxGT("On") +#define MSG_LCD_OFF _UxGT("Off") #define MSG_PID_P _UxGT("PID-P") #define MSG_PID_I _UxGT("PID-I") #define MSG_PID_D _UxGT("PID-D") @@ -215,7 +225,7 @@ #define MSG_VTRAV_MIN _UxGT("VTrav min") #define MSG_ACCELERATION _UxGT("Accelerazione") #define MSG_AMAX _UxGT("Amax ") -#define MSG_A_RETRACT _UxGT("A-retract") +#define MSG_A_RETRACT _UxGT("A-Ritrazione") #define MSG_A_TRAVEL _UxGT("A-Spostamento") #define MSG_STEPS_PER_MM _UxGT("Passi/mm") #if IS_KINEMATIC @@ -243,18 +253,20 @@ #define MSG_FILAMENT_LOAD _UxGT("Carica mm") #define MSG_ADVANCE_K _UxGT("K Avanzamento") #define MSG_CONTRAST _UxGT("Contrasto LCD") -#define MSG_STORE_EEPROM _UxGT("Salva in memoria") -#define MSG_LOAD_EEPROM _UxGT("Carica da memoria") +#define MSG_STORE_EEPROM _UxGT("Salva impostazioni") +#define MSG_LOAD_EEPROM _UxGT("Carica impostazioni") #define MSG_RESTORE_FAILSAFE _UxGT("Ripristina imp.") #define MSG_INIT_EEPROM _UxGT("Inizializza EEPROM") +#define MSG_SD_UPDATE _UxGT("Aggiorna SD") +#define MSG_RESET_PRINTER _UxGT("Resetta stampante") #define MSG_REFRESH _UxGT("Aggiorna") #define MSG_WATCH _UxGT("Schermata info") #define MSG_PREPARE _UxGT("Prepara") #define MSG_TUNE _UxGT("Regola") -#define MSG_PAUSE_PRINT _UxGT("Pausa") +#define MSG_PAUSE_PRINT _UxGT("Pausa stampa") #define MSG_RESUME_PRINT _UxGT("Riprendi stampa") #define MSG_STOP_PRINT _UxGT("Arresta stampa") -#define MSG_POWER_LOSS_RECOVERY _UxGT("Ripresa da PowerLoss") +#define MSG_OUTAGE_RECOVERY _UxGT("Ripresa da PowerLoss") #define MSG_CARD_MENU _UxGT("Stampa da SD") #define MSG_NO_CARD _UxGT("SD non presente") #define MSG_DWELL _UxGT("Sospensione...") @@ -268,18 +280,23 @@ #define MSG_CONTROL_RETRACT _UxGT("Ritrai mm") #define MSG_CONTROL_RETRACT_SWAP _UxGT("Scamb. Ritrai mm") #define MSG_CONTROL_RETRACTF _UxGT("Ritrai V") -#define MSG_CONTROL_RETRACT_ZLIFT _UxGT("Salta mm") +#define MSG_CONTROL_RETRACT_ZHOP _UxGT("Salta mm") #define MSG_CONTROL_RETRACT_RECOVER _UxGT("UnRet mm") #define MSG_CONTROL_RETRACT_RECOVER_SWAP _UxGT("Scamb. UnRet mm") #define MSG_CONTROL_RETRACT_RECOVERF _UxGT("UnRet V") #define MSG_CONTROL_RETRACT_RECOVER_SWAPF _UxGT("S UnRet V") #define MSG_AUTORETRACT _UxGT("AutoRitrai") +#define MSG_FILAMENT_SWAP_LENGTH _UxGT("Dist. ritrazione") +#define MSG_TOOL_CHANGE _UxGT("Cambio utensile") +#define MSG_TOOL_CHANGE_ZLIFT _UxGT("Risalita Z") +#define MSG_SINGLENOZZLE_PRIME_SPD _UxGT("Velocità innesco") +#define MSG_SINGLENOZZLE_RETRACT_SPD _UxGT("Velocità retrazione") #define MSG_FILAMENTCHANGE _UxGT("Cambia filamento") #define MSG_FILAMENTLOAD _UxGT("Carica filamento") #define MSG_FILAMENTUNLOAD _UxGT("Rimuovi filamento") #define MSG_FILAMENTUNLOAD_ALL _UxGT("Rimuovi tutto") #define MSG_INIT_SDCARD _UxGT("Iniz. SD-Card") -#define MSG_CNG_SDCARD _UxGT("Cambia SD-Card") +#define MSG_CHANGE_SDCARD _UxGT("Cambia SD-Card") #define MSG_ZPROBE_OUT _UxGT("Z probe fuori piatto") #define MSG_SKEW_FACTOR _UxGT("Fattore distorsione") #define MSG_BLTOUCH _UxGT("BLTouch") @@ -287,13 +304,15 @@ #define MSG_BLTOUCH_RESET _UxGT("Resetta BLTouch") #define MSG_BLTOUCH_DEPLOY _UxGT("Estendi BLTouch") #define MSG_BLTOUCH_STOW _UxGT("Ritrai BLTouch") -#define MSG_HOME _UxGT("Home") // Used as MSG_HOME " " MSG_X MSG_Y MSG_Z " " MSG_FIRST +#define MSG_MANUAL_DEPLOY _UxGT("Estendi Sonda-Z") +#define MSG_MANUAL_STOW _UxGT("Ritrai Sonda-Z") +#define MSG_HOME _UxGT("Home") // Usato come MSG_HOME " " MSG_X MSG_Y MSG_Z " " MSG_FIRST #define MSG_FIRST _UxGT("prima") -#define MSG_ZPROBE_ZOFFSET _UxGT("Z Offset") +#define MSG_ZPROBE_ZOFFSET _UxGT("Offset sonda Z") #define MSG_BABYSTEP_X _UxGT("Babystep X") #define MSG_BABYSTEP_Y _UxGT("Babystep Y") #define MSG_BABYSTEP_Z _UxGT("Babystep Z") -#define MSG_ENDSTOP_ABORT _UxGT("Finecorsa abort") +#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") #define MSG_ERR_REDUNDANT_TEMP _UxGT("Err: TEMP RIDONDANTE") @@ -306,9 +325,9 @@ #define MSG_ERR_Z_HOMING MSG_HOME _UxGT(" ") MSG_X MSG_Y _UxGT(" ") MSG_FIRST #define MSG_HALTED _UxGT("STAMPANTE FERMATA") #define MSG_PLEASE_RESET _UxGT("Riavviare prego") -#define MSG_SHORT_DAY _UxGT("g") // One character only -#define MSG_SHORT_HOUR _UxGT("h") // One character only -#define MSG_SHORT_MINUTE _UxGT("m") // One character only +#define MSG_SHORT_DAY _UxGT("g") // Un solo carattere +#define MSG_SHORT_HOUR _UxGT("h") // Un solo carattere +#define MSG_SHORT_MINUTE _UxGT("m") // Un solo carattere #define MSG_HEATING _UxGT("Riscaldamento...") #define MSG_COOLING _UxGT("Raffreddamento..") #define MSG_BED_HEATING _UxGT("Risc. piatto...") @@ -321,7 +340,7 @@ #define MSG_DELTA_SETTINGS _UxGT("Impostaz. Delta") #define MSG_DELTA_AUTO_CALIBRATE _UxGT("Auto calibrazione") #define MSG_DELTA_HEIGHT_CALIBRATE _UxGT("Imp. altezza Delta") -#define MSG_DELTA_Z_OFFSET_CALIBRATE _UxGT("Probe Z-offset") +#define MSG_DELTA_Z_OFFSET_CALIBRATE _UxGT("Offset sonda-Z") #define MSG_DELTA_DIAG_ROD _UxGT("Barra Diagonale") #define MSG_DELTA_HEIGHT _UxGT("Altezza") #define MSG_DELTA_RADIUS _UxGT("Raggio") @@ -363,47 +382,55 @@ #define MSG_FILAMENT_CHANGE_HEADER_LOAD _UxGT("CARICA FILAMENTO") #define MSG_FILAMENT_CHANGE_HEADER_UNLOAD _UxGT("RIMUOVI FILAMENTO") #define MSG_FILAMENT_CHANGE_OPTION_HEADER _UxGT("OPZIONI RIPRESA:") -#define MSG_FILAMENT_CHANGE_OPTION_PURGE _UxGT("Libera di piu") +#define MSG_FILAMENT_CHANGE_OPTION_PURGE _UxGT("Spurga di più") #define MSG_FILAMENT_CHANGE_OPTION_RESUME _UxGT("Riprendi stampa") #define MSG_FILAMENT_CHANGE_NOZZLE _UxGT(" Ugello: ") +#define MSG_RUNOUT_SENSOR_ENABLE _UxGT("Sens.filo terminato") #define MSG_ERR_HOMING_FAILED _UxGT("Home fallito") -#define MSG_ERR_PROBING_FAILED _UxGT("Probing fallito") +#define MSG_ERR_PROBING_FAILED _UxGT("Sondaggio fallito") #define MSG_M600_TOO_COLD _UxGT("M600:Troppo freddo") +// +// Le schermate di Cambio Filamento possono visualizzare fino a 3 linee su un display a 4 righe +// ...o fino a 2 linee su un display a 3 righe. #if LCD_HEIGHT >= 4 - // Up to 3 lines allowed + #define MSG_ADVANCED_PAUSE_WAITING_1 _UxGT("Premi per") + #define MSG_ADVANCED_PAUSE_WAITING_2 _UxGT("riprendere") + #define MSG_ADVANCED_PAUSE_WAITING_3 _UxGT("la stampa") #define MSG_FILAMENT_CHANGE_INIT_1 _UxGT("Attendere avvio") #define MSG_FILAMENT_CHANGE_INIT_2 _UxGT("del cambio") #define MSG_FILAMENT_CHANGE_INIT_3 _UxGT("di filamento") + #define MSG_FILAMENT_CHANGE_INSERT_1 _UxGT("Inserisci il") + #define MSG_FILAMENT_CHANGE_INSERT_2 _UxGT("filamento e premi") + #define MSG_FILAMENT_CHANGE_INSERT_3 _UxGT("per continuare") + #define MSG_FILAMENT_CHANGE_HEAT_1 _UxGT("Premi per") + #define MSG_FILAMENT_CHANGE_HEAT_2 _UxGT("riscaldare ugello") + #define MSG_FILAMENT_CHANGE_HEATING_1 _UxGT("Riscaldam. ugello") + #define MSG_FILAMENT_CHANGE_HEATING_2 _UxGT("Attendere prego...") #define MSG_FILAMENT_CHANGE_UNLOAD_1 _UxGT("Attendere") #define MSG_FILAMENT_CHANGE_UNLOAD_2 _UxGT("l'espulsione") #define MSG_FILAMENT_CHANGE_UNLOAD_3 _UxGT("del filamento") - #define MSG_FILAMENT_CHANGE_INSERT_1 _UxGT("Inserisci il") - #define MSG_FILAMENT_CHANGE_INSERT_2 _UxGT("filamento e") - #define MSG_FILAMENT_CHANGE_INSERT_3 _UxGT("premi per cont") - #define MSG_FILAMENT_CHANGE_HEAT_1 _UxGT("Premi per") - #define MSG_FILAMENT_CHANGE_HEAT_2 _UxGT("riscald. ugello") - #define MSG_FILAMENT_CHANGE_HEATING_1 _UxGT("Riscald. ugello") - #define MSG_FILAMENT_CHANGE_HEATING_2 _UxGT("Attendere...") #define MSG_FILAMENT_CHANGE_LOAD_1 _UxGT("Attendere") #define MSG_FILAMENT_CHANGE_LOAD_2 _UxGT("il caricamento") #define MSG_FILAMENT_CHANGE_LOAD_3 _UxGT("del filamento") #define MSG_FILAMENT_CHANGE_PURGE_1 _UxGT("Attendere") #define MSG_FILAMENT_CHANGE_PURGE_2 _UxGT("lo spurgo") #define MSG_FILAMENT_CHANGE_PURGE_3 _UxGT("del filamento") + #define MSG_FILAMENT_CHANGE_CONT_PURGE_1 _UxGT("Premi x terminare") + #define MSG_FILAMENT_CHANGE_CONT_PURGE_2 _UxGT("lo spurgo") + #define MSG_FILAMENT_CHANGE_CONT_PURGE_3 _UxGT("del filamento") #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Attendere") #define MSG_FILAMENT_CHANGE_RESUME_2 _UxGT("la ripresa") - #define MSG_FILAMENT_CHANGE_RESUME_3 _UxGT("della stampa") + #define MSG_FILAMENT_CHANGE_RESUME_3 _UxGT("della stampa...") #else // LCD_HEIGHT < 4 - // Up to 2 lines allowed + #define MSG_ADVANCED_PAUSE_WAITING_1 _UxGT("Premi x continuare") #define MSG_FILAMENT_CHANGE_INIT_1 _UxGT("Attendere...") - #define MSG_FILAMENT_CHANGE_UNLOAD_1 _UxGT("Espulsione...") #define MSG_FILAMENT_CHANGE_INSERT_1 _UxGT("Inserisci e premi") #define MSG_FILAMENT_CHANGE_HEAT_1 _UxGT("Riscalda ugello") #define MSG_FILAMENT_CHANGE_HEATING_1 _UxGT("Riscaldamento...") + #define MSG_FILAMENT_CHANGE_UNLOAD_1 _UxGT("Espulsione...") #define MSG_FILAMENT_CHANGE_LOAD_1 _UxGT("Caricamento...") #define MSG_FILAMENT_CHANGE_PURGE_1 _UxGT("Spurgo filamento") + #define MSG_FILAMENT_CHANGE_CONT_PURGE_1 _UxGT("Premi x terminare") #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Ripresa...") #endif // LCD_HEIGHT < 4 - -#endif // LANGUAGE_IT_H diff --git a/Marlin/src/lcd/language/language_jp-kana.h b/Marlin/src/lcd/language/language_jp-kana.h index 3bda84803a..b95285a85f 100644 --- a/Marlin/src/lcd/language/language_jp-kana.h +++ b/Marlin/src/lcd/language/language_jp-kana.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Japanese (Kana) @@ -29,9 +30,6 @@ * */ -#ifndef LANGUAGE_KANA_UTF_H -#define LANGUAGE_KANA_UTF_H - #define DISPLAY_CHARSET_ISO10646_KANA #define CHARSIZE 3 @@ -60,15 +58,15 @@ #define MSG_SET_HOME_OFFSETS _UxGT("キジュンオフセットセッテイ") // "Set home offsets" #define MSG_HOME_OFFSETS_APPLIED _UxGT("オフセットガテキヨウサレマシタ") // "Offsets applied" #define MSG_SET_ORIGIN _UxGT("キジュンセット") // "Set origin" -#define MSG_PREHEAT_1 _UxGT("PLA ヨネツ") // "Preheat PLA" +#define MSG_PREHEAT_1 _UxGT(PREHEAT_1_LABEL " ヨネツ") // "Preheat " PREHEAT_1_LABEL #define MSG_PREHEAT_1_N MSG_PREHEAT_1 _UxGT(" ") -#define MSG_PREHEAT_1_ALL _UxGT("PLA スベテヨネツ") // " All" -#define MSG_PREHEAT_1_BEDONLY _UxGT("PLA ベッドヨネツ") // " Bed" +#define MSG_PREHEAT_1_ALL _UxGT(PREHEAT_1_LABEL " スベテヨネツ") // " All" +#define MSG_PREHEAT_1_BEDONLY _UxGT(PREHEAT_1_LABEL " ベッドヨネツ") // " Bed" #define MSG_PREHEAT_1_SETTINGS MSG_PREHEAT_1 _UxGT("セッテイ") // " conf" -#define MSG_PREHEAT_2 _UxGT("ABS ヨネツ") // "Preheat ABS" +#define MSG_PREHEAT_2 _UxGT(PREHEAT_2_LABEL " ヨネツ") // "Preheat " PREHEAT_2_LABEL #define MSG_PREHEAT_2_N MSG_PREHEAT_2 _UxGT(" ") -#define MSG_PREHEAT_2_ALL _UxGT("ABS スベテヨネツ") // " All" -#define MSG_PREHEAT_2_BEDONLY _UxGT("ABS ベッドヨネツ") // " Bed" +#define MSG_PREHEAT_2_ALL _UxGT(PREHEAT_2_LABEL " スベテヨネツ") // " All" +#define MSG_PREHEAT_2_BEDONLY _UxGT(PREHEAT_2_LABEL " ベッドヨネツ") // " Bed" #define MSG_PREHEAT_2_SETTINGS MSG_PREHEAT_2 _UxGT("セッテイ") // " conf" #define MSG_COOLDOWN _UxGT("カネツテイシ") // "Cooldown" #define MSG_SWITCH_PS_ON _UxGT("デンゲン オン") // "Switch power on" @@ -99,8 +97,8 @@ #define MSG_MAX _UxGT(" ") LCD_STR_THERMOMETER _UxGT(" サイコウ") // " Max" #define MSG_FACTOR _UxGT(" ") LCD_STR_THERMOMETER _UxGT(" ファクター") // " Fact" #define MSG_AUTOTEMP _UxGT("ジドウオンドセイギョ") // "Autotemp" -#define MSG_ON _UxGT("オン ") // "On " -#define MSG_OFF _UxGT("オフ ") // "Off" +#define MSG_LCD_ON _UxGT("オン") // "On" +#define MSG_LCD_OFF _UxGT("オフ") // "Off" #define MSG_PID_P _UxGT("PID-P") #define MSG_PID_I _UxGT("PID-I") #define MSG_PID_D _UxGT("PID-D") @@ -152,14 +150,14 @@ #define MSG_CONTROL_RETRACT _UxGT("ヒキコミリョウ mm") // "Retract mm" #define MSG_CONTROL_RETRACT_SWAP _UxGT("ヒキコミリョウS mm") // "Swap Re.mm" #define MSG_CONTROL_RETRACTF _UxGT("ヒキコミソクド mm/s") // "Retract V" -#define MSG_CONTROL_RETRACT_ZLIFT _UxGT("ノズルタイヒ mm") // "Hop mm" +#define MSG_CONTROL_RETRACT_ZHOP _UxGT("ノズルタイヒ mm") // "Hop mm" #define MSG_CONTROL_RETRACT_RECOVER _UxGT("ホショウリョウ mm") // "UnRet mm" #define MSG_CONTROL_RETRACT_RECOVER_SWAP _UxGT("ホショウリョウS mm") // "S UnRet mm" #define MSG_CONTROL_RETRACT_RECOVERF _UxGT("ホショウソクド mm/s") // "UnRet V" #define MSG_AUTORETRACT _UxGT("ジドウヒキコミ") // "AutoRetr." #define MSG_FILAMENTCHANGE _UxGT("フィラメントコウカン") // "Change filament" #define MSG_INIT_SDCARD _UxGT("SDカードサイヨミコミ") // "Init. SD card" -#define MSG_CNG_SDCARD _UxGT("SDカードコウカン") // "Change SD card" +#define MSG_CHANGE_SDCARD _UxGT("SDカードコウカン") // "Change SD card" #define MSG_ZPROBE_OUT _UxGT("Zプローブ ベッドガイ") // "Z probe out. bed" #define MSG_BLTOUCH_SELFTEST _UxGT("BLTouch ジコシンダン") // "BLTouch Self-Test" #define MSG_BLTOUCH_RESET _UxGT("BLTouch リセット") // "Reset BLTouch" @@ -221,5 +219,3 @@ #define MSG_FILAMENT_CHANGE_LOAD_2 _UxGT("シバラクオマチクダサイ") // "filament load" #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("プリントヲサイカイシマス") // "Wait for print" #define MSG_FILAMENT_CHANGE_RESUME_2 _UxGT("シバラクオマチクダサイ") // "to resume" - -#endif // LANGUAGE_KANA_UTF_H diff --git a/Marlin/src/lcd/language/language_ko_KR.h b/Marlin/src/lcd/language/language_ko_KR.h new file mode 100644 index 0000000000..d6e9023b15 --- /dev/null +++ b/Marlin/src/lcd/language/language_ko_KR.h @@ -0,0 +1,413 @@ +/** + * 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 . + * + */ +#pragma once + +/** + * Korean + * + * LCD Menu Messages + * See also http://marlinfw.org/docs/development/lcd_language.html + * + */ + +#define CHARSIZE 1 + +#define WELCOME_MSG MACHINE_NAME _UxGT(" 준비.") +#define MSG_BACK _UxGT("뒤로") +#define MSG_SD_INSERTED _UxGT("카드 삽입됨") +#define MSG_SD_REMOVED _UxGT("카드 제거됨") +#define MSG_LCD_ENDSTOPS _UxGT("엔드스탑") +#define MSG_LCD_SOFT_ENDSTOPS _UxGT("소프트 엔드스탑") +#define MSG_MAIN _UxGT("뒤로") +#define MSG_ADVANCED_SETTINGS _UxGT("고급 설정") +#define MSG_CONFIGURATION _UxGT("설정") +#define MSG_AUTOSTART _UxGT("자동 시작") +#define MSG_DISABLE_STEPPERS _UxGT("모터 정지") +#define MSG_DEBUG_MENU _UxGT("디버깅 메뉴") +#define MSG_PROGRESS_BAR_TEST _UxGT("프로그레스바 테스트") +#define MSG_AUTO_HOME _UxGT("오토홈") +#define MSG_AUTO_HOME_X _UxGT("X 홈으로") +#define MSG_AUTO_HOME_Y _UxGT("Y 홈으로") +#define MSG_AUTO_HOME_Z _UxGT("Z 홈으로") +#define MSG_TMC_Z_CALIBRATION _UxGT("Z 캘리브레이션") +#define MSG_LEVEL_BED_HOMING _UxGT("XYZ 홈으로") +#define MSG_LEVEL_BED_WAITING _UxGT("누르면 시작합니다") +#define MSG_LEVEL_BED_NEXT_POINT _UxGT("다음 Point") +#define MSG_LEVEL_BED_DONE _UxGT("레벨링 완료!") +#define MSG_Z_FADE_HEIGHT _UxGT("Fade Height") +#define MSG_SET_HOME_OFFSETS _UxGT("Set home offsets") +#define MSG_HOME_OFFSETS_APPLIED _UxGT("Offsets applied") +#define MSG_SET_ORIGIN _UxGT("Set origin") +#define MSG_PREHEAT_1 _UxGT("예열하기 - " PREHEAT_1_LABEL) +#define MSG_PREHEAT_1_N MSG_PREHEAT_1 _UxGT(" ") +#define MSG_PREHEAT_1_ALL MSG_PREHEAT_1 _UxGT(" 모두") +#define MSG_PREHEAT_1_END MSG_PREHEAT_1 _UxGT(" 노즐만") +#define MSG_PREHEAT_1_BEDONLY MSG_PREHEAT_1 _UxGT(" 베드만") +#define MSG_PREHEAT_1_SETTINGS MSG_PREHEAT_1 _UxGT(" conf") +#define MSG_PREHEAT_2 _UxGT("예열하기 - " PREHEAT_2_LABEL) +#define MSG_PREHEAT_2_N MSG_PREHEAT_2 _UxGT(" ") +#define MSG_PREHEAT_2_ALL MSG_PREHEAT_2 _UxGT(" 모두") +#define MSG_PREHEAT_2_END MSG_PREHEAT_2 _UxGT(" 노즐만") +#define MSG_PREHEAT_2_BEDONLY MSG_PREHEAT_2 _UxGT(" 베드만") +#define MSG_PREHEAT_2_SETTINGS MSG_PREHEAT_2 _UxGT(" conf") +#define MSG_PREHEAT_CUSTOM _UxGT("Custom 예열") +#define MSG_COOLDOWN _UxGT("식히기") +#define MSG_SWITCH_PS_ON _UxGT("스위치 전원 켜기") +#define MSG_SWITCH_PS_OFF _UxGT("스위치 전원 끄기") +#define MSG_EXTRUDE _UxGT("밀어내기") +#define MSG_RETRACT _UxGT("당기기") +#define MSG_MOVE_AXIS _UxGT("축 이동") +#define MSG_BED_LEVELING _UxGT("베드 레벨링") +#define MSG_LEVEL_BED _UxGT("Level bed") +#define MSG_LEVEL_CORNERS _UxGT("Level corners") +#define MSG_NEXT_CORNER _UxGT("Next corner") +#define MSG_EDITING_STOPPED _UxGT("Mesh Editing Stopped") +#define MSG_USER_MENU _UxGT("Custom User Commands") +#define MSG_UBL_DOING_G29 _UxGT("오토레벨링 하기") +#define MSG_UBL_UNHOMED _UxGT("Home XYZ first") +#define MSG_UBL_TOOLS _UxGT("UBL Tools") +#define MSG_UBL_LEVEL_BED _UxGT("Unified Bed Leveling") +#define MSG_IDEX_MENU _UxGT("IDEX Mode") +#define MSG_IDEX_MODE_AUTOPARK _UxGT("Auto-Park") +#define MSG_IDEX_MODE_DUPLICATE _UxGT("Duplication") +#define MSG_IDEX_MODE_SCALED_COPY _UxGT("Scaled copy") +#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_UBL_MANUAL_MESH _UxGT("Manually Build Mesh") +#define MSG_UBL_BC_INSERT _UxGT("Place shim & measure") +#define MSG_UBL_BC_INSERT2 _UxGT("Measure") +#define MSG_UBL_BC_REMOVE _UxGT("Remove & measure bed") +#define MSG_UBL_MOVING_TO_NEXT _UxGT("Moving to next") +#define MSG_UBL_ACTIVATE_MESH _UxGT("Activate UBL") +#define MSG_UBL_DEACTIVATE_MESH _UxGT("Deactivate UBL") +#define MSG_UBL_SET_TEMP_BED _UxGT("Bed Temp") +#define MSG_UBL_BED_TEMP_CUSTOM MSG_UBL_SET_TEMP_BED +#define MSG_UBL_SET_TEMP_HOTEND _UxGT("Hotend Temp") +#define MSG_UBL_HOTEND_TEMP_CUSTOM MSG_UBL_SET_TEMP_HOTEND +#define MSG_UBL_MESH_EDIT _UxGT("Mesh Edit") +#define MSG_UBL_EDIT_CUSTOM_MESH _UxGT("Edit Custom Mesh") +#define MSG_UBL_FINE_TUNE_MESH _UxGT("Fine Tuning Mesh") +#define MSG_UBL_DONE_EDITING_MESH _UxGT("Done Editing Mesh") +#define MSG_UBL_BUILD_CUSTOM_MESH _UxGT("Build Custom Mesh") +#define MSG_UBL_BUILD_MESH_MENU _UxGT("Build Mesh") +#define MSG_UBL_BUILD_MESH_M1 _UxGT("Build Mesh (" PREHEAT_1_LABEL ")") +#define MSG_UBL_BUILD_MESH_M2 _UxGT("Build Mesh (" PREHEAT_2_LABEL ")") +#define MSG_UBL_BUILD_COLD_MESH _UxGT("Build Cold Mesh") +#define MSG_UBL_MESH_HEIGHT_ADJUST _UxGT("Adjust Mesh Height") +#define MSG_UBL_MESH_HEIGHT_AMOUNT _UxGT("Height Amount") +#define MSG_UBL_VALIDATE_MESH_MENU _UxGT("Validate Mesh") +#define MSG_UBL_VALIDATE_MESH_M1 _UxGT("Validate " PREHEAT_1_LABEL " Mesh") +#define MSG_UBL_VALIDATE_MESH_M2 _UxGT("Validate Mesh (" PREHEAT_2_LABEL ")") +#define MSG_UBL_VALIDATE_CUSTOM_MESH _UxGT("Validate Custom Mesh") +#define MSG_UBL_CONTINUE_MESH _UxGT("Continue Bed Mesh") +#define MSG_UBL_MESH_LEVELING _UxGT("Mesh Leveling") +#define MSG_UBL_3POINT_MESH_LEVELING _UxGT("3-Point Leveling") +#define MSG_UBL_GRID_MESH_LEVELING _UxGT("Grid Mesh Leveling") +#define MSG_UBL_MESH_LEVEL _UxGT("Level Mesh") +#define MSG_UBL_SIDE_POINTS _UxGT("Side Points") +#define MSG_UBL_MAP_TYPE _UxGT("Map Type") +#define MSG_UBL_OUTPUT_MAP _UxGT("Output Mesh Map") +#define MSG_UBL_OUTPUT_MAP_HOST _UxGT("Output for Host") +#define MSG_UBL_OUTPUT_MAP_CSV _UxGT("Output for CSV") +#define MSG_UBL_OUTPUT_MAP_BACKUP _UxGT("Off Printer Backup") +#define MSG_UBL_INFO_UBL _UxGT("Output UBL Info") +#define MSG_EDIT_MESH _UxGT("Edit Mesh") +#define MSG_UBL_FILLIN_AMOUNT _UxGT("Fill-in Amount") +#define MSG_UBL_MANUAL_FILLIN _UxGT("Manual Fill-in") +#define MSG_UBL_SMART_FILLIN _UxGT("Smart Fill-in") +#define MSG_UBL_FILLIN_MESH _UxGT("Fill-in Mesh") +#define MSG_UBL_INVALIDATE_ALL _UxGT("Invalidate All") +#define MSG_UBL_INVALIDATE_CLOSEST _UxGT("Invalidate Closest") +#define MSG_UBL_FINE_TUNE_ALL _UxGT("Fine Tune All") +#define MSG_UBL_FINE_TUNE_CLOSEST _UxGT("Fine Tune Closest") +#define MSG_UBL_STORAGE_MESH_MENU _UxGT("Mesh Storage") +#define MSG_UBL_STORAGE_SLOT _UxGT("Memory Slot") +#define MSG_UBL_LOAD_MESH _UxGT("Load Bed Mesh") +#define MSG_UBL_SAVE_MESH _UxGT("Save Bed Mesh") +#define MSG_MESH_LOADED _UxGT("Mesh %i loaded") +#define MSG_MESH_SAVED _UxGT("Mesh %i saved") +#define MSG_NO_STORAGE _UxGT("No storage") +#define MSG_UBL_SAVE_ERROR _UxGT("Err: UBL Save") +#define MSG_UBL_RESTORE_ERROR _UxGT("Err: UBL Restore") +#define MSG_UBL_Z_OFFSET_STOPPED _UxGT("Z-Offset Stopped") +#define MSG_UBL_STEP_BY_STEP_MENU _UxGT("Step-By-Step UBL") + +#define MSG_LED_CONTROL _UxGT("LED Control") +#define MSG_LEDS _UxGT("Lights") +#define MSG_LED_PRESETS _UxGT("Light Presets") +#define MSG_SET_LEDS_RED _UxGT("Red") +#define MSG_SET_LEDS_ORANGE _UxGT("Orange") +#define MSG_SET_LEDS_YELLOW _UxGT("Yellow") +#define MSG_SET_LEDS_GREEN _UxGT("Green") +#define MSG_SET_LEDS_BLUE _UxGT("Blue") +#define MSG_SET_LEDS_INDIGO _UxGT("Indigo") +#define MSG_SET_LEDS_VIOLET _UxGT("Violet") +#define MSG_SET_LEDS_WHITE _UxGT("White") +#define MSG_SET_LEDS_DEFAULT _UxGT("Default") +#define MSG_CUSTOM_LEDS _UxGT("Custom Lights") +#define MSG_INTENSITY_R _UxGT("Red Intensity") +#define MSG_INTENSITY_G _UxGT("Green Intensity") +#define MSG_INTENSITY_B _UxGT("Blue Intensity") +#define MSG_INTENSITY_W _UxGT("White Intensity") +#define MSG_LED_BRIGHTNESS _UxGT("Brightness") + +#define MSG_MOVING _UxGT("Moving...") +#define MSG_FREE_XY _UxGT("Free XY") +#define MSG_MOVE_X _UxGT("Move X") +#define MSG_MOVE_Y _UxGT("Move Y") +#define MSG_MOVE_Z _UxGT("Move Z") +#define MSG_MOVE_E _UxGT("Extruder") +#define MSG_MOVE_01MM _UxGT("Move 0.1mm") +#define MSG_MOVE_1MM _UxGT("Move 1mm") +#define MSG_MOVE_10MM _UxGT("Move 10mm") +#define MSG_SPEED _UxGT("Speed") +#define MSG_BED_Z _UxGT("Bed Z") +#define MSG_NOZZLE _UxGT("노즐") +#define MSG_BED _UxGT("베드") +#define MSG_FAN_SPEED _UxGT("펜 속도") +#define MSG_EXTRA_FAN_SPEED _UxGT("엑스트라 펜 속도") +#define MSG_FLOW _UxGT("Flow") +#define MSG_CONTROL _UxGT("Control") +#define MSG_MIN _UxGT(" ") LCD_STR_THERMOMETER _UxGT(" Min") +#define MSG_MAX _UxGT(" ") LCD_STR_THERMOMETER _UxGT(" Max") +#define MSG_FACTOR _UxGT(" ") LCD_STR_THERMOMETER _UxGT(" Fact") +#define MSG_AUTOTEMP _UxGT("Autotemp") +#define MSG_LCD_ON _UxGT("On") +#define MSG_LCD_OFF _UxGT("Off") +#define MSG_PID_P _UxGT("PID-P") +#define MSG_PID_I _UxGT("PID-I") +#define MSG_PID_D _UxGT("PID-D") +#define MSG_PID_C _UxGT("PID-C") +#define MSG_SELECT _UxGT("Select") +#define MSG_ACC _UxGT("Accel") +#define MSG_JERK _UxGT("Jerk") +#if IS_KINEMATIC + #define MSG_VA_JERK _UxGT("Va-jerk") + #define MSG_VB_JERK _UxGT("Vb-jerk") + #define MSG_VC_JERK _UxGT("Vc-jerk") +#else + #define MSG_VA_JERK _UxGT("Vx-jerk") + #define MSG_VB_JERK _UxGT("Vy-jerk") + #define MSG_VC_JERK _UxGT("Vz-jerk") +#endif +#define MSG_VE_JERK _UxGT("Ve-jerk") +#define MSG_JUNCTION_DEVIATION _UxGT("Junction Dev") +#define MSG_VELOCITY _UxGT("Velocity") +#define MSG_VMAX _UxGT("Vmax ") +#define MSG_VMIN _UxGT("Vmin") +#define MSG_VTRAV_MIN _UxGT("VTrav min") +#define MSG_ACCELERATION _UxGT("Acceleration") +#define MSG_AMAX _UxGT("Amax ") +#define MSG_A_RETRACT _UxGT("A-retract") +#define MSG_A_TRAVEL _UxGT("A-travel") +#define MSG_STEPS_PER_MM _UxGT("Steps/mm") +#if IS_KINEMATIC + #define MSG_ASTEPS _UxGT("Asteps/mm") + #define MSG_BSTEPS _UxGT("Bsteps/mm") + #define MSG_CSTEPS _UxGT("Csteps/mm") +#else + #define MSG_ASTEPS _UxGT("Xsteps/mm") + #define MSG_BSTEPS _UxGT("Ysteps/mm") + #define MSG_CSTEPS _UxGT("Zsteps/mm") +#endif +#define MSG_ESTEPS _UxGT("Esteps/mm") +#define MSG_E1STEPS _UxGT("E1steps/mm") +#define MSG_E2STEPS _UxGT("E2steps/mm") +#define MSG_E3STEPS _UxGT("E3steps/mm") +#define MSG_E4STEPS _UxGT("E4steps/mm") +#define MSG_E5STEPS _UxGT("E5steps/mm") +#define MSG_E6STEPS _UxGT("E6steps/mm") +#define MSG_TEMPERATURE _UxGT("온도") +#define MSG_MOTION _UxGT("동작") +#define MSG_FILAMENT _UxGT("Filament") +#define MSG_VOLUMETRIC_ENABLED _UxGT("E in mm3") +#define MSG_FILAMENT_DIAM _UxGT("Fil. Dia.") +#define MSG_FILAMENT_UNLOAD _UxGT("Unload mm") +#define MSG_FILAMENT_LOAD _UxGT("Load mm") +#define MSG_ADVANCE_K _UxGT("Advance K") +#define MSG_CONTRAST _UxGT("LCD contrast") +#define MSG_STORE_EEPROM _UxGT("설정 저장하기") +#define MSG_LOAD_EEPROM _UxGT("설정 읽어오기") +#define MSG_RESTORE_FAILSAFE _UxGT("설정 되돌리기") +#define MSG_INIT_EEPROM _UxGT("EEPROM 초기화") +#define MSG_REFRESH _UxGT("새로고침") +#define MSG_WATCH _UxGT("처음으로") +#define MSG_PREPARE _UxGT("준비하기") +#define MSG_TUNE _UxGT("Tune") +#define MSG_PAUSE_PRINT _UxGT("일시정지") +#define MSG_RESUME_PRINT _UxGT("재시작") +#define MSG_STOP_PRINT _UxGT("출력중지") +#define MSG_OUTAGE_RECOVERY _UxGT("Outage Recovery") +#define MSG_CARD_MENU _UxGT("SD 카드출력") +#define MSG_NO_CARD _UxGT("SD 카드없음") +#define MSG_DWELL _UxGT("슬립모드...") +#define MSG_USERWAIT _UxGT("Click to resume...") +#define MSG_PRINT_PAUSED _UxGT("일시 정지됨") +#define MSG_PRINTING _UxGT("출력중...") +#define MSG_PRINT_ABORTED _UxGT("취소됨") +#define MSG_NO_MOVE _UxGT("No move.") +#define MSG_KILLED _UxGT("죽음. ") +#define MSG_STOPPED _UxGT("멈춤. ") +#define MSG_CONTROL_RETRACT _UxGT("Retract mm") +#define MSG_CONTROL_RETRACT_SWAP _UxGT("Swap Re.mm") +#define MSG_CONTROL_RETRACTF _UxGT("Retract V") +#define MSG_CONTROL_RETRACT_ZHOP _UxGT("Hop mm") +#define MSG_CONTROL_RETRACT_RECOVER _UxGT("UnRet mm") +#define MSG_CONTROL_RETRACT_RECOVER_SWAP _UxGT("S UnRet mm") +#define MSG_CONTROL_RETRACT_RECOVERF _UxGT("UnRet V") +#define MSG_CONTROL_RETRACT_RECOVER_SWAPF _UxGT("S UnRet V") +#define MSG_AUTORETRACT _UxGT("AutoRetr.") +#define MSG_FILAMENTCHANGE _UxGT("Change filament") +#define MSG_FILAMENTLOAD _UxGT("Load filament") +#define MSG_FILAMENTUNLOAD _UxGT("Unload filament") +#define MSG_FILAMENTUNLOAD_ALL _UxGT("Unload All") +#define MSG_INIT_SDCARD _UxGT("Init. SD card") +#define MSG_CHANGE_SDCARD _UxGT("Change SD card") +#define MSG_ZPROBE_OUT _UxGT("Z Probe past bed") +#define MSG_SKEW_FACTOR _UxGT("Skew Factor") +#define MSG_BLTOUCH _UxGT("BLTouch") +#define MSG_BLTOUCH_SELFTEST _UxGT("BLTouch Self-Test") +#define MSG_BLTOUCH_RESET _UxGT("Reset BLTouch") +#define MSG_BLTOUCH_DEPLOY _UxGT("Deploy BLTouch") +#define MSG_BLTOUCH_STOW _UxGT("Stow BLTouch") +#define MSG_MANUAL_DEPLOY _UxGT("Deploy Z-Probe") +#define MSG_MANUAL_STOW _UxGT("Stow Z-Probe") +#define MSG_HOME _UxGT("Home") // Used as MSG_HOME " " MSG_X MSG_Y MSG_Z " " MSG_FIRST +#define MSG_FIRST _UxGT("first") +#define MSG_ZPROBE_ZOFFSET _UxGT("Probe Z Offset") +#define MSG_BABYSTEP_X _UxGT("Babystep X") +#define MSG_BABYSTEP_Y _UxGT("Babystep Y") +#define MSG_BABYSTEP_Z _UxGT("Babystep Z") +#define MSG_ENDSTOP_ABORT _UxGT("Endstop abort") +#define MSG_HEATING_FAILED_LCD _UxGT("Heating failed") +#define MSG_HEATING_FAILED_LCD_BED _UxGT("Bed heating failed") +#define MSG_ERR_REDUNDANT_TEMP _UxGT("Err: REDUNDANT TEMP") +#define MSG_THERMAL_RUNAWAY _UxGT("THERMAL RUNAWAY") +#define MSG_THERMAL_RUNAWAY_BED _UxGT("BED THERMAL RUNAWAY") +#define MSG_ERR_MAXTEMP _UxGT("Err: MAXTEMP") +#define MSG_ERR_MINTEMP _UxGT("Err: MINTEMP") +#define MSG_ERR_MAXTEMP_BED _UxGT("Err: MAXTEMP BED") +#define MSG_ERR_MINTEMP_BED _UxGT("Err: MINTEMP BED") +#define MSG_ERR_Z_HOMING MSG_HOME _UxGT(" ") MSG_X MSG_Y _UxGT(" ") MSG_FIRST +#define MSG_HALTED _UxGT("PRINTER HALTED") +#define MSG_PLEASE_RESET _UxGT("Please reset") +#define MSG_SHORT_DAY _UxGT("d") // One character only +#define MSG_SHORT_HOUR _UxGT("h") // One character only +#define MSG_SHORT_MINUTE _UxGT("m") // One character only +#define MSG_HEATING _UxGT("Heating...") +#define MSG_COOLING _UxGT("Cooling...") +#define MSG_BED_HEATING _UxGT("Bed heating...") +#define MSG_BED_COOLING _UxGT("Bed cooling...") +#define MSG_DELTA_CALIBRATE _UxGT("Delta Calibration") +#define MSG_DELTA_CALIBRATE_X _UxGT("Calibrate X") +#define MSG_DELTA_CALIBRATE_Y _UxGT("Calibrate Y") +#define MSG_DELTA_CALIBRATE_Z _UxGT("Calibrate Z") +#define MSG_DELTA_CALIBRATE_CENTER _UxGT("Calibrate Center") +#define MSG_DELTA_SETTINGS _UxGT("Delta Settings") +#define MSG_DELTA_AUTO_CALIBRATE _UxGT("Auto Calibration") +#define MSG_DELTA_HEIGHT_CALIBRATE _UxGT("Set Delta Height") +#define MSG_DELTA_Z_OFFSET_CALIBRATE _UxGT("Probe Z-offset") +#define MSG_DELTA_DIAG_ROD _UxGT("Diag Rod") +#define MSG_DELTA_HEIGHT _UxGT("Height") +#define MSG_DELTA_RADIUS _UxGT("Radius") +#define MSG_INFO_MENU _UxGT("About Printer") +#define MSG_INFO_PRINTER_MENU _UxGT("Printer Info") +#define MSG_3POINT_LEVELING _UxGT("3-Point Leveling") +#define MSG_LINEAR_LEVELING _UxGT("Linear Leveling") +#define MSG_BILINEAR_LEVELING _UxGT("Bilinear Leveling") +#define MSG_UBL_LEVELING _UxGT("Unified Bed Leveling") +#define MSG_MESH_LEVELING _UxGT("Mesh Leveling") +#define MSG_INFO_STATS_MENU _UxGT("Printer Stats") +#define MSG_INFO_BOARD_MENU _UxGT("Board Info") +#define MSG_INFO_THERMISTOR_MENU _UxGT("Thermistors") +#define MSG_INFO_EXTRUDERS _UxGT("Extruders") +#define MSG_INFO_BAUDRATE _UxGT("Baud") +#define MSG_INFO_PROTOCOL _UxGT("Protocol") +#define MSG_CASE_LIGHT _UxGT("Case light") +#define MSG_CASE_LIGHT_BRIGHTNESS _UxGT("Light Brightness") +#if LCD_WIDTH >= 20 + #define MSG_INFO_PRINT_COUNT _UxGT("Print Count") + #define MSG_INFO_COMPLETED_PRINTS _UxGT("Completed") + #define MSG_INFO_PRINT_TIME _UxGT("Total print time") + #define MSG_INFO_PRINT_LONGEST _UxGT("Longest job time") + #define MSG_INFO_PRINT_FILAMENT _UxGT("Extruded total") +#else + #define MSG_INFO_PRINT_COUNT _UxGT("Prints") + #define MSG_INFO_COMPLETED_PRINTS _UxGT("Completed") + #define MSG_INFO_PRINT_TIME _UxGT("Total") + #define MSG_INFO_PRINT_LONGEST _UxGT("Longest") + #define MSG_INFO_PRINT_FILAMENT _UxGT("Extruded") +#endif +#define MSG_INFO_MIN_TEMP _UxGT("Min Temp") +#define MSG_INFO_MAX_TEMP _UxGT("Max Temp") +#define MSG_INFO_PSU _UxGT("PSU") +#define MSG_DRIVE_STRENGTH _UxGT("Drive Strength") +#define MSG_DAC_PERCENT _UxGT("Driver %") +#define MSG_DAC_EEPROM_WRITE _UxGT("DAC EEPROM Write") +#define MSG_FILAMENT_CHANGE_HEADER_PAUSE _UxGT("PRINT PAUSED") +#define MSG_FILAMENT_CHANGE_HEADER_LOAD _UxGT("LOAD FILAMENT") +#define MSG_FILAMENT_CHANGE_HEADER_UNLOAD _UxGT("UNLOAD FILAMENT") +#define MSG_FILAMENT_CHANGE_OPTION_HEADER _UxGT("RESUME OPTIONS:") +#define MSG_FILAMENT_CHANGE_OPTION_PURGE _UxGT("Purge more") +#define MSG_FILAMENT_CHANGE_OPTION_RESUME _UxGT("Continue") +#define MSG_FILAMENT_CHANGE_NOZZLE _UxGT(" Nozzle: ") +#define MSG_RUNOUT_SENSOR_ENABLE _UxGT("Runout Sensor") +#define MSG_ERR_HOMING_FAILED _UxGT("Homing failed") +#define MSG_ERR_PROBING_FAILED _UxGT("Probing failed") +#define MSG_M600_TOO_COLD _UxGT("M600: Too cold") + +// +// Filament Change screens show up to 3 lines on a 4-line display +// ...or up to 2 lines on a 3-line display +// +#if LCD_HEIGHT >= 4 + #define MSG_FILAMENT_CHANGE_INIT_1 _UxGT("Wait for start") + #define MSG_FILAMENT_CHANGE_INIT_2 _UxGT("of the filament") + #define MSG_FILAMENT_CHANGE_INIT_3 _UxGT("change") + #define MSG_FILAMENT_CHANGE_UNLOAD_1 _UxGT("Wait for") + #define MSG_FILAMENT_CHANGE_UNLOAD_2 _UxGT("filament unload") + #define MSG_FILAMENT_CHANGE_INSERT_1 _UxGT("Insert filament") + #define MSG_FILAMENT_CHANGE_INSERT_2 _UxGT("and press button") + #define MSG_FILAMENT_CHANGE_INSERT_3 _UxGT("to continue...") + #define MSG_FILAMENT_CHANGE_HEAT_1 _UxGT("Press button to") + #define MSG_FILAMENT_CHANGE_HEAT_2 _UxGT("heat nozzle.") + #define MSG_FILAMENT_CHANGE_HEATING_1 _UxGT("Heating nozzle") + #define MSG_FILAMENT_CHANGE_HEATING_2 _UxGT("Please wait...") + #define MSG_FILAMENT_CHANGE_LOAD_1 _UxGT("Wait for") + #define MSG_FILAMENT_CHANGE_LOAD_2 _UxGT("filament load") + #define MSG_FILAMENT_CHANGE_PURGE_1 _UxGT("Wait for") + #define MSG_FILAMENT_CHANGE_PURGE_2 _UxGT("filament purge") + #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Wait for print") + #define MSG_FILAMENT_CHANGE_RESUME_2 _UxGT("to resume") +#else // LCD_HEIGHT < 4 + #define MSG_FILAMENT_CHANGE_INIT_1 _UxGT("Please wait...") + #define MSG_FILAMENT_CHANGE_UNLOAD_1 _UxGT("Ejecting...") + #define MSG_FILAMENT_CHANGE_INSERT_1 _UxGT("Insert and Click") + #define MSG_FILAMENT_CHANGE_HEAT_1 _UxGT("Click to heat") + #define MSG_FILAMENT_CHANGE_HEATING_1 _UxGT("Heating...") + #define MSG_FILAMENT_CHANGE_LOAD_1 _UxGT("Loading...") + #define MSG_FILAMENT_CHANGE_PURGE_1 _UxGT("Purging...") + #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Resuming...") +#endif // LCD_HEIGHT < 4 diff --git a/Marlin/src/lcd/language/language_nl.h b/Marlin/src/lcd/language/language_nl.h index 1def4b1060..1ab6d06836 100644 --- a/Marlin/src/lcd/language/language_nl.h +++ b/Marlin/src/lcd/language/language_nl.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Dutch @@ -27,8 +28,6 @@ * See also http://marlinfw.org/docs/development/lcd_language.html * */ -#ifndef LANGUAGE_NL_H -#define LANGUAGE_NL_H #define DISPLAY_CHARSET_ISO10646_1 #define NOT_EXTENDED_ISO10646_1_5X7 @@ -55,18 +54,18 @@ #define MSG_SET_HOME_OFFSETS _UxGT("Zet home offsets") #define MSG_HOME_OFFSETS_APPLIED _UxGT("H offset toegep.") #define MSG_SET_ORIGIN _UxGT("Nulpunt instellen") -#define MSG_PREHEAT_1 _UxGT("PLA voorverwarmen") -#define MSG_PREHEAT_1_N _UxGT("PLA voorverw. ") +#define MSG_PREHEAT_1 _UxGT(PREHEAT_1_LABEL " voorverwarmen") +#define MSG_PREHEAT_1_N _UxGT(PREHEAT_1_LABEL " voorverw. ") #define MSG_PREHEAT_1_ALL MSG_PREHEAT_1_N _UxGT("aan") #define MSG_PREHEAT_1_END MSG_PREHEAT_1 _UxGT(" Einde") #define MSG_PREHEAT_1_BEDONLY MSG_PREHEAT_1_N _UxGT("Bed") -#define MSG_PREHEAT_1_SETTINGS _UxGT("PLA verw. conf") -#define MSG_PREHEAT_2 _UxGT("ABS voorverwarmen") -#define MSG_PREHEAT_2_N _UxGT("ABS voorverw. ") +#define MSG_PREHEAT_1_SETTINGS _UxGT(PREHEAT_1_LABEL " verw. conf") +#define MSG_PREHEAT_2 _UxGT(PREHEAT_2_LABEL " voorverwarmen") +#define MSG_PREHEAT_2_N _UxGT(PREHEAT_2_LABEL " voorverw. ") #define MSG_PREHEAT_2_ALL MSG_PREHEAT_2_N _UxGT("aan") #define MSG_PREHEAT_2_END MSG_PREHEAT_2 _UxGT(" Einde") #define MSG_PREHEAT_2_BEDONLY MSG_PREHEAT_2_N _UxGT("Bed") -#define MSG_PREHEAT_2_SETTINGS _UxGT("ABS verw. conf") +#define MSG_PREHEAT_2_SETTINGS _UxGT(PREHEAT_2_LABEL " verw. conf") #define MSG_COOLDOWN _UxGT("Afkoelen") #define MSG_SWITCH_PS_ON _UxGT("Stroom aan") #define MSG_SWITCH_PS_OFF _UxGT("Stroom uit") @@ -96,8 +95,8 @@ #define MSG_MAX _UxGT(" ") LCD_STR_THERMOMETER _UxGT(" Max") #define MSG_FACTOR _UxGT(" ") LCD_STR_THERMOMETER _UxGT(" Fact") #define MSG_AUTOTEMP _UxGT("Autotemp") -#define MSG_ON _UxGT("Aan ") -#define MSG_OFF _UxGT("Uit") +#define MSG_LCD_ON _UxGT("Aan") +#define MSG_LCD_OFF _UxGT("Uit") #define MSG_PID_P _UxGT("PID-P") #define MSG_PID_I _UxGT("PID-I") #define MSG_PID_D _UxGT("PID-D") @@ -166,14 +165,14 @@ #define MSG_CONTROL_RETRACT _UxGT("Retract mm") //accepted English term in Dutch #define MSG_CONTROL_RETRACT_SWAP _UxGT("Ruil Retract mm") #define MSG_CONTROL_RETRACTF _UxGT("Retract F") -#define MSG_CONTROL_RETRACT_ZLIFT _UxGT("Hop mm") +#define MSG_CONTROL_RETRACT_ZHOP _UxGT("Hop mm") #define MSG_CONTROL_RETRACT_RECOVER _UxGT("UnRet mm") #define MSG_CONTROL_RETRACT_RECOVER_SWAP _UxGT("Ruil UnRet mm") #define MSG_CONTROL_RETRACT_RECOVERF _UxGT("UnRet F") #define MSG_AUTORETRACT _UxGT("AutoRetr.") #define MSG_FILAMENTCHANGE _UxGT("Verv. Filament") #define MSG_INIT_SDCARD _UxGT("Init. SD kaart") -#define MSG_CNG_SDCARD _UxGT("Verv. SD Kaart") +#define MSG_CHANGE_SDCARD _UxGT("Verv. SD Kaart") #define MSG_ZPROBE_OUT _UxGT("Z probe uit. bed") #define MSG_BLTOUCH_SELFTEST _UxGT("BLTouch Zelf-Test") #define MSG_BLTOUCH_RESET _UxGT("Reset BLTouch") @@ -281,5 +280,3 @@ #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Wacht voor") #define MSG_FILAMENT_CHANGE_RESUME_2 _UxGT("printing...") #endif // LCD_HEIGHT < 4 - -#endif // LANGUAGE_NL_H diff --git a/Marlin/src/lcd/language/language_pl.h b/Marlin/src/lcd/language/language_pl.h index 07fbc11954..63cf3cd33b 100644 --- a/Marlin/src/lcd/language/language_pl.h +++ b/Marlin/src/lcd/language/language_pl.h @@ -19,14 +19,12 @@ * along with this program. If not, see . * */ +#pragma once /** * Polish for DOGM display - includes accented characters */ -#ifndef LANGUAGE_PL_DOGM_H -#define LANGUAGE_PL_DOGM_H - #define DISPLAY_CHARSET_ISO10646_PL #define CHARSIZE 2 @@ -52,16 +50,16 @@ #define MSG_SET_HOME_OFFSETS _UxGT("Ust. poz. zer.") #define MSG_HOME_OFFSETS_APPLIED _UxGT("Poz. zerowa ust.") #define MSG_SET_ORIGIN _UxGT("Ustaw punkt zero") -#define MSG_PREHEAT_1 _UxGT("Rozgrzej PLA") +#define MSG_PREHEAT_1 _UxGT("Rozgrzej " PREHEAT_1_LABEL) #define MSG_PREHEAT_1_N MSG_PREHEAT_1 _UxGT(" ") #define MSG_PREHEAT_1_ALL MSG_PREHEAT_1 _UxGT(" wsz.") -#define MSG_PREHEAT_1_BEDONLY _UxGT("Rozgrzej stół PLA") -#define MSG_PREHEAT_1_SETTINGS _UxGT("Ustaw. rozg. PLA") -#define MSG_PREHEAT_2 _UxGT("Rozgrzej ABS") +#define MSG_PREHEAT_1_BEDONLY _UxGT("Rozgrzej stół " PREHEAT_1_LABEL) +#define MSG_PREHEAT_1_SETTINGS _UxGT("Ustaw. rozg. " PREHEAT_1_LABEL) +#define MSG_PREHEAT_2 _UxGT("Rozgrzej " PREHEAT_2_LABEL) #define MSG_PREHEAT_2_N MSG_PREHEAT_2 _UxGT(" ") #define MSG_PREHEAT_2_ALL MSG_PREHEAT_2 _UxGT(" wsz.") -#define MSG_PREHEAT_2_BEDONLY _UxGT("Rozgrzej stół ABS") -#define MSG_PREHEAT_2_SETTINGS _UxGT("Ustaw. rozg. ABS") +#define MSG_PREHEAT_2_BEDONLY _UxGT("Rozgrzej stół " PREHEAT_2_LABEL) +#define MSG_PREHEAT_2_SETTINGS _UxGT("Ustaw. rozg. " PREHEAT_2_LABEL) #define MSG_COOLDOWN _UxGT("Chłodzenie") #define MSG_SWITCH_PS_ON _UxGT("Włącz zasilacz") #define MSG_SWITCH_PS_OFF _UxGT("Wyłącz zasilacz") @@ -87,8 +85,8 @@ #define MSG_MAX LCD_STR_THERMOMETER _UxGT(" Max") #define MSG_FACTOR LCD_STR_THERMOMETER _UxGT(" Mnożnik") #define MSG_AUTOTEMP _UxGT("Auto. temperatura") -#define MSG_ON _UxGT("Wł. ") -#define MSG_OFF _UxGT("Wył.") +#define MSG_LCD_ON _UxGT("Wł.") +#define MSG_LCD_OFF _UxGT("Wył.") #define MSG_PID_P _UxGT("PID-P") #define MSG_PID_I _UxGT("PID-I") #define MSG_PID_D _UxGT("PID-D") @@ -157,14 +155,14 @@ #define MSG_CONTROL_RETRACT _UxGT("Wycofaj mm") #define MSG_CONTROL_RETRACT_SWAP _UxGT("Z Wycof. mm") #define MSG_CONTROL_RETRACTF _UxGT("Wycofaj V") -#define MSG_CONTROL_RETRACT_ZLIFT _UxGT("Skok Z mm") +#define MSG_CONTROL_RETRACT_ZHOP _UxGT("Skok Z mm") #define MSG_CONTROL_RETRACT_RECOVER _UxGT("Cof. wycof. mm") #define MSG_CONTROL_RETRACT_RECOVER_SWAP _UxGT("Z Cof. wyc. mm") #define MSG_CONTROL_RETRACT_RECOVERF _UxGT("Cof. wycof. V") #define MSG_AUTORETRACT _UxGT("Auto. wycofanie") #define MSG_FILAMENTCHANGE _UxGT("Zmień filament") #define MSG_INIT_SDCARD _UxGT("Inicjal. karty SD") -#define MSG_CNG_SDCARD _UxGT("Zmiana karty SD") +#define MSG_CHANGE_SDCARD _UxGT("Zmiana karty SD") #define MSG_ZPROBE_OUT _UxGT("Sonda Z za stołem") #define MSG_BLTOUCH_SELFTEST _UxGT("BLTouch Self-Test") #define MSG_BLTOUCH_RESET _UxGT("Reset BLTouch") @@ -253,5 +251,3 @@ #define MSG_FILAMENT_CHANGE_LOAD_1 _UxGT("Ładowanie...") #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Wznowienie...") #endif // LCD_HEIGHT < 4 - -#endif // LANGUAGE_PL_DOGM_H diff --git a/Marlin/src/lcd/language/language_pt-br.h b/Marlin/src/lcd/language/language_pt-br.h index a6c1e53b4c..4e3839b663 100644 --- a/Marlin/src/lcd/language/language_pt-br.h +++ b/Marlin/src/lcd/language/language_pt-br.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Portuguese (Brazil) @@ -28,8 +29,6 @@ * See also http://marlinfw.org/docs/development/lcd_language.html * */ -#ifndef LANGUAGE_PT_BR_UTF_H -#define LANGUAGE_PT_BR_UTF_H // Put characters here that should be displayed with M117 //_UxGT("áãàçÉéêíóõ") @@ -41,37 +40,42 @@ #define MSG_BACK _UxGT("Voltar") #define MSG_SD_INSERTED _UxGT("Cartão inserido") #define MSG_SD_REMOVED _UxGT("Cartão removido") -#define MSG_LCD_ENDSTOPS _UxGT("Finais") +#define MSG_LCD_ENDSTOPS _UxGT("Fins de curso") +#define MSG_LCD_SOFT_ENDSTOPS _UxGT("Soft Fins curso") #define MSG_MAIN _UxGT("Menu principal") -#define MSG_AUTOSTART _UxGT("Autostart") -#define MSG_DISABLE_STEPPERS _UxGT("Desabi. motores") +#define MSG_ADVANCED_SETTINGS _UxGT("Config. Avançada") +#define MSG_CONFIGURATION _UxGT("Configuração") +#define MSG_AUTOSTART _UxGT("Início automático") +#define MSG_DISABLE_STEPPERS _UxGT("Desabilit. motores") #define MSG_DEBUG_MENU _UxGT("Menu Debug") -#define MSG_PROGRESS_BAR_TEST _UxGT("Testar Barra de Prog")//resso +#define MSG_PROGRESS_BAR_TEST _UxGT("Testar Barra Progres") +#define MSG_AUTO_HOME _UxGT("Ir a origem XYZ") #define MSG_AUTO_HOME_X _UxGT("Ir na origem X") #define MSG_AUTO_HOME_Y _UxGT("Ir na origem Y") #define MSG_AUTO_HOME_Z _UxGT("Ir na origem Z") +#define MSG_AUTO_Z_ALIGN _UxGT("Auto alinhar Z") #define MSG_TMC_Z_CALIBRATION _UxGT("Calibrar Z") -#define MSG_AUTO_HOME _UxGT("Ir na origem XYZ") #define MSG_LEVEL_BED_HOMING _UxGT("Indo para origem") #define MSG_LEVEL_BED_WAITING _UxGT("Clique para Iniciar") #define MSG_LEVEL_BED_NEXT_POINT _UxGT("Próximo Ponto") #define MSG_LEVEL_BED_DONE _UxGT("Fim nivelação!") #define MSG_Z_FADE_HEIGHT _UxGT("Suavizar altura") #define MSG_SET_HOME_OFFSETS _UxGT("Compensar origem") -#define MSG_HOME_OFFSETS_APPLIED _UxGT("Alteração feita") +#define MSG_HOME_OFFSETS_APPLIED _UxGT("Alteração aplicada") #define MSG_SET_ORIGIN _UxGT("Ajustar Origem") -#define MSG_PREHEAT_1 _UxGT("Pre-aquecer PLA") +#define MSG_PREHEAT_1 _UxGT("Pre-aquecer " PREHEAT_1_LABEL) #define MSG_PREHEAT_1_N MSG_PREHEAT_1 _UxGT(" ") -#define MSG_PREHEAT_1_ALL _UxGT("Pre-aq.Todo PLA") -#define MSG_PREHEAT_1_END _UxGT("Pre-aq.Extrusora") -#define MSG_PREHEAT_1_BEDONLY _UxGT("Pre-aq.Mesa PLA") -#define MSG_PREHEAT_1_SETTINGS _UxGT("Ajustar PLA") -#define MSG_PREHEAT_2 _UxGT("Pre-aquecer ABS") -#define MSG_PREHEAT_2_N _UxGT("Pre-aquecer ABS") -#define MSG_PREHEAT_2_ALL _UxGT("Pre-aq.Todo ABS") -#define MSG_PREHEAT_2_BEDONLY _UxGT("Pre-aq.Mesa ABS") -#define MSG_PREHEAT_2_END _UxGT("Pre-aq.Extrusora") -#define MSG_PREHEAT_2_SETTINGS _UxGT("Ajustar ABS") +#define MSG_PREHEAT_1_ALL _UxGT("Pre-aq.Todo " PREHEAT_1_LABEL) +#define MSG_PREHEAT_1_END _UxGT("Extrusora " PREHEAT_1_LABEL) +#define MSG_PREHEAT_1_BEDONLY _UxGT("Pre-aq.Mesa " PREHEAT_1_LABEL) +#define MSG_PREHEAT_1_SETTINGS _UxGT("Ajustar " PREHEAT_1_LABEL) +#define MSG_PREHEAT_2 _UxGT("Pre-aquecer " PREHEAT_2_LABEL) +#define MSG_PREHEAT_2_N MSG_PREHEAT_2 _UxGT(" ") +#define MSG_PREHEAT_2_ALL _UxGT("Pre-aq.Todo " PREHEAT_2_LABEL) +#define MSG_PREHEAT_2_END _UxGT("Extrusora " PREHEAT_2_LABEL) +#define MSG_PREHEAT_2_BEDONLY _UxGT("Pre-aq.Mesa " PREHEAT_2_LABEL) +#define MSG_PREHEAT_2_SETTINGS _UxGT("Ajustar " PREHEAT_2_LABEL) +#define MSG_PREHEAT_CUSTOM _UxGT("Customizar Pre-aq.") #define MSG_COOLDOWN _UxGT("Esfriar") #define MSG_SWITCH_PS_ON _UxGT("Ligar") #define MSG_SWITCH_PS_OFF _UxGT("Desligar") @@ -83,38 +87,52 @@ #define MSG_LEVEL_CORNERS _UxGT("Nivelar Cantos") #define MSG_NEXT_CORNER _UxGT("Próximo Canto") #define MSG_EDITING_STOPPED _UxGT("Fim da Edição") +#define MSG_MESH_X _UxGT("Índice X") +#define MSG_MESH_Y _UxGT("Índice Y") +#define MSG_MESH_EDIT_Z _UxGT("Valor Z") #define MSG_USER_MENU _UxGT("Comando customizado") #define MSG_UBL_DOING_G29 _UxGT("Executando G29") #define MSG_UBL_UNHOMED _UxGT("Fora da Origam") #define MSG_UBL_TOOLS _UxGT("Ferramentas UBL") -#define MSG_UBL_LEVEL_BED _UxGT("Unified Bed Leveling") +#define MSG_UBL_LEVEL_BED _UxGT("Nivel. Mesa Unif.") + +#define MSG_IDEX_MENU _UxGT("Modo IDEX") +#define MSG_IDEX_MODE_AUTOPARK _UxGT("Auto-Estacionar") +#define MSG_IDEX_MODE_DUPLICATE _UxGT("Duplicação") +#define MSG_IDEX_MODE_SCALED_COPY _UxGT("Cópia em Escala") +#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_UBL_MANUAL_MESH _UxGT("Fazer malha manual") #define MSG_UBL_BC_INSERT _UxGT("Calçar e calibrar") #define MSG_UBL_BC_INSERT2 _UxGT("Medir") #define MSG_UBL_BC_REMOVE _UxGT("Remover e calibrar") -#define MSG_UBL_MOVING_TO_NEXT _UxGT("Indo para o Próximo") +#define MSG_UBL_MOVING_TO_NEXT _UxGT("Movendo para Próximo") #define MSG_UBL_ACTIVATE_MESH _UxGT("Ativar UBL") #define MSG_UBL_DEACTIVATE_MESH _UxGT("Desativar UBL") -#define MSG_UBL_SET_BED_TEMP _UxGT("Temp. Mesa") -#define MSG_UBL_CUSTOM_BED_TEMP MSG_UBL_SET_BED_TEMP -#define MSG_UBL_SET_HOTEND_TEMP _UxGT("Temp. Extrusora") -#define MSG_UBL_CUSTOM_HOTEND_TEMP MSG_UBL_SET_HOTEND_TEMP +#define MSG_UBL_SET_TEMP_BED _UxGT("Temp. Mesa") +#define MSG_UBL_BED_TEMP_CUSTOM MSG_UBL_SET_TEMP_BED +#define MSG_UBL_SET_TEMP_HOTEND _UxGT("Temp. Extrusora") +#define MSG_UBL_HOTEND_TEMP_CUSTOM MSG_UBL_SET_TEMP_HOTEND #define MSG_UBL_MESH_EDIT _UxGT("Editar Malha") #define MSG_UBL_EDIT_CUSTOM_MESH _UxGT("Editar Malha Custom") #define MSG_UBL_FINE_TUNE_MESH _UxGT("Ajuste Fino da Malha") #define MSG_UBL_DONE_EDITING_MESH _UxGT("Fim da Edição") -#define MSG_UBL_BUILD_CUSTOM_MESH _UxGT("Montar Customi") +#define MSG_UBL_BUILD_CUSTOM_MESH _UxGT("Montar Malha Custom") #define MSG_UBL_BUILD_MESH_MENU _UxGT("Montar ") -#define MSG_UBL_BUILD_PLA_MESH _UxGT("Montar PLA") -#define MSG_UBL_BUILD_ABS_MESH _UxGT("Montar ABS") -#define MSG_UBL_BUILD_COLD_MESH _UxGT("Montar fria") +#define MSG_UBL_BUILD_MESH_M1 _UxGT("Montar " PREHEAT_1_LABEL) +#define MSG_UBL_BUILD_MESH_M2 _UxGT("Montar " PREHEAT_2_LABEL) +#define MSG_UBL_BUILD_COLD_MESH _UxGT("Montar Malha fria") #define MSG_UBL_MESH_HEIGHT_ADJUST _UxGT("Ajustar Altura") -#define MSG_UBL_MESH_HEIGHT_AMOUNT _UxGT("Tamanho da Elevação") +#define MSG_UBL_MESH_HEIGHT_AMOUNT _UxGT("Quant. de Altura") #define MSG_UBL_VALIDATE_MESH_MENU _UxGT("Validar Malha") -#define MSG_UBL_VALIDATE_PLA_MESH _UxGT("Checar PLA") -#define MSG_UBL_VALIDATE_ABS_MESH _UxGT("Checar ABS") +#define MSG_UBL_VALIDATE_MESH_M1 _UxGT("Checar " PREHEAT_1_LABEL) +#define MSG_UBL_VALIDATE_MESH_M2 _UxGT("Checar " PREHEAT_2_LABEL) #define MSG_UBL_VALIDATE_CUSTOM_MESH _UxGT("Validar Malha Custom") #define MSG_UBL_CONTINUE_MESH _UxGT("Continuar Malha") #define MSG_UBL_MESH_LEVELING _UxGT("Nivelação da Malha") @@ -128,7 +146,7 @@ #define MSG_UBL_OUTPUT_MAP_CSV _UxGT("Salvar Malha CSV") #define MSG_UBL_OUTPUT_MAP_BACKUP _UxGT("Salvar Backup") #define MSG_UBL_INFO_UBL _UxGT("Informação do UBL") -#define MSG_UBL_EDIT_MESH_MENU _UxGT("Editar Malha") +#define MSG_EDIT_MESH _UxGT("Editar Malha") #define MSG_UBL_FILLIN_AMOUNT _UxGT("Qtd de Enchimento") #define MSG_UBL_MANUAL_FILLIN _UxGT("Enchimento Manual") #define MSG_UBL_SMART_FILLIN _UxGT("Enchimento Smart") @@ -166,13 +184,13 @@ #define MSG_INTENSITY_B _UxGT("Intensidade Azul") #define MSG_INTENSITY_W _UxGT("Intensidade Branco") #define MSG_LED_BRIGHTNESS _UxGT("Brilho") - #define MSG_MOVING _UxGT("Movendo...") #define MSG_FREE_XY _UxGT("Liberar XY") #define MSG_MOVE_X _UxGT("Mover X") #define MSG_MOVE_Y _UxGT("Mover Y") #define MSG_MOVE_Z _UxGT("Mover Z") #define MSG_MOVE_E _UxGT("Mover Extrusor") +#define MSG_HOTEND_TOO_COLD _UxGT("Extrus. mto fria") #define MSG_MOVE_01MM _UxGT("Mover 0.1mm") #define MSG_MOVE_1MM _UxGT("Mover 1mm") #define MSG_MOVE_10MM _UxGT("Mover 10mm") @@ -181,48 +199,43 @@ #define MSG_NOZZLE _UxGT("Bocal") #define MSG_BED _UxGT("Mesa") #define MSG_FAN_SPEED _UxGT("Vel. Ventoinha") +#define MSG_EXTRA_FAN_SPEED _UxGT("+Vel. Ventoinha") #define MSG_FLOW _UxGT("Vazão") #define MSG_CONTROL _UxGT("Controle") #define MSG_MIN LCD_STR_THERMOMETER _UxGT(" Min") -#define MSG_MAX LCD_STR_THERMOMETER _UxGT(" Max") +#define MSG_MAX LCD_STR_THERMOMETER _UxGT(" Máx") #define MSG_FACTOR LCD_STR_THERMOMETER _UxGT(" Fator") #define MSG_AUTOTEMP _UxGT("Temp. Automática") -#define MSG_ON _UxGT("Ligado ") -#define MSG_OFF _UxGT("Desligado") +#define MSG_LCD_ON _UxGT("Ligado") +#define MSG_LCD_OFF _UxGT("Desligado") #define MSG_PID_P _UxGT("PID-P") #define MSG_PID_I _UxGT("PID-I") #define MSG_PID_D _UxGT("PID-D") #define MSG_PID_C _UxGT("PID-C") #define MSG_SELECT _UxGT("Selecionar") #define MSG_ACC _UxGT("Acel.") -#define MSG_JERK _UxGT("Jogo") -#if IS_SCARA - #define MSG_VA_JERK _UxGT("jogo VA") - #define MSG_VB_JERK _UxGT("jogo VB") - #define MSG_VC_JERK _UxGT("jogo VZ") -#elif IS_DELTA - #define MSG_VA_JERK _UxGT("jogo VA") - #define MSG_VB_JERK _UxGT("jogo VB") - #define MSG_VC_JERK _UxGT("jogo VC") +#define MSG_JERK _UxGT("Arrancada") +#if IS_KINEMATIC + #define MSG_VA_JERK _UxGT("arrancada VA") + #define MSG_VB_JERK _UxGT("arrancada VB") + #define MSG_VC_JERK _UxGT("arrancada VC") #else - #define MSG_VA_JERK _UxGT("jogo VX") - #define MSG_VB_JERK _UxGT("jogo VY") - #define MSG_VC_JERK _UxGT("jogo VZ") + #define MSG_VA_JERK _UxGT("arrancada VX") + #define MSG_VB_JERK _UxGT("arrancada VY") + #define MSG_VC_JERK _UxGT("arrancada VZ") #endif -#define MSG_VE_JERK _UxGT("jogo VE") +#define MSG_VE_JERK _UxGT("arrancada VE") +#define MSG_JUNCTION_DEVIATION _UxGT("Desv. Junção") #define MSG_VELOCITY _UxGT("Velocidade") #define MSG_VMAX _UxGT("Vmax ") #define MSG_VMIN _UxGT("Vmin") #define MSG_VTRAV_MIN _UxGT("VDeslocamento min") +#define MSG_ACCELERATION _UxGT("Aceleração") #define MSG_AMAX _UxGT("Amax ") #define MSG_A_RETRACT _UxGT("Retrair A") #define MSG_A_TRAVEL _UxGT("Movimento A") #define MSG_STEPS_PER_MM _UxGT("Passo/mm") -#if IS_SCARA - #define MSG_ASTEPS _UxGT("Passo A/deg") - #define MSG_BSTEPS _UxGT("Passo B/deg") - #define MSG_CSTEPS _UxGT("Passo Z/mm") -#elif IS_DELTA +#if IS_KINEMATIC #define MSG_ASTEPS _UxGT("Passo A/mm") #define MSG_BSTEPS _UxGT("Passo B/mm") #define MSG_CSTEPS _UxGT("Passo C/mm") @@ -243,23 +256,30 @@ #define MSG_FILAMENT _UxGT("Filamento") #define MSG_VOLUMETRIC_ENABLED _UxGT("Extrusão em mm3") #define MSG_FILAMENT_DIAM _UxGT("Diâmetro Fil.") -#define MSG_ADVANCE_K _UxGT("Avançar K") +#define MSG_FILAMENT_UNLOAD _UxGT("Descarr. mm") +#define MSG_FILAMENT_LOAD _UxGT("Carregar mm") +#define MSG_ADVANCE_K _UxGT("Avanço K") #define MSG_CONTRAST _UxGT("Contraste") #define MSG_STORE_EEPROM _UxGT("Salvar Configuração") #define MSG_LOAD_EEPROM _UxGT("Ler Configuração") #define MSG_RESTORE_FAILSAFE _UxGT("Restauro seguro") #define MSG_INIT_EEPROM _UxGT("Iniciar EEPROM") -#define MSG_REFRESH LCD_STR_REFRESH _UxGT(" Atualização") +#define MSG_SD_UPDATE _UxGT("Atualiz. SD") +#define MSG_RESET_PRINTER _UxGT("Resetar Impressora") +#define MSG_REFRESH _UxGT("Atualização") #define MSG_WATCH _UxGT("Informações") #define MSG_PREPARE _UxGT("Preparar") #define MSG_TUNE _UxGT("Ajustar") #define MSG_PAUSE_PRINT _UxGT("Pausar impressão") #define MSG_RESUME_PRINT _UxGT("Resumir impressão") #define MSG_STOP_PRINT _UxGT("Parar impressão") +#define MSG_OUTAGE_RECOVERY _UxGT("Recuperar Impressão") #define MSG_CARD_MENU _UxGT("Imprimir do SD") #define MSG_NO_CARD _UxGT("Sem cartão SD") -#define MSG_DWELL _UxGT("ZzZzZz...") +#define MSG_DWELL _UxGT("Dormindo...") #define MSG_USERWAIT _UxGT("Clique para retomar") +#define MSG_PRINT_PAUSED _UxGT("Impressão Pausada") +#define MSG_PRINTING _UxGT("Imprimindo...") #define MSG_PRINT_ABORTED _UxGT("Impressão Abortada") #define MSG_NO_MOVE _UxGT("Sem movimento") #define MSG_KILLED _UxGT("PARADA DE EMERGÊNCIA") @@ -267,21 +287,32 @@ #define MSG_CONTROL_RETRACT _UxGT("Retrair mm") #define MSG_CONTROL_RETRACT_SWAP _UxGT("Retrair Troca mm") #define MSG_CONTROL_RETRACTF _UxGT("Retrair V") -#define MSG_CONTROL_RETRACT_ZLIFT _UxGT("Saltar mm") +#define MSG_CONTROL_RETRACT_ZHOP _UxGT("Saltar mm") #define MSG_CONTROL_RETRACT_RECOVER _UxGT("Des-Retrair mm") #define MSG_CONTROL_RETRACT_RECOVER_SWAP _UxGT("Des-RetTroca mm") #define MSG_CONTROL_RETRACT_RECOVERF _UxGT("Des-Retrair V") +#define MSG_CONTROL_RETRACT_RECOVER_SWAPF _UxGT("Des-RetTroca V") #define MSG_AUTORETRACT _UxGT("Retração Automática") +#define MSG_FILAMENT_SWAP_LENGTH _UxGT("Distancia Retração") +#define MSG_TOOL_CHANGE _UxGT("Mudar Ferramenta") +#define MSG_TOOL_CHANGE_ZLIFT _UxGT("Levantar Z") +#define MSG_SINGLENOZZLE_PRIME_SPD _UxGT("Preparar Veloc.") +#define MSG_SINGLENOZZLE_RETRACT_SPD _UxGT("Veloc. Retração") #define MSG_FILAMENTCHANGE _UxGT("Trocar Filamento") +#define MSG_FILAMENTLOAD _UxGT("Carregar Filamento") +#define MSG_FILAMENTUNLOAD _UxGT("Descarreg. Filamento") +#define MSG_FILAMENTUNLOAD_ALL _UxGT("Descarregar Todos") #define MSG_INIT_SDCARD _UxGT("Iniciar SD") -#define MSG_CNG_SDCARD _UxGT("Trocar SD") +#define MSG_CHANGE_SDCARD _UxGT("Trocar SD") #define MSG_ZPROBE_OUT _UxGT("Sonda fora da mesa") #define MSG_SKEW_FACTOR _UxGT("Fator de Cisalho") #define MSG_BLTOUCH _UxGT("BLTouch") #define MSG_BLTOUCH_SELFTEST _UxGT("Testar BLTouch") #define MSG_BLTOUCH_RESET _UxGT("Reiniciar BLTouch") -#define MSG_BLTOUCH_DEPLOY _UxGT("Implantar BLTouch") -#define MSG_BLTOUCH_STOW _UxGT("Condicionar BLTouch") +#define MSG_BLTOUCH_DEPLOY _UxGT("Estender BLTouch") +#define MSG_BLTOUCH_STOW _UxGT("Recolher BLTouch") +#define MSG_MANUAL_DEPLOY _UxGT("Estender Sonda-Z") +#define MSG_MANUAL_STOW _UxGT("Recolher Sonda-Z") #define MSG_HOME _UxGT("Home") #define MSG_FIRST _UxGT("Primeiro") @@ -289,16 +320,26 @@ #define MSG_BABYSTEP_X _UxGT("Passinho X") #define MSG_BABYSTEP_Y _UxGT("Passinho Y") #define MSG_BABYSTEP_Z _UxGT("Passinho Z") -#define MSG_ENDSTOP_ABORT _UxGT("Fim de Curso") +#define MSG_ENDSTOP_ABORT _UxGT("Abortar Fim de Curso") #define MSG_HEATING_FAILED_LCD _UxGT("Aquecimento falhou") +#define MSG_HEATING_FAILED_LCD_BED _UxGT("Aquecer mesa falhou") #define MSG_ERR_REDUNDANT_TEMP _UxGT("Erro:Temp Redundante") #define MSG_THERMAL_RUNAWAY _UxGT("ESCAPE TÉRMICO") +#define MSG_THERMAL_RUNAWAY_BED _UxGT("ESCAPE TÉRMICO MESA") #define MSG_ERR_MAXTEMP _UxGT("Erro:Temp Máxima") #define MSG_ERR_MINTEMP _UxGT("Erro:Temp Mínima") #define MSG_ERR_MAXTEMP_BED _UxGT("Erro:Temp Mesa Máx") #define MSG_ERR_MINTEMP_BED _UxGT("Erro:Temp Mesa Mín") +#define MSG_ERR_Z_HOMING MSG_HOME _UxGT(" ") MSG_X MSG_Y _UxGT(" ") MSG_FIRST +#define MSG_HALTED _UxGT("IMPRESSORA PAROU") +#define MSG_PLEASE_RESET _UxGT("Favor resetar") +#define MSG_SHORT_DAY _UxGT("d") +#define MSG_SHORT_HOUR _UxGT("h") +#define MSG_SHORT_MINUTE _UxGT("m") #define MSG_HEATING _UxGT("Aquecendo...") -#define MSG_BED_HEATING _UxGT("Aquecendo base...") +#define MSG_COOLING _UxGT("Resfriando...") +#define MSG_BED_HEATING _UxGT("Aquecendo mesa...") +#define MSG_BED_COOLING _UxGT("Esfriando mesa...") #define MSG_DELTA_CALIBRATE _UxGT("Calibrar Delta") #define MSG_DELTA_CALIBRATE_X _UxGT("Calibrar X") #define MSG_DELTA_CALIBRATE_Y _UxGT("Calibrar Y") @@ -308,6 +349,7 @@ #define MSG_DELTA_SETTINGS _UxGT("Configuração Delta") #define MSG_DELTA_AUTO_CALIBRATE _UxGT("Auto-Calibração") #define MSG_DELTA_HEIGHT_CALIBRATE _UxGT("Calibrar Altura") +#define MSG_DELTA_Z_OFFSET_CALIBRATE _UxGT("Desloc. Sonda Z") #define MSG_DELTA_DIAG_ROD _UxGT("Haste Diagonal") #define MSG_DELTA_HEIGHT _UxGT("Altura") #define MSG_DELTA_RADIUS _UxGT("Raio") @@ -320,67 +362,86 @@ #define MSG_MESH_LEVELING _UxGT("Nivelamento da Malha") #define MSG_INFO_STATS_MENU _UxGT("Estatísticas") #define MSG_INFO_BOARD_MENU _UxGT("Info. da Placa") -#define MSG_INFO_THERMISTOR_MENU _UxGT("Thermistors") +#define MSG_INFO_THERMISTOR_MENU _UxGT("Termistores") #define MSG_INFO_EXTRUDERS _UxGT("Extrusoras") -#define MSG_INFO_BAUDRATE _UxGT("Frequência Baud") +#define MSG_INFO_BAUDRATE _UxGT("Taxa de Transmissão") #define MSG_INFO_PROTOCOL _UxGT("Protocolo") -#define MSG_CASE_LIGHT _UxGT("Luz da Estrutura") +#define MSG_CASE_LIGHT _UxGT("Luz da Impressora") #define MSG_CASE_LIGHT_BRIGHTNESS _UxGT("Intensidade Brilho") -#define MSG_INFO_PRINT_COUNT _UxGT("Qtd de Impressões") -#define MSG_INFO_COMPLETED_PRINTS _UxGT("Fim") -#define MSG_INFO_PRINT_TIME _UxGT("Tempo de Impressão") -#define MSG_INFO_PRINT_LONGEST _UxGT("Trabalho Mais longo") -#define MSG_INFO_PRINT_FILAMENT _UxGT("Total Depositado") -#define MSG_INFO_MIN_TEMP _UxGT("Temp Min") -#define MSG_INFO_MAX_TEMP _UxGT("Temp Max") + +#if LCD_WIDTH >= 20 + #define MSG_INFO_PRINT_COUNT _UxGT("Total de Impressões") + #define MSG_INFO_COMPLETED_PRINTS _UxGT("Realizadas") + #define MSG_INFO_PRINT_TIME _UxGT("Tempo de Impressão") + #define MSG_INFO_PRINT_LONGEST _UxGT("Trabalho Mais longo") + #define MSG_INFO_PRINT_FILAMENT _UxGT("Total de Extrusão") +#else + #define MSG_INFO_PRINT_COUNT _UxGT("Qtd de Impressões") + #define MSG_INFO_COMPLETED_PRINTS _UxGT("Realizadas") + #define MSG_INFO_PRINT_TIME _UxGT("Tempo de Impressão") + #define MSG_INFO_PRINT_LONGEST _UxGT("Maior trabalho") + #define MSG_INFO_PRINT_FILAMENT _UxGT("T. Extrusão") +#endif + +#define MSG_INFO_MIN_TEMP _UxGT("Temp Mín") +#define MSG_INFO_MAX_TEMP _UxGT("Temp Máx") #define MSG_INFO_PSU _UxGT("PSU") #define MSG_DRIVE_STRENGTH _UxGT("Força do Motor") #define MSG_DAC_PERCENT _UxGT("Driver %") -#define MSG_DAC_EEPROM_WRITE _UxGT("Escrever Eeprom DAC") +#define MSG_DAC_EEPROM_WRITE _UxGT("Escrever EEPROM DAC") -#define MSG_FILAMENT_CHANGE_HEADER _UxGT("Troca de Filamento") +#define MSG_FILAMENT_CHANGE_HEADER_PAUSE _UxGT("IMPRESSÃO PAUSADA") +#define MSG_FILAMENT_CHANGE_HEADER_LOAD _UxGT("CARREGAR FILAMENTO") +#define MSG_FILAMENT_CHANGE_HEADER_UNLOAD _UxGT("DESCARREG. FILAMENTO") #define MSG_FILAMENT_CHANGE_OPTION_HEADER _UxGT("Config. de Retomada") -#define MSG_FILAMENT_CHANGE_OPTION_EXTRUDE _UxGT("Extrusar Mais") +#define MSG_FILAMENT_CHANGE_OPTION_PURGE _UxGT("Purgar mais") #define MSG_FILAMENT_CHANGE_OPTION_RESUME _UxGT("Continuar Impressão") -#define MSG_FILAMENT_CHANGE_MINTEMP _UxGT("Temp. Mínima é ") #define MSG_FILAMENT_CHANGE_NOZZLE _UxGT(" Bocal: ") +#define MSG_RUNOUT_SENSOR_ENABLE _UxGT("Sensor filamento") #define MSG_ERR_HOMING_FAILED _UxGT("Falha ao ir à origem") #define MSG_ERR_PROBING_FAILED _UxGT("Falha ao sondar") +#define MSG_M600_TOO_COLD _UxGT("M600: Muito frio") #if LCD_HEIGHT >= 4 + #define MSG_ADVANCED_PAUSE_WAITING_1 _UxGT("Aperte o botão para") + #define MSG_ADVANCED_PAUSE_WAITING_2 _UxGT("continuar impressão") + #define MSG_FILAMENT_CHANGE_INIT_1 _UxGT("Esperando o") #define MSG_FILAMENT_CHANGE_INIT_2 _UxGT("inicio da") - #define MSG_FILAMENT_CHANGE_INIT_3 _UxGT("troca de Filamento") + #define MSG_FILAMENT_CHANGE_INIT_3 _UxGT("troca de filamento") - #define MSG_FILAMENT_CHANGE_UNLOAD_1 _UxGT("Esperando") - #define MSG_FILAMENT_CHANGE_UNLOAD_2 _UxGT("remoção de filamento") - - #define MSG_FILAMENT_CHANGE_INSERT_1 _UxGT("Coloque Filamento") + #define MSG_FILAMENT_CHANGE_INSERT_1 _UxGT("Coloque filamento") #define MSG_FILAMENT_CHANGE_INSERT_2 _UxGT("pressione o botão") #define MSG_FILAMENT_CHANGE_INSERT_3 _UxGT("para continuar...") #define MSG_FILAMENT_CHANGE_HEAT_1 _UxGT("Pressione o botão") - #define MSG_FILAMENT_CHANGE_HEAT_2 _UxGT("p/ Aquecer o Bocal") + #define MSG_FILAMENT_CHANGE_HEAT_2 _UxGT("p/ aquecer o bocal") - #define MSG_FILAMENT_CHANGE_HEATING_1 _UxGT("Aquecendo o Bocal") + #define MSG_FILAMENT_CHANGE_HEATING_1 _UxGT("Aquecendo o bocal") #define MSG_FILAMENT_CHANGE_HEATING_2 _UxGT("Aguarde...") + #define MSG_FILAMENT_CHANGE_UNLOAD_1 _UxGT("Esperando") + #define MSG_FILAMENT_CHANGE_UNLOAD_2 _UxGT("remoção de filamento") + #define MSG_FILAMENT_CHANGE_LOAD_1 _UxGT("Esperando") #define MSG_FILAMENT_CHANGE_LOAD_2 _UxGT("filamento") - #define MSG_FILAMENT_CHANGE_EXTRUDE_1 _UxGT("Esperando extrusão") - #define MSG_FILAMENT_CHANGE_EXTRUDE_2 _UxGT("de filamento") + #define MSG_FILAMENT_CHANGE_PURGE_1 _UxGT("Espere pela") + #define MSG_FILAMENT_CHANGE_PURGE_2 _UxGT("purga de filamento") + + #define MSG_FILAMENT_CHANGE_CONT_PURGE_1 _UxGT("Clique para finaliz.") + #define MSG_FILAMENT_CHANGE_CONT_PURGE_2 _UxGT("purga de filamento") #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Esperando impressão") #define MSG_FILAMENT_CHANGE_RESUME_2 _UxGT("continuar") #else // LCD_HEIGHT < 4 + #define MSG_ADVANCED_PAUSE_WAITING_1 _UxGT("Clique p. continuar") #define MSG_FILAMENT_CHANGE_INIT_1 _UxGT("Aguarde...") - #define MSG_FILAMENT_CHANGE_UNLOAD_1 _UxGT("Ejetando...") #define MSG_FILAMENT_CHANGE_INSERT_1 _UxGT("Insira e Clique") #define MSG_FILAMENT_CHANGE_HEATING_1 _UxGT("Aquecendo...") + #define MSG_FILAMENT_CHANGE_UNLOAD_1 _UxGT("Ejetando...") #define MSG_FILAMENT_CHANGE_LOAD_1 _UxGT("Carregando...") - #define MSG_FILAMENT_CHANGE_EXTRUDE_1 _UxGT("Extrusando...") + #define MSG_FILAMENT_CHANGE_PURGE_1 _UxGT("Purgando...") + #define MSG_FILAMENT_CHANGE_CONT_PURGE_1 _UxGT("Clique p. finalizar") #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Continuando...") #endif - -#endif // LANGUAGE_PT_BR_UTF_H diff --git a/Marlin/src/lcd/language/language_pt.h b/Marlin/src/lcd/language/language_pt.h index 67500a087f..954e6eb458 100644 --- a/Marlin/src/lcd/language/language_pt.h +++ b/Marlin/src/lcd/language/language_pt.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Portuguese @@ -28,8 +29,6 @@ * See also http://marlinfw.org/docs/development/lcd_language.html * */ -#ifndef LANGUAGE_PT_UTF_H -#define LANGUAGE_PT_UTF_H #define DISPLAY_CHARSET_ISO10646_1 #define CHARSIZE 2 @@ -52,16 +51,16 @@ #define MSG_SET_HOME_OFFSETS _UxGT("Definir desvio") #define MSG_HOME_OFFSETS_APPLIED _UxGT("Offsets aplicados") #define MSG_SET_ORIGIN _UxGT("Definir origem") -#define MSG_PREHEAT_1 _UxGT("Pre-aquecer PLA") -#define MSG_PREHEAT_1_N _UxGT("Pre-aquecer PLA") -#define MSG_PREHEAT_1_ALL _UxGT("Pre-aq. PLA Tudo") -#define MSG_PREHEAT_1_BEDONLY _UxGT("Pre-aq. PLA ") LCD_STR_THERMOMETER _UxGT("Base") -#define MSG_PREHEAT_1_SETTINGS _UxGT("Definições PLA") -#define MSG_PREHEAT_2 _UxGT("Pre-aquecer ABS") -#define MSG_PREHEAT_2_N _UxGT("Pre-aquecer ABS ") -#define MSG_PREHEAT_2_ALL _UxGT("Pre-aq. ABS Tudo") -#define MSG_PREHEAT_2_BEDONLY _UxGT("Pre-aq. ABS ") LCD_STR_THERMOMETER _UxGT("Base") -#define MSG_PREHEAT_2_SETTINGS _UxGT("Definições ABS") +#define MSG_PREHEAT_1 _UxGT("Pre-aquecer " PREHEAT_1_LABEL) +#define MSG_PREHEAT_1_N _UxGT("Pre-aquecer " PREHEAT_1_LABEL) +#define MSG_PREHEAT_1_ALL _UxGT("Pre-aq. " PREHEAT_1_LABEL " Tudo") +#define MSG_PREHEAT_1_BEDONLY _UxGT("Pre-aq. " PREHEAT_1_LABEL " ") LCD_STR_THERMOMETER _UxGT("Base") +#define MSG_PREHEAT_1_SETTINGS _UxGT("Definições " PREHEAT_1_LABEL) +#define MSG_PREHEAT_2 _UxGT("Pre-aquecer " PREHEAT_2_LABEL) +#define MSG_PREHEAT_2_N _UxGT("Pre-aquecer " PREHEAT_2_LABEL " ") +#define MSG_PREHEAT_2_ALL _UxGT("Pre-aq. " PREHEAT_2_LABEL " Tudo") +#define MSG_PREHEAT_2_BEDONLY _UxGT("Pre-aq. " PREHEAT_2_LABEL " ") LCD_STR_THERMOMETER _UxGT("Base") +#define MSG_PREHEAT_2_SETTINGS _UxGT("Definições " PREHEAT_2_LABEL) #define MSG_COOLDOWN _UxGT("Arrefecer") #define MSG_SWITCH_PS_ON _UxGT("Ligar") #define MSG_SWITCH_PS_OFF _UxGT("Desligar") @@ -86,8 +85,8 @@ #define MSG_MAX _UxGT(" ") LCD_STR_THERMOMETER _UxGT(" Max") #define MSG_FACTOR _UxGT(" ") LCD_STR_THERMOMETER _UxGT(" Fact") #define MSG_AUTOTEMP _UxGT("Temp. Automática") -#define MSG_ON _UxGT("On ") -#define MSG_OFF _UxGT("Off") +#define MSG_LCD_ON _UxGT("On") +#define MSG_LCD_OFF _UxGT("Off") #define MSG_PID_P _UxGT("PID-P") #define MSG_PID_I _UxGT("PID-I") #define MSG_PID_D _UxGT("PID-D") @@ -154,14 +153,14 @@ #define MSG_CONTROL_RETRACT _UxGT(" Retrair mm") #define MSG_CONTROL_RETRACT_SWAP _UxGT("Troca Retrair mm") #define MSG_CONTROL_RETRACTF _UxGT(" Retrair V") -#define MSG_CONTROL_RETRACT_ZLIFT _UxGT(" Levantar mm") +#define MSG_CONTROL_RETRACT_ZHOP _UxGT(" Levantar mm") #define MSG_CONTROL_RETRACT_RECOVER _UxGT(" DesRet mm") #define MSG_CONTROL_RETRACT_RECOVER_SWAP _UxGT("Troca DesRet mm") #define MSG_CONTROL_RETRACT_RECOVERF _UxGT(" DesRet V") #define MSG_AUTORETRACT _UxGT(" AutoRetr.") #define MSG_FILAMENTCHANGE _UxGT("Trocar filamento") #define MSG_INIT_SDCARD _UxGT("Inici. cartão SD") -#define MSG_CNG_SDCARD _UxGT("Trocar cartão SD") +#define MSG_CHANGE_SDCARD _UxGT("Trocar cartão SD") #define MSG_ZPROBE_OUT _UxGT("Sensor fora/base") #define MSG_HOME _UxGT("Home") // Used as MSG_HOME " " MSG_X MSG_Y MSG_Z " " MSG_FIRST #define MSG_FIRST _UxGT("first") @@ -186,5 +185,3 @@ #define MSG_DELTA_CALIBRATE_CENTER _UxGT("Calibrar Centro") #define MSG_LCD_ENDSTOPS _UxGT("Fim de curso") - -#endif // LANGUAGE_PT_UTF_H diff --git a/Marlin/src/lcd/language/language_ru.h b/Marlin/src/lcd/language/language_ru.h index 9e73e051d2..9a3761b0cb 100644 --- a/Marlin/src/lcd/language/language_ru.h +++ b/Marlin/src/lcd/language/language_ru.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Russian @@ -27,8 +28,6 @@ * See also http://marlinfw.org/docs/development/lcd_language.html * */ -#ifndef LANGUAGE_RU_H -#define LANGUAGE_RU_H #define DISPLAY_CHARSET_ISO10646_5 #define CHARSIZE 2 @@ -57,13 +56,13 @@ #define MSG_SET_HOME_OFFSETS _UxGT("Запомнить парковку") #define MSG_HOME_OFFSETS_APPLIED _UxGT("Коррекции применены") #define MSG_SET_ORIGIN _UxGT("Запомнить ноль") -#define MSG_PREHEAT_1 _UxGT("Преднагрев PLA") +#define MSG_PREHEAT_1 _UxGT("Преднагрев " PREHEAT_1_LABEL) #define MSG_PREHEAT_1_N MSG_PREHEAT_1 _UxGT(" ") #define MSG_PREHEAT_1_ALL MSG_PREHEAT_1 _UxGT(" всё") #define MSG_PREHEAT_1_END MSG_PREHEAT_1 _UxGT(" сопло") #define MSG_PREHEAT_1_BEDONLY MSG_PREHEAT_1 _UxGT(" стол") #define MSG_PREHEAT_1_SETTINGS MSG_PREHEAT_1 _UxGT(" настр.") -#define MSG_PREHEAT_2 _UxGT("Преднагрев ABS") +#define MSG_PREHEAT_2 _UxGT("Преднагрев " PREHEAT_2_LABEL) #define MSG_PREHEAT_2_N MSG_PREHEAT_2 _UxGT(" ") #define MSG_PREHEAT_2_ALL MSG_PREHEAT_2 _UxGT(" всё") #define MSG_PREHEAT_2_END MSG_PREHEAT_2 _UxGT(" сопло") @@ -93,24 +92,24 @@ #define MSG_UBL_MOVING_TO_NEXT _UxGT("Двигаемся дальше") #define MSG_UBL_ACTIVATE_MESH _UxGT("Активировать UBL") #define MSG_UBL_DEACTIVATE_MESH _UxGT("Деактивировать UBL") -#define MSG_UBL_SET_BED_TEMP _UxGT("Температура стола") -#define MSG_UBL_CUSTOM_BED_TEMP MSG_UBL_SET_BED_TEMP -#define MSG_UBL_SET_HOTEND_TEMP _UxGT("Температура сопла") -#define MSG_UBL_CUSTOM_HOTEND_TEMP MSG_UBL_SET_HOTEND_TEMP +#define MSG_UBL_SET_TEMP_BED _UxGT("Температура стола") +#define MSG_UBL_BED_TEMP_CUSTOM MSG_UBL_SET_TEMP_BED +#define MSG_UBL_SET_TEMP_HOTEND _UxGT("Температура сопла") +#define MSG_UBL_HOTEND_TEMP_CUSTOM MSG_UBL_SET_TEMP_HOTEND #define MSG_UBL_MESH_EDIT _UxGT("Редактор сеток") #define MSG_UBL_EDIT_CUSTOM_MESH _UxGT("Редакт. свою сетку") #define MSG_UBL_FINE_TUNE_MESH _UxGT("Точная настр. сетки") #define MSG_UBL_DONE_EDITING_MESH _UxGT("Ред. сетки завершено") #define MSG_UBL_BUILD_CUSTOM_MESH _UxGT("Построить свою сетку") #define MSG_UBL_BUILD_MESH_MENU _UxGT("Построить сетку") -#define MSG_UBL_BUILD_PLA_MESH _UxGT("Построить сетку PLA") -#define MSG_UBL_BUILD_ABS_MESH _UxGT("Построить сетку ABS") +#define MSG_UBL_BUILD_MESH_M1 _UxGT("Построить сетку " PREHEAT_1_LABEL) +#define MSG_UBL_BUILD_MESH_M2 _UxGT("Построить сетку " PREHEAT_2_LABEL) #define MSG_UBL_BUILD_COLD_MESH _UxGT("Построить хол. сетку") #define MSG_UBL_MESH_HEIGHT_ADJUST _UxGT("Устан. высоту сетки") #define MSG_UBL_MESH_HEIGHT_AMOUNT _UxGT("Высота") #define MSG_UBL_VALIDATE_MESH_MENU _UxGT("Проверить сетку") -#define MSG_UBL_VALIDATE_PLA_MESH _UxGT("Проверить сетку PLA") -#define MSG_UBL_VALIDATE_ABS_MESH _UxGT("Проверить сетку ABS") +#define MSG_UBL_VALIDATE_MESH_M1 _UxGT("Проверить сетку " PREHEAT_1_LABEL) +#define MSG_UBL_VALIDATE_MESH_M2 _UxGT("Проверить сетку " PREHEAT_2_LABEL) #define MSG_UBL_VALIDATE_CUSTOM_MESH _UxGT("Проверить свою сетку") #define MSG_UBL_CONTINUE_MESH _UxGT("Продолжить сетку") #define MSG_UBL_MESH_LEVELING _UxGT("Калибровка сетки") @@ -124,7 +123,7 @@ #define MSG_UBL_OUTPUT_MAP_CSV _UxGT("Вывести в CSV") #define MSG_UBL_OUTPUT_MAP_BACKUP _UxGT("Забекапить сетку") #define MSG_UBL_INFO_UBL _UxGT("Вывод информации UBL") -#define MSG_UBL_EDIT_MESH_MENU _UxGT("Редактировать сетку") +#define MSG_EDIT_MESH _UxGT("Редактировать сетку") #define MSG_UBL_FILLIN_AMOUNT _UxGT("Кол-во заполнителя") #define MSG_UBL_MANUAL_FILLIN _UxGT("Ручное заполнение") #define MSG_UBL_SMART_FILLIN _UxGT("Умное заполнение") @@ -185,8 +184,8 @@ #define MSG_MAX _UxGT(" ") LCD_STR_THERMOMETER _UxGT(" Макс") #define MSG_FACTOR _UxGT(" ") LCD_STR_THERMOMETER _UxGT(" Фактор") #define MSG_AUTOTEMP _UxGT("Автотемпература") -#define MSG_ON _UxGT("Вкл.") -#define MSG_OFF _UxGT("Выкл.") +#define MSG_LCD_ON _UxGT("Вкл.") +#define MSG_LCD_OFF _UxGT("Выкл.") #define MSG_PID_P _UxGT("PID-P") #define MSG_PID_I _UxGT("PID-I") #define MSG_PID_D _UxGT("PID-D") @@ -261,7 +260,7 @@ #define MSG_CONTROL_RETRACT _UxGT("Втягивание мм") #define MSG_CONTROL_RETRACT_SWAP _UxGT("Втягивание смены мм") #define MSG_CONTROL_RETRACTF _UxGT("Втягивание V") -#define MSG_CONTROL_RETRACT_ZLIFT _UxGT("Втяг. прыжка мм") +#define MSG_CONTROL_RETRACT_ZHOP _UxGT("Втяг. прыжка мм") #define MSG_CONTROL_RETRACT_RECOVER _UxGT("Возврат мм") #define MSG_CONTROL_RETRACT_RECOVER_SWAP _UxGT("Возврат смены мм") #define MSG_CONTROL_RETRACT_RECOVERF _UxGT("Возврат V") @@ -272,7 +271,7 @@ #define MSG_FILAMENTUNLOAD _UxGT("Выгрузка филамента") #define MSG_FILAMENTUNLOAD_ALL _UxGT("Выгрузить всё") #define MSG_INIT_SDCARD _UxGT("Иниц. SD карту") -#define MSG_CNG_SDCARD _UxGT("Сменить SD карту") +#define MSG_CHANGE_SDCARD _UxGT("Сменить SD карту") #define MSG_ZPROBE_OUT _UxGT("Z датчик вне стола") #define MSG_SKEW_FACTOR _UxGT("Фактор наклона") #define MSG_BLTOUCH _UxGT("BLTouch") @@ -399,5 +398,3 @@ #define MSG_FILAMENT_CHANGE_PURGE_1 _UxGT("Выдавливание...") #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Возобновление...") #endif // LCD_HEIGHT < 4 - -#endif // LANGUAGE_RU_H diff --git a/Marlin/src/lcd/language/language_sk.h b/Marlin/src/lcd/language/language_sk.h index fdcecab4ed..4a6efaec48 100644 --- a/Marlin/src/lcd/language/language_sk.h +++ b/Marlin/src/lcd/language/language_sk.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Slovak @@ -31,8 +32,6 @@ * http://www.facebook.com/farmamam * */ -#ifndef LANGUAGE_SK_UTF_H -#define LANGUAGE_SK_UTF_H // Put characters here that should be displayed with M117 //_UxGT("aäAÄaáAÁeéEÉiíIÍlĺLĹ") @@ -60,6 +59,7 @@ #define MSG_AUTO_HOME_X _UxGT("Domov os X") #define MSG_AUTO_HOME_Y _UxGT("Domov os Y") #define MSG_AUTO_HOME_Z _UxGT("Domov os Z") +#define MSG_AUTO_Z_ALIGN _UxGT("Auto-zarovn. Z") #define MSG_TMC_Z_CALIBRATION _UxGT("Kalibrovať Z") #define MSG_LEVEL_BED_HOMING _UxGT("Parkovanie XYZ") #define MSG_LEVEL_BED_WAITING _UxGT("Kliknutím spusťte") @@ -69,13 +69,13 @@ #define MSG_SET_HOME_OFFSETS _UxGT("Nastaviť offsety") #define MSG_HOME_OFFSETS_APPLIED _UxGT("Offsety nastavené") #define MSG_SET_ORIGIN _UxGT("Nastaviť začiatok") -#define MSG_PREHEAT_1 _UxGT("Zahriať PLA") +#define MSG_PREHEAT_1 _UxGT("Zahriať " PREHEAT_1_LABEL) #define MSG_PREHEAT_1_N MSG_PREHEAT_1 _UxGT(" ") #define MSG_PREHEAT_1_ALL MSG_PREHEAT_1 _UxGT(" všetko") #define MSG_PREHEAT_1_END MSG_PREHEAT_1 _UxGT(" hotend") #define MSG_PREHEAT_1_BEDONLY MSG_PREHEAT_1 _UxGT(" podlož") #define MSG_PREHEAT_1_SETTINGS MSG_PREHEAT_1 _UxGT(" nast.") -#define MSG_PREHEAT_2 _UxGT("Zahriať ABS") +#define MSG_PREHEAT_2 _UxGT("Zahriať " PREHEAT_2_LABEL) #define MSG_PREHEAT_2_N MSG_PREHEAT_2 _UxGT(" ") #define MSG_PREHEAT_2_ALL MSG_PREHEAT_2 _UxGT(" všetko") #define MSG_PREHEAT_2_END MSG_PREHEAT_2 _UxGT(" hotend") @@ -93,6 +93,9 @@ #define MSG_LEVEL_CORNERS _UxGT("Vyrovnať rohy") #define MSG_NEXT_CORNER _UxGT("Ďalší roh") #define MSG_EDITING_STOPPED _UxGT("Koniec úprav siete") +#define MSG_MESH_X _UxGT("Index X") +#define MSG_MESH_Y _UxGT("Index Y") +#define MSG_MESH_EDIT_Z _UxGT("Hodnota Z") #define MSG_USER_MENU _UxGT("Vlastné príkazy") #define MSG_UBL_DOING_G29 _UxGT("Vykonávam G29") @@ -102,7 +105,12 @@ #define MSG_IDEX_MENU _UxGT("IDEX mód") #define MSG_IDEX_MODE_AUTOPARK _UxGT("Auto-parkovanie") #define MSG_IDEX_MODE_DUPLICATE _UxGT("Duplikácia") +#define MSG_IDEX_MODE_SCALED_COPY _UxGT("Zmenšená 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_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") @@ -110,24 +118,24 @@ #define MSG_UBL_MOVING_TO_NEXT _UxGT("Presun na ďalší") #define MSG_UBL_ACTIVATE_MESH _UxGT("Aktivovať UBL") #define MSG_UBL_DEACTIVATE_MESH _UxGT("Deaktivovať UBL") -#define MSG_UBL_SET_BED_TEMP _UxGT("Teplota podložky") -#define MSG_UBL_CUSTOM_BED_TEMP MSG_UBL_SET_BED_TEMP -#define MSG_UBL_SET_HOTEND_TEMP _UxGT("Teplota hotendu") -#define MSG_UBL_CUSTOM_HOTEND_TEMP MSG_UBL_SET_HOTEND_TEMP +#define MSG_UBL_SET_TEMP_BED _UxGT("Teplota podložky") +#define MSG_UBL_BED_TEMP_CUSTOM MSG_UBL_SET_TEMP_BED +#define MSG_UBL_SET_TEMP_HOTEND _UxGT("Teplota hotendu") +#define MSG_UBL_HOTEND_TEMP_CUSTOM MSG_UBL_SET_TEMP_HOTEND #define MSG_UBL_MESH_EDIT _UxGT("Úprava siete bodov") #define MSG_UBL_EDIT_CUSTOM_MESH _UxGT("Upraviť vlastnú sieť") #define MSG_UBL_FINE_TUNE_MESH _UxGT("Doladiť sieť bodov") #define MSG_UBL_DONE_EDITING_MESH _UxGT("Koniec úprav siete") #define MSG_UBL_BUILD_CUSTOM_MESH _UxGT("Vlastná sieť") #define MSG_UBL_BUILD_MESH_MENU _UxGT("Vytvoriť sieť") -#define MSG_UBL_BUILD_PLA_MESH _UxGT("Sieť bodov PLA") -#define MSG_UBL_BUILD_ABS_MESH _UxGT("Sieť bodov ABS") +#define MSG_UBL_BUILD_MESH_M1 _UxGT("Sieť bodov " PREHEAT_1_LABEL) +#define MSG_UBL_BUILD_MESH_M2 _UxGT("Sieť bodov " PREHEAT_2_LABEL) #define MSG_UBL_BUILD_COLD_MESH _UxGT("Studená sieť bodov") #define MSG_UBL_MESH_HEIGHT_ADJUST _UxGT("Upraviť výšku siete") #define MSG_UBL_MESH_HEIGHT_AMOUNT _UxGT("Výška") #define MSG_UBL_VALIDATE_MESH_MENU _UxGT("Skontrolovať sieť") -#define MSG_UBL_VALIDATE_PLA_MESH _UxGT("Kontrola siete PLA") -#define MSG_UBL_VALIDATE_ABS_MESH _UxGT("Kontrola siete ABS") +#define MSG_UBL_VALIDATE_MESH_M1 _UxGT("Kontrola siete " PREHEAT_1_LABEL) +#define MSG_UBL_VALIDATE_MESH_M2 _UxGT("Kontrola siete " PREHEAT_2_LABEL) #define MSG_UBL_VALIDATE_CUSTOM_MESH _UxGT("Kontrola vlast.siete") #define MSG_UBL_CONTINUE_MESH _UxGT("Pokračovať v sieti") #define MSG_UBL_MESH_LEVELING _UxGT("Sieťové rovnanie") @@ -141,7 +149,7 @@ #define MSG_UBL_OUTPUT_MAP_CSV _UxGT("Exportovať do CSV") #define MSG_UBL_OUTPUT_MAP_BACKUP _UxGT("Záloha do PC") #define MSG_UBL_INFO_UBL _UxGT("Info. o UBL do PC") -#define MSG_UBL_EDIT_MESH_MENU _UxGT("Upraviť sieť bodov") +#define MSG_EDIT_MESH _UxGT("Upraviť sieť bodov") #define MSG_UBL_FILLIN_AMOUNT _UxGT("Hustota mriežky") #define MSG_UBL_MANUAL_FILLIN _UxGT("Ručné vyplnenie") #define MSG_UBL_SMART_FILLIN _UxGT("Chytré vyplnenie") @@ -187,6 +195,7 @@ #define MSG_MOVE_Y _UxGT("Posunúť Y") #define MSG_MOVE_Z _UxGT("Posunúť Z") #define MSG_MOVE_E _UxGT("Extrudér") +#define MSG_HOTEND_TOO_COLD _UxGT("Hotend je studený") #define MSG_MOVE_01MM _UxGT("Posunúť o 0,1mm") #define MSG_MOVE_1MM _UxGT("Posunúť o 1mm") #define MSG_MOVE_10MM _UxGT("Posunúť o 10mm") @@ -202,8 +211,8 @@ #define MSG_MAX _UxGT(" ") LCD_STR_THERMOMETER _UxGT(" Max") #define MSG_FACTOR _UxGT(" ") LCD_STR_THERMOMETER _UxGT(" Fakt") #define MSG_AUTOTEMP _UxGT("Auto-teplota") -#define MSG_ON _UxGT("Zap") -#define MSG_OFF _UxGT("Vyp") +#define MSG_LCD_ON _UxGT("Zap") +#define MSG_LCD_OFF _UxGT("Vyp") #define MSG_PID_P _UxGT("PID-P") #define MSG_PID_I _UxGT("PID-I") #define MSG_PID_D _UxGT("PID-D") @@ -259,7 +268,9 @@ #define MSG_STORE_EEPROM _UxGT("Uložiť nastavenie") #define MSG_LOAD_EEPROM _UxGT("Načítať nastavenie") #define MSG_RESTORE_FAILSAFE _UxGT("Obnoviť nastavenie") -#define MSG_INIT_EEPROM _UxGT("Inicializácia EEPROM") +#define MSG_INIT_EEPROM _UxGT("Inicializ. EEPROM") +#define MSG_SD_UPDATE _UxGT("Aktualizovať z SD") +#define MSG_RESET_PRINTER _UxGT("Reštart. tlačiar.") #define MSG_REFRESH _UxGT("Obnoviť") #define MSG_WATCH _UxGT("Info. obrazovka") #define MSG_PREPARE _UxGT("Príprava tlače") @@ -267,7 +278,7 @@ #define MSG_PAUSE_PRINT _UxGT("Pozastaviť tlač") #define MSG_RESUME_PRINT _UxGT("Obnoviť tlač") #define MSG_STOP_PRINT _UxGT("Zastaviť tlač") -#define MSG_POWER_LOSS_RECOVERY _UxGT("Obnova po výp. nap.") +#define MSG_OUTAGE_RECOVERY _UxGT("Obnova po výp. nap.") #define MSG_CARD_MENU _UxGT("Tlačiť z SD") #define MSG_NO_CARD _UxGT("Žiadna SD karta") #define MSG_DWELL _UxGT("Spím...") @@ -281,19 +292,24 @@ #define MSG_CONTROL_RETRACT _UxGT("Retrakt mm") #define MSG_CONTROL_RETRACT_SWAP _UxGT("Výmena Re.mm") #define MSG_CONTROL_RETRACTF _UxGT("Retraktovať V") -#define MSG_CONTROL_RETRACT_ZLIFT _UxGT("Zdvih Z mm") +#define MSG_CONTROL_RETRACT_ZHOP _UxGT("Zdvih Z mm") #define MSG_CONTROL_RETRACT_RECOVER _UxGT("UnRet mm") #define MSG_CONTROL_RETRACT_RECOVER_SWAP _UxGT("S UnRet mm") #define MSG_CONTROL_RETRACT_RECOVERF _UxGT("UnRet V") #define MSG_CONTROL_RETRACT_RECOVER_SWAPF _UxGT("S UnRet V") #define MSG_AUTORETRACT _UxGT("AutoRetr.") +#define MSG_FILAMENT_SWAP_LENGTH _UxGT("Dĺžka retrakcie") +#define MSG_TOOL_CHANGE _UxGT("Výmena nástroja") +#define MSG_TOOL_CHANGE_ZLIFT _UxGT("Zdvihnúť Z") +#define MSG_SINGLENOZZLE_PRIME_SPD _UxGT("Primárna rýchl.") +#define MSG_SINGLENOZZLE_RETRACT_SPD _UxGT("Rýchl. retrakcie") #define MSG_FILAMENTCHANGE _UxGT("Vymeniť filament") #define MSG_FILAMENTLOAD _UxGT("Zaviesť filament") #define MSG_FILAMENTUNLOAD _UxGT("Vysunúť filament") #define MSG_FILAMENTUNLOAD_ALL _UxGT("Vysunúť všetko") #define MSG_INIT_SDCARD _UxGT("Načítať SD kartu") -#define MSG_CNG_SDCARD _UxGT("Vymeniť SD kartu") +#define MSG_CHANGE_SDCARD _UxGT("Vymeniť SD kartu") #define MSG_ZPROBE_OUT _UxGT("Sonda Z mimo podl.") #define MSG_SKEW_FACTOR _UxGT("Faktor skosenia") #define MSG_BLTOUCH _UxGT("BLTouch") @@ -301,6 +317,8 @@ #define MSG_BLTOUCH_RESET _UxGT("Reset BLTouch") #define MSG_BLTOUCH_DEPLOY _UxGT("Vysunúť BLTouch") #define MSG_BLTOUCH_STOW _UxGT("Zasunúť BLTouch") +#define MSG_MANUAL_DEPLOY _UxGT("Inštalovať sondu Z") +#define MSG_MANUAL_STOW _UxGT("Odstrániť sondu Z") #define MSG_HOME _UxGT("Najskôr os") // Used as MSG_HOME " " MSG_X MSG_Y MSG_Z " " MSG_FIRST #define MSG_FIRST _UxGT("domov") #define MSG_ZPROBE_ZOFFSET _UxGT("Z offset sondy") @@ -383,43 +401,51 @@ #define MSG_FILAMENT_CHANGE_OPTION_PURGE _UxGT("Vytlačiť viacej") #define MSG_FILAMENT_CHANGE_OPTION_RESUME _UxGT("Obnoviť tlač") #define MSG_FILAMENT_CHANGE_NOZZLE _UxGT(" Tryska: ") +#define MSG_RUNOUT_SENSOR_ENABLE _UxGT("Senzor filamentu") #define MSG_ERR_HOMING_FAILED _UxGT("Parkovanie zlyhalo") #define MSG_ERR_PROBING_FAILED _UxGT("Kalibrácia zlyhala") #define MSG_M600_TOO_COLD _UxGT("M600: Príliš studený") +// +// Filament Change screens show up to 3 lines on a 4-line display +// ...or up to 2 lines on a 3-line display +// #if LCD_HEIGHT >= 4 - // Up to 3 lines allowed + #define MSG_ADVANCED_PAUSE_WAITING_1 _UxGT("Stlačte tlačidlo") + #define MSG_ADVANCED_PAUSE_WAITING_2 _UxGT("pre obnovu tlače") #define MSG_FILAMENT_CHANGE_INIT_1 _UxGT("Čakajte prosím") #define MSG_FILAMENT_CHANGE_INIT_2 _UxGT("na spustenie") #define MSG_FILAMENT_CHANGE_INIT_3 _UxGT("výmeny filamentu") + #define MSG_FILAMENT_CHANGE_INSERT_1 _UxGT("Vložte filament") + #define MSG_FILAMENT_CHANGE_INSERT_2 _UxGT("a stlačte tlačidlo") + #define MSG_FILAMENT_CHANGE_INSERT_3 _UxGT("pre pokračovanie") + #define MSG_FILAMENT_CHANGE_HEAT_1 _UxGT("Stlačte tlačidlo") + #define MSG_FILAMENT_CHANGE_HEAT_2 _UxGT("pre ohrev trysky") + #define MSG_FILAMENT_CHANGE_HEATING_1 _UxGT("Ohrev trysky") + #define MSG_FILAMENT_CHANGE_HEATING_2 _UxGT("Čakajte prosím...") #define MSG_FILAMENT_CHANGE_UNLOAD_1 _UxGT("Čakajte prosím") #define MSG_FILAMENT_CHANGE_UNLOAD_2 _UxGT("na vysunutie") #define MSG_FILAMENT_CHANGE_UNLOAD_3 _UxGT("filamentu") - #define MSG_FILAMENT_CHANGE_INSERT_1 _UxGT("Vložte filament") - #define MSG_FILAMENT_CHANGE_INSERT_2 _UxGT("a stlačte") - #define MSG_FILAMENT_CHANGE_INSERT_3 _UxGT("tlačidlo...") - #define MSG_FILAMENT_CHANGE_HEAT_1 _UxGT("Kliknite pre") - #define MSG_FILAMENT_CHANGE_HEAT_2 _UxGT("ohrev trysky") - #define MSG_FILAMENT_CHANGE_HEATING_1 _UxGT("Čakajte prosím") - #define MSG_FILAMENT_CHANGE_HEATING_2 _UxGT("na teplotu trysky") #define MSG_FILAMENT_CHANGE_LOAD_1 _UxGT("Čakajte prosím") #define MSG_FILAMENT_CHANGE_LOAD_2 _UxGT("na zavedenie") #define MSG_FILAMENT_CHANGE_LOAD_3 _UxGT("filamentu") - #define MSG_FILAMENT_CHANGE_PURGE_1 _UxGT("Čakajte na") - #define MSG_FILAMENT_CHANGE_PURGE_2 _UxGT("vytlačenie") - #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Čakajte prosím") - #define MSG_FILAMENT_CHANGE_RESUME_2 _UxGT("na pokračovanie") - #define MSG_FILAMENT_CHANGE_RESUME_3 _UxGT("tlače") + #define MSG_FILAMENT_CHANGE_PURGE_1 _UxGT("Čakajte prosím") + #define MSG_FILAMENT_CHANGE_PURGE_2 _UxGT("na vytlačenie") + #define MSG_FILAMENT_CHANGE_PURGE_3 _UxGT("filamentu") + #define MSG_FILAMENT_CHANGE_CONT_PURGE_1 _UxGT("Stlačte tlačidlo") + #define MSG_FILAMENT_CHANGE_CONT_PURGE_2 _UxGT("pre dokončenie") + #define MSG_FILAMENT_CHANGE_CONT_PURGE_3 _UxGT("vytláčania filam.") + #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Čakajte prosím na") + #define MSG_FILAMENT_CHANGE_RESUME_2 _UxGT("obnovenie tlače...") #else // LCD_HEIGHT < 4 - // Up to 2 lines allowed + #define MSG_ADVANCED_PAUSE_WAITING_1 _UxGT("Kliknite pre pokr.") #define MSG_FILAMENT_CHANGE_INIT_1 _UxGT("Čakajte prosím...") - #define MSG_FILAMENT_CHANGE_UNLOAD_1 _UxGT("Vysúvanie...") #define MSG_FILAMENT_CHANGE_INSERT_1 _UxGT("Vložte a kliknite") #define MSG_FILAMENT_CHANGE_HEAT_1 _UxGT("Kliknite pre ohrev") #define MSG_FILAMENT_CHANGE_HEATING_1 _UxGT("Ohrev...") + #define MSG_FILAMENT_CHANGE_UNLOAD_1 _UxGT("Vysúvanie...") #define MSG_FILAMENT_CHANGE_LOAD_1 _UxGT("Zavádzanie...") #define MSG_FILAMENT_CHANGE_PURGE_1 _UxGT("Vytlačovanie...") + #define MSG_FILAMENT_CHANGE_CONT_PURGE_1 _UxGT("Klik. pre dokonč.") #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Pokračovanie...") #endif // LCD_HEIGHT < 4 - -#endif // LANGUAGE_SK_UTF_H diff --git a/Marlin/src/lcd/language/language_test.h b/Marlin/src/lcd/language/language_test.h index 32805f11a3..dfc31953fb 100644 --- a/Marlin/src/lcd/language/language_test.h +++ b/Marlin/src/lcd/language/language_test.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * TEST @@ -27,8 +28,6 @@ * See also http://marlinfw.org/docs/development/lcd_language.html * */ -#ifndef LANGUAGE_TEST_H -#define LANGUAGE_TEST_H // Select ONE of the following Mappers. // They decide what to do with a symbol in the area of [0x80:0xFF]. They take a symbol of this language file and make them point @@ -226,5 +225,3 @@ #define MSG_PID_P STRG_OKTAL_e #define MSG_PID_I STRG_OKTAL_f #endif - -#endif // LANGUAGE_TEST_H diff --git a/Marlin/src/lcd/language/language_tr.h b/Marlin/src/lcd/language/language_tr.h index fc30d86ad8..44b3232ea4 100644 --- a/Marlin/src/lcd/language/language_tr.h +++ b/Marlin/src/lcd/language/language_tr.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Turkish @@ -27,8 +28,6 @@ * See also http://marlinfw.org/docs/development/lcd_language.html * */ -#ifndef LANGUAGE_TR_H -#define LANGUAGE_TR_H #define DISPLAY_CHARSET_ISO10646_TR #define CHARSIZE 2 @@ -55,13 +54,13 @@ #define MSG_SET_HOME_OFFSETS _UxGT("Offset Ayarla") // Offset Ayarla #define MSG_HOME_OFFSETS_APPLIED _UxGT("Offset Tamam") // Offset Tamam #define MSG_SET_ORIGIN _UxGT("Sıfır Belirle") // Sıfır Belirle -#define MSG_PREHEAT_1 _UxGT("Ön Isınma PLA") // Ön Isınma PLA +#define MSG_PREHEAT_1 _UxGT("Ön Isınma " PREHEAT_1_LABEL) // Ön Isınma PREHEAT_1_LABEL #define MSG_PREHEAT_1_N MSG_PREHEAT_1 _UxGT(" ") // #define MSG_PREHEAT_1_ALL MSG_PREHEAT_1 _UxGT(" Tüm") // Tüm #define MSG_PREHEAT_1_END MSG_PREHEAT_1 _UxGT(" Nozül") // Nozül #define MSG_PREHEAT_1_BEDONLY MSG_PREHEAT_1 _UxGT(" Tabla") // Tabla #define MSG_PREHEAT_1_SETTINGS MSG_PREHEAT_1 _UxGT(" Ayar") // Ayar -#define MSG_PREHEAT_2 _UxGT("Ön Isınma ABS") // Ön Isınma ABS +#define MSG_PREHEAT_2 _UxGT("Ön Isınma " PREHEAT_2_LABEL) // Ön Isınma PREHEAT_2_LABEL #define MSG_PREHEAT_2_N MSG_PREHEAT_2 _UxGT(" ") // #define MSG_PREHEAT_2_ALL MSG_PREHEAT_2 _UxGT(" Tüm") // Tüm #define MSG_PREHEAT_2_END MSG_PREHEAT_2 _UxGT(" Nozül") // Nozül @@ -96,8 +95,8 @@ #define MSG_MAX _UxGT(" ") LCD_STR_THERMOMETER _UxGT(" Max") // Max #define MSG_FACTOR _UxGT(" ") LCD_STR_THERMOMETER _UxGT(" Çarpan") // Çarpan #define MSG_AUTOTEMP _UxGT("Autotemp") // Autotemp -#define MSG_ON _UxGT("On ") // On -#define MSG_OFF _UxGT("Off") // Off +#define MSG_LCD_ON _UxGT("On") // On +#define MSG_LCD_OFF _UxGT("Off") // Off #define MSG_PID_P _UxGT("PID-P") // PID-P #define MSG_PID_I _UxGT("PID-I") // PID-I #define MSG_PID_D _UxGT("PID-D") // PID-D @@ -166,14 +165,14 @@ #define MSG_CONTROL_RETRACT _UxGT("Geri Çek mm") // Geri Çek mm #define MSG_CONTROL_RETRACT_SWAP _UxGT("Swap Re.mm") // Swap Re.mm #define MSG_CONTROL_RETRACTF _UxGT("Geri Çekme V") // Geri Çekme V -#define MSG_CONTROL_RETRACT_ZLIFT _UxGT("Hop mm") // Hop mm +#define MSG_CONTROL_RETRACT_ZHOP _UxGT("Hop mm") // Hop mm #define MSG_CONTROL_RETRACT_RECOVER _UxGT("UnRet mm") // UnRet mm #define MSG_CONTROL_RETRACT_RECOVER_SWAP _UxGT("S UnRet mm") // S UnRetmm #define MSG_CONTROL_RETRACT_RECOVERF _UxGT("UnRet V") // UnRet V #define MSG_AUTORETRACT _UxGT("AutoRetr.") // AutoRetr. #define MSG_FILAMENTCHANGE _UxGT("Filaman Değiştir") // Filaman Değiştir #define MSG_INIT_SDCARD _UxGT("Init. SD") // Init. SD -#define MSG_CNG_SDCARD _UxGT("SD Değiştir") // SD Değiştir +#define MSG_CHANGE_SDCARD _UxGT("SD Değiştir") // SD Değiştir #define MSG_ZPROBE_OUT _UxGT("Z Prob Açık. Tabla") // Z Prob Açık. Tabla #define MSG_BLTOUCH_SELFTEST _UxGT("BLTouch Self-Test") // BLTouch Self-Test #define MSG_BLTOUCH_RESET _UxGT("Sıfırla BLTouch") // Sıfırla BLTouch @@ -266,5 +265,3 @@ #define MSG_FILAMENT_CHANGE_LOAD_1 _UxGT("Yüklüyor...") // Yüklüyor... #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Sürdürülüyor...") // Sürdürülüyor... #endif // LCD_HEIGHT < 4 - -#endif // LANGUAGE_TR_H diff --git a/Marlin/src/lcd/language/language_uk.h b/Marlin/src/lcd/language/language_uk.h index 6236320589..38d7642420 100644 --- a/Marlin/src/lcd/language/language_uk.h +++ b/Marlin/src/lcd/language/language_uk.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Ukrainian @@ -27,8 +28,6 @@ * See also http://marlinfw.org/docs/development/lcd_language.html * */ -#ifndef LANGUAGE_UK_H -#define LANGUAGE_UK_H #define DISPLAY_CHARSET_ISO10646_5 #define CHARSIZE 2 @@ -52,12 +51,12 @@ #define MSG_SET_HOME_OFFSETS _UxGT("Зберегти паркув.") #define MSG_HOME_OFFSETS_APPLIED _UxGT("Зміщення застос.") #define MSG_SET_ORIGIN _UxGT("Встанов. початок") -#define MSG_PREHEAT_1 _UxGT("Нагрів PLA") +#define MSG_PREHEAT_1 _UxGT("Нагрів " PREHEAT_1_LABEL) #define MSG_PREHEAT_1_N MSG_PREHEAT_1 _UxGT(" ") #define MSG_PREHEAT_1_ALL MSG_PREHEAT_1 _UxGT(" Все") #define MSG_PREHEAT_1_BEDONLY MSG_PREHEAT_1 _UxGT(" Стіл") #define MSG_PREHEAT_1_SETTINGS MSG_PREHEAT_1 _UxGT(" нал.") -#define MSG_PREHEAT_2 _UxGT("Нагрів ABS") +#define MSG_PREHEAT_2 _UxGT("Нагрів " PREHEAT_2_LABEL) #define MSG_PREHEAT_2_N MSG_PREHEAT_2 _UxGT(" ") #define MSG_PREHEAT_2_ALL MSG_PREHEAT_2 _UxGT(" Все") #define MSG_PREHEAT_2_BEDONLY MSG_PREHEAT_2 _UxGT(" Стіл") @@ -88,8 +87,8 @@ #define MSG_MAX _UxGT(" ") LCD_STR_THERMOMETER _UxGT(" Макс") #define MSG_FACTOR _UxGT(" ") LCD_STR_THERMOMETER _UxGT(" Факт") #define MSG_AUTOTEMP _UxGT("Автотемпер.") -#define MSG_ON _UxGT("Увімк.") -#define MSG_OFF _UxGT("Вимк. ") +#define MSG_LCD_ON _UxGT("Увімк.") +#define MSG_LCD_OFF _UxGT("Вимк.") #define MSG_PID_P _UxGT("PID-P") #define MSG_PID_I _UxGT("PID-I") #define MSG_PID_D _UxGT("PID-D") @@ -156,7 +155,7 @@ #define MSG_STOPPED _UxGT("ЗУПИНЕНО. ") #define MSG_FILAMENTCHANGE _UxGT("Зміна волокна") #define MSG_INIT_SDCARD _UxGT("Старт SD картки") -#define MSG_CNG_SDCARD _UxGT("Заміна SD карти") +#define MSG_CHANGE_SDCARD _UxGT("Заміна SD карти") #define MSG_ZPROBE_OUT _UxGT("Z дет. не в межах") #define MSG_BLTOUCH_SELFTEST _UxGT("BLTouch Само-Тест") #define MSG_BLTOUCH_RESET _UxGT("Скинути BLTouch") @@ -240,5 +239,3 @@ #define MSG_FILAMENT_CHANGE_LOAD_1 _UxGT("Ввід...") #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Відновлення...") #endif // LCD_HEIGHT < 4 - -#endif // LANGUAGE_UK_H diff --git a/Marlin/src/lcd/language/language_zh_CN.h b/Marlin/src/lcd/language/language_zh_CN.h index acdd097c23..7eb9fa008f 100644 --- a/Marlin/src/lcd/language/language_zh_CN.h +++ b/Marlin/src/lcd/language/language_zh_CN.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Simplified Chinese @@ -27,10 +28,6 @@ * See also http://marlinfw.org/docs/development/lcd_language.html * */ -#ifndef LANGUAGE_ZH_CN_H -#define LANGUAGE_ZH_CN_H - -//#define TALL_FONT_CORRECTION (1) #define CHARSIZE 3 @@ -57,12 +54,12 @@ #define MSG_SET_HOME_OFFSETS _UxGT("设置原点偏移") //"Set home offsets" #define MSG_HOME_OFFSETS_APPLIED _UxGT("偏移已启用") //"Offsets applied" #define MSG_SET_ORIGIN _UxGT("设置原点") //"Set origin" -#define MSG_PREHEAT_1 _UxGT("预热PLA") //"Preheat PLA" +#define MSG_PREHEAT_1 _UxGT("预热" PREHEAT_1_LABEL) //"Preheat PREHEAT_2_LABEL" #define MSG_PREHEAT_1_N MSG_PREHEAT_1 _UxGT(" ") //MSG_PREHEAT_1 " " #define MSG_PREHEAT_1_ALL MSG_PREHEAT_1 _UxGT(" 全部") //MSG_PREHEAT_1 " All" #define MSG_PREHEAT_1_BEDONLY MSG_PREHEAT_1 _UxGT(" 热床") //MSG_PREHEAT_1 " Bed" #define MSG_PREHEAT_1_SETTINGS MSG_PREHEAT_1 _UxGT(" 设置") //MSG_PREHEAT_1 " conf" -#define MSG_PREHEAT_2 _UxGT("预热ABS") //"Preheat ABS" +#define MSG_PREHEAT_2 _UxGT("预热" PREHEAT_2_LABEL) //"Preheat PREHEAT_2_LABEL" #define MSG_PREHEAT_2_N MSG_PREHEAT_2 _UxGT(" ") //MSG_PREHEAT_2 " " #define MSG_PREHEAT_2_ALL MSG_PREHEAT_2 _UxGT(" 全部") //MSG_PREHEAT_2 " All" #define MSG_PREHEAT_2_BEDONLY MSG_PREHEAT_2 _UxGT(" 热床") //MSG_PREHEAT_2 " Bed" @@ -93,22 +90,22 @@ #define MSG_UBL_MOVING_TO_NEXT _UxGT("移动到下一个") // "Moving to next" #define MSG_UBL_ACTIVATE_MESH _UxGT("激活UBL") // "Activate UBL" #define MSG_UBL_DEACTIVATE_MESH _UxGT("关闭UBL") // "Deactivate UBL" -#define MSG_UBL_SET_BED_TEMP _UxGT("设置热床温度") // "Bed Temp" -#define MSG_UBL_SET_HOTEND_TEMP _UxGT("热端温度") // "Hotend Temp" +#define MSG_UBL_SET_TEMP_BED _UxGT("设置热床温度") // "Bed Temp" +#define MSG_UBL_SET_TEMP_HOTEND _UxGT("热端温度") // "Hotend Temp" #define MSG_UBL_MESH_EDIT _UxGT("网格编辑") // "Mesh Edit" #define MSG_UBL_EDIT_CUSTOM_MESH _UxGT("编辑客户网格") // "Edit Custom Mesh" #define MSG_UBL_FINE_TUNE_MESH _UxGT("细调网格") // "Fine Tuning Mesh" #define MSG_UBL_DONE_EDITING_MESH _UxGT("完成编辑网格") // "Done Editing Mesh" #define MSG_UBL_BUILD_CUSTOM_MESH _UxGT("创设客户网格") // "Build Custom Mesh" #define MSG_UBL_BUILD_MESH_MENU _UxGT("创设网格") // "Build Mesh" -#define MSG_UBL_BUILD_PLA_MESH _UxGT("创设PLA网格") // "Build PLA Mesh" -#define MSG_UBL_BUILD_ABS_MESH _UxGT("创设ABS网格") // "Build ABS Mesh" +#define MSG_UBL_BUILD_MESH_M1 _UxGT("创设" PREHEAT_1_LABEL "网格") // "Build PREHEAT_1_LABEL Mesh" +#define MSG_UBL_BUILD_MESH_M2 _UxGT("创设" PREHEAT_2_LABEL "网格") // "Build PREHEAT_2_LABEL Mesh" #define MSG_UBL_BUILD_COLD_MESH _UxGT("创设冷网格") // "Build Cold Mesh" #define MSG_UBL_MESH_HEIGHT_ADJUST _UxGT("调整网格高度") // "Adjust Mesh Height" #define MSG_UBL_MESH_HEIGHT_AMOUNT _UxGT("高度合计") // "Height Amount" #define MSG_UBL_VALIDATE_MESH_MENU _UxGT("批准网格") // "Validate Mesh" -#define MSG_UBL_VALIDATE_PLA_MESH _UxGT("批准PLA网格") // "Validate PLA Mesh" -#define MSG_UBL_VALIDATE_ABS_MESH _UxGT("批准ABS网格") // "Validate ABS Mesh" +#define MSG_UBL_VALIDATE_MESH_M1 _UxGT("批准" PREHEAT_1_LABEL "网格") // "Validate PREHEAT_1_LABEL Mesh" +#define MSG_UBL_VALIDATE_MESH_M2 _UxGT("批准" PREHEAT_2_LABEL "网格") // "Validate PREHEAT_2_LABEL Mesh" #define MSG_UBL_VALIDATE_CUSTOM_MESH _UxGT("批准客户网格") // "Validate Custom Mesh" #define MSG_UBL_CONTINUE_MESH _UxGT("继续热床网格") // "Continue Bed Mesh" #define MSG_UBL_MESH_LEVELING _UxGT("网格调平") // "Mesh Leveling" @@ -122,7 +119,7 @@ #define MSG_UBL_OUTPUT_MAP_CSV _UxGT("输出到CSV") // "Output for CSV" #define MSG_UBL_OUTPUT_MAP_BACKUP _UxGT("输出到备份") // "Off Printer Backup" #define MSG_UBL_INFO_UBL _UxGT("输出UBL信息") // "Output UBL Info" -#define MSG_UBL_EDIT_MESH_MENU _UxGT("编辑网格") // "Edit Mesh" +#define MSG_EDIT_MESH _UxGT("编辑网格") // "Edit Mesh" #define MSG_UBL_FILLIN_AMOUNT _UxGT("填充合计") // "Fill-in Amount" #define MSG_UBL_MANUAL_FILLIN _UxGT("手工填充") // "Manual Fill-in" #define MSG_UBL_SMART_FILLIN _UxGT("聪明填充") // "Smart Fill-in" @@ -183,8 +180,8 @@ #define MSG_MAX _UxGT(" ") LCD_STR_THERMOMETER _UxGT(" 最大") //" " LCD_STR_THERMOMETER " Max" #define MSG_FACTOR _UxGT(" ") LCD_STR_THERMOMETER _UxGT(" 因数") //" " LCD_STR_THERMOMETER " Fact" #define MSG_AUTOTEMP _UxGT("自动控温") //"Autotemp" -#define MSG_ON _UxGT("开 ") //"On " -#define MSG_OFF _UxGT("关 ") //"Off" +#define MSG_LCD_ON _UxGT("开") //"On" +#define MSG_LCD_OFF _UxGT("关") //"Off" #define MSG_PID_P _UxGT("PID-P") //"PID-P" #define MSG_PID_I _UxGT("PID-I") //"PID-I" #define MSG_PID_D _UxGT("PID-D") //"PID-D" @@ -229,7 +226,7 @@ #define MSG_E6STEPS _UxGT("挤出机6步数/mm") //"E6steps/mm" #define MSG_TEMPERATURE _UxGT("温度") //"Temperature" #define MSG_MOTION _UxGT("运动") //"Motion" -#define MSG_FILAMENT _UxGT("丝料测容") //"Filament" lcd_control_volumetric_menu +#define MSG_FILAMENT _UxGT("丝料测容") //"Filament" menu_advanced_filament #define MSG_VOLUMETRIC_ENABLED _UxGT("测容积mm³") //"E in mm3" volumetric_enabled #define MSG_FILAMENT_DIAM _UxGT("丝料直径") //"Fil. Dia." #define MSG_FILAMENT_UNLOAD _UxGT("卸载 mm") // "Unload mm" @@ -259,7 +256,7 @@ #define MSG_CONTROL_RETRACT _UxGT("回抽长度mm") //"Retract mm" retract_length, retract length (positive mm) #define MSG_CONTROL_RETRACT_SWAP _UxGT("换手回抽长度mm") //"Swap Re.mm" swap_retract_length, swap retract length (positive mm), for extruder change #define MSG_CONTROL_RETRACTF _UxGT("回抽速率mm/s") //"Retract V" retract_feedrate_mm_s, feedrate for retracting (mm/s) -#define MSG_CONTROL_RETRACT_ZLIFT _UxGT("Hop mm") //"Hop mm" retract_zlift, retract Z-lift +#define MSG_CONTROL_RETRACT_ZHOP _UxGT("Hop mm") //"Hop mm" retract_zraise, retract Z-lift #define MSG_CONTROL_RETRACT_RECOVER _UxGT("回抽恢复长度mm") //"UnRet +mm" retract_recover_length, additional recover length (mm, added to retract length when recovering) #define MSG_CONTROL_RETRACT_RECOVER_SWAP _UxGT("换手回抽恢复长度mm") //"S UnRet+mm" swap_retract_recover_length, additional swap recover length (mm, added to retract length when recovering from extruder change) #define MSG_CONTROL_RETRACT_RECOVERF _UxGT("回抽恢复后进料速率mm/s") //"UnRet V" retract_recover_feedrate_mm_s, feedrate for recovering from retraction (mm/s) @@ -270,7 +267,7 @@ #define MSG_FILAMENTUNLOAD _UxGT("卸载丝料") // "Unload filament" #define MSG_FILAMENTUNLOAD_ALL _UxGT("卸载全部") // "Unload All" #define MSG_INIT_SDCARD _UxGT("初始化存储卡") //"Init. SD card" -#define MSG_CNG_SDCARD _UxGT("更换存储卡") //"Change SD card" +#define MSG_CHANGE_SDCARD _UxGT("更换存储卡") //"Change SD card" #define MSG_ZPROBE_OUT _UxGT("Z探针在热床之外") //"Z probe out. bed" Z probe is not within the physical limits #define MSG_SKEW_FACTOR _UxGT("偏斜因数") // "Skew Factor" #define MSG_BLTOUCH _UxGT("BLTouch") // "BLTouch" @@ -327,7 +324,7 @@ #define MSG_CASE_LIGHT _UxGT("外壳灯") // "Case light" #define MSG_CASE_LIGHT_BRIGHTNESS _UxGT("灯亮度") // "Light BRIGHTNESS" -#if LCD_WIDTH > 19 +#if LCD_WIDTH >= 20 #define MSG_INFO_PRINT_COUNT _UxGT("打印计数") //"Print Count" #define MSG_INFO_COMPLETED_PRINTS _UxGT("完成了") //"Completed" #define MSG_INFO_PRINT_TIME _UxGT("总打印时间") //"Total print time" @@ -386,5 +383,3 @@ #define MSG_FILAMENT_CHANGE_PURGE_1 _UxGT("清除中 ...") // "Purging..." #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("恢复中 ...") //"Resuming..." #endif // LCD_HEIGHT < 4 - -#endif // LANGUAGE_ZH_CN_H diff --git a/Marlin/src/lcd/language/language_zh_TW.h b/Marlin/src/lcd/language/language_zh_TW.h index a4885a80da..d823ad4d6f 100644 --- a/Marlin/src/lcd/language/language_zh_TW.h +++ b/Marlin/src/lcd/language/language_zh_TW.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Traditional Chinese @@ -27,10 +28,6 @@ * See also http://marlinfw.org/docs/development/lcd_language.html * */ -#ifndef LANGUAGE_ZH_TW_H -#define LANGUAGE_ZH_TW_H - -//#define TALL_FONT_CORRECTION (1) #define CHARSIZE 3 @@ -57,12 +54,12 @@ #define MSG_SET_HOME_OFFSETS _UxGT("設置原點偏移") //"Set home offsets" #define MSG_HOME_OFFSETS_APPLIED _UxGT("偏移已啟用") //"Offsets applied" #define MSG_SET_ORIGIN _UxGT("設置原點") //"Set origin" -#define MSG_PREHEAT_1 _UxGT("預熱PLA") //"Preheat PLA" +#define MSG_PREHEAT_1 _UxGT("預熱" PREHEAT_1_LABEL) //"Preheat PREHEAT_1_LABEL" #define MSG_PREHEAT_1_N MSG_PREHEAT_1 _UxGT(" ") //MSG_PREHEAT_1 " " #define MSG_PREHEAT_1_ALL MSG_PREHEAT_1 _UxGT(" 全部") //MSG_PREHEAT_1 " All" #define MSG_PREHEAT_1_BEDONLY MSG_PREHEAT_1 _UxGT(" 熱床") //MSG_PREHEAT_1 " Bed" #define MSG_PREHEAT_1_SETTINGS MSG_PREHEAT_1 _UxGT(" 設置") //MSG_PREHEAT_1 " conf" -#define MSG_PREHEAT_2 _UxGT("預熱ABS") //"Preheat ABS" +#define MSG_PREHEAT_2 _UxGT("預熱" PREHEAT_2_LABEL) //"Preheat PREHEAT_2_LABEL" #define MSG_PREHEAT_2_N MSG_PREHEAT_2 _UxGT(" ") //MSG_PREHEAT_2 " " #define MSG_PREHEAT_2_ALL MSG_PREHEAT_2 _UxGT(" 全部") //MSG_PREHEAT_2 " All" #define MSG_PREHEAT_2_BEDONLY MSG_PREHEAT_2 _UxGT(" 熱床") //MSG_PREHEAT_2 " Bed" @@ -93,22 +90,22 @@ #define MSG_UBL_MOVING_TO_NEXT _UxGT("移動到下一個") // "Moving to next" #define MSG_UBL_ACTIVATE_MESH _UxGT("激活UBL") // "Activate UBL" #define MSG_UBL_DEACTIVATE_MESH _UxGT("關閉UBL") // "Deactivate UBL" -#define MSG_UBL_SET_BED_TEMP _UxGT("設置熱床溫度") // "Bed Temp" -#define MSG_UBL_SET_HOTEND_TEMP _UxGT("熱端溫度") // "Hotend Temp" +#define MSG_UBL_SET_TEMP_BED _UxGT("設置熱床溫度") // "Bed Temp" +#define MSG_UBL_SET_TEMP_HOTEND _UxGT("熱端溫度") // "Hotend Temp" #define MSG_UBL_MESH_EDIT _UxGT("網格編輯") // "Mesh Edit" #define MSG_UBL_EDIT_CUSTOM_MESH _UxGT("編輯客戶網格") // "Edit Custom Mesh" #define MSG_UBL_FINE_TUNE_MESH _UxGT("細調網格") // "Fine Tuning Mesh" #define MSG_UBL_DONE_EDITING_MESH _UxGT("完成編輯網格") // "Done Editing Mesh" #define MSG_UBL_BUILD_CUSTOM_MESH _UxGT("創設客戶網格") // "Build Custom Mesh" #define MSG_UBL_BUILD_MESH_MENU _UxGT("創設網格") // "Build Mesh" -#define MSG_UBL_BUILD_PLA_MESH _UxGT("創設PLA網格") // "Build PLA Mesh" -#define MSG_UBL_BUILD_ABS_MESH _UxGT("創設ABS網格") // "Build ABS Mesh" +#define MSG_UBL_BUILD_MESH_M1 _UxGT("創設" PREHEAT_1_LABEL "網格") // "Build PREHEAT_1_LABEL Mesh" +#define MSG_UBL_BUILD_MESH_M2 _UxGT("創設" PREHEAT_2_LABEL "網格") // "Build PREHEAT_2_LABEL Mesh" #define MSG_UBL_BUILD_COLD_MESH _UxGT("創設冷網格") // "Build Cold Mesh" #define MSG_UBL_MESH_HEIGHT_ADJUST _UxGT("調整網格高度") // "Adjust Mesh Height" #define MSG_UBL_MESH_HEIGHT_AMOUNT _UxGT("高度合計") // "Height Amount" #define MSG_UBL_VALIDATE_MESH_MENU _UxGT("批准網格") // "Validate Mesh" -#define MSG_UBL_VALIDATE_PLA_MESH _UxGT("批准PLA網格") // "Validate PLA Mesh" -#define MSG_UBL_VALIDATE_ABS_MESH _UxGT("批准ABS網格") // "Validate ABS Mesh" +#define MSG_UBL_VALIDATE_MESH_M1 _UxGT("批准" PREHEAT_1_LABEL "網格") // "Validate PREHEAT_1_LABEL Mesh" +#define MSG_UBL_VALIDATE_MESH_M2 _UxGT("批准" PREHEAT_2_LABEL "網格") // "Validate PREHEAT_2_LABEL Mesh" #define MSG_UBL_VALIDATE_CUSTOM_MESH _UxGT("批准客戶網格") // "Validate Custom Mesh" #define MSG_UBL_CONTINUE_MESH _UxGT("繼續熱床網格") // "Continue Bed Mesh" #define MSG_UBL_MESH_LEVELING _UxGT("網格調平") // "Mesh Leveling" @@ -122,7 +119,7 @@ #define MSG_UBL_OUTPUT_MAP_CSV _UxGT("輸出到CSV") // "Output for CSV" #define MSG_UBL_OUTPUT_MAP_BACKUP _UxGT("輸出到備份") // "Off Printer Backup" #define MSG_UBL_INFO_UBL _UxGT("輸出UBL信息") // "Output UBL Info" -#define MSG_UBL_EDIT_MESH_MENU _UxGT("編輯網格") // "Edit Mesh" +#define MSG_EDIT_MESH _UxGT("編輯網格") // "Edit Mesh" #define MSG_UBL_FILLIN_AMOUNT _UxGT("填充合計") // "Fill-in Amount" #define MSG_UBL_MANUAL_FILLIN _UxGT("手工填充") // "Manual Fill-in" #define MSG_UBL_SMART_FILLIN _UxGT("聰明填充") // "Smart Fill-in" @@ -183,8 +180,8 @@ #define MSG_MAX _UxGT(" ") LCD_STR_THERMOMETER _UxGT(" 最大") //" " LCD_STR_THERMOMETER " Max" #define MSG_FACTOR _UxGT(" ") LCD_STR_THERMOMETER _UxGT(" 系數") //" " LCD_STR_THERMOMETER " Fact" #define MSG_AUTOTEMP _UxGT("自動控溫") //"Autotemp" -#define MSG_ON _UxGT("開 ") //"On " -#define MSG_OFF _UxGT("關 ") //"Off" +#define MSG_LCD_ON _UxGT("開") //"On" +#define MSG_LCD_OFF _UxGT("關") //"Off" #define MSG_PID_P _UxGT("PID-P") //"PID-P" #define MSG_PID_I _UxGT("PID-I") //"PID-I" #define MSG_PID_D _UxGT("PID-D") //"PID-D" @@ -229,7 +226,7 @@ #define MSG_E6STEPS _UxGT("擠出機6步數/mm") //"E6steps/mm" #define MSG_TEMPERATURE _UxGT("溫度") //"Temperature" #define MSG_MOTION _UxGT("運作") //"Motion" -#define MSG_FILAMENT _UxGT("絲料測容") //"Filament" lcd_control_volumetric_menu +#define MSG_FILAMENT _UxGT("絲料測容") //"Filament" menu_control_volumetric #define MSG_VOLUMETRIC_ENABLED _UxGT("測容積mm³") //"E in mm3" volumetric_enabled #define MSG_FILAMENT_DIAM _UxGT("絲料直徑") //"Fil. Dia." #define MSG_FILAMENT_UNLOAD _UxGT("卸載 mm") // "Unload mm" @@ -259,7 +256,7 @@ #define MSG_CONTROL_RETRACT _UxGT("回縮長度mm") //"Retract mm" retract_length, retract length (positive mm) #define MSG_CONTROL_RETRACT_SWAP _UxGT("換手回抽長度mm") //"Swap Re.mm" swap_retract_length, swap retract length (positive mm), for extruder change #define MSG_CONTROL_RETRACTF _UxGT("回縮速率mm/s") //"Retract V" retract_feedrate_mm_s, feedrate for retracting (mm/s) -#define MSG_CONTROL_RETRACT_ZLIFT _UxGT("Hop mm") //"Hop mm" retract_zlift, retract Z-lift +#define MSG_CONTROL_RETRACT_ZHOP _UxGT("Hop mm") //"Hop mm" retract_zraise, retract Z-lift #define MSG_CONTROL_RETRACT_RECOVER _UxGT("回縮恢復長度mm") //"UnRet +mm" retract_recover_length, additional recover length (mm, added to retract length when recovering) #define MSG_CONTROL_RETRACT_RECOVER_SWAP _UxGT("換手回縮恢復長度mm") //"S UnRet+mm" swap_retract_recover_length, additional swap recover length (mm, added to retract length when recovering from extruder change) #define MSG_CONTROL_RETRACT_RECOVERF _UxGT("回縮恢復後進料速率mm/s") //"UnRet V" retract_recover_feedrate_mm_s, feedrate for recovering from retraction (mm/s) @@ -270,7 +267,7 @@ #define MSG_FILAMENTUNLOAD _UxGT("卸載絲料") // "Unload filament" #define MSG_FILAMENTUNLOAD_ALL _UxGT("卸載全部") // "Unload All" #define MSG_INIT_SDCARD _UxGT("初始化記憶卡") //"Init. SD card" -#define MSG_CNG_SDCARD _UxGT("更換記憶卡") //"Change SD card" +#define MSG_CHANGE_SDCARD _UxGT("更換記憶卡") //"Change SD card" #define MSG_ZPROBE_OUT _UxGT("Z探針在熱床之外") //"Z probe out. bed" Z probe is not within the physical limits #define MSG_SKEW_FACTOR _UxGT("偏斜因數") // "Skew Factor" #define MSG_BLTOUCH _UxGT("BLTouch") // "BLTouch" @@ -327,7 +324,7 @@ #define MSG_CASE_LIGHT _UxGT("外殼燈") // "Case light" #define MSG_CASE_LIGHT_BRIGHTNESS _UxGT("燈亮度") // "Light BRIGHTNESS" -#if LCD_WIDTH > 19 +#if LCD_WIDTH >= 20 #define MSG_INFO_PRINT_COUNT _UxGT("列印計數") //"Print Count" #define MSG_INFO_COMPLETED_PRINTS _UxGT("已完成") //"Completed" #define MSG_INFO_PRINT_TIME _UxGT("總列印時間") //"Total print time" @@ -386,5 +383,3 @@ #define MSG_FILAMENT_CHANGE_PURGE_1 _UxGT("清除中 ...") // "Purging..." #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("恢復中 ...") //"Resuming..." #endif // LCD_HEIGHT < 4 - -#endif // LANGUAGE_ZH_TW_H diff --git a/Marlin/src/lcd/lcdprint.h b/Marlin/src/lcd/lcdprint.h index c266401652..59cd546855 100644 --- a/Marlin/src/lcd/lcdprint.h +++ b/Marlin/src/lcd/lcdprint.h @@ -6,15 +6,16 @@ * @date 2016-08-19 * @copyright GPL/BSD */ -#ifndef _LCDPRINT_H -#define _LCDPRINT_H +#pragma once #include "fontutils.h" -#if DISABLED(DOGLCD) - #define _UxGT(a) a +#include "../inc/MarlinConfigPre.h" + +#if HAS_GRAPHICAL_LCD + #include "dogm/u8g_fontutf8.h" #else - #include "u8g_fontutf8.h" + #define _UxGT(a) a #endif #define START_OF_UTF8_CHAR(C) (((C) & 0xC0u) != 0x80u) @@ -45,14 +46,14 @@ int lcd_put_u8str_max(const char * utf8_str, pixel_len_t max_length); * * Draw a ROM UTF-8 string */ -int lcd_put_u8str_max_P(const char * utf8_str_P, pixel_len_t max_length); +int lcd_put_u8str_max_P(PGM_P utf8_str_P, pixel_len_t max_length); -void lcd_moveto(int col, int row); +void lcd_moveto(const uint8_t col, const uint8_t row); -inline int lcd_put_u8str_P(const char *str) { return lcd_put_u8str_max_P(str, PIXEL_LEN_NOLIMIT); } +void lcd_put_int(const int i); + +inline int lcd_put_u8str_P(PGM_P str) { return lcd_put_u8str_max_P(str, PIXEL_LEN_NOLIMIT); } inline int lcd_put_u8str(const char* str) { return lcd_put_u8str_max(str, PIXEL_LEN_NOLIMIT); } -inline int lcd_put_wchar(wchar_t c) { return lcd_put_wchar_max(c, PIXEL_LEN_NOLIMIT); } - -#endif // _LCDPRINT_H +inline int lcd_put_wchar(const wchar_t c) { return lcd_put_wchar_max(c, PIXEL_LEN_NOLIMIT); } diff --git a/Marlin/src/lcd/lcdprint_u8g.cpp b/Marlin/src/lcd/lcdprint_u8g.cpp deleted file mode 100644 index 39ac8acc30..0000000000 --- a/Marlin/src/lcd/lcdprint_u8g.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/** - * @file lcdprint_u8g.c - * @brief LCD print api for u8glib - * @author Yunhui Fu (yhfudev@gmail.com) - * @version 1.0 - * @date 2016-08-19 - * @copyright GPL/BSD - */ - -#include "../inc/MarlinConfigPre.h" - -#if ENABLED(DOGLCD) - -#include -extern U8GLIB *pu8g; -#define _lcd_write(a) pu8g->print(a) -#define _lcd_setcursor(col, row) pu8g->setPrintPos((col), (row)); - -#include "ultralcd.h" -#include "../Marlin.h" - -#include "fontutils.h" -#include "u8g_fontutf8.h" -#include "lcdprint.h" - -int lcd_glyph_height(void) { - return u8g_GetFontBBXHeight(pu8g->getU8g()); -} - -void lcd_moveto(int col, int row) { - _lcd_setcursor(col, row); -} - -// return < 0 on error -// return the advanced pixels -int lcd_put_wchar_max(wchar_t c, pixel_len_t max_length) { - if (c < 256) { - _lcd_write((char)c); - return u8g_GetFontBBXWidth(pu8g->getU8g()); - } - unsigned int x = pu8g->getPrintCol(), - y = pu8g->getPrintRow(), - ret = uxg_DrawWchar(pu8g->getU8g(), x, y, c, max_length); - pu8g->setPrintPos(x + ret, y); - - return ret; -} - -int lcd_put_u8str_max(const char * utf8_str, pixel_len_t max_length) { - unsigned int x = pu8g->getPrintCol(), - y = pu8g->getPrintRow(), - ret = uxg_DrawUtf8Str(pu8g->getU8g(), x, y, utf8_str, max_length); - pu8g->setPrintPos(x + ret, y); - return ret; -} - -int lcd_put_u8str_max_P(const char * utf8_str_P, pixel_len_t max_length) { - unsigned int x = pu8g->getPrintCol(), - y = pu8g->getPrintRow(), - ret = uxg_DrawUtf8StrP(pu8g->getU8g(), x, y, utf8_str_P, max_length); - pu8g->setPrintPos(x + ret, y); - return ret; -} - -#endif // DOGLCD diff --git a/Marlin/src/lcd/malyanlcd.cpp b/Marlin/src/lcd/malyanlcd.cpp index d02a330244..0df6a8937a 100644 --- a/Marlin/src/lcd/malyanlcd.cpp +++ b/Marlin/src/lcd/malyanlcd.cpp @@ -45,6 +45,7 @@ #if ENABLED(MALYAN_LCD) +#include "ultralcd.h" #include "../module/temperature.h" #include "../module/planner.h" #include "../module/stepper.h" @@ -81,7 +82,7 @@ int inbound_count; bool last_printing_status = false; // Everything written needs the high bit set. -void write_to_lcd_P(const char * const message) { +void write_to_lcd_P(PGM_P const message) { char encoded_message[MAX_CURLY_COMMAND]; uint8_t message_length = MIN(strlen_P(message), sizeof(encoded_message)); @@ -254,9 +255,7 @@ void process_lcd_p_command(const char* command) { quickstop_stepper(); print_job_timer.stop(); thermalManager.disable_all_heaters(); - #if FAN_COUNT > 0 - for (uint8_t i = 0; i < FAN_COUNT; i++) fanSpeeds[i] = 0; - #endif + zero_fan_speeds(); wait_for_heatup = false; write_to_lcd_P(PSTR("{SYS:STARTED}")); #endif @@ -279,7 +278,7 @@ void process_lcd_p_command(const char* command) { // There may be a difference in how V1 and V2 LCDs handle subdirectory // prints. Investigate more. This matches the V1 motion controller actions // but the V2 LCD switches to "print" mode on {SYS:DIR} response. - if (card.filenameIsDir) { + if (card.flag.filenameIsDir) { card.chdir(card.filename); write_to_lcd_P(PSTR("{SYS:DIR}")); } @@ -331,7 +330,7 @@ void process_lcd_s_command(const char* command) { case 'L': { #if ENABLED(SDSUPPORT) - if (!card.cardOK) card.initsd(); + if (!card.flag.cardOK) card.initsd(); // A more efficient way to do this would be to // implement a callback in the ls_SerialPrint code, but @@ -343,7 +342,7 @@ void process_lcd_s_command(const char* command) { uint16_t file_count = card.get_num_Files(); for (uint16_t i = 0; i < file_count; i++) { card.getfilename(i); - sprintf_P(message_buffer, card.filenameIsDir ? PSTR("{DIR:%s}") : PSTR("{FILE:%s}"), card.longest_filename()); + sprintf_P(message_buffer, card.flag.filenameIsDir ? PSTR("{DIR:%s}") : PSTR("{FILE:%s}"), card.longest_filename()); write_to_lcd(message_buffer); } @@ -419,7 +418,7 @@ void update_usb_status(const bool forceUpdate) { * The optimize attribute fixes a register Compile * error for amtel. */ -void lcd_update() { +void MarlinUI::update() { static char inbound_buffer[MAX_CURLY_COMMAND]; // First report USB status. @@ -446,13 +445,13 @@ void lcd_update() { // If there was a print in progress, we need to emit the final // print status as {TQ:100}. Reset last percent done so a new print will // issue a percent of 0. - const uint8_t percent_done = card.sdprinting ? card.percentDone() : last_printing_status ? 100 : 0; + const uint8_t percent_done = IS_SD_PRINTING() ? card.percentDone() : last_printing_status ? 100 : 0; if (percent_done != last_percent_done) { char message_buffer[10]; sprintf_P(message_buffer, PSTR("{TQ:%03i}"), percent_done); write_to_lcd(message_buffer); last_percent_done = percent_done; - last_printing_status = card.sdprinting; + last_printing_status = IS_SD_PRINTING(); } #endif } @@ -463,7 +462,7 @@ void lcd_update() { * it and translate into gcode, which then gets injected into * the command queue where possible. */ -void lcd_init() { +void MarlinUI::init() { inbound_count = 0; LCD_SERIAL.begin(500000); @@ -481,10 +480,10 @@ void lcd_init() { /** * Set an alert. */ -void lcd_setalertstatusPGM(const char* message) { - char message_buffer[MAX_CURLY_COMMAND]; - sprintf_P(message_buffer, PSTR("{E:%s}"), message); - write_to_lcd(message_buffer); +void MarlinUI::set_alert_status_P(PGM_P const message) { + write_to_lcd_P(PSTR("{E:")); + write_to_lcd_P(message); + write_to_lcd_P("}"); } #endif // MALYAN_LCD diff --git a/Marlin/src/lcd/menu/menu.cpp b/Marlin/src/lcd/menu/menu.cpp new file mode 100644 index 0000000000..8046a5d811 --- /dev/null +++ b/Marlin/src/lcd/menu/menu.cpp @@ -0,0 +1,454 @@ +/** + * 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 "../../inc/MarlinConfigPre.h" + +#if HAS_LCD_MENU + +#include "menu.h" +#include "../ultralcd.h" +#include "../../module/planner.h" +#include "../../module/motion.h" +#include "../../gcode/queue.h" +#include "../../sd/cardreader.h" +#include "../../libs/buzzer.h" + +#if ENABLED(EEPROM_SETTINGS) + #include "../../module/configuration_store.h" +#endif + +#if WATCH_HOTENDS || WATCH_THE_BED || ENABLED(BABYSTEP_ZPROBE_OFFSET) + #include "../../module/temperature.h" +#endif + +#if ENABLED(BABYSTEP_ZPROBE_OFFSET) + #include "../../module/probe.h" +#endif + +#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) || ENABLED(AUTO_BED_LEVELING_UBL) + #include "../../feature/bedlevel/bedlevel.h" +#endif + +//////////////////////////////////////////// +///////////// Global Variables ///////////// +//////////////////////////////////////////// + +// Menu Navigation +int8_t encoderTopLine; +typedef struct { + screenFunc_t menu_function; + uint32_t encoder_position; +} 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; + +// Prevent recursion into screen handlers +bool no_reentry = false; + +//////////////////////////////////////////// +//////// Menu Navigation & History ///////// +//////////////////////////////////////////// + +void MarlinUI::return_to_status() { goto_screen(status_screen); } + +void MarlinUI::save_previous_screen() { + if (screen_history_depth < COUNT(screen_history)) { + screen_history[screen_history_depth].menu_function = currentScreen; + screen_history[screen_history_depth].encoder_position = encoderPosition; + ++screen_history_depth; + } +} + +void MarlinUI::goto_previous_screen() { + if (screen_history_depth > 0) { + --screen_history_depth; + goto_screen( + screen_history[screen_history_depth].menu_function, + screen_history[screen_history_depth].encoder_position + ); + } + else + return_to_status(); +} + +//////////////////////////////////////////// +/////////// Common Menu Actions //////////// +//////////////////////////////////////////// + +void MenuItem_gcode::action(PGM_P pgcode) { enqueue_and_echo_commands_P(pgcode); } + +//////////////////////////////////////////// +/////////// Menu Editing Actions /////////// +//////////////////////////////////////////// + +/** + * Functions for editing single values + * + * The "DEFINE_MENU_EDIT_ITEM" macro generates the functions needed to edit a numerical value. + * + * The prerequisite is that in the header the type was already declared: + * + * DECLARE_MENU_EDIT_TYPE(int16_t, int3, itostr3, 1) + * + * For example, DEFINE_MENU_EDIT_ITEM(int3) expands into these functions: + * + * bool MenuItem_int3::_edit(); + * void MenuItem_int3::edit(); // edit int16_t (interactively) + * void MenuItem_int3::action_edit(PGM_P const pstr, int16_t * const ptr, const int16_t minValue, const int16_t maxValue, const screenFunc_t callback = null, const bool live = false); + * + * You can then use one of the menu macros to present the edit interface: + * MENU_ITEM_EDIT(int3, MSG_SPEED, &feedrate_percentage, 10, 999) + * + * This expands into a more primitive menu item: + * MENU_ITEM_VARIANT(int3, _edit, MSG_SPEED, PSTR(MSG_SPEED), &feedrate_percentage, 10, 999) + * + * ...which calls: + * MenuItem_int3::action_edit(PSTR(MSG_SPEED), &feedrate_percentage, 10, 999) + */ +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 (ui.should_draw()) + draw_edit_screen(editLabel, strfunc(ui.encoderPosition + minEditValue)); + if (ui.lcd_clicked || (liveEdit && ui.should_draw())) { + if (editValue != NULL) loadfunc(editValue, ui.encoderPosition + minEditValue); + if (callbackFunc && (liveEdit || ui.lcd_clicked)) (*callbackFunc)(); + if (ui.use_click()) ui.goto_previous_screen(); + } +} + +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) { + ui.save_previous_screen(); + ui.refresh(); + editLabel = el; + editValue = ev; + minEditValue = minv; + maxEditValue = maxv; + ui.encoderPosition = ep; + ui.currentScreen = cs; + callbackFunc = cb; + liveEdit = le; +} + +#define DEFINE_MENU_EDIT_ITEM(NAME) template class TMenuItem; + +DEFINE_MENU_EDIT_ITEM(int3); +DEFINE_MENU_EDIT_ITEM(int4); +DEFINE_MENU_EDIT_ITEM(int8); +DEFINE_MENU_EDIT_ITEM(float3); +DEFINE_MENU_EDIT_ITEM(float52); +DEFINE_MENU_EDIT_ITEM(float43); +DEFINE_MENU_EDIT_ITEM(float5); +DEFINE_MENU_EDIT_ITEM(float51); +DEFINE_MENU_EDIT_ITEM(float52sign); +DEFINE_MENU_EDIT_ITEM(float62); +DEFINE_MENU_EDIT_ITEM(long5); + +void MenuItem_bool::action_edit(PGM_P pstr, bool *ptr, screenFunc_t callback) { + UNUSED(pstr); *ptr ^= true; ui.refresh(); + if (callback) (*callback)(); +} + +//////////////////////////////////////////// +///////////////// Menu Tree //////////////// +//////////////////////////////////////////// + +#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) + float lcd_z_fade_height; + void _lcd_set_z_fade_height() { set_z_fade_height(lcd_z_fade_height); } +#endif + +bool printer_busy() { return planner.movesplanned() || IS_SD_PRINTING(); } + +/** + * General function to go directly to a screen + */ +void MarlinUI::goto_screen(screenFunc_t screen, const uint32_t encoder/*=0*/) { + if (currentScreen != screen) { + + #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) + // Shadow for editing the fade height + lcd_z_fade_height = planner.z_fade_height; + #endif + + #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) && ENABLED(BABYSTEPPING) + static millis_t doubleclick_expire_ms = 0; + // Going to menu_main from status screen? Remember first click time. + // Going back to status screen within a very short time? Go to Z babystepping. + if (screen == menu_main) { + if (on_status_screen()) + doubleclick_expire_ms = millis() + DOUBLECLICK_MAX_INTERVAL; + } + else if (screen == status_screen && currentScreen == menu_main && PENDING(millis(), doubleclick_expire_ms)) { + if (printer_busy()) { + screen = + #if ENABLED(BABYSTEP_ZPROBE_OFFSET) + lcd_babystep_zoffset + #else + lcd_babystep_z + #endif + ; + } + #if ENABLED(MOVE_Z_WHEN_IDLE) + else { + move_menu_scale = MOVE_Z_IDLE_MULTIPLICATOR; + screen = lcd_move_z; + } + #endif + } + #endif + + currentScreen = screen; + encoderPosition = encoder; + if (screen == status_screen) { + ui.defer_status_screen(false); + #if ENABLED(AUTO_BED_LEVELING_UBL) + ubl.lcd_map_control = false; + #endif + screen_history_depth = 0; + } + + clear_lcd(); + + // Re-initialize custom characters that may be re-used + #if HAS_CHARACTER_LCD + #if ENABLED(AUTO_BED_LEVELING_UBL) + if (!ubl.lcd_map_control) + #endif + set_custom_characters(screen == status_screen ? CHARSET_INFO : CHARSET_MENU); + #endif + + refresh(LCDVIEW_CALL_REDRAW_NEXT); + screen_changed = true; + #if HAS_GRAPHICAL_LCD + drawing_screen = false; + #endif + } +} + +//////////////////////////////////////////// +///////////// Manual Movement ////////////// +//////////////////////////////////////////// + +// +// Display the synchronize screen until moves are +// finished, and don't return to the caller until +// done. ** This blocks the command queue! ** +// +static PGM_P sync_message; + +void MarlinUI::_synchronize() { + if (should_draw()) draw_menu_item_static(LCD_HEIGHT >= 4 ? 1 : 0, sync_message); + if (no_reentry) return; + // Make this the current handler till all moves are done + no_reentry = true; + const screenFunc_t old_screen = currentScreen; + goto_screen(_synchronize); + planner.synchronize(); // idle() is called until moves complete + no_reentry = false; + goto_screen(old_screen); +} + +// Display the synchronize screen with a custom message +// ** This blocks the command queue! ** +void MarlinUI::synchronize(PGM_P const msg/*=NULL*/) { + static const char moving[] PROGMEM = MSG_MOVING; + sync_message = msg ? msg : moving; + _synchronize(); +} + +/** + * Scrolling for menus and other line-based screens + * + * encoderLine is the position based on the encoder + * encoderTopLine is the top menu line to display + * _lcdLineNr is the index of the LCD line (e.g., 0-3) + * _menuLineNr is the menu item to draw and process + * _thisItemNr is the index of each MENU_ITEM or STATIC_ITEM + * screen_items is the total number of items in the menu (after one call) + */ +int8_t encoderLine, screen_items; +void scroll_screen(const uint8_t limit, const bool is_menu) { + ui.encoder_direction_menus(); + ENCODER_RATE_MULTIPLY(false); + if (ui.encoderPosition > 0x8000) ui.encoderPosition = 0; + if (ui.first_page) { + encoderLine = ui.encoderPosition / (ENCODER_STEPS_PER_MENU_ITEM); + screen_changed = false; + } + if (screen_items > 0 && encoderLine >= screen_items - limit) { + encoderLine = MAX(0, screen_items - limit); + ui.encoderPosition = encoderLine * (ENCODER_STEPS_PER_MENU_ITEM); + } + if (is_menu) { + NOMORE(encoderTopLine, encoderLine); + if (encoderLine >= encoderTopLine + LCD_HEIGHT) + encoderTopLine = encoderLine - LCD_HEIGHT + 1; + } + else + encoderTopLine = encoderLine; +} + +void MarlinUI::completion_feedback(const bool good/*=true*/) { + if (good) { + BUZZ(100, 659); + BUZZ(100, 698); + } + else BUZZ(20, 440); +} + +#if HAS_LINE_TO_Z + + void line_to_z(const float &z) { + current_position[Z_AXIS] = z; + planner.buffer_line(current_position, MMM_TO_MMS(manual_feedrate_mm_m[Z_AXIS]), active_extruder); + } + +#endif + +#if ENABLED(BABYSTEP_ZPROBE_OFFSET) + + void lcd_babystep_zoffset() { + if (ui.use_click()) return ui.goto_previous_screen_no_defer(); + ui.defer_status_screen(true); + #if ENABLED(BABYSTEP_HOTEND_Z_OFFSET) + const bool do_probe = (active_extruder == 0); + #else + constexpr bool do_probe = true; + #endif + ui.encoder_direction_normal(); + if (ui.encoderPosition) { + const int16_t babystep_increment = (int32_t)ui.encoderPosition * (BABYSTEP_MULTIPLICATOR); + ui.encoderPosition = 0; + + const float diff = planner.steps_to_mm[Z_AXIS] * babystep_increment, + new_probe_offset = zprobe_zoffset + diff, + new_offs = + #if ENABLED(BABYSTEP_HOTEND_Z_OFFSET) + do_probe ? new_probe_offset : hotend_offset[Z_AXIS][active_extruder] - diff + #else + new_probe_offset + #endif + ; + if (WITHIN(new_offs, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) { + + thermalManager.babystep_axis(Z_AXIS, babystep_increment); + + if (do_probe) zprobe_zoffset = new_offs; + #if ENABLED(BABYSTEP_HOTEND_Z_OFFSET) + else hotend_offset[Z_AXIS][active_extruder] = new_offs; + #endif + + ui.refresh(LCDVIEW_CALL_REDRAW_NEXT); + } + } + 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])); + else + #endif + draw_edit_screen(PSTR(MSG_ZPROBE_ZOFFSET), ftostr43sign(zprobe_zoffset)); + + #if ENABLED(BABYSTEP_ZPROBE_GFX_OVERLAY) + if (do_probe) _lcd_zoffset_overlay_gfx(zprobe_zoffset); + #endif + } + } + +#endif // BABYSTEP_ZPROBE_OFFSET + +/** + * Watch temperature callbacks + */ +#if HAS_TEMP_HOTEND + #if WATCH_HOTENDS + #define _WATCH_FUNC(N) thermalManager.start_watching_heater(N) + #else + #define _WATCH_FUNC(N) NOOP + #endif + void watch_temp_callback_E0() { _WATCH_FUNC(0); } + #if HOTENDS > 1 + void watch_temp_callback_E1() { _WATCH_FUNC(1); } + #if HOTENDS > 2 + void watch_temp_callback_E2() { _WATCH_FUNC(2); } + #if HOTENDS > 3 + void watch_temp_callback_E3() { _WATCH_FUNC(3); } + #if HOTENDS > 4 + void watch_temp_callback_E4() { _WATCH_FUNC(4); } + #if HOTENDS > 5 + void watch_temp_callback_E5() { _WATCH_FUNC(5); } + #endif // HOTENDS > 5 + #endif // HOTENDS > 4 + #endif // HOTENDS > 3 + #endif // HOTENDS > 2 + #endif // HOTENDS > 1 +#endif // HAS_TEMP_HOTEND + +void watch_temp_callback_bed() { + #if WATCH_THE_BED + thermalManager.start_watching_bed(); + #endif +} + +#if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(PID_AUTOTUNE_MENU) || ENABLED(ADVANCED_PAUSE_FEATURE) + + void lcd_enqueue_command(const char * const cmd) { + no_reentry = true; + enqueue_and_echo_command_now(cmd); + no_reentry = false; + } + + void lcd_enqueue_commands_P(PGM_P const cmd) { + no_reentry = true; + enqueue_and_echo_commands_now_P(cmd); + no_reentry = false; + } + +#endif + +#if ENABLED(EEPROM_SETTINGS) + void lcd_store_settings() { ui.completion_feedback(settings.save()); } + void lcd_load_settings() { ui.completion_feedback(settings.load()); } +#endif + +void _lcd_draw_homing() { + constexpr uint8_t line = (LCD_HEIGHT - 1) / 2; + if (ui.should_draw()) draw_menu_item_static(line, PSTR(MSG_LEVEL_BED_HOMING)); + ui.refresh(LCDVIEW_CALL_NO_REDRAW); +} + +#if ENABLED(LCD_BED_LEVELING) || (HAS_LEVELING && DISABLED(SLIM_LCD_MENUS)) + #include "../../feature/bedlevel/bedlevel.h" + void _lcd_toggle_bed_leveling() { set_bed_leveling_enabled(!planner.leveling_active); } +#endif + +#endif // HAS_LCD_MENU diff --git a/Marlin/src/lcd/menu/menu.h b/Marlin/src/lcd/menu/menu.h new file mode 100644 index 0000000000..7044bd22ca --- /dev/null +++ b/Marlin/src/lcd/menu/menu.h @@ -0,0 +1,381 @@ +/** + * 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 . + * + */ +#pragma once + +#include "../ultralcd.h" +#include "../../inc/MarlinConfig.h" + +extern int8_t encoderLine, encoderTopLine, screen_items; +extern bool screen_changed; + +constexpr int16_t heater_maxtemp[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP, HEATER_4_MAXTEMP); + +void scroll_screen(const uint8_t limit, const bool is_menu); +bool printer_busy(); + +//////////////////////////////////////////// +////////// Menu Item Numeric Types ///////// +//////////////////////////////////////////// + +#define DECLARE_MENU_EDIT_TYPE(TYPE, NAME, STRFUNC, SCALE) \ + struct MenuItemInfo_##NAME { \ + typedef TYPE type_t; \ + static constexpr float scale = SCALE; \ + static inline char* strfunc(const float value) { return STRFUNC((TYPE) value); } \ + }; + +DECLARE_MENU_EDIT_TYPE(int16_t, int3, itostr3, 1 ); +DECLARE_MENU_EDIT_TYPE(int16_t, int4, itostr4sign, 1 ); +DECLARE_MENU_EDIT_TYPE(uint8_t, int8, i8tostr3, 1 ); +DECLARE_MENU_EDIT_TYPE(float, float3, ftostr3, 1 ); +DECLARE_MENU_EDIT_TYPE(float, float52, ftostr52, 100 ); +DECLARE_MENU_EDIT_TYPE(float, float43, ftostr43sign, 1000 ); +DECLARE_MENU_EDIT_TYPE(float, float5, ftostr5rj, 0.01f ); +DECLARE_MENU_EDIT_TYPE(float, float51, ftostr51sign, 10 ); +DECLARE_MENU_EDIT_TYPE(float, float52sign, ftostr52sign, 100 ); +DECLARE_MENU_EDIT_TYPE(float, float62, ftostr62rj, 100 ); +DECLARE_MENU_EDIT_TYPE(uint32_t, long5, ftostr5rj, 0.01f ); + +//////////////////////////////////////////// +///////// Menu Item Draw Functions ///////// +//////////////////////////////////////////// + +void draw_edit_screen(PGM_P const pstr, const char* const value=NULL); +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); +FORCE_INLINE void draw_menu_item_back(const bool sel, const uint8_t row, PGM_P const pstr) { draw_menu_item(sel, row, pstr, LCD_STR_UPLEVEL[0], LCD_STR_UPLEVEL[0]); } +FORCE_INLINE void draw_menu_item_edit(const bool sel, const uint8_t row, PGM_P const pstr, const char* const data) { _draw_menu_item_edit(sel, row, pstr, data, false); } +FORCE_INLINE void draw_menu_item_edit_P(const bool sel, const uint8_t row, PGM_P const pstr, const char* const data) { _draw_menu_item_edit(sel, row, pstr, data, true); } +#define draw_menu_item_submenu(sel, row, pstr, data) draw_menu_item(sel, row, pstr, '>', LCD_STR_ARROW_RIGHT[0]) +#define draw_menu_item_gcode(sel, row, pstr, gcode) draw_menu_item(sel, row, pstr, '>', ' ') +#define draw_menu_item_function(sel, row, pstr, data) draw_menu_item(sel, row, pstr, '>', ' ') +#define DRAW_MENU_ITEM_SETTING_EDIT_GENERIC(VAL) draw_menu_item_edit(sel, row, pstr, VAL) +#define DRAW_BOOL_SETTING(sel, row, pstr, data) draw_menu_item_edit_P(sel, row, pstr, (*(data))?PSTR(MSG_LCD_ON):PSTR(MSG_LCD_OFF)) + +#if ENABLED(SDSUPPORT) + class CardReader; + void draw_sd_menu_item(const bool sel, const uint8_t row, PGM_P const pstr, CardReader &theCard, const bool isDir); + FORCE_INLINE void draw_menu_item_sdfile(const bool sel, const uint8_t row, PGM_P const pstr, CardReader &theCard) { draw_sd_menu_item(sel, row, pstr, theCard, false); } + FORCE_INLINE void draw_menu_item_sdfolder(const bool sel, const uint8_t row, PGM_P const pstr, CardReader &theCard) { draw_sd_menu_item(sel, row, pstr, theCard, true); } +#endif + +#if HAS_GRAPHICAL_LCD && (ENABLED(BABYSTEP_ZPROBE_GFX_OVERLAY) || ENABLED(MESH_EDIT_GFX_OVERLAY)) + void _lcd_zoffset_overlay_gfx(const float zvalue); +#endif + +//////////////////////////////////////////// +/////// Edit Setting Draw Functions //////// +//////////////////////////////////////////// + +#define _DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(TYPE, NAME, STRFUNC) \ + FORCE_INLINE void draw_menu_item_edit_##NAME (const bool sel, const uint8_t row, PGM_P const pstr, PGM_P const pstr2, TYPE * const data, ...) { \ + UNUSED(pstr2); \ + DRAW_MENU_ITEM_SETTING_EDIT_GENERIC(STRFUNC(*(data))); \ + } \ + FORCE_INLINE void draw_menu_item_edit_accessor_##NAME (const bool sel, const uint8_t row, PGM_P const pstr, PGM_P const pstr2, TYPE (*pget)(), void (*pset)(TYPE), ...) { \ + UNUSED(pstr2); UNUSED(pset); \ + DRAW_MENU_ITEM_SETTING_EDIT_GENERIC(STRFUNC(pget())); \ + } \ + typedef void NAME##_void +#define DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(NAME) _DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(MenuItemInfo_##NAME::type_t, NAME, MenuItemInfo_##NAME::strfunc) + +DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(int3); +DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(int4); +DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(int8); +DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float3); +DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float52); +DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float43); +DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float5); +DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float51); +DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float52sign); +DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float62); +DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(long5); + +#define draw_menu_item_edit_bool(sel, row, pstr, pstr2, data, ...) DRAW_BOOL_SETTING(sel, row, pstr, data) +#define draw_menu_item_edit_accessor_bool(sel, row, pstr, pstr2, pget, pset) DRAW_BOOL_SETTING(sel, row, pstr, data) + +//////////////////////////////////////////// +/////////////// Menu Actions /////////////// +//////////////////////////////////////////// + +class MenuItem_back { + public: + static inline void action() { ui.goto_previous_screen(); } +}; + +class MenuItem_submenu { + public: + static inline void action(const screenFunc_t func) { ui.save_previous_screen(); ui.goto_screen(func); } +}; + +class MenuItem_gcode { + public: + static void action(const char * const pgcode); +}; + +class MenuItem_function { + public: + static inline void action(const menuAction_t func) { (*func)(); }; +}; + +//////////////////////////////////////////// +/////////// Menu Editing Actions /////////// +//////////////////////////////////////////// + +class MenuItemBase { + 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); + static void edit(strfunc_t, loadfunc_t); +}; + +template +class TMenuItem : MenuItemBase { + private: + typedef typename NAME::type_t type_t; + inline static float unscale(const float value) { return value * (1.0f / NAME::scale); } + inline static 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)); } + 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); + } + static void edit() { MenuItemBase::edit(to_string, load); } +}; + +#define DECLARE_MENU_EDIT_ITEM(NAME) typedef TMenuItem MenuItem_##NAME; + +DECLARE_MENU_EDIT_ITEM(int3); +DECLARE_MENU_EDIT_ITEM(int4); +DECLARE_MENU_EDIT_ITEM(int8); +DECLARE_MENU_EDIT_ITEM(float3); +DECLARE_MENU_EDIT_ITEM(float52); +DECLARE_MENU_EDIT_ITEM(float43); +DECLARE_MENU_EDIT_ITEM(float5); +DECLARE_MENU_EDIT_ITEM(float51); +DECLARE_MENU_EDIT_ITEM(float52sign); +DECLARE_MENU_EDIT_ITEM(float62); +DECLARE_MENU_EDIT_ITEM(long5); + +class MenuItem_bool { + public: + static void action_edit(PGM_P const pstr, bool* ptr, const screenFunc_t callbackFunc=NULL); +}; + +//////////////////////////////////////////// +//////////// Menu System Macros //////////// +//////////////////////////////////////////// + +/** + * SCREEN_OR_MENU_LOOP generates init code for a screen or menu + * + * encoderTopLine is the top menu line to display + * _lcdLineNr is the index of the LCD line (e.g., 0-3) + * _menuLineNr is the menu item to draw and process + * _thisItemNr is the index of each MENU_ITEM or STATIC_ITEM + */ +#define SCREEN_OR_MENU_LOOP() \ + int8_t _menuLineNr = encoderTopLine, _thisItemNr; \ + for (int8_t _lcdLineNr = 0; _lcdLineNr < LCD_HEIGHT; _lcdLineNr++, _menuLineNr++) { \ + _thisItemNr = 0 + +/** + * START_SCREEN Opening code for a screen having only static items. + * Do simplified scrolling of the entire screen. + * + * START_MENU Opening code for a screen with menu items. + * Scroll as-needed to keep the selected line in view. + */ +#define START_SCREEN() \ + scroll_screen(LCD_HEIGHT, false); \ + bool _skipStatic = false; \ + SCREEN_OR_MENU_LOOP() + +#define START_MENU() \ + scroll_screen(1, true); \ + bool _skipStatic = true; \ + SCREEN_OR_MENU_LOOP() + +#define END_SCREEN() \ + } \ + screen_items = _thisItemNr + +#define END_MENU() \ + } \ + screen_items = _thisItemNr; \ + UNUSED(_skipStatic) + +#if ENABLED(ENCODER_RATE_MULTIPLIER) + #define ENCODER_RATE_MULTIPLY(F) (ui.encoderRateMultiplierEnabled = F) + #define _MENU_ITEM_MULTIPLIER_CHECK(USE_MULTIPLIER) do{ if (USE_MULTIPLIER) ui.enable_encoder_multiplier(true); }while(0) + //#define ENCODER_RATE_MULTIPLIER_DEBUG // If defined, output the encoder steps per second value +#else + #define ENCODER_RATE_MULTIPLY(F) NOOP + #define _MENU_ITEM_MULTIPLIER_CHECK(USE_MULTIPLIER) +#endif + +/** + * MENU_ITEM generates draw & handler code for a menu item, potentially calling: + * + * draw_menu_item_[_variant](sel, row, label, arg3...) + * MenuItem_::action[_variant](arg3...) + * + * Examples: + * MENU_ITEM(back, MSG_WATCH, 0 [dummy parameter] ) + * or + * MENU_BACK(MSG_WATCH) + * draw_menu_item_back(sel, row, PSTR(MSG_WATCH)) + * MenuItem_back::action() + * + * MENU_ITEM(function, MSG_PAUSE_PRINT, lcd_sdcard_pause) + * draw_menu_item_function(sel, row, PSTR(MSG_PAUSE_PRINT), lcd_sdcard_pause) + * MenuItem_function::action(lcd_sdcard_pause) + * + * MENU_ITEM_EDIT(int3, MSG_SPEED, &feedrate_percentage, 10, 999) + * draw_menu_item_edit_int3(sel, row, PSTR(MSG_SPEED), PSTR(MSG_SPEED), &feedrate_percentage, 10, 999) + * MenuItem_int3::action_edit(PSTR(MSG_SPEED), &feedrate_percentage, 10, 999) + * + */ +#define _MENU_ITEM_VARIANT_P(TYPE, VARIANT, USE_MULTIPLIER, PLABEL, ...) do { \ + _skipStatic = false; \ + if (_menuLineNr == _thisItemNr) { \ + if (encoderLine == _thisItemNr && ui.use_click()) { \ + _MENU_ITEM_MULTIPLIER_CHECK(USE_MULTIPLIER); \ + MenuItem_##TYPE ::action ## VARIANT(__VA_ARGS__); \ + if (screen_changed) return; \ + } \ + if (ui.should_draw()) \ + draw_menu_item ## VARIANT ## _ ## TYPE(encoderLine == _thisItemNr, _lcdLineNr, PLABEL, ## __VA_ARGS__); \ + } \ + ++_thisItemNr; \ +}while(0) + +// Used to print static text with no visible cursor. +// Parameters: label [, bool center [, bool invert [, char *value] ] ] +#define STATIC_ITEM_P(PLABEL, ...) do{ \ + if (_menuLineNr == _thisItemNr) { \ + if (_skipStatic && encoderLine <= _thisItemNr) { \ + ui.encoderPosition += ENCODER_STEPS_PER_MENU_ITEM; \ + ++encoderLine; \ + } \ + if (ui.should_draw()) \ + draw_menu_item_static(_lcdLineNr, PLABEL, ## __VA_ARGS__); \ + } \ + ++_thisItemNr; \ +} while(0) + +#define MENU_ITEM_ADDON_START(X) \ + if (ui.should_draw() && _menuLineNr == _thisItemNr - 1) { \ + SETCURSOR(X, _lcdLineNr) + +#define MENU_ITEM_ADDON_END() } (0) + +#define STATIC_ITEM(LABEL, ...) STATIC_ITEM_P(PSTR(LABEL), ## __VA_ARGS__) + +#define MENU_BACK(LABEL) MENU_ITEM(back, LABEL) +#define MENU_ITEM_DUMMY() do { _thisItemNr++; }while(0) +#define MENU_ITEM_P(TYPE, PLABEL, ...) _MENU_ITEM_VARIANT_P(TYPE, , false, PLABEL, ## __VA_ARGS__) +#define MENU_ITEM(TYPE, LABEL, ...) _MENU_ITEM_VARIANT_P(TYPE, , false, PSTR(LABEL), ## __VA_ARGS__) +#define MENU_ITEM_EDIT(TYPE, LABEL, ...) _MENU_ITEM_VARIANT_P(TYPE, _edit, false, PSTR(LABEL), PSTR(LABEL), ## __VA_ARGS__) +#define MENU_ITEM_EDIT_CALLBACK(TYPE, LABEL, ...) _MENU_ITEM_VARIANT_P(TYPE, _edit, false, PSTR(LABEL), PSTR(LABEL), ## __VA_ARGS__) +#define MENU_MULTIPLIER_ITEM_EDIT(TYPE, LABEL, ...) _MENU_ITEM_VARIANT_P(TYPE, _edit, true, PSTR(LABEL), PSTR(LABEL), ## __VA_ARGS__) +#define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(TYPE, LABEL, ...) _MENU_ITEM_VARIANT_P(TYPE, _edit, true, PSTR(LABEL), PSTR(LABEL), ## __VA_ARGS__) + +//////////////////////////////////////////// +/////////////// Menu Screens /////////////// +//////////////////////////////////////////// + +void menu_main(); +void menu_move(); + +#if ENABLED(SDSUPPORT) + void menu_sdcard(); +#endif + +// First Fan Speed title in "Tune" and "Control>Temperature" menus +#if FAN_COUNT > 0 && HAS_FAN0 + #if FAN_COUNT > 1 + #define FAN_SPEED_1_SUFFIX " 1" + #else + #define FAN_SPEED_1_SUFFIX "" + #endif +#endif + +//////////////////////////////////////////// +//////// Menu Item Helper Functions //////// +//////////////////////////////////////////// + +void lcd_move_z(); +void _lcd_draw_homing(); + +void watch_temp_callback_E0(); +void watch_temp_callback_E1(); +void watch_temp_callback_E2(); +void watch_temp_callback_E3(); +void watch_temp_callback_E4(); +void watch_temp_callback_E5(); +void watch_temp_callback_bed(); + +#define HAS_LINE_TO_Z (ENABLED(DELTA) || ENABLED(PROBE_MANUALLY) || ENABLED(MESH_BED_LEVELING) || ENABLED(LEVEL_BED_CORNERS)) + +#if HAS_LINE_TO_Z + void line_to_z(const float &z); +#endif + +#if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(PID_AUTOTUNE_MENU) || ENABLED(ADVANCED_PAUSE_FEATURE) + void lcd_enqueue_command(const char * const cmd); + void lcd_enqueue_commands_P(PGM_P const cmd); +#endif + +#if ENABLED(LEVEL_BED_CORNERS) + void _lcd_level_bed_corners(); +#endif + +#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) + extern float lcd_z_fade_height; + void _lcd_set_z_fade_height(); +#endif + +#if ENABLED(LCD_BED_LEVELING) || (HAS_LEVELING && DISABLED(SLIM_LCD_MENUS)) + void _lcd_toggle_bed_leveling(); +#endif + +#if ENABLED(BABYSTEPPING) + #if ENABLED(BABYSTEP_ZPROBE_OFFSET) + void lcd_babystep_zoffset(); + #else + void lcd_babystep_z(); + #endif +#endif + +#if ENABLED(EEPROM_SETTINGS) + void lcd_store_settings(); + void lcd_load_settings(); +#endif + +#if ENABLED(POWER_LOSS_RECOVERY) + void menu_job_recovery(); +#endif diff --git a/Marlin/src/lcd/menu/menu_advanced.cpp b/Marlin/src/lcd/menu/menu_advanced.cpp new file mode 100644 index 0000000000..bebf749214 --- /dev/null +++ b/Marlin/src/lcd/menu/menu_advanced.cpp @@ -0,0 +1,644 @@ +/** + * 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 . + * + */ + +// +// Advanced Settings Menus +// + +#include "../../inc/MarlinConfigPre.h" + +#if HAS_LCD_MENU + +#include "menu.h" +#include "../../module/planner.h" + +#if DISABLED(NO_VOLUMETRICS) + #include "../../gcode/parser.h" +#endif + +#if HAS_BED_PROBE + #include "../../module/probe.h" + #if ENABLED(BLTOUCH) + #include "../../module/endstops.h" + #endif +#endif + +#if ENABLED(PIDTEMP) + #include "../../module/temperature.h" +#endif + +#if HAS_M206_COMMAND + // + // Set the home offset based on the current_position + // + void _lcd_set_home_offsets() { + enqueue_and_echo_commands_P(PSTR("M428")); + ui.return_to_status(); + } +#endif + +#if ENABLED(SD_FIRMWARE_UPDATE) + + #include "../../module/configuration_store.h" + + // + // Toggle the SD Firmware Update state in EEPROM + // + static void _lcd_toggle_sd_update() { + const bool new_state = !settings.sd_update_status(); + ui.completion_feedback(settings.set_sd_update_status(new_state)); + ui.return_to_status(); + if (new_state) LCD_MESSAGEPGM(MSG_RESET_PRINTER); else ui.reset_status(); + } +#endif + +#if DISABLED(NO_VOLUMETRICS) || ENABLED(ADVANCED_PAUSE_FEATURE) + // + // Advanced Settings > Filament + // + void menu_advanced_filament() { + START_MENU(); + MENU_BACK(MSG_ADVANCED_SETTINGS); + + #if ENABLED(LIN_ADVANCE) + #if EXTRUDERS == 1 + MENU_ITEM_EDIT(float52, MSG_ADVANCE_K, &planner.extruder_advance_K[0], 0, 999); + #elif EXTRUDERS > 1 + #define EDIT_ADVANCE_K(N) MENU_ITEM_EDIT(float52, MSG_ADVANCE_K MSG_E##N, &planner.extruder_advance_K[N-1], 0, 999) + EDIT_ADVANCE_K(1); + EDIT_ADVANCE_K(2); + #if EXTRUDERS > 2 + EDIT_ADVANCE_K(3); + #if EXTRUDERS > 3 + EDIT_ADVANCE_K(4); + #if EXTRUDERS > 4 + EDIT_ADVANCE_K(5); + #if EXTRUDERS > 5 + EDIT_ADVANCE_K(6); + #endif // EXTRUDERS > 5 + #endif // EXTRUDERS > 4 + #endif // EXTRUDERS > 3 + #endif // EXTRUDERS > 2 + #endif // EXTRUDERS > 1 + #endif + + #if DISABLED(NO_VOLUMETRICS) + MENU_ITEM_EDIT_CALLBACK(bool, MSG_VOLUMETRIC_ENABLED, &parser.volumetric_enabled, planner.calculate_volumetric_multipliers); + + if (parser.volumetric_enabled) { + #if EXTRUDERS == 1 + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_DIAM, &planner.filament_size[0], 1.5f, 3.25f, planner.calculate_volumetric_multipliers); + #else // EXTRUDERS > 1 + #define EDIT_FIL_DIAM(N) MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_DIAM MSG_DIAM_E##N, &planner.filament_size[N-1], 1.5f, 3.25f, planner.calculate_volumetric_multipliers) + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_DIAM, &planner.filament_size[active_extruder], 1.5f, 3.25f, planner.calculate_volumetric_multipliers); + EDIT_FIL_DIAM(1); + EDIT_FIL_DIAM(2); + #if EXTRUDERS > 2 + EDIT_FIL_DIAM(3); + #if EXTRUDERS > 3 + EDIT_FIL_DIAM(4); + #if EXTRUDERS > 4 + EDIT_FIL_DIAM(5); + #if EXTRUDERS > 5 + EDIT_FIL_DIAM(6); + #endif // EXTRUDERS > 5 + #endif // EXTRUDERS > 4 + #endif // EXTRUDERS > 3 + #endif // EXTRUDERS > 2 + #endif // EXTRUDERS > 1 + } + #endif + + #if ENABLED(ADVANCED_PAUSE_FEATURE) + constexpr float extrude_maxlength = + #if ENABLED(PREVENT_LENGTHY_EXTRUDE) + EXTRUDE_MAXLENGTH + #else + 999 + #endif + ; + + #if EXTRUDERS == 1 + MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_FILAMENT_UNLOAD, &fc_settings[0].unload_length, 0, extrude_maxlength); + #else // EXTRUDERS > 1 + #define EDIT_FIL_UNLOAD(N) MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_FILAMENT_UNLOAD MSG_DIAM_E##N, &fc_settings[N-1].unload_length, 0, extrude_maxlength) + MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_FILAMENT_UNLOAD, &fc_settings[active_extruder].unload_length, 0, extrude_maxlength); + EDIT_FIL_UNLOAD(1); + EDIT_FIL_UNLOAD(2); + #if EXTRUDERS > 2 + EDIT_FIL_UNLOAD(3); + #if EXTRUDERS > 3 + EDIT_FIL_UNLOAD(4); + #if EXTRUDERS > 4 + EDIT_FIL_UNLOAD(5); + #if EXTRUDERS > 5 + EDIT_FIL_UNLOAD(6); + #endif // EXTRUDERS > 5 + #endif // EXTRUDERS > 4 + #endif // EXTRUDERS > 3 + #endif // EXTRUDERS > 2 + #endif // EXTRUDERS > 1 + + #if EXTRUDERS == 1 + MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_FILAMENT_LOAD, &fc_settings[0].load_length, 0, extrude_maxlength); + #else // EXTRUDERS > 1 + #define EDIT_FIL_LOAD(N) MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_FILAMENT_LOAD MSG_DIAM_E##N, &fc_settings[N-1].load_length, 0, extrude_maxlength) + MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_FILAMENT_LOAD, &fc_settings[active_extruder].load_length, 0, extrude_maxlength); + EDIT_FIL_LOAD(1); + EDIT_FIL_LOAD(2); + #if EXTRUDERS > 2 + EDIT_FIL_LOAD(3); + #if EXTRUDERS > 3 + EDIT_FIL_LOAD(4); + #if EXTRUDERS > 4 + EDIT_FIL_LOAD(5); + #if EXTRUDERS > 5 + EDIT_FIL_LOAD(6); + #endif // EXTRUDERS > 5 + #endif // EXTRUDERS > 4 + #endif // EXTRUDERS > 3 + #endif // EXTRUDERS > 2 + #endif // EXTRUDERS > 1 + #endif + + END_MENU(); + } + +#endif // !NO_VOLUMETRICS || ADVANCED_PAUSE_FEATURE + +// +// Advanced Settings > Temperature helpers +// + +#if ENABLED(PID_AUTOTUNE_MENU) + + #if ENABLED(PIDTEMP) + int16_t autotune_temp[HOTENDS] = ARRAY_BY_HOTENDS1(150); + #endif + + #if ENABLED(PIDTEMPBED) + int16_t autotune_temp_bed = 70; + #endif + + void _lcd_autotune(const int16_t e) { + char cmd[30]; + sprintf_P(cmd, PSTR("M303 U1 E%i S%i"), e, + #if HAS_PID_FOR_BOTH + e < 0 ? autotune_temp_bed : autotune_temp[e] + #elif ENABLED(PIDTEMPBED) + autotune_temp_bed + #else + autotune_temp[e] + #endif + ); + lcd_enqueue_command(cmd); + } + +#endif // PID_AUTOTUNE_MENU + +#if ENABLED(PIDTEMP) + + float raw_Ki, raw_Kd; // place-holders for Ki and Kd edits + + // Helpers for editing PID Ki & Kd values + // grab the PID value out of the temp variable; scale it; then update the PID driver + void copy_and_scalePID_i(int16_t e) { + #if DISABLED(PID_PARAMS_PER_HOTEND) || HOTENDS == 1 + UNUSED(e); + #endif + PID_PARAM(Ki, e) = scalePID_i(raw_Ki); + thermalManager.updatePID(); + } + void copy_and_scalePID_d(int16_t e) { + #if DISABLED(PID_PARAMS_PER_HOTEND) || HOTENDS == 1 + UNUSED(e); + #endif + PID_PARAM(Kd, e) = scalePID_d(raw_Kd); + thermalManager.updatePID(); + } + #define _DEFINE_PIDTEMP_BASE_FUNCS(N) \ + void copy_and_scalePID_i_E ## N() { copy_and_scalePID_i(N); } \ + void copy_and_scalePID_d_E ## N() { copy_and_scalePID_d(N); } + + #if ENABLED(PID_AUTOTUNE_MENU) + #define DEFINE_PIDTEMP_FUNCS(N) \ + _DEFINE_PIDTEMP_BASE_FUNCS(N); \ + void lcd_autotune_callback_E ## N() { _lcd_autotune(N); } typedef void _pid_##N##_void + #else + #define DEFINE_PIDTEMP_FUNCS(N) _DEFINE_PIDTEMP_BASE_FUNCS(N) typedef void _pid_##N##_void + #endif + + DEFINE_PIDTEMP_FUNCS(0); + #if ENABLED(PID_PARAMS_PER_HOTEND) + #if HOTENDS > 1 + DEFINE_PIDTEMP_FUNCS(1); + #if HOTENDS > 2 + DEFINE_PIDTEMP_FUNCS(2); + #if HOTENDS > 3 + DEFINE_PIDTEMP_FUNCS(3); + #if HOTENDS > 4 + DEFINE_PIDTEMP_FUNCS(4); + #if HOTENDS > 5 + DEFINE_PIDTEMP_FUNCS(5); + #endif // HOTENDS > 5 + #endif // HOTENDS > 4 + #endif // HOTENDS > 3 + #endif // HOTENDS > 2 + #endif // HOTENDS > 1 + #endif // PID_PARAMS_PER_HOTEND + +#endif // PIDTEMP + +// +// Advanced Settings > Temperature +// +void menu_advanced_temperature() { + START_MENU(); + MENU_BACK(MSG_ADVANCED_SETTINGS); + // + // Autotemp, Min, Max, Fact + // + #if ENABLED(AUTOTEMP) && HAS_TEMP_HOTEND + MENU_ITEM_EDIT(bool, MSG_AUTOTEMP, &planner.autotemp_enabled); + MENU_ITEM_EDIT(float3, MSG_MIN, &planner.autotemp_min, 0, float(HEATER_0_MAXTEMP) - 15); + MENU_ITEM_EDIT(float3, MSG_MAX, &planner.autotemp_max, 0, float(HEATER_0_MAXTEMP) - 15); + MENU_ITEM_EDIT(float52, MSG_FACTOR, &planner.autotemp_factor, 0, 1); + #endif + + // + // PID-P, PID-I, PID-D, PID-C, PID Autotune + // PID-P E1, PID-I E1, PID-D E1, PID-C E1, PID Autotune E1 + // PID-P E2, PID-I E2, PID-D E2, PID-C E2, PID Autotune E2 + // PID-P E3, PID-I E3, PID-D E3, PID-C E3, PID Autotune E3 + // PID-P E4, PID-I E4, PID-D E4, PID-C E4, PID Autotune E4 + // PID-P E5, PID-I E5, PID-D E5, PID-C E5, PID Autotune E5 + // + #if ENABLED(PIDTEMP) + + #define _PID_BASE_MENU_ITEMS(ELABEL, eindex) \ + raw_Ki = unscalePID_i(PID_PARAM(Ki, eindex)); \ + raw_Kd = unscalePID_d(PID_PARAM(Kd, eindex)); \ + MENU_ITEM_EDIT(float52sign, MSG_PID_P ELABEL, &PID_PARAM(Kp, eindex), 1, 9990); \ + MENU_ITEM_EDIT_CALLBACK(float52sign, MSG_PID_I ELABEL, &raw_Ki, 0.01f, 9990, copy_and_scalePID_i_E ## eindex); \ + MENU_ITEM_EDIT_CALLBACK(float52sign, MSG_PID_D ELABEL, &raw_Kd, 1, 9990, copy_and_scalePID_d_E ## eindex) + + #if ENABLED(PID_EXTRUSION_SCALING) + #define _PID_MENU_ITEMS(ELABEL, eindex) \ + _PID_BASE_MENU_ITEMS(ELABEL, eindex); \ + MENU_ITEM_EDIT(float3, MSG_PID_C ELABEL, &PID_PARAM(Kc, eindex), 1, 9990) + #else + #define _PID_MENU_ITEMS(ELABEL, eindex) _PID_BASE_MENU_ITEMS(ELABEL, eindex) + #endif + + #if ENABLED(PID_AUTOTUNE_MENU) + #define PID_MENU_ITEMS(ELABEL, eindex) \ + _PID_MENU_ITEMS(ELABEL, eindex); \ + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_PID_AUTOTUNE ELABEL, &autotune_temp[eindex], 150, heater_maxtemp[eindex] - 15, lcd_autotune_callback_E ## eindex) + #else + #define PID_MENU_ITEMS(ELABEL, eindex) _PID_MENU_ITEMS(ELABEL, eindex) + #endif + + #if ENABLED(PID_PARAMS_PER_HOTEND) && HOTENDS > 1 + PID_MENU_ITEMS(" " MSG_E1, 0); + PID_MENU_ITEMS(" " MSG_E2, 1); + #if HOTENDS > 2 + PID_MENU_ITEMS(" " MSG_E3, 2); + #if HOTENDS > 3 + PID_MENU_ITEMS(" " MSG_E4, 3); + #if HOTENDS > 4 + PID_MENU_ITEMS(" " MSG_E5, 4); + #if HOTENDS > 5 + PID_MENU_ITEMS(" " MSG_E6, 5); + #endif // HOTENDS > 5 + #endif // HOTENDS > 4 + #endif // HOTENDS > 3 + #endif // HOTENDS > 2 + #else // !PID_PARAMS_PER_HOTEND || HOTENDS == 1 + PID_MENU_ITEMS("", 0); + #endif // !PID_PARAMS_PER_HOTEND || HOTENDS == 1 + + #endif // PIDTEMP + + END_MENU(); +} + +#if DISABLED(SLIM_LCD_MENUS) + + void _reset_acceleration_rates() { planner.reset_acceleration_rates(); } + #if ENABLED(DISTINCT_E_FACTORS) + void _reset_e_acceleration_rate(const uint8_t e) { if (e == active_extruder) _reset_acceleration_rates(); } + void _reset_e0_acceleration_rate() { _reset_e_acceleration_rate(0); } + void _reset_e1_acceleration_rate() { _reset_e_acceleration_rate(1); } + #if E_STEPPERS > 2 + void _reset_e2_acceleration_rate() { _reset_e_acceleration_rate(2); } + #if E_STEPPERS > 3 + void _reset_e3_acceleration_rate() { _reset_e_acceleration_rate(3); } + #if E_STEPPERS > 4 + void _reset_e4_acceleration_rate() { _reset_e_acceleration_rate(4); } + #if E_STEPPERS > 5 + void _reset_e5_acceleration_rate() { _reset_e_acceleration_rate(5); } + #endif // E_STEPPERS > 5 + #endif // E_STEPPERS > 4 + #endif // E_STEPPERS > 3 + #endif // E_STEPPERS > 2 + #endif + + void _planner_refresh_positioning() { planner.refresh_positioning(); } + #if ENABLED(DISTINCT_E_FACTORS) + void _planner_refresh_e_positioning(const uint8_t e) { + if (e == active_extruder) + _planner_refresh_positioning(); + else + planner.steps_to_mm[E_AXIS + e] = 1.0f / planner.settings.axis_steps_per_mm[E_AXIS + e]; + } + void _planner_refresh_e0_positioning() { _planner_refresh_e_positioning(0); } + void _planner_refresh_e1_positioning() { _planner_refresh_e_positioning(1); } + #if E_STEPPERS > 2 + void _planner_refresh_e2_positioning() { _planner_refresh_e_positioning(2); } + #if E_STEPPERS > 3 + void _planner_refresh_e3_positioning() { _planner_refresh_e_positioning(3); } + #if E_STEPPERS > 4 + void _planner_refresh_e4_positioning() { _planner_refresh_e_positioning(4); } + #if E_STEPPERS > 5 + void _planner_refresh_e5_positioning() { _planner_refresh_e_positioning(5); } + #endif // E_STEPPERS > 5 + #endif // E_STEPPERS > 4 + #endif // E_STEPPERS > 3 + #endif // E_STEPPERS > 2 + #endif + + // M203 / M205 Velocity options + void menu_advanced_velocity() { + START_MENU(); + MENU_BACK(MSG_ADVANCED_SETTINGS); + + // M203 Max Feedrate + #define EDIT_VMAX(N) MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_VMAX MSG_##N, &planner.settings.max_feedrate_mm_s[_AXIS(N)], 1, 999) + EDIT_VMAX(A); + EDIT_VMAX(B); + EDIT_VMAX(C); + + #if ENABLED(DISTINCT_E_FACTORS) + #define EDIT_VMAX_E(N) MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_VMAX MSG_E##N, &planner.settings.max_feedrate_mm_s[E_AXIS_N(N-1)], 1, 999) + MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_VMAX MSG_E, &planner.settings.max_feedrate_mm_s[E_AXIS_N(active_extruder)], 1, 999); + EDIT_VMAX_E(1); + EDIT_VMAX_E(2); + #if E_STEPPERS > 2 + EDIT_VMAX_E(3); + #if E_STEPPERS > 3 + EDIT_VMAX_E(4); + #if E_STEPPERS > 4 + EDIT_VMAX_E(5); + #if E_STEPPERS > 5 + EDIT_VMAX_E(6); + #endif // E_STEPPERS > 5 + #endif // E_STEPPERS > 4 + #endif // E_STEPPERS > 3 + #endif // E_STEPPERS > 2 + #else + MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_VMAX MSG_E, &planner.settings.max_feedrate_mm_s[E_AXIS], 1, 999); + #endif + + // M205 S Min Feedrate + MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_VMIN, &planner.settings.min_feedrate_mm_s, 0, 999); + + // M205 T Min Travel Feedrate + MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_VTRAV_MIN, &planner.settings.min_travel_feedrate_mm_s, 0, 999); + + END_MENU(); + } + + // M201 / M204 Accelerations + void menu_advanced_acceleration() { + START_MENU(); + MENU_BACK(MSG_ADVANCED_SETTINGS); + + // M204 P Acceleration + MENU_MULTIPLIER_ITEM_EDIT(float5, MSG_ACC, &planner.settings.acceleration, 10, 99000); + + // M204 R Retract Acceleration + MENU_MULTIPLIER_ITEM_EDIT(float5, MSG_A_RETRACT, &planner.settings.retract_acceleration, 100, 99000); + + // M204 T Travel Acceleration + MENU_MULTIPLIER_ITEM_EDIT(float5, MSG_A_TRAVEL, &planner.settings.travel_acceleration, 100, 99000); + + // M201 settings + #define EDIT_AMAX(Q,L) MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_##Q, &planner.settings.max_acceleration_mm_per_s2[_AXIS(Q)], L, 99000, _reset_acceleration_rates) + EDIT_AMAX(A,100); + EDIT_AMAX(B,100); + EDIT_AMAX(C, 10); + + #if ENABLED(DISTINCT_E_FACTORS) + #define EDIT_AMAX_E(N,E) MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_E##N, &planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(E)], 100, 99000, _reset_e##E##_acceleration_rate) + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_E, &planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(active_extruder)], 100, 99000, _reset_acceleration_rates); + EDIT_AMAX_E(1,0); + EDIT_AMAX_E(2,1); + #if E_STEPPERS > 2 + EDIT_AMAX_E(3,2); + #if E_STEPPERS > 3 + EDIT_AMAX_E(4,3); + #if E_STEPPERS > 4 + EDIT_AMAX_E(5,4); + #if E_STEPPERS > 5 + EDIT_AMAX_E(6,5); + #endif // E_STEPPERS > 5 + #endif // E_STEPPERS > 4 + #endif // E_STEPPERS > 3 + #endif // E_STEPPERS > 2 + #else + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_E, &planner.settings.max_acceleration_mm_per_s2[E_AXIS], 100, 99000, _reset_acceleration_rates); + #endif + + END_MENU(); + } + + // M205 Jerk + void menu_advanced_jerk() { + START_MENU(); + MENU_BACK(MSG_ADVANCED_SETTINGS); + + #if ENABLED(JUNCTION_DEVIATION) + #if ENABLED(LIN_ADVANCE) + MENU_ITEM_EDIT_CALLBACK(float43, MSG_JUNCTION_DEVIATION, &planner.junction_deviation_mm, 0.01f, 0.3f, planner.recalculate_max_e_jerk); + #else + MENU_ITEM_EDIT(float43, MSG_JUNCTION_DEVIATION, &planner.junction_deviation_mm, 0.01f, 0.3f); + #endif + #endif + #if HAS_CLASSIC_JERK + #define EDIT_JERK(N) MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_V##N##_JERK, &planner.max_jerk[_AXIS(N)], 1, 990) + EDIT_JERK(A); + EDIT_JERK(B); + #if ENABLED(DELTA) + EDIT_JERK(C); + #else + MENU_MULTIPLIER_ITEM_EDIT(float52sign, MSG_VC_JERK, &planner.max_jerk[C_AXIS], 0.1f, 990); + #endif + #if DISABLED(JUNCTION_DEVIATION) || DISABLED(LIN_ADVANCE) + EDIT_JERK(E); + #endif + #endif + + END_MENU(); + } + + // M92 Steps-per-mm + void menu_advanced_steps_per_mm() { + START_MENU(); + MENU_BACK(MSG_ADVANCED_SETTINGS); + + #define EDIT_QSTEPS(Q) MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float62, MSG_##Q##STEPS, &planner.settings.axis_steps_per_mm[_AXIS(Q)], 5, 9999, _planner_refresh_positioning) + EDIT_QSTEPS(A); + EDIT_QSTEPS(B); + EDIT_QSTEPS(C); + + #if ENABLED(DISTINCT_E_FACTORS) + #define EDIT_ESTEPS(N,E) MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float62, MSG_E##N##STEPS, &planner.settings.axis_steps_per_mm[E_AXIS_N(E)], 5, 9999, _planner_refresh_e##E##_positioning) + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float62, MSG_ESTEPS, &planner.settings.axis_steps_per_mm[E_AXIS_N(active_extruder)], 5, 9999, _planner_refresh_positioning); + EDIT_ESTEPS(1,0); + EDIT_ESTEPS(2,1); + #if E_STEPPERS > 2 + EDIT_ESTEPS(3,2); + #if E_STEPPERS > 3 + EDIT_ESTEPS(4,3); + #if E_STEPPERS > 4 + EDIT_ESTEPS(5,4); + #if E_STEPPERS > 5 + EDIT_ESTEPS(6,5); + #endif // E_STEPPERS > 5 + #endif // E_STEPPERS > 4 + #endif // E_STEPPERS > 3 + #endif // E_STEPPERS > 2 + #else + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float62, MSG_ESTEPS, &planner.settings.axis_steps_per_mm[E_AXIS], 5, 9999, _planner_refresh_positioning); + #endif + + END_MENU(); + } + + #if ENABLED(EEPROM_SETTINGS) + + #include "../../module/configuration_store.h" + + static void lcd_init_eeprom() { + ui.completion_feedback(settings.init_eeprom()); + ui.goto_previous_screen(); + } + + static void lcd_init_eeprom_confirm() { + START_MENU(); + MENU_BACK(MSG_ADVANCED_SETTINGS); + MENU_ITEM(function, MSG_INIT_EEPROM, lcd_init_eeprom); + END_MENU(); + } + + #endif + +#endif // !SLIM_LCD_MENUS + +void menu_advanced_settings() { + START_MENU(); + MENU_BACK(MSG_CONFIGURATION); + + #if ENABLED(BABYSTEP_ZPROBE_OFFSET) + MENU_ITEM(submenu, MSG_ZPROBE_ZOFFSET, lcd_babystep_zoffset); + #elif HAS_BED_PROBE + MENU_ITEM_EDIT(float52, MSG_ZPROBE_ZOFFSET, &zprobe_zoffset, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX); + #endif + + #if DISABLED(SLIM_LCD_MENUS) + + #if HAS_M206_COMMAND + // + // Set Home Offsets + // + MENU_ITEM(function, MSG_SET_HOME_OFFSETS, _lcd_set_home_offsets); + #endif + + // M203 / M205 - Feedrate items + MENU_ITEM(submenu, MSG_VELOCITY, menu_advanced_velocity); + + // M201 - Acceleration items + MENU_ITEM(submenu, MSG_ACCELERATION, menu_advanced_acceleration); + + // M205 - Max Jerk + MENU_ITEM(submenu, MSG_JERK, menu_advanced_jerk); + + if (!printer_busy()) { + // M92 - Steps Per mm + MENU_ITEM(submenu, MSG_STEPS_PER_MM, menu_advanced_steps_per_mm); + } + + #endif // !SLIM_LCD_MENUS + + MENU_ITEM(submenu, MSG_TEMPERATURE, menu_advanced_temperature); + + #if DISABLED(NO_VOLUMETRICS) || ENABLED(ADVANCED_PAUSE_FEATURE) + MENU_ITEM(submenu, MSG_FILAMENT, menu_advanced_filament); + #elif ENABLED(LIN_ADVANCE) + #if EXTRUDERS == 1 + MENU_ITEM_EDIT(float52, MSG_ADVANCE_K, &planner.extruder_advance_K[0], 0, 999); + #elif EXTRUDERS > 1 + #define EDIT_ADVANCE_K(N) MENU_ITEM_EDIT(float52, MSG_ADVANCE_K MSG_E##N, &planner.extruder_advance_K[N-1], 0, 999) + EDIT_ADVANCE_K(1); + EDIT_ADVANCE_K(2); + #if EXTRUDERS > 2 + EDIT_ADVANCE_K(3); + #if EXTRUDERS > 3 + EDIT_ADVANCE_K(4); + #if EXTRUDERS > 4 + EDIT_ADVANCE_K(5); + #if EXTRUDERS > 5 + EDIT_ADVANCE_K(6); + #endif // EXTRUDERS > 5 + #endif // EXTRUDERS > 4 + #endif // EXTRUDERS > 3 + #endif // EXTRUDERS > 2 + #endif // EXTRUDERS > 1 + #endif + + // M540 S - Abort on endstop hit when SD printing + #if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED) + MENU_ITEM_EDIT(bool, MSG_ENDSTOP_ABORT, &planner.abort_on_endstop_hit); + #endif + + // + // BLTouch Self-Test and Reset + // + #if ENABLED(BLTOUCH) + MENU_ITEM(gcode, MSG_BLTOUCH_SELFTEST, PSTR("M280 P" STRINGIFY(Z_PROBE_SERVO_NR) " S" STRINGIFY(BLTOUCH_SELFTEST))); + if (!endstops.z_probe_enabled && TEST_BLTOUCH()) + MENU_ITEM(gcode, MSG_BLTOUCH_RESET, PSTR("M280 P" STRINGIFY(Z_PROBE_SERVO_NR) " S" STRINGIFY(BLTOUCH_RESET))); + #endif + + #if ENABLED(SD_FIRMWARE_UPDATE) + bool sd_update_state = settings.sd_update_status(); + MENU_ITEM_EDIT_CALLBACK(bool, MSG_SD_UPDATE, &sd_update_state, _lcd_toggle_sd_update); + #endif + + #if ENABLED(EEPROM_SETTINGS) && DISABLED(SLIM_LCD_MENUS) + MENU_ITEM(submenu, MSG_INIT_EEPROM, lcd_init_eeprom_confirm); + #endif + + END_MENU(); +} + +#endif // HAS_LCD_MENU diff --git a/Marlin/src/lcd/menu/menu_bed_corners.cpp b/Marlin/src/lcd/menu/menu_bed_corners.cpp new file mode 100644 index 0000000000..037d6be03a --- /dev/null +++ b/Marlin/src/lcd/menu/menu_bed_corners.cpp @@ -0,0 +1,102 @@ +/** + * 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 . + * + */ + +// +// Level Bed Corners menu +// + +#include "../../inc/MarlinConfigPre.h" + +#if HAS_LCD_MENU && ENABLED(LEVEL_BED_CORNERS) + +#include "menu.h" +#include "../../module/motion.h" +#include "../../module/planner.h" + +/** + * Level corners, starting in the front-left corner. + */ +static int8_t bed_corner; +void _lcd_goto_next_corner() { + line_to_z(4.0); + switch (bed_corner) { + case 0: + current_position[X_AXIS] = X_MIN_BED + LEVEL_CORNERS_INSET; + current_position[Y_AXIS] = Y_MIN_BED + LEVEL_CORNERS_INSET; + break; + case 1: + current_position[X_AXIS] = X_MAX_BED - LEVEL_CORNERS_INSET; + break; + case 2: + current_position[Y_AXIS] = Y_MAX_BED - LEVEL_CORNERS_INSET; + break; + case 3: + current_position[X_AXIS] = X_MIN_BED + LEVEL_CORNERS_INSET; + break; + #if ENABLED(LEVEL_CENTER_TOO) + case 4: + current_position[X_AXIS] = X_CENTER; + current_position[Y_AXIS] = Y_CENTER; + break; + #endif + } + planner.buffer_line(current_position, MMM_TO_MMS(manual_feedrate_mm_m[X_AXIS]), active_extruder); + line_to_z(0.0); + if (++bed_corner > 3 + #if ENABLED(LEVEL_CENTER_TOO) + + 1 + #endif + ) bed_corner = 0; +} + +void menu_level_bed_corners() { + START_MENU(); + MENU_ITEM(function, + #if ENABLED(LEVEL_CENTER_TOO) + MSG_LEVEL_BED_NEXT_POINT + #else + MSG_NEXT_CORNER + #endif + , _lcd_goto_next_corner); + MENU_ITEM(function, MSG_BACK, ui.goto_previous_screen_no_defer); + END_MENU(); +} + +void _lcd_level_bed_corners_homing() { + _lcd_draw_homing(); + if (all_axes_homed()) { + bed_corner = 0; + ui.goto_screen(menu_level_bed_corners); + _lcd_goto_next_corner(); + } +} + +void _lcd_level_bed_corners() { + ui.defer_status_screen(true); + if (!all_axes_known()) { + set_all_unhomed(); + enqueue_and_echo_commands_P(PSTR("G28")); + } + ui.goto_screen(_lcd_level_bed_corners_homing); +} + +#endif // HAS_LCD_MENU && LEVEL_BED_CORNERS diff --git a/Marlin/src/lcd/menu/menu_bed_leveling.cpp b/Marlin/src/lcd/menu/menu_bed_leveling.cpp new file mode 100644 index 0000000000..40c51b5726 --- /dev/null +++ b/Marlin/src/lcd/menu/menu_bed_leveling.cpp @@ -0,0 +1,295 @@ +/** + * 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 . + * + */ + +// +// Bed Leveling Menus +// + +#include "../../inc/MarlinConfigPre.h" + +#if ENABLED(LCD_BED_LEVELING) + +#include "menu.h" +#include "../../module/planner.h" +#include "../../feature/bedlevel/bedlevel.h" + +#if HAS_BED_PROBE && DISABLED(BABYSTEP_ZPROBE_OFFSET) + #include "../../module/probe.h" +#endif + +#if ENABLED(PROBE_MANUALLY) || ENABLED(MESH_BED_LEVELING) + + #include "../../module/motion.h" + #include "../../gcode/queue.h" + + // + // Motion > Level Bed handlers + // + + static uint8_t manual_probe_index; + + // LCD probed points are from defaults + constexpr uint8_t total_probe_points = ( + #if ENABLED(AUTO_BED_LEVELING_3POINT) + 3 + #elif ABL_GRID || ENABLED(MESH_BED_LEVELING) + GRID_MAX_POINTS + #endif + ); + + bool MarlinUI::wait_for_bl_move; // = false + + // + // Bed leveling is done. Wait for G29 to complete. + // A flag is used so that this can release control + // and allow the command queue to be processed. + // + // When G29 finishes the last move: + // - Raise Z to the "manual probe height" + // - Don't return until done. + // + // ** This blocks the command queue! ** + // + void _lcd_level_bed_done() { + if (!ui.wait_for_bl_move) { + #if MANUAL_PROBE_HEIGHT > 0 && DISABLED(MESH_BED_LEVELING) + // Display "Done" screen and wait for moves to complete + line_to_z(MANUAL_PROBE_HEIGHT); + ui.synchronize(PSTR(MSG_LEVEL_BED_DONE)); + #endif + ui.goto_previous_screen_no_defer(); + ui.completion_feedback(); + } + if (ui.should_draw()) draw_menu_item_static(LCD_HEIGHT >= 4 ? 1 : 0, PSTR(MSG_LEVEL_BED_DONE)); + ui.refresh(LCDVIEW_CALL_REDRAW_NEXT); + } + + void _lcd_level_goto_next_point(); + + // + // Step 7: Get the Z coordinate, click goes to the next point or exits + // + void _lcd_level_bed_get_z() { + ui.encoder_direction_normal(); + + if (ui.use_click()) { + + // + // Save the current Z position and move + // + + // If done... + if (++manual_probe_index >= total_probe_points) { + // + // The last G29 records the point and enables bed leveling + // + ui.wait_for_bl_move = true; + ui.goto_screen(_lcd_level_bed_done); + #if ENABLED(MESH_BED_LEVELING) + enqueue_and_echo_commands_P(PSTR("G29 S2")); + #elif ENABLED(PROBE_MANUALLY) + enqueue_and_echo_commands_P(PSTR("G29 V1")); + #endif + } + else + _lcd_level_goto_next_point(); + + return; + } + + // + // 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); + 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; + } + + // + // Draw on first display, then only on Z change + // + if (ui.should_draw()) { + const float v = current_position[Z_AXIS]; + draw_edit_screen(PSTR(MSG_MOVE_Z), ftostr43sign(v + (v < 0 ? -0.0001f : 0.0001f), '+')); + } + } + + // + // Step 6: Display "Next point: 1 / 9" while waiting for move to finish + // + void _lcd_level_bed_moving() { + if (ui.should_draw()) { + char msg[10]; + sprintf_P(msg, PSTR("%i / %u"), (int)(manual_probe_index + 1), total_probe_points); + draw_edit_screen(PSTR(MSG_LEVEL_BED_NEXT_POINT), msg); + } + ui.refresh(LCDVIEW_CALL_NO_REDRAW); + if (!ui.wait_for_bl_move) ui.goto_screen(_lcd_level_bed_get_z); + } + + // + // Step 5: Initiate a move to the next point + // + void _lcd_level_goto_next_point() { + ui.goto_screen(_lcd_level_bed_moving); + + // G29 Records Z, moves, and signals when it pauses + ui.wait_for_bl_move = true; + #if ENABLED(MESH_BED_LEVELING) + enqueue_and_echo_commands_P(manual_probe_index ? PSTR("G29 S2") : PSTR("G29 S1")); + #elif ENABLED(PROBE_MANUALLY) + enqueue_and_echo_commands_P(PSTR("G29 V1")); + #endif + } + + // + // Step 4: Display "Click to Begin", wait for click + // Move to the first probe position + // + void _lcd_level_bed_homing_done() { + if (ui.should_draw()) draw_edit_screen(PSTR(MSG_LEVEL_BED_WAITING)); + if (ui.use_click()) { + manual_probe_index = 0; + _lcd_level_goto_next_point(); + } + } + + // + // Step 3: Display "Homing XYZ" - Wait for homing to finish + // + void _lcd_level_bed_homing() { + _lcd_draw_homing(); + if (all_axes_homed()) ui.goto_screen(_lcd_level_bed_homing_done); + } + + #if ENABLED(PROBE_MANUALLY) + extern bool g29_in_progress; + #endif + + // + // Step 2: Continue Bed Leveling... + // + void _lcd_level_bed_continue() { + ui.defer_status_screen(true); + set_all_unhomed(); + ui.goto_screen(_lcd_level_bed_homing); + enqueue_and_echo_commands_P(PSTR("G28")); + } + +#endif // PROBE_MANUALLY || MESH_BED_LEVELING + +#if ENABLED(MESH_EDIT_MENU) + + inline void refresh_planner() { + set_current_from_steppers_for_axis(ALL_AXES); + sync_plan_position(); + } + + void menu_edit_mesh() { + static uint8_t xind, yind; // =0 + START_MENU(); + MENU_BACK(MSG_BED_LEVELING); + MENU_ITEM_EDIT(int8, MSG_MESH_X, &xind, 0, GRID_MAX_POINTS_X - 1); + MENU_ITEM_EDIT(int8, MSG_MESH_Y, &yind, 0, GRID_MAX_POINTS_Y - 1); + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float43, MSG_MESH_EDIT_Z, &Z_VALUES(xind, yind), -(LCD_PROBE_Z_RANGE) * 0.5, (LCD_PROBE_Z_RANGE) * 0.5, refresh_planner); + END_MENU(); + } + +#endif // MESH_EDIT_MENU + +/** + * Step 1: Bed Level entry-point + * + * << Motion + * Auto Home (if homing needed) + * Leveling On/Off (if data exists, and homed) + * Fade Height: --- (Req: ENABLE_LEVELING_FADE_HEIGHT) + * Mesh Z Offset: --- (Req: MESH_BED_LEVELING) + * Z Probe Offset: --- (Req: HAS_BED_PROBE, Opt: BABYSTEP_ZPROBE_OFFSET) + * Level Bed > + * Level Corners > (if homed) + * Load Settings (Req: EEPROM_SETTINGS) + * Save Settings (Req: EEPROM_SETTINGS) + */ +void menu_bed_leveling() { + START_MENU(); + MENU_BACK(MSG_MOTION); + + const bool is_homed = all_axes_known(); + + // Auto Home if not using manual probing + #if DISABLED(PROBE_MANUALLY) && DISABLED(MESH_BED_LEVELING) + if (!is_homed) MENU_ITEM(gcode, MSG_AUTO_HOME, PSTR("G28")); + #endif + + // Level Bed + #if ENABLED(PROBE_MANUALLY) || ENABLED(MESH_BED_LEVELING) + // Manual leveling uses a guided procedure + MENU_ITEM(submenu, MSG_LEVEL_BED, _lcd_level_bed_continue); + #else + // Automatic leveling can just run the G-code + MENU_ITEM(gcode, MSG_LEVEL_BED, is_homed ? PSTR("G29") : PSTR("G28\nG29")); + #endif + + #if ENABLED(MESH_EDIT_MENU) + if (leveling_is_valid()) + MENU_ITEM(submenu, MSG_EDIT_MESH, menu_edit_mesh); + #endif + + // Homed and leveling is valid? Then leveling can be toggled. + if (is_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); + } + + // Z Fade Height + #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float3, MSG_Z_FADE_HEIGHT, &lcd_z_fade_height, 0, 100, _lcd_set_z_fade_height); + #endif + + // + // Mesh Bed Leveling Z-Offset + // + #if ENABLED(MESH_BED_LEVELING) + MENU_ITEM_EDIT(float43, MSG_BED_Z, &mbl.z_offset, -1, 1); + #endif + + #if ENABLED(BABYSTEP_ZPROBE_OFFSET) + MENU_ITEM(submenu, MSG_ZPROBE_ZOFFSET, lcd_babystep_zoffset); + #elif HAS_BED_PROBE + MENU_ITEM_EDIT(float52, MSG_ZPROBE_ZOFFSET, &zprobe_zoffset, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX); + #endif + + #if ENABLED(LEVEL_BED_CORNERS) + MENU_ITEM(submenu, MSG_LEVEL_CORNERS, _lcd_level_bed_corners); + #endif + + #if ENABLED(EEPROM_SETTINGS) + MENU_ITEM(function, MSG_LOAD_EEPROM, lcd_load_settings); + MENU_ITEM(function, MSG_STORE_EEPROM, lcd_store_settings); + #endif + END_MENU(); +} + +#endif // LCD_BED_LEVELING diff --git a/Marlin/src/lcd/menu/menu_configuration.cpp b/Marlin/src/lcd/menu/menu_configuration.cpp new file mode 100644 index 0000000000..3e67a83672 --- /dev/null +++ b/Marlin/src/lcd/menu/menu_configuration.cpp @@ -0,0 +1,382 @@ +/** + * 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 . + * + */ + +// +// Configuration Menu +// + +#include "../../inc/MarlinConfigPre.h" + +#if HAS_LCD_MENU + +#include "menu.h" + +#include "../../module/configuration_store.h" + +#if ENABLED(FILAMENT_RUNOUT_SENSOR) + #include "../../feature/runout.h" +#endif + +#if ENABLED(POWER_LOSS_RECOVERY) + #include "../../feature/power_loss_recovery.h" +#endif + +#define HAS_DEBUG_MENU ENABLED(LCD_PROGRESS_BAR_TEST) + +void menu_advanced_settings(); +void menu_delta_calibrate(); + +static void lcd_factory_settings() { + settings.reset(); + ui.completion_feedback(); +} + +#if ENABLED(LCD_PROGRESS_BAR_TEST) + + #include "../lcdprint.h" + + static void progress_bar_test() { + ui.encoder_direction_normal(); + static int8_t bar_percent = 0; + if (ui.use_click()) { + ui.goto_previous_screen(); + ui.set_custom_characters(CHARSET_MENU); + return; + } + bar_percent += (int8_t)ui.encoderPosition; + bar_percent = constrain(bar_percent, 0, 100); + ui.encoderPosition = 0; + draw_menu_item_static(0, PSTR(MSG_PROGRESS_BAR_TEST), true, true); + lcd_moveto((LCD_WIDTH) / 2 - 2, LCD_HEIGHT - 2); + lcd_put_int(bar_percent); lcd_put_wchar('%'); + lcd_moveto(0, LCD_HEIGHT - 1); ui.draw_progress_bar(bar_percent); + } + + void _progress_bar_test() { + ui.goto_screen(progress_bar_test); + ui.set_custom_characters(CHARSET_INFO); + } + +#endif // LCD_PROGRESS_BAR_TEST + +#if HAS_DEBUG_MENU + + void menu_debug() { + START_MENU(); + + MENU_BACK(MSG_MAIN); + + #if ENABLED(LCD_PROGRESS_BAR_TEST) + MENU_ITEM(submenu, MSG_PROGRESS_BAR_TEST, _progress_bar_test); + #endif + + END_MENU(); + } + +#endif + +#if EXTRUDERS > 1 + + #include "../../module/tool_change.h" + + void menu_tool_change() { + START_MENU(); + MENU_BACK(MSG_MAIN); + #if ENABLED(TOOLCHANGE_PARK) + MENU_ITEM_EDIT(float3, MSG_FILAMENT_SWAP_LENGTH, &toolchange_settings.swap_length, 0, 200); + MENU_MULTIPLIER_ITEM_EDIT(int4, MSG_SINGLENOZZLE_RETRACT_SPD, &toolchange_settings.retract_speed, 10, 5400); + MENU_MULTIPLIER_ITEM_EDIT(int4, MSG_SINGLENOZZLE_PRIME_SPD, &toolchange_settings.prime_speed, 10, 5400); + #endif + MENU_ITEM_EDIT(float3, MSG_TOOL_CHANGE_ZLIFT, &toolchange_settings.z_raise, 0, 10); + END_MENU(); + } + +#endif + +#if ENABLED(DUAL_X_CARRIAGE) + + #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. + 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() { + START_MENU(); + MENU_BACK(MSG_MAIN); + + MENU_ITEM(gcode, MSG_IDEX_MODE_AUTOPARK, PSTR("M605 S1\nG28 X\nG1 X100")); + const bool need_g28 = !(TEST(axis_known_position, Y_AXIS) && TEST(axis_known_position, Z_AXIS)); + MENU_ITEM(gcode, MSG_IDEX_MODE_DUPLICATE, need_g28 + ? PSTR("M605 S1\nT0\nG28\nM605 S2 X200\nG28 X\nG1 X100") // If Y or Z is not homed, do a full G28 first + : PSTR("M605 S1\nT0\nM605 S2 X200\nG28 X\nG1 X100") + ); + //MENU_ITEM(gcode, MSG_IDEX_MODE_SCALED_COPY, need_g28 + // ? PSTR("M605 S1\nT0\nG28\nM605 S2 X200\nG28 X\nG1 X100\nM605 S3 X200") // If Y or Z is not homed, do a full G28 first + // : 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(); + } + +#endif + +#if ENABLED(BLTOUCH) + + void menu_bltouch() { + START_MENU(); + MENU_BACK(MSG_MAIN); + MENU_ITEM(gcode, MSG_BLTOUCH_RESET, PSTR("M280 P" STRINGIFY(Z_PROBE_SERVO_NR) " S" STRINGIFY(BLTOUCH_RESET))); + MENU_ITEM(gcode, MSG_BLTOUCH_SELFTEST, PSTR("M280 P" STRINGIFY(Z_PROBE_SERVO_NR) " S" STRINGIFY(BLTOUCH_SELFTEST))); + MENU_ITEM(gcode, MSG_BLTOUCH_DEPLOY, PSTR("M280 P" STRINGIFY(Z_PROBE_SERVO_NR) " S" STRINGIFY(BLTOUCH_DEPLOY))); + MENU_ITEM(gcode, MSG_BLTOUCH_STOW, PSTR("M280 P" STRINGIFY(Z_PROBE_SERVO_NR) " S" STRINGIFY(BLTOUCH_STOW))); + END_MENU(); + } + +#endif + +#if ENABLED(MENU_ITEM_CASE_LIGHT) + + #include "../../feature/caselight.h" + + void menu_case_light() { + START_MENU(); + MENU_BACK(MSG_MAIN); + MENU_ITEM_EDIT_CALLBACK(int8, MSG_CASE_LIGHT_BRIGHTNESS, &case_light_brightness, 0, 255, update_case_light, true); + MENU_ITEM_EDIT_CALLBACK(bool, MSG_CASE_LIGHT, (bool*)&case_light_on, update_case_light); + END_MENU(); + } + +#endif + +#if ENABLED(FWRETRACT) + + #include "../../feature/fwretract.h" + + void menu_config_retract() { + START_MENU(); + MENU_BACK(MSG_CONTROL); + #if ENABLED(FWRETRACT_AUTORETRACT) + MENU_ITEM_EDIT_CALLBACK(bool, MSG_AUTORETRACT, &fwretract.autoretract_enabled, fwretract.refresh_autoretract); + #endif + MENU_ITEM_EDIT(float52sign, MSG_CONTROL_RETRACT, &fwretract.settings.retract_length, 0, 100); + #if EXTRUDERS > 1 + MENU_ITEM_EDIT(float52sign, MSG_CONTROL_RETRACT_SWAP, &fwretract.settings.swap_retract_length, 0, 100); + #endif + MENU_ITEM_EDIT(float3, MSG_CONTROL_RETRACTF, &fwretract.settings.retract_feedrate_mm_s, 1, 999); + MENU_ITEM_EDIT(float52sign, MSG_CONTROL_RETRACT_ZHOP, &fwretract.settings.retract_zraise, 0, 999); + MENU_ITEM_EDIT(float52sign, MSG_CONTROL_RETRACT_RECOVER, &fwretract.settings.retract_recover_length, -100, 100); + #if EXTRUDERS > 1 + MENU_ITEM_EDIT(float52sign, MSG_CONTROL_RETRACT_RECOVER_SWAP, &fwretract.settings.swap_retract_recover_length, -100, 100); + #endif + MENU_ITEM_EDIT(float3, MSG_CONTROL_RETRACT_RECOVERF, &fwretract.settings.retract_recover_feedrate_mm_s, 1, 999); + #if EXTRUDERS > 1 + MENU_ITEM_EDIT(float3, MSG_CONTROL_RETRACT_RECOVER_SWAPF, &fwretract.settings.swap_retract_recover_feedrate_mm_s, 1, 999); + #endif + END_MENU(); + } + +#endif + +#if ENABLED(DAC_STEPPER_CURRENT) + + #include "../../feature/dac/stepper_dac.h" + + uint8_t driverPercent[XYZE]; + inline void dac_driver_getValues() { LOOP_XYZE(i) driverPercent[i] = dac_current_get_percent((AxisEnum)i); } + static void dac_driver_commit() { dac_current_set_percents(driverPercent); } + + void menu_dac() { + dac_driver_getValues(); + START_MENU(); + MENU_BACK(MSG_CONTROL); + #define EDIT_DAC_PERCENT(N) MENU_ITEM_EDIT_CALLBACK(int8, MSG_##N " " MSG_DAC_PERCENT, &driverPercent[_AXIS(N)], 0, 100, dac_driver_commit) + EDIT_DAC_PERCENT(X); + EDIT_DAC_PERCENT(Y); + EDIT_DAC_PERCENT(Z); + EDIT_DAC_PERCENT(E); + MENU_ITEM(function, MSG_DAC_EEPROM_WRITE, dac_commit_eeprom); + END_MENU(); + } + +#endif + +#if HAS_MOTOR_CURRENT_PWM + + #include "../../module/stepper.h" + + void menu_pwm() { + START_MENU(); + MENU_BACK(MSG_CONTROL); + #define EDIT_CURRENT_PWM(LABEL,I) MENU_ITEM_EDIT_CALLBACK(long5, LABEL, &stepper.motor_current_setting[I], 100, 2000, stepper.refresh_motor_power) + #if PIN_EXISTS(MOTOR_CURRENT_PWM_XY) + EDIT_CURRENT_PWM(MSG_X MSG_Y, 0); + #endif + #if PIN_EXISTS(MOTOR_CURRENT_PWM_Z) + EDIT_CURRENT_PWM(MSG_Z, 1); + #endif + #if PIN_EXISTS(MOTOR_CURRENT_PWM_E) + EDIT_CURRENT_PWM(MSG_E, 2); + #endif + END_MENU(); + } + +#endif + +#if DISABLED(SLIM_LCD_MENUS) + + void _menu_configuration_preheat_settings(const uint8_t material) { + #if HOTENDS > 5 + #define MINTEMP_ALL MIN(HEATER_0_MINTEMP, HEATER_1_MINTEMP, HEATER_2_MINTEMP, HEATER_3_MINTEMP, HEATER_4_MINTEMP, HEATER_5_MINTEMP) + #define MAXTEMP_ALL MAX(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP, HEATER_4_MAXTEMP, HEATER_5_MAXTEMP) + #elif HOTENDS > 4 + #define MINTEMP_ALL MIN(HEATER_0_MINTEMP, HEATER_1_MINTEMP, HEATER_2_MINTEMP, HEATER_3_MINTEMP, HEATER_4_MINTEMP) + #define MAXTEMP_ALL MAX(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP, HEATER_4_MAXTEMP) + #elif HOTENDS > 3 + #define MINTEMP_ALL MIN(HEATER_0_MINTEMP, HEATER_1_MINTEMP, HEATER_2_MINTEMP, HEATER_3_MINTEMP) + #define MAXTEMP_ALL MAX(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP) + #elif HOTENDS > 2 + #define MINTEMP_ALL MIN(HEATER_0_MINTEMP, HEATER_1_MINTEMP, HEATER_2_MINTEMP) + #define MAXTEMP_ALL MAX(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP) + #elif HOTENDS > 1 + #define MINTEMP_ALL MIN(HEATER_0_MINTEMP, HEATER_1_MINTEMP) + #define MAXTEMP_ALL MAX(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP) + #else + #define MINTEMP_ALL HEATER_0_MINTEMP + #define MAXTEMP_ALL HEATER_0_MAXTEMP + #endif + START_MENU(); + MENU_BACK(MSG_CONFIGURATION); + MENU_ITEM_EDIT(int8, MSG_FAN_SPEED, &ui.preheat_fan_speed[material], 0, 255); + #if HAS_TEMP_HOTEND + MENU_ITEM_EDIT(int3, MSG_NOZZLE, &ui.preheat_hotend_temp[material], MINTEMP_ALL, MAXTEMP_ALL - 15); + #endif + #if HAS_HEATED_BED + MENU_ITEM_EDIT(int3, MSG_BED, &ui.preheat_bed_temp[material], BED_MINTEMP, BED_MAXTEMP - 15); + #endif + #if ENABLED(EEPROM_SETTINGS) + MENU_ITEM(function, MSG_STORE_EEPROM, lcd_store_settings); + #endif + END_MENU(); + } + + void menu_preheat_material1_settings() { _menu_configuration_preheat_settings(0); } + void menu_preheat_material2_settings() { _menu_configuration_preheat_settings(1); } + +#endif + +void menu_configuration() { + START_MENU(); + MENU_BACK(MSG_MAIN); + + // + // Debug Menu when certain options are enabled + // + #if HAS_DEBUG_MENU + MENU_ITEM(submenu, MSG_DEBUG_MENU, menu_debug); + #endif + + MENU_ITEM(submenu, MSG_ADVANCED_SETTINGS, menu_advanced_settings); + + const bool busy = printer_busy(); + if (!busy) { + // + // Delta Calibration + // + #if ENABLED(DELTA_CALIBRATION_MENU) || ENABLED(DELTA_AUTO_CALIBRATION) + MENU_ITEM(submenu, MSG_DELTA_CALIBRATE, menu_delta_calibrate); + #endif + + #if ENABLED(DUAL_X_CARRIAGE) + MENU_ITEM(submenu, MSG_IDEX_MENU, menu_IDEX); + #endif + + #if ENABLED(BLTOUCH) + MENU_ITEM(submenu, MSG_BLTOUCH, menu_bltouch); + #endif + } + + // + // Set single nozzle filament retract and prime length + // + #if EXTRUDERS > 1 + MENU_ITEM(submenu, MSG_TOOL_CHANGE, menu_tool_change); + #endif + + // + // Set Case light on/off/brightness + // + #if ENABLED(MENU_ITEM_CASE_LIGHT) + if (USEABLE_HARDWARE_PWM(CASE_LIGHT_PIN)) + MENU_ITEM(submenu, MSG_CASE_LIGHT, menu_case_light); + else + MENU_ITEM_EDIT_CALLBACK(bool, MSG_CASE_LIGHT, (bool*)&case_light_on, update_case_light); + #endif + + #if HAS_LCD_CONTRAST + MENU_ITEM_EDIT_CALLBACK(int3, MSG_CONTRAST, &ui.contrast, LCD_CONTRAST_MIN, LCD_CONTRAST_MAX, ui.refresh_contrast, true); + #endif + #if ENABLED(FWRETRACT) + MENU_ITEM(submenu, MSG_RETRACT, menu_config_retract); + #endif + #if ENABLED(DAC_STEPPER_CURRENT) + MENU_ITEM(submenu, MSG_DRIVE_STRENGTH, menu_dac); + #endif + #if HAS_MOTOR_CURRENT_PWM + MENU_ITEM(submenu, MSG_DRIVE_STRENGTH, menu_pwm); + #endif + + #if ENABLED(FILAMENT_RUNOUT_SENSOR) + MENU_ITEM_EDIT_CALLBACK(bool, MSG_RUNOUT_SENSOR_ENABLE, &runout.enabled, runout.reset); + #endif + + #if ENABLED(POWER_LOSS_RECOVERY) + MENU_ITEM_EDIT_CALLBACK(bool, MSG_OUTAGE_RECOVERY, &recovery.enabled, recovery.changed); + #endif + + #if DISABLED(SLIM_LCD_MENUS) + // Preheat configurations + MENU_ITEM(submenu, MSG_PREHEAT_1_SETTINGS, menu_preheat_material1_settings); + MENU_ITEM(submenu, MSG_PREHEAT_2_SETTINGS, menu_preheat_material2_settings); + #endif + + #if ENABLED(EEPROM_SETTINGS) + MENU_ITEM(function, MSG_STORE_EEPROM, lcd_store_settings); + if (!busy) + MENU_ITEM(function, MSG_LOAD_EEPROM, lcd_load_settings); + #endif + + if (!busy) + MENU_ITEM(function, MSG_RESTORE_FAILSAFE, lcd_factory_settings); + + END_MENU(); +} + +#endif // HAS_LCD_MENU diff --git a/Marlin/src/lcd/menu/menu_custom.cpp b/Marlin/src/lcd/menu/menu_custom.cpp new file mode 100644 index 0000000000..6b16bbc792 --- /dev/null +++ b/Marlin/src/lcd/menu/menu_custom.cpp @@ -0,0 +1,87 @@ +/** + * 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 . + * + */ + +// +// Custom User Menu +// + +#include "../../inc/MarlinConfigPre.h" + +#if HAS_LCD_MENU && ENABLED(CUSTOM_USER_MENUS) + +#include "menu.h" +#include "../../gcode/queue.h" + +#ifdef USER_SCRIPT_DONE + #define _DONE_SCRIPT "\n" USER_SCRIPT_DONE +#else + #define _DONE_SCRIPT "" +#endif + +void _lcd_user_gcode(PGM_P const cmd) { + enqueue_and_echo_commands_P(cmd); + #if ENABLED(USER_SCRIPT_AUDIBLE_FEEDBACK) + ui.completion_feedback(); + #endif + #if ENABLED(USER_SCRIPT_RETURN) + ui.return_to_status(); + #endif +} + +#if defined(USER_DESC_1) && defined(USER_GCODE_1) + void lcd_user_gcode_1() { _lcd_user_gcode(PSTR(USER_GCODE_1 _DONE_SCRIPT)); } +#endif +#if defined(USER_DESC_2) && defined(USER_GCODE_2) + void lcd_user_gcode_2() { _lcd_user_gcode(PSTR(USER_GCODE_2 _DONE_SCRIPT)); } +#endif +#if defined(USER_DESC_3) && defined(USER_GCODE_3) + void lcd_user_gcode_3() { _lcd_user_gcode(PSTR(USER_GCODE_3 _DONE_SCRIPT)); } +#endif +#if defined(USER_DESC_4) && defined(USER_GCODE_4) + void lcd_user_gcode_4() { _lcd_user_gcode(PSTR(USER_GCODE_4 _DONE_SCRIPT)); } +#endif +#if defined(USER_DESC_5) && defined(USER_GCODE_5) + void lcd_user_gcode_5() { _lcd_user_gcode(PSTR(USER_GCODE_5 _DONE_SCRIPT)); } +#endif + +void menu_user() { + START_MENU(); + MENU_BACK(MSG_MAIN); + #if defined(USER_DESC_1) && defined(USER_GCODE_1) + MENU_ITEM(function, USER_DESC_1, lcd_user_gcode_1); + #endif + #if defined(USER_DESC_2) && defined(USER_GCODE_2) + MENU_ITEM(function, USER_DESC_2, lcd_user_gcode_2); + #endif + #if defined(USER_DESC_3) && defined(USER_GCODE_3) + MENU_ITEM(function, USER_DESC_3, lcd_user_gcode_3); + #endif + #if defined(USER_DESC_4) && defined(USER_GCODE_4) + MENU_ITEM(function, USER_DESC_4, lcd_user_gcode_4); + #endif + #if defined(USER_DESC_5) && defined(USER_GCODE_5) + MENU_ITEM(function, USER_DESC_5, lcd_user_gcode_5); + #endif + END_MENU(); +} + +#endif // HAS_LCD_MENU && CUSTOM_USER_MENUS diff --git a/Marlin/src/lcd/menu/menu_delta_calibrate.cpp b/Marlin/src/lcd/menu/menu_delta_calibrate.cpp new file mode 100644 index 0000000000..f83057b658 --- /dev/null +++ b/Marlin/src/lcd/menu/menu_delta_calibrate.cpp @@ -0,0 +1,137 @@ +/** + * 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 . + * + */ + +// +// Delta Calibrate Menu +// + +#include "../../inc/MarlinConfigPre.h" + +#if HAS_LCD_MENU && (ENABLED(DELTA_CALIBRATION_MENU) || ENABLED(DELTA_AUTO_CALIBRATION)) + +#include "menu.h" +#include "../../module/delta.h" +#include "../../module/motion.h" + +#if HAS_LEVELING + #include "../../feature/bedlevel/bedlevel.h" +#endif + +void _man_probe_pt(const float &rx, const float &ry) { + do_blocking_move_to(rx, ry, Z_CLEARANCE_BETWEEN_PROBES); + ui.synchronize(); + move_menu_scale = MAX(PROBE_MANUALLY_STEP, MIN_STEPS_PER_SEGMENT / float(DEFAULT_XYZ_STEPS_PER_UNIT)); + ui.goto_screen(lcd_move_z); +} + +#if ENABLED(DELTA_AUTO_CALIBRATION) + + #include "../../gcode/gcode.h" + + float lcd_probe_pt(const float &rx, const float &ry) { + _man_probe_pt(rx, ry); + KEEPALIVE_STATE(PAUSED_FOR_USER); + ui.defer_status_screen(true); + wait_for_user = true; + while (wait_for_user) idle(); + KEEPALIVE_STATE(IN_HANDLER); + ui.goto_previous_screen_no_defer(); + return current_position[Z_AXIS]; + } + +#endif + +#if ENABLED(DELTA_CALIBRATION_MENU) + + #include "../../gcode/queue.h" + + void _lcd_calibrate_homing() { + _lcd_draw_homing(); + if (all_axes_homed()) ui.goto_previous_screen(); + } + + void _lcd_delta_calibrate_home() { + enqueue_and_echo_commands_P(PSTR("G28")); + ui.goto_screen(_lcd_calibrate_homing); + } + + void _goto_tower_x() { _man_probe_pt(cos(RADIANS(210)) * delta_calibration_radius, sin(RADIANS(210)) * delta_calibration_radius); } + void _goto_tower_y() { _man_probe_pt(cos(RADIANS(330)) * delta_calibration_radius, sin(RADIANS(330)) * delta_calibration_radius); } + void _goto_tower_z() { _man_probe_pt(cos(RADIANS( 90)) * delta_calibration_radius, sin(RADIANS( 90)) * delta_calibration_radius); } + void _goto_center() { _man_probe_pt(0,0); } + +#endif + +void _recalc_delta_settings() { + #if HAS_LEVELING + reset_bed_level(); // After changing kinematics bed-level data is no longer valid + #endif + recalc_delta_settings(); +} + +void lcd_delta_settings() { + START_MENU(); + MENU_BACK(MSG_DELTA_CALIBRATE); + MENU_ITEM_EDIT_CALLBACK(float52sign, MSG_DELTA_HEIGHT, &delta_height, delta_height - 10, delta_height + 10, _recalc_delta_settings); + #define EDIT_ENDSTOP_ADJ(LABEL,N) MENU_ITEM_EDIT_CALLBACK(float43, LABEL, &delta_endstop_adj[_AXIS(N)], -5, 5, _recalc_delta_settings) + EDIT_ENDSTOP_ADJ("Ex",A); + EDIT_ENDSTOP_ADJ("Ey",B); + EDIT_ENDSTOP_ADJ("Ez",C); + MENU_ITEM_EDIT_CALLBACK(float52sign, MSG_DELTA_RADIUS, &delta_radius, delta_radius - 5, delta_radius + 5, _recalc_delta_settings); + #define EDIT_ANGLE_TRIM(LABEL,N) MENU_ITEM_EDIT_CALLBACK(float43, LABEL, &delta_tower_angle_trim[_AXIS(N)], -5, 5, _recalc_delta_settings) + EDIT_ANGLE_TRIM("Tx",A); + EDIT_ANGLE_TRIM("Ty",B); + EDIT_ANGLE_TRIM("Tz",C); + MENU_ITEM_EDIT_CALLBACK(float52sign, MSG_DELTA_DIAG_ROD, &delta_diagonal_rod, delta_diagonal_rod - 5, delta_diagonal_rod + 5, _recalc_delta_settings); + END_MENU(); +} + +void menu_delta_calibrate() { + START_MENU(); + MENU_BACK(MSG_MAIN); + + #if ENABLED(DELTA_AUTO_CALIBRATION) + MENU_ITEM(gcode, MSG_DELTA_AUTO_CALIBRATE, PSTR("G33")); + MENU_ITEM(gcode, MSG_DELTA_HEIGHT_CALIBRATE, PSTR("G33 S P1")); + MENU_ITEM(gcode, MSG_DELTA_Z_OFFSET_CALIBRATE, PSTR("G33 P-1")); + #if ENABLED(EEPROM_SETTINGS) + MENU_ITEM(function, MSG_STORE_EEPROM, lcd_store_settings); + MENU_ITEM(function, MSG_LOAD_EEPROM, lcd_load_settings); + #endif + #endif + + MENU_ITEM(submenu, MSG_DELTA_SETTINGS, lcd_delta_settings); + + #if ENABLED(DELTA_CALIBRATION_MENU) + MENU_ITEM(submenu, MSG_AUTO_HOME, _lcd_delta_calibrate_home); + if (all_axes_homed()) { + MENU_ITEM(submenu, MSG_DELTA_CALIBRATE_X, _goto_tower_x); + MENU_ITEM(submenu, MSG_DELTA_CALIBRATE_Y, _goto_tower_y); + MENU_ITEM(submenu, MSG_DELTA_CALIBRATE_Z, _goto_tower_z); + MENU_ITEM(submenu, MSG_DELTA_CALIBRATE_CENTER, _goto_center); + } + #endif + + END_MENU(); +} + +#endif // HAS_LCD_MENU && (DELTA_CALIBRATION_MENU || DELTA_AUTO_CALIBRATION) diff --git a/Marlin/src/lcd/menu/menu_filament.cpp b/Marlin/src/lcd/menu/menu_filament.cpp new file mode 100644 index 0000000000..b5938d0a98 --- /dev/null +++ b/Marlin/src/lcd/menu/menu_filament.cpp @@ -0,0 +1,517 @@ +/** + * 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 . + * + */ + +// +// Filament Change Menu +// + +#include "../../inc/MarlinConfigPre.h" + +#if HAS_LCD_MENU && ENABLED(ADVANCED_PAUSE_FEATURE) + +#include "menu.h" +#include "../../module/temperature.h" +#include "../../feature/pause.h" + +// +// Change Filament > Change/Unload/Load Filament +// +static AdvancedPauseMode _change_filament_temp_mode; // =ADVANCED_PAUSE_MODE_PAUSE_PRINT +static int8_t _change_filament_temp_extruder; // =0 + +inline PGM_P _change_filament_temp_command() { + switch (_change_filament_temp_mode) { + case ADVANCED_PAUSE_MODE_LOAD_FILAMENT: + return PSTR("M701 T%d"); + case ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT: + return _change_filament_temp_extruder >= 0 ? PSTR("M702 T%d") : PSTR("M702 ;%d"); + case ADVANCED_PAUSE_MODE_PAUSE_PRINT: + default: + return PSTR("M600 B0 T%d"); + } + return PSTR(MSG_FILAMENTCHANGE); +} + +static void _change_filament_temp(const uint16_t temperature) { + char cmd[11]; + sprintf_P(cmd, _change_filament_temp_command(), _change_filament_temp_extruder); + thermalManager.setTargetHotend(temperature, _change_filament_temp_extruder); + lcd_enqueue_command(cmd); +} +inline void _lcd_change_filament_temp_1_func() { _change_filament_temp(PREHEAT_1_TEMP_HOTEND); } +inline void _lcd_change_filament_temp_2_func() { _change_filament_temp(PREHEAT_2_TEMP_HOTEND); } +inline void _lcd_change_filament_temp_custom_cb() { _change_filament_temp(thermalManager.target_temperature[_change_filament_temp_extruder]); } + +static PGM_P change_filament_header(const AdvancedPauseMode mode) { + switch (mode) { + case ADVANCED_PAUSE_MODE_LOAD_FILAMENT: + return PSTR(MSG_FILAMENTLOAD); + case ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT: + return PSTR(MSG_FILAMENTUNLOAD); + default: break; + } + return PSTR(MSG_FILAMENTCHANGE); +} + +void _menu_temp_filament_op(const AdvancedPauseMode mode, const int8_t extruder) { + _change_filament_temp_mode = mode; + _change_filament_temp_extruder = extruder; + START_MENU(); + if (LCD_HEIGHT >= 4) STATIC_ITEM_P(change_filament_header(mode), true, true); + MENU_BACK(MSG_BACK); + MENU_ITEM(function, MSG_PREHEAT_1, _lcd_change_filament_temp_1_func); + MENU_ITEM(function, MSG_PREHEAT_2, _lcd_change_filament_temp_2_func); + uint16_t max_temp; + switch (extruder) { + default: max_temp = HEATER_0_MAXTEMP; + #if HOTENDS > 1 + case 1: max_temp = HEATER_1_MAXTEMP; break; + #if HOTENDS > 2 + case 2: max_temp = HEATER_2_MAXTEMP; break; + #if HOTENDS > 3 + case 3: max_temp = HEATER_3_MAXTEMP; break; + #if HOTENDS > 4 + case 4: max_temp = HEATER_4_MAXTEMP; break; + #if HOTENDS > 5 + case 5: max_temp = HEATER_5_MAXTEMP; break; + #endif + #endif + #endif + #endif + #endif + } + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_PREHEAT_CUSTOM, &thermalManager.target_temperature[_change_filament_temp_extruder], EXTRUDE_MINTEMP, max_temp - 15, _lcd_change_filament_temp_custom_cb); + END_MENU(); +} +void menu_temp_e0_filament_change() { _menu_temp_filament_op(ADVANCED_PAUSE_MODE_PAUSE_PRINT, 0); } +void menu_temp_e0_filament_load() { _menu_temp_filament_op(ADVANCED_PAUSE_MODE_LOAD_FILAMENT, 0); } +void menu_temp_e0_filament_unload() { _menu_temp_filament_op(ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT, 0); } +#if E_STEPPERS > 1 + void menu_temp_e1_filament_change() { _menu_temp_filament_op(ADVANCED_PAUSE_MODE_PAUSE_PRINT, 1); } + void menu_temp_e1_filament_load() { _menu_temp_filament_op(ADVANCED_PAUSE_MODE_LOAD_FILAMENT, 1); } + void menu_temp_e1_filament_unload() { _menu_temp_filament_op(ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT, 1); } + #if ENABLED(FILAMENT_UNLOAD_ALL_EXTRUDERS) + void menu_unload_filament_all_temp() { _menu_temp_filament_op(ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT, -1); } + #endif + #if E_STEPPERS > 2 + void menu_temp_e2_filament_change() { _menu_temp_filament_op(ADVANCED_PAUSE_MODE_PAUSE_PRINT, 2); } + void menu_temp_e2_filament_load() { _menu_temp_filament_op(ADVANCED_PAUSE_MODE_LOAD_FILAMENT, 2); } + void menu_temp_e2_filament_unload() { _menu_temp_filament_op(ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT, 2); } + #if E_STEPPERS > 3 + void menu_temp_e3_filament_change() { _menu_temp_filament_op(ADVANCED_PAUSE_MODE_PAUSE_PRINT, 3); } + void menu_temp_e3_filament_load() { _menu_temp_filament_op(ADVANCED_PAUSE_MODE_LOAD_FILAMENT, 3); } + void menu_temp_e3_filament_unload() { _menu_temp_filament_op(ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT, 3); } + #if E_STEPPERS > 4 + void menu_temp_e4_filament_change() { _menu_temp_filament_op(ADVANCED_PAUSE_MODE_PAUSE_PRINT, 4); } + void menu_temp_e4_filament_load() { _menu_temp_filament_op(ADVANCED_PAUSE_MODE_LOAD_FILAMENT, 4); } + void menu_temp_e4_filament_unload() { _menu_temp_filament_op(ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT, 4); } + #endif // E_STEPPERS > 4 + #endif // E_STEPPERS > 3 + #endif // E_STEPPERS > 2 +#endif // E_STEPPERS > 1 + +/** + * + * "Change Filament" submenu + * + */ +#if E_STEPPERS > 1 || ENABLED(FILAMENT_LOAD_UNLOAD_GCODES) + void menu_change_filament() { + START_MENU(); + MENU_BACK(MSG_MAIN); + + // Change filament + #if E_STEPPERS == 1 + PGM_P msg0 = PSTR(MSG_FILAMENTCHANGE); + if (thermalManager.targetTooColdToExtrude(active_extruder)) + MENU_ITEM_P(submenu, msg0, menu_temp_e0_filament_change); + else + MENU_ITEM_P(gcode, msg0, PSTR("M600 B0")); + #else + PGM_P msg0 = PSTR(MSG_FILAMENTCHANGE " " MSG_E1); + PGM_P msg1 = PSTR(MSG_FILAMENTCHANGE " " MSG_E2); + if (thermalManager.targetTooColdToExtrude(0)) + MENU_ITEM_P(submenu, msg0, menu_temp_e0_filament_change); + else + MENU_ITEM_P(gcode, msg0, PSTR("M600 B0 T0")); + if (thermalManager.targetTooColdToExtrude(1)) + MENU_ITEM_P(submenu, msg1, menu_temp_e1_filament_change); + else + MENU_ITEM_P(gcode, msg1, PSTR("M600 B0 T1")); + #if E_STEPPERS > 2 + PGM_P msg2 = PSTR(MSG_FILAMENTCHANGE " " MSG_E3); + if (thermalManager.targetTooColdToExtrude(2)) + MENU_ITEM_P(submenu, msg2, menu_temp_e2_filament_change); + else + MENU_ITEM_P(gcode, msg2, PSTR("M600 B0 T2")); + #if E_STEPPERS > 3 + PGM_P msg3 = PSTR(MSG_FILAMENTCHANGE " " MSG_E4); + if (thermalManager.targetTooColdToExtrude(3)) + MENU_ITEM_P(submenu, msg3, menu_temp_e3_filament_change); + else + MENU_ITEM_P(gcode, msg3, PSTR("M600 B0 T3")); + #if E_STEPPERS > 4 + PGM_P msg4 = PSTR(MSG_FILAMENTCHANGE " " MSG_E5); + if (thermalManager.targetTooColdToExtrude(4)) + MENU_ITEM_P(submenu, msg4, menu_temp_e4_filament_change); + else + MENU_ITEM_P(gcode, msg4, PSTR("M600 B0 T4")); + #if E_STEPPERS > 5 + PGM_P msg5 = PSTR(MSG_FILAMENTCHANGE " " MSG_E6); + if (thermalManager.targetTooColdToExtrude(5)) + MENU_ITEM_P(submenu, msg5, menu_temp_e5_filament_change); + else + MENU_ITEM_P(gcode, msg5, PSTR("M600 B0 T5")); + #endif // E_STEPPERS > 5 + #endif // E_STEPPERS > 4 + #endif // E_STEPPERS > 3 + #endif // E_STEPPERS > 2 + #endif // E_STEPPERS == 1 + + #if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES) + if (!printer_busy()) { + // Load filament + #if E_STEPPERS == 1 + PGM_P msg0 = PSTR(MSG_FILAMENTLOAD); + if (thermalManager.targetTooColdToExtrude(active_extruder)) + MENU_ITEM_P(submenu, msg0, menu_temp_e0_filament_load); + else + MENU_ITEM_P(gcode, msg0, PSTR("M701")); + #else + PGM_P msg0 = PSTR(MSG_FILAMENTLOAD " " MSG_E1); + PGM_P msg1 = PSTR(MSG_FILAMENTLOAD " " MSG_E2); + if (thermalManager.targetTooColdToExtrude(0)) + MENU_ITEM_P(submenu, msg0, menu_temp_e0_filament_load); + else + MENU_ITEM_P(gcode, msg0, PSTR("M701 T0")); + if (thermalManager.targetTooColdToExtrude(1)) + MENU_ITEM_P(submenu, msg1, menu_temp_e1_filament_load); + else + MENU_ITEM_P(gcode, msg1, PSTR("M701 T1")); + #if E_STEPPERS > 2 + PGM_P msg2 = PSTR(MSG_FILAMENTLOAD " " MSG_E3); + if (thermalManager.targetTooColdToExtrude(2)) + MENU_ITEM_P(submenu, msg2, menu_temp_e2_filament_load); + else + MENU_ITEM_P(gcode, msg2, PSTR("M701 T2")); + #if E_STEPPERS > 3 + PGM_P msg3 = PSTR(MSG_FILAMENTLOAD " " MSG_E4); + if (thermalManager.targetTooColdToExtrude(3)) + MENU_ITEM_P(submenu, msg3, menu_temp_e3_filament_load); + else + MENU_ITEM_P(gcode, msg3, PSTR("M701 T3")); + #if E_STEPPERS > 4 + PGM_P msg4 = PSTR(MSG_FILAMENTLOAD " " MSG_E5); + if (thermalManager.targetTooColdToExtrude(4)) + MENU_ITEM_P(submenu, msg4, menu_temp_e4_filament_load); + else + MENU_ITEM_P(gcode, msg4, PSTR("M701 T4")); + #if E_STEPPERS > 5 + PGM_P msg5 = PSTR(MSG_FILAMENTLOAD " " MSG_E6); + if (thermalManager.targetTooColdToExtrude(5)) + MENU_ITEM_P(submenu, msg5, menu_temp_e5_filament_load); + else + MENU_ITEM_P(gcode, msg5, PSTR("M701 T5")); + #endif // E_STEPPERS > 5 + #endif // E_STEPPERS > 4 + #endif // E_STEPPERS > 3 + #endif // E_STEPPERS > 2 + #endif // E_STEPPERS == 1 + + // Unload filament + #if E_STEPPERS == 1 + if (thermalManager.targetHotEnoughToExtrude(active_extruder)) + MENU_ITEM(gcode, MSG_FILAMENTUNLOAD, PSTR("M702")); + else + MENU_ITEM(submenu, MSG_FILAMENTUNLOAD, menu_temp_e0_filament_unload); + #else + #if ENABLED(FILAMENT_UNLOAD_ALL_EXTRUDERS) + if (thermalManager.targetHotEnoughToExtrude(0) + #if E_STEPPERS > 1 + && thermalManager.targetHotEnoughToExtrude(1) + #if E_STEPPERS > 2 + && thermalManager.targetHotEnoughToExtrude(2) + #if E_STEPPERS > 3 + && thermalManager.targetHotEnoughToExtrude(3) + #if E_STEPPERS > 4 + && thermalManager.targetHotEnoughToExtrude(4) + #if E_STEPPERS > 5 + && thermalManager.targetHotEnoughToExtrude(5) + #endif // E_STEPPERS > 5 + #endif // E_STEPPERS > 4 + #endif // E_STEPPERS > 3 + #endif // E_STEPPERS > 2 + #endif // E_STEPPERS > 1 + ) + MENU_ITEM(gcode, MSG_FILAMENTUNLOAD_ALL, PSTR("M702")); + else + MENU_ITEM(submenu, MSG_FILAMENTUNLOAD_ALL, menu_unload_filament_all_temp); + #endif + if (thermalManager.targetHotEnoughToExtrude(0)) + MENU_ITEM(gcode, MSG_FILAMENTUNLOAD " " MSG_E1, PSTR("M702 T0")); + else + MENU_ITEM(submenu, MSG_FILAMENTUNLOAD " " MSG_E1, menu_temp_e0_filament_unload); + if (thermalManager.targetHotEnoughToExtrude(1)) + MENU_ITEM(gcode, MSG_FILAMENTUNLOAD " " MSG_E2, PSTR("M702 T1")); + else + MENU_ITEM(submenu, MSG_FILAMENTUNLOAD " " MSG_E2, menu_temp_e1_filament_unload); + #if E_STEPPERS > 2 + if (thermalManager.targetHotEnoughToExtrude(2)) + MENU_ITEM(gcode, MSG_FILAMENTUNLOAD " " MSG_E3, PSTR("M702 T2")); + else + MENU_ITEM(submenu, MSG_FILAMENTUNLOAD " " MSG_E3, menu_temp_e2_filament_unload); + #if E_STEPPERS > 3 + if (thermalManager.targetHotEnoughToExtrude(3)) + MENU_ITEM(gcode, MSG_FILAMENTUNLOAD " " MSG_E4, PSTR("M702 T3")); + else + MENU_ITEM(submenu, MSG_FILAMENTUNLOAD " " MSG_E4, menu_temp_e3_filament_unload); + #if E_STEPPERS > 4 + if (thermalManager.targetHotEnoughToExtrude(4)) + MENU_ITEM(gcode, MSG_FILAMENTUNLOAD " " MSG_E5, PSTR("M702 T4")); + else + MENU_ITEM(submenu, MSG_FILAMENTUNLOAD " " MSG_E5, menu_temp_e4_filament_unload); + #if E_STEPPERS > 5 + if (thermalManager.targetHotEnoughToExtrude(5)) + MENU_ITEM(gcode, MSG_FILAMENTUNLOAD " " MSG_E6, PSTR("M702 T5")); + else + MENU_ITEM(submenu, MSG_FILAMENTUNLOAD " " MSG_E6, menu_temp_e5_filament_unload); + #endif // E_STEPPERS > 5 + #endif // E_STEPPERS > 4 + #endif // E_STEPPERS > 3 + #endif // E_STEPPERS > 2 + #endif // E_STEPPERS == 1 + } + #endif + + END_MENU(); + } +#endif + +static AdvancedPauseMode advanced_pause_mode = ADVANCED_PAUSE_MODE_PAUSE_PRINT; +static uint8_t hotend_status_extruder = 0; + +static PGM_P advanced_pause_header() { + switch (advanced_pause_mode) { + case ADVANCED_PAUSE_MODE_LOAD_FILAMENT: + return PSTR(MSG_FILAMENT_CHANGE_HEADER_LOAD); + case ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT: + return PSTR(MSG_FILAMENT_CHANGE_HEADER_UNLOAD); + default: break; + } + return PSTR(MSG_FILAMENT_CHANGE_HEADER_PAUSE); +} + +// Portions from STATIC_ITEM... +#define HOTEND_STATUS_ITEM() do { \ + if (_menuLineNr == _thisItemNr) { \ + if (ui.should_draw()) { \ + draw_menu_item_static(_lcdLineNr, PSTR(MSG_FILAMENT_CHANGE_NOZZLE), false, true); \ + ui.draw_hotend_status(_lcdLineNr, hotend_status_extruder); \ + } \ + if (_skipStatic && encoderLine <= _thisItemNr) { \ + ui.encoderPosition += ENCODER_STEPS_PER_MENU_ITEM; \ + ++encoderLine; \ + } \ + ui.refresh(LCDVIEW_CALL_REDRAW_NEXT); \ + } \ + ++_thisItemNr; \ +}while(0) + +void lcd_advanced_pause_resume_print() { + advanced_pause_menu_response = ADVANCED_PAUSE_RESPONSE_RESUME_PRINT; +} + +void lcd_advanced_pause_extrude_more() { + advanced_pause_menu_response = ADVANCED_PAUSE_RESPONSE_EXTRUDE_MORE; +} + +void menu_advanced_pause_option() { + START_MENU(); + #if LCD_HEIGHT > 2 + STATIC_ITEM(MSG_FILAMENT_CHANGE_OPTION_HEADER, true, false); + #endif + MENU_ITEM(function, MSG_FILAMENT_CHANGE_OPTION_RESUME, lcd_advanced_pause_resume_print); + MENU_ITEM(function, MSG_FILAMENT_CHANGE_OPTION_PURGE, lcd_advanced_pause_extrude_more); + END_MENU(); +} + +// +// ADVANCED_PAUSE_FEATURE message screens +// + +void _lcd_advanced_pause_message(PGM_P const msg1, PGM_P const msg2=NULL, PGM_P const msg3=NULL) { + START_SCREEN(); + STATIC_ITEM_P(advanced_pause_header(), true, true); + STATIC_ITEM_P(msg1); + if (msg2) STATIC_ITEM_P(msg2); + if (msg3) STATIC_ITEM_P(msg3); + if ((!!msg2) + (!!msg3) + 2 < LCD_HEIGHT - 1) STATIC_ITEM(" "); + HOTEND_STATUS_ITEM(); + END_SCREEN(); +} + +void lcd_advanced_pause_init_message() { + _lcd_advanced_pause_message(PSTR(MSG_FILAMENT_CHANGE_INIT_1) + #ifdef MSG_FILAMENT_CHANGE_INIT_2 + , PSTR(MSG_FILAMENT_CHANGE_INIT_2) + #ifdef MSG_FILAMENT_CHANGE_INIT_3 + , PSTR(MSG_FILAMENT_CHANGE_INIT_3) + #endif + #endif + ); +} + +void lcd_advanced_pause_unload_message() { + _lcd_advanced_pause_message(PSTR(MSG_FILAMENT_CHANGE_UNLOAD_1) + #ifdef MSG_FILAMENT_CHANGE_UNLOAD_2 + , PSTR(MSG_FILAMENT_CHANGE_UNLOAD_2) + #ifdef MSG_FILAMENT_CHANGE_UNLOAD_3 + , PSTR(MSG_FILAMENT_CHANGE_UNLOAD_3) + #endif + #endif + ); +} + +void lcd_advanced_pause_heating_message() { + _lcd_advanced_pause_message(PSTR(MSG_FILAMENT_CHANGE_HEATING_1) + #ifdef MSG_FILAMENT_CHANGE_HEATING_2 + , PSTR(MSG_FILAMENT_CHANGE_HEATING_2) + #ifdef MSG_FILAMENT_CHANGE_HEATING_3 + , PSTR(MSG_FILAMENT_CHANGE_HEATING_3) + #endif + #endif + ); +} + +void lcd_advanced_pause_heat_message() { + _lcd_advanced_pause_message(PSTR(MSG_FILAMENT_CHANGE_HEAT_1) + #ifdef MSG_FILAMENT_CHANGE_HEAT_2 + , PSTR(MSG_FILAMENT_CHANGE_HEAT_2) + #ifdef MSG_FILAMENT_CHANGE_HEAT_3 + , PSTR(MSG_FILAMENT_CHANGE_HEAT_3) + #endif + #endif + ); +} + +void lcd_advanced_pause_insert_message() { + _lcd_advanced_pause_message(PSTR(MSG_FILAMENT_CHANGE_INSERT_1) + #ifdef MSG_FILAMENT_CHANGE_INSERT_2 + , PSTR(MSG_FILAMENT_CHANGE_INSERT_2) + #ifdef MSG_FILAMENT_CHANGE_INSERT_3 + , PSTR(MSG_FILAMENT_CHANGE_INSERT_3) + #endif + #endif + ); +} + +void lcd_advanced_pause_load_message() { + _lcd_advanced_pause_message(PSTR(MSG_FILAMENT_CHANGE_LOAD_1) + #ifdef MSG_FILAMENT_CHANGE_LOAD_2 + , PSTR(MSG_FILAMENT_CHANGE_LOAD_2) + #ifdef MSG_FILAMENT_CHANGE_LOAD_3 + , PSTR(MSG_FILAMENT_CHANGE_LOAD_3) + #endif + #endif + ); +} + +void lcd_advanced_pause_waiting_message() { + _lcd_advanced_pause_message(PSTR(MSG_ADVANCED_PAUSE_WAITING_1) + #ifdef MSG_ADVANCED_PAUSE_WAITING_2 + , PSTR(MSG_ADVANCED_PAUSE_WAITING_2) + #ifdef MSG_ADVANCED_PAUSE_WAITING_3 + , PSTR(MSG_ADVANCED_PAUSE_WAITING_3) + #endif + #endif + ); +} + +void lcd_advanced_pause_resume_message() { + _lcd_advanced_pause_message(PSTR(MSG_FILAMENT_CHANGE_RESUME_1) + #ifdef MSG_FILAMENT_CHANGE_RESUME_2 + , PSTR(MSG_FILAMENT_CHANGE_RESUME_2) + #ifdef MSG_FILAMENT_CHANGE_RESUME_3 + , PSTR(MSG_FILAMENT_CHANGE_RESUME_3) + #endif + #endif + ); +} + +void lcd_advanced_pause_purge_message() { + _lcd_advanced_pause_message( + #if ENABLED(ADVANCED_PAUSE_CONTINUOUS_PURGE) + PSTR(MSG_FILAMENT_CHANGE_CONT_PURGE_1) + #ifdef MSG_FILAMENT_CHANGE_CONT_PURGE_2 + , PSTR(MSG_FILAMENT_CHANGE_CONT_PURGE_2) + #ifdef MSG_FILAMENT_CHANGE_CONT_PURGE_3 + , PSTR(MSG_FILAMENT_CHANGE_CONT_PURGE_3) + #endif + #endif + #else + PSTR(MSG_FILAMENT_CHANGE_PURGE_1) + #ifdef MSG_FILAMENT_CHANGE_PURGE_2 + , PSTR(MSG_FILAMENT_CHANGE_PURGE_2) + #ifdef MSG_FILAMENT_CHANGE_PURGE_3 + , PSTR(MSG_FILAMENT_CHANGE_PURGE_3) + #endif + #endif + #endif + ); +} + +FORCE_INLINE screenFunc_t ap_message_screen(const AdvancedPauseMessage message) { + switch (message) { + case ADVANCED_PAUSE_MESSAGE_INIT: return lcd_advanced_pause_init_message; + case ADVANCED_PAUSE_MESSAGE_UNLOAD: return lcd_advanced_pause_unload_message; + case ADVANCED_PAUSE_MESSAGE_WAITING: return lcd_advanced_pause_waiting_message; + case ADVANCED_PAUSE_MESSAGE_INSERT: return lcd_advanced_pause_insert_message; + case ADVANCED_PAUSE_MESSAGE_LOAD: return lcd_advanced_pause_load_message; + case ADVANCED_PAUSE_MESSAGE_PURGE: return lcd_advanced_pause_purge_message; + case ADVANCED_PAUSE_MESSAGE_RESUME: return lcd_advanced_pause_resume_message; + case ADVANCED_PAUSE_MESSAGE_HEAT: return lcd_advanced_pause_heat_message; + case ADVANCED_PAUSE_MESSAGE_HEATING: return lcd_advanced_pause_heating_message; + case ADVANCED_PAUSE_MESSAGE_OPTION: advanced_pause_menu_response = ADVANCED_PAUSE_RESPONSE_WAIT_FOR; + return menu_advanced_pause_option; + case ADVANCED_PAUSE_MESSAGE_STATUS: + default: break; + } + return NULL; +} + +void lcd_advanced_pause_show_message( + const AdvancedPauseMessage message, + const AdvancedPauseMode mode/*=ADVANCED_PAUSE_MODE_SAME*/, + const uint8_t extruder/*=active_extruder*/ +) { + if (mode != ADVANCED_PAUSE_MODE_SAME) advanced_pause_mode = mode; + hotend_status_extruder = extruder; + const screenFunc_t next_screen = ap_message_screen(message); + if (next_screen) { + ui.defer_status_screen(true); + ui.goto_screen(next_screen); + } + else + ui.return_to_status(); +} + +#endif // HAS_LCD_MENU && ADVANCED_PAUSE_FEATURE diff --git a/Marlin/src/lcd/menu/menu_info.cpp b/Marlin/src/lcd/menu/menu_info.cpp new file mode 100644 index 0000000000..3bd7054cdc --- /dev/null +++ b/Marlin/src/lcd/menu/menu_info.cpp @@ -0,0 +1,198 @@ +/** + * 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 . + * + */ + +// +// Info Menu +// + +#include "../../inc/MarlinConfigPre.h" + +#if HAS_LCD_MENU && ENABLED(LCD_INFO_MENU) + +#include "menu.h" +// #include "../../module/motion.h" +// #include "../../module/planner.h" +// #include "../../module/temperature.h" +// #include "../../Marlin.h" + +// #if HAS_LEVELING +// #include "../../feature/bedlevel/bedlevel.h" +// #endif + + +#if ENABLED(PRINTCOUNTER) + + #include "../../module/printcounter.h" + + // + // About Printer > Printer Stats + // + void menu_info_stats() { + if (ui.use_click()) return ui.goto_previous_screen(); + + char buffer[21]; + printStatistics stats = print_job_timer.getStats(); + + START_SCREEN(); // 12345678901234567890 + STATIC_ITEM(MSG_INFO_PRINT_COUNT ": ", false, false, itostr3left(stats.totalPrints)); // Print Count: 999 + STATIC_ITEM(MSG_INFO_COMPLETED_PRINTS": ", false, false, itostr3left(stats.finishedPrints)); // Completed : 666 + + duration_t elapsed = stats.printTime; + elapsed.toString(buffer); + + STATIC_ITEM(MSG_INFO_PRINT_TIME ": ", false, false); // Total print Time: + STATIC_ITEM("", false, false, buffer); // 99y 364d 23h 59m 59s + + elapsed = stats.longestPrint; + elapsed.toString(buffer); + + STATIC_ITEM(MSG_INFO_PRINT_LONGEST ": ", false, false); // Longest job time: + STATIC_ITEM("", false, false, buffer); // 99y 364d 23h 59m 59s + + sprintf_P(buffer, PSTR("%ld.%im"), long(stats.filamentUsed / 1000), int16_t(stats.filamentUsed / 100) % 10); + STATIC_ITEM(MSG_INFO_PRINT_FILAMENT ": ", false, false); // Extruded total: + STATIC_ITEM("", false, false, buffer); // 125m + END_SCREEN(); + } + +#endif + +// +// About Printer > Thermistors +// +void menu_info_thermistors() { + if (ui.use_click()) return ui.goto_previous_screen(); + START_SCREEN(); + #define THERMISTOR_ID TEMP_SENSOR_0 + #include "../thermistornames.h" + STATIC_ITEM("T0: " THERMISTOR_NAME, false, true); + STATIC_ITEM(MSG_INFO_MIN_TEMP ": " STRINGIFY(HEATER_0_MINTEMP), false); + STATIC_ITEM(MSG_INFO_MAX_TEMP ": " STRINGIFY(HEATER_0_MAXTEMP), false); + + #if TEMP_SENSOR_1 != 0 + #undef THERMISTOR_ID + #define THERMISTOR_ID TEMP_SENSOR_1 + #include "../thermistornames.h" + STATIC_ITEM("T1: " THERMISTOR_NAME, false, true); + STATIC_ITEM(MSG_INFO_MIN_TEMP ": " STRINGIFY(HEATER_1_MINTEMP), false); + STATIC_ITEM(MSG_INFO_MAX_TEMP ": " STRINGIFY(HEATER_1_MAXTEMP), false); + #endif + + #if TEMP_SENSOR_2 != 0 + #undef THERMISTOR_ID + #define THERMISTOR_ID TEMP_SENSOR_2 + #include "../thermistornames.h" + STATIC_ITEM("T2: " THERMISTOR_NAME, false, true); + STATIC_ITEM(MSG_INFO_MIN_TEMP ": " STRINGIFY(HEATER_2_MINTEMP), false); + STATIC_ITEM(MSG_INFO_MAX_TEMP ": " STRINGIFY(HEATER_2_MAXTEMP), false); + #endif + + #if TEMP_SENSOR_3 != 0 + #undef THERMISTOR_ID + #define THERMISTOR_ID TEMP_SENSOR_3 + #include "../thermistornames.h" + STATIC_ITEM("T3: " THERMISTOR_NAME, false, true); + STATIC_ITEM(MSG_INFO_MIN_TEMP ": " STRINGIFY(HEATER_3_MINTEMP), false); + STATIC_ITEM(MSG_INFO_MAX_TEMP ": " STRINGIFY(HEATER_3_MAXTEMP), false); + #endif + + #if TEMP_SENSOR_4 != 0 + #undef THERMISTOR_ID + #define THERMISTOR_ID TEMP_SENSOR_4 + #include "../thermistornames.h" + STATIC_ITEM("T4: " THERMISTOR_NAME, false, true); + STATIC_ITEM(MSG_INFO_MIN_TEMP ": " STRINGIFY(HEATER_4_MINTEMP), false); + STATIC_ITEM(MSG_INFO_MAX_TEMP ": " STRINGIFY(HEATER_4_MAXTEMP), false); + #endif + + #if HAS_HEATED_BED + #undef THERMISTOR_ID + #define THERMISTOR_ID TEMP_SENSOR_BED + #include "../thermistornames.h" + STATIC_ITEM("TBed:" THERMISTOR_NAME, false, true); + STATIC_ITEM(MSG_INFO_MIN_TEMP ": " STRINGIFY(BED_MINTEMP), false); + STATIC_ITEM(MSG_INFO_MAX_TEMP ": " STRINGIFY(BED_MAXTEMP), false); + #endif + END_SCREEN(); +} + +// +// About Printer > Board Info +// +void menu_info_board() { + if (ui.use_click()) return ui.goto_previous_screen(); + START_SCREEN(); + STATIC_ITEM(BOARD_NAME, true, true); // MyPrinterController + STATIC_ITEM(MSG_INFO_BAUDRATE ": " STRINGIFY(BAUDRATE), true); // Baud: 250000 + STATIC_ITEM(MSG_INFO_PROTOCOL ": " PROTOCOL_VERSION, true); // Protocol: 1.0 + #if POWER_SUPPLY == 0 + STATIC_ITEM(MSG_INFO_PSU ": Generic", true); + #elif POWER_SUPPLY == 1 + STATIC_ITEM(MSG_INFO_PSU ": ATX", true); // Power Supply: ATX + #elif POWER_SUPPLY == 2 + STATIC_ITEM(MSG_INFO_PSU ": XBox", true); // Power Supply: XBox + #endif + END_SCREEN(); +} + +// +// About Printer > Printer Info +// +void menu_info_printer() { + if (ui.use_click()) return ui.goto_previous_screen(); + START_SCREEN(); + STATIC_ITEM(MSG_MARLIN, true, true); // Marlin + STATIC_ITEM(SHORT_BUILD_VERSION, true); // x.x.x-Branch + STATIC_ITEM(STRING_DISTRIBUTION_DATE, true); // YYYY-MM-DD HH:MM + STATIC_ITEM(MACHINE_NAME, true); // My3DPrinter + STATIC_ITEM(WEBSITE_URL, true); // www.my3dprinter.com + STATIC_ITEM(MSG_INFO_EXTRUDERS ": " STRINGIFY(EXTRUDERS), true); // Extruders: 2 + #if ENABLED(AUTO_BED_LEVELING_3POINT) + STATIC_ITEM(MSG_3POINT_LEVELING, true); // 3-Point Leveling + #elif ENABLED(AUTO_BED_LEVELING_LINEAR) + STATIC_ITEM(MSG_LINEAR_LEVELING, true); // Linear Leveling + #elif ENABLED(AUTO_BED_LEVELING_BILINEAR) + STATIC_ITEM(MSG_BILINEAR_LEVELING, true); // Bi-linear Leveling + #elif ENABLED(AUTO_BED_LEVELING_UBL) + STATIC_ITEM(MSG_UBL_LEVELING, true); // Unified Bed Leveling + #elif ENABLED(MESH_BED_LEVELING) + STATIC_ITEM(MSG_MESH_LEVELING, true); // Mesh Leveling + #endif + END_SCREEN(); +} + +// +// "About Printer" submenu +// +void menu_info() { + START_MENU(); + MENU_BACK(MSG_MAIN); + MENU_ITEM(submenu, MSG_INFO_PRINTER_MENU, menu_info_printer); // Printer Info > + MENU_ITEM(submenu, MSG_INFO_BOARD_MENU, menu_info_board); // Board Info > + MENU_ITEM(submenu, MSG_INFO_THERMISTOR_MENU, menu_info_thermistors); // Thermistors > + #if ENABLED(PRINTCOUNTER) + MENU_ITEM(submenu, MSG_INFO_STATS_MENU, menu_info_stats); // Printer Stats > + #endif + END_MENU(); +} + +#endif // HAS_LCD_MENU && LCD_INFO_MENU diff --git a/Marlin/src/lcd/menu/menu_job_recovery.cpp b/Marlin/src/lcd/menu/menu_job_recovery.cpp new file mode 100644 index 0000000000..18063b224a --- /dev/null +++ b/Marlin/src/lcd/menu/menu_job_recovery.cpp @@ -0,0 +1,56 @@ +/** + * 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 . + * + */ + +// +// Job Recovery Menu +// + +#include "../../inc/MarlinConfigPre.h" + +#if HAS_LCD_MENU && ENABLED(POWER_LOSS_RECOVERY) + +#include "menu.h" +#include "../../gcode/queue.h" +#include "../../sd/cardreader.h" +#include "../../feature/power_loss_recovery.h" + +static void lcd_power_loss_recovery_resume() { + ui.return_to_status(); + enqueue_and_echo_commands_P(PSTR("M1000")); +} + +static void lcd_power_loss_recovery_cancel() { + card.removeJobRecoveryFile(); + card.autostart_index = 0; + ui.return_to_status(); +} + +void menu_job_recovery() { + ui.defer_status_screen(true); + START_MENU(); + STATIC_ITEM(MSG_OUTAGE_RECOVERY); + MENU_ITEM(function, MSG_RESUME_PRINT, lcd_power_loss_recovery_resume); + MENU_ITEM(function, MSG_STOP_PRINT, lcd_power_loss_recovery_cancel); + END_MENU(); +} + +#endif // HAS_LCD_MENU && POWER_LOSS_RECOVERY diff --git a/Marlin/src/lcd/menu/menu_led.cpp b/Marlin/src/lcd/menu/menu_led.cpp new file mode 100644 index 0000000000..d85fe338fb --- /dev/null +++ b/Marlin/src/lcd/menu/menu_led.cpp @@ -0,0 +1,83 @@ +/** + * 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 . + * + */ + +// +// LED Menu +// + +#include "../../inc/MarlinConfigPre.h" + +#if HAS_LCD_MENU && ENABLED(LED_CONTROL_MENU) + +#include "menu.h" +#include "../../feature/leds/leds.h" + +#if ENABLED(LED_COLOR_PRESETS) + + void menu_led_presets() { + START_MENU(); + #if LCD_HEIGHT > 2 + STATIC_ITEM(MSG_LED_PRESETS, true, true); + #endif + MENU_BACK(MSG_LED_CONTROL); + MENU_ITEM(function, MSG_SET_LEDS_WHITE, leds.set_white); + MENU_ITEM(function, MSG_SET_LEDS_RED, leds.set_red); + MENU_ITEM(function, MSG_SET_LEDS_ORANGE, leds.set_orange); + MENU_ITEM(function, MSG_SET_LEDS_YELLOW,leds.set_yellow); + MENU_ITEM(function, MSG_SET_LEDS_GREEN, leds.set_green); + MENU_ITEM(function, MSG_SET_LEDS_BLUE, leds.set_blue); + MENU_ITEM(function, MSG_SET_LEDS_INDIGO, leds.set_indigo); + MENU_ITEM(function, MSG_SET_LEDS_VIOLET, leds.set_violet); + END_MENU(); + } + +#endif + +void menu_led_custom() { + START_MENU(); + MENU_BACK(MSG_LED_CONTROL); + MENU_ITEM_EDIT_CALLBACK(int8, MSG_INTENSITY_R, &leds.color.r, 0, 255, leds.update, true); + MENU_ITEM_EDIT_CALLBACK(int8, MSG_INTENSITY_G, &leds.color.g, 0, 255, leds.update, true); + MENU_ITEM_EDIT_CALLBACK(int8, MSG_INTENSITY_B, &leds.color.b, 0, 255, leds.update, true); + #if ENABLED(RGBW_LED) || ENABLED(NEOPIXEL_LED) + MENU_ITEM_EDIT_CALLBACK(int8, MSG_INTENSITY_W, &leds.color.w, 0, 255, leds.update, true); + #if ENABLED(NEOPIXEL_LED) + MENU_ITEM_EDIT_CALLBACK(int8, MSG_LED_BRIGHTNESS, &leds.color.i, 0, 255, leds.update, true); + #endif + #endif + END_MENU(); +} + +void menu_led() { + START_MENU(); + MENU_BACK(MSG_MAIN); + bool led_on = leds.lights_on; + MENU_ITEM_EDIT_CALLBACK(bool, MSG_LEDS, &led_on, leds.toggle); + MENU_ITEM(function, MSG_SET_LEDS_DEFAULT, leds.set_default); + #if ENABLED(LED_COLOR_PRESETS) + MENU_ITEM(submenu, MSG_LED_PRESETS, menu_led_presets); + #endif + MENU_ITEM(submenu, MSG_CUSTOM_LEDS, menu_led_custom); + END_MENU(); +} + +#endif // HAS_LCD_MENU && LED_CONTROL_MENU diff --git a/Marlin/src/lcd/menu/menu_main.cpp b/Marlin/src/lcd/menu/menu_main.cpp new file mode 100644 index 0000000000..e7665bba46 --- /dev/null +++ b/Marlin/src/lcd/menu/menu_main.cpp @@ -0,0 +1,160 @@ +/** + * 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 . + * + */ + +// +// Main Menu +// + +#include "../../inc/MarlinConfigPre.h" + +#if HAS_LCD_MENU + +#include "menu.h" +#include "../../module/temperature.h" + +#if ENABLED(SDSUPPORT) + + #include "../../sd/cardreader.h" + #include "../../gcode/queue.h" + #include "../../module/printcounter.h" + + void lcd_sdcard_pause() { + card.pauseSDPrint(); + print_job_timer.pause(); + #if ENABLED(PARK_HEAD_ON_PAUSE) + enqueue_and_echo_commands_P(PSTR("M125")); + #endif + ui.reset_status(); + } + + void lcd_sdcard_resume() { + #if ENABLED(PARK_HEAD_ON_PAUSE) + enqueue_and_echo_commands_P(PSTR("M24")); + #else + card.startFileprint(); + print_job_timer.start(); + #endif + ui.reset_status(); + } + + void lcd_sdcard_stop() { + wait_for_heatup = wait_for_user = false; + card.flag.abort_sd_printing = true; + ui.set_status_P(PSTR(MSG_PRINT_ABORTED), -1); + ui.return_to_status(); + } + +#endif // SDSUPPORT + +void menu_tune(); +void menu_motion(); +void menu_temperature(); +void menu_configuration(); +void menu_user(); +void menu_temp_e0_filament_change(); +void menu_change_filament(); +void menu_info(); +void menu_led(); + +void menu_main() { + START_MENU(); + MENU_BACK(MSG_WATCH); + + #if ENABLED(SDSUPPORT) + if (card.flag.cardOK) { + if (card.isFileOpen()) { + if (IS_SD_PRINTING()) + MENU_ITEM(function, MSG_PAUSE_PRINT, lcd_sdcard_pause); + else + MENU_ITEM(function, MSG_RESUME_PRINT, lcd_sdcard_resume); + MENU_ITEM(function, MSG_STOP_PRINT, lcd_sdcard_stop); + } + else { + MENU_ITEM(submenu, MSG_CARD_MENU, menu_sdcard); + #if !PIN_EXISTS(SD_DETECT) + MENU_ITEM(gcode, MSG_CHANGE_SDCARD, PSTR("M21")); // SD-card changed by user + #endif + } + } + else { + MENU_ITEM(submenu, MSG_NO_CARD, menu_sdcard); + #if !PIN_EXISTS(SD_DETECT) + MENU_ITEM(gcode, MSG_INIT_SDCARD, PSTR("M21")); // Manually initialize the SD-card via user interface + #endif + } + #endif // SDSUPPORT + + const bool busy = printer_busy(); + if (busy) + MENU_ITEM(submenu, MSG_TUNE, menu_tune); + else { + MENU_ITEM(submenu, MSG_MOTION, menu_motion); + MENU_ITEM(submenu, MSG_TEMPERATURE, menu_temperature); + } + + MENU_ITEM(submenu, MSG_CONFIGURATION, menu_configuration); + + #if ENABLED(CUSTOM_USER_MENUS) + MENU_ITEM(submenu, MSG_USER_MENU, menu_user); + #endif + + #if ENABLED(ADVANCED_PAUSE_FEATURE) + #if E_STEPPERS == 1 && DISABLED(FILAMENT_LOAD_UNLOAD_GCODES) + if (thermalManager.targetHotEnoughToExtrude(active_extruder)) + MENU_ITEM(gcode, MSG_FILAMENTCHANGE, PSTR("M600 B0")); + else + MENU_ITEM(submenu, MSG_FILAMENTCHANGE, menu_temp_e0_filament_change); + #else + MENU_ITEM(submenu, MSG_FILAMENTCHANGE, menu_change_filament); + #endif + #endif + + #if ENABLED(LCD_INFO_MENU) + MENU_ITEM(submenu, MSG_INFO_MENU, menu_info); + #endif + + #if ENABLED(LED_CONTROL_MENU) + MENU_ITEM(submenu, MSG_LED_CONTROL, menu_led); + #endif + + // + // Switch power on/off + // + #if HAS_POWER_SWITCH + if (powersupply_on) + MENU_ITEM(gcode, MSG_SWITCH_PS_OFF, PSTR("M81")); + else + MENU_ITEM(gcode, MSG_SWITCH_PS_ON, PSTR("M80")); + #endif + + // + // Autostart + // + #if ENABLED(SDSUPPORT) && ENABLED(MENU_ADDAUTOSTART) + if (!busy) + MENU_ITEM(function, MSG_AUTOSTART, card.beginautostart); + #endif + + END_MENU(); +} + +#endif // HAS_LCD_MENU diff --git a/Marlin/src/lcd/menu/menu_motion.cpp b/Marlin/src/lcd/menu/menu_motion.cpp new file mode 100644 index 0000000000..e4c29ad18c --- /dev/null +++ b/Marlin/src/lcd/menu/menu_motion.cpp @@ -0,0 +1,500 @@ +/** + * 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 . + * + */ + +// +// Motion Menu +// + +#include "../../inc/MarlinConfigPre.h" + +#if HAS_LCD_MENU + +#include "menu.h" +#include "../../module/motion.h" + +#if ENABLED(DELTA) + #include "../../module/delta.h" +#endif + +#if ENABLED(PREVENT_COLD_EXTRUSION) + #include "../../module/temperature.h" +#endif + +#if HAS_LEVELING + #include "../../module/planner.h" + #include "../../feature/bedlevel/bedlevel.h" +#endif + +extern millis_t manual_move_start_time; +extern int8_t manual_move_axis; +#if ENABLED(MANUAL_E_MOVES_RELATIVE) + float manual_move_e_origin = 0; +#endif +#if IS_KINEMATIC + extern float manual_move_offset; +#endif + +// +// Tell ui.update() to start a move to current_position" after a short delay. +// +inline void manual_move_to_current(AxisEnum axis + #if E_MANUAL > 1 + , const int8_t eindex=-1 + #endif +) { + #if E_MANUAL > 1 + if (axis == E_AXIS) ui.manual_move_e_index = eindex >= 0 ? eindex : active_extruder; + #endif + manual_move_start_time = millis() + (move_menu_scale < 0.99f ? 0UL : 250UL); // delay for bigger moves + manual_move_axis = (int8_t)axis; +} + +// +// "Motion" > "Move Axis" submenu +// + +static void _lcd_move_xyz(PGM_P name, AxisEnum axis) { + if (ui.use_click()) return ui.goto_previous_screen_no_defer(); + ui.encoder_direction_normal(); + if (ui.encoderPosition && !ui.processing_manual_move) { + + // Start with no limits to movement + float min = current_position[axis] - 1000, + max = current_position[axis] + 1000; + + // Limit to software endstops, if enabled + #if HAS_SOFTWARE_ENDSTOPS + if (soft_endstops_enabled) switch (axis) { + case X_AXIS: + #if ENABLED(MIN_SOFTWARE_ENDSTOP_X) + min = soft_endstop_min[X_AXIS]; + #endif + #if ENABLED(MAX_SOFTWARE_ENDSTOP_X) + max = soft_endstop_max[X_AXIS]; + #endif + break; + case Y_AXIS: + #if ENABLED(MIN_SOFTWARE_ENDSTOP_Y) + min = soft_endstop_min[Y_AXIS]; + #endif + #if ENABLED(MAX_SOFTWARE_ENDSTOP_Y) + max = soft_endstop_max[Y_AXIS]; + #endif + break; + case Z_AXIS: + #if ENABLED(MIN_SOFTWARE_ENDSTOP_Z) + min = soft_endstop_min[Z_AXIS]; + #endif + #if ENABLED(MAX_SOFTWARE_ENDSTOP_Z) + max = soft_endstop_max[Z_AXIS]; + #endif + default: break; + } + #endif // HAS_SOFTWARE_ENDSTOPS + + // Delta limits XY based on the current offset from center + // This assumes the center is 0,0 + #if ENABLED(DELTA) + if (axis != Z_AXIS) { + max = SQRT(sq((float)(DELTA_PRINTABLE_RADIUS)) - sq(current_position[Y_AXIS - axis])); // (Y_AXIS - axis) == the other axis + min = -max; + } + #endif + + // Get the new position + const float diff = float((int32_t)ui.encoderPosition) * move_menu_scale; + #if IS_KINEMATIC + manual_move_offset += diff; + if ((int32_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) + NOLESS(current_position[axis], min); + else + NOMORE(current_position[axis], max); + #endif + + manual_move_to_current(axis); + ui.refresh(LCDVIEW_REDRAW_NOW); + } + ui.encoderPosition = 0; + if (ui.should_draw()) { + const float pos = NATIVE_TO_LOGICAL(ui.processing_manual_move ? destination[axis] : current_position[axis] + #if IS_KINEMATIC + + manual_move_offset + #endif + , axis); + draw_edit_screen(name, move_menu_scale >= 0.1f ? ftostr41sign(pos) : ftostr43sign(pos)); + } +} +void lcd_move_x() { _lcd_move_xyz(PSTR(MSG_MOVE_X), X_AXIS); } +void lcd_move_y() { _lcd_move_xyz(PSTR(MSG_MOVE_Y), Y_AXIS); } +void lcd_move_z() { _lcd_move_xyz(PSTR(MSG_MOVE_Z), Z_AXIS); } +static void _lcd_move_e( + #if E_MANUAL > 1 + const int8_t eindex=-1 + #endif +) { + if (ui.use_click()) return ui.goto_previous_screen_no_defer(); + ui.encoder_direction_normal(); + if (ui.encoderPosition) { + if (!ui.processing_manual_move) { + const float diff = float((int32_t)ui.encoderPosition) * move_menu_scale; + #if IS_KINEMATIC + manual_move_offset += diff; + #else + current_position[E_AXIS] += diff; + #endif + manual_move_to_current(E_AXIS + #if E_MANUAL > 1 + , eindex + #endif + ); + ui.refresh(LCDVIEW_REDRAW_NOW); + } + ui.encoderPosition = 0; + } + if (ui.should_draw()) { + PGM_P pos_label; + #if E_MANUAL == 1 + pos_label = PSTR(MSG_MOVE_E); + #else + switch (eindex) { + default: pos_label = PSTR(MSG_MOVE_E MSG_MOVE_E1); break; + case 1: pos_label = PSTR(MSG_MOVE_E MSG_MOVE_E2); break; + #if E_MANUAL > 2 + case 2: pos_label = PSTR(MSG_MOVE_E MSG_MOVE_E3); break; + #if E_MANUAL > 3 + case 3: pos_label = PSTR(MSG_MOVE_E MSG_MOVE_E4); break; + #if E_MANUAL > 4 + case 4: pos_label = PSTR(MSG_MOVE_E MSG_MOVE_E5); break; + #if E_MANUAL > 5 + case 5: pos_label = PSTR(MSG_MOVE_E MSG_MOVE_E6); break; + #endif // E_MANUAL > 5 + #endif // E_MANUAL > 4 + #endif // E_MANUAL > 3 + #endif // E_MANUAL > 2 + } + #endif // E_MANUAL > 1 + + draw_edit_screen(pos_label, ftostr41sign(current_position[E_AXIS] + #if IS_KINEMATIC + + manual_move_offset + #endif + #if ENABLED(MANUAL_E_MOVES_RELATIVE) + - manual_move_e_origin + #endif + )); + } +} + +inline void lcd_move_e() { _lcd_move_e(); } +#if E_MANUAL > 1 + inline void lcd_move_e0() { _lcd_move_e(0); } + inline void lcd_move_e1() { _lcd_move_e(1); } + #if E_MANUAL > 2 + inline void lcd_move_e2() { _lcd_move_e(2); } + #if E_MANUAL > 3 + inline void lcd_move_e3() { _lcd_move_e(3); } + #if E_MANUAL > 4 + inline void lcd_move_e4() { _lcd_move_e(4); } + #if E_MANUAL > 5 + inline void lcd_move_e5() { _lcd_move_e(5); } + #endif // E_MANUAL > 5 + #endif // E_MANUAL > 4 + #endif // E_MANUAL > 3 + #endif // E_MANUAL > 2 +#endif // E_MANUAL > 1 + +// +// "Motion" > "Move Xmm" > "Move XYZ" submenu +// + +screenFunc_t _manual_move_func_ptr; + +void _goto_manual_move(const float scale) { + ui.defer_status_screen(true); + move_menu_scale = scale; + ui.goto_screen(_manual_move_func_ptr); +} +void menu_move_10mm() { _goto_manual_move(10); } +void menu_move_1mm() { _goto_manual_move( 1); } +void menu_move_01mm() { _goto_manual_move( 0.1f); } + +void _menu_move_distance(const AxisEnum axis, const screenFunc_t func, const int8_t eindex=-1) { + _manual_move_func_ptr = func; + START_MENU(); + if (LCD_HEIGHT >= 4) { + switch (axis) { + case X_AXIS: + STATIC_ITEM(MSG_MOVE_X, true, true); break; + case Y_AXIS: + STATIC_ITEM(MSG_MOVE_Y, true, true); break; + case Z_AXIS: + STATIC_ITEM(MSG_MOVE_Z, true, true); break; + default: + #if ENABLED(MANUAL_E_MOVES_RELATIVE) + manual_move_e_origin = current_position[E_AXIS]; + #endif + STATIC_ITEM(MSG_MOVE_E, true, true); + break; + } + } + #if ENABLED(PREVENT_COLD_EXTRUSION) + if (axis == E_AXIS && thermalManager.tooColdToExtrude(eindex >= 0 ? eindex : active_extruder)) + MENU_BACK(MSG_HOTEND_TOO_COLD); + else + #endif + { + MENU_BACK(MSG_MOVE_AXIS); + MENU_ITEM(submenu, MSG_MOVE_10MM, menu_move_10mm); + MENU_ITEM(submenu, MSG_MOVE_1MM, menu_move_1mm); + MENU_ITEM(submenu, MSG_MOVE_01MM, menu_move_01mm); + } + END_MENU(); +} +void lcd_move_get_x_amount() { _menu_move_distance(X_AXIS, lcd_move_x); } +void lcd_move_get_y_amount() { _menu_move_distance(Y_AXIS, lcd_move_y); } +void lcd_move_get_z_amount() { _menu_move_distance(Z_AXIS, lcd_move_z); } +void lcd_move_get_e_amount() { _menu_move_distance(E_AXIS, lcd_move_e, -1); } +#if E_MANUAL > 1 + void lcd_move_get_e0_amount() { _menu_move_distance(E_AXIS, lcd_move_e0, 0); } + void lcd_move_get_e1_amount() { _menu_move_distance(E_AXIS, lcd_move_e1, 1); } + #if E_MANUAL > 2 + void lcd_move_get_e2_amount() { _menu_move_distance(E_AXIS, lcd_move_e2, 2); } + #if E_MANUAL > 3 + void lcd_move_get_e3_amount() { _menu_move_distance(E_AXIS, lcd_move_e3, 3); } + #if E_MANUAL > 4 + void lcd_move_get_e4_amount() { _menu_move_distance(E_AXIS, lcd_move_e4, 4); } + #if E_MANUAL > 5 + void lcd_move_get_e5_amount() { _menu_move_distance(E_AXIS, lcd_move_e5, 5); } + #endif // E_MANUAL > 5 + #endif // E_MANUAL > 4 + #endif // E_MANUAL > 3 + #endif // E_MANUAL > 2 +#endif // E_MANUAL > 1 + +#if ENABLED(DELTA) + void lcd_lower_z_to_clip_height() { + line_to_z(delta_clip_start_height); + ui.synchronize(); + } +#endif + +void menu_move() { + START_MENU(); + MENU_BACK(MSG_MOTION); + + #if HAS_SOFTWARE_ENDSTOPS && ENABLED(SOFT_ENDSTOPS_MENU_ITEM) + MENU_ITEM_EDIT(bool, MSG_LCD_SOFT_ENDSTOPS, &soft_endstops_enabled); + #endif + + if ( + #if IS_KINEMATIC || ENABLED(NO_MOTION_BEFORE_HOMING) + all_axes_homed() + #else + true + #endif + ) { + if ( + #if ENABLED(DELTA) + current_position[Z_AXIS] <= delta_clip_start_height + #else + true + #endif + ) { + MENU_ITEM(submenu, MSG_MOVE_X, lcd_move_get_x_amount); + MENU_ITEM(submenu, MSG_MOVE_Y, lcd_move_get_y_amount); + } + #if ENABLED(DELTA) + else + MENU_ITEM(function, MSG_FREE_XY, lcd_lower_z_to_clip_height); + #endif + + MENU_ITEM(submenu, MSG_MOVE_Z, lcd_move_get_z_amount); + } + else + MENU_ITEM(gcode, MSG_AUTO_HOME, PSTR("G28")); + + #if ENABLED(SWITCHING_EXTRUDER) || ENABLED(SWITCHING_NOZZLE) + + #if EXTRUDERS == 6 + switch (active_extruder) { + case 0: MENU_ITEM(gcode, MSG_SELECT " " MSG_E2, PSTR("T1")); break; + case 1: MENU_ITEM(gcode, MSG_SELECT " " MSG_E1, PSTR("T0")); break; + case 2: MENU_ITEM(gcode, MSG_SELECT " " MSG_E4, PSTR("T3")); break; + case 3: MENU_ITEM(gcode, MSG_SELECT " " MSG_E3, PSTR("T2")); break; + case 4: MENU_ITEM(gcode, MSG_SELECT " " MSG_E6, PSTR("T5")); break; + case 5: MENU_ITEM(gcode, MSG_SELECT " " MSG_E5, PSTR("T4")); break; + } + #elif EXTRUDERS == 5 || EXTRUDERS == 4 + switch (active_extruder) { + case 0: MENU_ITEM(gcode, MSG_SELECT " " MSG_E2, PSTR("T1")); break; + case 1: MENU_ITEM(gcode, MSG_SELECT " " MSG_E1, PSTR("T0")); break; + case 2: MENU_ITEM(gcode, MSG_SELECT " " MSG_E4, PSTR("T3")); break; + case 3: MENU_ITEM(gcode, MSG_SELECT " " MSG_E3, PSTR("T2")); break; + } + #elif EXTRUDERS == 3 + if (active_extruder < 2) { + if (active_extruder) + MENU_ITEM(gcode, MSG_SELECT " " MSG_E1, PSTR("T0")); + else + MENU_ITEM(gcode, MSG_SELECT " " MSG_E2, PSTR("T1")); + } + #else + if (active_extruder) + MENU_ITEM(gcode, MSG_SELECT " " MSG_E1, PSTR("T0")); + else + MENU_ITEM(gcode, MSG_SELECT " " MSG_E2, PSTR("T1")); + #endif + + #elif ENABLED(DUAL_X_CARRIAGE) + + if (active_extruder) + MENU_ITEM(gcode, MSG_SELECT " " MSG_E1, PSTR("T0")); + else + MENU_ITEM(gcode, MSG_SELECT " " MSG_E2, PSTR("T1")); + + #endif + + #if ENABLED(SWITCHING_EXTRUDER) || ENABLED(SWITCHING_NOZZLE) + + // Only the current... + MENU_ITEM(submenu, MSG_MOVE_E, lcd_move_get_e_amount); + // ...and the non-switching + #if E_MANUAL == 5 + MENU_ITEM(submenu, MSG_MOVE_E MSG_MOVE_E5, lcd_move_get_e4_amount); + #elif E_MANUAL == 3 + MENU_ITEM(submenu, MSG_MOVE_E MSG_MOVE_E3, lcd_move_get_e2_amount); + #endif + + #else + + // Independent extruders with one E-stepper per hotend + MENU_ITEM(submenu, MSG_MOVE_E, lcd_move_get_e_amount); + #if E_MANUAL > 1 + MENU_ITEM(submenu, MSG_MOVE_E MSG_MOVE_E1, lcd_move_get_e0_amount); + MENU_ITEM(submenu, MSG_MOVE_E MSG_MOVE_E2, lcd_move_get_e1_amount); + #if E_MANUAL > 2 + MENU_ITEM(submenu, MSG_MOVE_E MSG_MOVE_E3, lcd_move_get_e2_amount); + #if E_MANUAL > 3 + MENU_ITEM(submenu, MSG_MOVE_E MSG_MOVE_E4, lcd_move_get_e3_amount); + #if E_MANUAL > 4 + MENU_ITEM(submenu, MSG_MOVE_E MSG_MOVE_E5, lcd_move_get_e4_amount); + #if E_MANUAL > 5 + MENU_ITEM(submenu, MSG_MOVE_E MSG_MOVE_E6, lcd_move_get_e5_amount); + #endif // E_MANUAL > 5 + #endif // E_MANUAL > 4 + #endif // E_MANUAL > 3 + #endif // E_MANUAL > 2 + #endif // E_MANUAL > 1 + + #endif + + END_MENU(); +} + +void _lcd_ubl_level_bed(); +void menu_bed_leveling(); + +void menu_motion() { + START_MENU(); + + // + // ^ Main + // + MENU_BACK(MSG_MAIN); + + // + // Move Axis + // + #if ENABLED(DELTA) + if (all_axes_homed()) + #endif + MENU_ITEM(submenu, MSG_MOVE_AXIS, menu_move); + + // + // Auto Home + // + MENU_ITEM(gcode, MSG_AUTO_HOME, PSTR("G28")); + #if ENABLED(INDIVIDUAL_AXIS_HOMING_MENU) + MENU_ITEM(gcode, MSG_AUTO_HOME_X, PSTR("G28 X")); + MENU_ITEM(gcode, MSG_AUTO_HOME_Y, PSTR("G28 Y")); + MENU_ITEM(gcode, MSG_AUTO_HOME_Z, PSTR("G28 Z")); + #endif + + // + // Auto Z-Align + // + #if ENABLED(Z_STEPPER_AUTO_ALIGN) + MENU_ITEM(gcode, MSG_AUTO_Z_ALIGN, PSTR("G34")); + #endif + + // + // TMC Z Calibration + // + #if ENABLED(TMC_Z_CALIBRATION) + MENU_ITEM(gcode, MSG_TMC_Z_CALIBRATION, PSTR("G28\nM915")); + #endif + + // + // Level Bed + // + #if ENABLED(AUTO_BED_LEVELING_UBL) + + MENU_ITEM(submenu, MSG_UBL_LEVEL_BED, _lcd_ubl_level_bed); + + #elif ENABLED(LCD_BED_LEVELING) + + if (!g29_in_progress) MENU_ITEM(submenu, MSG_BED_LEVELING, menu_bed_leveling); + + #elif HAS_LEVELING && DISABLED(SLIM_LCD_MENUS) + + #if DISABLED(PROBE_MANUALLY) + MENU_ITEM(gcode, MSG_LEVEL_BED, PSTR("G28\nG29")); + #endif + if (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); + } + #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float3, MSG_Z_FADE_HEIGHT, &lcd_z_fade_height, 0, 100, _lcd_set_z_fade_height); + #endif + + #endif + + #if ENABLED(LEVEL_BED_CORNERS) && DISABLED(LCD_BED_LEVELING) + MENU_ITEM(function, MSG_LEVEL_CORNERS, _lcd_level_bed_corners); + #endif + + // + // Disable Steppers + // + MENU_ITEM(gcode, MSG_DISABLE_STEPPERS, PSTR("M84")); + + END_MENU(); +} + +#endif // HAS_LCD_MENU diff --git a/Marlin/src/lcd/menu/menu_sdcard.cpp b/Marlin/src/lcd/menu/menu_sdcard.cpp new file mode 100644 index 0000000000..f5fffb91e2 --- /dev/null +++ b/Marlin/src/lcd/menu/menu_sdcard.cpp @@ -0,0 +1,139 @@ +/** + * 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 . + * + */ + +// +// SD Card Menu +// + +#include "../../inc/MarlinConfigPre.h" + +#if HAS_LCD_MENU && ENABLED(SDSUPPORT) + +#include "menu.h" +#include "../../sd/cardreader.h" + +#if !PIN_EXISTS(SD_DETECT) + void lcd_sd_refresh() { + card.initsd(); + encoderTopLine = 0; + } +#endif + +void lcd_sd_updir() { + ui.encoderPosition = card.updir() ? ENCODER_STEPS_PER_MENU_ITEM : 0; + encoderTopLine = 0; + screen_changed = true; + ui.refresh(); +} + +#if ENABLED(SD_REPRINT_LAST_SELECTED_FILE) + + uint32_t last_sdfile_encoderPosition = 0xFFFF; + + void MarlinUI::reselect_last_file() { + if (last_sdfile_encoderPosition == 0xFFFF) return; + //#if HAS_GRAPHICAL_LCD + // // This is a hack to force a screen update. + // ui.refresh(LCDVIEW_CALL_REDRAW_NEXT); + // ui.synchronize(); + // safe_delay(50); + // ui.synchronize(); + // ui.refresh(LCDVIEW_CALL_REDRAW_NEXT); + // ui.drawing_screen = screen_changed = true; + //#endif + + goto_screen(menu_sdcard, last_sdfile_encoderPosition); + last_sdfile_encoderPosition = 0xFFFF; + + defer_status_screen(true); + + //#if HAS_GRAPHICAL_LCD + // update(); + //#endif + } +#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 + #endif + card.openAndPrintFile(theCard.filename); + ui.return_to_status(); + ui.reset_status(); + } +}; + +class MenuItem_sdfolder { + public: + static void action(CardReader &theCard) { + card.chdir(theCard.filename); + encoderTopLine = 0; + ui.encoderPosition = 2 * ENCODER_STEPS_PER_MENU_ITEM; + screen_changed = true; + #if HAS_GRAPHICAL_LCD + ui.drawing_screen = false; + #endif + ui.refresh(); + } +}; + +void menu_sdcard() { + ui.encoder_direction_menus(); + + const uint16_t fileCnt = card.get_num_Files(); + + START_MENU(); + MENU_BACK(MSG_MAIN); + card.getWorkDirName(); + if (card.filename[0] == '/') { + #if !PIN_EXISTS(SD_DETECT) + MENU_ITEM(function, LCD_STR_REFRESH MSG_REFRESH, lcd_sd_refresh); + #endif + } + else if (card.flag.cardOK) + MENU_ITEM(function, LCD_STR_FOLDER "..", lcd_sd_updir); + + for (uint16_t i = 0; i < fileCnt; i++) { + if (_menuLineNr == _thisItemNr) { + const uint16_t nr = + #if ENABLED(SDCARD_RATHERRECENTFIRST) && DISABLED(SDCARD_SORT_ALPHA) + fileCnt - 1 - + #endif + i; + + card.getfilename_sorted(nr); + + if (card.flag.filenameIsDir) + MENU_ITEM(sdfolder, MSG_CARD_MENU, card); + else + MENU_ITEM(sdfile, MSG_CARD_MENU, card); + } + else { + MENU_ITEM_DUMMY(); + } + } + END_MENU(); +} + +#endif // HAS_LCD_MENU && SDSUPPORT diff --git a/Marlin/src/lcd/menu/menu_temperature.cpp b/Marlin/src/lcd/menu/menu_temperature.cpp new file mode 100644 index 0000000000..2883fe752e --- /dev/null +++ b/Marlin/src/lcd/menu/menu_temperature.cpp @@ -0,0 +1,389 @@ +/** + * 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 . + * + */ + +// +// Temperature Menu +// + +#include "../../inc/MarlinConfigPre.h" + +#if HAS_LCD_MENU + +#include "menu.h" +#include "../../module/temperature.h" + +#if FAN_COUNT > 1 + #include "../../module/motion.h" +#endif + +// Initialized by settings.load() +int16_t MarlinUI::preheat_hotend_temp[2], MarlinUI::preheat_bed_temp[2]; +uint8_t MarlinUI::preheat_fan_speed[2]; + +// +// "Temperature" submenu items +// + +void _lcd_preheat(const int16_t endnum, const int16_t temph, const int16_t tempb, const uint8_t fan) { + if (temph > 0) thermalManager.setTargetHotend(MIN(heater_maxtemp[endnum], temph), endnum); + #if HAS_HEATED_BED + if (tempb >= 0) thermalManager.setTargetBed(tempb); + #else + UNUSED(tempb); + #endif + #if FAN_COUNT > 0 + #if FAN_COUNT > 1 + fan_speed[active_extruder < FAN_COUNT ? active_extruder : 0] = fan; + #else + fan_speed[0] = fan; + #endif + #else + UNUSED(fan); + #endif + ui.return_to_status(); +} + +#if HOTENDS > 1 + + void lcd_preheat_m1_e1_only() { _lcd_preheat(1, ui.preheat_hotend_temp[0], -1, ui.preheat_fan_speed[0]); } + void lcd_preheat_m2_e1_only() { _lcd_preheat(1, ui.preheat_hotend_temp[1], -1, ui.preheat_fan_speed[1]); } + #if HAS_HEATED_BED + void lcd_preheat_m1_e1() { _lcd_preheat(1, ui.preheat_hotend_temp[0], ui.preheat_bed_temp[0], ui.preheat_fan_speed[0]); } + void lcd_preheat_m2_e1() { _lcd_preheat(1, ui.preheat_hotend_temp[1], ui.preheat_bed_temp[1], ui.preheat_fan_speed[1]); } + #endif + #if HOTENDS > 2 + void lcd_preheat_m1_e2_only() { _lcd_preheat(2, ui.preheat_hotend_temp[0], -1, ui.preheat_fan_speed[0]); } + void lcd_preheat_m2_e2_only() { _lcd_preheat(2, ui.preheat_hotend_temp[1], -1, ui.preheat_fan_speed[1]); } + #if HAS_HEATED_BED + void lcd_preheat_m1_e2() { _lcd_preheat(2, ui.preheat_hotend_temp[0], ui.preheat_bed_temp[0], ui.preheat_fan_speed[0]); } + void lcd_preheat_m2_e2() { _lcd_preheat(2, ui.preheat_hotend_temp[1], ui.preheat_bed_temp[1], ui.preheat_fan_speed[1]); } + #endif + #if HOTENDS > 3 + void lcd_preheat_m1_e3_only() { _lcd_preheat(3, ui.preheat_hotend_temp[0], -1, ui.preheat_fan_speed[0]); } + void lcd_preheat_m2_e3_only() { _lcd_preheat(3, ui.preheat_hotend_temp[1], -1, ui.preheat_fan_speed[1]); } + #if HAS_HEATED_BED + void lcd_preheat_m1_e3() { _lcd_preheat(3, ui.preheat_hotend_temp[0], ui.preheat_bed_temp[0], ui.preheat_fan_speed[0]); } + void lcd_preheat_m2_e3() { _lcd_preheat(3, ui.preheat_hotend_temp[1], ui.preheat_bed_temp[1], ui.preheat_fan_speed[1]); } + #endif + #if HOTENDS > 4 + void lcd_preheat_m1_e4_only() { _lcd_preheat(4, ui.preheat_hotend_temp[0], -1, ui.preheat_fan_speed[0]); } + void lcd_preheat_m2_e4_only() { _lcd_preheat(4, ui.preheat_hotend_temp[1], -1, ui.preheat_fan_speed[1]); } + #if HAS_HEATED_BED + void lcd_preheat_m1_e4() { _lcd_preheat(4, ui.preheat_hotend_temp[0], ui.preheat_bed_temp[0], ui.preheat_fan_speed[0]); } + void lcd_preheat_m2_e4() { _lcd_preheat(4, ui.preheat_hotend_temp[1], ui.preheat_bed_temp[1], ui.preheat_fan_speed[1]); } + #endif + #if HOTENDS > 5 + void lcd_preheat_m1_e5_only() { _lcd_preheat(5, ui.preheat_hotend_temp[0], -1, ui.preheat_fan_speed[0]); } + void lcd_preheat_m2_e5_only() { _lcd_preheat(5, ui.preheat_hotend_temp[1], -1, ui.preheat_fan_speed[1]); } + #if HAS_HEATED_BED + void lcd_preheat_m1_e5() { _lcd_preheat(5, ui.preheat_hotend_temp[0], ui.preheat_bed_temp[0], ui.preheat_fan_speed[0]); } + void lcd_preheat_m2_e5() { _lcd_preheat(5, ui.preheat_hotend_temp[1], ui.preheat_bed_temp[1], ui.preheat_fan_speed[1]); } + #endif + #endif // HOTENDS > 5 + #endif // HOTENDS > 4 + #endif // HOTENDS > 3 + #endif // HOTENDS > 2 + + #if HAS_HEATED_BED + void lcd_preheat_m1_e0(); + void lcd_preheat_m2_e0(); + #else + void lcd_preheat_m1_e0_only(); + void lcd_preheat_m2_e0_only(); + #endif + + void lcd_preheat_m1_all() { + #if HOTENDS > 1 + thermalManager.setTargetHotend(ui.preheat_hotend_temp[0], 1); + #if HOTENDS > 2 + thermalManager.setTargetHotend(ui.preheat_hotend_temp[0], 2); + #if HOTENDS > 3 + thermalManager.setTargetHotend(ui.preheat_hotend_temp[0], 3); + #if HOTENDS > 4 + thermalManager.setTargetHotend(ui.preheat_hotend_temp[0], 4); + #if HOTENDS > 5 + thermalManager.setTargetHotend(ui.preheat_hotend_temp[0], 5); + #endif // HOTENDS > 5 + #endif // HOTENDS > 4 + #endif // HOTENDS > 3 + #endif // HOTENDS > 2 + #endif // HOTENDS > 1 + #if HAS_HEATED_BED + lcd_preheat_m1_e0(); + #else + lcd_preheat_m1_e0_only(); + #endif + } + + void lcd_preheat_m2_all() { + #if HOTENDS > 1 + thermalManager.setTargetHotend(ui.preheat_hotend_temp[1], 1); + #if HOTENDS > 2 + thermalManager.setTargetHotend(ui.preheat_hotend_temp[1], 2); + #if HOTENDS > 3 + thermalManager.setTargetHotend(ui.preheat_hotend_temp[1], 3); + #if HOTENDS > 4 + thermalManager.setTargetHotend(ui.preheat_hotend_temp[1], 4); + #if HOTENDS > 5 + thermalManager.setTargetHotend(ui.preheat_hotend_temp[1], 5); + #endif // HOTENDS > 5 + #endif // HOTENDS > 4 + #endif // HOTENDS > 3 + #endif // HOTENDS > 2 + #endif // HOTENDS > 1 + #if HAS_HEATED_BED + lcd_preheat_m2_e0(); + #else + lcd_preheat_m2_e0_only(); + #endif + } + +#endif // HOTENDS > 1 + +#if HAS_TEMP_HOTEND || HAS_HEATED_BED + + void lcd_preheat_m1_e0_only() { _lcd_preheat(0, ui.preheat_hotend_temp[0], -1, ui.preheat_fan_speed[0]); } + void lcd_preheat_m2_e0_only() { _lcd_preheat(0, ui.preheat_hotend_temp[1], -1, ui.preheat_fan_speed[1]); } + + #if HAS_HEATED_BED + void lcd_preheat_m1_e0() { _lcd_preheat(0, ui.preheat_hotend_temp[0], ui.preheat_bed_temp[0], ui.preheat_fan_speed[0]); } + void lcd_preheat_m2_e0() { _lcd_preheat(0, ui.preheat_hotend_temp[1], ui.preheat_bed_temp[1], ui.preheat_fan_speed[1]); } + void lcd_preheat_m1_bedonly() { _lcd_preheat(0, 0, ui.preheat_bed_temp[0], ui.preheat_fan_speed[0]); } + void lcd_preheat_m2_bedonly() { _lcd_preheat(0, 0, ui.preheat_bed_temp[1], ui.preheat_fan_speed[1]); } + #endif + + void menu_preheat_m1() { + START_MENU(); + MENU_BACK(MSG_TEMPERATURE); + #if HOTENDS == 1 + #if HAS_HEATED_BED + MENU_ITEM(function, MSG_PREHEAT_1, lcd_preheat_m1_e0); + MENU_ITEM(function, MSG_PREHEAT_1_END, lcd_preheat_m1_e0_only); + #else + MENU_ITEM(function, MSG_PREHEAT_1, lcd_preheat_m1_e0_only); + #endif + #elif HOTENDS > 1 + #if HAS_HEATED_BED + MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H1, lcd_preheat_m1_e0); + MENU_ITEM(function, MSG_PREHEAT_1_END " " MSG_E1, lcd_preheat_m1_e0_only); + MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H2, lcd_preheat_m1_e1); + MENU_ITEM(function, MSG_PREHEAT_1_END " " MSG_E2, lcd_preheat_m1_e1_only); + #else + MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H1, lcd_preheat_m1_e0_only); + MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H2, lcd_preheat_m1_e1_only); + #endif + #if HOTENDS > 2 + #if HAS_HEATED_BED + MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H3, lcd_preheat_m1_e2); + MENU_ITEM(function, MSG_PREHEAT_1_END " " MSG_E3, lcd_preheat_m1_e2_only); + #else + MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H3, lcd_preheat_m1_e2_only); + #endif + #if HOTENDS > 3 + #if HAS_HEATED_BED + MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H4, lcd_preheat_m1_e3); + MENU_ITEM(function, MSG_PREHEAT_1_END " " MSG_E4, lcd_preheat_m1_e3_only); + #else + MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H4, lcd_preheat_m1_e3_only); + #endif + #if HOTENDS > 4 + #if HAS_HEATED_BED + MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H5, lcd_preheat_m1_e4); + MENU_ITEM(function, MSG_PREHEAT_1_END " " MSG_E5, lcd_preheat_m1_e4_only); + #else + MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H5, lcd_preheat_m1_e4_only); + #endif + #if HOTENDS > 5 + #if HAS_HEATED_BED + MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H6, lcd_preheat_m1_e5); + MENU_ITEM(function, MSG_PREHEAT_1_END " " MSG_E6, lcd_preheat_m1_e5_only); + #else + MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H6, lcd_preheat_m1_e5_only); + #endif + #endif // HOTENDS > 5 + #endif // HOTENDS > 4 + #endif // HOTENDS > 3 + #endif // HOTENDS > 2 + MENU_ITEM(function, MSG_PREHEAT_1_ALL, lcd_preheat_m1_all); + #endif // HOTENDS > 1 + #if HAS_HEATED_BED + MENU_ITEM(function, MSG_PREHEAT_1_BEDONLY, lcd_preheat_m1_bedonly); + #endif + END_MENU(); + } + + void menu_preheat_m2() { + START_MENU(); + MENU_BACK(MSG_TEMPERATURE); + #if HOTENDS == 1 + #if HAS_HEATED_BED + MENU_ITEM(function, MSG_PREHEAT_2, lcd_preheat_m2_e0); + MENU_ITEM(function, MSG_PREHEAT_2_END, lcd_preheat_m2_e0_only); + #else + MENU_ITEM(function, MSG_PREHEAT_2, lcd_preheat_m2_e0_only); + #endif + #elif HOTENDS > 1 + #if HAS_HEATED_BED + MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H1, lcd_preheat_m2_e0); + MENU_ITEM(function, MSG_PREHEAT_2_END " " MSG_E1, lcd_preheat_m2_e0_only); + MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H2, lcd_preheat_m2_e1); + MENU_ITEM(function, MSG_PREHEAT_2_END " " MSG_E2, lcd_preheat_m2_e1_only); + #else + MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H1, lcd_preheat_m2_e0_only); + MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H2, lcd_preheat_m2_e1_only); + #endif + #if HOTENDS > 2 + #if HAS_HEATED_BED + MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H3, lcd_preheat_m2_e2); + MENU_ITEM(function, MSG_PREHEAT_2_END " " MSG_E3, lcd_preheat_m2_e2_only); + #else + MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H3, lcd_preheat_m2_e2_only); + #endif + #if HOTENDS > 3 + #if HAS_HEATED_BED + MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H4, lcd_preheat_m2_e3); + MENU_ITEM(function, MSG_PREHEAT_2_END " " MSG_E4, lcd_preheat_m2_e3_only); + #else + MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H4, lcd_preheat_m2_e3_only); + #endif + #if HOTENDS > 4 + #if HAS_HEATED_BED + MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H5, lcd_preheat_m2_e4); + MENU_ITEM(function, MSG_PREHEAT_2_END " " MSG_E5, lcd_preheat_m2_e4_only); + #else + MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H5, lcd_preheat_m2_e4_only); + #endif + #if HOTENDS > 5 + #if HAS_HEATED_BED + MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H6, lcd_preheat_m2_e5); + MENU_ITEM(function, MSG_PREHEAT_2_END " " MSG_E6, lcd_preheat_m2_e5_only); + #else + MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H6, lcd_preheat_m2_e5_only); + #endif + #endif // HOTENDS > 5 + #endif // HOTENDS > 4 + #endif // HOTENDS > 3 + #endif // HOTENDS > 2 + MENU_ITEM(function, MSG_PREHEAT_2_ALL, lcd_preheat_m2_all); + #endif // HOTENDS > 1 + #if HAS_HEATED_BED + MENU_ITEM(function, MSG_PREHEAT_2_BEDONLY, lcd_preheat_m2_bedonly); + #endif + END_MENU(); + } + + void lcd_cooldown() { + zero_fan_speeds(); + thermalManager.disable_all_heaters(); + ui.return_to_status(); + } + +#endif // HAS_TEMP_HOTEND || HAS_HEATED_BED + +void menu_temperature() { + START_MENU(); + MENU_BACK(MSG_MAIN); + + // + // Nozzle: + // Nozzle [1-5]: + // + #if HOTENDS == 1 + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE, &thermalManager.target_temperature[0], 0, HEATER_0_MAXTEMP - 15, watch_temp_callback_E0); + #else // HOTENDS > 1 + #define EDIT_TARGET(N) MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_LCD_N##N, &thermalManager.target_temperature[N], 0, HEATER_##N##_MAXTEMP - 15, watch_temp_callback_E##N) + EDIT_TARGET(0); + EDIT_TARGET(1); + #if HOTENDS > 2 + EDIT_TARGET(2); + #if HOTENDS > 3 + EDIT_TARGET(3); + #if HOTENDS > 4 + EDIT_TARGET(4); + #if HOTENDS > 5 + EDIT_TARGET(5); + #endif // HOTENDS > 5 + #endif // HOTENDS > 4 + #endif // HOTENDS > 3 + #endif // HOTENDS > 2 + #endif // HOTENDS > 1 + + // + // Bed: + // + #if HAS_HEATED_BED + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_BED, &thermalManager.target_temperature_bed, 0, BED_MAXTEMP - 15, watch_temp_callback_bed); + #endif + + // + // Fan Speed: + // + #if FAN_COUNT > 0 + #if HAS_FAN0 + MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_FAN_SPEED FAN_SPEED_1_SUFFIX, &fan_speed[0], 0, 255); + #if ENABLED(EXTRA_FAN_SPEED) + MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_EXTRA_FAN_SPEED FAN_SPEED_1_SUFFIX, &new_fan_speed[0], 3, 255); + #endif + #endif + #if HAS_FAN1 + MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_FAN_SPEED " 2", &fan_speed[1], 0, 255); + #if ENABLED(EXTRA_FAN_SPEED) + MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_EXTRA_FAN_SPEED " 2", &new_fan_speed[1], 3, 255); + #endif + #endif + #if HAS_FAN2 + MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_FAN_SPEED " 3", &fan_speed[2], 0, 255); + #if ENABLED(EXTRA_FAN_SPEED) + MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_EXTRA_FAN_SPEED " 3", &new_fan_speed[2], 3, 255); + #endif + #endif + #endif // FAN_COUNT > 0 + + #if HAS_TEMP_HOTEND + + // + // Cooldown + // + bool has_heat = false; + HOTEND_LOOP() if (thermalManager.target_temperature[HOTEND_INDEX]) { has_heat = true; break; } + #if HAS_TEMP_BED + if (thermalManager.target_temperature_bed) has_heat = true; + #endif + if (has_heat) MENU_ITEM(function, MSG_COOLDOWN, lcd_cooldown); + + // + // Preheat for Material 1 and 2 + // + #if TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 || TEMP_SENSOR_4 != 0 || HAS_HEATED_BED + MENU_ITEM(submenu, MSG_PREHEAT_1, menu_preheat_m1); + MENU_ITEM(submenu, MSG_PREHEAT_2, menu_preheat_m2); + #else + MENU_ITEM(function, MSG_PREHEAT_1, lcd_preheat_m1_e0_only); + MENU_ITEM(function, MSG_PREHEAT_2, lcd_preheat_m2_e0_only); + #endif + + #endif // HAS_TEMP_HOTEND + + END_MENU(); +} + +#endif // HAS_LCD_MENU diff --git a/Marlin/src/lcd/menu/menu_tune.cpp b/Marlin/src/lcd/menu/menu_tune.cpp new file mode 100644 index 0000000000..b3e41fa5d0 --- /dev/null +++ b/Marlin/src/lcd/menu/menu_tune.cpp @@ -0,0 +1,208 @@ +/** + * 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 . + * + */ + +// +// Tune Menu +// + +#include "../../inc/MarlinConfigPre.h" + +#if HAS_LCD_MENU + +#include "menu.h" +#include "../../module/motion.h" +#include "../../module/planner.h" +#include "../../module/temperature.h" +#include "../../Marlin.h" + +#if HAS_LEVELING + #include "../../feature/bedlevel/bedlevel.h" +#endif + +// Refresh the E factor after changing flow +void _lcd_refresh_e_factor_0() { planner.refresh_e_factor(0); } +#if EXTRUDERS > 1 + void _lcd_refresh_e_factor() { planner.refresh_e_factor(active_extruder); } + void _lcd_refresh_e_factor_1() { planner.refresh_e_factor(1); } + #if EXTRUDERS > 2 + void _lcd_refresh_e_factor_2() { planner.refresh_e_factor(2); } + #if EXTRUDERS > 3 + void _lcd_refresh_e_factor_3() { planner.refresh_e_factor(3); } + #if EXTRUDERS > 4 + void _lcd_refresh_e_factor_4() { planner.refresh_e_factor(4); } + #if EXTRUDERS > 5 + void _lcd_refresh_e_factor_5() { planner.refresh_e_factor(5); } + #endif // EXTRUDERS > 5 + #endif // EXTRUDERS > 4 + #endif // EXTRUDERS > 3 + #endif // EXTRUDERS > 2 +#endif // EXTRUDERS > 1 + +#if ENABLED(BABYSTEPPING) + + long babysteps_done = 0; + + void _lcd_babystep(const AxisEnum axis, PGM_P 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); + ui.encoderPosition = 0; + ui.refresh(LCDVIEW_REDRAW_NOW); + thermalManager.babystep_axis(axis, babystep_increment); + babysteps_done += babystep_increment; + } + if (ui.should_draw()) + draw_edit_screen(msg, ftostr43sign(planner.steps_to_mm[axis] * babysteps_done)); + } + + #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(true); } + void lcd_babystep_y() { ui.goto_screen(_lcd_babystep_y); babysteps_done = 0; ui.defer_status_screen(true); } + #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(true); } + #endif + +#endif // BABYSTEPPING + +void menu_tune() { + START_MENU(); + MENU_BACK(MSG_MAIN); + + // + // Speed: + // + MENU_ITEM_EDIT(int3, MSG_SPEED, &feedrate_percentage, 10, 999); + + // + // Manual bed leveling, Bed Z: + // + #if ENABLED(MESH_BED_LEVELING) && ENABLED(LCD_BED_LEVELING) + MENU_ITEM_EDIT(float43, MSG_BED_Z, &mbl.z_offset, -1, 1); + #endif + + // + // Nozzle: + // Nozzle [1-4]: + // + #if HOTENDS == 1 + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE, &thermalManager.target_temperature[0], 0, HEATER_0_MAXTEMP - 15, watch_temp_callback_E0); + #else // HOTENDS > 1 + #define EDIT_NOZZLE(N) MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_LCD_N##N, &thermalManager.target_temperature[N], 0, HEATER_##N##_MAXTEMP - 15, watch_temp_callback_E##N) + EDIT_NOZZLE(0); + EDIT_NOZZLE(1); + #if HOTENDS > 2 + EDIT_NOZZLE(2); + #if HOTENDS > 3 + EDIT_NOZZLE(3); + #if HOTENDS > 4 + EDIT_NOZZLE(4); + #if HOTENDS > 5 + EDIT_NOZZLE(5); + #endif // HOTENDS > 5 + #endif // HOTENDS > 4 + #endif // HOTENDS > 3 + #endif // HOTENDS > 2 + #endif // HOTENDS > 1 + + // + // Bed: + // + #if HAS_HEATED_BED + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_BED, &thermalManager.target_temperature_bed, 0, BED_MAXTEMP - 15, watch_temp_callback_bed); + #endif + + // + // Fan Speed: + // + #if FAN_COUNT > 0 + #if HAS_FAN0 + MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_FAN_SPEED FAN_SPEED_1_SUFFIX, &fan_speed[0], 0, 255); + #if ENABLED(EXTRA_FAN_SPEED) + MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_EXTRA_FAN_SPEED FAN_SPEED_1_SUFFIX, &new_fan_speed[0], 3, 255); + #endif + #endif + #if HAS_FAN1 + MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_FAN_SPEED " 2", &fan_speed[1], 0, 255); + #if ENABLED(EXTRA_FAN_SPEED) + MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_EXTRA_FAN_SPEED " 2", &new_fan_speed[1], 3, 255); + #endif + #endif + #if HAS_FAN2 + MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_FAN_SPEED " 3", &fan_speed[2], 0, 255); + #if ENABLED(EXTRA_FAN_SPEED) + MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_EXTRA_FAN_SPEED " 3", &new_fan_speed[2], 3, 255); + #endif + #endif + #endif // FAN_COUNT > 0 + + // + // Flow: + // Flow [1-5]: + // + #if EXTRUDERS == 1 + MENU_ITEM_EDIT_CALLBACK(int3, MSG_FLOW, &planner.flow_percentage[0], 10, 999, _lcd_refresh_e_factor_0); + #else // EXTRUDERS > 1 + MENU_ITEM_EDIT_CALLBACK(int3, MSG_FLOW, &planner.flow_percentage[active_extruder], 10, 999, _lcd_refresh_e_factor); + #define EDIT_FLOW(N) MENU_ITEM_EDIT_CALLBACK(int3, MSG_FLOW MSG_LCD_N##N, &planner.flow_percentage[N], 10, 999, _lcd_refresh_e_factor_##N) + EDIT_FLOW(0); + EDIT_FLOW(1); + #if EXTRUDERS > 2 + EDIT_FLOW(2); + #if EXTRUDERS > 3 + EDIT_FLOW(3); + #if EXTRUDERS > 4 + EDIT_FLOW(4); + #if EXTRUDERS > 5 + EDIT_FLOW(5); + #endif // EXTRUDERS > 5 + #endif // EXTRUDERS > 4 + #endif // EXTRUDERS > 3 + #endif // EXTRUDERS > 2 + #endif // EXTRUDERS > 1 + + // + // Babystep X: + // Babystep Y: + // Babystep Z: + // + #if ENABLED(BABYSTEPPING) + #if ENABLED(BABYSTEP_XY) + MENU_ITEM(submenu, MSG_BABYSTEP_X, lcd_babystep_x); + MENU_ITEM(submenu, MSG_BABYSTEP_Y, lcd_babystep_y); + #endif + #if ENABLED(BABYSTEP_ZPROBE_OFFSET) + MENU_ITEM(submenu, MSG_ZPROBE_ZOFFSET, lcd_babystep_zoffset); + #else + MENU_ITEM(submenu, MSG_BABYSTEP_Z, lcd_babystep_z); + #endif + #endif + + END_MENU(); +} + +#endif // HAS_LCD_MENU diff --git a/Marlin/src/lcd/menu/menu_ubl.cpp b/Marlin/src/lcd/menu/menu_ubl.cpp new file mode 100644 index 0000000000..146c9268f1 --- /dev/null +++ b/Marlin/src/lcd/menu/menu_ubl.cpp @@ -0,0 +1,606 @@ +/** + * 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 . + * + */ + +// +// Unified Bed Leveling Menus +// + +#include "../../inc/MarlinConfigPre.h" + +#if HAS_LCD_MENU && ENABLED(AUTO_BED_LEVELING_UBL) + +#include "menu.h" +#include "../../module/planner.h" +#include "../../module/configuration_store.h" +#include "../../feature/bedlevel/bedlevel.h" + +static int16_t ubl_storage_slot = 0, + custom_hotend_temp = 190, + side_points = 3, + ubl_fillin_amount = 5, + ubl_height_amount = 1, + n_edit_pts = 1, + x_plot = 0, + y_plot = 0; + +#if HAS_HEATED_BED + static int16_t custom_bed_temp = 50; +#endif + +float mesh_edit_value, mesh_edit_accumulator; // We round mesh_edit_value to 2.5 decimal places. So we keep a + // separate value that doesn't lose precision. +static int16_t ubl_encoderPosition = 0; + +static void _lcd_mesh_fine_tune(PGM_P msg) { + ui.defer_status_screen(true); + if (ubl.encoder_diff) { + ubl_encoderPosition = (ubl.encoder_diff > 0) ? 1 : -1; + ubl.encoder_diff = 0; + + mesh_edit_accumulator += float(ubl_encoderPosition) * 0.005f * 0.5f; + mesh_edit_value = mesh_edit_accumulator; + ui.encoderPosition = 0; + ui.refresh(LCDVIEW_CALL_REDRAW_NEXT); + + const int32_t rounded = (int32_t)(mesh_edit_value * 1000); + mesh_edit_value = float(rounded - (rounded % 5L)) / 1000; + } + + if (ui.should_draw()) { + draw_edit_screen(msg, ftostr43sign(mesh_edit_value)); + #if ENABLED(MESH_EDIT_GFX_OVERLAY) + _lcd_zoffset_overlay_gfx(mesh_edit_value); + #endif + } +} + +void _lcd_mesh_edit_NOP() { + ui.defer_status_screen(true); +} + +float lcd_mesh_edit() { + ui.goto_screen(_lcd_mesh_edit_NOP); + ui.refresh(LCDVIEW_CALL_REDRAW_NEXT); + _lcd_mesh_fine_tune(PSTR("Mesh Editor")); + return mesh_edit_value; +} + +void lcd_mesh_edit_setup(const float &initial) { + mesh_edit_value = mesh_edit_accumulator = initial; + ui.goto_screen(_lcd_mesh_edit_NOP); +} + +void _lcd_z_offset_edit() { + _lcd_mesh_fine_tune(PSTR("Z-Offset: ")); +} + +float lcd_z_offset_edit() { + ui.goto_screen(_lcd_z_offset_edit); + return mesh_edit_value; +} + +void lcd_z_offset_edit_setup(const float &initial) { + mesh_edit_value = mesh_edit_accumulator = initial; + ui.goto_screen(_lcd_z_offset_edit); +} + +/** + * UBL Build Custom Mesh Command + */ +void _lcd_ubl_build_custom_mesh() { + char UBL_LCD_GCODE[20]; + enqueue_and_echo_commands_P(PSTR("G28")); + #if HAS_HEATED_BED + sprintf_P(UBL_LCD_GCODE, PSTR("M190 S%i"), custom_bed_temp); + lcd_enqueue_command(UBL_LCD_GCODE); + #endif + sprintf_P(UBL_LCD_GCODE, PSTR("M109 S%i"), custom_hotend_temp); + lcd_enqueue_command(UBL_LCD_GCODE); + enqueue_and_echo_commands_P(PSTR("G29 P1")); +} + +/** + * UBL Custom Mesh submenu + * + * << Build Mesh + * Hotend Temp: --- + * Bed Temp: --- + * Build Custom Mesh + */ +void _lcd_ubl_custom_mesh() { + START_MENU(); + MENU_BACK(MSG_UBL_BUILD_MESH_MENU); + MENU_ITEM_EDIT(int3, MSG_UBL_HOTEND_TEMP_CUSTOM, &custom_hotend_temp, EXTRUDE_MINTEMP, (HEATER_0_MAXTEMP - 10)); + #if HAS_HEATED_BED + MENU_ITEM_EDIT(int3, MSG_UBL_BED_TEMP_CUSTOM, &custom_bed_temp, BED_MINTEMP, (BED_MAXTEMP - 15)); + #endif + MENU_ITEM(function, MSG_UBL_BUILD_CUSTOM_MESH, _lcd_ubl_build_custom_mesh); + END_MENU(); +} + +/** + * UBL Adjust Mesh Height Command + */ +void _lcd_ubl_adjust_height_cmd() { + char UBL_LCD_GCODE[16]; + const int ind = ubl_height_amount > 0 ? 9 : 10; + strcpy_P(UBL_LCD_GCODE, PSTR("G29 P6 C -")); + sprintf_P(&UBL_LCD_GCODE[ind], PSTR(".%i"), ABS(ubl_height_amount)); + lcd_enqueue_command(UBL_LCD_GCODE); +} + +/** + * UBL Adjust Mesh Height submenu + * + * << Edit Mesh + * Height Amount: --- + * Adjust Mesh Height + * << Info Screen + */ +void _menu_ubl_height_adjust() { + START_MENU(); + MENU_BACK(MSG_EDIT_MESH); + MENU_ITEM_EDIT_CALLBACK(int3, MSG_UBL_MESH_HEIGHT_AMOUNT, &ubl_height_amount, -9, 9, _lcd_ubl_adjust_height_cmd); + MENU_ITEM(function, MSG_WATCH, ui.return_to_status); + END_MENU(); +} + +/** + * UBL Edit Mesh submenu + * + * << UBL Tools + * Fine Tune All + * Fine Tune Closest + * - Adjust Mesh Height >> + * << Info Screen + */ +void _lcd_ubl_edit_mesh() { + START_MENU(); + MENU_BACK(MSG_UBL_TOOLS); + MENU_ITEM(gcode, MSG_UBL_FINE_TUNE_ALL, PSTR("G29 P4 R999 T")); + MENU_ITEM(gcode, MSG_UBL_FINE_TUNE_CLOSEST, PSTR("G29 P4 T")); + MENU_ITEM(submenu, MSG_UBL_MESH_HEIGHT_ADJUST, _menu_ubl_height_adjust); + MENU_ITEM(function, MSG_WATCH, ui.return_to_status); + END_MENU(); +} + +/** + * UBL Validate Custom Mesh Command + */ +void _lcd_ubl_validate_custom_mesh() { + char UBL_LCD_GCODE[24]; + const int temp = + #if HAS_HEATED_BED + custom_bed_temp + #else + 0 + #endif + ; + sprintf_P(UBL_LCD_GCODE, PSTR("G26 C B%i H%i P"), temp, custom_hotend_temp); + lcd_enqueue_commands_P(PSTR("G28")); + lcd_enqueue_command(UBL_LCD_GCODE); +} + +/** + * UBL Validate Mesh submenu + * + * << UBL Tools + * Mesh Validation with Material 1 + * Mesh Validation with Material 2 + * Validate Custom Mesh + * << Info Screen + */ +void _lcd_ubl_validate_mesh() { + START_MENU(); + MENU_BACK(MSG_UBL_TOOLS); + #if HAS_HEATED_BED + MENU_ITEM(gcode, MSG_UBL_VALIDATE_MESH_M1, PSTR("G28\nG26 C B" STRINGIFY(PREHEAT_1_TEMP_BED) " H" STRINGIFY(PREHEAT_1_TEMP_HOTEND) " P")); + MENU_ITEM(gcode, MSG_UBL_VALIDATE_MESH_M2, PSTR("G28\nG26 C B" STRINGIFY(PREHEAT_2_TEMP_BED) " H" STRINGIFY(PREHEAT_2_TEMP_HOTEND) " P")); + #else + MENU_ITEM(gcode, MSG_UBL_VALIDATE_MESH_M1, PSTR("G28\nG26 C B0 H" STRINGIFY(PREHEAT_1_TEMP_HOTEND) " P")); + MENU_ITEM(gcode, MSG_UBL_VALIDATE_MESH_M2, PSTR("G28\nG26 C B0 H" STRINGIFY(PREHEAT_2_TEMP_HOTEND) " P")); + #endif + MENU_ITEM(function, MSG_UBL_VALIDATE_CUSTOM_MESH, _lcd_ubl_validate_custom_mesh); + MENU_ITEM(function, MSG_WATCH, ui.return_to_status); + END_MENU(); +} + +/** + * UBL Grid Leveling Command + */ +void _lcd_ubl_grid_level_cmd() { + char UBL_LCD_GCODE[10]; + sprintf_P(UBL_LCD_GCODE, PSTR("G29 J%i"), side_points); + lcd_enqueue_command(UBL_LCD_GCODE); +} + +/** + * UBL Grid Leveling submenu + * + * << UBL Tools + * Side points: --- + * Level Mesh + */ +void _lcd_ubl_grid_level() { + START_MENU(); + MENU_BACK(MSG_UBL_TOOLS); + MENU_ITEM_EDIT(int3, MSG_UBL_SIDE_POINTS, &side_points, 2, 6); + MENU_ITEM(function, MSG_UBL_MESH_LEVEL, _lcd_ubl_grid_level_cmd); + END_MENU(); +} + +/** + * UBL Mesh Leveling submenu + * + * << UBL Tools + * 3-Point Mesh Leveling + * - Grid Mesh Leveling >> + * << Info Screen + */ +void _lcd_ubl_mesh_leveling() { + START_MENU(); + MENU_BACK(MSG_UBL_TOOLS); + MENU_ITEM(gcode, MSG_UBL_3POINT_MESH_LEVELING, PSTR("G29 J0")); + MENU_ITEM(submenu, MSG_UBL_GRID_MESH_LEVELING, _lcd_ubl_grid_level); + MENU_ITEM(function, MSG_WATCH, ui.return_to_status); + END_MENU(); +} + +/** + * UBL Fill-in Amount Mesh Command + */ +void _lcd_ubl_fillin_amount_cmd() { + char UBL_LCD_GCODE[16]; + sprintf_P(UBL_LCD_GCODE, PSTR("G29 P3 R C.%i"), ubl_fillin_amount); + lcd_enqueue_command(UBL_LCD_GCODE); +} + +/** + * UBL Fill-in Mesh submenu + * + * << Build Mesh + * Fill-in Amount: --- + * Fill-in Mesh + * Smart Fill-in + * Manual Fill-in + * << Info Screen + */ +void _menu_ubl_fillin() { + START_MENU(); + MENU_BACK(MSG_UBL_BUILD_MESH_MENU); + MENU_ITEM_EDIT_CALLBACK(int3, MSG_UBL_FILLIN_AMOUNT, &ubl_fillin_amount, 0, 9, _lcd_ubl_fillin_amount_cmd); + MENU_ITEM(gcode, MSG_UBL_SMART_FILLIN, PSTR("G29 P3 T0")); + MENU_ITEM(gcode, MSG_UBL_MANUAL_FILLIN, PSTR("G29 P2 B T0")); + MENU_ITEM(function, MSG_WATCH, ui.return_to_status); + END_MENU(); +} + +void _lcd_ubl_invalidate() { + ubl.invalidate(); + SERIAL_PROTOCOLLNPGM("Mesh invalidated."); +} + +/** + * UBL Build Mesh submenu + * + * << UBL Tools + * Build Mesh with Material 1 + * Build Mesh with Material 2 + * - Build Custom Mesh >> + * Build Cold Mesh + * - Fill-in Mesh >> + * Continue Bed Mesh + * Invalidate All + * Invalidate Closest + * << Info Screen + */ +void _lcd_ubl_build_mesh() { + START_MENU(); + MENU_BACK(MSG_UBL_TOOLS); + #if HAS_HEATED_BED + MENU_ITEM(gcode, MSG_UBL_BUILD_MESH_M1, PSTR( + "G28\n" + "M190 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\n" + "M109 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) "\n" + "G29 P1\n" + "M104 S0\n" + "M140 S0" + )); + MENU_ITEM(gcode, MSG_UBL_BUILD_MESH_M2, PSTR( + "G28\n" + "M190 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\n" + "M109 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) "\n" + "G29 P1\n" + "M104 S0\n" + "M140 S0" + )); + #else + MENU_ITEM(gcode, MSG_UBL_BUILD_MESH_M1, PSTR( + "G28\n" + "M109 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) "\n" + "G29 P1\n" + "M104 S0" + )); + MENU_ITEM(gcode, MSG_UBL_BUILD_MESH_M2, PSTR( + "G28\n" + "M109 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) "\n" + "G29 P1\n" + "M104 S0" + )); + #endif + MENU_ITEM(submenu, MSG_UBL_BUILD_CUSTOM_MESH, _lcd_ubl_custom_mesh); + MENU_ITEM(gcode, MSG_UBL_BUILD_COLD_MESH, PSTR("G28\nG29 P1")); + MENU_ITEM(submenu, MSG_UBL_FILLIN_MESH, _menu_ubl_fillin); + MENU_ITEM(gcode, MSG_UBL_CONTINUE_MESH, PSTR("G29 P1 C")); + MENU_ITEM(function, MSG_UBL_INVALIDATE_ALL, _lcd_ubl_invalidate); + MENU_ITEM(gcode, MSG_UBL_INVALIDATE_CLOSEST, PSTR("G29 I")); + MENU_ITEM(function, MSG_WATCH, ui.return_to_status); + END_MENU(); +} + +/** + * UBL Load Mesh Command + */ +void _lcd_ubl_load_mesh_cmd() { + char UBL_LCD_GCODE[25]; + sprintf_P(UBL_LCD_GCODE, PSTR("G29 L%i"), ubl_storage_slot); + lcd_enqueue_command(UBL_LCD_GCODE); + sprintf_P(UBL_LCD_GCODE, PSTR("M117 " MSG_MESH_LOADED), ubl_storage_slot); + lcd_enqueue_command(UBL_LCD_GCODE); +} + +/** + * UBL Save Mesh Command + */ +void _lcd_ubl_save_mesh_cmd() { + char UBL_LCD_GCODE[25]; + sprintf_P(UBL_LCD_GCODE, PSTR("G29 S%i"), ubl_storage_slot); + lcd_enqueue_command(UBL_LCD_GCODE); + sprintf_P(UBL_LCD_GCODE, PSTR("M117 " MSG_MESH_SAVED), ubl_storage_slot); + lcd_enqueue_command(UBL_LCD_GCODE); +} + +/** + * UBL Mesh Storage submenu + * + * << Unified Bed Leveling + * Memory Slot: --- + * Load Bed Mesh + * Save Bed Mesh + */ +void _lcd_ubl_storage_mesh() { + int16_t a = settings.calc_num_meshes(); + START_MENU(); + MENU_BACK(MSG_UBL_LEVEL_BED); + if (!WITHIN(ubl_storage_slot, 0, a - 1)) { + STATIC_ITEM(MSG_NO_STORAGE); + } + else { + MENU_ITEM_EDIT(int3, MSG_UBL_STORAGE_SLOT, &ubl_storage_slot, 0, a - 1); + MENU_ITEM(function, MSG_UBL_LOAD_MESH, _lcd_ubl_load_mesh_cmd); + MENU_ITEM(function, MSG_UBL_SAVE_MESH, _lcd_ubl_save_mesh_cmd); + } + END_MENU(); +} + +/** + * UBL LCD "radar" map homing + */ +void _lcd_ubl_output_map_lcd(); + +void _lcd_ubl_map_homing() { + ui.defer_status_screen(true); + _lcd_draw_homing(); + if (all_axes_homed()) { + ubl.lcd_map_control = true; // Return to the map screen + ui.goto_screen(_lcd_ubl_output_map_lcd); + } +} + +/** + * UBL LCD "radar" map point editing + */ +void _lcd_ubl_map_lcd_edit_cmd() { + char UBL_LCD_GCODE[50], str[10], str2[10]; + dtostrf(pgm_read_float(&ubl._mesh_index_to_xpos[x_plot]), 0, 2, str); + dtostrf(pgm_read_float(&ubl._mesh_index_to_ypos[y_plot]), 0, 2, str2); + snprintf_P(UBL_LCD_GCODE, sizeof(UBL_LCD_GCODE), PSTR("G29 P4 X%s Y%s R%i"), str, str2, n_edit_pts); + lcd_enqueue_command(UBL_LCD_GCODE); +} + +/** + * UBL LCD Map Movement + */ +void ubl_map_move_to_xy() { + current_position[X_AXIS] = pgm_read_float(&ubl._mesh_index_to_xpos[x_plot]); + current_position[Y_AXIS] = pgm_read_float(&ubl._mesh_index_to_ypos[y_plot]); + planner.buffer_line(current_position, MMM_TO_MMS(XY_PROBE_SPEED), active_extruder); +} + +/** + * UBL LCD "radar" map + */ +void set_current_from_steppers_for_axis(const AxisEnum axis); +void sync_plan_position(); + +void _lcd_do_nothing() {} +void _lcd_hard_stop() { + const screenFunc_t old_screen = ui.currentScreen; + ui.currentScreen = _lcd_do_nothing; + planner.quick_stop(); + ui.currentScreen = old_screen; + set_current_from_steppers_for_axis(ALL_AXES); + sync_plan_position(); +} + +void _lcd_ubl_output_map_lcd() { + static int16_t step_scaler = 0; + + if (ui.use_click()) return _lcd_ubl_map_lcd_edit_cmd(); + ui.encoder_direction_normal(); + + if (ui.encoderPosition) { + step_scaler += (int32_t)ui.encoderPosition; + x_plot += step_scaler / (ENCODER_STEPS_PER_MENU_ITEM); + if (ABS(step_scaler) >= ENCODER_STEPS_PER_MENU_ITEM) step_scaler = 0; + ui.encoderPosition = 0; + ui.refresh(LCDVIEW_REDRAW_NOW); + } + + // Encoder to the right (++) + if (x_plot >= GRID_MAX_POINTS_X) { x_plot = 0; y_plot++; } + if (y_plot >= GRID_MAX_POINTS_Y) y_plot = 0; + + // Encoder to the left (--) + if (x_plot <= GRID_MAX_POINTS_X - (GRID_MAX_POINTS_X + 1)) { x_plot = GRID_MAX_POINTS_X - 1; y_plot--; } + if (y_plot <= GRID_MAX_POINTS_Y - (GRID_MAX_POINTS_Y + 1)) y_plot = GRID_MAX_POINTS_Y - 1; + + // Prevent underrun/overrun of plot numbers + x_plot = constrain(x_plot, GRID_MAX_POINTS_X - (GRID_MAX_POINTS_X + 1), GRID_MAX_POINTS_X + 1); + y_plot = constrain(y_plot, GRID_MAX_POINTS_Y - (GRID_MAX_POINTS_Y + 1), GRID_MAX_POINTS_Y + 1); + + // Determine number of points to edit + #if IS_KINEMATIC + n_edit_pts = 9; //TODO: Delta accessible edit points + #else + const bool xc = WITHIN(x_plot, 1, GRID_MAX_POINTS_X - 2), + yc = WITHIN(y_plot, 1, GRID_MAX_POINTS_Y - 2); + n_edit_pts = yc ? (xc ? 9 : 6) : (xc ? 6 : 4); // Corners + #endif + + if (ui.should_draw()) { + ui.ubl_plot(x_plot, y_plot); + + if (planner.movesplanned()) // If the nozzle is already moving, cancel the move. + _lcd_hard_stop(); + + ubl_map_move_to_xy(); // Move to new location + } +} + +/** + * UBL Homing before LCD map + */ +void _lcd_ubl_output_map_lcd_cmd() { + if (!all_axes_known()) { + set_all_unhomed(); + enqueue_and_echo_commands_P(PSTR("G28")); + } + ui.goto_screen(_lcd_ubl_map_homing); +} + +/** + * UBL Output map submenu + * + * << Unified Bed Leveling + * Output for Host + * Output for CSV + * Off Printer Backup + * Output Mesh Map + */ +void _lcd_ubl_output_map() { + START_MENU(); + MENU_BACK(MSG_UBL_LEVEL_BED); + MENU_ITEM(gcode, MSG_UBL_OUTPUT_MAP_HOST, PSTR("G29 T0")); + MENU_ITEM(gcode, MSG_UBL_OUTPUT_MAP_CSV, PSTR("G29 T1")); + MENU_ITEM(gcode, MSG_UBL_OUTPUT_MAP_BACKUP, PSTR("G29 S-1")); + MENU_ITEM(function, MSG_UBL_OUTPUT_MAP, _lcd_ubl_output_map_lcd_cmd); + END_MENU(); +} + +/** + * UBL Tools submenu + * + * << Unified Bed Leveling + * - Build Mesh >> + * - Validate Mesh >> + * - Edit Mesh >> + * - Mesh Leveling >> + */ +void _menu_ubl_tools() { + START_MENU(); + MENU_BACK(MSG_UBL_LEVEL_BED); + MENU_ITEM(submenu, MSG_UBL_BUILD_MESH_MENU, _lcd_ubl_build_mesh); + MENU_ITEM(gcode, MSG_UBL_MANUAL_MESH, PSTR("G29 I999\nG29 P2 B T0")); + MENU_ITEM(submenu, MSG_UBL_VALIDATE_MESH_MENU, _lcd_ubl_validate_mesh); + MENU_ITEM(submenu, MSG_EDIT_MESH, _lcd_ubl_edit_mesh); + MENU_ITEM(submenu, MSG_UBL_MESH_LEVELING, _lcd_ubl_mesh_leveling); + END_MENU(); +} + +/** + * UBL Step-By-Step submenu + * + * << Unified Bed Leveling + * 1 Build Cold Mesh + * 2 Smart Fill-in + * - 3 Validate Mesh >> + * 4 Fine Tune All + * - 5 Validate Mesh >> + * 6 Fine Tune All + * 7 Save Bed Mesh + */ +void _lcd_ubl_step_by_step() { + START_MENU(); + MENU_BACK(MSG_UBL_LEVEL_BED); + MENU_ITEM(gcode, "1 " MSG_UBL_BUILD_COLD_MESH, PSTR("G28\nG29 P1")); + MENU_ITEM(gcode, "2 " MSG_UBL_SMART_FILLIN, PSTR("G29 P3 T0")); + MENU_ITEM(submenu, "3 " MSG_UBL_VALIDATE_MESH_MENU, _lcd_ubl_validate_mesh); + MENU_ITEM(gcode, "4 " MSG_UBL_FINE_TUNE_ALL, PSTR("G29 P4 R999 T")); + MENU_ITEM(submenu, "5 " MSG_UBL_VALIDATE_MESH_MENU, _lcd_ubl_validate_mesh); + MENU_ITEM(gcode, "6 " MSG_UBL_FINE_TUNE_ALL, PSTR("G29 P4 R999 T")); + MENU_ITEM(function, "7 " MSG_UBL_SAVE_MESH, _lcd_ubl_save_mesh_cmd); + END_MENU(); +} + +/** + * UBL System submenu + * + * << Motion + * - Manually Build Mesh >> + * - Activate UBL >> + * - Deactivate UBL >> + * - Step-By-Step UBL >> + * - Mesh Storage >> + * - Output Map >> + * - UBL Tools >> + * - Output UBL Info >> + */ + +void _lcd_ubl_level_bed() { + START_MENU(); + MENU_BACK(MSG_MOTION); + MENU_ITEM(gcode, MSG_UBL_ACTIVATE_MESH, PSTR("G29 A")); + MENU_ITEM(gcode, MSG_UBL_DEACTIVATE_MESH, PSTR("G29 D")); + MENU_ITEM(submenu, MSG_UBL_STEP_BY_STEP_MENU, _lcd_ubl_step_by_step); + MENU_ITEM(function, MSG_UBL_MESH_EDIT, _lcd_ubl_output_map_lcd_cmd); + MENU_ITEM(submenu, MSG_UBL_STORAGE_MESH_MENU, _lcd_ubl_storage_mesh); + MENU_ITEM(submenu, MSG_UBL_OUTPUT_MAP, _lcd_ubl_output_map); + MENU_ITEM(submenu, MSG_UBL_TOOLS, _menu_ubl_tools); + MENU_ITEM(gcode, MSG_UBL_INFO_UBL, PSTR("G29 W")); + #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float3, MSG_Z_FADE_HEIGHT, &lcd_z_fade_height, 0, 100, _lcd_set_z_fade_height); + #endif + END_MENU(); +} + +#endif // HAS_LCD_MENU && AUTO_BED_LEVELING_UBL diff --git a/Marlin/src/lcd/ultralcd.cpp b/Marlin/src/lcd/ultralcd.cpp index e346e61c36..afbcdfb4d9 100644 --- a/Marlin/src/lcd/ultralcd.cpp +++ b/Marlin/src/lcd/ultralcd.cpp @@ -22,655 +22,394 @@ #include "../inc/MarlinConfigPre.h" -#if ENABLED(ULTRA_LCD) +// These displays all share the MarlinUI class +#if HAS_SPI_LCD || ENABLED(MALYAN_LCD) || ENABLED(EXTENSIBLE_UI) + #include "ultralcd.h" + MarlinUI ui; + #if ENABLED(SDSUPPORT) + #include "../sd/cardreader.h" + #endif + #if ENABLED(EXTENSIBLE_UI) + #define START_OF_UTF8_CHAR(C) (((C) & 0xC0u) != 0x80u) + #endif +#endif -#include +#if HAS_SPI_LCD + #if ENABLED(STATUS_MESSAGE_SCROLLING) + uint8_t MarlinUI::status_scroll_offset; // = 0 + #if LONG_FILENAME_LENGTH > CHARSIZE * 2 * (LCD_WIDTH) + #define MAX_MESSAGE_LENGTH LONG_FILENAME_LENGTH + #else + #define MAX_MESSAGE_LENGTH CHARSIZE * 2 * (LCD_WIDTH) + #endif + #else + #define MAX_MESSAGE_LENGTH CHARSIZE * (LCD_WIDTH) + #endif +#elif ENABLED(EXTENSIBLE_UI) + #define MAX_MESSAGE_LENGTH 63 +#endif -#include "ultralcd.h" +#ifdef MAX_MESSAGE_LENGTH + uint8_t MarlinUI::status_message_level; // = 0 + char MarlinUI::status_message[MAX_MESSAGE_LENGTH + 1]; +#endif + +#if HAS_SPI_LCD + +#if HAS_GRAPHICAL_LCD + #include "dogm/ultralcd_DOGM.h" +#endif + +#include "lcdprint.h" #include "../sd/cardreader.h" #include "../module/temperature.h" #include "../module/planner.h" -#include "../module/stepper.h" -#include "../module/motion.h" -#include "../module/probe.h" #include "../module/printcounter.h" -#include "../gcode/gcode.h" +#include "../module/motion.h" #include "../gcode/queue.h" -#include "../module/configuration_store.h" -#include "../module/tool_change.h" - #include "../Marlin.h" -#if ENABLED(ADVANCED_PAUSE_FEATURE) - #include "../feature/pause.h" -#endif - #if ENABLED(POWER_LOSS_RECOVERY) - #include "../feature/power_loss_recovery.h" + #include "../feature/power_loss_recovery.h" #endif -#if ENABLED(PRINTCOUNTER) && ENABLED(LCD_INFO_MENU) - #include "../libs/duration_t.h" +#if ENABLED(AUTO_BED_LEVELING_UBL) + #include "../feature/bedlevel/bedlevel.h" #endif -#if ENABLED(FILAMENT_LCD_DISPLAY) - #include "../feature/filwidth.h" -#endif - -#if ENABLED(BLTOUCH) - #include "../module/endstops.h" -#endif - -#if HAS_LEVELING - #include "../feature/bedlevel/bedlevel.h" -#endif - -#if ENABLED(LED_CONTROL_MENU) - #include "../feature/leds/leds.h" -#endif - -#if DISABLED(LCD_USE_I2C_BUZZER) +#if HAS_BUZZER #include "../libs/buzzer.h" #endif -#if ENABLED(STATUS_MESSAGE_SCROLLING) - #if LONG_FILENAME_LENGTH > CHARSIZE * 2 * (LCD_WIDTH) - #define MAX_MESSAGE_LENGTH LONG_FILENAME_LENGTH - #else - #define MAX_MESSAGE_LENGTH CHARSIZE * 2 * (LCD_WIDTH) +#if HAS_ENCODER_ACTION + volatile uint8_t MarlinUI::buttons; + #if HAS_SLOW_BUTTONS + volatile uint8_t MarlinUI::slow_buttons; #endif - uint8_t status_scroll_offset = 0; -#else - #define MAX_MESSAGE_LENGTH CHARSIZE * (LCD_WIDTH) #endif -char lcd_status_message[MAX_MESSAGE_LENGTH + 1]; -uint8_t lcd_status_update_delay = 1, // First update one loop delayed - lcd_status_message_level; // Higher level blocks lower level +#if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT) + uint8_t lcd_sd_status; +#endif + +#if HAS_LCD_MENU && LCD_TIMEOUT_TO_STATUS + bool MarlinUI::defer_return_to_status; +#endif + +uint8_t MarlinUI::lcd_status_update_delay = 1; // First update one loop delayed #if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT) - millis_t previous_lcd_status_ms = 0; -#endif - -#if ENABLED(ULTIPANEL) && ENABLED(SCROLL_LONG_FILENAMES) - uint8_t filename_scroll_pos, filename_scroll_max, filename_scroll_hash; + millis_t MarlinUI::next_filament_display; // = 0 #endif #if ENABLED(LCD_SET_PROGRESS_MANUALLY) - uint8_t progress_bar_percent; + uint8_t MarlinUI::progress_bar_percent; // = 0 #endif -#if ENABLED(DOGLCD) - #include "ultralcd_impl_DOGM.h" - bool drawing_screen, first_page; // = false -#else - #include "ultralcd_impl_HD44780.h" - constexpr bool first_page = true; +millis_t next_button_update_ms; + +#if HAS_GRAPHICAL_LCD + bool MarlinUI::drawing_screen, MarlinUI::first_page; // = false #endif -// The main status screen -void lcd_status_screen(); +// Encoder Handling +#if HAS_ENCODER_ACTION + uint32_t MarlinUI::encoderPosition; + volatile int8_t encoderDiff; // Updated in update_buttons, added to encoderPosition every LCD update +#endif -millis_t next_lcd_update_ms; - -uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to draw, decrements after every draw. Set to 2 in LCD routines so the LCD gets at least 1 full redraw (first redraw is partial) -uint16_t max_display_update_time = 0; - -#if ENABLED(ULTIPANEL) - - #define DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(_type, _name, _strFunc) \ - inline void lcd_implementation_drawmenu_setting_edit_ ## _name (const bool sel, const uint8_t row, const char* pstr, const char* pstr2, _type * const data, ...) { \ - UNUSED(pstr2); \ - DRAWMENU_SETTING_EDIT_GENERIC(_strFunc(*(data))); \ - } \ - inline void lcd_implementation_drawmenu_setting_edit_callback_ ## _name (const bool sel, const uint8_t row, const char* pstr, const char* pstr2, _type * const data, ...) { \ - UNUSED(pstr2); \ - DRAWMENU_SETTING_EDIT_GENERIC(_strFunc(*(data))); \ - } \ - inline void lcd_implementation_drawmenu_setting_edit_accessor_ ## _name (const bool sel, const uint8_t row, const char* pstr, const char* pstr2, _type (*pget)(), void (*pset)(_type), ...) { \ - UNUSED(pstr2); UNUSED(pset); \ - DRAWMENU_SETTING_EDIT_GENERIC(_strFunc(pget())); \ - } \ - typedef void _name##_void - DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(int16_t, int3, itostr3); - DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(uint8_t, int8, i8tostr3); - DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(float, float3, ftostr3); - DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(float, float52, ftostr52); - DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(float, float43, ftostr43sign); - DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(float, float5, ftostr5rj); - DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(float, float51, ftostr51sign); - DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(float, float52sign, ftostr52sign); - DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(float, float62, ftostr62rj); - DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(uint32_t, long5, ftostr5rj); - #define lcd_implementation_drawmenu_setting_edit_bool(sel, row, pstr, pstr2, data) DRAW_BOOL_SETTING(sel, row, pstr, data) - #define lcd_implementation_drawmenu_setting_edit_callback_bool(sel, row, pstr, pstr2, data, callback) DRAW_BOOL_SETTING(sel, row, pstr, data) - #define lcd_implementation_drawmenu_setting_edit_accessor_bool(sel, row, pstr, pstr2, pget, pset) DRAW_BOOL_SETTING(sel, row, pstr, data) - - #ifndef TALL_FONT_CORRECTION - #define TALL_FONT_CORRECTION 0 - #endif - - bool no_reentry = false; - constexpr int8_t menu_bottom = LCD_HEIGHT - (TALL_FONT_CORRECTION); - - // Initialized by settings.load() - int16_t lcd_preheat_hotend_temp[2], lcd_preheat_bed_temp[2], lcd_preheat_fan_speed[2]; - - #if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(G26_MESH_VALIDATION) - bool lcd_external_control; // = false - #endif - - #if ENABLED(BABYSTEPPING) - long babysteps_done = 0; - #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - static void lcd_babystep_zoffset(); - #else - static void lcd_babystep_z(); - #endif - #endif - - #if ENABLED(DAC_STEPPER_CURRENT) - #include "../feature/dac/stepper_dac.h" //was dac_mcp4728.h MarlinMain uses stepper dac for the m-codes - uint8_t driverPercent[XYZE]; - #endif - - //////////////////////////////////////////// - ///////////////// Menu Tree //////////////// - //////////////////////////////////////////// - - void lcd_main_menu(); - void lcd_tune_menu(); - void lcd_movement_menu(); - void lcd_move_menu(); - void lcd_configuration_menu(); - void lcd_temperature_menu(); - void lcd_advanced_settings_menu(); - - #if DISABLED(SLIM_LCD_MENUS) - void lcd_configuration_temperature_preheat_material1_settings_menu(); - void lcd_configuration_temperature_preheat_material2_settings_menu(); - #endif - - #if DISABLED(NO_VOLUMETRICS) || ENABLED(ADVANCED_PAUSE_FEATURE) - void lcd_advanced_filament_menu(); - #endif - - #if ENABLED(LCD_INFO_MENU) - #if ENABLED(PRINTCOUNTER) - void lcd_info_stats_menu(); - #endif - void lcd_info_thermistors_menu(); - void lcd_info_board_menu(); - void lcd_info_menu(); - #endif // LCD_INFO_MENU - - #if ENABLED(LED_CONTROL_MENU) - void lcd_led_menu(); - #endif - - #if ENABLED(ADVANCED_PAUSE_FEATURE) - #if E_STEPPERS > 1 || ENABLED(FILAMENT_LOAD_UNLOAD_GCODES) - void lcd_change_filament_menu(); - #else - void lcd_temp_menu_e0_filament_change(); - #endif - #endif - - #if ENABLED(DAC_STEPPER_CURRENT) - void dac_driver_commit(); - void dac_driver_getValues(); - void lcd_dac_menu(); - void lcd_dac_write_eeprom(); - #endif - - #if ENABLED(FWRETRACT) - #include "../feature/fwretract.h" - void lcd_config_retract_menu(); - #endif - - #if ENABLED(DELTA_CALIBRATION_MENU) || ENABLED(DELTA_AUTO_CALIBRATION) - void lcd_delta_calibrate_menu(); - #endif - - #if ENABLED(MESH_BED_LEVELING) && ENABLED(LCD_BED_LEVELING) - #include "../feature/bedlevel/mbl/mesh_bed_leveling.h" - #endif - - #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) - static float new_z_fade_height; - void _lcd_set_z_fade_height() { set_z_fade_height(new_z_fade_height); } - #endif - - //////////////////////////////////////////// - //////////// Menu System Actions /////////// - //////////////////////////////////////////// - - #define menu_action_back(dummy) _menu_action_back() - void _menu_action_back(); - void menu_action_submenu(screenFunc_t data); - void menu_action_gcode(const char* pgcode); - void menu_action_function(menuAction_t data); - - #define DECLARE_MENU_EDIT_TYPE(_type, _name) \ - bool _menu_edit_ ## _name(); \ - void menu_edit_ ## _name(); \ - void menu_edit_callback_ ## _name(); \ - void _menu_action_setting_edit_ ## _name(const char * const pstr, _type* const ptr, const _type minValue, const _type maxValue); \ - void menu_action_setting_edit_ ## _name(const char * const pstr, _type * const ptr, const _type minValue, const _type maxValue); \ - void menu_action_setting_edit_callback_ ## _name(const char * const pstr, _type * const ptr, const _type minValue, const _type maxValue, const screenFunc_t callback=NULL, const bool live=false); \ - typedef void _name##_void - - DECLARE_MENU_EDIT_TYPE(int16_t, int3); - DECLARE_MENU_EDIT_TYPE(uint8_t, int8); - DECLARE_MENU_EDIT_TYPE(float, float3); - DECLARE_MENU_EDIT_TYPE(float, float52); - DECLARE_MENU_EDIT_TYPE(float, float43); - DECLARE_MENU_EDIT_TYPE(float, float5); - DECLARE_MENU_EDIT_TYPE(float, float51); - DECLARE_MENU_EDIT_TYPE(float, float52sign); - DECLARE_MENU_EDIT_TYPE(float, float62); - DECLARE_MENU_EDIT_TYPE(uint32_t, long5); - - void menu_action_setting_edit_bool(const char* pstr, bool* ptr); - void menu_action_setting_edit_callback_bool(const char* pstr, bool* ptr, screenFunc_t callbackFunc); +#if HAS_LCD_MENU + #include "menu/menu.h" + #include "../sd/cardreader.h" #if ENABLED(SDSUPPORT) - void lcd_sdcard_menu(); - void menu_action_sdfile(CardReader &theCard); - void menu_action_sddirectory(CardReader &theCard); + + #if ENABLED(SCROLL_LONG_FILENAMES) + uint8_t MarlinUI::filename_scroll_pos, MarlinUI::filename_scroll_max; + #endif + + const char * MarlinUI::scrolled_filename(CardReader &theCard, const uint8_t maxlen, uint8_t hash, const bool doScroll) { + const char *outstr = theCard.longest_filename(); + if (theCard.longFilename[0]) { + #if ENABLED(SCROLL_LONG_FILENAMES) + if (doScroll) { + for (uint8_t l = FILENAME_LENGTH; l--;) + hash = ((hash << 1) | (hash >> 7)) ^ theCard.filename[l]; // rotate, xor + static uint8_t filename_scroll_hash; + if (filename_scroll_hash != hash) { // If the hash changed... + filename_scroll_hash = hash; // Save the new hash + filename_scroll_max = MAX(0, utf8_strlen(theCard.longFilename) - maxlen); // Update the scroll limit + filename_scroll_pos = 0; // Reset scroll to the start + lcd_status_update_delay = 8; // Don't scroll right away + } + outstr += filename_scroll_pos; + } + #else + theCard.longFilename[maxlen] = '\0'; // cutoff at screen edge + #endif + } + return outstr; + } + #endif - //////////////////////////////////////////// - //////////// Menu System Macros //////////// - //////////////////////////////////////////// - - /** - * MENU_ITEM generates draw & handler code for a menu item, potentially calling: - * - * lcd_implementation_drawmenu_[type](sel, row, label, arg3...) - * menu_action_[type](arg3...) - * - * Examples: - * MENU_ITEM(back, MSG_WATCH, 0 [dummy parameter] ) - * or - * MENU_BACK(MSG_WATCH) - * lcd_implementation_drawmenu_back(sel, row, PSTR(MSG_WATCH)) - * menu_action_back() - * - * MENU_ITEM(function, MSG_PAUSE_PRINT, lcd_sdcard_pause) - * lcd_implementation_drawmenu_function(sel, row, PSTR(MSG_PAUSE_PRINT), lcd_sdcard_pause) - * menu_action_function(lcd_sdcard_pause) - * - * MENU_ITEM_EDIT(int3, MSG_SPEED, &feedrate_percentage, 10, 999) - * MENU_ITEM(setting_edit_int3, MSG_SPEED, PSTR(MSG_SPEED), &feedrate_percentage, 10, 999) - * lcd_implementation_drawmenu_setting_edit_int3(sel, row, PSTR(MSG_SPEED), PSTR(MSG_SPEED), &feedrate_percentage, 10, 999) - * menu_action_setting_edit_int3(PSTR(MSG_SPEED), &feedrate_percentage, 10, 999) - * - */ - #define _MENU_ITEM_PART_1(TYPE, ...) \ - if (_menuLineNr == _thisItemNr) { \ - if (encoderLine == _thisItemNr && lcd_clicked) { \ - lcd_clicked = false - - #define _MENU_ITEM_PART_2(TYPE, PLABEL, ...) \ - menu_action_ ## TYPE(__VA_ARGS__); \ - if (screen_changed) return; \ - } \ - if (lcdDrawUpdate) \ - lcd_implementation_drawmenu_ ## TYPE(encoderLine == _thisItemNr, _lcdLineNr, PLABEL, ## __VA_ARGS__); \ - } \ - ++_thisItemNr - - #define MENU_ITEM_P(TYPE, PLABEL, ...) do { \ - _skipStatic = false; \ - _MENU_ITEM_PART_1(TYPE, ## __VA_ARGS__); \ - _MENU_ITEM_PART_2(TYPE, PLABEL, ## __VA_ARGS__); \ - }while(0) - - #define MENU_ITEM(TYPE, LABEL, ...) MENU_ITEM_P(TYPE, PSTR(LABEL), ## __VA_ARGS__) - - #define MENU_BACK(LABEL) MENU_ITEM(back, LABEL, 0) - - // Used to print static text with no visible cursor. - // Parameters: label [, bool center [, bool invert [, char *value] ] ] - #define STATIC_ITEM_P(LABEL, ...) \ - if (_menuLineNr == _thisItemNr) { \ - if (_skipStatic && encoderLine <= _thisItemNr) { \ - encoderPosition += ENCODER_STEPS_PER_MENU_ITEM; \ - ++encoderLine; \ - } \ - if (lcdDrawUpdate) \ - lcd_implementation_drawmenu_static(_lcdLineNr, LABEL, ## __VA_ARGS__); \ - } \ - ++_thisItemNr - - #define STATIC_ITEM(LABEL, ...) STATIC_ITEM_P(PSTR(LABEL), ## __VA_ARGS__) + screenFunc_t MarlinUI::currentScreen; // Initialized in CTOR #if ENABLED(ENCODER_RATE_MULTIPLIER) + bool MarlinUI::encoderRateMultiplierEnabled; + millis_t MarlinUI::lastEncoderMovementMillis = 0; + void MarlinUI::enable_encoder_multiplier(const bool onoff) { + encoderRateMultiplierEnabled = onoff; + lastEncoderMovementMillis = 0; + } + #endif - bool encoderRateMultiplierEnabled; - #define ENCODER_RATE_MULTIPLY(F) (encoderRateMultiplierEnabled = F) - - //#define ENCODER_RATE_MULTIPLIER_DEBUG // If defined, output the encoder steps per second value - - /** - * MENU_MULTIPLIER_ITEM generates drawing and handling code for a multiplier menu item - */ - #define MENU_MULTIPLIER_ITEM(TYPE, LABEL, ...) do { \ - _MENU_ITEM_PART_1(TYPE, ## __VA_ARGS__); \ - encoderRateMultiplierEnabled = true; \ - lastEncoderMovementMillis = 0; \ - _MENU_ITEM_PART_2(TYPE, PSTR(LABEL), ## __VA_ARGS__); \ - }while(0) - - #else // !ENCODER_RATE_MULTIPLIER - #define ENCODER_RATE_MULTIPLY(F) NOOP - #endif // !ENCODER_RATE_MULTIPLIER - - #define MENU_ITEM_DUMMY() do { _thisItemNr++; }while(0) - #define MENU_ITEM_EDIT(TYPE, LABEL, ...) MENU_ITEM(setting_edit_ ## TYPE, LABEL, PSTR(LABEL), ## __VA_ARGS__) - #define MENU_ITEM_EDIT_CALLBACK(TYPE, LABEL, ...) MENU_ITEM(setting_edit_callback_ ## TYPE, LABEL, PSTR(LABEL), ## __VA_ARGS__) - #if ENABLED(ENCODER_RATE_MULTIPLIER) - #define MENU_MULTIPLIER_ITEM_EDIT(TYPE, LABEL, ...) MENU_MULTIPLIER_ITEM(setting_edit_ ## TYPE, LABEL, PSTR(LABEL), ## __VA_ARGS__) - #define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(TYPE, LABEL, ...) MENU_MULTIPLIER_ITEM(setting_edit_callback_ ## TYPE, LABEL, PSTR(LABEL), ## __VA_ARGS__) - #else // !ENCODER_RATE_MULTIPLIER - #define MENU_MULTIPLIER_ITEM_EDIT(TYPE, LABEL, ...) MENU_ITEM(setting_edit_ ## TYPE, LABEL, PSTR(LABEL), ## __VA_ARGS__) - #define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(TYPE, LABEL, ...) MENU_ITEM(setting_edit_callback_ ## TYPE, LABEL, PSTR(LABEL), ## __VA_ARGS__) - #endif // !ENCODER_RATE_MULTIPLIER - - #define SCREEN_OR_MENU_LOOP() \ - int8_t _menuLineNr = encoderTopLine, _thisItemNr; \ - for (int8_t _lcdLineNr = 0; _lcdLineNr < menu_bottom; _lcdLineNr++, _menuLineNr++) { \ - _thisItemNr = 0 - - /** - * START_SCREEN Opening code for a screen having only static items. - * Do simplified scrolling of the entire screen. - * - * START_MENU Opening code for a screen with menu items. - * Scroll as-needed to keep the selected line in view. - */ - #define START_SCREEN() \ - scroll_screen(menu_bottom, false); \ - bool _skipStatic = false; \ - SCREEN_OR_MENU_LOOP() - - #define START_MENU() \ - scroll_screen(1, true); \ - bool _skipStatic = true; \ - SCREEN_OR_MENU_LOOP() - - #define END_SCREEN() \ - } \ - screen_items = _thisItemNr - - #define END_MENU() \ - } \ - screen_items = _thisItemNr; \ - UNUSED(_skipStatic) - - //////////////////////////////////////////// - ///////////// Global Variables ///////////// - //////////////////////////////////////////// - - /** - * REVERSE_MENU_DIRECTION - * - * To reverse the menu direction we need a general way to reverse - * the direction of the encoder everywhere. So encoderDirection is - * added to allow the encoder to go the other way. - * - * This behavior is limited to scrolling Menus and SD card listings, - * and is disabled in other contexts. - */ #if ENABLED(REVERSE_MENU_DIRECTION) - int8_t encoderDirection = 1; - #define ENCODER_DIRECTION_NORMAL() (encoderDirection = 1) - #define ENCODER_DIRECTION_MENUS() (encoderDirection = -1) - #else - #define ENCODER_DIRECTION_NORMAL() ; - #define ENCODER_DIRECTION_MENUS() ; + int8_t MarlinUI::encoderDirection = 1; #endif - // Encoder Movement - volatile int8_t encoderDiff; // Updated in lcd_buttons_update, added to encoderPosition every LCD update - uint32_t encoderPosition; - millis_t lastEncoderMovementMillis = 0; + bool MarlinUI::lcd_clicked; + float move_menu_scale; - // Button States - bool lcd_clicked, wait_for_unclick; - volatile uint8_t buttons; - millis_t next_button_update_ms; - #if ENABLED(REPRAPWORLD_KEYPAD) - volatile uint8_t buttons_reprapworld_keypad; - #endif - #if ENABLED(LCD_HAS_SLOW_BUTTONS) - volatile uint8_t slow_buttons; - #endif - - // Menu System Navigation - screenFunc_t currentScreen = lcd_status_screen; - int8_t encoderTopLine; - typedef struct { - screenFunc_t menu_function; - uint32_t encoder_position; - } menuPosition; - menuPosition screen_history[6]; - uint8_t screen_history_depth = 0; - bool screen_changed, defer_return_to_status; - - // Value Editing - const char *editLabel; - void *editValue; - int32_t minEditValue, maxEditValue; - screenFunc_t callbackFunc; - bool liveEdit; - - // Manual Moves - const float manual_feedrate_mm_m[] = MANUAL_FEEDRATE; - millis_t manual_move_start_time = 0; - int8_t manual_move_axis = (int8_t)NO_AXIS; - #if EXTRUDERS > 1 - int8_t manual_move_e_index = 0; - #else - #define manual_move_e_index 0 - #endif - - #if ENABLED(MANUAL_E_MOVES_RELATIVE) - float manual_move_e_origin = 0; - #endif - - #if IS_KINEMATIC - bool processing_manual_move = false; - float manual_move_offset = 0; - #else - constexpr bool processing_manual_move = false; - #endif - - #if PIN_EXISTS(SD_DETECT) - uint8_t lcd_sd_status; - #endif - - #if ENABLED(PIDTEMP) - float raw_Ki, raw_Kd; // place-holders for Ki and Kd edits - #endif - - inline bool use_click() { + bool MarlinUI::use_click() { const bool click = lcd_clicked; lcd_clicked = false; return click; } - /** - * General function to go directly to a screen - */ - void lcd_goto_screen(screenFunc_t screen, const uint32_t encoder/*=0*/) { - if (currentScreen != screen) { + #if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(G26_MESH_VALIDATION) - #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) - // Shadow for editing the fade height - new_z_fade_height = planner.z_fade_height; + bool MarlinUI::external_control; // = false + + void MarlinUI::wait_for_release() { + while (button_pressed()) safe_delay(50); + safe_delay(50); + } + + #endif + +#endif + +void MarlinUI::init() { + + init_lcd(); + + #if HAS_DIGITAL_BUTTONS + + #if BUTTON_EXISTS(EN1) + SET_INPUT_PULLUP(BTN_EN1); + #endif + #if BUTTON_EXISTS(EN2) + SET_INPUT_PULLUP(BTN_EN2); + #endif + #if BUTTON_EXISTS(ENC) + SET_INPUT_PULLUP(BTN_ENC); + #endif + + #if BUTTON_EXISTS(UP) + SET_INPUT(BTN_UP); + #endif + #if BUTTON_EXISTS(DWN) + SET_INPUT(BTN_DWN); + #endif + #if BUTTON_EXISTS(LFT) + SET_INPUT(BTN_LFT); + #endif + #if BUTTON_EXISTS(RT) + SET_INPUT(BTN_RT); + #endif + + #endif // !HAS_DIGITAL_BUTTONS + + #if HAS_SHIFT_ENCODER + + #if ENABLED(SR_LCD_2W_NL) // Non latching 2 wire shift register + + SET_OUTPUT(SR_DATA_PIN); + SET_OUTPUT(SR_CLK_PIN); + + #elif defined(SHIFT_CLK) + + SET_OUTPUT(SHIFT_CLK); + OUT_WRITE(SHIFT_LD, HIGH); + #if defined(SHIFT_EN) && SHIFT_EN >= 0 + OUT_WRITE(SHIFT_EN, LOW); #endif + SET_INPUT_PULLUP(SHIFT_OUT); - #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) && ENABLED(BABYSTEPPING) - static millis_t doubleclick_expire_ms = 0; - // Going to lcd_main_menu from status screen? Remember first click time. - // Going back to status screen within a very short time? Go to Z babystepping. - if (screen == lcd_main_menu) { - if (currentScreen == lcd_status_screen) - doubleclick_expire_ms = millis() + DOUBLECLICK_MAX_INTERVAL; - } - else if (screen == lcd_status_screen && currentScreen == lcd_main_menu && PENDING(millis(), doubleclick_expire_ms)/* && (planner.movesplanned() || IS_SD_PRINTING)*/) - screen = - #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - lcd_babystep_zoffset - #else - lcd_babystep_z - #endif - ; - #endif + #endif - currentScreen = screen; - encoderPosition = encoder; - if (screen == lcd_status_screen) { - defer_return_to_status = false; - #if ENABLED(AUTO_BED_LEVELING_UBL) - ubl.lcd_map_control = false; - #endif - screen_history_depth = 0; + #endif // HAS_SHIFT_ENCODER + + #if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT) + SET_INPUT_PULLUP(SD_DETECT_PIN); + lcd_sd_status = 2; // UNKNOWN + #endif + + #if HAS_ENCODER_ACTION && HAS_SLOW_BUTTONS + slow_buttons = 0; + #endif + + update_buttons(); + + #if HAS_ENCODER_ACTION + encoderDiff = 0; + #endif +} + +bool MarlinUI::get_blink() { + static uint8_t blink = 0; + static millis_t next_blink_ms = 0; + millis_t ms = millis(); + if (ELAPSED(ms, next_blink_ms)) { + blink ^= 0xFF; + next_blink_ms = ms + 1000 - (LCD_UPDATE_INTERVAL) / 2; + } + return blink != 0; +} + +//////////////////////////////////////////// +///////////// Keypad Handling ////////////// +//////////////////////////////////////////// + +#if ENABLED(REPRAPWORLD_KEYPAD) && HAS_ENCODER_ACTION + + volatile uint8_t MarlinUI::keypad_buttons; + + #if HAS_LCD_MENU && !HAS_ADC_BUTTONS + + void lcd_move_x(); + void lcd_move_y(); + void lcd_move_z(); + + void _reprapworld_keypad_move(const AxisEnum axis, const int16_t dir) { + move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP; + encoderPosition = dir; + switch (axis) { + case X_AXIS: lcd_move_x(); break; + case Y_AXIS: lcd_move_y(); break; + case Z_AXIS: lcd_move_z(); + default: break; } - lcd_implementation_clear(); - // Re-initialize custom characters that may be re-used - #if DISABLED(DOGLCD) && ENABLED(AUTO_BED_LEVELING_UBL) - if (!ubl.lcd_map_control) { - lcd_set_custom_characters( - #if ENABLED(LCD_PROGRESS_BAR) - screen == lcd_status_screen ? CHARSET_INFO : CHARSET_MENU + } + + #endif + + bool MarlinUI::handle_keypad() { + + #if HAS_ADC_BUTTONS + + #define ADC_MIN_KEY_DELAY 100 + if (keypad_buttons) { + #if HAS_ENCODER_ACTION + refresh(LCDVIEW_REDRAW_NOW); + #if HAS_LCD_MENU + if (encoderDirection == -1) { // ADC_KEYPAD forces REVERSE_MENU_DIRECTION, so this indicates menu navigation + if (RRK(EN_KEYPAD_UP)) encoderPosition += ENCODER_STEPS_PER_MENU_ITEM; + else if (RRK(EN_KEYPAD_DOWN)) encoderPosition -= ENCODER_STEPS_PER_MENU_ITEM; + else if (RRK(EN_KEYPAD_LEFT)) { MenuItem_back::action(); quick_feedback(); } + else if (RRK(EN_KEYPAD_RIGHT)) { return_to_status(); quick_feedback(); } + } + else + #endif + { + #if HAS_LCD_MENU + if (RRK(EN_KEYPAD_UP)) encoderPosition -= ENCODER_PULSES_PER_STEP; + else if (RRK(EN_KEYPAD_DOWN)) encoderPosition += ENCODER_PULSES_PER_STEP; + else if (RRK(EN_KEYPAD_LEFT)) { MenuItem_back::action(); quick_feedback(); } + else if (RRK(EN_KEYPAD_RIGHT)) encoderPosition = 0; + #else + if (RRK(EN_KEYPAD_UP) || RRK(EN_KEYPAD_LEFT)) encoderPosition -= ENCODER_PULSES_PER_STEP; + else if (RRK(EN_KEYPAD_DOWN) || RRK(EN_KEYPAD_RIGHT)) encoderPosition += ENCODER_PULSES_PER_STEP; #endif - ); - } - #elif ENABLED(LCD_PROGRESS_BAR) - lcd_set_custom_characters(screen == lcd_status_screen ? CHARSET_INFO : CHARSET_MENU); - #endif - lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT; - screen_changed = true; - #if ENABLED(DOGLCD) - drawing_screen = false; - #endif - } + } + #endif + next_button_update_ms = millis() + ADC_MIN_KEY_DELAY; + return true; + } + + #else // !HAS_ADC_BUTTONS + + static uint8_t keypad_debounce = 0; + + if (!RRK( EN_KEYPAD_F1 | EN_KEYPAD_F2 + | EN_KEYPAD_F3 | EN_KEYPAD_DOWN + | EN_KEYPAD_RIGHT | EN_KEYPAD_MIDDLE + | EN_KEYPAD_UP | EN_KEYPAD_LEFT ) + ) { + if (keypad_debounce > 0) keypad_debounce--; + } + else if (!keypad_debounce) { + keypad_debounce = 2; + + const bool homed = all_axes_homed(); + + #if HAS_LCD_MENU + + if (RRK(EN_KEYPAD_MIDDLE)) goto_screen(menu_move); + + #if DISABLED(DELTA) && Z_HOME_DIR == -1 + if (RRK(EN_KEYPAD_F2)) _reprapworld_keypad_move(Z_AXIS, 1); + #endif + + if (homed) { + #if ENABLED(DELTA) || Z_HOME_DIR != -1 + if (RRK(EN_KEYPAD_F2)) _reprapworld_keypad_move(Z_AXIS, 1); + #endif + if (RRK(EN_KEYPAD_F3)) _reprapworld_keypad_move(Z_AXIS, -1); + if (RRK(EN_KEYPAD_LEFT)) _reprapworld_keypad_move(X_AXIS, -1); + if (RRK(EN_KEYPAD_RIGHT)) _reprapworld_keypad_move(X_AXIS, 1); + if (RRK(EN_KEYPAD_DOWN)) _reprapworld_keypad_move(Y_AXIS, 1); + if (RRK(EN_KEYPAD_UP)) _reprapworld_keypad_move(Y_AXIS, -1); + } + + #endif // HAS_LCD_MENU + + if (!homed && RRK(EN_KEYPAD_F1)) enqueue_and_echo_commands_P(PSTR("G28")); + return true; + } + + #endif // !ADC_KEYPAD + + return false; } - /** - * Show "Moving..." till moves are done, then revert to previous display. - */ - static const char moving[] PROGMEM = MSG_MOVING; - static const char *sync_message = moving; - - // - // Display the synchronize screen until moves are - // finished, and don't return to the caller until - // done. ** This blocks the command queue! ** - // - void _lcd_synchronize() { - if (lcdDrawUpdate) lcd_implementation_drawmenu_static(LCD_HEIGHT >= 4 ? 1 : 0, sync_message); - if (no_reentry) return; - // Make this the current handler till all moves are done - no_reentry = true; - const screenFunc_t old_screen = currentScreen; - lcd_goto_screen(_lcd_synchronize); - planner.synchronize(); // idle() is called until moves complete - no_reentry = false; - lcd_goto_screen(old_screen); - } - - // Display the synchronize screen with a custom message - // ** This blocks the command queue! ** - void lcd_synchronize(const char * const msg=NULL) { - sync_message = msg ? msg : moving; - _lcd_synchronize(); - } - - void lcd_return_to_status() { lcd_goto_screen(lcd_status_screen); } - - void lcd_save_previous_screen() { - if (screen_history_depth < COUNT(screen_history)) { - screen_history[screen_history_depth].menu_function = currentScreen; - screen_history[screen_history_depth].encoder_position = encoderPosition; - ++screen_history_depth; - } - } - - void lcd_goto_previous_menu() { - if (screen_history_depth > 0) { - --screen_history_depth; - lcd_goto_screen( - screen_history[screen_history_depth].menu_function, - screen_history[screen_history_depth].encoder_position - ); - } - else - lcd_return_to_status(); - } - - void lcd_goto_previous_menu_no_defer() { - defer_return_to_status = false; - lcd_goto_previous_menu(); - } - - /** - * Scrolling for menus and other line-based screens - * - * encoderLine is the position based on the encoder - * encoderTopLine is the top menu line to display - * _lcdLineNr is the index of the LCD line (e.g., 0-3) - * _menuLineNr is the menu item to draw and process - * _thisItemNr is the index of each MENU_ITEM or STATIC_ITEM - * screen_items is the total number of items in the menu (after one call) - */ - int8_t encoderLine, screen_items; - void scroll_screen(const uint8_t limit, const bool is_menu) { - ENCODER_DIRECTION_MENUS(); - ENCODER_RATE_MULTIPLY(false); - if (encoderPosition > 0x8000) encoderPosition = 0; - if (first_page) { - encoderLine = encoderPosition / (ENCODER_STEPS_PER_MENU_ITEM); - screen_changed = false; - } - if (screen_items > 0 && encoderLine >= screen_items - limit) { - encoderLine = MAX(0, screen_items - limit); - encoderPosition = encoderLine * (ENCODER_STEPS_PER_MENU_ITEM); - } - if (is_menu) { - NOMORE(encoderTopLine, encoderLine); - if (encoderLine >= encoderTopLine + menu_bottom) - encoderTopLine = encoderLine - menu_bottom + 1; - } - else - encoderTopLine = encoderLine; - } - -#endif // ULTIPANEL +#endif // REPRAPWORLD_KEYPAD /** - * - * "Info Screen" + * Status Screen * * This is very display-dependent, so the lcd implementation draws this. */ -void lcd_status_screen() { - - #if ENABLED(ULTIPANEL) - ENCODER_DIRECTION_NORMAL(); - ENCODER_RATE_MULTIPLY(false); +#if ENABLED(LCD_PROGRESS_BAR) + millis_t MarlinUI::progress_bar_ms; // = 0 + #if PROGRESS_MSG_EXPIRE > 0 + millis_t MarlinUI::expire_status_ms; // = 0 #endif +#endif - #if ENABLED(LCD_SET_PROGRESS_MANUALLY) && ENABLED(SDSUPPORT) && (ENABLED(LCD_PROGRESS_BAR) || ENABLED(DOGLCD)) - // Progress bar % comes from SD when actively printing - if (IS_SD_PRINTING) - progress_bar_percent = card.percentDone(); +#if HAS_PRINT_PROGRESS + uint8_t MarlinUI::get_progress() { + #if ENABLED(LCD_SET_PROGRESS_MANUALLY) + uint8_t &progress = progress_bar_percent; + #else + uint8_t progress = 0; + #endif + #if ENABLED(SDSUPPORT) + if (IS_SD_PRINTING()) progress = card.percentDone(); + #endif + return progress; + } +#endif + +void MarlinUI::status_screen() { + + #if HAS_LCD_MENU + encoder_direction_normal(); + ENCODER_RATE_MULTIPLY(false); #endif #if ENABLED(LCD_PROGRESS_BAR) @@ -681,7 +420,9 @@ void lcd_status_screen() { // share the same line on the display. // - millis_t ms = millis(); + #if DISABLED(PROGRESS_MSG_ONCE) || (PROGRESS_MSG_EXPIRE > 0) + millis_t ms = millis(); + #endif // If the message will blink rather than expire... #if DISABLED(PROGRESS_MSG_ONCE) @@ -694,14 +435,10 @@ void lcd_status_screen() { // Handle message expire if (expire_status_ms > 0) { - #if DISABLED(LCD_SET_PROGRESS_MANUALLY) - const uint8_t progress_bar_percent = card.percentDone(); - #endif - // Expire the message if a job is active and the bar has ticks - if (progress_bar_percent > 2 && !print_job_timer.isPaused()) { + if (get_progress() > 2 && !print_job_timer.isPaused()) { if (ELAPSED(ms, expire_status_ms)) { - lcd_status_message[0] = '\0'; + status_message[0] = '\0'; expire_status_ms = 0; } } @@ -716,103 +453,62 @@ void lcd_status_screen() { #endif // LCD_PROGRESS_BAR - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU if (use_click()) { #if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT) - previous_lcd_status_ms = millis(); // get status message to show up for a while + next_filament_display = millis() + 5000UL; // Show status message for 5s #endif - lcd_implementation_init( // to maybe revive the LCD if static electricity killed it. - #if ENABLED(LCD_PROGRESS_BAR) - CHARSET_MENU - #endif - ); - lcd_goto_screen(lcd_main_menu); + goto_screen(menu_main); + init_lcd(); // May revive the LCD if static electricity killed it return; } - #if ENABLED(ULTIPANEL_FEEDMULTIPLY) - const int16_t new_frm = feedrate_percentage + (int32_t)encoderPosition; - // Dead zone at 100% feedrate - if ((feedrate_percentage < 100 && new_frm > 100) || (feedrate_percentage > 100 && new_frm < 100)) { - feedrate_percentage = 100; + #endif // HAS_LCD_MENU + + #if ENABLED(ULTIPANEL_FEEDMULTIPLY) && HAS_ENCODER_ACTION + + const int16_t new_frm = feedrate_percentage + (int32_t)encoderPosition; + // Dead zone at 100% feedrate + if ((feedrate_percentage < 100 && new_frm > 100) || (feedrate_percentage > 100 && new_frm < 100)) { + feedrate_percentage = 100; + encoderPosition = 0; + } + else if (feedrate_percentage == 100) { + if ((int32_t)encoderPosition > ENCODER_FEEDRATE_DEADZONE) { + feedrate_percentage += (int32_t)encoderPosition - (ENCODER_FEEDRATE_DEADZONE); encoderPosition = 0; } - else if (feedrate_percentage == 100) { - if ((int32_t)encoderPosition > ENCODER_FEEDRATE_DEADZONE) { - feedrate_percentage += (int32_t)encoderPosition - (ENCODER_FEEDRATE_DEADZONE); - encoderPosition = 0; - } - else if ((int32_t)encoderPosition < -(ENCODER_FEEDRATE_DEADZONE)) { - feedrate_percentage += (int32_t)encoderPosition + ENCODER_FEEDRATE_DEADZONE; - encoderPosition = 0; - } - } - else { - feedrate_percentage = new_frm; + else if ((int32_t)encoderPosition < -(ENCODER_FEEDRATE_DEADZONE)) { + feedrate_percentage += (int32_t)encoderPosition + ENCODER_FEEDRATE_DEADZONE; encoderPosition = 0; } - #endif // ULTIPANEL_FEEDMULTIPLY + } + else { + feedrate_percentage = new_frm; + encoderPosition = 0; + } feedrate_percentage = constrain(feedrate_percentage, 10, 999); - #endif // ULTIPANEL + #endif // ULTIPANEL_FEEDMULTIPLY - lcd_implementation_status_screen(); + draw_status_screen(); } -/** - * Reset the status message - */ -void lcd_reset_status() { - static const char paused[] PROGMEM = MSG_PRINT_PAUSED; - static const char printing[] PROGMEM = MSG_PRINTING; - static const char welcome[] PROGMEM = WELCOME_MSG; - const char *msg; - if (print_job_timer.isPaused()) - msg = paused; - #if ENABLED(SDSUPPORT) - else if (card.sdprinting) - return lcd_setstatus(card.longest_filename(), true); +void MarlinUI::kill_screen(PGM_P lcd_msg) { + init(); + set_alert_status_P(lcd_msg); + draw_kill_screen(); +} + +void MarlinUI::quick_feedback(const bool clear_buttons/*=true*/) { + + #if HAS_LCD_MENU + refresh(); #endif - else if (print_job_timer.isRunning()) - msg = printing; - else - msg = welcome; - lcd_setstatusPGM(msg, -1); -} - -/** - * - * draw the kill screen - * - */ -void kill_screen(const char* lcd_msg) { - lcd_init(); - lcd_setalertstatusPGM(lcd_msg); - lcd_kill_screen(); -} - -/** - * - * Audio feedback for controller clicks - * - */ -void lcd_buzz(const long duration, const uint16_t freq) { - #if ENABLED(LCD_USE_I2C_BUZZER) - lcd.buzz(duration, freq); - #elif PIN_EXISTS(BEEPER) - buzzer.tone(duration, freq); - #else - UNUSED(duration); UNUSED(freq); - #endif -} - -void lcd_quick_feedback(const bool clear_buttons) { - - #if ENABLED(ULTIPANEL) - lcd_refresh(); + #if HAS_ENCODER_ACTION if (clear_buttons) buttons = 0; next_button_update_ms = millis() + 500; #else @@ -820,9 +516,9 @@ void lcd_quick_feedback(const bool clear_buttons) { #endif // Buzz and wait. The delay is needed for buttons to settle! - lcd_buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ); + buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ); - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU #if ENABLED(LCD_USE_I2C_BUZZER) delay(10); #elif PIN_EXISTS(BEEPER) @@ -831,2133 +527,31 @@ void lcd_quick_feedback(const bool clear_buttons) { #endif } -#if ENABLED(ULTIPANEL) +//////////////////////////////////////////// +/////////////// Manual Move //////////////// +//////////////////////////////////////////// - void lcd_completion_feedback(const bool good/*=true*/) { - if (good) { - lcd_buzz(100, 659); - lcd_buzz(100, 698); - } - else lcd_buzz(20, 440); - } +#if HAS_LCD_MENU - inline void line_to_current_z() { - planner.buffer_line(current_position, MMM_TO_MMS(manual_feedrate_mm_m[Z_AXIS]), active_extruder); - } + extern bool no_reentry; // Flag to prevent recursion into menu handlers - inline void line_to_z(const float &z) { - current_position[Z_AXIS] = z; - line_to_current_z(); - } - - #if ENABLED(SDSUPPORT) - - void lcd_sdcard_pause() { - card.pauseSDPrint(); - print_job_timer.pause(); - #if ENABLED(PARK_HEAD_ON_PAUSE) - enqueue_and_echo_commands_P(PSTR("M125")); - #endif - lcd_reset_status(); - } - - void lcd_sdcard_resume() { - #if ENABLED(PARK_HEAD_ON_PAUSE) - enqueue_and_echo_commands_P(PSTR("M24")); - #else - card.startFileprint(); - print_job_timer.start(); - #endif - lcd_reset_status(); - } - - bool abort_sd_printing; // =false - - void lcd_sdcard_stop() { - wait_for_heatup = wait_for_user = false; - abort_sd_printing = true; - lcd_setstatusPGM(PSTR(MSG_PRINT_ABORTED), -1); - lcd_return_to_status(); - } - - #endif // SDSUPPORT - - #if ENABLED(POWER_LOSS_RECOVERY) - - static void lcd_power_loss_recovery_resume() { - char cmd[20]; - - // Return to status now - lcd_return_to_status(); - - // Turn leveling off and home - enqueue_and_echo_commands_P(PSTR("M420 S0\nG28 R0" - #if ENABLED(MARLIN_DEV_MODE) - " S" - #elif !IS_KINEMATIC - " X Y" - #endif - )); - - #if HAS_HEATED_BED - const int16_t bt = job_recovery_info.target_temperature_bed; - if (bt) { - // Restore the bed temperature - sprintf_P(cmd, PSTR("M190 S%i"), bt); - enqueue_and_echo_command(cmd); - } - #endif - - // Restore all hotend temperatures - HOTEND_LOOP() { - const int16_t et = job_recovery_info.target_temperature[e]; - if (et) { - #if HOTENDS > 1 - sprintf_P(cmd, PSTR("T%i"), e); - enqueue_and_echo_command(cmd); - #endif - sprintf_P(cmd, PSTR("M109 S%i"), et); - enqueue_and_echo_command(cmd); - } - } - - #if HOTENDS > 1 - sprintf_P(cmd, PSTR("T%i"), job_recovery_info.active_hotend); - enqueue_and_echo_command(cmd); - #endif - - // Restore print cooling fan speeds - for (uint8_t i = 0; i < FAN_COUNT; i++) { - int16_t f = job_recovery_info.fanSpeeds[i]; - if (f) { - sprintf_P(cmd, PSTR("M106 P%i S%i"), i, f); - enqueue_and_echo_command(cmd); - } - } - - // Start draining the job recovery command queue - job_recovery_phase = JOB_RECOVERY_YES; - } - - static void lcd_power_loss_recovery_cancel() { - card.removeJobRecoveryFile(); - card.autostart_index = 0; - lcd_return_to_status(); - } - - static void lcd_job_recovery_menu() { - defer_return_to_status = true; - START_MENU(); - STATIC_ITEM(MSG_POWER_LOSS_RECOVERY); - MENU_ITEM(function, MSG_RESUME_PRINT, lcd_power_loss_recovery_resume); - MENU_ITEM(function, MSG_STOP_PRINT, lcd_power_loss_recovery_cancel); - END_MENU(); - } - - #endif // POWER_LOSS_RECOVERY - - #if ENABLED(MENU_ITEM_CASE_LIGHT) - - #include "../feature/caselight.h" - - void case_light_menu() { - START_MENU(); - // - // ^ Main - // - MENU_BACK(MSG_MAIN); - MENU_ITEM_EDIT_CALLBACK(int8, MSG_CASE_LIGHT_BRIGHTNESS, &case_light_brightness, 0, 255, update_case_light, true); - MENU_ITEM_EDIT_CALLBACK(bool, MSG_CASE_LIGHT, (bool*)&case_light_on, update_case_light); - END_MENU(); - } - #endif // MENU_ITEM_CASE_LIGHT - - #if ENABLED(BLTOUCH) - - /** - * - * "BLTouch" submenu - * - */ - static void bltouch_menu() { - START_MENU(); - // - // ^ Main - // - MENU_BACK(MSG_MAIN); - MENU_ITEM(gcode, MSG_BLTOUCH_RESET, PSTR("M280 P" STRINGIFY(Z_PROBE_SERVO_NR) " S" STRINGIFY(BLTOUCH_RESET))); - MENU_ITEM(gcode, MSG_BLTOUCH_SELFTEST, PSTR("M280 P" STRINGIFY(Z_PROBE_SERVO_NR) " S" STRINGIFY(BLTOUCH_SELFTEST))); - MENU_ITEM(gcode, MSG_BLTOUCH_DEPLOY, PSTR("M280 P" STRINGIFY(Z_PROBE_SERVO_NR) " S" STRINGIFY(BLTOUCH_DEPLOY))); - MENU_ITEM(gcode, MSG_BLTOUCH_STOW, PSTR("M280 P" STRINGIFY(Z_PROBE_SERVO_NR) " S" STRINGIFY(BLTOUCH_STOW))); - END_MENU(); - } - - #endif // BLTOUCH - - #if ENABLED(LCD_PROGRESS_BAR_TEST) - - static void progress_bar_test() { - static int8_t bar_percent = 0; - if (use_click()) { - lcd_goto_previous_menu(); - lcd_set_custom_characters(CHARSET_MENU); - return; - } - bar_percent += (int8_t)encoderPosition; - bar_percent = constrain(bar_percent, 0, 100); - encoderPosition = 0; - lcd_implementation_drawmenu_static(0, PSTR(MSG_PROGRESS_BAR_TEST), true, true); - lcd_moveto((LCD_WIDTH) / 2 - 2, LCD_HEIGHT - 2); - lcd_put_u8str(int(bar_percent)); lcd_put_wchar('%'); - lcd_moveto(0, LCD_HEIGHT - 1); lcd_draw_progress_bar(bar_percent); - } - - void _progress_bar_test() { - lcd_goto_screen(progress_bar_test); - lcd_set_custom_characters(); - } - - #endif // LCD_PROGRESS_BAR_TEST - - #if HAS_DEBUG_MENU - - void lcd_debug_menu() { - START_MENU(); - - MENU_BACK(MSG_MAIN); // ^ Main - - #if ENABLED(LCD_PROGRESS_BAR_TEST) - MENU_ITEM(submenu, MSG_PROGRESS_BAR_TEST, _progress_bar_test); - #endif - - END_MENU(); - } - - #endif // HAS_DEBUG_MENU - - /** - * IDEX submenu - */ - #if ENABLED(DUAL_X_CARRIAGE) - static void _recalc_IDEX_settings() { - if (active_extruder) { // 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; - } - } - - static void IDEX_menu() { - START_MENU(); - MENU_BACK(MSG_MAIN); - MENU_ITEM(gcode, MSG_IDEX_MODE_AUTOPARK, PSTR("M605 S1\nG28 X\nG1 X100")); - const bool need_g28 = !(TEST(axis_known_position, Y_AXIS) && TEST(axis_known_position, Z_AXIS)); - MENU_ITEM(gcode, MSG_IDEX_MODE_DUPLICATE, need_g28 - ? PSTR("M605 S1\nT0\nG28\nM605 S2 X200\nG28 X\nG1 X100") // If Y or Z is not homed, do a full G28 first - : PSTR("M605 S1\nT0\nM605 S2 X200\nG28 X\nG1 X100") - ); - //MENU_ITEM(gcode, MSG_IDEX_MODE_SCALED_COPY, need_g28 - // ? PSTR("M605 S1\nT0\nG28\nM605 S2 X200\nG28 X\nG1 X100\nM605 S3 X200") // If Y or Z is not homed, do a full G28 first - // : 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(); - } - #endif // DUAL_X_CARRIAGE - - #if ENABLED(CUSTOM_USER_MENUS) - - #ifdef USER_SCRIPT_DONE - #define _DONE_SCRIPT "\n" USER_SCRIPT_DONE - #else - #define _DONE_SCRIPT "" - #endif - - void _lcd_user_gcode(const char * const cmd) { - enqueue_and_echo_commands_P(cmd); - #if ENABLED(USER_SCRIPT_AUDIBLE_FEEDBACK) - lcd_completion_feedback(); - #endif - #if ENABLED(USER_SCRIPT_RETURN) - lcd_return_to_status(); - #endif - } - - #if defined(USER_DESC_1) && defined(USER_GCODE_1) - void lcd_user_gcode_1() { _lcd_user_gcode(PSTR(USER_GCODE_1 _DONE_SCRIPT)); } - #endif - #if defined(USER_DESC_2) && defined(USER_GCODE_2) - void lcd_user_gcode_2() { _lcd_user_gcode(PSTR(USER_GCODE_2 _DONE_SCRIPT)); } - #endif - #if defined(USER_DESC_3) && defined(USER_GCODE_3) - void lcd_user_gcode_3() { _lcd_user_gcode(PSTR(USER_GCODE_3 _DONE_SCRIPT)); } - #endif - #if defined(USER_DESC_4) && defined(USER_GCODE_4) - void lcd_user_gcode_4() { _lcd_user_gcode(PSTR(USER_GCODE_4 _DONE_SCRIPT)); } - #endif - #if defined(USER_DESC_5) && defined(USER_GCODE_5) - void lcd_user_gcode_5() { _lcd_user_gcode(PSTR(USER_GCODE_5 _DONE_SCRIPT)); } - #endif - - void _lcd_user_menu() { - START_MENU(); - MENU_BACK(MSG_MAIN); - #if defined(USER_DESC_1) && defined(USER_GCODE_1) - MENU_ITEM(function, USER_DESC_1, lcd_user_gcode_1); - #endif - #if defined(USER_DESC_2) && defined(USER_GCODE_2) - MENU_ITEM(function, USER_DESC_2, lcd_user_gcode_2); - #endif - #if defined(USER_DESC_3) && defined(USER_GCODE_3) - MENU_ITEM(function, USER_DESC_3, lcd_user_gcode_3); - #endif - #if defined(USER_DESC_4) && defined(USER_GCODE_4) - MENU_ITEM(function, USER_DESC_4, lcd_user_gcode_4); - #endif - #if defined(USER_DESC_5) && defined(USER_GCODE_5) - MENU_ITEM(function, USER_DESC_5, lcd_user_gcode_5); - #endif - END_MENU(); - } + int8_t manual_move_axis = (int8_t)NO_AXIS; + millis_t manual_move_start_time = 0; + #if IS_KINEMATIC + bool MarlinUI::processing_manual_move = false; + float manual_move_offset = 0; #endif - /** - * - * "Main" menu - * - */ - - #if ENABLED(SDSUPPORT) && ENABLED(MENU_ADDAUTOSTART) - - void lcd_autostart_sd() { card.beginautostart(); } - + #if E_MANUAL > 1 + int8_t MarlinUI::manual_move_e_index = 0; #endif - void lcd_main_menu() { - START_MENU(); - MENU_BACK(MSG_WATCH); - - #if ENABLED(CUSTOM_USER_MENUS) - MENU_ITEM(submenu, MSG_USER_MENU, _lcd_user_menu); - #endif - - #if ENABLED(DUAL_X_CARRIAGE) - MENU_ITEM(submenu, MSG_IDEX_MENU, IDEX_menu); - #endif - - // - // Debug Menu when certain options are enabled - // - #if HAS_DEBUG_MENU - MENU_ITEM(submenu, MSG_DEBUG_MENU, lcd_debug_menu); - #endif - - // - // Set Case light on/off/brightness - // - #if ENABLED(MENU_ITEM_CASE_LIGHT) - if (USEABLE_HARDWARE_PWM(CASE_LIGHT_PIN)) { - MENU_ITEM(submenu, MSG_CASE_LIGHT, case_light_menu); - } - else - MENU_ITEM_EDIT_CALLBACK(bool, MSG_CASE_LIGHT, (bool*)&case_light_on, update_case_light); - #endif - - #if ENABLED(SDSUPPORT) - if (card.cardOK) { - if (card.isFileOpen()) { - if (card.sdprinting) - MENU_ITEM(function, MSG_PAUSE_PRINT, lcd_sdcard_pause); - else - MENU_ITEM(function, MSG_RESUME_PRINT, lcd_sdcard_resume); - MENU_ITEM(function, MSG_STOP_PRINT, lcd_sdcard_stop); - } - else { - MENU_ITEM(submenu, MSG_CARD_MENU, lcd_sdcard_menu); - #if !PIN_EXISTS(SD_DETECT) - MENU_ITEM(gcode, MSG_CNG_SDCARD, PSTR("M21")); // SD-card changed by user - #endif - } - } - else { - MENU_ITEM(submenu, MSG_NO_CARD, lcd_sdcard_menu); - #if !PIN_EXISTS(SD_DETECT) - MENU_ITEM(gcode, MSG_INIT_SDCARD, PSTR("M21")); // Manually initialize the SD-card via user interface - #endif - } - #endif // SDSUPPORT - - if (planner.movesplanned() || IS_SD_PRINTING) - MENU_ITEM(submenu, MSG_TUNE, lcd_tune_menu); - else { - MENU_ITEM(submenu, MSG_MOTION, lcd_movement_menu); - MENU_ITEM(submenu, MSG_TEMPERATURE, lcd_temperature_menu); - MENU_ITEM(submenu, MSG_CONFIGURATION, lcd_configuration_menu); - } - - #if ENABLED(ADVANCED_PAUSE_FEATURE) - #if E_STEPPERS == 1 && DISABLED(FILAMENT_LOAD_UNLOAD_GCODES) - if (thermalManager.targetHotEnoughToExtrude(active_extruder)) - MENU_ITEM(gcode, MSG_FILAMENTCHANGE, PSTR("M600 B0")); - else - MENU_ITEM(submenu, MSG_FILAMENTCHANGE, lcd_temp_menu_e0_filament_change); - #else - MENU_ITEM(submenu, MSG_FILAMENTCHANGE, lcd_change_filament_menu); - #endif - #endif - - #if ENABLED(LCD_INFO_MENU) - MENU_ITEM(submenu, MSG_INFO_MENU, lcd_info_menu); - #endif - - #if ENABLED(LED_CONTROL_MENU) - MENU_ITEM(submenu, MSG_LED_CONTROL, lcd_led_menu); - #endif - - // - // Switch power on/off - // - #if HAS_POWER_SWITCH - if (powersupply_on) - MENU_ITEM(gcode, MSG_SWITCH_PS_OFF, PSTR("M81")); - else - MENU_ITEM(gcode, MSG_SWITCH_PS_ON, PSTR("M80")); - #endif - - // - // Autostart - // - #if ENABLED(SDSUPPORT) && ENABLED(MENU_ADDAUTOSTART) - MENU_ITEM(function, MSG_AUTOSTART, lcd_autostart_sd); - #endif - - END_MENU(); - } - - /** - * - * "Tune" submenu items - * - */ - - #if ENABLED(BABYSTEP_ZPROBE_GFX_OVERLAY) || ENABLED(MESH_EDIT_GFX_OVERLAY) - - void _lcd_zoffset_overlay_gfx(const float zvalue) { - // Determine whether the user is raising or lowering the nozzle. - static int8_t dir; - static float old_zvalue; - if (zvalue != old_zvalue) { - dir = zvalue ? zvalue < old_zvalue ? -1 : 1 : 0; - old_zvalue = zvalue; - } - - #if ENABLED(OVERLAY_GFX_REVERSE) - const unsigned char *rot_up = ccw_bmp, *rot_down = cw_bmp; - #else - const unsigned char *rot_up = cw_bmp, *rot_down = ccw_bmp; - #endif - - #if ENABLED(USE_BIG_EDIT_FONT) - const int left = 0, right = 45, nozzle = 95; - #else - const int left = 5, right = 90, nozzle = 60; - #endif - - // Draw a representation of the nozzle - if (PAGE_CONTAINS(3, 16)) u8g.drawBitmapP(nozzle + 6, 4 - dir, 2, 12, nozzle_bmp); - if (PAGE_CONTAINS(20, 20)) u8g.drawBitmapP(nozzle + 0, 20, 3, 1, offset_bedline_bmp); - - // Draw cw/ccw indicator and up/down arrows. - if (PAGE_CONTAINS(47, 62)) { - u8g.drawBitmapP(left + 0, 47, 3, 16, rot_down); - u8g.drawBitmapP(right + 0, 47, 3, 16, rot_up); - u8g.drawBitmapP(right + 20, 48 - dir, 2, 13, up_arrow_bmp); - u8g.drawBitmapP(left + 20, 49 - dir, 2, 13, down_arrow_bmp); - } - } - - #endif // BABYSTEP_ZPROBE_GFX_OVERLAY || MESH_EDIT_GFX_OVERLAY - - #if ENABLED(BABYSTEPPING) - - void _lcd_babystep(const AxisEnum axis, const char* msg) { - if (use_click()) { return lcd_goto_previous_menu_no_defer(); } - ENCODER_DIRECTION_NORMAL(); - if (encoderPosition) { - const int16_t babystep_increment = (int32_t)encoderPosition * (BABYSTEP_MULTIPLICATOR); - encoderPosition = 0; - lcdDrawUpdate = LCDVIEW_REDRAW_NOW; - thermalManager.babystep_axis(axis, babystep_increment); - babysteps_done += babystep_increment; - } - if (lcdDrawUpdate) - lcd_implementation_drawedit(msg, ftostr43sign(planner.steps_to_mm[axis] * babysteps_done)); - } - - #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() { lcd_goto_screen(_lcd_babystep_x); babysteps_done = 0; defer_return_to_status = true; } - void lcd_babystep_y() { lcd_goto_screen(_lcd_babystep_y); babysteps_done = 0; defer_return_to_status = true; } - #endif - - #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - - void lcd_babystep_zoffset() { - if (use_click()) { return lcd_goto_previous_menu_no_defer(); } - defer_return_to_status = true; - #if ENABLED(BABYSTEP_HOTEND_Z_OFFSET) - const bool do_probe = (active_extruder == 0); - #else - constexpr bool do_probe = true; - #endif - ENCODER_DIRECTION_NORMAL(); - if (encoderPosition) { - const int16_t babystep_increment = (int32_t)encoderPosition * (BABYSTEP_MULTIPLICATOR); - encoderPosition = 0; - - const float diff = planner.steps_to_mm[Z_AXIS] * babystep_increment, - new_probe_offset = zprobe_zoffset + diff, - new_offs = - #if ENABLED(BABYSTEP_HOTEND_Z_OFFSET) - do_probe ? new_probe_offset : hotend_offset[Z_AXIS][active_extruder] - diff - #else - new_probe_offset - #endif - ; - if (WITHIN(new_offs, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) { - - thermalManager.babystep_axis(Z_AXIS, babystep_increment); - - if (do_probe) zprobe_zoffset = new_offs; - #if ENABLED(BABYSTEP_HOTEND_Z_OFFSET) - else hotend_offset[Z_AXIS][active_extruder] = new_offs; - #endif - - lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT; - } - } - if (lcdDrawUpdate) { - #if ENABLED(BABYSTEP_HOTEND_Z_OFFSET) - if (do_probe) - lcd_implementation_drawedit(PSTR(MSG_ZPROBE_ZOFFSET), ftostr43sign(zprobe_zoffset)); - else - lcd_implementation_drawedit(PSTR(MSG_IDEX_Z_OFFSET), ftostr43sign(hotend_offset[Z_AXIS][active_extruder])); - #else - lcd_implementation_drawedit(PSTR(MSG_ZPROBE_ZOFFSET), ftostr43sign(zprobe_zoffset)); - #endif - #if ENABLED(BABYSTEP_ZPROBE_GFX_OVERLAY) - if (do_probe) _lcd_zoffset_overlay_gfx(zprobe_zoffset); - #endif - } - } - - #else // !BABYSTEP_ZPROBE_OFFSET - - void _lcd_babystep_z() { _lcd_babystep(Z_AXIS, PSTR(MSG_BABYSTEP_Z)); } - void lcd_babystep_z() { lcd_goto_screen(_lcd_babystep_z); babysteps_done = 0; defer_return_to_status = true; } - - #endif // !BABYSTEP_ZPROBE_OFFSET - - #endif // BABYSTEPPING - - #if ENABLED(AUTO_BED_LEVELING_UBL) - - float mesh_edit_value, mesh_edit_accumulator; // We round mesh_edit_value to 2.5 decimal places. So we keep a - // separate value that doesn't lose precision. - static int16_t ubl_encoderPosition = 0; - - static void _lcd_mesh_fine_tune(const char* msg) { - defer_return_to_status = true; - if (ubl.encoder_diff) { - ubl_encoderPosition = (ubl.encoder_diff > 0) ? 1 : -1; - ubl.encoder_diff = 0; - - mesh_edit_accumulator += float(ubl_encoderPosition) * 0.005f * 0.5f; - mesh_edit_value = mesh_edit_accumulator; - encoderPosition = 0; - lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT; - - const int32_t rounded = (int32_t)(mesh_edit_value * 1000); - mesh_edit_value = float(rounded - (rounded % 5L)) / 1000; - } - - if (lcdDrawUpdate) { - lcd_implementation_drawedit(msg, ftostr43sign(mesh_edit_value)); - #if ENABLED(MESH_EDIT_GFX_OVERLAY) - _lcd_zoffset_overlay_gfx(mesh_edit_value); - #endif - } - } - - void _lcd_mesh_edit_NOP() { - defer_return_to_status = true; - } - - float lcd_mesh_edit() { - lcd_goto_screen(_lcd_mesh_edit_NOP); - lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT; - _lcd_mesh_fine_tune(PSTR("Mesh Editor")); - return mesh_edit_value; - } - - void lcd_mesh_edit_setup(const float &initial) { - mesh_edit_value = mesh_edit_accumulator = initial; - lcd_goto_screen(_lcd_mesh_edit_NOP); - } - - void _lcd_z_offset_edit() { - _lcd_mesh_fine_tune(PSTR("Z-Offset: ")); - } - - float lcd_z_offset_edit() { - lcd_goto_screen(_lcd_z_offset_edit); - return mesh_edit_value; - } - - void lcd_z_offset_edit_setup(const float &initial) { - mesh_edit_value = mesh_edit_accumulator = initial; - lcd_goto_screen(_lcd_z_offset_edit); - } - - #endif // AUTO_BED_LEVELING_UBL - - - /** - * Watch temperature callbacks - */ - #if HAS_TEMP_HOTEND - #if WATCH_HOTENDS - #define _WATCH_FUNC(N) thermalManager.start_watching_heater(N) - #else - #define _WATCH_FUNC(N) NOOP - #endif - void watch_temp_callback_E0() { _WATCH_FUNC(0); } - #if HOTENDS > 1 - void watch_temp_callback_E1() { _WATCH_FUNC(1); } - #if HOTENDS > 2 - void watch_temp_callback_E2() { _WATCH_FUNC(2); } - #if HOTENDS > 3 - void watch_temp_callback_E3() { _WATCH_FUNC(3); } - #if HOTENDS > 4 - void watch_temp_callback_E4() { _WATCH_FUNC(4); } - #if HOTENDS > 5 - void watch_temp_callback_E5() { _WATCH_FUNC(5); } - #endif // HOTENDS > 5 - #endif // HOTENDS > 4 - #endif // HOTENDS > 3 - #endif // HOTENDS > 2 - #endif // HOTENDS > 1 - #endif // HAS_TEMP_HOTEND - - void watch_temp_callback_bed() { - #if WATCH_THE_BED - thermalManager.start_watching_bed(); - #endif - } - - // First Fan Speed title in "Tune" and "Control>Temperature" menus - #if FAN_COUNT > 0 && HAS_FAN0 - #if FAN_COUNT > 1 - #define FAN_SPEED_1_SUFFIX " 1" - #else - #define FAN_SPEED_1_SUFFIX "" - #endif - #endif - - // Refresh the E factor after changing flow - inline void _lcd_refresh_e_factor_0() { planner.refresh_e_factor(0); } - #if EXTRUDERS > 1 - inline void _lcd_refresh_e_factor() { planner.refresh_e_factor(active_extruder); } - inline void _lcd_refresh_e_factor_1() { planner.refresh_e_factor(1); } - #if EXTRUDERS > 2 - inline void _lcd_refresh_e_factor_2() { planner.refresh_e_factor(2); } - #if EXTRUDERS > 3 - inline void _lcd_refresh_e_factor_3() { planner.refresh_e_factor(3); } - #if EXTRUDERS > 4 - inline void _lcd_refresh_e_factor_4() { planner.refresh_e_factor(4); } - #if EXTRUDERS > 5 - inline void _lcd_refresh_e_factor_5() { planner.refresh_e_factor(5); } - #endif // EXTRUDERS > 5 - #endif // EXTRUDERS > 4 - #endif // EXTRUDERS > 3 - #endif // EXTRUDERS > 2 - #endif // EXTRUDERS > 1 - - /** - * - * "Tune" submenu - * - */ - void lcd_tune_menu() { - START_MENU(); - - // - // ^ Main - // - MENU_BACK(MSG_MAIN); - - // - // Speed: - // - MENU_ITEM_EDIT(int3, MSG_SPEED, &feedrate_percentage, 10, 999); - - // - // Manual bed leveling, Bed Z: - // - #if ENABLED(MESH_BED_LEVELING) && ENABLED(LCD_BED_LEVELING) - MENU_ITEM_EDIT(float43, MSG_BED_Z, &mbl.z_offset, -1, 1); - #endif - - // - // Leveling Fade Height - // - #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) && DISABLED(SLIM_LCD_MENUS) - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float3, MSG_Z_FADE_HEIGHT, &new_z_fade_height, 0, 100, _lcd_set_z_fade_height); - #endif - - // - // Nozzle: - // Nozzle [1-4]: - // - #if HOTENDS == 1 - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE, &thermalManager.target_temperature[0], 0, HEATER_0_MAXTEMP - 15, watch_temp_callback_E0); - #else // HOTENDS > 1 - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N1, &thermalManager.target_temperature[0], 0, HEATER_0_MAXTEMP - 15, watch_temp_callback_E0); - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N2, &thermalManager.target_temperature[1], 0, HEATER_1_MAXTEMP - 15, watch_temp_callback_E1); - #if HOTENDS > 2 - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N3, &thermalManager.target_temperature[2], 0, HEATER_2_MAXTEMP - 15, watch_temp_callback_E2); - #if HOTENDS > 3 - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N4, &thermalManager.target_temperature[3], 0, HEATER_3_MAXTEMP - 15, watch_temp_callback_E3); - #if HOTENDS > 4 - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N5, &thermalManager.target_temperature[4], 0, HEATER_4_MAXTEMP - 15, watch_temp_callback_E4); - #if HOTENDS > 5 - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N6, &thermalManager.target_temperature[5], 0, HEATER_5_MAXTEMP - 15, watch_temp_callback_E5); - #endif // HOTENDS > 5 - #endif // HOTENDS > 4 - #endif // HOTENDS > 3 - #endif // HOTENDS > 2 - #endif // HOTENDS > 1 - - // - // Bed: - // - #if HAS_HEATED_BED - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_BED, &thermalManager.target_temperature_bed, 0, BED_MAXTEMP - 15, watch_temp_callback_bed); - #endif - - // - // Fan Speed: - // - #if FAN_COUNT > 0 - #if HAS_FAN0 - MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_FAN_SPEED FAN_SPEED_1_SUFFIX, &fanSpeeds[0], 0, 255); - #if ENABLED(EXTRA_FAN_SPEED) - MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_EXTRA_FAN_SPEED FAN_SPEED_1_SUFFIX, &new_fanSpeeds[0], 3, 255); - #endif - #endif - #if HAS_FAN1 - MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_FAN_SPEED " 2", &fanSpeeds[1], 0, 255); - #if ENABLED(EXTRA_FAN_SPEED) - MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_EXTRA_FAN_SPEED " 2", &new_fanSpeeds[1], 3, 255); - #endif - #endif - #if HAS_FAN2 - MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_FAN_SPEED " 3", &fanSpeeds[2], 0, 255); - #if ENABLED(EXTRA_FAN_SPEED) - MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_EXTRA_FAN_SPEED " 3", &new_fanSpeeds[2], 3, 255); - #endif - #endif - #endif // FAN_COUNT > 0 - - // - // Flow: - // Flow [1-5]: - // - #if EXTRUDERS == 1 - MENU_ITEM_EDIT_CALLBACK(int3, MSG_FLOW, &planner.flow_percentage[0], 10, 999, _lcd_refresh_e_factor_0); - #else // EXTRUDERS > 1 - MENU_ITEM_EDIT_CALLBACK(int3, MSG_FLOW, &planner.flow_percentage[active_extruder], 10, 999, _lcd_refresh_e_factor); - MENU_ITEM_EDIT_CALLBACK(int3, MSG_FLOW MSG_N1, &planner.flow_percentage[0], 10, 999, _lcd_refresh_e_factor_0); - MENU_ITEM_EDIT_CALLBACK(int3, MSG_FLOW MSG_N2, &planner.flow_percentage[1], 10, 999, _lcd_refresh_e_factor_1); - #if EXTRUDERS > 2 - MENU_ITEM_EDIT_CALLBACK(int3, MSG_FLOW MSG_N3, &planner.flow_percentage[2], 10, 999, _lcd_refresh_e_factor_2); - #if EXTRUDERS > 3 - MENU_ITEM_EDIT_CALLBACK(int3, MSG_FLOW MSG_N4, &planner.flow_percentage[3], 10, 999, _lcd_refresh_e_factor_3); - #if EXTRUDERS > 4 - MENU_ITEM_EDIT_CALLBACK(int3, MSG_FLOW MSG_N5, &planner.flow_percentage[4], 10, 999, _lcd_refresh_e_factor_4); - #if EXTRUDERS > 5 - MENU_ITEM_EDIT_CALLBACK(int3, MSG_FLOW MSG_N6, &planner.flow_percentage[5], 10, 999, _lcd_refresh_e_factor_5); - #endif // EXTRUDERS > 5 - #endif // EXTRUDERS > 4 - #endif // EXTRUDERS > 3 - #endif // EXTRUDERS > 2 - #endif // EXTRUDERS > 1 - - // - // Babystep X: - // Babystep Y: - // Babystep Z: - // - #if ENABLED(BABYSTEPPING) - #if ENABLED(BABYSTEP_XY) - MENU_ITEM(submenu, MSG_BABYSTEP_X, lcd_babystep_x); - MENU_ITEM(submenu, MSG_BABYSTEP_Y, lcd_babystep_y); - #endif - #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - MENU_ITEM(submenu, MSG_ZPROBE_ZOFFSET, lcd_babystep_zoffset); - #else - MENU_ITEM(submenu, MSG_BABYSTEP_Z, lcd_babystep_z); - #endif - #endif - - END_MENU(); - } - - /** - * - * "Driver current control" submenu items - * - */ - #if ENABLED(DAC_STEPPER_CURRENT) - - void dac_driver_getValues() { LOOP_XYZE(i) driverPercent[i] = dac_current_get_percent((AxisEnum)i); } - - void dac_driver_commit() { dac_current_set_percents(driverPercent); } - - void dac_driver_eeprom_write() { dac_commit_eeprom(); } - - void lcd_dac_menu() { - dac_driver_getValues(); - START_MENU(); - MENU_BACK(MSG_CONTROL); - MENU_ITEM_EDIT_CALLBACK(int8, MSG_X " " MSG_DAC_PERCENT, &driverPercent[X_AXIS], 0, 100, dac_driver_commit); - MENU_ITEM_EDIT_CALLBACK(int8, MSG_Y " " MSG_DAC_PERCENT, &driverPercent[Y_AXIS], 0, 100, dac_driver_commit); - MENU_ITEM_EDIT_CALLBACK(int8, MSG_Z " " MSG_DAC_PERCENT, &driverPercent[Z_AXIS], 0, 100, dac_driver_commit); - MENU_ITEM_EDIT_CALLBACK(int8, MSG_E " " MSG_DAC_PERCENT, &driverPercent[E_AXIS], 0, 100, dac_driver_commit); - MENU_ITEM(function, MSG_DAC_EEPROM_WRITE, dac_driver_eeprom_write); - END_MENU(); - } - - #endif // DAC_STEPPER_CURRENT - - #if HAS_MOTOR_CURRENT_PWM - - void lcd_pwm_menu() { - START_MENU(); - MENU_BACK(MSG_CONTROL); - #if PIN_EXISTS(MOTOR_CURRENT_PWM_XY) - MENU_ITEM_EDIT_CALLBACK(long5, MSG_X MSG_Y, &stepper.motor_current_setting[0], 100, 2000, Stepper::refresh_motor_power); - #endif - #if PIN_EXISTS(MOTOR_CURRENT_PWM_Z) - MENU_ITEM_EDIT_CALLBACK(long5, MSG_Z, &stepper.motor_current_setting[1], 100, 2000, Stepper::refresh_motor_power); - #endif - #if PIN_EXISTS(MOTOR_CURRENT_PWM_E) - MENU_ITEM_EDIT_CALLBACK(long5, MSG_E, &stepper.motor_current_setting[2], 100, 2000, Stepper::refresh_motor_power); - #endif - END_MENU(); - } - - #endif // HAS_MOTOR_CURRENT_PWM - - constexpr int16_t heater_maxtemp[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP, HEATER_4_MAXTEMP); - - /** - * - * "Temperature" submenu items - * - */ - void _lcd_preheat(const int16_t endnum, const int16_t temph, const int16_t tempb, const int16_t fan) { - if (temph > 0) thermalManager.setTargetHotend(MIN(heater_maxtemp[endnum], temph), endnum); - #if HAS_HEATED_BED - if (tempb >= 0) thermalManager.setTargetBed(tempb); - #else - UNUSED(tempb); - #endif - #if FAN_COUNT > 0 - #if FAN_COUNT > 1 - fanSpeeds[active_extruder < FAN_COUNT ? active_extruder : 0] = fan; - #else - fanSpeeds[0] = fan; - #endif - #else - UNUSED(fan); - #endif - lcd_return_to_status(); - } - - #if HAS_TEMP_HOTEND - void lcd_preheat_m1_e0_only() { _lcd_preheat(0, lcd_preheat_hotend_temp[0], -1, lcd_preheat_fan_speed[0]); } - void lcd_preheat_m2_e0_only() { _lcd_preheat(0, lcd_preheat_hotend_temp[1], -1, lcd_preheat_fan_speed[1]); } - #if HAS_HEATED_BED - void lcd_preheat_m1_e0() { _lcd_preheat(0, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); } - void lcd_preheat_m2_e0() { _lcd_preheat(0, lcd_preheat_hotend_temp[1], lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); } - #endif - #endif - - #if HOTENDS > 1 - void lcd_preheat_m1_e1_only() { _lcd_preheat(1, lcd_preheat_hotend_temp[0], -1, lcd_preheat_fan_speed[0]); } - void lcd_preheat_m2_e1_only() { _lcd_preheat(1, lcd_preheat_hotend_temp[1], -1, lcd_preheat_fan_speed[1]); } - #if HAS_HEATED_BED - void lcd_preheat_m1_e1() { _lcd_preheat(1, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); } - void lcd_preheat_m2_e1() { _lcd_preheat(1, lcd_preheat_hotend_temp[1], lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); } - #endif - #if HOTENDS > 2 - void lcd_preheat_m1_e2_only() { _lcd_preheat(2, lcd_preheat_hotend_temp[0], -1, lcd_preheat_fan_speed[0]); } - void lcd_preheat_m2_e2_only() { _lcd_preheat(2, lcd_preheat_hotend_temp[1], -1, lcd_preheat_fan_speed[1]); } - #if HAS_HEATED_BED - void lcd_preheat_m1_e2() { _lcd_preheat(2, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); } - void lcd_preheat_m2_e2() { _lcd_preheat(2, lcd_preheat_hotend_temp[1], lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); } - #endif - #if HOTENDS > 3 - void lcd_preheat_m1_e3_only() { _lcd_preheat(3, lcd_preheat_hotend_temp[0], -1, lcd_preheat_fan_speed[0]); } - void lcd_preheat_m2_e3_only() { _lcd_preheat(3, lcd_preheat_hotend_temp[1], -1, lcd_preheat_fan_speed[1]); } - #if HAS_HEATED_BED - void lcd_preheat_m1_e3() { _lcd_preheat(3, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); } - void lcd_preheat_m2_e3() { _lcd_preheat(3, lcd_preheat_hotend_temp[1], lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); } - #endif - #if HOTENDS > 4 - void lcd_preheat_m1_e4_only() { _lcd_preheat(4, lcd_preheat_hotend_temp[0], -1, lcd_preheat_fan_speed[0]); } - void lcd_preheat_m2_e4_only() { _lcd_preheat(4, lcd_preheat_hotend_temp[1], -1, lcd_preheat_fan_speed[1]); } - #if HAS_HEATED_BED - void lcd_preheat_m1_e4() { _lcd_preheat(4, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); } - void lcd_preheat_m2_e4() { _lcd_preheat(4, lcd_preheat_hotend_temp[1], lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); } - #endif - #if HOTENDS > 5 - void lcd_preheat_m1_e5_only() { _lcd_preheat(5, lcd_preheat_hotend_temp[0], -1, lcd_preheat_fan_speed[0]); } - void lcd_preheat_m2_e5_only() { _lcd_preheat(5, lcd_preheat_hotend_temp[1], -1, lcd_preheat_fan_speed[1]); } - #if HAS_HEATED_BED - void lcd_preheat_m1_e5() { _lcd_preheat(5, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); } - void lcd_preheat_m2_e5() { _lcd_preheat(5, lcd_preheat_hotend_temp[1], lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); } - #endif - #endif // HOTENDS > 5 - #endif // HOTENDS > 4 - #endif // HOTENDS > 3 - #endif // HOTENDS > 2 - - void lcd_preheat_m1_all() { - #if HOTENDS > 1 - thermalManager.setTargetHotend(lcd_preheat_hotend_temp[0], 1); - #if HOTENDS > 2 - thermalManager.setTargetHotend(lcd_preheat_hotend_temp[0], 2); - #if HOTENDS > 3 - thermalManager.setTargetHotend(lcd_preheat_hotend_temp[0], 3); - #if HOTENDS > 4 - thermalManager.setTargetHotend(lcd_preheat_hotend_temp[0], 4); - #if HOTENDS > 5 - thermalManager.setTargetHotend(lcd_preheat_hotend_temp[0], 5); - #endif // HOTENDS > 5 - #endif // HOTENDS > 4 - #endif // HOTENDS > 3 - #endif // HOTENDS > 2 - #endif // HOTENDS > 1 - #if HAS_HEATED_BED - lcd_preheat_m1_e0(); - #else - lcd_preheat_m1_e0_only(); - #endif - } - void lcd_preheat_m2_all() { - #if HOTENDS > 1 - thermalManager.setTargetHotend(lcd_preheat_hotend_temp[1], 1); - #if HOTENDS > 2 - thermalManager.setTargetHotend(lcd_preheat_hotend_temp[1], 2); - #if HOTENDS > 3 - thermalManager.setTargetHotend(lcd_preheat_hotend_temp[1], 3); - #if HOTENDS > 4 - thermalManager.setTargetHotend(lcd_preheat_hotend_temp[1], 4); - #if HOTENDS > 5 - thermalManager.setTargetHotend(lcd_preheat_hotend_temp[1], 5); - #endif // HOTENDS > 5 - #endif // HOTENDS > 4 - #endif // HOTENDS > 3 - #endif // HOTENDS > 2 - #endif // HOTENDS > 1 - #if HAS_HEATED_BED - lcd_preheat_m2_e0(); - #else - lcd_preheat_m2_e0_only(); - #endif - } - - #endif // HOTENDS > 1 - - #if HAS_HEATED_BED - void lcd_preheat_m1_bedonly() { _lcd_preheat(0, 0, lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); } - void lcd_preheat_m2_bedonly() { _lcd_preheat(0, 0, lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); } - #endif - - #if HAS_TEMP_HOTEND || HAS_HEATED_BED - - void lcd_preheat_m1_menu() { - START_MENU(); - MENU_BACK(MSG_TEMPERATURE); - #if HOTENDS == 1 - #if HAS_HEATED_BED - MENU_ITEM(function, MSG_PREHEAT_1, lcd_preheat_m1_e0); - MENU_ITEM(function, MSG_PREHEAT_1_END, lcd_preheat_m1_e0_only); - #else - MENU_ITEM(function, MSG_PREHEAT_1, lcd_preheat_m1_e0_only); - #endif - #elif HOTENDS > 1 - #if HAS_HEATED_BED - MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H1, lcd_preheat_m1_e0); - MENU_ITEM(function, MSG_PREHEAT_1_END " " MSG_E1, lcd_preheat_m1_e0_only); - MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H2, lcd_preheat_m1_e1); - MENU_ITEM(function, MSG_PREHEAT_1_END " " MSG_E2, lcd_preheat_m1_e1_only); - #else - MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H1, lcd_preheat_m1_e0_only); - MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H2, lcd_preheat_m1_e1_only); - #endif - #if HOTENDS > 2 - #if HAS_HEATED_BED - MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H3, lcd_preheat_m1_e2); - MENU_ITEM(function, MSG_PREHEAT_1_END " " MSG_E3, lcd_preheat_m1_e2_only); - #else - MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H3, lcd_preheat_m1_e2_only); - #endif - #if HOTENDS > 3 - #if HAS_HEATED_BED - MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H4, lcd_preheat_m1_e3); - MENU_ITEM(function, MSG_PREHEAT_1_END " " MSG_E4, lcd_preheat_m1_e3_only); - #else - MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H4, lcd_preheat_m1_e3_only); - #endif - #if HOTENDS > 4 - #if HAS_HEATED_BED - MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H5, lcd_preheat_m1_e4); - MENU_ITEM(function, MSG_PREHEAT_1_END " " MSG_E5, lcd_preheat_m1_e4_only); - #else - MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H5, lcd_preheat_m1_e4_only); - #endif - #if HOTENDS > 5 - #if HAS_HEATED_BED - MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H6, lcd_preheat_m1_e5); - MENU_ITEM(function, MSG_PREHEAT_1_END " " MSG_E6, lcd_preheat_m1_e5_only); - #else - MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H6, lcd_preheat_m1_e5_only); - #endif - #endif // HOTENDS > 5 - #endif // HOTENDS > 4 - #endif // HOTENDS > 3 - #endif // HOTENDS > 2 - MENU_ITEM(function, MSG_PREHEAT_1_ALL, lcd_preheat_m1_all); - #endif // HOTENDS > 1 - #if HAS_HEATED_BED - MENU_ITEM(function, MSG_PREHEAT_1_BEDONLY, lcd_preheat_m1_bedonly); - #endif - END_MENU(); - } - - void lcd_preheat_m2_menu() { - START_MENU(); - MENU_BACK(MSG_TEMPERATURE); - #if HOTENDS == 1 - #if HAS_HEATED_BED - MENU_ITEM(function, MSG_PREHEAT_2, lcd_preheat_m2_e0); - MENU_ITEM(function, MSG_PREHEAT_2_END, lcd_preheat_m2_e0_only); - #else - MENU_ITEM(function, MSG_PREHEAT_2, lcd_preheat_m2_e0_only); - #endif - #elif HOTENDS > 1 - #if HAS_HEATED_BED - MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H1, lcd_preheat_m2_e0); - MENU_ITEM(function, MSG_PREHEAT_2_END " " MSG_E1, lcd_preheat_m2_e0_only); - MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H2, lcd_preheat_m2_e1); - MENU_ITEM(function, MSG_PREHEAT_2_END " " MSG_E2, lcd_preheat_m2_e1_only); - #else - MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H1, lcd_preheat_m2_e0_only); - MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H2, lcd_preheat_m2_e1_only); - #endif - #if HOTENDS > 2 - #if HAS_HEATED_BED - MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H3, lcd_preheat_m2_e2); - MENU_ITEM(function, MSG_PREHEAT_2_END " " MSG_E3, lcd_preheat_m2_e2_only); - #else - MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H3, lcd_preheat_m2_e2_only); - #endif - #if HOTENDS > 3 - #if HAS_HEATED_BED - MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H4, lcd_preheat_m2_e3); - MENU_ITEM(function, MSG_PREHEAT_2_END " " MSG_E4, lcd_preheat_m2_e3_only); - #else - MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H4, lcd_preheat_m2_e3_only); - #endif - #if HOTENDS > 4 - #if HAS_HEATED_BED - MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H5, lcd_preheat_m2_e4); - MENU_ITEM(function, MSG_PREHEAT_2_END " " MSG_E5, lcd_preheat_m2_e4_only); - #else - MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H5, lcd_preheat_m2_e4_only); - #endif - #if HOTENDS > 5 - #if HAS_HEATED_BED - MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H6, lcd_preheat_m2_e5); - MENU_ITEM(function, MSG_PREHEAT_2_END " " MSG_E6, lcd_preheat_m2_e5_only); - #else - MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H6, lcd_preheat_m2_e5_only); - #endif - #endif // HOTENDS > 5 - #endif // HOTENDS > 4 - #endif // HOTENDS > 3 - #endif // HOTENDS > 2 - MENU_ITEM(function, MSG_PREHEAT_2_ALL, lcd_preheat_m2_all); - #endif // HOTENDS > 1 - #if HAS_HEATED_BED - MENU_ITEM(function, MSG_PREHEAT_2_BEDONLY, lcd_preheat_m2_bedonly); - #endif - END_MENU(); - } - - #endif // HAS_TEMP_HOTEND || HAS_HEATED_BED - - void lcd_cooldown() { - #if FAN_COUNT > 0 - for (uint8_t i = 0; i < FAN_COUNT; i++) fanSpeeds[i] = 0; - #endif - thermalManager.disable_all_heaters(); - lcd_return_to_status(); - } - - #if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(PID_AUTOTUNE_MENU) || ENABLED(ADVANCED_PAUSE_FEATURE) - - /** - * If the queue is full, the command will fail, so we have to loop - * with idle() to make sure the command has been enqueued. - */ - void lcd_enqueue_command(char * const cmd) { - no_reentry = true; - enqueue_and_echo_command_now(cmd); - no_reentry = false; - } - - void lcd_enqueue_commands_P(const char * const cmd) { - no_reentry = true; - enqueue_and_echo_commands_now_P(cmd); - no_reentry = false; - } - - #endif - - #if ENABLED(EEPROM_SETTINGS) - static void lcd_store_settings() { lcd_completion_feedback(settings.save()); } - static void lcd_load_settings() { lcd_completion_feedback(settings.load()); } - #endif - - #if ENABLED(LEVEL_BED_CORNERS) - - /** - * Level corners, starting in the front-left corner. - */ - static int8_t bed_corner; - void _lcd_goto_next_corner() { - line_to_z(4.0); - switch (bed_corner) { - case 0: - current_position[X_AXIS] = X_MIN_BED + LEVEL_CORNERS_INSET; - current_position[Y_AXIS] = Y_MIN_BED + LEVEL_CORNERS_INSET; - break; - case 1: - current_position[X_AXIS] = X_MAX_BED - LEVEL_CORNERS_INSET; - break; - case 2: - current_position[Y_AXIS] = Y_MAX_BED - LEVEL_CORNERS_INSET; - break; - case 3: - current_position[X_AXIS] = X_MIN_BED + LEVEL_CORNERS_INSET; - break; - #if ENABLED(LEVEL_CENTER_TOO) - case 4: - current_position[X_AXIS] = X_CENTER; - current_position[Y_AXIS] = Y_CENTER; - break; - #endif - } - planner.buffer_line(current_position, MMM_TO_MMS(manual_feedrate_mm_m[X_AXIS]), active_extruder); - line_to_z(0.0); - if (++bed_corner > 3 - #if ENABLED(LEVEL_CENTER_TOO) - + 1 - #endif - ) bed_corner = 0; - } - - void _lcd_corner_submenu() { - START_MENU(); - MENU_ITEM(function, - #if ENABLED(LEVEL_CENTER_TOO) - MSG_LEVEL_BED_NEXT_POINT - #else - MSG_NEXT_CORNER - #endif - , _lcd_goto_next_corner); - MENU_ITEM(function, MSG_BACK, lcd_goto_previous_menu_no_defer); - END_MENU(); - } - - void _lcd_level_bed_corners() { - defer_return_to_status = true; - lcd_goto_screen(_lcd_corner_submenu); - bed_corner = 0; - _lcd_goto_next_corner(); - } - - #endif // LEVEL_BED_CORNERS - - #if ENABLED(LCD_BED_LEVELING) && (ENABLED(PROBE_MANUALLY) || ENABLED(MESH_BED_LEVELING)) - - /** - * - * "Motion" > "Level Bed" handlers - * - */ - - static uint8_t manual_probe_index; - - // LCD probed points are from defaults - constexpr uint8_t total_probe_points = ( - #if ENABLED(AUTO_BED_LEVELING_3POINT) - 3 - #elif ABL_GRID || ENABLED(MESH_BED_LEVELING) - GRID_MAX_POINTS - #endif - ); - - bool lcd_wait_for_move; - - // - // Bed leveling is done. Wait for G29 to complete. - // A flag is used so that this can release control - // and allow the command queue to be processed. - // - // When G29 finishes the last move: - // - Raise Z to the "manual probe height" - // - Don't return until done. - // - // ** This blocks the command queue! ** - // - void _lcd_level_bed_done() { - if (!lcd_wait_for_move) { - #if MANUAL_PROBE_HEIGHT > 0 && DISABLED(MESH_BED_LEVELING) - // Display "Done" screen and wait for moves to complete - line_to_z(MANUAL_PROBE_HEIGHT); - lcd_synchronize(PSTR(MSG_LEVEL_BED_DONE)); - #endif - lcd_goto_previous_menu_no_defer(); - lcd_completion_feedback(); - } - if (lcdDrawUpdate) lcd_implementation_drawmenu_static(LCD_HEIGHT >= 4 ? 1 : 0, PSTR(MSG_LEVEL_BED_DONE)); - lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT; - } - - void _lcd_level_goto_next_point(); - - /** - * Step 7: Get the Z coordinate, click goes to the next point or exits - */ - void _lcd_level_bed_get_z() { - ENCODER_DIRECTION_NORMAL(); - - if (use_click()) { - - // - // Save the current Z position and move - // - - // If done... - if (++manual_probe_index >= total_probe_points) { - // - // The last G29 records the point and enables bed leveling - // - lcd_wait_for_move = true; - lcd_goto_screen(_lcd_level_bed_done); - #if ENABLED(MESH_BED_LEVELING) - enqueue_and_echo_commands_P(PSTR("G29 S2")); - #elif ENABLED(PROBE_MANUALLY) - enqueue_and_echo_commands_P(PSTR("G29 V1")); - #endif - } - else - _lcd_level_goto_next_point(); - - return; - } - - // - // Encoder knob or keypad buttons adjust the Z position - // - if (encoderPosition) { - const float z = current_position[Z_AXIS] + float((int32_t)encoderPosition) * (MBL_Z_STEP); - line_to_z(constrain(z, -(LCD_PROBE_Z_RANGE) * 0.5f, (LCD_PROBE_Z_RANGE) * 0.5f)); - lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT; - encoderPosition = 0; - } - - // - // Draw on first display, then only on Z change - // - if (lcdDrawUpdate) { - const float v = current_position[Z_AXIS]; - lcd_implementation_drawedit(PSTR(MSG_MOVE_Z), ftostr43sign(v + (v < 0 ? -0.0001f : 0.0001f), '+')); - } - } - - /** - * Step 6: Display "Next point: 1 / 9" while waiting for move to finish - */ - void _lcd_level_bed_moving() { - if (lcdDrawUpdate) { - char msg[10]; - sprintf_P(msg, PSTR("%i / %u"), (int)(manual_probe_index + 1), total_probe_points); - lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_NEXT_POINT), msg); - } - lcdDrawUpdate = LCDVIEW_CALL_NO_REDRAW; - if (!lcd_wait_for_move) lcd_goto_screen(_lcd_level_bed_get_z); - } - - /** - * Step 5: Initiate a move to the next point - */ - void _lcd_level_goto_next_point() { - lcd_goto_screen(_lcd_level_bed_moving); - - // G29 Records Z, moves, and signals when it pauses - lcd_wait_for_move = true; - #if ENABLED(MESH_BED_LEVELING) - enqueue_and_echo_commands_P(manual_probe_index ? PSTR("G29 S2") : PSTR("G29 S1")); - #elif ENABLED(PROBE_MANUALLY) - enqueue_and_echo_commands_P(PSTR("G29 V1")); - #endif - } - - /** - * Step 4: Display "Click to Begin", wait for click - * Move to the first probe position - */ - void _lcd_level_bed_homing_done() { - if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_WAITING)); - if (use_click()) { - manual_probe_index = 0; - _lcd_level_goto_next_point(); - } - } - - /** - * Step 3: Display "Homing XYZ" - Wait for homing to finish - */ - void _lcd_level_bed_homing() { - if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_HOMING), NULL); - lcdDrawUpdate = LCDVIEW_CALL_NO_REDRAW; - if (all_axes_homed()) lcd_goto_screen(_lcd_level_bed_homing_done); - } - - #if ENABLED(PROBE_MANUALLY) - extern bool g29_in_progress; - #endif - - /** - * Step 2: Continue Bed Leveling... - */ - void _lcd_level_bed_continue() { - defer_return_to_status = true; - axis_homed = 0; - lcd_goto_screen(_lcd_level_bed_homing); - enqueue_and_echo_commands_P(PSTR("G28")); - } - - #elif ENABLED(AUTO_BED_LEVELING_UBL) - - void _lcd_ubl_level_bed(); - - static int16_t ubl_storage_slot = 0, - custom_hotend_temp = 190, - side_points = 3, - ubl_fillin_amount = 5, - ubl_height_amount = 1, - n_edit_pts = 1, - x_plot = 0, - y_plot = 0; - - #if HAS_HEATED_BED - static int16_t custom_bed_temp = 50; - #endif - - /** - * UBL Build Custom Mesh Command - */ - void _lcd_ubl_build_custom_mesh() { - char UBL_LCD_GCODE[20]; - enqueue_and_echo_commands_P(PSTR("G28")); - #if HAS_HEATED_BED - sprintf_P(UBL_LCD_GCODE, PSTR("M190 S%i"), custom_bed_temp); - lcd_enqueue_command(UBL_LCD_GCODE); - #endif - sprintf_P(UBL_LCD_GCODE, PSTR("M109 S%i"), custom_hotend_temp); - lcd_enqueue_command(UBL_LCD_GCODE); - enqueue_and_echo_commands_P(PSTR("G29 P1")); - } - - /** - * UBL Custom Mesh submenu - * - * << Build Mesh - * Hotend Temp: --- - * Bed Temp: --- - * Build Custom Mesh - */ - void _lcd_ubl_custom_mesh() { - START_MENU(); - MENU_BACK(MSG_UBL_BUILD_MESH_MENU); - MENU_ITEM_EDIT(int3, MSG_UBL_CUSTOM_HOTEND_TEMP, &custom_hotend_temp, EXTRUDE_MINTEMP, (HEATER_0_MAXTEMP - 10)); - #if HAS_HEATED_BED - MENU_ITEM_EDIT(int3, MSG_UBL_CUSTOM_BED_TEMP, &custom_bed_temp, BED_MINTEMP, (BED_MAXTEMP - 15)); - #endif - MENU_ITEM(function, MSG_UBL_BUILD_CUSTOM_MESH, _lcd_ubl_build_custom_mesh); - END_MENU(); - } - - /** - * UBL Adjust Mesh Height Command - */ - void _lcd_ubl_adjust_height_cmd() { - char UBL_LCD_GCODE[16]; - const int ind = ubl_height_amount > 0 ? 9 : 10; - strcpy_P(UBL_LCD_GCODE, PSTR("G29 P6 C -")); - sprintf_P(&UBL_LCD_GCODE[ind], PSTR(".%i"), ABS(ubl_height_amount)); - lcd_enqueue_command(UBL_LCD_GCODE); - } - - /** - * UBL Adjust Mesh Height submenu - * - * << Edit Mesh - * Height Amount: --- - * Adjust Mesh Height - * << Info Screen - */ - void _lcd_ubl_height_adjust_menu() { - START_MENU(); - MENU_BACK(MSG_UBL_EDIT_MESH_MENU); - MENU_ITEM_EDIT_CALLBACK(int3, MSG_UBL_MESH_HEIGHT_AMOUNT, &ubl_height_amount, -9, 9, _lcd_ubl_adjust_height_cmd); - MENU_ITEM(function, MSG_WATCH, lcd_return_to_status); - END_MENU(); - } - - /** - * UBL Edit Mesh submenu - * - * << UBL Tools - * Fine Tune All - * Fine Tune Closest - * - Adjust Mesh Height >> - * << Info Screen - */ - void _lcd_ubl_edit_mesh() { - START_MENU(); - MENU_BACK(MSG_UBL_TOOLS); - MENU_ITEM(gcode, MSG_UBL_FINE_TUNE_ALL, PSTR("G29 P4 R999 T")); - MENU_ITEM(gcode, MSG_UBL_FINE_TUNE_CLOSEST, PSTR("G29 P4 T")); - MENU_ITEM(submenu, MSG_UBL_MESH_HEIGHT_ADJUST, _lcd_ubl_height_adjust_menu); - MENU_ITEM(function, MSG_WATCH, lcd_return_to_status); - END_MENU(); - } - - /** - * UBL Validate Custom Mesh Command - */ - void _lcd_ubl_validate_custom_mesh() { - char UBL_LCD_GCODE[24]; - const int temp = - #if HAS_HEATED_BED - custom_bed_temp - #else - 0 - #endif - ; - sprintf_P(UBL_LCD_GCODE, PSTR("G26 C B%i H%i P"), temp, custom_hotend_temp); - lcd_enqueue_commands_P(PSTR("G28")); - lcd_enqueue_command(UBL_LCD_GCODE); - } - - /** - * UBL Validate Mesh submenu - * - * << UBL Tools - * PLA Mesh Validation - * ABS Mesh Validation - * Validate Custom Mesh - * << Info Screen - */ - void _lcd_ubl_validate_mesh() { - START_MENU(); - MENU_BACK(MSG_UBL_TOOLS); - #if HAS_HEATED_BED - MENU_ITEM(gcode, MSG_UBL_VALIDATE_PLA_MESH, PSTR("G28\nG26 C B" STRINGIFY(PREHEAT_1_TEMP_BED) " H" STRINGIFY(PREHEAT_1_TEMP_HOTEND) " P")); - MENU_ITEM(gcode, MSG_UBL_VALIDATE_ABS_MESH, PSTR("G28\nG26 C B" STRINGIFY(PREHEAT_2_TEMP_BED) " H" STRINGIFY(PREHEAT_2_TEMP_HOTEND) " P")); - #else - MENU_ITEM(gcode, MSG_UBL_VALIDATE_PLA_MESH, PSTR("G28\nG26 C B0 H" STRINGIFY(PREHEAT_1_TEMP_HOTEND) " P")); - MENU_ITEM(gcode, MSG_UBL_VALIDATE_ABS_MESH, PSTR("G28\nG26 C B0 H" STRINGIFY(PREHEAT_2_TEMP_HOTEND) " P")); - #endif - MENU_ITEM(function, MSG_UBL_VALIDATE_CUSTOM_MESH, _lcd_ubl_validate_custom_mesh); - MENU_ITEM(function, MSG_WATCH, lcd_return_to_status); - END_MENU(); - } - - /** - * UBL Grid Leveling Command - */ - void _lcd_ubl_grid_level_cmd() { - char UBL_LCD_GCODE[10]; - sprintf_P(UBL_LCD_GCODE, PSTR("G29 J%i"), side_points); - lcd_enqueue_command(UBL_LCD_GCODE); - } - - /** - * UBL Grid Leveling submenu - * - * << UBL Tools - * Side points: --- - * Level Mesh - */ - void _lcd_ubl_grid_level() { - START_MENU(); - MENU_BACK(MSG_UBL_TOOLS); - MENU_ITEM_EDIT(int3, MSG_UBL_SIDE_POINTS, &side_points, 2, 6); - MENU_ITEM(function, MSG_UBL_MESH_LEVEL, _lcd_ubl_grid_level_cmd); - END_MENU(); - } - - /** - * UBL Mesh Leveling submenu - * - * << UBL Tools - * 3-Point Mesh Leveling - * - Grid Mesh Leveling >> - * << Info Screen - */ - void _lcd_ubl_mesh_leveling() { - START_MENU(); - MENU_BACK(MSG_UBL_TOOLS); - MENU_ITEM(gcode, MSG_UBL_3POINT_MESH_LEVELING, PSTR("G29 J0")); - MENU_ITEM(submenu, MSG_UBL_GRID_MESH_LEVELING, _lcd_ubl_grid_level); - MENU_ITEM(function, MSG_WATCH, lcd_return_to_status); - END_MENU(); - } - - /** - * UBL Fill-in Amount Mesh Command - */ - void _lcd_ubl_fillin_amount_cmd() { - char UBL_LCD_GCODE[16]; - sprintf_P(UBL_LCD_GCODE, PSTR("G29 P3 R C.%i"), ubl_fillin_amount); - lcd_enqueue_command(UBL_LCD_GCODE); - } - - /** - * UBL Fill-in Mesh submenu - * - * << Build Mesh - * Fill-in Amount: --- - * Fill-in Mesh - * Smart Fill-in - * Manual Fill-in - * << Info Screen - */ - void _lcd_ubl_fillin_menu() { - START_MENU(); - MENU_BACK(MSG_UBL_BUILD_MESH_MENU); - MENU_ITEM_EDIT_CALLBACK(int3, MSG_UBL_FILLIN_AMOUNT, &ubl_fillin_amount, 0, 9, _lcd_ubl_fillin_amount_cmd); - MENU_ITEM(gcode, MSG_UBL_SMART_FILLIN, PSTR("G29 P3 T0")); - MENU_ITEM(gcode, MSG_UBL_MANUAL_FILLIN, PSTR("G29 P2 B T0")); - MENU_ITEM(function, MSG_WATCH, lcd_return_to_status); - END_MENU(); - } - - void _lcd_ubl_invalidate() { - ubl.invalidate(); - SERIAL_PROTOCOLLNPGM("Mesh invalidated."); - } - - /** - * UBL Build Mesh submenu - * - * << UBL Tools - * Build PLA Mesh - * Build ABS Mesh - * - Build Custom Mesh >> - * Build Cold Mesh - * - Fill-in Mesh >> - * Continue Bed Mesh - * Invalidate All - * Invalidate Closest - * << Info Screen - */ - void _lcd_ubl_build_mesh() { - START_MENU(); - MENU_BACK(MSG_UBL_TOOLS); - #if HAS_HEATED_BED - MENU_ITEM(gcode, MSG_UBL_BUILD_PLA_MESH, PSTR( - "G28\n" - "M190 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\n" - "M109 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) "\n" - "G29 P1\n" - "M104 S0\n" - "M140 S0" - )); - MENU_ITEM(gcode, MSG_UBL_BUILD_ABS_MESH, PSTR( - "G28\n" - "M190 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\n" - "M109 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) "\n" - "G29 P1\n" - "M104 S0\n" - "M140 S0" - )); - #else - MENU_ITEM(gcode, MSG_UBL_BUILD_PLA_MESH, PSTR( - "G28\n" - "M109 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) "\n" - "G29 P1\n" - "M104 S0" - )); - MENU_ITEM(gcode, MSG_UBL_BUILD_ABS_MESH, PSTR( - "G28\n" - "M109 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) "\n" - "G29 P1\n" - "M104 S0" - )); - #endif - MENU_ITEM(submenu, MSG_UBL_BUILD_CUSTOM_MESH, _lcd_ubl_custom_mesh); - MENU_ITEM(gcode, MSG_UBL_BUILD_COLD_MESH, PSTR("G28\nG29 P1")); - MENU_ITEM(submenu, MSG_UBL_FILLIN_MESH, _lcd_ubl_fillin_menu); - MENU_ITEM(gcode, MSG_UBL_CONTINUE_MESH, PSTR("G29 P1 C")); - MENU_ITEM(function, MSG_UBL_INVALIDATE_ALL, _lcd_ubl_invalidate); - MENU_ITEM(gcode, MSG_UBL_INVALIDATE_CLOSEST, PSTR("G29 I")); - MENU_ITEM(function, MSG_WATCH, lcd_return_to_status); - END_MENU(); - } - - /** - * UBL Load Mesh Command - */ - void _lcd_ubl_load_mesh_cmd() { - char UBL_LCD_GCODE[25]; - sprintf_P(UBL_LCD_GCODE, PSTR("G29 L%i"), ubl_storage_slot); - lcd_enqueue_command(UBL_LCD_GCODE); - sprintf_P(UBL_LCD_GCODE, PSTR("M117 " MSG_MESH_LOADED), ubl_storage_slot); - lcd_enqueue_command(UBL_LCD_GCODE); - } - - /** - * UBL Save Mesh Command - */ - void _lcd_ubl_save_mesh_cmd() { - char UBL_LCD_GCODE[25]; - sprintf_P(UBL_LCD_GCODE, PSTR("G29 S%i"), ubl_storage_slot); - lcd_enqueue_command(UBL_LCD_GCODE); - sprintf_P(UBL_LCD_GCODE, PSTR("M117 " MSG_MESH_SAVED), ubl_storage_slot); - lcd_enqueue_command(UBL_LCD_GCODE); - } - - /** - * UBL Mesh Storage submenu - * - * << Unified Bed Leveling - * Memory Slot: --- - * Load Bed Mesh - * Save Bed Mesh - */ - void _lcd_ubl_storage_mesh() { - int16_t a = settings.calc_num_meshes(); - START_MENU(); - MENU_BACK(MSG_UBL_LEVEL_BED); - if (!WITHIN(ubl_storage_slot, 0, a - 1)) { - STATIC_ITEM(MSG_NO_STORAGE); - } - else { - MENU_ITEM_EDIT(int3, MSG_UBL_STORAGE_SLOT, &ubl_storage_slot, 0, a - 1); - MENU_ITEM(function, MSG_UBL_LOAD_MESH, _lcd_ubl_load_mesh_cmd); - MENU_ITEM(function, MSG_UBL_SAVE_MESH, _lcd_ubl_save_mesh_cmd); - } - END_MENU(); - } - - /** - * UBL LCD "radar" map homing - */ - void _lcd_ubl_output_map_lcd(); - - void _lcd_ubl_map_homing() { - defer_return_to_status = true; - if (lcdDrawUpdate) lcd_implementation_drawmenu_static(LCD_HEIGHT < 3 ? 0 : (LCD_HEIGHT > 4 ? 2 : 1), PSTR(MSG_LEVEL_BED_HOMING)); - lcdDrawUpdate = LCDVIEW_CALL_NO_REDRAW; - if (all_axes_homed()) { - ubl.lcd_map_control = true; // Return to the map screen - lcd_goto_screen(_lcd_ubl_output_map_lcd); - } - } - - /** - * UBL LCD "radar" map point editing - */ - void _lcd_ubl_map_lcd_edit_cmd() { - char UBL_LCD_GCODE[50], str[10], str2[10]; - dtostrf(pgm_read_float(&ubl._mesh_index_to_xpos[x_plot]), 0, 2, str); - dtostrf(pgm_read_float(&ubl._mesh_index_to_ypos[y_plot]), 0, 2, str2); - snprintf_P(UBL_LCD_GCODE, sizeof(UBL_LCD_GCODE), PSTR("G29 P4 X%s Y%s R%i"), str, str2, n_edit_pts); - lcd_enqueue_command(UBL_LCD_GCODE); - } - - /** - * UBL LCD Map Movement - */ - void ubl_map_move_to_xy() { - current_position[X_AXIS] = pgm_read_float(&ubl._mesh_index_to_xpos[x_plot]); - current_position[Y_AXIS] = pgm_read_float(&ubl._mesh_index_to_ypos[y_plot]); - planner.buffer_line(current_position, MMM_TO_MMS(XY_PROBE_SPEED), active_extruder); - } - - /** - * UBL LCD "radar" map - */ - void set_current_from_steppers_for_axis(const AxisEnum axis); - void sync_plan_position(); - - void _lcd_do_nothing() {} - void _lcd_hard_stop() { - const screenFunc_t old_screen = currentScreen; - currentScreen = _lcd_do_nothing; - planner.quick_stop(); - currentScreen = old_screen; - set_current_from_steppers_for_axis(ALL_AXES); - sync_plan_position(); - } - - void _lcd_ubl_output_map_lcd() { - static int16_t step_scaler = 0; - - if (use_click()) return _lcd_ubl_map_lcd_edit_cmd(); - ENCODER_DIRECTION_NORMAL(); - - if (encoderPosition) { - step_scaler += (int32_t)encoderPosition; - x_plot += step_scaler / (ENCODER_STEPS_PER_MENU_ITEM); - if (ABS(step_scaler) >= ENCODER_STEPS_PER_MENU_ITEM) step_scaler = 0; - encoderPosition = 0; - lcdDrawUpdate = LCDVIEW_REDRAW_NOW; - } - - // Encoder to the right (++) - if (x_plot >= GRID_MAX_POINTS_X) { x_plot = 0; y_plot++; } - if (y_plot >= GRID_MAX_POINTS_Y) y_plot = 0; - - // Encoder to the left (--) - if (x_plot <= GRID_MAX_POINTS_X - (GRID_MAX_POINTS_X + 1)) { x_plot = GRID_MAX_POINTS_X - 1; y_plot--; } - if (y_plot <= GRID_MAX_POINTS_Y - (GRID_MAX_POINTS_Y + 1)) y_plot = GRID_MAX_POINTS_Y - 1; - - // Prevent underrun/overrun of plot numbers - x_plot = constrain(x_plot, GRID_MAX_POINTS_X - (GRID_MAX_POINTS_X + 1), GRID_MAX_POINTS_X + 1); - y_plot = constrain(y_plot, GRID_MAX_POINTS_Y - (GRID_MAX_POINTS_Y + 1), GRID_MAX_POINTS_Y + 1); - - // Determine number of points to edit - #if IS_KINEMATIC - n_edit_pts = 9; //TODO: Delta accessible edit points - #else - const bool xc = WITHIN(x_plot, 1, GRID_MAX_POINTS_X - 2), - yc = WITHIN(y_plot, 1, GRID_MAX_POINTS_Y - 2); - n_edit_pts = yc ? (xc ? 9 : 6) : (xc ? 6 : 4); // Corners - #endif - - if (lcdDrawUpdate) { - lcd_implementation_ubl_plot(x_plot, y_plot); - - if (planner.movesplanned()) // If the nozzle is already moving, cancel the move. - _lcd_hard_stop(); - - ubl_map_move_to_xy(); // Move to new location - } - } - - /** - * UBL Homing before LCD map - */ - void _lcd_ubl_output_map_lcd_cmd() { - if (!all_axes_known()) { - axis_homed = 0; - enqueue_and_echo_commands_P(PSTR("G28")); - } - lcd_goto_screen(_lcd_ubl_map_homing); - } - - /** - * UBL Output map submenu - * - * << Unified Bed Leveling - * Output for Host - * Output for CSV - * Off Printer Backup - * Output Mesh Map - */ - void _lcd_ubl_output_map() { - START_MENU(); - MENU_BACK(MSG_UBL_LEVEL_BED); - MENU_ITEM(gcode, MSG_UBL_OUTPUT_MAP_HOST, PSTR("G29 T0")); - MENU_ITEM(gcode, MSG_UBL_OUTPUT_MAP_CSV, PSTR("G29 T1")); - MENU_ITEM(gcode, MSG_UBL_OUTPUT_MAP_BACKUP, PSTR("G29 S-1")); - MENU_ITEM(function, MSG_UBL_OUTPUT_MAP, _lcd_ubl_output_map_lcd_cmd); - END_MENU(); - } - - /** - * UBL Tools submenu - * - * << Unified Bed Leveling - * - Build Mesh >> - * - Validate Mesh >> - * - Edit Mesh >> - * - Mesh Leveling >> - */ - void _lcd_ubl_tools_menu() { - START_MENU(); - MENU_BACK(MSG_UBL_LEVEL_BED); - MENU_ITEM(submenu, MSG_UBL_BUILD_MESH_MENU, _lcd_ubl_build_mesh); - MENU_ITEM(gcode, MSG_UBL_MANUAL_MESH, PSTR("G29 I999\nG29 P2 B T0")); - MENU_ITEM(submenu, MSG_UBL_VALIDATE_MESH_MENU, _lcd_ubl_validate_mesh); - MENU_ITEM(submenu, MSG_UBL_EDIT_MESH_MENU, _lcd_ubl_edit_mesh); - MENU_ITEM(submenu, MSG_UBL_MESH_LEVELING, _lcd_ubl_mesh_leveling); - END_MENU(); - } - - /** - * UBL Step-By-Step submenu - * - * << Unified Bed Leveling - * 1 Build Cold Mesh - * 2 Smart Fill-in - * - 3 Validate Mesh >> - * 4 Fine Tune All - * - 5 Validate Mesh >> - * 6 Fine Tune All - * 7 Save Bed Mesh - */ - void _lcd_ubl_step_by_step() { - START_MENU(); - MENU_BACK(MSG_UBL_LEVEL_BED); - MENU_ITEM(gcode, "1 " MSG_UBL_BUILD_COLD_MESH, PSTR("G28\nG29 P1")); - MENU_ITEM(gcode, "2 " MSG_UBL_SMART_FILLIN, PSTR("G29 P3 T0")); - MENU_ITEM(submenu, "3 " MSG_UBL_VALIDATE_MESH_MENU, _lcd_ubl_validate_mesh); - MENU_ITEM(gcode, "4 " MSG_UBL_FINE_TUNE_ALL, PSTR("G29 P4 R999 T")); - MENU_ITEM(submenu, "5 " MSG_UBL_VALIDATE_MESH_MENU, _lcd_ubl_validate_mesh); - MENU_ITEM(gcode, "6 " MSG_UBL_FINE_TUNE_ALL, PSTR("G29 P4 R999 T")); - MENU_ITEM(function, "7 " MSG_UBL_SAVE_MESH, _lcd_ubl_save_mesh_cmd); - END_MENU(); - } - - /** - * UBL System submenu - * - * << Motion - * - Manually Build Mesh >> - * - Activate UBL >> - * - Deactivate UBL >> - * - Step-By-Step UBL >> - * - Mesh Storage >> - * - Output Map >> - * - UBL Tools >> - * - Output UBL Info >> - */ - - void _lcd_ubl_level_bed() { - START_MENU(); - MENU_BACK(MSG_MOTION); - MENU_ITEM(gcode, MSG_UBL_ACTIVATE_MESH, PSTR("G29 A")); - MENU_ITEM(gcode, MSG_UBL_DEACTIVATE_MESH, PSTR("G29 D")); - MENU_ITEM(submenu, MSG_UBL_STEP_BY_STEP_MENU, _lcd_ubl_step_by_step); - MENU_ITEM(function, MSG_UBL_MESH_EDIT, _lcd_ubl_output_map_lcd_cmd); - MENU_ITEM(submenu, MSG_UBL_STORAGE_MESH_MENU, _lcd_ubl_storage_mesh); - MENU_ITEM(submenu, MSG_UBL_OUTPUT_MAP, _lcd_ubl_output_map); - MENU_ITEM(submenu, MSG_UBL_TOOLS, _lcd_ubl_tools_menu); - MENU_ITEM(gcode, MSG_UBL_INFO_UBL, PSTR("G29 W")); - #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float3, MSG_Z_FADE_HEIGHT, &new_z_fade_height, 0, 100, _lcd_set_z_fade_height); - #endif - END_MENU(); - } - - #endif // AUTO_BED_LEVELING_UBL - - - #if ENABLED(LCD_BED_LEVELING) || (HAS_LEVELING && DISABLED(SLIM_LCD_MENUS)) - void _lcd_toggle_bed_leveling() { set_bed_leveling_enabled(!planner.leveling_active); } - #endif - - #if ENABLED(LCD_BED_LEVELING) - - /** - * Step 1: Bed Level entry-point - * - * << Motion - * Auto Home (if homing needed) - * Leveling On/Off (if data exists, and homed) - * Fade Height: --- (Req: ENABLE_LEVELING_FADE_HEIGHT) - * Mesh Z Offset: --- (Req: MESH_BED_LEVELING) - * Z Probe Offset: --- (Req: HAS_BED_PROBE, Opt: BABYSTEP_ZPROBE_OFFSET) - * Level Bed > - * Level Corners > (if homed) - * Load Settings (Req: EEPROM_SETTINGS) - * Save Settings (Req: EEPROM_SETTINGS) - */ - void lcd_bed_leveling() { - START_MENU(); - MENU_BACK(MSG_MOTION); - - const bool is_homed = all_axes_known(); - - // Auto Home if not using manual probing - #if DISABLED(PROBE_MANUALLY) && DISABLED(MESH_BED_LEVELING) - if (!is_homed) MENU_ITEM(gcode, MSG_AUTO_HOME, PSTR("G28")); - #endif - - // Level Bed - #if ENABLED(PROBE_MANUALLY) || ENABLED(MESH_BED_LEVELING) - // Manual leveling uses a guided procedure - MENU_ITEM(submenu, MSG_LEVEL_BED, _lcd_level_bed_continue); - #else - // Automatic leveling can just run the G-code - MENU_ITEM(gcode, MSG_LEVEL_BED, is_homed ? PSTR("G29") : PSTR("G28\nG29")); - #endif - - // Homed and leveling is valid? Then leveling can be toggled. - if (is_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); - } - - // Z Fade Height - #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float3, MSG_Z_FADE_HEIGHT, &new_z_fade_height, 0, 100, _lcd_set_z_fade_height); - #endif - - // - // MBL Z Offset - // - #if ENABLED(MESH_BED_LEVELING) - MENU_ITEM_EDIT(float43, MSG_BED_Z, &mbl.z_offset, -1, 1); - #endif - - #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - MENU_ITEM(submenu, MSG_ZPROBE_ZOFFSET, lcd_babystep_zoffset); - #elif HAS_BED_PROBE - MENU_ITEM_EDIT(float52, MSG_ZPROBE_ZOFFSET, &zprobe_zoffset, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX); - #endif - - #if ENABLED(LEVEL_BED_CORNERS) - // Move to the next corner for leveling - if (all_axes_homed()) MENU_ITEM(submenu, MSG_LEVEL_CORNERS, _lcd_level_bed_corners); - #endif - - #if ENABLED(EEPROM_SETTINGS) - MENU_ITEM(function, MSG_LOAD_EEPROM, lcd_load_settings); - MENU_ITEM(function, MSG_STORE_EEPROM, lcd_store_settings); - #endif - END_MENU(); - } - - #endif // LCD_BED_LEVELING - - /** - * - * "Movement" submenu - * - */ - - void lcd_movement_menu() { - START_MENU(); - - // - // ^ Main - // - MENU_BACK(MSG_MAIN); - - // - // Move Axis - // - #if ENABLED(DELTA) - if (all_axes_homed()) - #endif - MENU_ITEM(submenu, MSG_MOVE_AXIS, lcd_move_menu); - - // - // Auto Home - // - MENU_ITEM(gcode, MSG_AUTO_HOME, PSTR("G28")); - #if ENABLED(INDIVIDUAL_AXIS_HOMING_MENU) - MENU_ITEM(gcode, MSG_AUTO_HOME_X, PSTR("G28 X")); - MENU_ITEM(gcode, MSG_AUTO_HOME_Y, PSTR("G28 Y")); - MENU_ITEM(gcode, MSG_AUTO_HOME_Z, PSTR("G28 Z")); - #endif - - // - // TMC Z Calibration - // - #if ENABLED(TMC_Z_CALIBRATION) - MENU_ITEM(gcode, MSG_TMC_Z_CALIBRATION, PSTR("G28\nM915")); - #endif - - // - // Level Bed - // - #if ENABLED(AUTO_BED_LEVELING_UBL) - - MENU_ITEM(submenu, MSG_UBL_LEVEL_BED, _lcd_ubl_level_bed); - - #elif ENABLED(LCD_BED_LEVELING) - - #if ENABLED(PROBE_MANUALLY) - if (!g29_in_progress) - #endif - MENU_ITEM(submenu, MSG_BED_LEVELING, lcd_bed_leveling); - - #elif HAS_LEVELING && DISABLED(SLIM_LCD_MENUS) - - #if DISABLED(PROBE_MANUALLY) - MENU_ITEM(gcode, MSG_LEVEL_BED, PSTR("G28\nG29")); - #endif - if (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); - } - #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float3, MSG_Z_FADE_HEIGHT, &new_z_fade_height, 0, 100, _lcd_set_z_fade_height); - #endif - - #endif - - #if ENABLED(LEVEL_BED_CORNERS) && DISABLED(LCD_BED_LEVELING) - if (all_axes_homed()) - MENU_ITEM(function, MSG_LEVEL_CORNERS, _lcd_level_bed_corners); - #endif - - // - // Disable Steppers - // - MENU_ITEM(gcode, MSG_DISABLE_STEPPERS, PSTR("M84")); - - END_MENU(); - } - - float move_menu_scale; - - #if ENABLED(DELTA_CALIBRATION_MENU) || ENABLED(DELTA_AUTO_CALIBRATION) - - void lcd_move_z(); - - void _man_probe_pt(const float &rx, const float &ry) { - do_blocking_move_to_z(Z_CLEARANCE_BETWEEN_PROBES); - do_blocking_move_to_xy(rx, ry); - - lcd_synchronize(); - move_menu_scale = MAX(PROBE_MANUALLY_STEP, MIN_STEPS_PER_SEGMENT / float(DEFAULT_XYZ_STEPS_PER_UNIT)); - lcd_goto_screen(lcd_move_z); - } - - #endif // DELTA_CALIBRATION_MENU || DELTA_AUTO_CALIBRATION - - #if ENABLED(DELTA_AUTO_CALIBRATION) - - float lcd_probe_pt(const float &rx, const float &ry) { - _man_probe_pt(rx, ry); - KEEPALIVE_STATE(PAUSED_FOR_USER); - defer_return_to_status = true; - wait_for_user = true; - while (wait_for_user) idle(); - KEEPALIVE_STATE(IN_HANDLER); - lcd_goto_previous_menu_no_defer(); - return current_position[Z_AXIS]; - } - - #endif // DELTA_AUTO_CALIBRATION - - #if ENABLED(DELTA_CALIBRATION_MENU) - - void _lcd_calibrate_homing() { - if (lcdDrawUpdate) lcd_implementation_drawmenu_static(LCD_HEIGHT >= 4 ? 1 : 0, PSTR(MSG_LEVEL_BED_HOMING)); - lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT; - if (all_axes_homed()) - lcd_goto_previous_menu(); - } - - void _lcd_delta_calibrate_home() { - enqueue_and_echo_commands_P(PSTR("G28")); - lcd_goto_screen(_lcd_calibrate_homing); - } - - void _goto_tower_x() { _man_probe_pt(cos(RADIANS(210)) * delta_calibration_radius, sin(RADIANS(210)) * delta_calibration_radius); } - void _goto_tower_y() { _man_probe_pt(cos(RADIANS(330)) * delta_calibration_radius, sin(RADIANS(330)) * delta_calibration_radius); } - void _goto_tower_z() { _man_probe_pt(cos(RADIANS( 90)) * delta_calibration_radius, sin(RADIANS( 90)) * delta_calibration_radius); } - void _goto_center() { _man_probe_pt(0,0); } - - #endif // DELTA_CALIBRATION_MENU - - #if ENABLED(DELTA_CALIBRATION_MENU) || ENABLED(DELTA_AUTO_CALIBRATION) - - void _recalc_delta_settings() { - #if HAS_LEVELING - reset_bed_level(); // After changing kinematics bed-level data is no longer valid - #endif - recalc_delta_settings(); - } - - void lcd_delta_settings() { - START_MENU(); - MENU_BACK(MSG_DELTA_CALIBRATE); - MENU_ITEM_EDIT_CALLBACK(float52sign, MSG_DELTA_HEIGHT, &delta_height, delta_height - 10, delta_height + 10, _recalc_delta_settings); - MENU_ITEM_EDIT_CALLBACK(float43, "Ex", &delta_endstop_adj[A_AXIS], -5, 5, _recalc_delta_settings); - MENU_ITEM_EDIT_CALLBACK(float43, "Ey", &delta_endstop_adj[B_AXIS], -5, 5, _recalc_delta_settings); - MENU_ITEM_EDIT_CALLBACK(float43, "Ez", &delta_endstop_adj[C_AXIS], -5, 5, _recalc_delta_settings); - MENU_ITEM_EDIT_CALLBACK(float52sign, MSG_DELTA_RADIUS, &delta_radius, delta_radius - 5, delta_radius + 5, _recalc_delta_settings); - MENU_ITEM_EDIT_CALLBACK(float43, "Tx", &delta_tower_angle_trim[A_AXIS], -5, 5, _recalc_delta_settings); - MENU_ITEM_EDIT_CALLBACK(float43, "Ty", &delta_tower_angle_trim[B_AXIS], -5, 5, _recalc_delta_settings); - MENU_ITEM_EDIT_CALLBACK(float43, "Tz", &delta_tower_angle_trim[C_AXIS], -5, 5, _recalc_delta_settings); - MENU_ITEM_EDIT_CALLBACK(float52sign, MSG_DELTA_DIAG_ROD, &delta_diagonal_rod, delta_diagonal_rod - 5, delta_diagonal_rod + 5, _recalc_delta_settings); - END_MENU(); - } - - void lcd_delta_calibrate_menu() { - START_MENU(); - MENU_BACK(MSG_MAIN); - #if ENABLED(DELTA_AUTO_CALIBRATION) - MENU_ITEM(gcode, MSG_DELTA_AUTO_CALIBRATE, PSTR("G33")); - MENU_ITEM(gcode, MSG_DELTA_HEIGHT_CALIBRATE, PSTR("G33 S P1")); - MENU_ITEM(gcode, MSG_DELTA_Z_OFFSET_CALIBRATE, PSTR("G33 P-1")); - #if ENABLED(EEPROM_SETTINGS) - MENU_ITEM(function, MSG_STORE_EEPROM, lcd_store_settings); - MENU_ITEM(function, MSG_LOAD_EEPROM, lcd_load_settings); - #endif - #endif - MENU_ITEM(submenu, MSG_DELTA_SETTINGS, lcd_delta_settings); - #if ENABLED(DELTA_CALIBRATION_MENU) - MENU_ITEM(submenu, MSG_AUTO_HOME, _lcd_delta_calibrate_home); - if (all_axes_homed()) { - MENU_ITEM(submenu, MSG_DELTA_CALIBRATE_X, _goto_tower_x); - MENU_ITEM(submenu, MSG_DELTA_CALIBRATE_Y, _goto_tower_y); - MENU_ITEM(submenu, MSG_DELTA_CALIBRATE_Z, _goto_tower_z); - MENU_ITEM(submenu, MSG_DELTA_CALIBRATE_CENTER, _goto_center); - } - #endif - END_MENU(); - } - - #endif // DELTA_CALIBRATION_MENU || DELTA_AUTO_CALIBRATION - /** * If the most recent manual move hasn't been fed to the planner yet, - * and the planner can accept one, send immediately + * and the planner can accept one, send a move immediately. */ - inline void manage_manual_move() { + void MarlinUI::manage_manual_move() { if (processing_manual_move) return; @@ -3003,2325 +597,7 @@ void lcd_quick_feedback(const bool clear_buttons) { } } - /** - * Set a flag that lcd_update() should start a move - * to "current_position" after a short delay. - */ - inline void manual_move_to_current(AxisEnum axis - #if E_MANUAL > 1 - , const int8_t eindex=-1 - #endif - ) { - #if ENABLED(DUAL_X_CARRIAGE) || E_MANUAL > 1 - #if E_MANUAL > 1 - if (axis == E_AXIS) - #endif - manual_move_e_index = eindex >= 0 ? eindex : active_extruder; - #endif - manual_move_start_time = millis() + (move_menu_scale < 0.99f ? 0UL : 250UL); // delay for bigger moves - manual_move_axis = (int8_t)axis; - } - - /** - * - * "Motion" > "Move Axis" submenu - * - */ - - void _lcd_move_xyz(const char* name, AxisEnum axis) { - if (use_click()) { return lcd_goto_previous_menu_no_defer(); } - ENCODER_DIRECTION_NORMAL(); - if (encoderPosition && !processing_manual_move) { - - // Start with no limits to movement - float min = current_position[axis] - 1000, - max = current_position[axis] + 1000; - - // Limit to software endstops, if enabled - #if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) - if (soft_endstops_enabled) switch (axis) { - case X_AXIS: - #if ENABLED(MIN_SOFTWARE_ENDSTOP_X) - min = soft_endstop_min[X_AXIS]; - #endif - #if ENABLED(MAX_SOFTWARE_ENDSTOP_X) - max = soft_endstop_max[X_AXIS]; - #endif - break; - case Y_AXIS: - #if ENABLED(MIN_SOFTWARE_ENDSTOP_Y) - min = soft_endstop_min[Y_AXIS]; - #endif - #if ENABLED(MAX_SOFTWARE_ENDSTOP_Y) - max = soft_endstop_max[Y_AXIS]; - #endif - break; - case Z_AXIS: - #if ENABLED(MIN_SOFTWARE_ENDSTOP_Z) - min = soft_endstop_min[Z_AXIS]; - #endif - #if ENABLED(MAX_SOFTWARE_ENDSTOP_Z) - max = soft_endstop_max[Z_AXIS]; - #endif - default: break; - } - #endif // MIN_SOFTWARE_ENDSTOPS || MAX_SOFTWARE_ENDSTOPS - - // Delta limits XY based on the current offset from center - // This assumes the center is 0,0 - #if ENABLED(DELTA) - if (axis != Z_AXIS) { - max = SQRT(sq((float)(DELTA_PRINTABLE_RADIUS)) - sq(current_position[Y_AXIS - axis])); // (Y_AXIS - axis) == the other axis - min = -max; - } - #endif - - // Get the new position - const float diff = float((int32_t)encoderPosition) * move_menu_scale; - #if IS_KINEMATIC - manual_move_offset += diff; - if ((int32_t)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)encoderPosition < 0) - NOLESS(current_position[axis], min); - else - NOMORE(current_position[axis], max); - #endif - - manual_move_to_current(axis); - lcdDrawUpdate = LCDVIEW_REDRAW_NOW; - } - encoderPosition = 0; - if (lcdDrawUpdate) { - const float pos = NATIVE_TO_LOGICAL(processing_manual_move ? destination[axis] : current_position[axis] - #if IS_KINEMATIC - + manual_move_offset - #endif - , axis); - lcd_implementation_drawedit(name, move_menu_scale >= 0.1f ? ftostr41sign(pos) : ftostr43sign(pos)); - } - } - void lcd_move_x() { _lcd_move_xyz(PSTR(MSG_MOVE_X), X_AXIS); } - void lcd_move_y() { _lcd_move_xyz(PSTR(MSG_MOVE_Y), Y_AXIS); } - void lcd_move_z() { _lcd_move_xyz(PSTR(MSG_MOVE_Z), Z_AXIS); } - void _lcd_move_e( - #if E_MANUAL > 1 - const int8_t eindex=-1 - #endif - ) { - if (use_click()) { return lcd_goto_previous_menu_no_defer(); } - ENCODER_DIRECTION_NORMAL(); - if (encoderPosition) { - if (!processing_manual_move) { - const float diff = float((int32_t)encoderPosition) * move_menu_scale; - #if IS_KINEMATIC - manual_move_offset += diff; - #else - current_position[E_AXIS] += diff; - #endif - manual_move_to_current(E_AXIS - #if E_MANUAL > 1 - , eindex - #endif - ); - lcdDrawUpdate = LCDVIEW_REDRAW_NOW; - } - encoderPosition = 0; - } - if (lcdDrawUpdate) { - PGM_P pos_label; - #if E_MANUAL == 1 - pos_label = PSTR(MSG_MOVE_E); - #else - switch (eindex) { - default: pos_label = PSTR(MSG_MOVE_E MSG_MOVE_E1); break; - case 1: pos_label = PSTR(MSG_MOVE_E MSG_MOVE_E2); break; - #if E_MANUAL > 2 - case 2: pos_label = PSTR(MSG_MOVE_E MSG_MOVE_E3); break; - #if E_MANUAL > 3 - case 3: pos_label = PSTR(MSG_MOVE_E MSG_MOVE_E4); break; - #if E_MANUAL > 4 - case 4: pos_label = PSTR(MSG_MOVE_E MSG_MOVE_E5); break; - #if E_MANUAL > 5 - case 5: pos_label = PSTR(MSG_MOVE_E MSG_MOVE_E6); break; - #endif // E_MANUAL > 5 - #endif // E_MANUAL > 4 - #endif // E_MANUAL > 3 - #endif // E_MANUAL > 2 - } - #endif // E_MANUAL > 1 - lcd_implementation_drawedit(pos_label, ftostr41sign(current_position[E_AXIS] - #if IS_KINEMATIC - + manual_move_offset - #endif - #if ENABLED(MANUAL_E_MOVES_RELATIVE) - - manual_move_e_origin - #endif - )); - } - } - - void lcd_move_e() { _lcd_move_e(); } - #if E_MANUAL > 1 - void lcd_move_e0() { _lcd_move_e(0); } - void lcd_move_e1() { _lcd_move_e(1); } - #if E_MANUAL > 2 - void lcd_move_e2() { _lcd_move_e(2); } - #if E_MANUAL > 3 - void lcd_move_e3() { _lcd_move_e(3); } - #if E_MANUAL > 4 - void lcd_move_e4() { _lcd_move_e(4); } - #if E_MANUAL > 5 - void lcd_move_e5() { _lcd_move_e(5); } - #endif // E_MANUAL > 5 - #endif // E_MANUAL > 4 - #endif // E_MANUAL > 3 - #endif // E_MANUAL > 2 - #endif // E_MANUAL > 1 - - /** - * - * "Motion" > "Move Xmm" > "Move XYZ" submenu - * - */ - - screenFunc_t _manual_move_func_ptr; - - void _goto_manual_move(const float scale) { - defer_return_to_status = true; - move_menu_scale = scale; - lcd_goto_screen(_manual_move_func_ptr); - } - void lcd_move_menu_10mm() { _goto_manual_move(10); } - void lcd_move_menu_1mm() { _goto_manual_move( 1); } - void lcd_move_menu_01mm() { _goto_manual_move( 0.1f); } - - void _lcd_move_distance_menu(const AxisEnum axis, const screenFunc_t func) { - _manual_move_func_ptr = func; - START_MENU(); - if (LCD_HEIGHT >= 4) { - switch (axis) { - case X_AXIS: - STATIC_ITEM(MSG_MOVE_X, true, true); break; - case Y_AXIS: - STATIC_ITEM(MSG_MOVE_Y, true, true); break; - case Z_AXIS: - STATIC_ITEM(MSG_MOVE_Z, true, true); break; - default: - #if ENABLED(MANUAL_E_MOVES_RELATIVE) - manual_move_e_origin = current_position[E_AXIS]; - #endif - STATIC_ITEM(MSG_MOVE_E, true, true); - break; - } - } - MENU_BACK(MSG_MOVE_AXIS); - MENU_ITEM(submenu, MSG_MOVE_10MM, lcd_move_menu_10mm); - MENU_ITEM(submenu, MSG_MOVE_1MM, lcd_move_menu_1mm); - MENU_ITEM(submenu, MSG_MOVE_01MM, lcd_move_menu_01mm); - END_MENU(); - } - void lcd_move_get_x_amount() { _lcd_move_distance_menu(X_AXIS, lcd_move_x); } - void lcd_move_get_y_amount() { _lcd_move_distance_menu(Y_AXIS, lcd_move_y); } - void lcd_move_get_z_amount() { _lcd_move_distance_menu(Z_AXIS, lcd_move_z); } - void lcd_move_get_e_amount() { _lcd_move_distance_menu(E_AXIS, lcd_move_e); } - #if E_MANUAL > 1 - void lcd_move_get_e0_amount() { _lcd_move_distance_menu(E_AXIS, lcd_move_e0); } - void lcd_move_get_e1_amount() { _lcd_move_distance_menu(E_AXIS, lcd_move_e1); } - #if E_MANUAL > 2 - void lcd_move_get_e2_amount() { _lcd_move_distance_menu(E_AXIS, lcd_move_e2); } - #if E_MANUAL > 3 - void lcd_move_get_e3_amount() { _lcd_move_distance_menu(E_AXIS, lcd_move_e3); } - #if E_MANUAL > 4 - void lcd_move_get_e4_amount() { _lcd_move_distance_menu(E_AXIS, lcd_move_e4); } - #if E_MANUAL > 5 - void lcd_move_get_e5_amount() { _lcd_move_distance_menu(E_AXIS, lcd_move_e5); } - #endif // E_MANUAL > 5 - #endif // E_MANUAL > 4 - #endif // E_MANUAL > 3 - #endif // E_MANUAL > 2 - #endif // E_MANUAL > 1 - - /** - * - * "Motion" > "Move Axis" submenu - * - */ - - #if IS_KINEMATIC || ENABLED(NO_MOTION_BEFORE_HOMING) - #define _MOVE_XYZ_ALLOWED (all_axes_homed()) - #else - #define _MOVE_XYZ_ALLOWED true - #endif - - #if ENABLED(DELTA) - #define _MOVE_XY_ALLOWED (current_position[Z_AXIS] <= delta_clip_start_height) - void lcd_lower_z_to_clip_height() { - line_to_z(delta_clip_start_height); - lcd_synchronize(); - } - #else - #define _MOVE_XY_ALLOWED true - #endif - - void lcd_move_menu() { - START_MENU(); - MENU_BACK(MSG_MOTION); - - #if HAS_SOFTWARE_ENDSTOPS && ENABLED(SOFT_ENDSTOPS_MENU_ITEM) - MENU_ITEM_EDIT(bool, MSG_LCD_SOFT_ENDSTOPS, &soft_endstops_enabled); - #endif - - if (_MOVE_XYZ_ALLOWED) { - if (_MOVE_XY_ALLOWED) { - MENU_ITEM(submenu, MSG_MOVE_X, lcd_move_get_x_amount); - MENU_ITEM(submenu, MSG_MOVE_Y, lcd_move_get_y_amount); - } - #if ENABLED(DELTA) - else - MENU_ITEM(function, MSG_FREE_XY, lcd_lower_z_to_clip_height); - #endif - - MENU_ITEM(submenu, MSG_MOVE_Z, lcd_move_get_z_amount); - } - else - MENU_ITEM(gcode, MSG_AUTO_HOME, PSTR("G28")); - - #if ENABLED(SWITCHING_EXTRUDER) || ENABLED(SWITCHING_NOZZLE) - - #if EXTRUDERS == 6 - switch (active_extruder) { - case 0: MENU_ITEM(gcode, MSG_SELECT " " MSG_E2, PSTR("T1")); break; - case 1: MENU_ITEM(gcode, MSG_SELECT " " MSG_E1, PSTR("T0")); break; - case 2: MENU_ITEM(gcode, MSG_SELECT " " MSG_E4, PSTR("T3")); break; - case 3: MENU_ITEM(gcode, MSG_SELECT " " MSG_E3, PSTR("T2")); break; - case 4: MENU_ITEM(gcode, MSG_SELECT " " MSG_E6, PSTR("T5")); break; - case 5: MENU_ITEM(gcode, MSG_SELECT " " MSG_E5, PSTR("T4")); break; - } - #elif EXTRUDERS == 5 || EXTRUDERS == 4 - switch (active_extruder) { - case 0: MENU_ITEM(gcode, MSG_SELECT " " MSG_E2, PSTR("T1")); break; - case 1: MENU_ITEM(gcode, MSG_SELECT " " MSG_E1, PSTR("T0")); break; - case 2: MENU_ITEM(gcode, MSG_SELECT " " MSG_E4, PSTR("T3")); break; - case 3: MENU_ITEM(gcode, MSG_SELECT " " MSG_E3, PSTR("T2")); break; - } - #elif EXTRUDERS == 3 - if (active_extruder < 2) { - if (active_extruder) - MENU_ITEM(gcode, MSG_SELECT " " MSG_E1, PSTR("T0")); - else - MENU_ITEM(gcode, MSG_SELECT " " MSG_E2, PSTR("T1")); - } - #else - if (active_extruder) - MENU_ITEM(gcode, MSG_SELECT " " MSG_E1, PSTR("T0")); - else - MENU_ITEM(gcode, MSG_SELECT " " MSG_E2, PSTR("T1")); - #endif - - #elif ENABLED(DUAL_X_CARRIAGE) - - if (active_extruder) - MENU_ITEM(gcode, MSG_SELECT " " MSG_E1, PSTR("T0")); - else - MENU_ITEM(gcode, MSG_SELECT " " MSG_E2, PSTR("T1")); - - #endif - - #if ENABLED(SWITCHING_EXTRUDER) || ENABLED(SWITCHING_NOZZLE) - - // Only the current... - MENU_ITEM(submenu, MSG_MOVE_E, lcd_move_get_e_amount); - // ...and the non-switching - #if E_MANUAL == 5 - MENU_ITEM(submenu, MSG_MOVE_E MSG_MOVE_E5, lcd_move_get_e4_amount); - #elif E_MANUAL == 3 - MENU_ITEM(submenu, MSG_MOVE_E MSG_MOVE_E3, lcd_move_get_e2_amount); - #endif - - #else - - // Independent extruders with one E-stepper per hotend - MENU_ITEM(submenu, MSG_MOVE_E, lcd_move_get_e_amount); - #if E_MANUAL > 1 - MENU_ITEM(submenu, MSG_MOVE_E MSG_MOVE_E1, lcd_move_get_e0_amount); - MENU_ITEM(submenu, MSG_MOVE_E MSG_MOVE_E2, lcd_move_get_e1_amount); - #if E_MANUAL > 2 - MENU_ITEM(submenu, MSG_MOVE_E MSG_MOVE_E3, lcd_move_get_e2_amount); - #if E_MANUAL > 3 - MENU_ITEM(submenu, MSG_MOVE_E MSG_MOVE_E4, lcd_move_get_e3_amount); - #if E_MANUAL > 4 - MENU_ITEM(submenu, MSG_MOVE_E MSG_MOVE_E5, lcd_move_get_e4_amount); - #if E_MANUAL > 5 - MENU_ITEM(submenu, MSG_MOVE_E MSG_MOVE_E6, lcd_move_get_e5_amount); - #endif // E_MANUAL > 5 - #endif // E_MANUAL > 4 - #endif // E_MANUAL > 3 - #endif // E_MANUAL > 2 - #endif // E_MANUAL > 1 - - #endif - - END_MENU(); - } - - /** - * - * "Configuration" submenu - * - */ - - #if HAS_LCD_CONTRAST - void lcd_callback_set_contrast() { set_lcd_contrast(lcd_contrast); } - #endif - - static void lcd_factory_settings() { - settings.reset(); - lcd_completion_feedback(); - } - - #if ENABLED(EEPROM_SETTINGS) && DISABLED(SLIM_LCD_MENUS) - - static void lcd_init_eeprom() { - lcd_completion_feedback(settings.init_eeprom()); - lcd_goto_previous_menu(); - } - - static void lcd_init_eeprom_confirm() { - START_MENU(); - MENU_BACK(MSG_ADVANCED_SETTINGS); - MENU_ITEM(function, MSG_INIT_EEPROM, lcd_init_eeprom); - END_MENU(); - } - - #endif - - void lcd_configuration_menu() { - START_MENU(); - MENU_BACK(MSG_MAIN); - - MENU_ITEM(submenu, MSG_ADVANCED_SETTINGS, lcd_advanced_settings_menu); - - // - // Delta Calibration - // - #if ENABLED(DELTA_CALIBRATION_MENU) || ENABLED(DELTA_AUTO_CALIBRATION) - MENU_ITEM(submenu, MSG_DELTA_CALIBRATE, lcd_delta_calibrate_menu); - #endif - - #if HAS_LCD_CONTRAST - MENU_ITEM_EDIT_CALLBACK(int3, MSG_CONTRAST, &lcd_contrast, LCD_CONTRAST_MIN, LCD_CONTRAST_MAX, lcd_callback_set_contrast, true); - #endif - #if ENABLED(FWRETRACT) - MENU_ITEM(submenu, MSG_RETRACT, lcd_config_retract_menu); - #endif - #if ENABLED(DAC_STEPPER_CURRENT) - MENU_ITEM(submenu, MSG_DRIVE_STRENGTH, lcd_dac_menu); - #endif - #if HAS_MOTOR_CURRENT_PWM - MENU_ITEM(submenu, MSG_DRIVE_STRENGTH, lcd_pwm_menu); - #endif - - #if ENABLED(BLTOUCH) - MENU_ITEM(submenu, MSG_BLTOUCH, bltouch_menu); - #endif - - #if DISABLED(SLIM_LCD_MENUS) - // Preheat configurations - MENU_ITEM(submenu, MSG_PREHEAT_1_SETTINGS, lcd_configuration_temperature_preheat_material1_settings_menu); - MENU_ITEM(submenu, MSG_PREHEAT_2_SETTINGS, lcd_configuration_temperature_preheat_material2_settings_menu); - #endif - - #if ENABLED(EEPROM_SETTINGS) - MENU_ITEM(function, MSG_STORE_EEPROM, lcd_store_settings); - MENU_ITEM(function, MSG_LOAD_EEPROM, lcd_load_settings); - #endif - - MENU_ITEM(function, MSG_RESTORE_FAILSAFE, lcd_factory_settings); - - END_MENU(); - } - - /** - * - * "Temperature" submenu - * - */ - - #if ENABLED(PID_AUTOTUNE_MENU) - - #if ENABLED(PIDTEMP) - int16_t autotune_temp[HOTENDS] = ARRAY_BY_HOTENDS1(150); - #endif - - #if ENABLED(PIDTEMPBED) - int16_t autotune_temp_bed = 70; - #endif - - void _lcd_autotune(int16_t e) { - char cmd[30]; - sprintf_P(cmd, PSTR("M303 U1 E%i S%i"), e, - #if HAS_PID_FOR_BOTH - e < 0 ? autotune_temp_bed : autotune_temp[e] - #elif ENABLED(PIDTEMPBED) - autotune_temp_bed - #else - autotune_temp[e] - #endif - ); - lcd_enqueue_command(cmd); - } - - #endif // PID_AUTOTUNE_MENU - - #if ENABLED(PIDTEMP) - - // Helpers for editing PID Ki & Kd values - // grab the PID value out of the temp variable; scale it; then update the PID driver - void copy_and_scalePID_i(int16_t e) { - #if DISABLED(PID_PARAMS_PER_HOTEND) || HOTENDS == 1 - UNUSED(e); - #endif - PID_PARAM(Ki, e) = scalePID_i(raw_Ki); - thermalManager.updatePID(); - } - void copy_and_scalePID_d(int16_t e) { - #if DISABLED(PID_PARAMS_PER_HOTEND) || HOTENDS == 1 - UNUSED(e); - #endif - PID_PARAM(Kd, e) = scalePID_d(raw_Kd); - thermalManager.updatePID(); - } - #define _DEFINE_PIDTEMP_BASE_FUNCS(N) \ - void copy_and_scalePID_i_E ## N() { copy_and_scalePID_i(N); } \ - void copy_and_scalePID_d_E ## N() { copy_and_scalePID_d(N); } - - #if ENABLED(PID_AUTOTUNE_MENU) - #define DEFINE_PIDTEMP_FUNCS(N) \ - _DEFINE_PIDTEMP_BASE_FUNCS(N); \ - void lcd_autotune_callback_E ## N() { _lcd_autotune(N); } typedef void _pid_##N##_void - #else - #define DEFINE_PIDTEMP_FUNCS(N) _DEFINE_PIDTEMP_BASE_FUNCS(N) typedef void _pid_##N##_void - #endif - - DEFINE_PIDTEMP_FUNCS(0); - #if ENABLED(PID_PARAMS_PER_HOTEND) - #if HOTENDS > 1 - DEFINE_PIDTEMP_FUNCS(1); - #if HOTENDS > 2 - DEFINE_PIDTEMP_FUNCS(2); - #if HOTENDS > 3 - DEFINE_PIDTEMP_FUNCS(3); - #if HOTENDS > 4 - DEFINE_PIDTEMP_FUNCS(4); - #if HOTENDS > 5 - DEFINE_PIDTEMP_FUNCS(5); - #endif // HOTENDS > 5 - #endif // HOTENDS > 4 - #endif // HOTENDS > 3 - #endif // HOTENDS > 2 - #endif // HOTENDS > 1 - #endif // PID_PARAMS_PER_HOTEND - - #endif // PIDTEMP - - /** - * - * "Temperature" submenu - * - */ - void lcd_temperature_menu() { - START_MENU(); - MENU_BACK(MSG_MAIN); - - // - // Nozzle: - // Nozzle [1-5]: - // - #if HOTENDS == 1 - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE, &thermalManager.target_temperature[0], 0, HEATER_0_MAXTEMP - 15, watch_temp_callback_E0); - #else // HOTENDS > 1 - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N1, &thermalManager.target_temperature[0], 0, HEATER_0_MAXTEMP - 15, watch_temp_callback_E0); - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N2, &thermalManager.target_temperature[1], 0, HEATER_1_MAXTEMP - 15, watch_temp_callback_E1); - #if HOTENDS > 2 - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N3, &thermalManager.target_temperature[2], 0, HEATER_2_MAXTEMP - 15, watch_temp_callback_E2); - #if HOTENDS > 3 - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N4, &thermalManager.target_temperature[3], 0, HEATER_3_MAXTEMP - 15, watch_temp_callback_E3); - #if HOTENDS > 4 - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N5, &thermalManager.target_temperature[4], 0, HEATER_4_MAXTEMP - 15, watch_temp_callback_E4); - #if HOTENDS > 5 - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_N6, &thermalManager.target_temperature[5], 0, HEATER_5_MAXTEMP - 15, watch_temp_callback_E5); - #endif // HOTENDS > 5 - #endif // HOTENDS > 4 - #endif // HOTENDS > 3 - #endif // HOTENDS > 2 - #endif // HOTENDS > 1 - - // - // Bed: - // - #if HAS_HEATED_BED - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_BED, &thermalManager.target_temperature_bed, 0, BED_MAXTEMP - 15, watch_temp_callback_bed); - #endif - - // - // Fan Speed: - // - #if FAN_COUNT > 0 - #if HAS_FAN0 - MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_FAN_SPEED FAN_SPEED_1_SUFFIX, &fanSpeeds[0], 0, 255); - #if ENABLED(EXTRA_FAN_SPEED) - MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_EXTRA_FAN_SPEED FAN_SPEED_1_SUFFIX, &new_fanSpeeds[0], 3, 255); - #endif - #endif - #if HAS_FAN1 - MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_FAN_SPEED " 2", &fanSpeeds[1], 0, 255); - #if ENABLED(EXTRA_FAN_SPEED) - MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_EXTRA_FAN_SPEED " 2", &new_fanSpeeds[1], 3, 255); - #endif - #endif - #if HAS_FAN2 - MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_FAN_SPEED " 3", &fanSpeeds[2], 0, 255); - #if ENABLED(EXTRA_FAN_SPEED) - MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_EXTRA_FAN_SPEED " 3", &new_fanSpeeds[2], 3, 255); - #endif - #endif - #endif // FAN_COUNT > 0 - - #if HAS_TEMP_HOTEND - - // - // Cooldown - // - bool has_heat = false; - HOTEND_LOOP() if (thermalManager.target_temperature[HOTEND_INDEX]) { has_heat = true; break; } - #if HAS_TEMP_BED - if (thermalManager.target_temperature_bed) has_heat = true; - #endif - if (has_heat) MENU_ITEM(function, MSG_COOLDOWN, lcd_cooldown); - - // - // Preheat for Material 1 and 2 - // - #if TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 || TEMP_SENSOR_4 != 0 || HAS_HEATED_BED - MENU_ITEM(submenu, MSG_PREHEAT_1, lcd_preheat_m1_menu); - MENU_ITEM(submenu, MSG_PREHEAT_2, lcd_preheat_m2_menu); - #else - MENU_ITEM(function, MSG_PREHEAT_1, lcd_preheat_m1_e0_only); - MENU_ITEM(function, MSG_PREHEAT_2, lcd_preheat_m2_e0_only); - #endif - - #endif // HAS_TEMP_HOTEND - - END_MENU(); - } - - /** - * - * "Advanced Settings" -> "Temperature" submenu - * - */ - void lcd_advanced_temperature_menu() { - START_MENU(); - MENU_BACK(MSG_ADVANCED_SETTINGS); - // - // Autotemp, Min, Max, Fact - // - #if ENABLED(AUTOTEMP) && HAS_TEMP_HOTEND - MENU_ITEM_EDIT(bool, MSG_AUTOTEMP, &planner.autotemp_enabled); - MENU_ITEM_EDIT(float3, MSG_MIN, &planner.autotemp_min, 0, float(HEATER_0_MAXTEMP) - 15); - MENU_ITEM_EDIT(float3, MSG_MAX, &planner.autotemp_max, 0, float(HEATER_0_MAXTEMP) - 15); - MENU_ITEM_EDIT(float52, MSG_FACTOR, &planner.autotemp_factor, 0, 1); - #endif - - // - // PID-P, PID-I, PID-D, PID-C, PID Autotune - // PID-P E1, PID-I E1, PID-D E1, PID-C E1, PID Autotune E1 - // PID-P E2, PID-I E2, PID-D E2, PID-C E2, PID Autotune E2 - // PID-P E3, PID-I E3, PID-D E3, PID-C E3, PID Autotune E3 - // PID-P E4, PID-I E4, PID-D E4, PID-C E4, PID Autotune E4 - // PID-P E5, PID-I E5, PID-D E5, PID-C E5, PID Autotune E5 - // - #if ENABLED(PIDTEMP) - - #define _PID_BASE_MENU_ITEMS(ELABEL, eindex) \ - raw_Ki = unscalePID_i(PID_PARAM(Ki, eindex)); \ - raw_Kd = unscalePID_d(PID_PARAM(Kd, eindex)); \ - MENU_ITEM_EDIT(float52sign, MSG_PID_P ELABEL, &PID_PARAM(Kp, eindex), 1, 9990); \ - MENU_ITEM_EDIT_CALLBACK(float52sign, MSG_PID_I ELABEL, &raw_Ki, 0.01f, 9990, copy_and_scalePID_i_E ## eindex); \ - MENU_ITEM_EDIT_CALLBACK(float52sign, MSG_PID_D ELABEL, &raw_Kd, 1, 9990, copy_and_scalePID_d_E ## eindex) - - #if ENABLED(PID_EXTRUSION_SCALING) - #define _PID_MENU_ITEMS(ELABEL, eindex) \ - _PID_BASE_MENU_ITEMS(ELABEL, eindex); \ - MENU_ITEM_EDIT(float3, MSG_PID_C ELABEL, &PID_PARAM(Kc, eindex), 1, 9990) - #else - #define _PID_MENU_ITEMS(ELABEL, eindex) _PID_BASE_MENU_ITEMS(ELABEL, eindex) - #endif - - #if ENABLED(PID_AUTOTUNE_MENU) - #define PID_MENU_ITEMS(ELABEL, eindex) \ - _PID_MENU_ITEMS(ELABEL, eindex); \ - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_PID_AUTOTUNE ELABEL, &autotune_temp[eindex], 150, heater_maxtemp[eindex] - 15, lcd_autotune_callback_E ## eindex) - #else - #define PID_MENU_ITEMS(ELABEL, eindex) _PID_MENU_ITEMS(ELABEL, eindex) - #endif - - #if ENABLED(PID_PARAMS_PER_HOTEND) && HOTENDS > 1 - PID_MENU_ITEMS(" " MSG_E1, 0); - PID_MENU_ITEMS(" " MSG_E2, 1); - #if HOTENDS > 2 - PID_MENU_ITEMS(" " MSG_E3, 2); - #if HOTENDS > 3 - PID_MENU_ITEMS(" " MSG_E4, 3); - #if HOTENDS > 4 - PID_MENU_ITEMS(" " MSG_E5, 4); - #if HOTENDS > 5 - PID_MENU_ITEMS(" " MSG_E6, 5); - #endif // HOTENDS > 5 - #endif // HOTENDS > 4 - #endif // HOTENDS > 3 - #endif // HOTENDS > 2 - #else // !PID_PARAMS_PER_HOTEND || HOTENDS == 1 - PID_MENU_ITEMS("", 0); - #endif // !PID_PARAMS_PER_HOTEND || HOTENDS == 1 - - #endif // PIDTEMP - - END_MENU(); - } - - #if DISABLED(SLIM_LCD_MENUS) - - void _lcd_configuration_temperature_preheat_settings_menu(const uint8_t material) { - #if HOTENDS > 5 - #define MINTEMP_ALL MIN5(HEATER_0_MINTEMP, HEATER_1_MINTEMP, HEATER_2_MINTEMP, HEATER_3_MINTEMP, HEATER_4_MINTEMP, HEATER_5_MINTEMP) - #define MAXTEMP_ALL MAX5(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP, HEATER_4_MAXTEMP, HEATER_5_MAXTEMP) - #elif HOTENDS > 4 - #define MINTEMP_ALL MIN5(HEATER_0_MINTEMP, HEATER_1_MINTEMP, HEATER_2_MINTEMP, HEATER_3_MINTEMP, HEATER_4_MINTEMP) - #define MAXTEMP_ALL MAX5(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP, HEATER_4_MAXTEMP) - #elif HOTENDS > 3 - #define MINTEMP_ALL MIN4(HEATER_0_MINTEMP, HEATER_1_MINTEMP, HEATER_2_MINTEMP, HEATER_3_MINTEMP) - #define MAXTEMP_ALL MAX4(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP) - #elif HOTENDS > 2 - #define MINTEMP_ALL MIN3(HEATER_0_MINTEMP, HEATER_1_MINTEMP, HEATER_2_MINTEMP) - #define MAXTEMP_ALL MAX3(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP) - #elif HOTENDS > 1 - #define MINTEMP_ALL MIN(HEATER_0_MINTEMP, HEATER_1_MINTEMP) - #define MAXTEMP_ALL MAX(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP) - #else - #define MINTEMP_ALL HEATER_0_MINTEMP - #define MAXTEMP_ALL HEATER_0_MAXTEMP - #endif - START_MENU(); - MENU_BACK(MSG_CONFIGURATION); - MENU_ITEM_EDIT(int3, MSG_FAN_SPEED, &lcd_preheat_fan_speed[material], 0, 255); - #if HAS_TEMP_HOTEND - MENU_ITEM_EDIT(int3, MSG_NOZZLE, &lcd_preheat_hotend_temp[material], MINTEMP_ALL, MAXTEMP_ALL - 15); - #endif - #if HAS_HEATED_BED - MENU_ITEM_EDIT(int3, MSG_BED, &lcd_preheat_bed_temp[material], BED_MINTEMP, BED_MAXTEMP - 15); - #endif - #if ENABLED(EEPROM_SETTINGS) - MENU_ITEM(function, MSG_STORE_EEPROM, lcd_store_settings); - #endif - END_MENU(); - } - - /** - * - * "Temperature" > "Preheat Material 1 conf" submenu - * - */ - void lcd_configuration_temperature_preheat_material1_settings_menu() { _lcd_configuration_temperature_preheat_settings_menu(0); } - - /** - * - * "Temperature" > "Preheat Material 2 conf" submenu - * - */ - void lcd_configuration_temperature_preheat_material2_settings_menu() { _lcd_configuration_temperature_preheat_settings_menu(1); } - - void _reset_acceleration_rates() { planner.reset_acceleration_rates(); } - #if ENABLED(DISTINCT_E_FACTORS) - void _reset_e_acceleration_rate(const uint8_t e) { if (e == active_extruder) _reset_acceleration_rates(); } - void _reset_e0_acceleration_rate() { _reset_e_acceleration_rate(0); } - void _reset_e1_acceleration_rate() { _reset_e_acceleration_rate(1); } - #if E_STEPPERS > 2 - void _reset_e2_acceleration_rate() { _reset_e_acceleration_rate(2); } - #if E_STEPPERS > 3 - void _reset_e3_acceleration_rate() { _reset_e_acceleration_rate(3); } - #if E_STEPPERS > 4 - void _reset_e4_acceleration_rate() { _reset_e_acceleration_rate(4); } - #if E_STEPPERS > 5 - void _reset_e5_acceleration_rate() { _reset_e_acceleration_rate(5); } - #endif // E_STEPPERS > 5 - #endif // E_STEPPERS > 4 - #endif // E_STEPPERS > 3 - #endif // E_STEPPERS > 2 - #endif - - void _planner_refresh_positioning() { planner.refresh_positioning(); } - #if ENABLED(DISTINCT_E_FACTORS) - void _planner_refresh_e_positioning(const uint8_t e) { - if (e == active_extruder) - _planner_refresh_positioning(); - else - planner.steps_to_mm[E_AXIS + e] = 1.0f / planner.axis_steps_per_mm[E_AXIS + e]; - } - void _planner_refresh_e0_positioning() { _planner_refresh_e_positioning(0); } - void _planner_refresh_e1_positioning() { _planner_refresh_e_positioning(1); } - #if E_STEPPERS > 2 - void _planner_refresh_e2_positioning() { _planner_refresh_e_positioning(2); } - #if E_STEPPERS > 3 - void _planner_refresh_e3_positioning() { _planner_refresh_e_positioning(3); } - #if E_STEPPERS > 4 - void _planner_refresh_e4_positioning() { _planner_refresh_e_positioning(4); } - #if E_STEPPERS > 5 - void _planner_refresh_e5_positioning() { _planner_refresh_e_positioning(5); } - #endif // E_STEPPERS > 5 - #endif // E_STEPPERS > 4 - #endif // E_STEPPERS > 3 - #endif // E_STEPPERS > 2 - #endif - - // M203 / M205 Velocity options - void lcd_advanced_velocity_menu() { - START_MENU(); - MENU_BACK(MSG_ADVANCED_SETTINGS); - - // M203 Max Feedrate - MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_VMAX MSG_A, &planner.max_feedrate_mm_s[A_AXIS], 1, 999); - MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_VMAX MSG_B, &planner.max_feedrate_mm_s[B_AXIS], 1, 999); - MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_VMAX MSG_C, &planner.max_feedrate_mm_s[C_AXIS], 1, 999); - - #if ENABLED(DISTINCT_E_FACTORS) - MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_VMAX MSG_E, &planner.max_feedrate_mm_s[E_AXIS + active_extruder], 1, 999); - MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_VMAX MSG_E1, &planner.max_feedrate_mm_s[E_AXIS], 1, 999); - MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_VMAX MSG_E2, &planner.max_feedrate_mm_s[E_AXIS + 1], 1, 999); - #if E_STEPPERS > 2 - MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_VMAX MSG_E3, &planner.max_feedrate_mm_s[E_AXIS + 2], 1, 999); - #if E_STEPPERS > 3 - MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_VMAX MSG_E4, &planner.max_feedrate_mm_s[E_AXIS + 3], 1, 999); - #if E_STEPPERS > 4 - MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_VMAX MSG_E5, &planner.max_feedrate_mm_s[E_AXIS + 4], 1, 999); - #if E_STEPPERS > 5 - MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_VMAX MSG_E6, &planner.max_feedrate_mm_s[E_AXIS + 5], 1, 999); - #endif // E_STEPPERS > 5 - #endif // E_STEPPERS > 4 - #endif // E_STEPPERS > 3 - #endif // E_STEPPERS > 2 - #else - MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_VMAX MSG_E, &planner.max_feedrate_mm_s[E_AXIS], 1, 999); - #endif - - // M205 S Min Feedrate - MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_VMIN, &planner.min_feedrate_mm_s, 0, 999); - - // M205 T Min Travel Feedrate - MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_VTRAV_MIN, &planner.min_travel_feedrate_mm_s, 0, 999); - - END_MENU(); - } - - // M201 / M204 Accelerations - void lcd_advanced_acceleration_menu() { - START_MENU(); - MENU_BACK(MSG_ADVANCED_SETTINGS); - - // M204 P Acceleration - MENU_MULTIPLIER_ITEM_EDIT(float5, MSG_ACC, &planner.acceleration, 10, 99000); - - // M204 R Retract Acceleration - MENU_MULTIPLIER_ITEM_EDIT(float5, MSG_A_RETRACT, &planner.retract_acceleration, 100, 99000); - - // M204 T Travel Acceleration - MENU_MULTIPLIER_ITEM_EDIT(float5, MSG_A_TRAVEL, &planner.travel_acceleration, 100, 99000); - - // M201 settings - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_A, &planner.max_acceleration_mm_per_s2[A_AXIS], 100, 99000, _reset_acceleration_rates); - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_B, &planner.max_acceleration_mm_per_s2[B_AXIS], 100, 99000, _reset_acceleration_rates); - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_C, &planner.max_acceleration_mm_per_s2[C_AXIS], 10, 99000, _reset_acceleration_rates); - - #if ENABLED(DISTINCT_E_FACTORS) - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_E, &planner.max_acceleration_mm_per_s2[E_AXIS + active_extruder], 100, 99000, _reset_acceleration_rates); - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_E1, &planner.max_acceleration_mm_per_s2[E_AXIS], 100, 99000, _reset_e0_acceleration_rate); - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_E2, &planner.max_acceleration_mm_per_s2[E_AXIS + 1], 100, 99000, _reset_e1_acceleration_rate); - #if E_STEPPERS > 2 - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_E3, &planner.max_acceleration_mm_per_s2[E_AXIS + 2], 100, 99000, _reset_e2_acceleration_rate); - #if E_STEPPERS > 3 - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_E4, &planner.max_acceleration_mm_per_s2[E_AXIS + 3], 100, 99000, _reset_e3_acceleration_rate); - #if E_STEPPERS > 4 - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_E5, &planner.max_acceleration_mm_per_s2[E_AXIS + 4], 100, 99000, _reset_e4_acceleration_rate); - #if E_STEPPERS > 5 - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_E6, &planner.max_acceleration_mm_per_s2[E_AXIS + 5], 100, 99000, _reset_e5_acceleration_rate); - #endif // E_STEPPERS > 5 - #endif // E_STEPPERS > 4 - #endif // E_STEPPERS > 3 - #endif // E_STEPPERS > 2 - #else - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_E, &planner.max_acceleration_mm_per_s2[E_AXIS], 100, 99000, _reset_acceleration_rates); - #endif - - END_MENU(); - } - - // M205 Jerk - void lcd_advanced_jerk_menu() { - START_MENU(); - MENU_BACK(MSG_ADVANCED_SETTINGS); - - #if ENABLED(JUNCTION_DEVIATION) - #if ENABLED(LIN_ADVANCE) - MENU_ITEM_EDIT_CALLBACK(float43, MSG_JUNCTION_DEVIATION, &planner.junction_deviation_mm, 0.01f, 0.3f, planner.recalculate_max_e_jerk); - #else - MENU_ITEM_EDIT(float43, MSG_JUNCTION_DEVIATION, &planner.junction_deviation_mm, 0.01f, 0.3f); - #endif - #endif - #if HAS_CLASSIC_JERK - MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_VA_JERK, &planner.max_jerk[A_AXIS], 1, 990); - MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_VB_JERK, &planner.max_jerk[B_AXIS], 1, 990); - #if ENABLED(DELTA) - MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_VC_JERK, &planner.max_jerk[C_AXIS], 1, 990); - #else - MENU_MULTIPLIER_ITEM_EDIT(float52sign, MSG_VC_JERK, &planner.max_jerk[C_AXIS], 0.1f, 990); - #endif - #if DISABLED(JUNCTION_DEVIATION) || DISABLED(LIN_ADVANCE) - MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_VE_JERK, &planner.max_jerk[E_AXIS], 1, 990); - #endif - #endif - - END_MENU(); - } - - // M92 Steps-per-mm - void lcd_advanced_steps_per_mm_menu() { - START_MENU(); - MENU_BACK(MSG_ADVANCED_SETTINGS); - - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float62, MSG_ASTEPS, &planner.axis_steps_per_mm[A_AXIS], 5, 9999, _planner_refresh_positioning); - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float62, MSG_BSTEPS, &planner.axis_steps_per_mm[B_AXIS], 5, 9999, _planner_refresh_positioning); - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float62, MSG_CSTEPS, &planner.axis_steps_per_mm[C_AXIS], 5, 9999, _planner_refresh_positioning); - - #if ENABLED(DISTINCT_E_FACTORS) - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float62, MSG_ESTEPS, &planner.axis_steps_per_mm[E_AXIS + active_extruder], 5, 9999, _planner_refresh_positioning); - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float62, MSG_E1STEPS, &planner.axis_steps_per_mm[E_AXIS], 5, 9999, _planner_refresh_e0_positioning); - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float62, MSG_E2STEPS, &planner.axis_steps_per_mm[E_AXIS + 1], 5, 9999, _planner_refresh_e1_positioning); - #if E_STEPPERS > 2 - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float62, MSG_E3STEPS, &planner.axis_steps_per_mm[E_AXIS + 2], 5, 9999, _planner_refresh_e2_positioning); - #if E_STEPPERS > 3 - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float62, MSG_E4STEPS, &planner.axis_steps_per_mm[E_AXIS + 3], 5, 9999, _planner_refresh_e3_positioning); - #if E_STEPPERS > 4 - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float62, MSG_E5STEPS, &planner.axis_steps_per_mm[E_AXIS + 4], 5, 9999, _planner_refresh_e4_positioning); - #if E_STEPPERS > 5 - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float62, MSG_E6STEPS, &planner.axis_steps_per_mm[E_AXIS + 5], 5, 9999, _planner_refresh_e5_positioning); - #endif // E_STEPPERS > 5 - #endif // E_STEPPERS > 4 - #endif // E_STEPPERS > 3 - #endif // E_STEPPERS > 2 - #else - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float62, MSG_ESTEPS, &planner.axis_steps_per_mm[E_AXIS], 5, 9999, _planner_refresh_positioning); - #endif - - END_MENU(); - } - - #endif // !SLIM_LCD_MENUS - - /** - * - * "Advanced Settings" submenu - * - */ - - #if HAS_M206_COMMAND - /** - * Set the home offset based on the current_position - */ - void lcd_set_home_offsets() { - // M428 Command - enqueue_and_echo_commands_P(PSTR("M428")); - lcd_return_to_status(); - } - #endif - - void lcd_advanced_settings_menu() { - START_MENU(); - MENU_BACK(MSG_CONFIGURATION); - - #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - MENU_ITEM(submenu, MSG_ZPROBE_ZOFFSET, lcd_babystep_zoffset); - #elif HAS_BED_PROBE - MENU_ITEM_EDIT(float52, MSG_ZPROBE_ZOFFSET, &zprobe_zoffset, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX); - #endif - - #if DISABLED(SLIM_LCD_MENUS) - - #if HAS_M206_COMMAND - // - // Set Home Offsets - // - MENU_ITEM(function, MSG_SET_HOME_OFFSETS, lcd_set_home_offsets); - #endif - - // M203 / M205 - Feedrate items - MENU_ITEM(submenu, MSG_VELOCITY, lcd_advanced_velocity_menu); - - // M201 - Acceleration items - MENU_ITEM(submenu, MSG_ACCELERATION, lcd_advanced_acceleration_menu); - - // M205 - Max Jerk - MENU_ITEM(submenu, MSG_JERK, lcd_advanced_jerk_menu); - - // M92 - Steps Per mm - MENU_ITEM(submenu, MSG_STEPS_PER_MM, lcd_advanced_steps_per_mm_menu); - - #endif // !SLIM_LCD_MENUS - - MENU_ITEM(submenu, MSG_TEMPERATURE, lcd_advanced_temperature_menu); - - #if DISABLED(NO_VOLUMETRICS) || ENABLED(ADVANCED_PAUSE_FEATURE) - MENU_ITEM(submenu, MSG_FILAMENT, lcd_advanced_filament_menu); - #elif ENABLED(LIN_ADVANCE) - #if EXTRUDERS == 1 - MENU_ITEM_EDIT(float52, MSG_ADVANCE_K, &planner.extruder_advance_K[0], 0, 999); - #elif EXTRUDERS > 1 - MENU_ITEM_EDIT(float52, MSG_ADVANCE_K MSG_E1, &planner.extruder_advance_K[0], 0, 999); - MENU_ITEM_EDIT(float52, MSG_ADVANCE_K MSG_E2, &planner.extruder_advance_K[1], 0, 999); - #if EXTRUDERS > 2 - MENU_ITEM_EDIT(float52, MSG_ADVANCE_K MSG_E3, &planner.extruder_advance_K[2], 0, 999); - #if EXTRUDERS > 3 - MENU_ITEM_EDIT(float52, MSG_ADVANCE_K MSG_E4, &planner.extruder_advance_K[3], 0, 999); - #if EXTRUDERS > 4 - MENU_ITEM_EDIT(float52, MSG_ADVANCE_K MSG_E5, &planner.extruder_advance_K[4], 0, 999); - #if EXTRUDERS > 5 - MENU_ITEM_EDIT(float52, MSG_ADVANCE_K MSG_E6, &planner.extruder_advance_K[5], 0, 999); - #endif // EXTRUDERS > 5 - #endif // EXTRUDERS > 4 - #endif // EXTRUDERS > 3 - #endif // EXTRUDERS > 2 - #endif // EXTRUDERS > 1 - #endif - - // M540 S - Abort on endstop hit when SD printing - #if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED) - MENU_ITEM_EDIT(bool, MSG_ENDSTOP_ABORT, &planner.abort_on_endstop_hit); - #endif - - // - // BLTouch Self-Test and Reset - // - #if ENABLED(BLTOUCH) - MENU_ITEM(gcode, MSG_BLTOUCH_SELFTEST, PSTR("M280 P" STRINGIFY(Z_PROBE_SERVO_NR) " S" STRINGIFY(BLTOUCH_SELFTEST))); - if (!endstops.z_probe_enabled && TEST_BLTOUCH()) - MENU_ITEM(gcode, MSG_BLTOUCH_RESET, PSTR("M280 P" STRINGIFY(Z_PROBE_SERVO_NR) " S" STRINGIFY(BLTOUCH_RESET))); - #endif - - #if ENABLED(EEPROM_SETTINGS) && DISABLED(SLIM_LCD_MENUS) - MENU_ITEM(submenu, MSG_INIT_EEPROM, lcd_init_eeprom_confirm); - #endif - - END_MENU(); - } - - #if DISABLED(NO_VOLUMETRICS) || ENABLED(ADVANCED_PAUSE_FEATURE) - /** - * - * "Advanced Settings" > "Filament" submenu - * - */ - void lcd_advanced_filament_menu() { - START_MENU(); - MENU_BACK(MSG_ADVANCED_SETTINGS); - - #if ENABLED(LIN_ADVANCE) - #if EXTRUDERS == 1 - MENU_ITEM_EDIT(float52, MSG_ADVANCE_K, &planner.extruder_advance_K[0], 0, 999); - #elif EXTRUDERS > 1 - MENU_ITEM_EDIT(float52, MSG_ADVANCE_K MSG_E1, &planner.extruder_advance_K[0], 0, 999); - MENU_ITEM_EDIT(float52, MSG_ADVANCE_K MSG_E2, &planner.extruder_advance_K[1], 0, 999); - #if EXTRUDERS > 2 - MENU_ITEM_EDIT(float52, MSG_ADVANCE_K MSG_E3, &planner.extruder_advance_K[2], 0, 999); - #if EXTRUDERS > 3 - MENU_ITEM_EDIT(float52, MSG_ADVANCE_K MSG_E4, &planner.extruder_advance_K[3], 0, 999); - #if EXTRUDERS > 4 - MENU_ITEM_EDIT(float52, MSG_ADVANCE_K MSG_E5, &planner.extruder_advance_K[4], 0, 999); - #if EXTRUDERS > 5 - MENU_ITEM_EDIT(float52, MSG_ADVANCE_K MSG_E6, &planner.extruder_advance_K[5], 0, 999); - #endif // EXTRUDERS > 5 - #endif // EXTRUDERS > 4 - #endif // EXTRUDERS > 3 - #endif // EXTRUDERS > 2 - #endif // EXTRUDERS > 1 - #endif - - #if DISABLED(NO_VOLUMETRICS) - MENU_ITEM_EDIT_CALLBACK(bool, MSG_VOLUMETRIC_ENABLED, &parser.volumetric_enabled, planner.calculate_volumetric_multipliers); - - if (parser.volumetric_enabled) { - #if EXTRUDERS == 1 - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_DIAM, &planner.filament_size[0], 1.5f, 3.25f, planner.calculate_volumetric_multipliers); - #else // EXTRUDERS > 1 - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_DIAM, &planner.filament_size[active_extruder], 1.5f, 3.25f, planner.calculate_volumetric_multipliers); - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_DIAM MSG_DIAM_E1, &planner.filament_size[0], 1.5f, 3.25f, planner.calculate_volumetric_multipliers); - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_DIAM MSG_DIAM_E2, &planner.filament_size[1], 1.5f, 3.25f, planner.calculate_volumetric_multipliers); - #if EXTRUDERS > 2 - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_DIAM MSG_DIAM_E3, &planner.filament_size[2], 1.5f, 3.25f, planner.calculate_volumetric_multipliers); - #if EXTRUDERS > 3 - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_DIAM MSG_DIAM_E4, &planner.filament_size[3], 1.5f, 3.25f, planner.calculate_volumetric_multipliers); - #if EXTRUDERS > 4 - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_DIAM MSG_DIAM_E5, &planner.filament_size[4], 1.5f, 3.25f, planner.calculate_volumetric_multipliers); - #if EXTRUDERS > 5 - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_DIAM MSG_DIAM_E6, &planner.filament_size[5], 1.5f, 3.25f, planner.calculate_volumetric_multipliers); - #endif // EXTRUDERS > 5 - #endif // EXTRUDERS > 4 - #endif // EXTRUDERS > 3 - #endif // EXTRUDERS > 2 - #endif // EXTRUDERS > 1 - } - #endif - - #if ENABLED(ADVANCED_PAUSE_FEATURE) - const float extrude_maxlength = - #if ENABLED(PREVENT_LENGTHY_EXTRUDE) - EXTRUDE_MAXLENGTH - #else - 999 - #endif - ; - - #if EXTRUDERS == 1 - MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_FILAMENT_UNLOAD, &filament_change_unload_length[0], 0, extrude_maxlength); - #else // EXTRUDERS > 1 - MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_FILAMENT_UNLOAD, &filament_change_unload_length[active_extruder], 0, extrude_maxlength); - MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_FILAMENT_UNLOAD MSG_DIAM_E1, &filament_change_unload_length[0], 0, extrude_maxlength); - MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_FILAMENT_UNLOAD MSG_DIAM_E2, &filament_change_unload_length[1], 0, extrude_maxlength); - #if EXTRUDERS > 2 - MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_FILAMENT_UNLOAD MSG_DIAM_E3, &filament_change_unload_length[2], 0, extrude_maxlength); - #if EXTRUDERS > 3 - MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_FILAMENT_UNLOAD MSG_DIAM_E4, &filament_change_unload_length[3], 0, extrude_maxlength); - #if EXTRUDERS > 4 - MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_FILAMENT_UNLOAD MSG_DIAM_E5, &filament_change_unload_length[4], 0, extrude_maxlength); - #if EXTRUDERS > 5 - MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_FILAMENT_UNLOAD MSG_DIAM_E6, &filament_change_unload_length[5], 0, extrude_maxlength); - #endif // EXTRUDERS > 5 - #endif // EXTRUDERS > 4 - #endif // EXTRUDERS > 3 - #endif // EXTRUDERS > 2 - #endif // EXTRUDERS > 1 - - #if EXTRUDERS == 1 - MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_FILAMENT_LOAD, &filament_change_load_length[0], 0, extrude_maxlength); - #else // EXTRUDERS > 1 - MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_FILAMENT_LOAD, &filament_change_load_length[active_extruder], 0, extrude_maxlength); - MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_FILAMENT_LOAD MSG_DIAM_E1, &filament_change_load_length[0], 0, extrude_maxlength); - MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_FILAMENT_LOAD MSG_DIAM_E2, &filament_change_load_length[1], 0, extrude_maxlength); - #if EXTRUDERS > 2 - MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_FILAMENT_LOAD MSG_DIAM_E3, &filament_change_load_length[2], 0, extrude_maxlength); - #if EXTRUDERS > 3 - MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_FILAMENT_LOAD MSG_DIAM_E4, &filament_change_load_length[3], 0, extrude_maxlength); - #if EXTRUDERS > 4 - MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_FILAMENT_LOAD MSG_DIAM_E5, &filament_change_load_length[4], 0, extrude_maxlength); - #if EXTRUDERS > 5 - MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_FILAMENT_LOAD MSG_DIAM_E6, &filament_change_load_length[5], 0, extrude_maxlength); - #endif // EXTRUDERS > 5 - #endif // EXTRUDERS > 4 - #endif // EXTRUDERS > 3 - #endif // EXTRUDERS > 2 - #endif // EXTRUDERS > 1 - #endif - - END_MENU(); - } - #endif // !NO_VOLUMETRICS || ADVANCED_PAUSE_FEATURE - - /** - * - * "Configuration" > "Retract" submenu - * - */ - #if ENABLED(FWRETRACT) - - void lcd_config_retract_menu() { - START_MENU(); - MENU_BACK(MSG_CONTROL); - #if ENABLED(FWRETRACT_AUTORETRACT) - MENU_ITEM_EDIT_CALLBACK(bool, MSG_AUTORETRACT, &fwretract.autoretract_enabled, fwretract.refresh_autoretract); - #endif - MENU_ITEM_EDIT(float52sign, MSG_CONTROL_RETRACT, &fwretract.retract_length, 0, 100); - #if EXTRUDERS > 1 - MENU_ITEM_EDIT(float52sign, MSG_CONTROL_RETRACT_SWAP, &fwretract.swap_retract_length, 0, 100); - #endif - MENU_ITEM_EDIT(float3, MSG_CONTROL_RETRACTF, &fwretract.retract_feedrate_mm_s, 1, 999); - MENU_ITEM_EDIT(float52sign, MSG_CONTROL_RETRACT_ZLIFT, &fwretract.retract_zlift, 0, 999); - MENU_ITEM_EDIT(float52sign, MSG_CONTROL_RETRACT_RECOVER, &fwretract.retract_recover_length, -100, 100); - #if EXTRUDERS > 1 - MENU_ITEM_EDIT(float52sign, MSG_CONTROL_RETRACT_RECOVER_SWAP, &fwretract.swap_retract_recover_length, -100, 100); - #endif - MENU_ITEM_EDIT(float3, MSG_CONTROL_RETRACT_RECOVERF, &fwretract.retract_recover_feedrate_mm_s, 1, 999); - #if EXTRUDERS > 1 - MENU_ITEM_EDIT(float3, MSG_CONTROL_RETRACT_RECOVER_SWAPF, &fwretract.swap_retract_recover_feedrate_mm_s, 1, 999); - #endif - END_MENU(); - } - - #endif // FWRETRACT - - #if ENABLED(SDSUPPORT) - - #if !PIN_EXISTS(SD_DETECT) - void lcd_sd_refresh() { - card.initsd(); - encoderTopLine = 0; - } - #endif - - void lcd_sd_updir() { - encoderPosition = card.updir() ? ENCODER_STEPS_PER_MENU_ITEM : 0; - encoderTopLine = 0; - screen_changed = true; - lcd_refresh(); - } - - /** - * - * "Print from SD" submenu - * - */ - - #if ENABLED(SD_REPRINT_LAST_SELECTED_FILE) - uint32_t last_sdfile_encoderPosition = 0xFFFF; - - void lcd_reselect_last_file() { - if (last_sdfile_encoderPosition == 0xFFFF) return; - #if ENABLED(DOGLCD) - // Some of this is a hack to force the screen update to work. - // TODO: Fix the real issue that causes this! - lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT; - _lcd_synchronize(); - safe_delay(50); - _lcd_synchronize(); - lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT; - drawing_screen = screen_changed = true; - #endif - - lcd_goto_screen(lcd_sdcard_menu, last_sdfile_encoderPosition); - defer_return_to_status = true; - last_sdfile_encoderPosition = 0xFFFF; - - #if ENABLED(DOGLCD) - lcd_update(); - #endif - } - #endif - - void lcd_sdcard_menu() { - ENCODER_DIRECTION_MENUS(); - - const uint16_t fileCnt = card.get_num_Files(); - - START_MENU(); - MENU_BACK(MSG_MAIN); - card.getWorkDirName(); - if (card.filename[0] == '/') { - #if !PIN_EXISTS(SD_DETECT) - MENU_ITEM(function, LCD_STR_REFRESH MSG_REFRESH, lcd_sd_refresh); - #endif - } - else { - MENU_ITEM(function, LCD_STR_FOLDER "..", lcd_sd_updir); - } - - for (uint16_t i = 0; i < fileCnt; i++) { - if (_menuLineNr == _thisItemNr) { - const uint16_t nr = - #if ENABLED(SDCARD_RATHERRECENTFIRST) && DISABLED(SDCARD_SORT_ALPHA) - fileCnt - 1 - - #endif - i; - - #if ENABLED(SDCARD_SORT_ALPHA) - card.getfilename_sorted(nr); - #else - card.getfilename(nr); - #endif - - if (card.filenameIsDir) - MENU_ITEM(sddirectory, MSG_CARD_MENU, card); - else - MENU_ITEM(sdfile, MSG_CARD_MENU, card); - } - else { - MENU_ITEM_DUMMY(); - } - } - END_MENU(); - } - - #endif // SDSUPPORT - - #if ENABLED(LCD_INFO_MENU) - - #if ENABLED(PRINTCOUNTER) - /** - * - * About Printer > Statistics submenu - * - */ - void lcd_info_stats_menu() { - if (use_click()) { return lcd_goto_previous_menu(); } - - char buffer[21]; - printStatistics stats = print_job_timer.getStats(); - - START_SCREEN(); // 12345678901234567890 - STATIC_ITEM(MSG_INFO_PRINT_COUNT ": ", false, false, itostr3left(stats.totalPrints)); // Print Count: 999 - STATIC_ITEM(MSG_INFO_COMPLETED_PRINTS": ", false, false, itostr3left(stats.finishedPrints)); // Completed : 666 - - duration_t elapsed = stats.printTime; - elapsed.toString(buffer); - - STATIC_ITEM(MSG_INFO_PRINT_TIME ": ", false, false); // Total print Time: - STATIC_ITEM("", false, false, buffer); // 99y 364d 23h 59m 59s - - elapsed = stats.longestPrint; - elapsed.toString(buffer); - - STATIC_ITEM(MSG_INFO_PRINT_LONGEST ": ", false, false); // Longest job time: - STATIC_ITEM("", false, false, buffer); // 99y 364d 23h 59m 59s - - sprintf_P(buffer, PSTR("%ld.%im"), long(stats.filamentUsed / 1000), int16_t(stats.filamentUsed / 100) % 10); - STATIC_ITEM(MSG_INFO_PRINT_FILAMENT ": ", false, false); // Extruded total: - STATIC_ITEM("", false, false, buffer); // 125m - END_SCREEN(); - } - #endif // PRINTCOUNTER - - /** - * - * About Printer > Thermistors - * - */ - void lcd_info_thermistors_menu() { - if (use_click()) { return lcd_goto_previous_menu(); } - START_SCREEN(); - #define THERMISTOR_ID TEMP_SENSOR_0 - #include "thermistornames.h" - STATIC_ITEM("T0: " THERMISTOR_NAME, false, true); - STATIC_ITEM(MSG_INFO_MIN_TEMP ": " STRINGIFY(HEATER_0_MINTEMP), false); - STATIC_ITEM(MSG_INFO_MAX_TEMP ": " STRINGIFY(HEATER_0_MAXTEMP), false); - - #if TEMP_SENSOR_1 != 0 - #undef THERMISTOR_ID - #define THERMISTOR_ID TEMP_SENSOR_1 - #include "thermistornames.h" - STATIC_ITEM("T1: " THERMISTOR_NAME, false, true); - STATIC_ITEM(MSG_INFO_MIN_TEMP ": " STRINGIFY(HEATER_1_MINTEMP), false); - STATIC_ITEM(MSG_INFO_MAX_TEMP ": " STRINGIFY(HEATER_1_MAXTEMP), false); - #endif - - #if TEMP_SENSOR_2 != 0 - #undef THERMISTOR_ID - #define THERMISTOR_ID TEMP_SENSOR_2 - #include "thermistornames.h" - STATIC_ITEM("T2: " THERMISTOR_NAME, false, true); - STATIC_ITEM(MSG_INFO_MIN_TEMP ": " STRINGIFY(HEATER_2_MINTEMP), false); - STATIC_ITEM(MSG_INFO_MAX_TEMP ": " STRINGIFY(HEATER_2_MAXTEMP), false); - #endif - - #if TEMP_SENSOR_3 != 0 - #undef THERMISTOR_ID - #define THERMISTOR_ID TEMP_SENSOR_3 - #include "thermistornames.h" - STATIC_ITEM("T3: " THERMISTOR_NAME, false, true); - STATIC_ITEM(MSG_INFO_MIN_TEMP ": " STRINGIFY(HEATER_3_MINTEMP), false); - STATIC_ITEM(MSG_INFO_MAX_TEMP ": " STRINGIFY(HEATER_3_MAXTEMP), false); - #endif - - #if TEMP_SENSOR_4 != 0 - #undef THERMISTOR_ID - #define THERMISTOR_ID TEMP_SENSOR_4 - #include "thermistornames.h" - STATIC_ITEM("T4: " THERMISTOR_NAME, false, true); - STATIC_ITEM(MSG_INFO_MIN_TEMP ": " STRINGIFY(HEATER_4_MINTEMP), false); - STATIC_ITEM(MSG_INFO_MAX_TEMP ": " STRINGIFY(HEATER_4_MAXTEMP), false); - #endif - - #if HAS_HEATED_BED - #undef THERMISTOR_ID - #define THERMISTOR_ID TEMP_SENSOR_BED - #include "thermistornames.h" - STATIC_ITEM("TBed:" THERMISTOR_NAME, false, true); - STATIC_ITEM(MSG_INFO_MIN_TEMP ": " STRINGIFY(BED_MINTEMP), false); - STATIC_ITEM(MSG_INFO_MAX_TEMP ": " STRINGIFY(BED_MAXTEMP), false); - #endif - END_SCREEN(); - } - - /** - * - * About Printer > Board Info - * - */ - void lcd_info_board_menu() { - if (use_click()) { return lcd_goto_previous_menu(); } - START_SCREEN(); - STATIC_ITEM(BOARD_NAME, true, true); // MyPrinterController - STATIC_ITEM(MSG_INFO_BAUDRATE ": " STRINGIFY(BAUDRATE), true); // Baud: 250000 - STATIC_ITEM(MSG_INFO_PROTOCOL ": " PROTOCOL_VERSION, true); // Protocol: 1.0 - #if POWER_SUPPLY == 0 - STATIC_ITEM(MSG_INFO_PSU ": Generic", true); - #elif POWER_SUPPLY == 1 - STATIC_ITEM(MSG_INFO_PSU ": ATX", true); // Power Supply: ATX - #elif POWER_SUPPLY == 2 - STATIC_ITEM(MSG_INFO_PSU ": XBox", true); // Power Supply: XBox - #endif - END_SCREEN(); - } - - /** - * - * About Printer > Printer Info - * - */ - void lcd_info_printer_menu() { - if (use_click()) { return lcd_goto_previous_menu(); } - START_SCREEN(); - STATIC_ITEM(MSG_MARLIN, true, true); // Marlin - STATIC_ITEM(SHORT_BUILD_VERSION, true); // x.x.x-Branch - STATIC_ITEM(STRING_DISTRIBUTION_DATE, true); // YYYY-MM-DD HH:MM - STATIC_ITEM(MACHINE_NAME, true); // My3DPrinter - STATIC_ITEM(WEBSITE_URL, true); // www.my3dprinter.com - STATIC_ITEM(MSG_INFO_EXTRUDERS ": " STRINGIFY(EXTRUDERS), true); // Extruders: 2 - #if ENABLED(AUTO_BED_LEVELING_3POINT) - STATIC_ITEM(MSG_3POINT_LEVELING, true); // 3-Point Leveling - #elif ENABLED(AUTO_BED_LEVELING_LINEAR) - STATIC_ITEM(MSG_LINEAR_LEVELING, true); // Linear Leveling - #elif ENABLED(AUTO_BED_LEVELING_BILINEAR) - STATIC_ITEM(MSG_BILINEAR_LEVELING, true); // Bi-linear Leveling - #elif ENABLED(AUTO_BED_LEVELING_UBL) - STATIC_ITEM(MSG_UBL_LEVELING, true); // Unified Bed Leveling - #elif ENABLED(MESH_BED_LEVELING) - STATIC_ITEM(MSG_MESH_LEVELING, true); // Mesh Leveling - #endif - END_SCREEN(); - } - - /** - * - * "About Printer" submenu - * - */ - void lcd_info_menu() { - START_MENU(); - MENU_BACK(MSG_MAIN); - MENU_ITEM(submenu, MSG_INFO_PRINTER_MENU, lcd_info_printer_menu); // Printer Info > - MENU_ITEM(submenu, MSG_INFO_BOARD_MENU, lcd_info_board_menu); // Board Info > - MENU_ITEM(submenu, MSG_INFO_THERMISTOR_MENU, lcd_info_thermistors_menu); // Thermistors > - #if ENABLED(PRINTCOUNTER) - MENU_ITEM(submenu, MSG_INFO_STATS_MENU, lcd_info_stats_menu); // Printer Statistics > - #endif - END_MENU(); - } - #endif // LCD_INFO_MENU - - /** - * - * LED Menu - * - */ - - #if ENABLED(LED_CONTROL_MENU) - - #if ENABLED(LED_COLOR_PRESETS) - - void lcd_led_presets_menu() { - START_MENU(); - #if LCD_HEIGHT > 2 - STATIC_ITEM(MSG_LED_PRESETS, true, true); - #endif - MENU_BACK(MSG_LED_CONTROL); - MENU_ITEM(function, MSG_SET_LEDS_WHITE, leds.set_white); - MENU_ITEM(function, MSG_SET_LEDS_RED, leds.set_red); - MENU_ITEM(function, MSG_SET_LEDS_ORANGE, leds.set_orange); - MENU_ITEM(function, MSG_SET_LEDS_YELLOW,leds.set_yellow); - MENU_ITEM(function, MSG_SET_LEDS_GREEN, leds.set_green); - MENU_ITEM(function, MSG_SET_LEDS_BLUE, leds.set_blue); - MENU_ITEM(function, MSG_SET_LEDS_INDIGO, leds.set_indigo); - MENU_ITEM(function, MSG_SET_LEDS_VIOLET, leds.set_violet); - END_MENU(); - } - #endif // LED_COLOR_PRESETS - - void lcd_led_custom_menu() { - START_MENU(); - MENU_BACK(MSG_LED_CONTROL); - MENU_ITEM_EDIT_CALLBACK(int8, MSG_INTENSITY_R, &leds.color.r, 0, 255, leds.update, true); - MENU_ITEM_EDIT_CALLBACK(int8, MSG_INTENSITY_G, &leds.color.g, 0, 255, leds.update, true); - MENU_ITEM_EDIT_CALLBACK(int8, MSG_INTENSITY_B, &leds.color.b, 0, 255, leds.update, true); - #if ENABLED(RGBW_LED) || ENABLED(NEOPIXEL_LED) - MENU_ITEM_EDIT_CALLBACK(int8, MSG_INTENSITY_W, &leds.color.w, 0, 255, leds.update, true); - #if ENABLED(NEOPIXEL_LED) - MENU_ITEM_EDIT_CALLBACK(int8, MSG_LED_BRIGHTNESS, &leds.color.i, 0, 255, leds.update, true); - #endif - #endif - END_MENU(); - } - - void lcd_led_menu() { - START_MENU(); - MENU_BACK(MSG_MAIN); - bool led_on = leds.lights_on; - MENU_ITEM_EDIT_CALLBACK(bool, MSG_LEDS, &led_on, leds.toggle); - MENU_ITEM(function, MSG_SET_LEDS_DEFAULT, leds.set_default); - #if ENABLED(LED_COLOR_PRESETS) - MENU_ITEM(submenu, MSG_LED_PRESETS, lcd_led_presets_menu); - #endif - MENU_ITEM(submenu, MSG_CUSTOM_LEDS, lcd_led_custom_menu); - END_MENU(); - } - - #endif // LED_CONTROL_MENU - - /** - * - * Filament Change Feature Screens - * - */ - #if ENABLED(ADVANCED_PAUSE_FEATURE) - - /** - * - * "Change Filament" > "Change/Unload/Load Filament" submenu - * - */ - static AdvancedPauseMode _change_filament_temp_mode; - static int8_t _change_filament_temp_extruder; - - static const char* _change_filament_temp_command() { - switch (_change_filament_temp_mode) { - case ADVANCED_PAUSE_MODE_LOAD_FILAMENT: - return PSTR("M701 T%d"); - case ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT: - return _change_filament_temp_extruder >= 0 ? PSTR("M702 T%d") : PSTR("M702 ;%d"); - case ADVANCED_PAUSE_MODE_PAUSE_PRINT: - default: - return PSTR("M600 B0 T%d"); - } - return PSTR(MSG_FILAMENTCHANGE); - } - - void _change_filament_temp(const uint16_t temperature) { - char cmd[11]; - sprintf_P(cmd, _change_filament_temp_command(), _change_filament_temp_extruder); - thermalManager.setTargetHotend(temperature, _change_filament_temp_extruder); - lcd_enqueue_command(cmd); - } - void _lcd_change_filament_temp_1_menu() { _change_filament_temp(PREHEAT_1_TEMP_HOTEND); } - void _lcd_change_filament_temp_2_menu() { _change_filament_temp(PREHEAT_2_TEMP_HOTEND); } - void _lcd_change_filament_temp_custom_menu() { _change_filament_temp(thermalManager.target_temperature[_change_filament_temp_extruder]); } - - static const char* change_filament_header(const AdvancedPauseMode mode) { - switch (mode) { - case ADVANCED_PAUSE_MODE_LOAD_FILAMENT: - return PSTR(MSG_FILAMENTLOAD); - case ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT: - return PSTR(MSG_FILAMENTUNLOAD); - default: break; - } - return PSTR(MSG_FILAMENTCHANGE); - } - - void _lcd_temp_menu_filament_op(const AdvancedPauseMode mode, const int8_t extruder) { - _change_filament_temp_mode = mode; - _change_filament_temp_extruder = extruder; - START_MENU(); - if (LCD_HEIGHT >= 4) STATIC_ITEM_P(change_filament_header(mode), true, true); - MENU_BACK(MSG_FILAMENTCHANGE); - MENU_ITEM(submenu, MSG_PREHEAT_1, _lcd_change_filament_temp_1_menu); - MENU_ITEM(submenu, MSG_PREHEAT_2, _lcd_change_filament_temp_2_menu); - uint16_t max_temp; - switch (extruder) { - default: max_temp = HEATER_0_MAXTEMP; - #if HOTENDS > 1 - case 1: max_temp = HEATER_1_MAXTEMP; break; - #if HOTENDS > 2 - case 2: max_temp = HEATER_2_MAXTEMP; break; - #if HOTENDS > 3 - case 3: max_temp = HEATER_3_MAXTEMP; break; - #if HOTENDS > 4 - case 4: max_temp = HEATER_4_MAXTEMP; break; - #if HOTENDS > 5 - case 5: max_temp = HEATER_5_MAXTEMP; break; - #endif - #endif - #endif - #endif - #endif - } - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_PREHEAT_CUSTOM, &thermalManager.target_temperature[_change_filament_temp_extruder], EXTRUDE_MINTEMP, max_temp - 15, _lcd_change_filament_temp_custom_menu); - END_MENU(); - } - void lcd_temp_menu_e0_filament_change() { _lcd_temp_menu_filament_op(ADVANCED_PAUSE_MODE_PAUSE_PRINT, 0); } - void lcd_temp_menu_e0_filament_load() { _lcd_temp_menu_filament_op(ADVANCED_PAUSE_MODE_LOAD_FILAMENT, 0); } - void lcd_temp_menu_e0_filament_unload() { _lcd_temp_menu_filament_op(ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT, 0); } - #if E_STEPPERS > 1 - void lcd_temp_menu_e1_filament_change() { _lcd_temp_menu_filament_op(ADVANCED_PAUSE_MODE_PAUSE_PRINT, 1); } - void lcd_temp_menu_e1_filament_load() { _lcd_temp_menu_filament_op(ADVANCED_PAUSE_MODE_LOAD_FILAMENT, 1); } - void lcd_temp_menu_e1_filament_unload() { _lcd_temp_menu_filament_op(ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT, 1); } - #if ENABLED(FILAMENT_UNLOAD_ALL_EXTRUDERS) - void lcd_unload_filament_all_temp_menu() { _lcd_temp_menu_filament_op(ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT, -1); } - #endif - #if E_STEPPERS > 2 - void lcd_temp_menu_e2_filament_change() { _lcd_temp_menu_filament_op(ADVANCED_PAUSE_MODE_PAUSE_PRINT, 2); } - void lcd_temp_menu_e2_filament_load() { _lcd_temp_menu_filament_op(ADVANCED_PAUSE_MODE_LOAD_FILAMENT, 2); } - void lcd_temp_menu_e2_filament_unload() { _lcd_temp_menu_filament_op(ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT, 2); } - #if E_STEPPERS > 3 - void lcd_temp_menu_e3_filament_change() { _lcd_temp_menu_filament_op(ADVANCED_PAUSE_MODE_PAUSE_PRINT, 3); } - void lcd_temp_menu_e3_filament_load() { _lcd_temp_menu_filament_op(ADVANCED_PAUSE_MODE_LOAD_FILAMENT, 3); } - void lcd_temp_menu_e3_filament_unload() { _lcd_temp_menu_filament_op(ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT, 3); } - #if E_STEPPERS > 4 - void lcd_temp_menu_e4_filament_change() { _lcd_temp_menu_filament_op(ADVANCED_PAUSE_MODE_PAUSE_PRINT, 4); } - void lcd_temp_menu_e4_filament_load() { _lcd_temp_menu_filament_op(ADVANCED_PAUSE_MODE_LOAD_FILAMENT, 4); } - void lcd_temp_menu_e4_filament_unload() { _lcd_temp_menu_filament_op(ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT, 4); } - #endif // E_STEPPERS > 4 - #endif // E_STEPPERS > 3 - #endif // E_STEPPERS > 2 - #endif // E_STEPPERS > 1 - - /** - * - * "Change Filament" submenu - * - */ - #if E_STEPPERS > 1 || ENABLED(FILAMENT_LOAD_UNLOAD_GCODES) - void lcd_change_filament_menu() { - START_MENU(); - MENU_BACK(MSG_MAIN); - - // Change filament - #if E_STEPPERS == 1 - PGM_P msg0 = PSTR(MSG_FILAMENTCHANGE); - if (thermalManager.targetTooColdToExtrude(active_extruder)) - MENU_ITEM_P(submenu, msg0, lcd_temp_menu_e0_filament_change); - else - MENU_ITEM_P(gcode, msg0, PSTR("M600 B0")); - #else - PGM_P msg0 = PSTR(MSG_FILAMENTCHANGE " " MSG_E1); - PGM_P msg1 = PSTR(MSG_FILAMENTCHANGE " " MSG_E2); - if (thermalManager.targetTooColdToExtrude(0)) - MENU_ITEM_P(submenu, msg0, lcd_temp_menu_e0_filament_change); - else - MENU_ITEM_P(gcode, msg0, PSTR("M600 B0 T0")); - if (thermalManager.targetTooColdToExtrude(1)) - MENU_ITEM_P(submenu, msg1, lcd_temp_menu_e1_filament_change); - else - MENU_ITEM_P(gcode, msg1, PSTR("M600 B0 T1")); - #if E_STEPPERS > 2 - PGM_P msg2 = PSTR(MSG_FILAMENTCHANGE " " MSG_E3); - if (thermalManager.targetTooColdToExtrude(2)) - MENU_ITEM_P(submenu, msg2, lcd_temp_menu_e2_filament_change); - else - MENU_ITEM_P(gcode, msg2, PSTR("M600 B0 T2")); - #if E_STEPPERS > 3 - PGM_P msg3 = PSTR(MSG_FILAMENTCHANGE " " MSG_E4); - if (thermalManager.targetTooColdToExtrude(3)) - MENU_ITEM_P(submenu, msg3, lcd_temp_menu_e3_filament_change); - else - MENU_ITEM_P(gcode, msg3, PSTR("M600 B0 T3")); - #if E_STEPPERS > 4 - PGM_P msg4 = PSTR(MSG_FILAMENTCHANGE " " MSG_E5); - if (thermalManager.targetTooColdToExtrude(4)) - MENU_ITEM_P(submenu, msg4, lcd_temp_menu_e4_filament_change); - else - MENU_ITEM_P(gcode, msg4, PSTR("M600 B0 T4")); - #if E_STEPPERS > 5 - PGM_P msg5 = PSTR(MSG_FILAMENTCHANGE " " MSG_E6); - if (thermalManager.targetTooColdToExtrude(5)) - MENU_ITEM_P(submenu, msg5, lcd_temp_menu_e5_filament_change); - else - MENU_ITEM_P(gcode, msg5, PSTR("M600 B0 T5")); - #endif // E_STEPPERS > 5 - #endif // E_STEPPERS > 4 - #endif // E_STEPPERS > 3 - #endif // E_STEPPERS > 2 - #endif // E_STEPPERS == 1 - - #if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES) - if (!planner.movesplanned() && !IS_SD_FILE_OPEN) { - // Load filament - #if E_STEPPERS == 1 - PGM_P msg0 = PSTR(MSG_FILAMENTLOAD); - if (thermalManager.targetTooColdToExtrude(active_extruder)) - MENU_ITEM_P(submenu, msg0, lcd_temp_menu_e0_filament_load); - else - MENU_ITEM_P(gcode, msg0, PSTR("M701")); - #else - PGM_P msg0 = PSTR(MSG_FILAMENTLOAD " " MSG_E1); - PGM_P msg1 = PSTR(MSG_FILAMENTLOAD " " MSG_E2); - if (thermalManager.targetTooColdToExtrude(0)) - MENU_ITEM_P(submenu, msg0, lcd_temp_menu_e0_filament_load); - else - MENU_ITEM_P(gcode, msg0, PSTR("M701 T0")); - if (thermalManager.targetTooColdToExtrude(1)) - MENU_ITEM_P(submenu, msg1, lcd_temp_menu_e1_filament_load); - else - MENU_ITEM_P(gcode, msg1, PSTR("M701 T1")); - #if E_STEPPERS > 2 - PGM_P msg2 = PSTR(MSG_FILAMENTLOAD " " MSG_E3); - if (thermalManager.targetTooColdToExtrude(2)) - MENU_ITEM_P(submenu, msg2, lcd_temp_menu_e2_filament_load); - else - MENU_ITEM_P(gcode, msg2, PSTR("M701 T2")); - #if E_STEPPERS > 3 - PGM_P msg3 = PSTR(MSG_FILAMENTLOAD " " MSG_E4); - if (thermalManager.targetTooColdToExtrude(3)) - MENU_ITEM_P(submenu, msg3, lcd_temp_menu_e3_filament_load); - else - MENU_ITEM_P(gcode, msg3, PSTR("M701 T3")); - #if E_STEPPERS > 4 - PGM_P msg4 = PSTR(MSG_FILAMENTLOAD " " MSG_E5); - if (thermalManager.targetTooColdToExtrude(4)) - MENU_ITEM_P(submenu, msg4, lcd_temp_menu_e4_filament_load); - else - MENU_ITEM_P(gcode, msg4, PSTR("M701 T4")); - #if E_STEPPERS > 5 - PGM_P msg5 = PSTR(MSG_FILAMENTLOAD " " MSG_E6); - if (thermalManager.targetTooColdToExtrude(5)) - MENU_ITEM_P(submenu, msg5, lcd_temp_menu_e5_filament_load); - else - MENU_ITEM_P(gcode, msg5, PSTR("M701 T5")); - #endif // E_STEPPERS > 5 - #endif // E_STEPPERS > 4 - #endif // E_STEPPERS > 3 - #endif // E_STEPPERS > 2 - #endif // E_STEPPERS == 1 - - // Unload filament - #if E_STEPPERS == 1 - if (thermalManager.targetHotEnoughToExtrude(active_extruder)) - MENU_ITEM(gcode, MSG_FILAMENTUNLOAD, PSTR("M702")); - else - MENU_ITEM(submenu, MSG_FILAMENTUNLOAD, lcd_temp_menu_e0_filament_unload); - #else - #if ENABLED(FILAMENT_UNLOAD_ALL_EXTRUDERS) - if (thermalManager.targetHotEnoughToExtrude(0) - #if E_STEPPERS > 1 - && thermalManager.targetHotEnoughToExtrude(1) - #if E_STEPPERS > 2 - && thermalManager.targetHotEnoughToExtrude(2) - #if E_STEPPERS > 3 - && thermalManager.targetHotEnoughToExtrude(3) - #if E_STEPPERS > 4 - && thermalManager.targetHotEnoughToExtrude(4) - #if E_STEPPERS > 5 - && thermalManager.targetHotEnoughToExtrude(5) - #endif // E_STEPPERS > 5 - #endif // E_STEPPERS > 4 - #endif // E_STEPPERS > 3 - #endif // E_STEPPERS > 2 - #endif // E_STEPPERS > 1 - ) - MENU_ITEM(gcode, MSG_FILAMENTUNLOAD_ALL, PSTR("M702")); - else - MENU_ITEM(submenu, MSG_FILAMENTUNLOAD_ALL, lcd_unload_filament_all_temp_menu); - #endif - if (thermalManager.targetHotEnoughToExtrude(0)) - MENU_ITEM(gcode, MSG_FILAMENTUNLOAD " " MSG_E1, PSTR("M702 T0")); - else - MENU_ITEM(submenu, MSG_FILAMENTUNLOAD " " MSG_E1, lcd_temp_menu_e0_filament_unload); - if (thermalManager.targetHotEnoughToExtrude(1)) - MENU_ITEM(gcode, MSG_FILAMENTUNLOAD " " MSG_E2, PSTR("M702 T1")); - else - MENU_ITEM(submenu, MSG_FILAMENTUNLOAD " " MSG_E2, lcd_temp_menu_e1_filament_unload); - #if E_STEPPERS > 2 - if (thermalManager.targetHotEnoughToExtrude(2)) - MENU_ITEM(gcode, MSG_FILAMENTUNLOAD " " MSG_E3, PSTR("M702 T2")); - else - MENU_ITEM(submenu, MSG_FILAMENTUNLOAD " " MSG_E3, lcd_temp_menu_e2_filament_unload); - #if E_STEPPERS > 3 - if (thermalManager.targetHotEnoughToExtrude(3)) - MENU_ITEM(gcode, MSG_FILAMENTUNLOAD " " MSG_E4, PSTR("M702 T3")); - else - MENU_ITEM(submenu, MSG_FILAMENTUNLOAD " " MSG_E4, lcd_temp_menu_e3_filament_unload); - #if E_STEPPERS > 4 - if (thermalManager.targetHotEnoughToExtrude(4)) - MENU_ITEM(gcode, MSG_FILAMENTUNLOAD " " MSG_E5, PSTR("M702 T4")); - else - MENU_ITEM(submenu, MSG_FILAMENTUNLOAD " " MSG_E5, lcd_temp_menu_e4_filament_unload); - #if E_STEPPERS > 5 - if (thermalManager.targetHotEnoughToExtrude(5)) - MENU_ITEM(gcode, MSG_FILAMENTUNLOAD " " MSG_E6, PSTR("M702 T5")); - else - MENU_ITEM(submenu, MSG_FILAMENTUNLOAD " " MSG_E6, lcd_temp_menu_e5_filament_unload); - #endif // E_STEPPERS > 5 - #endif // E_STEPPERS > 4 - #endif // E_STEPPERS > 3 - #endif // E_STEPPERS > 2 - #endif // E_STEPPERS == 1 - } - #endif - - END_MENU(); - } - #endif - - static AdvancedPauseMode advanced_pause_mode = ADVANCED_PAUSE_MODE_PAUSE_PRINT; - static uint8_t hotend_status_extruder = 0; - - static const char* advanced_pause_header() { - switch (advanced_pause_mode) { - case ADVANCED_PAUSE_MODE_LOAD_FILAMENT: - return PSTR(MSG_FILAMENT_CHANGE_HEADER_LOAD); - case ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT: - return PSTR(MSG_FILAMENT_CHANGE_HEADER_UNLOAD); - default: break; - } - return PSTR(MSG_FILAMENT_CHANGE_HEADER_PAUSE); - } - - // Portions from STATIC_ITEM... - #define HOTEND_STATUS_ITEM() do { \ - if (_menuLineNr == _thisItemNr) { \ - if (lcdDrawUpdate) { \ - lcd_implementation_drawmenu_static(_lcdLineNr, PSTR(MSG_FILAMENT_CHANGE_NOZZLE), false, true); \ - lcd_implementation_hotend_status(_lcdLineNr, hotend_status_extruder); \ - } \ - if (_skipStatic && encoderLine <= _thisItemNr) { \ - encoderPosition += ENCODER_STEPS_PER_MENU_ITEM; \ - ++encoderLine; \ - } \ - lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT; \ - } \ - ++_thisItemNr; \ - }while(0) - - void lcd_advanced_pause_resume_print() { - advanced_pause_menu_response = ADVANCED_PAUSE_RESPONSE_RESUME_PRINT; - } - - void lcd_advanced_pause_extrude_more() { - advanced_pause_menu_response = ADVANCED_PAUSE_RESPONSE_EXTRUDE_MORE; - } - - void lcd_advanced_pause_option_menu() { - START_MENU(); - #if LCD_HEIGHT > 2 - STATIC_ITEM(MSG_FILAMENT_CHANGE_OPTION_HEADER, true, false); - #endif - MENU_ITEM(function, MSG_FILAMENT_CHANGE_OPTION_RESUME, lcd_advanced_pause_resume_print); - MENU_ITEM(function, MSG_FILAMENT_CHANGE_OPTION_PURGE, lcd_advanced_pause_extrude_more); - END_MENU(); - } - - void lcd_advanced_pause_init_message() { - START_SCREEN(); - STATIC_ITEM_P(advanced_pause_header(), true, true); - STATIC_ITEM(MSG_FILAMENT_CHANGE_INIT_1); - #ifdef MSG_FILAMENT_CHANGE_INIT_2 - STATIC_ITEM(MSG_FILAMENT_CHANGE_INIT_2); - #define __FC_LINES_A 3 - #else - #define __FC_LINES_A 2 - #endif - #ifdef MSG_FILAMENT_CHANGE_INIT_3 - STATIC_ITEM(MSG_FILAMENT_CHANGE_INIT_3); - #define _FC_LINES_A (__FC_LINES_A + 1) - #else - #define _FC_LINES_A __FC_LINES_A - #endif - #if LCD_HEIGHT > _FC_LINES_A + 1 - STATIC_ITEM(" "); - #endif - HOTEND_STATUS_ITEM(); - END_SCREEN(); - } - - void lcd_advanced_pause_unload_message() { - START_SCREEN(); - STATIC_ITEM_P(advanced_pause_header(), true, true); - STATIC_ITEM(MSG_FILAMENT_CHANGE_UNLOAD_1); - #ifdef MSG_FILAMENT_CHANGE_UNLOAD_2 - STATIC_ITEM(MSG_FILAMENT_CHANGE_UNLOAD_2); - #define __FC_LINES_B 3 - #else - #define __FC_LINES_B 2 - #endif - #ifdef MSG_FILAMENT_CHANGE_UNLOAD_3 - STATIC_ITEM(MSG_FILAMENT_CHANGE_UNLOAD_3); - #define _FC_LINES_B (__FC_LINES_B + 1) - #else - #define _FC_LINES_B __FC_LINES_B - #endif - #if LCD_HEIGHT > _FC_LINES_B + 1 - STATIC_ITEM(" "); - #endif - HOTEND_STATUS_ITEM(); - END_SCREEN(); - } - - void lcd_advanced_pause_wait_for_nozzles_to_heat() { - START_SCREEN(); - STATIC_ITEM_P(advanced_pause_header(), true, true); - STATIC_ITEM(MSG_FILAMENT_CHANGE_HEATING_1); - #ifdef MSG_FILAMENT_CHANGE_HEATING_2 - STATIC_ITEM(MSG_FILAMENT_CHANGE_HEATING_2); - #define _FC_LINES_C 3 - #else - #define _FC_LINES_C 2 - #endif - #if LCD_HEIGHT > _FC_LINES_C + 1 - STATIC_ITEM(" "); - #endif - HOTEND_STATUS_ITEM(); - END_SCREEN(); - } - - void lcd_advanced_pause_heat_nozzle() { - START_SCREEN(); - STATIC_ITEM_P(advanced_pause_header(), true, true); - STATIC_ITEM(MSG_FILAMENT_CHANGE_HEAT_1); - #ifdef MSG_FILAMENT_CHANGE_INSERT_2 - STATIC_ITEM(MSG_FILAMENT_CHANGE_HEAT_2); - #define _FC_LINES_D 3 - #else - #define _FC_LINES_D 2 - #endif - #if LCD_HEIGHT > _FC_LINES_D + 1 - STATIC_ITEM(" "); - #endif - HOTEND_STATUS_ITEM(); - END_SCREEN(); - } - - void lcd_advanced_pause_insert_message() { - START_SCREEN(); - STATIC_ITEM_P(advanced_pause_header(), true, true); - STATIC_ITEM(MSG_FILAMENT_CHANGE_INSERT_1); - #ifdef MSG_FILAMENT_CHANGE_INSERT_2 - STATIC_ITEM(MSG_FILAMENT_CHANGE_INSERT_2); - #define __FC_LINES_E 3 - #else - #define __FC_LINES_E 2 - #endif - #ifdef MSG_FILAMENT_CHANGE_INSERT_3 - STATIC_ITEM(MSG_FILAMENT_CHANGE_INSERT_3); - #define _FC_LINES_E (__FC_LINES_E + 1) - #else - #define _FC_LINES_E __FC_LINES_E - #endif - #if LCD_HEIGHT > _FC_LINES_E + 1 - STATIC_ITEM(" "); - #endif - HOTEND_STATUS_ITEM(); - END_SCREEN(); - } - - void lcd_advanced_pause_load_message() { - START_SCREEN(); - STATIC_ITEM_P(advanced_pause_header(), true, true); - STATIC_ITEM(MSG_FILAMENT_CHANGE_LOAD_1); - #ifdef MSG_FILAMENT_CHANGE_LOAD_2 - STATIC_ITEM(MSG_FILAMENT_CHANGE_LOAD_2); - #define __FC_LINES_F 3 - #else - #define __FC_LINES_F 2 - #endif - #ifdef MSG_FILAMENT_CHANGE_LOAD_3 - STATIC_ITEM(MSG_FILAMENT_CHANGE_LOAD_3); - #define _FC_LINES_F (__FC_LINES_F + 1) - #else - #define _FC_LINES_F __FC_LINES_F - #endif - #if LCD_HEIGHT > _FC_LINES_F + 1 - STATIC_ITEM(" "); - #endif - HOTEND_STATUS_ITEM(); - END_SCREEN(); - } - - void lcd_advanced_pause_purge_message() { - START_SCREEN(); - STATIC_ITEM_P(advanced_pause_header(), true, true); - STATIC_ITEM(MSG_FILAMENT_CHANGE_PURGE_1); - #ifdef MSG_FILAMENT_CHANGE_PURGE_2 - STATIC_ITEM(MSG_FILAMENT_CHANGE_PURGE_2); - #define __FC_LINES_G 3 - #else - #define __FC_LINES_G 2 - #endif - #ifdef MSG_FILAMENT_CHANGE_PURGE_3 - STATIC_ITEM(MSG_FILAMENT_CHANGE_PURGE_3); - #define _FC_LINES_G (__FC_LINES_G + 1) - #else - #define _FC_LINES_G __FC_LINES_G - #endif - #if LCD_HEIGHT > _FC_LINES_G + 1 - STATIC_ITEM(" "); - #endif - HOTEND_STATUS_ITEM(); - END_SCREEN(); - } - - #if ENABLED(ADVANCED_PAUSE_CONTINUOUS_PURGE) - void lcd_advanced_pause_continuous_purge_menu() { - START_SCREEN(); - STATIC_ITEM(MSG_FILAMENT_CHANGE_PURGE_1); - #ifdef MSG_FILAMENT_CHANGE_PURGE_2 - STATIC_ITEM(MSG_FILAMENT_CHANGE_PURGE_2); - #define __FC_LINES_G 3 - #else - #define __FC_LINES_G 2 - #endif - #ifdef MSG_FILAMENT_CHANGE_PURGE_3 - STATIC_ITEM(MSG_FILAMENT_CHANGE_PURGE_3); - #define _FC_LINES_G (__FC_LINES_G + 1) - #else - #define _FC_LINES_G __FC_LINES_G - #endif - #if LCD_HEIGHT > _FC_LINES_G + 1 - STATIC_ITEM(" "); - #endif - HOTEND_STATUS_ITEM(); - STATIC_ITEM(MSG_USERWAIT); - END_SCREEN(); - } - #endif - - void lcd_advanced_pause_resume_message() { - START_SCREEN(); - STATIC_ITEM_P(advanced_pause_header(), true, true); - STATIC_ITEM(MSG_FILAMENT_CHANGE_RESUME_1); - #ifdef MSG_FILAMENT_CHANGE_RESUME_2 - STATIC_ITEM(MSG_FILAMENT_CHANGE_RESUME_2); - #endif - #ifdef MSG_FILAMENT_CHANGE_RESUME_3 - STATIC_ITEM(MSG_FILAMENT_CHANGE_RESUME_3); - #endif - END_SCREEN(); - } - - FORCE_INLINE screenFunc_t ap_message_screen(const AdvancedPauseMessage message) { - switch (message) { - case ADVANCED_PAUSE_MESSAGE_INIT: return lcd_advanced_pause_init_message; - case ADVANCED_PAUSE_MESSAGE_UNLOAD: return lcd_advanced_pause_unload_message; - case ADVANCED_PAUSE_MESSAGE_INSERT: return lcd_advanced_pause_insert_message; - case ADVANCED_PAUSE_MESSAGE_LOAD: return lcd_advanced_pause_load_message; - case ADVANCED_PAUSE_MESSAGE_PURGE: return lcd_advanced_pause_purge_message; - case ADVANCED_PAUSE_MESSAGE_RESUME: return lcd_advanced_pause_resume_message; - case ADVANCED_PAUSE_MESSAGE_CLICK_TO_HEAT_NOZZLE: return lcd_advanced_pause_heat_nozzle; - case ADVANCED_PAUSE_MESSAGE_WAIT_FOR_NOZZLES_TO_HEAT: return lcd_advanced_pause_wait_for_nozzles_to_heat; - case ADVANCED_PAUSE_MESSAGE_OPTION: advanced_pause_menu_response = ADVANCED_PAUSE_RESPONSE_WAIT_FOR; - return lcd_advanced_pause_option_menu; - #if ENABLED(ADVANCED_PAUSE_CONTINUOUS_PURGE) - case ADVANCED_PAUSE_MESSAGE_CONTINUOUS_PURGE: return lcd_advanced_pause_continuous_purge_menu; - #endif - case ADVANCED_PAUSE_MESSAGE_STATUS: - default: break; - } - return NULL; - } - - void lcd_advanced_pause_show_message( - const AdvancedPauseMessage message, - const AdvancedPauseMode mode/*=ADVANCED_PAUSE_MODE_PAUSE_PRINT*/, - const uint8_t extruder/*=active_extruder*/ - ) { - advanced_pause_mode = mode; - hotend_status_extruder = extruder; - const screenFunc_t next_screen = ap_message_screen(message); - if (next_screen) { - defer_return_to_status = true; - lcd_goto_screen(next_screen); - } - else - lcd_return_to_status(); - } - - #endif // ADVANCED_PAUSE_FEATURE - - /** - * - * Functions for editing single values - * - * The "DEFINE_MENU_EDIT_TYPE" macro generates the functions needed to edit a numerical value. - * - * For example, DEFINE_MENU_EDIT_TYPE(int16_t, int3, itostr3, 1) expands into these functions: - * - * bool _menu_edit_int3(); - * void menu_edit_int3(); // edit int16_t (interactively) - * void menu_edit_callback_int3(); // edit int16_t (interactively) with callback on completion - * void _menu_action_setting_edit_int3(const char * const pstr, int16_t * const ptr, const int16_t minValue, const int16_t maxValue); - * void menu_action_setting_edit_int3(const char * const pstr, int16_t * const ptr, const int16_t minValue, const int16_t maxValue); - * void menu_action_setting_edit_callback_int3(const char * const pstr, int16_t * const ptr, const int16_t minValue, const int16_t maxValue, const screenFunc_t callback, const bool live); // edit int16_t with callback - * - * You can then use one of the menu macros to present the edit interface: - * MENU_ITEM_EDIT(int3, MSG_SPEED, &feedrate_percentage, 10, 999) - * - * This expands into a more primitive menu item: - * MENU_ITEM(setting_edit_int3, MSG_SPEED, PSTR(MSG_SPEED), &feedrate_percentage, 10, 999) - * - * ...which calls: - * menu_action_setting_edit_int3(PSTR(MSG_SPEED), &feedrate_percentage, 10, 999) - */ - #define DEFINE_MENU_EDIT_TYPE(_type, _name, _strFunc, _scale) \ - bool _menu_edit_ ## _name() { \ - ENCODER_DIRECTION_NORMAL(); \ - if ((int32_t)encoderPosition < 0) encoderPosition = 0; \ - if ((int32_t)encoderPosition > maxEditValue) encoderPosition = maxEditValue; \ - if (lcdDrawUpdate) \ - lcd_implementation_drawedit(editLabel, _strFunc(((_type)((int32_t)encoderPosition + minEditValue)) * (1.0f / _scale))); \ - if (lcd_clicked || (liveEdit && lcdDrawUpdate)) { \ - _type value = ((_type)((int32_t)encoderPosition + minEditValue)) * (1.0f / _scale); \ - if (editValue != NULL) *((_type*)editValue) = value; \ - if (callbackFunc && (liveEdit || lcd_clicked)) (*callbackFunc)(); \ - if (lcd_clicked) lcd_goto_previous_menu(); \ - } \ - return use_click(); \ - } \ - void menu_edit_ ## _name() { _menu_edit_ ## _name(); } \ - void _menu_action_setting_edit_ ## _name(const char * const pstr, _type* const ptr, const _type minValue, const _type maxValue) { \ - lcd_save_previous_screen(); \ - lcd_refresh(); \ - \ - editLabel = pstr; \ - editValue = ptr; \ - minEditValue = minValue * _scale; \ - maxEditValue = maxValue * _scale - minEditValue; \ - encoderPosition = (*ptr) * _scale - minEditValue; \ - } \ - void menu_action_setting_edit_callback_ ## _name(const char * const pstr, _type * const ptr, const _type minValue, const _type maxValue, const screenFunc_t callback, const bool live) { \ - _menu_action_setting_edit_ ## _name(pstr, ptr, minValue, maxValue); \ - currentScreen = menu_edit_ ## _name; \ - callbackFunc = callback; \ - liveEdit = live; \ - } \ - FORCE_INLINE void menu_action_setting_edit_ ## _name(const char * const pstr, _type * const ptr, const _type minValue, const _type maxValue) { \ - menu_action_setting_edit_callback_ ## _name(pstr, ptr, minValue, maxValue); \ - } \ - typedef void _name##_void - - DEFINE_MENU_EDIT_TYPE(int16_t, int3, itostr3, 1); - DEFINE_MENU_EDIT_TYPE(uint8_t, int8, i8tostr3, 1); - DEFINE_MENU_EDIT_TYPE(float, float3, ftostr3, 1); - DEFINE_MENU_EDIT_TYPE(float, float52, ftostr52, 100); - DEFINE_MENU_EDIT_TYPE(float, float43, ftostr43sign, 1000); - DEFINE_MENU_EDIT_TYPE(float, float5, ftostr5rj, 0.01f); - DEFINE_MENU_EDIT_TYPE(float, float51, ftostr51sign, 10); - DEFINE_MENU_EDIT_TYPE(float, float52sign, ftostr52sign, 100); - DEFINE_MENU_EDIT_TYPE(float, float62, ftostr62rj, 100); - DEFINE_MENU_EDIT_TYPE(uint32_t, long5, ftostr5rj, 0.01f); - - /** - * - * Handlers for Keypad input - * - */ - #if ENABLED(ADC_KEYPAD) - - inline bool handle_adc_keypad() { - #define ADC_MIN_KEY_DELAY 100 - if (buttons_reprapworld_keypad) { - lcdDrawUpdate = LCDVIEW_REDRAW_NOW; - if (encoderDirection == -1) { // side effect which signals we are inside a menu - if (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_DOWN) encoderPosition -= ENCODER_STEPS_PER_MENU_ITEM; - else if (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_UP) encoderPosition += ENCODER_STEPS_PER_MENU_ITEM; - else if (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_LEFT) { menu_action_back(); lcd_quick_feedback(true); } - else if (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_RIGHT) { lcd_return_to_status(); lcd_quick_feedback(true); } - } - else { - if (buttons_reprapworld_keypad & (EN_REPRAPWORLD_KEYPAD_DOWN|EN_REPRAPWORLD_KEYPAD_UP|EN_REPRAPWORLD_KEYPAD_RIGHT)) { - if (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_DOWN) encoderPosition += ENCODER_PULSES_PER_STEP; - else if (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_UP) encoderPosition -= ENCODER_PULSES_PER_STEP; - else if (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_RIGHT) encoderPosition = 0; - } - } - #if ENABLED(ADC_KEYPAD_DEBUG) - SERIAL_PROTOCOLLNPAIR("buttons_reprapworld_keypad = ", (uint32_t)buttons_reprapworld_keypad); - SERIAL_PROTOCOLLNPAIR("encoderPosition = ", (uint32_t)encoderPosition); - #endif - next_button_update_ms = millis() + ADC_MIN_KEY_DELAY; - return true; - } - - return false; - } - - #elif ENABLED(REPRAPWORLD_KEYPAD) - - void _reprapworld_keypad_move(const AxisEnum axis, const int16_t dir) { - move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP; - encoderPosition = dir; - switch (axis) { - case X_AXIS: lcd_move_x(); break; - case Y_AXIS: lcd_move_y(); break; - case Z_AXIS: lcd_move_z(); - default: break; - } - } - void reprapworld_keypad_move_z_up() { _reprapworld_keypad_move(Z_AXIS, 1); } - void reprapworld_keypad_move_z_down() { _reprapworld_keypad_move(Z_AXIS, -1); } - void reprapworld_keypad_move_x_left() { _reprapworld_keypad_move(X_AXIS, -1); } - void reprapworld_keypad_move_x_right() { _reprapworld_keypad_move(X_AXIS, 1); } - void reprapworld_keypad_move_y_up() { _reprapworld_keypad_move(Y_AXIS, -1); } - void reprapworld_keypad_move_y_down() { _reprapworld_keypad_move(Y_AXIS, 1); } - void reprapworld_keypad_move_home() { enqueue_and_echo_commands_P(PSTR("G28")); } // move all axes home and wait - void reprapworld_keypad_move_menu() { lcd_goto_screen(lcd_move_menu); } - - inline void handle_reprapworld_keypad() { - - static uint8_t keypad_debounce = 0; - - if (!REPRAPWORLD_KEYPAD_PRESSED) { - if (keypad_debounce > 0) keypad_debounce--; - } - else if (!keypad_debounce) { - keypad_debounce = 2; - - if (REPRAPWORLD_KEYPAD_MOVE_MENU) reprapworld_keypad_move_menu(); - - #if DISABLED(DELTA) && Z_HOME_DIR == -1 - if (REPRAPWORLD_KEYPAD_MOVE_Z_UP) reprapworld_keypad_move_z_up(); - #endif - - if (all_axes_homed()) { - #if ENABLED(DELTA) || Z_HOME_DIR != -1 - if (REPRAPWORLD_KEYPAD_MOVE_Z_UP) reprapworld_keypad_move_z_up(); - #endif - if (REPRAPWORLD_KEYPAD_MOVE_Z_DOWN) reprapworld_keypad_move_z_down(); - if (REPRAPWORLD_KEYPAD_MOVE_X_LEFT) reprapworld_keypad_move_x_left(); - if (REPRAPWORLD_KEYPAD_MOVE_X_RIGHT) reprapworld_keypad_move_x_right(); - if (REPRAPWORLD_KEYPAD_MOVE_Y_DOWN) reprapworld_keypad_move_y_down(); - if (REPRAPWORLD_KEYPAD_MOVE_Y_UP) reprapworld_keypad_move_y_up(); - } - else { - if (REPRAPWORLD_KEYPAD_MOVE_HOME) reprapworld_keypad_move_home(); - } - } - } - - #endif // REPRAPWORLD_KEYPAD - - /** - * - * Menu actions - * - */ - void _menu_action_back() { lcd_goto_previous_menu(); } - void menu_action_submenu(screenFunc_t func) { lcd_save_previous_screen(); lcd_goto_screen(func); } - void menu_action_gcode(const char* pgcode) { enqueue_and_echo_commands_P(pgcode); } - void menu_action_function(screenFunc_t func) { (*func)(); } - - #if ENABLED(SDSUPPORT) - - void menu_action_sdfile(CardReader &theCard) { - #if ENABLED(SD_REPRINT_LAST_SELECTED_FILE) - last_sdfile_encoderPosition = encoderPosition; // Save which file was selected for later use - #endif - card.openAndPrintFile(theCard.filename); - lcd_return_to_status(); - lcd_reset_status(); - } - - void menu_action_sddirectory(CardReader &theCard) { - card.chdir(theCard.filename); - encoderTopLine = 0; - encoderPosition = 2 * ENCODER_STEPS_PER_MENU_ITEM; - screen_changed = true; - #if ENABLED(DOGLCD) - drawing_screen = false; - #endif - lcd_refresh(); - } - - #endif // SDSUPPORT - - void menu_action_setting_edit_bool(const char* pstr, bool* ptr) { UNUSED(pstr); *ptr ^= true; lcd_refresh(); } - void menu_action_setting_edit_callback_bool(const char* pstr, bool* ptr, screenFunc_t callback) { - menu_action_setting_edit_bool(pstr, ptr); - (*callback)(); - } - -#endif // ULTIPANEL - -void lcd_init() { - - lcd_implementation_init(); - - #if ENABLED(NEWPANEL) - #if BUTTON_EXISTS(EN1) - SET_INPUT_PULLUP(BTN_EN1); - #endif - #if BUTTON_EXISTS(EN2) - SET_INPUT_PULLUP(BTN_EN2); - #endif - #if BUTTON_EXISTS(ENC) - SET_INPUT_PULLUP(BTN_ENC); - #endif - - #if ENABLED(REPRAPWORLD_KEYPAD) && DISABLED(ADC_KEYPAD) - SET_OUTPUT(SHIFT_CLK); - OUT_WRITE(SHIFT_LD, HIGH); - SET_INPUT_PULLUP(SHIFT_OUT); - #endif - - #if BUTTON_EXISTS(UP) - SET_INPUT(BTN_UP); - #endif - #if BUTTON_EXISTS(DWN) - SET_INPUT(BTN_DWN); - #endif - #if BUTTON_EXISTS(LFT) - SET_INPUT(BTN_LFT); - #endif - #if BUTTON_EXISTS(RT) - SET_INPUT(BTN_RT); - #endif - - #else // !NEWPANEL - - #if ENABLED(SR_LCD_2W_NL) // Non latching 2 wire shift register - SET_OUTPUT(SR_DATA_PIN); - SET_OUTPUT(SR_CLK_PIN); - #elif defined(SHIFT_CLK) - SET_OUTPUT(SHIFT_CLK); - OUT_WRITE(SHIFT_LD, HIGH); - OUT_WRITE(SHIFT_EN, LOW); - SET_INPUT_PULLUP(SHIFT_OUT); - #endif // SR_LCD_2W_NL - - #endif // !NEWPANEL - - #if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT) - SET_INPUT_PULLUP(SD_DETECT_PIN); - lcd_sd_status = 2; // UNKNOWN - #endif - - #if ENABLED(LCD_HAS_SLOW_BUTTONS) - slow_buttons = 0; - #endif - - lcd_buttons_update(); - - #if ENABLED(ULTIPANEL) - encoderDiff = 0; - #endif -} - -bool lcd_blink() { - static uint8_t blink = 0; - static millis_t next_blink_ms = 0; - millis_t ms = millis(); - if (ELAPSED(ms, next_blink_ms)) { - blink ^= 0xFF; - next_blink_ms = ms + 1000 - (LCD_UPDATE_INTERVAL) / 2; - } - return blink != 0; -} +#endif // HAS_LCD_MENU /** * Update the LCD, read encoder buttons, etc. @@ -5330,7 +606,7 @@ bool lcd_blink() { * - Act on RepRap World keypad input * - Update the encoder position * - Apply acceleration to the encoder position - * - Set lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NOW on controller events + * - Do refresh(LCDVIEW_CALL_REDRAW_NOW) on controller events * - Reset the Info Screen timeout if there's any input * - Update status indicators, if any * @@ -5340,7 +616,7 @@ bool lcd_blink() { * - Call the menu handler. Menu handlers should do the following: * - If a value changes, set lcdDrawUpdate to LCDVIEW_REDRAW_NOW and draw the value * (Encoder events automatically set lcdDrawUpdate for you.) - * - if (lcdDrawUpdate) { redraw } + * - if (should_draw()) { redraw } * - Before exiting the handler set lcdDrawUpdate to: * - LCDVIEW_CLEAR_CALL_REDRAW to clear screen and set LCDVIEW_CALL_REDRAW_NEXT. * - LCDVIEW_REDRAW_NOW to draw now (including remaining stripes). @@ -5353,52 +629,64 @@ bool lcd_blink() { * - Clear the LCD if lcdDrawUpdate == LCDVIEW_CLEAR_CALL_REDRAW * - Update lcdDrawUpdate for the next loop (i.e., move one state down, usually) * - * No worries. This function is only called from the main thread. + * This function is only called from the main thread. */ -void lcd_update() { - #if ENABLED(ULTIPANEL) - static millis_t return_to_status_ms = 0; +LCDViewAction MarlinUI::lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; + +bool MarlinUI::detected() { + return + #if (ENABLED(LCD_I2C_TYPE_MCP23017) || ENABLED(LCD_I2C_TYPE_MCP23008)) && defined(DETECT_DEVICE) + lcd.LcdDetected() == 1 + #else + true + #endif + ; +} + +void MarlinUI::update() { + + static uint16_t max_display_update_time = 0; + static millis_t next_lcd_update_ms; + + #if HAS_LCD_MENU + + #if LCD_TIMEOUT_TO_STATUS + static millis_t return_to_status_ms = 0; + #endif // Handle any queued Move Axis motion manage_manual_move(); - // Update button states for LCD_CLICKED, etc. - // After state changes the next button update - // may be delayed 300-500ms. - lcd_buttons_update(); - - #if ENABLED(AUTO_BED_LEVELING_UBL) - // Don't run the debouncer if UBL owns the display - #define UBL_CONDITION !lcd_external_control - #else - #define UBL_CONDITION true - #endif + // Update button states for button_pressed(), etc. + // If the state changes the next update may be delayed 300-500ms. + update_buttons(); // If the action button is pressed... - if (UBL_CONDITION && LCD_CLICKED) { - if (!wait_for_unclick) { // If not waiting for a debounce release: - wait_for_unclick = true; // Set debounce flag to ignore continous clicks - lcd_clicked = !wait_for_user && !no_reentry; // Keep the click if not waiting for a user-click - wait_for_user = false; // Any click clears wait for user - lcd_quick_feedback(true); // Always make a click sound + static bool wait_for_unclick; // = 0 + if (!external_control && button_pressed()) { + if (!wait_for_unclick) { // If not waiting for a debounce release: + wait_for_unclick = true; // - Set debounce flag to ignore continous clicks + lcd_clicked = !wait_for_user && !no_reentry; // - Keep the click if not waiting for a user-click + wait_for_user = false; // - Any click clears wait for user + quick_feedback(); // - Always make a click sound } } else wait_for_unclick = false; - #if BUTTON_EXISTS(BACK) - if (LCD_BACK_CLICKED) { - lcd_quick_feedback(true); - lcd_goto_previous_menu(); + #if HAS_DIGITAL_BUTTONS && BUTTON_EXISTS(BACK) + if (LCD_BACK_CLICKED()) { + quick_feedback(); + goto_previous_screen(); } #endif - #endif // ULTIPANEL + #endif // HAS_LCD_MENU #if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT) - const uint8_t sd_status = (uint8_t)IS_SD_INSERTED; - if (sd_status != lcd_sd_status && lcd_detected()) { + const uint8_t sd_status = (uint8_t)IS_SD_INSERTED(); + if (sd_status != lcd_sd_status && detected()) { uint8_t old_sd_status = lcd_sd_status; // prevent re-entry to this block! lcd_sd_status = sd_status; @@ -5409,33 +697,22 @@ void lcd_update() { if (old_sd_status == 2) card.beginautostart(); // Initial boot else - LCD_MESSAGEPGM(MSG_SD_INSERTED); + set_status_P(PSTR(MSG_SD_INSERTED)); } else { card.release(); - if (old_sd_status != 2) LCD_MESSAGEPGM(MSG_SD_REMOVED); + if (old_sd_status != 2) set_status_P(PSTR(MSG_SD_REMOVED)); } - lcd_refresh(); - lcd_implementation_init( // to maybe revive the LCD if static electricity killed it. - #if ENABLED(LCD_PROGRESS_BAR) - currentScreen == lcd_status_screen ? CHARSET_INFO : CHARSET_MENU - #endif - ); + refresh(); + init_lcd(); // May revive the LCD if static electricity killed it } #endif // SDSUPPORT && SD_DETECT_PIN - #if ENABLED(POWER_LOSS_RECOVERY) - if (job_recovery_commands_count && job_recovery_phase == JOB_RECOVERY_IDLE) { - lcd_goto_screen(lcd_job_recovery_menu); - job_recovery_phase = JOB_RECOVERY_MAYBE; // Waiting for a response - } - #endif - const millis_t ms = millis(); if (ELAPSED(ms, next_lcd_update_ms) - #if ENABLED(DOGLCD) + #if HAS_GRAPHICAL_LCD || drawing_screen #endif ) { @@ -5443,40 +720,41 @@ void lcd_update() { next_lcd_update_ms = ms + LCD_UPDATE_INTERVAL; #if ENABLED(LCD_HAS_STATUS_INDICATORS) - lcd_implementation_update_indicators(); + update_indicators(); #endif - #if ENABLED(ULTIPANEL) + #if HAS_ENCODER_ACTION - #if ENABLED(LCD_HAS_SLOW_BUTTONS) - slow_buttons = lcd_implementation_read_slow_buttons(); // buttons which take too long to read in interrupt context + #if HAS_SLOW_BUTTONS + slow_buttons = read_slow_buttons(); // Buttons that take too long to read in interrupt context #endif - #if ENABLED(ADC_KEYPAD) + #if ENABLED(REPRAPWORLD_KEYPAD) - if (handle_adc_keypad()) - return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS; - - #elif ENABLED(REPRAPWORLD_KEYPAD) - - handle_reprapworld_keypad(); + if (handle_keypad()) { + #if HAS_LCD_MENU && LCD_TIMEOUT_TO_STATUS + return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS; + #endif + } #endif - const bool encoderPastThreshold = (ABS(encoderDiff) >= ENCODER_PULSES_PER_STEP); + const float abs_diff = ABS(encoderDiff); + const bool encoderPastThreshold = (abs_diff >= (ENCODER_PULSES_PER_STEP)); if (encoderPastThreshold || lcd_clicked) { if (encoderPastThreshold) { - int32_t encoderMultiplier = 1; - #if ENABLED(ENCODER_RATE_MULTIPLIER) + #if HAS_LCD_MENU && ENABLED(ENCODER_RATE_MULTIPLIER) + + int32_t encoderMultiplier = 1; if (encoderRateMultiplierEnabled) { - int32_t encoderMovementSteps = ABS(encoderDiff) / ENCODER_PULSES_PER_STEP; + const float encoderMovementSteps = abs_diff / (ENCODER_PULSES_PER_STEP); if (lastEncoderMovementMillis) { // Note that the rate is always calculated between two passes through the // loop and that the abs of the encoderDiff value is tracked. - float encoderStepRate = float(encoderMovementSteps) / float(ms - lastEncoderMovementMillis) * 1000; + const float encoderStepRate = encoderMovementSteps / float(ms - lastEncoderMovementMillis) * 1000; if (encoderStepRate >= ENCODER_100X_STEPS_PER_SEC) encoderMultiplier = 100; else if (encoderStepRate >= ENCODER_10X_STEPS_PER_SEC) encoderMultiplier = 10; @@ -5488,104 +766,95 @@ void lcd_update() { SERIAL_ECHOPAIR(" ENCODER_10X_STEPS_PER_SEC: ", ENCODER_10X_STEPS_PER_SEC); SERIAL_ECHOPAIR(" ENCODER_100X_STEPS_PER_SEC: ", ENCODER_100X_STEPS_PER_SEC); SERIAL_EOL(); - #endif // ENCODER_RATE_MULTIPLIER_DEBUG + #endif } lastEncoderMovementMillis = ms; } // encoderRateMultiplierEnabled + + #else + + constexpr int32_t encoderMultiplier = 1; + #endif // ENCODER_RATE_MULTIPLIER - encoderPosition += (encoderDiff * encoderMultiplier) / ENCODER_PULSES_PER_STEP; + encoderPosition += (encoderDiff * encoderMultiplier) / (ENCODER_PULSES_PER_STEP); encoderDiff = 0; } - return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS; - lcdDrawUpdate = LCDVIEW_REDRAW_NOW; + #if HAS_LCD_MENU && LCD_TIMEOUT_TO_STATUS + return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS; + #endif + refresh(LCDVIEW_REDRAW_NOW); } - #endif // ULTIPANEL - // We arrive here every ~100ms when idling often enough. - // Instead of tracking the changes simply redraw the Info Screen ~1 time a second. - if ( - #if ENABLED(ULTIPANEL) - currentScreen == lcd_status_screen && - #endif - !lcd_status_update_delay-- - ) { + #endif + + // This runs every ~100ms when idling often enough. + // Instead of tracking changes just redraw the Status Screen once per second. + if (on_status_screen() && !lcd_status_update_delay--) { lcd_status_update_delay = 9 - #if ENABLED(DOGLCD) + #if HAS_GRAPHICAL_LCD + 3 #endif ; max_display_update_time--; - lcdDrawUpdate = LCDVIEW_REDRAW_NOW; + refresh(LCDVIEW_REDRAW_NOW); } - #if ENABLED(ULTIPANEL) && ENABLED(SCROLL_LONG_FILENAMES) + #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 == lcd_sdcard_menu && filename_scroll_pos < filename_scroll_max && !lcd_status_update_delay--) { + if (currentScreen == menu_sdcard && filename_scroll_pos < filename_scroll_max && !lcd_status_update_delay--) { lcd_status_update_delay = 6; - lcdDrawUpdate = LCDVIEW_REDRAW_NOW; + refresh(LCDVIEW_REDRAW_NOW); filename_scroll_pos++; - return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS; + #if LCD_TIMEOUT_TO_STATUS + return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS; + #endif } #endif // then we want to use 1/2 of the time only. uint16_t bbr2 = planner.block_buffer_runtime() >> 1; - #if ENABLED(DOGLCD) - #define IS_DRAWING drawing_screen - #else - #define IS_DRAWING false - #endif - - if ((lcdDrawUpdate || IS_DRAWING) && (!bbr2 || bbr2 > max_display_update_time)) { + if ((should_draw() || drawing_screen) && (!bbr2 || bbr2 > max_display_update_time)) { // Change state of drawing flag between screen updates - if (!IS_DRAWING) switch (lcdDrawUpdate) { + if (!drawing_screen) switch (lcdDrawUpdate) { case LCDVIEW_CALL_NO_REDRAW: - lcdDrawUpdate = LCDVIEW_NONE; + refresh(LCDVIEW_NONE); break; case LCDVIEW_CLEAR_CALL_REDRAW: case LCDVIEW_CALL_REDRAW_NEXT: - lcdDrawUpdate = LCDVIEW_REDRAW_NOW; + refresh(LCDVIEW_REDRAW_NOW); case LCDVIEW_REDRAW_NOW: // set above, or by a handler through LCDVIEW_CALL_REDRAW_NEXT case LCDVIEW_NONE: break; } // switch - #if ENABLED(ADC_KEYPAD) - buttons_reprapworld_keypad = 0; + #if HAS_ADC_BUTTONS + keypad_buttons = 0; #endif - #if ENABLED(ULTIPANEL) - #define CURRENTSCREEN() (*currentScreen)() - #else - #define CURRENTSCREEN() lcd_status_screen() - #endif + #if HAS_GRAPHICAL_LCD - #if ENABLED(DOGLCD) #if ENABLED(LIGHTWEIGHT_UI) - #if ENABLED(ULTIPANEL) - const bool in_status = currentScreen == lcd_status_screen; - #else - constexpr bool in_status = true; - #endif - const bool do_u8g_loop = !in_status; + const bool in_status = on_status_screen(), + do_u8g_loop = !in_status; lcd_in_status(in_status); - if (in_status) lcd_status_screen(); + if (in_status) status_screen(); #else constexpr bool do_u8g_loop = true; #endif + if (do_u8g_loop) { - if (!drawing_screen) { // If not already drawing pages - u8g.firstPage(); // Start the first page - drawing_screen = first_page = true; // Flag as drawing pages + if (!drawing_screen) { // If not already drawing pages + u8g.firstPage(); // Start the first page + drawing_screen = first_page = true; // Flag as drawing pages } - lcd_setFont(FONT_MENU); // Setup font for every page draw - u8g.setColorIndex(1); // And reset the color - CURRENTSCREEN(); // Draw and process the current screen + set_font(FONT_MENU); // Setup font for every page draw + u8g.setColorIndex(1); // And reset the color + run_current_screen(); // Draw and process the current screen first_page = false; // The screen handler can clear drawing_screen for an action that changes the screen. @@ -5596,11 +865,14 @@ void lcd_update() { return; } } + #else - CURRENTSCREEN(); + + run_current_screen(); + #endif - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU lcd_clicked = false; #endif @@ -5609,22 +881,20 @@ void lcd_update() { NOLESS(max_display_update_time, millis() - ms); } - #if ENABLED(ULTIPANEL) - + #if HAS_LCD_MENU && LCD_TIMEOUT_TO_STATUS // Return to Status Screen after a timeout - if (currentScreen == lcd_status_screen || defer_return_to_status) + if (on_status_screen() || defer_return_to_status) return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS; else if (ELAPSED(ms, return_to_status_ms)) - lcd_return_to_status(); - - #endif // ULTIPANEL + return_to_status(); + #endif // Change state of drawing flag between screen updates - if (!IS_DRAWING) switch (lcdDrawUpdate) { + if (!drawing_screen) switch (lcdDrawUpdate) { case LCDVIEW_CLEAR_CALL_REDRAW: - lcd_implementation_clear(); break; + clear_lcd(); break; case LCDVIEW_REDRAW_NOW: - lcdDrawUpdate = LCDVIEW_NONE; + refresh(LCDVIEW_NONE); case LCDVIEW_NONE: case LCDVIEW_CALL_REDRAW_NEXT: case LCDVIEW_CALL_NO_REDRAW: @@ -5634,303 +904,7 @@ void lcd_update() { } // ELAPSED(ms, next_lcd_update_ms) } -void lcd_finishstatus(const bool persist=false) { - - #if !(ENABLED(LCD_PROGRESS_BAR) && (PROGRESS_MSG_EXPIRE > 0)) - UNUSED(persist); - #endif - - #if ENABLED(LCD_PROGRESS_BAR) - progress_bar_ms = millis(); - #if PROGRESS_MSG_EXPIRE > 0 - expire_status_ms = persist ? 0 : progress_bar_ms + PROGRESS_MSG_EXPIRE; - #endif - #endif - lcd_refresh(); - - #if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT) - previous_lcd_status_ms = millis(); //get status message to show up for a while - #endif - - #if ENABLED(STATUS_MESSAGE_SCROLLING) - status_scroll_offset = 0; - #endif -} - -#if ENABLED(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0 - void dontExpireStatus() { expire_status_ms = 0; } -#endif - -bool lcd_hasstatus() { return (lcd_status_message[0] != '\0'); } - -void lcd_setstatus(const char * const message, const bool persist) { - if (lcd_status_message_level > 0) return; - - // Here we have a problem. The message is encoded in UTF8, so - // arbitrarily cutting it will be a problem. We MUST be sure - // that there is no cutting in the middle of a multibyte character! - - // Get a pointer to the null terminator - const char* pend = message + strlen(message); - - // If length of supplied UTF8 string is greater than - // our buffer size, start cutting whole UTF8 chars - while ((pend - message) > MAX_MESSAGE_LENGTH) { - --pend; - while (!START_OF_UTF8_CHAR(*pend)) --pend; - }; - - // At this point, we have the proper cut point. Use it - uint8_t maxLen = pend - message; - strncpy(lcd_status_message, message, maxLen); - lcd_status_message[maxLen] = '\0'; - - lcd_finishstatus(persist); -} - -void lcd_setstatusPGM(const char * const message, int8_t level) { - if (level < 0) level = lcd_status_message_level = 0; - if (level < lcd_status_message_level) return; - lcd_status_message_level = level; - - // Here we have a problem. The message is encoded in UTF8, so - // arbitrarily cutting it will be a problem. We MUST be sure - // that there is no cutting in the middle of a multibyte character! - - // Get a pointer to the null terminator - const char* pend = message + strlen_P(message); - - // If length of supplied UTF8 string is greater than - // our buffer size, start cutting whole UTF8 chars - while ((pend - message) > MAX_MESSAGE_LENGTH) { - --pend; - while (!START_OF_UTF8_CHAR(pgm_read_byte(pend))) --pend; - }; - - // At this point, we have the proper cut point. Use it - uint8_t maxLen = pend - message; - strncpy_P(lcd_status_message, message, maxLen); - lcd_status_message[maxLen] = '\0'; - - lcd_finishstatus(level > 0); -} - -void lcd_status_printf_P(const uint8_t level, const char * const fmt, ...) { - if (level < lcd_status_message_level) return; - lcd_status_message_level = level; - va_list args; - va_start(args, fmt); - vsnprintf_P(lcd_status_message, MAX_MESSAGE_LENGTH, fmt, args); - va_end(args); - lcd_finishstatus(level > 0); -} - -void lcd_setalertstatusPGM(const char * const message) { - lcd_setstatusPGM(message, 1); - #if ENABLED(ULTIPANEL) - lcd_return_to_status(); - #endif -} - -void lcd_reset_alert_level() { lcd_status_message_level = 0; } - -#if HAS_LCD_CONTRAST - - void set_lcd_contrast(const int16_t value) { - lcd_contrast = constrain(value, LCD_CONTRAST_MIN, LCD_CONTRAST_MAX); - u8g.setContrast(lcd_contrast); - } - -#endif - -#if ENABLED(ULTIPANEL) - - /** - * Setup Rotary Encoder Bit Values (for two pin encoders to indicate movement) - * These values are independent of which pins are used for EN_A and EN_B indications - * The rotary encoder part is also independent to the chipset used for the LCD - */ - #if defined(EN_A) && defined(EN_B) - #define encrot0 0 - #define encrot1 2 - #define encrot2 3 - #define encrot3 1 - #endif - - #define GET_SHIFT_BUTTON_STATES(DST) \ - uint8_t new_##DST = 0; \ - WRITE(SHIFT_LD, LOW); \ - WRITE(SHIFT_LD, HIGH); \ - for (int8_t i = 0; i < 8; i++) { \ - new_##DST >>= 1; \ - if (READ(SHIFT_OUT)) SBI(new_##DST, 7); \ - WRITE(SHIFT_CLK, HIGH); \ - WRITE(SHIFT_CLK, LOW); \ - } \ - DST = ~new_##DST; //invert it, because a pressed switch produces a logical 0 - - - /** - * Read encoder buttons from the hardware registers - * Warning: This function is called from interrupt context! - */ - void lcd_buttons_update() { - static uint8_t lastEncoderBits; - const millis_t now = millis(); - if (ELAPSED(now, next_button_update_ms)) { - - #if ENABLED(NEWPANEL) - uint8_t newbutton = 0; - - #if BUTTON_EXISTS(EN1) - if (BUTTON_PRESSED(EN1)) newbutton |= EN_A; - #endif - #if BUTTON_EXISTS(EN2) - if (BUTTON_PRESSED(EN2)) newbutton |= EN_B; - #endif - #if BUTTON_EXISTS(ENC) - if (BUTTON_PRESSED(ENC)) newbutton |= EN_C; - #endif - #if BUTTON_EXISTS(BACK) - if (BUTTON_PRESSED(BACK)) newbutton |= EN_D; - #endif - - // - // Directional buttons - // - #if LCD_HAS_DIRECTIONAL_BUTTONS - - #if ENABLED(REVERSE_MENU_DIRECTION) - #define _ENCODER_UD_STEPS (ENCODER_STEPS_PER_MENU_ITEM * encoderDirection) - #else - #define _ENCODER_UD_STEPS ENCODER_STEPS_PER_MENU_ITEM - #endif - #if ENABLED(REVERSE_ENCODER_DIRECTION) - #define ENCODER_UD_STEPS _ENCODER_UD_STEPS - #define ENCODER_LR_PULSES ENCODER_PULSES_PER_STEP - #else - #define ENCODER_UD_STEPS -(_ENCODER_UD_STEPS) - #define ENCODER_LR_PULSES -(ENCODER_PULSES_PER_STEP) - #endif - - if (false) { - // for the else-ifs below - } - #if BUTTON_EXISTS(UP) - else if (BUTTON_PRESSED(UP)) { - encoderDiff = -(ENCODER_UD_STEPS); - next_button_update_ms = now + 300; - } - #endif - #if BUTTON_EXISTS(DWN) - else if (BUTTON_PRESSED(DWN)) { - encoderDiff = ENCODER_UD_STEPS; - next_button_update_ms = now + 300; - } - #endif - #if BUTTON_EXISTS(LFT) - else if (BUTTON_PRESSED(LFT)) { - encoderDiff = -(ENCODER_LR_PULSES); - next_button_update_ms = now + 300; - } - #endif - #if BUTTON_EXISTS(RT) - else if (BUTTON_PRESSED(RT)) { - encoderDiff = ENCODER_LR_PULSES; - next_button_update_ms = now + 300; - } - #endif - - #endif // LCD_HAS_DIRECTIONAL_BUTTONS - - buttons = newbutton; - #if ENABLED(LCD_HAS_SLOW_BUTTONS) - buttons |= slow_buttons; - #endif - - #if ENABLED(ADC_KEYPAD) - - uint8_t newbutton_reprapworld_keypad = 0; - buttons = 0; - if (buttons_reprapworld_keypad == 0) { - newbutton_reprapworld_keypad = get_ADC_keyValue(); - if (WITHIN(newbutton_reprapworld_keypad, 1, 8)) - buttons_reprapworld_keypad = _BV(newbutton_reprapworld_keypad - 1); - } - - #elif ENABLED(REPRAPWORLD_KEYPAD) - - GET_SHIFT_BUTTON_STATES(buttons_reprapworld_keypad); - - #endif - - #else // !NEWPANEL - - GET_SHIFT_BUTTON_STATES(buttons); - - #endif - - } // next_button_update_ms - - // Manage encoder rotation - #if ENABLED(REVERSE_MENU_DIRECTION) && ENABLED(REVERSE_ENCODER_DIRECTION) - #define ENCODER_DIFF_CW (encoderDiff -= encoderDirection) - #define ENCODER_DIFF_CCW (encoderDiff += encoderDirection) - #elif ENABLED(REVERSE_MENU_DIRECTION) - #define ENCODER_DIFF_CW (encoderDiff += encoderDirection) - #define ENCODER_DIFF_CCW (encoderDiff -= encoderDirection) - #elif ENABLED(REVERSE_ENCODER_DIRECTION) - #define ENCODER_DIFF_CW (encoderDiff--) - #define ENCODER_DIFF_CCW (encoderDiff++) - #else - #define ENCODER_DIFF_CW (encoderDiff++) - #define ENCODER_DIFF_CCW (encoderDiff--) - #endif - #define ENCODER_SPIN(_E1, _E2) switch (lastEncoderBits) { case _E1: ENCODER_DIFF_CW; break; case _E2: ENCODER_DIFF_CCW; } - - uint8_t enc = 0; - if (buttons & EN_A) enc |= B01; - if (buttons & EN_B) enc |= B10; - if (enc != lastEncoderBits) { - switch (enc) { - case encrot0: ENCODER_SPIN(encrot3, encrot1); break; - case encrot1: ENCODER_SPIN(encrot0, encrot2); break; - case encrot2: ENCODER_SPIN(encrot1, encrot3); break; - case encrot3: ENCODER_SPIN(encrot2, encrot0); break; - } - #if ENABLED(AUTO_BED_LEVELING_UBL) - if (lcd_external_control) { - ubl.encoder_diff = encoderDiff; // Make encoder rotation available to UBL G29 mesh editing. - encoderDiff = 0; // Hide the encoder event from the current screen handler. - } - #endif - lastEncoderBits = enc; - } - } - - #if (ENABLED(LCD_I2C_TYPE_MCP23017) || ENABLED(LCD_I2C_TYPE_MCP23008)) && ENABLED(DETECT_DEVICE) - bool lcd_detected() { return lcd.LcdDetected() == 1; } - #else - bool lcd_detected() { return true; } - #endif - - #if ENABLED(G26_MESH_VALIDATION) - void lcd_chirp() { - lcd_buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ); - } - #endif - - #if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(G26_MESH_VALIDATION) - bool is_lcd_clicked() { return LCD_CLICKED; } - void wait_for_release() { - while (is_lcd_clicked()) safe_delay(50); - safe_delay(50); - } - #endif - -#endif // ULTIPANEL - -#if ENABLED(ADC_KEYPAD) +#if HAS_ADC_BUTTONS typedef struct { uint16_t ADCKeyValueMin, ADCKeyValueMax; @@ -5939,22 +913,19 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; } static const _stADCKeypadTable_ stADCKeyTable[] PROGMEM = { // VALUE_MIN, VALUE_MAX, KEY - { 4000, 4096, BLEN_REPRAPWORLD_KEYPAD_F1 + 1 }, // F1 - { 4000, 4096, BLEN_REPRAPWORLD_KEYPAD_F2 + 1 }, // F2 - { 4000, 4096, BLEN_REPRAPWORLD_KEYPAD_F3 + 1 }, // F3 - { 300, 500, BLEN_REPRAPWORLD_KEYPAD_LEFT + 1 }, // LEFT - { 1900, 2200, BLEN_REPRAPWORLD_KEYPAD_RIGHT + 1 }, // RIGHT - { 570, 870, BLEN_REPRAPWORLD_KEYPAD_UP + 1 }, // UP - { 2670, 2870, BLEN_REPRAPWORLD_KEYPAD_DOWN + 1 }, // DOWN - { 1150, 1450, BLEN_REPRAPWORLD_KEYPAD_MIDDLE + 1 }, // ENTER + { 4000, 4096, 1 + BLEN_KEYPAD_F1 }, // F1 + { 4000, 4096, 1 + BLEN_KEYPAD_F2 }, // F2 + { 4000, 4096, 1 + BLEN_KEYPAD_F3 }, // F3 + { 300, 500, 1 + BLEN_KEYPAD_LEFT }, // LEFT + { 1900, 2200, 1 + BLEN_KEYPAD_RIGHT }, // RIGHT + { 570, 870, 1 + BLEN_KEYPAD_UP }, // UP + { 2670, 2870, 1 + BLEN_KEYPAD_DOWN }, // DOWN + { 1150, 1450, 1 + BLEN_KEYPAD_MIDDLE }, // ENTER }; uint8_t get_ADC_keyValue(void) { if (thermalManager.ADCKey_count >= 16) { const uint16_t currentkpADCValue = thermalManager.current_ADCKey_raw >> 2; - #if ENABLED(ADC_KEYPAD_DEBUG) - SERIAL_PROTOCOLLN(currentkpADCValue); - #endif thermalManager.current_ADCKey_raw = 0; thermalManager.ADCKey_count = 0; if (currentkpADCValue < 4000) @@ -5968,4 +939,316 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; } } #endif -#endif // ULTRA_LCD +#if HAS_ENCODER_ACTION + + #if DISABLED(ADC_KEYPAD) && (ENABLED(REPRAPWORLD_KEYPAD) || !HAS_DIGITAL_BUTTONS) + + /** + * Setup Rotary Encoder Bit Values (for two pin encoders to indicate movement) + * These values are independent of which pins are used for EN_A and EN_B indications + * The rotary encoder part is also independent to the chipset used for the LCD + */ + #define GET_SHIFT_BUTTON_STATES(DST) \ + uint8_t new_##DST = 0; \ + WRITE(SHIFT_LD, LOW); \ + WRITE(SHIFT_LD, HIGH); \ + for (int8_t i = 0; i < 8; i++) { \ + new_##DST >>= 1; \ + if (READ(SHIFT_OUT)) SBI(new_##DST, 7); \ + WRITE(SHIFT_CLK, HIGH); \ + WRITE(SHIFT_CLK, LOW); \ + } \ + DST = ~new_##DST; //invert it, because a pressed switch produces a logical 0 + + #endif + + /** + * Read encoder buttons from the hardware registers + * Warning: This function is called from interrupt context! + */ + void MarlinUI::update_buttons() { + const millis_t now = millis(); + if (ELAPSED(now, next_button_update_ms)) { + + #if HAS_DIGITAL_BUTTONS + + #if BUTTON_EXISTS(EN1) || BUTTON_EXISTS(EN2) || BUTTON_EXISTS(ENC) || BUTTON_EXISTS(BACK) + + uint8_t newbutton = 0; + + #if BUTTON_EXISTS(EN1) + if (BUTTON_PRESSED(EN1)) newbutton |= EN_A; + #endif + #if BUTTON_EXISTS(EN2) + if (BUTTON_PRESSED(EN2)) newbutton |= EN_B; + #endif + #if BUTTON_EXISTS(ENC) + if (BUTTON_PRESSED(ENC)) newbutton |= EN_C; + #endif + #if BUTTON_EXISTS(BACK) + if (BUTTON_PRESSED(BACK)) newbutton |= EN_D; + #endif + + #else + + constexpr uint8_t newbutton = 0; + + #endif + + // + // Directional buttons + // + #if BUTTON_EXISTS(UP) || BUTTON_EXISTS(DWN) || BUTTON_EXISTS(LFT) || BUTTON_EXISTS(RT) + + const int8_t pulses = (ENCODER_PULSES_PER_STEP) * encoderDirection; + + if (false) { + // for the else-ifs below + } + #if BUTTON_EXISTS(UP) + else if (BUTTON_PRESSED(UP)) { + encoderDiff = (ENCODER_STEPS_PER_MENU_ITEM) * pulses; + next_button_update_ms = now + 300; + } + #endif + #if BUTTON_EXISTS(DWN) + else if (BUTTON_PRESSED(DWN)) { + encoderDiff = -(ENCODER_STEPS_PER_MENU_ITEM) * pulses; + next_button_update_ms = now + 300; + } + #endif + #if BUTTON_EXISTS(LFT) + else if (BUTTON_PRESSED(LFT)) { + encoderDiff = -pulses; + next_button_update_ms = now + 300; + } + #endif + #if BUTTON_EXISTS(RT) + else if (BUTTON_PRESSED(RT)) { + encoderDiff = pulses; + next_button_update_ms = now + 300; + } + #endif + + #endif // UP || DWN || LFT || RT + + buttons = newbutton + #if HAS_SLOW_BUTTONS + | slow_buttons + #endif + ; + + #elif HAS_ADC_BUTTONS + + buttons = 0; + if (keypad_buttons == 0) { + const uint8_t b = get_ADC_keyValue(); + if (WITHIN(b, 1, 8)) keypad_buttons = _BV(b - 1); + } + + #endif + + #if HAS_SHIFT_ENCODER + + GET_SHIFT_BUTTON_STATES( + #if ENABLED(REPRAPWORLD_KEYPAD) + keypad_buttons + #else + buttons + #endif + ); + + #endif + + } // next_button_update_ms + + #if HAS_ENCODER_WHEEL + static uint8_t lastEncoderBits; + + #define encrot0 0 + #define encrot1 2 + #define encrot2 3 + #define encrot3 1 + + // Manage encoder rotation + #define ENCODER_SPIN(_E1, _E2) switch (lastEncoderBits) { case _E1: encoderDiff += encoderDirection; break; case _E2: encoderDiff -= encoderDirection; } + + uint8_t enc = 0; + if (buttons & EN_A) enc |= B01; + if (buttons & EN_B) enc |= B10; + if (enc != lastEncoderBits) { + switch (enc) { + case encrot0: ENCODER_SPIN(encrot3, encrot1); break; + case encrot1: ENCODER_SPIN(encrot0, encrot2); break; + case encrot2: ENCODER_SPIN(encrot1, encrot3); break; + case encrot3: ENCODER_SPIN(encrot2, encrot0); break; + } + if (external_control) { + #if ENABLED(AUTO_BED_LEVELING_UBL) + ubl.encoder_diff = encoderDiff; // Make encoder rotation available to UBL G29 mesh editing. + #endif + encoderDiff = 0; // Hide the encoder event from the current screen handler. + } + lastEncoderBits = enc; + } + + #endif // HAS_ENCODER_WHEEL + } + + #if HAS_SLOW_BUTTONS + + uint8_t MarlinUI::read_slow_buttons() { + #if ENABLED(LCD_I2C_TYPE_MCP23017) + // Reading these buttons this is likely to be too slow to call inside interrupt context + // so they are called during normal lcd_update + uint8_t slow_bits = lcd.readButtons() << B_I2C_BTN_OFFSET; + #if ENABLED(LCD_I2C_VIKI) + if ((slow_bits & (B_MI | B_RI)) && PENDING(millis(), next_button_update_ms)) // LCD clicked + slow_bits &= ~(B_MI | B_RI); // Disable LCD clicked buttons if screen is updated + #endif // LCD_I2C_VIKI + return slow_bits; + #endif // LCD_I2C_TYPE_MCP23017 + } + + #endif + +#endif // HAS_ENCODER_ACTION + +#endif // HAS_SPI_LCD + +#if HAS_SPI_LCD || ENABLED(EXTENSIBLE_UI) + + #if ENABLED(EXTENSIBLE_UI) + #include "extensible_ui/ui_api.h" + #endif + + //////////////////////////////////////////// + /////////////// Status Line //////////////// + //////////////////////////////////////////// + + void MarlinUI::finishstatus(const bool persist) { + + #if !(ENABLED(LCD_PROGRESS_BAR) && (PROGRESS_MSG_EXPIRE > 0)) + UNUSED(persist); + #endif + + #if ENABLED(LCD_PROGRESS_BAR) + progress_bar_ms = millis(); + #if PROGRESS_MSG_EXPIRE > 0 + expire_status_ms = persist ? 0 : progress_bar_ms + PROGRESS_MSG_EXPIRE; + #endif + #endif + + #if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT) + next_filament_display = millis() + 5000UL; // Show status message for 5s + #endif + + #if ENABLED(STATUS_MESSAGE_SCROLLING) + status_scroll_offset = 0; + #endif + + #if ENABLED(EXTENSIBLE_UI) + ExtUI::onStatusChanged(status_message); + #endif + + refresh(); + } + + bool MarlinUI::has_status() { return (status_message[0] != '\0'); } + + void MarlinUI::set_status(const char * const message, const bool persist) { + if (status_message_level > 0) return; + + // Here we have a problem. The message is encoded in UTF8, so + // arbitrarily cutting it will be a problem. We MUST be sure + // that there is no cutting in the middle of a multibyte character! + + // Get a pointer to the null terminator + const char* pend = message + strlen(message); + + // If length of supplied UTF8 string is greater than + // our buffer size, start cutting whole UTF8 chars + while ((pend - message) > MAX_MESSAGE_LENGTH) { + --pend; + while (!START_OF_UTF8_CHAR(*pend)) --pend; + }; + + // At this point, we have the proper cut point. Use it + uint8_t maxLen = pend - message; + strncpy(status_message, message, maxLen); + status_message[maxLen] = '\0'; + + finishstatus(persist); + } + + #include + + void MarlinUI::status_printf_P(const uint8_t level, PGM_P const fmt, ...) { + if (level < status_message_level) return; + status_message_level = level; + va_list args; + va_start(args, fmt); + vsnprintf_P(status_message, MAX_MESSAGE_LENGTH, fmt, args); + va_end(args); + finishstatus(level > 0); + } + + void MarlinUI::set_status_P(PGM_P const message, int8_t level) { + if (level < 0) level = status_message_level = 0; + if (level < status_message_level) return; + status_message_level = level; + + // Here we have a problem. The message is encoded in UTF8, so + // arbitrarily cutting it will be a problem. We MUST be sure + // that there is no cutting in the middle of a multibyte character! + + // Get a pointer to the null terminator + PGM_P pend = message + strlen_P(message); + + // If length of supplied UTF8 string is greater than + // our buffer size, start cutting whole UTF8 chars + while ((pend - message) > MAX_MESSAGE_LENGTH) { + --pend; + while (!START_OF_UTF8_CHAR(pgm_read_byte(pend))) --pend; + }; + + // At this point, we have the proper cut point. Use it + uint8_t maxLen = pend - message; + strncpy_P(status_message, message, maxLen); + status_message[maxLen] = '\0'; + + finishstatus(level > 0); + } + + void MarlinUI::set_alert_status_P(PGM_P const message) { + set_status_P(message, 1); + #if HAS_LCD_MENU + return_to_status(); + #endif + } + + #include "../module/printcounter.h" + + /** + * Reset the status message + */ + void MarlinUI::reset_status() { + static const char paused[] PROGMEM = MSG_PRINT_PAUSED; + static const char printing[] PROGMEM = MSG_PRINTING; + static const char welcome[] PROGMEM = WELCOME_MSG; + PGM_P msg; + if (print_job_timer.isPaused()) + msg = paused; + #if ENABLED(SDSUPPORT) + else if (IS_SD_PRINTING()) + return set_status(card.longest_filename(), true); + #endif + else if (print_job_timer.isRunning()) + msg = printing; + else + msg = welcome; + + set_status_P(msg, -1); + } + +#endif diff --git a/Marlin/src/lcd/ultralcd.h b/Marlin/src/lcd/ultralcd.h index 2cff09f0ed..54eb239b9d 100644 --- a/Marlin/src/lcd/ultralcd.h +++ b/Marlin/src/lcd/ultralcd.h @@ -19,25 +19,17 @@ * along with this program. If not, see . * */ - -#ifndef ULTRALCD_H -#define ULTRALCD_H +#pragma once #include "../inc/MarlinConfig.h" -#if ENABLED(ULTRA_LCD) || ENABLED(MALYAN_LCD) - void lcd_init(); - bool lcd_detected(); - void lcd_update(); - void lcd_setalertstatusPGM(const char* message); -#else - inline void lcd_init() {} - inline bool lcd_detected() { return true; } - inline void lcd_update() {} - inline void lcd_setalertstatusPGM(const char* message) { UNUSED(message); } +#if HAS_BUZZER + #include "../libs/buzzer.h" #endif -#if ENABLED(ULTRA_LCD) +#define HAS_ENCODER_ACTION (HAS_LCD_MENU || ENABLED(ULTIPANEL_FEEDMULTIPLY)) + +#if HAS_SPI_LCD #include "../Marlin.h" @@ -46,234 +38,494 @@ #include "../module/motion.h" // for active_extruder #endif - void lcd_return_to_status(); - bool lcd_hasstatus(); - void lcd_setstatus(const char* message, const bool persist=false); - void lcd_setstatusPGM(const char* message, const int8_t level=0); - void lcd_setalertstatusPGM(const char* message); - void lcd_reset_alert_level(); - void lcd_reset_status(); - void lcd_status_printf_P(const uint8_t level, const char * const fmt, ...); - void lcd_kill_screen(); - void kill_screen(const char* lcd_msg); + enum LCDViewAction : uint8_t { + LCDVIEW_NONE, + LCDVIEW_REDRAW_NOW, + LCDVIEW_CALL_REDRAW_NEXT, + LCDVIEW_CLEAR_CALL_REDRAW, + LCDVIEW_CALL_NO_REDRAW + }; - extern uint8_t lcdDrawUpdate; - inline void lcd_refresh() { lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; } - - #if HAS_BUZZER - void lcd_buzz(const long duration, const uint16_t freq); - #endif - - void lcd_quick_feedback(const bool clear_buttons); // Audible feedback for a button click - could also be visual - - #if ENABLED(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0 - void dontExpireStatus(); - #endif - - #if ENABLED(LCD_SET_PROGRESS_MANUALLY) - extern uint8_t progress_bar_percent; - #endif - - #if ENABLED(ADC_KEYPAD) + #if HAS_ADC_BUTTONS uint8_t get_ADC_keyValue(); #endif - #if ENABLED(DOGLCD) - extern int16_t lcd_contrast; - void set_lcd_contrast(const int16_t value); - #endif - - #if ENABLED(SHOW_BOOTSCREEN) - void lcd_bootscreen(); + #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)) + #else + #define SETCURSOR(col, row) lcd_moveto(col, row) + #define SETCURSOR_RJ(len, row) lcd_moveto(LCD_WIDTH - len, row) #endif #define LCD_UPDATE_INTERVAL 100 - #define BUTTON_EXISTS(BN) (defined(BTN_## BN) && BTN_## BN >= 0) - #define BUTTON_PRESSED(BN) !READ(BTN_## BN) - #if ENABLED(ULTIPANEL) // LCD with a click-wheel input + #if HAS_LCD_MENU - extern bool defer_return_to_status; + #if ENABLED(SDSUPPORT) + #include "../sd/cardreader.h" + #endif - // Function pointer to menu functions. typedef void (*screenFunc_t)(); typedef void (*menuAction_t)(); - extern int16_t lcd_preheat_hotend_temp[2], lcd_preheat_bed_temp[2], lcd_preheat_fan_speed[2]; - - #if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(G26_MESH_VALIDATION) - extern bool lcd_external_control; - #else - constexpr bool lcd_external_control = false; - #endif - - #if ENABLED(LCD_BED_LEVELING) - extern bool lcd_wait_for_move; - #else - constexpr bool lcd_wait_for_move = false; - #endif - - void lcd_goto_screen(screenFunc_t screen, const uint32_t encoder=0); - - void lcd_completion_feedback(const bool good=true); + // Manual Movement + constexpr float manual_feedrate_mm_m[XYZE] = MANUAL_FEEDRATE; + extern float move_menu_scale; #if ENABLED(ADVANCED_PAUSE_FEATURE) void lcd_advanced_pause_show_message(const AdvancedPauseMessage message, - const AdvancedPauseMode mode=ADVANCED_PAUSE_MODE_PAUSE_PRINT, + const AdvancedPauseMode mode=ADVANCED_PAUSE_MODE_SAME, const uint8_t extruder=active_extruder); #endif - #if ENABLED(G26_MESH_VALIDATION) - void lcd_chirp(); - #endif - #if ENABLED(AUTO_BED_LEVELING_UBL) void lcd_mesh_edit_setup(const float &initial); float lcd_mesh_edit(); - void lcd_z_offset_edit_setup(const float &initial); - float lcd_z_offset_edit(); #endif - #endif - - #if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT) - extern millis_t previous_lcd_status_ms; - #endif - - bool lcd_blink(); - - #if ENABLED(REPRAPWORLD_KEYPAD) // is also ULTIPANEL and NEWPANEL - - #define REPRAPWORLD_BTN_OFFSET 0 // bit offset into buttons for shift register values - - #define BLEN_REPRAPWORLD_KEYPAD_F3 0 - #define BLEN_REPRAPWORLD_KEYPAD_F2 1 - #define BLEN_REPRAPWORLD_KEYPAD_F1 2 - #define BLEN_REPRAPWORLD_KEYPAD_DOWN 3 - #define BLEN_REPRAPWORLD_KEYPAD_RIGHT 4 - #define BLEN_REPRAPWORLD_KEYPAD_MIDDLE 5 - #define BLEN_REPRAPWORLD_KEYPAD_UP 6 - #define BLEN_REPRAPWORLD_KEYPAD_LEFT 7 - - #define EN_REPRAPWORLD_KEYPAD_F3 (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_F3)) - #define EN_REPRAPWORLD_KEYPAD_F2 (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_F2)) - #define EN_REPRAPWORLD_KEYPAD_F1 (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_F1)) - #define EN_REPRAPWORLD_KEYPAD_DOWN (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_DOWN)) - #define EN_REPRAPWORLD_KEYPAD_RIGHT (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_RIGHT)) - #define EN_REPRAPWORLD_KEYPAD_MIDDLE (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_MIDDLE)) - #define EN_REPRAPWORLD_KEYPAD_UP (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_UP)) - #define EN_REPRAPWORLD_KEYPAD_LEFT (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_LEFT)) - - #define REPRAPWORLD_KEYPAD_MOVE_Z_DOWN (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_F3) - #define REPRAPWORLD_KEYPAD_MOVE_Z_UP (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_F2) - #define REPRAPWORLD_KEYPAD_MOVE_Y_DOWN (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_DOWN) - #define REPRAPWORLD_KEYPAD_MOVE_X_RIGHT (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_RIGHT) - #define REPRAPWORLD_KEYPAD_MOVE_Y_UP (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_UP) - #define REPRAPWORLD_KEYPAD_MOVE_X_LEFT (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_LEFT) - - #if ENABLED(ADC_KEYPAD) - #define KEYPAD_HOME EN_REPRAPWORLD_KEYPAD_F1 - #define KEYPAD_EN_C EN_REPRAPWORLD_KEYPAD_MIDDLE - #else - #define KEYPAD_HOME EN_REPRAPWORLD_KEYPAD_MIDDLE - #define KEYPAD_EN_C EN_REPRAPWORLD_KEYPAD_F1 - #endif - #define REPRAPWORLD_KEYPAD_MOVE_HOME (buttons_reprapworld_keypad & KEYPAD_HOME) - #define REPRAPWORLD_KEYPAD_MOVE_MENU (buttons_reprapworld_keypad & KEYPAD_EN_C) - - #define REPRAPWORLD_KEYPAD_PRESSED (buttons_reprapworld_keypad & ( \ - EN_REPRAPWORLD_KEYPAD_F3 | \ - EN_REPRAPWORLD_KEYPAD_F2 | \ - EN_REPRAPWORLD_KEYPAD_F1 | \ - EN_REPRAPWORLD_KEYPAD_DOWN | \ - EN_REPRAPWORLD_KEYPAD_RIGHT | \ - EN_REPRAPWORLD_KEYPAD_MIDDLE | \ - EN_REPRAPWORLD_KEYPAD_UP | \ - EN_REPRAPWORLD_KEYPAD_LEFT) \ - ) - - #endif - - #if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(G26_MESH_VALIDATION) - bool is_lcd_clicked(); - void wait_for_release(); - #endif - -#else // MALYAN_LCD or no LCD - - constexpr bool lcd_wait_for_move = false; - - inline void lcd_refresh() {} - inline bool lcd_hasstatus() { return false; } - inline void lcd_setstatus(const char* const message, const bool persist=false) { UNUSED(message); UNUSED(persist); } - inline void lcd_setstatusPGM(const char* const message, const int8_t level=0) { UNUSED(message); UNUSED(level); } - inline void lcd_status_printf_P(const uint8_t level, const char * const fmt, ...) { UNUSED(level); UNUSED(fmt); } - inline void lcd_reset_alert_level() {} - inline void lcd_reset_status() {} - -#endif // ULTRA_LCD - -#if ENABLED(ULTIPANEL) - - #if ENABLED(NEWPANEL) // Uses digital switches, not a shift register - - // Wheel spin pins where BA is 00, 10, 11, 01 (1 bit always changes) - #define BLEN_A 0 - #define BLEN_B 1 - - #define EN_A _BV(BLEN_A) - #define EN_B _BV(BLEN_B) - - #if BUTTON_EXISTS(ENC) - #define BLEN_C 2 - #define EN_C _BV(BLEN_C) - #endif - - #if BUTTON_EXISTS(BACK) - #define BLEN_D 3 - #define EN_D _BV(BLEN_D) - #define LCD_BACK_CLICKED (buttons & EN_D) - #endif - - #endif // NEWPANEL - - extern volatile uint8_t buttons; // The last-checked buttons in a bit array. - void lcd_buttons_update(); - -#else - - inline void lcd_buttons_update() {} + #endif // HAS_LCD_MENU #endif +// REPRAPWORLD_KEYPAD (and ADC_KEYPAD) #if ENABLED(REPRAPWORLD_KEYPAD) + #define BTN_OFFSET 0 // Bit offset into buttons for shift register values + + #define BLEN_KEYPAD_F3 0 + #define BLEN_KEYPAD_F2 1 + #define BLEN_KEYPAD_F1 2 + #define BLEN_KEYPAD_DOWN 3 + #define BLEN_KEYPAD_RIGHT 4 + #define BLEN_KEYPAD_MIDDLE 5 + #define BLEN_KEYPAD_UP 6 + #define BLEN_KEYPAD_LEFT 7 + + #define EN_KEYPAD_F1 _BV(BTN_OFFSET + BLEN_KEYPAD_F1) + #define EN_KEYPAD_F2 _BV(BTN_OFFSET + BLEN_KEYPAD_F2) + #define EN_KEYPAD_F3 _BV(BTN_OFFSET + BLEN_KEYPAD_F3) + #define EN_KEYPAD_DOWN _BV(BTN_OFFSET + BLEN_KEYPAD_DOWN) + #define EN_KEYPAD_RIGHT _BV(BTN_OFFSET + BLEN_KEYPAD_RIGHT) + #define EN_KEYPAD_MIDDLE _BV(BTN_OFFSET + BLEN_KEYPAD_MIDDLE) + #define EN_KEYPAD_UP _BV(BTN_OFFSET + BLEN_KEYPAD_UP) + #define EN_KEYPAD_LEFT _BV(BTN_OFFSET + BLEN_KEYPAD_LEFT) + + #define RRK(B) (keypad_buttons & (B)) + #ifdef EN_C - #define LCD_CLICKED ((buttons & EN_C) || REPRAPWORLD_KEYPAD_MOVE_MENU) + #define BUTTON_CLICK() ((buttons & EN_C) || RRK(EN_KEYPAD_MIDDLE)) #else - #define LCD_CLICKED REPRAPWORLD_KEYPAD_MOVE_MENU + #define BUTTON_CLICK() RRK(EN_KEYPAD_MIDDLE) #endif -#elif defined(EN_C) - #define LCD_CLICKED (buttons & EN_C) + +#endif + +#if HAS_DIGITAL_BUTTONS + + // Wheel spin pins where BA is 00, 10, 11, 01 (1 bit always changes) + #define BLEN_A 0 + #define BLEN_B 1 + + #define EN_A _BV(BLEN_A) + #define EN_B _BV(BLEN_B) + + #define BUTTON_EXISTS(BN) (defined(BTN_## BN) && BTN_## BN >= 0) + #define BUTTON_PRESSED(BN) !READ(BTN_## BN) + + #if BUTTON_EXISTS(ENC) + #define BLEN_C 2 + #define EN_C _BV(BLEN_C) + #endif + + #if ENABLED(LCD_I2C_VIKI) + + #define B_I2C_BTN_OFFSET 3 // (the first three bit positions reserved for EN_A, EN_B, EN_C) + + // button and encoder bit positions within 'buttons' + #define B_LE (BUTTON_LEFT << B_I2C_BTN_OFFSET) // The remaining normalized buttons are all read via I2C + #define B_UP (BUTTON_UP << B_I2C_BTN_OFFSET) + #define B_MI (BUTTON_SELECT << B_I2C_BTN_OFFSET) + #define B_DW (BUTTON_DOWN << B_I2C_BTN_OFFSET) + #define B_RI (BUTTON_RIGHT << B_I2C_BTN_OFFSET) + + #if BUTTON_EXISTS(ENC) // The pause/stop/restart button is connected to BTN_ENC when used + #define B_ST (EN_C) // Map the pause/stop/resume button into its normalized functional name + #define BUTTON_CLICK() (buttons & (B_MI|B_RI|B_ST)) // Pause/stop also acts as click until a proper pause/stop is implemented. + #else + #define BUTTON_CLICK() (buttons & (B_MI|B_RI)) + #endif + + // I2C buttons take too long to read inside an interrupt context and so we read them during lcd_update + + #elif ENABLED(LCD_I2C_PANELOLU2) + + #if !BUTTON_EXISTS(ENC) // Use I2C if not directly connected to a pin + + #define B_I2C_BTN_OFFSET 3 // (the first three bit positions reserved for EN_A, EN_B, EN_C) + + #define B_MI (PANELOLU2_ENCODER_C << B_I2C_BTN_OFFSET) // requires LiquidTWI2 library v1.2.3 or later + + #define BUTTON_CLICK() (buttons & B_MI) + + #endif + + #endif + #else - #define LCD_CLICKED false + + #define BUTTON_EXISTS(BN) false + + // Shift register bits correspond to buttons: + #define BL_LE 7 // Left + #define BL_UP 6 // Up + #define BL_MI 5 // Middle + #define BL_DW 4 // Down + #define BL_RI 3 // Right + #define BL_ST 2 // Red Button + #define B_LE (_BV(BL_LE)) + #define B_UP (_BV(BL_UP)) + #define B_MI (_BV(BL_MI)) + #define B_DW (_BV(BL_DW)) + #define B_RI (_BV(BL_RI)) + #define B_ST (_BV(BL_ST)) + + #ifndef BUTTON_CLICK + #define BUTTON_CLICK() (buttons & (B_MI|B_ST)) + #endif + #endif -#define LCD_MESSAGEPGM(x) lcd_setstatusPGM(PSTR(x)) -#define LCD_ALERTMESSAGEPGM(x) lcd_setalertstatusPGM(PSTR(x)) - -// For i2c define BUZZ to use lcd_buzz -#if ENABLED(LCD_USE_I2C_BUZZER) - #define BUZZ(d,f) lcd_buzz(d, f) -#endif - -#if ENABLED(SD_REPRINT_LAST_SELECTED_FILE) - void lcd_reselect_last_file(); -#endif - -#if ENABLED(ULTIPANEL) && ENABLED(SDSUPPORT) - extern bool abort_sd_printing; +#if BUTTON_EXISTS(BACK) + #define BLEN_D 3 + #define EN_D _BV(BLEN_D) + #define LCD_BACK_CLICKED() (buttons & EN_D) #else - constexpr bool abort_sd_printing = false; + #define LCD_BACK_CLICKED() false #endif -#endif // ULTRALCD_H +#ifndef BUTTON_CLICK + #ifdef EN_C + #define BUTTON_CLICK() (buttons & EN_C) + #else + #define BUTTON_CLICK() false + #endif +#endif + +#if HAS_GRAPHICAL_LCD + enum MarlinFont : uint8_t { + FONT_STATUSMENU = 1, + FONT_EDIT, + FONT_MENU + }; +#else + enum HD44780CharSet : uint8_t { + CHARSET_MENU, + CHARSET_INFO, + CHARSET_BOOT + }; +#endif + +//////////////////////////////////////////// +//////////// MarlinUI Singleton //////////// +//////////////////////////////////////////// + +class MarlinUI { +public: + + MarlinUI() { + #if HAS_LCD_MENU + currentScreen = status_screen; + #endif + } + + static inline void buzz(const long duration, const uint16_t freq) { + #if ENABLED(LCD_USE_I2C_BUZZER) + lcd.buzz(duration, freq); + #elif PIN_EXISTS(BEEPER) + buzzer.tone(duration, freq); + #else + UNUSED(duration); UNUSED(freq); + #endif + } + + // LCD implementations + static void clear_lcd(); + static void init_lcd(); + + #if HAS_SPI_LCD || ENABLED(MALYAN_LCD) || ENABLED(EXTENSIBLE_UI) + static void init(); + static void update(); + static void set_alert_status_P(PGM_P message); + #else // NO LCD + static inline void init() {} + static inline void update() {} + static inline void set_alert_status_P(PGM_P message) { UNUSED(message); } + #endif + + #if HAS_SPI_LCD || ENABLED(EXTENSIBLE_UI) + + static char status_message[]; + static bool has_status(); + + + static uint8_t status_message_level; // Higher levels block lower levels + static inline void reset_alert_level() { status_message_level = 0; } + + #if HAS_SPI_LCD + + static bool detected(); + + static LCDViewAction lcdDrawUpdate; + static inline bool should_draw() { return bool(lcdDrawUpdate); } + static inline void refresh(const LCDViewAction type) { lcdDrawUpdate = type; } + static inline void refresh() { refresh(LCDVIEW_CLEAR_CALL_REDRAW); } + + #if ENABLED(SHOW_BOOTSCREEN) + static void show_bootscreen(); + #endif + + #if HAS_GRAPHICAL_LCD + + static bool drawing_screen, first_page; + + static void set_font(const MarlinFont font_nr); + + #else + + static constexpr bool drawing_screen = false, first_page = true; + + static void set_custom_characters(const HD44780CharSet screen_charset=CHARSET_INFO); + + #if ENABLED(LCD_PROGRESS_BAR) + static millis_t progress_bar_ms; // Start time for the current progress bar cycle + static void draw_progress_bar(const uint8_t percent); + #if PROGRESS_MSG_EXPIRE > 0 + static millis_t MarlinUI::expire_status_ms; // = 0 + static inline void reset_progress_bar_timeout() { expire_status_ms = 0; } + #endif + #endif + + #endif + + #if ENABLED(STATUS_MESSAGE_SCROLLING) + static uint8_t status_scroll_offset; + #endif + static uint8_t lcd_status_update_delay; + + #if HAS_PRINT_PROGRESS + #if ENABLED(LCD_SET_PROGRESS_MANUALLY) + static uint8_t progress_bar_percent; + static void set_progress(const uint8_t progress) { progress_bar_percent = MIN(progress, 100); } + #endif + static uint8_t get_progress(); + #else + static constexpr uint8_t get_progress() { return 0; } + #endif + + #if HAS_LCD_CONTRAST + static int16_t contrast; + static void set_contrast(const int16_t value); + static inline void refresh_contrast() { set_contrast(contrast); } + #endif + + #if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT) + static millis_t next_filament_display; + #endif + + static void quick_feedback(const bool clear_buttons=true); + static void completion_feedback(const bool good=true); + + #if DISABLED(LIGHTWEIGHT_UI) + static void draw_status_message(const bool blink); + #endif + + #if ENABLED(ADVANCED_PAUSE_FEATURE) + static void draw_hotend_status(const uint8_t row, const uint8_t extruder); + #endif + + static void status_screen(); + + #else + static void refresh() {} + #endif + + static bool get_blink(); + static void kill_screen(PGM_P const lcd_msg); + static void draw_kill_screen(); + static void set_status(const char* const message, const bool persist=false); + static void set_status_P(PGM_P const message, const int8_t level=0); + static void status_printf_P(const uint8_t level, PGM_P const fmt, ...); + static void reset_status(); + + #else // MALYAN_LCD or NO LCD + + static inline void refresh() {} + static inline void set_status(const char* const message, const bool persist=false) { UNUSED(message); UNUSED(persist); } + static inline void set_status_P(PGM_P const message, const int8_t level=0) { UNUSED(message); UNUSED(level); } + static inline void status_printf_P(const uint8_t level, PGM_P const fmt, ...) { UNUSED(level); UNUSED(fmt); } + static inline void reset_status() {} + static inline void reset_alert_level() {} + static constexpr bool has_status() { return false; } + + #endif + + #if HAS_LCD_MENU + + #if ENABLED(ENCODER_RATE_MULTIPLIER) + static bool encoderRateMultiplierEnabled; + static millis_t lastEncoderMovementMillis; + static void enable_encoder_multiplier(const bool onoff); + #endif + + #if ENABLED(SDSUPPORT) + #if ENABLED(SCROLL_LONG_FILENAMES) + static uint8_t filename_scroll_pos, filename_scroll_max; + #endif + static const char * scrolled_filename(CardReader &theCard, const uint8_t maxlen, uint8_t hash, const bool doScroll); + #endif + + #if IS_KINEMATIC + static bool processing_manual_move; + #else + static constexpr bool processing_manual_move = false; + #endif + + #if E_MANUAL > 1 + static int8_t manual_move_e_index; + #else + static constexpr int8_t manual_move_e_index = 0; + #endif + + static int16_t preheat_hotend_temp[2], preheat_bed_temp[2]; + static uint8_t preheat_fan_speed[2]; + + static void manage_manual_move(); + + static bool lcd_clicked; + static bool use_click(); + + 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); + static void save_previous_screen(); + static void goto_previous_screen(); + static void return_to_status(); + static inline bool on_status_screen() { return currentScreen == status_screen; } + static inline void run_current_screen() { (*currentScreen)(); } + + #if ENABLED(LIGHTWEIGHT_UI) + static void lcd_in_status(const bool inStatus); + #endif + + static inline void defer_status_screen(const bool defer) { + #if LCD_TIMEOUT_TO_STATUS + defer_return_to_status = defer; + #else + UNUSED(defer); + #endif + } + + static inline void goto_previous_screen_no_defer() { + defer_status_screen(false); + goto_previous_screen(); + } + + #if ENABLED(SD_REPRINT_LAST_SELECTED_FILE) + static void reselect_last_file(); + #endif + + #if ENABLED(G26_MESH_VALIDATION) + static inline void chirp() { buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ); } + #endif + + #if ENABLED(AUTO_BED_LEVELING_UBL) + static void ubl_plot(const uint8_t x, const uint8_t inverted_y); + #endif + + #elif HAS_SPI_LCD + + static constexpr bool lcd_clicked = false; + static constexpr bool on_status_screen() { return true; } + static inline void run_current_screen() { status_screen(); } + + #endif + + #if ENABLED(LCD_BED_LEVELING) && (ENABLED(PROBE_MANUALLY) || ENABLED(MESH_BED_LEVELING)) + static bool wait_for_bl_move; + #else + static constexpr bool wait_for_bl_move = false; + #endif + + #if HAS_LCD_MENU && (ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(G26_MESH_VALIDATION)) + static bool external_control; + FORCE_INLINE static void capture() { external_control = true; } + FORCE_INLINE static void release() { external_control = false; } + #else + static constexpr bool external_control = false; + #endif + + #if HAS_ENCODER_ACTION + + static volatile uint8_t buttons; + #if ENABLED(REPRAPWORLD_KEYPAD) + static volatile uint8_t keypad_buttons; + static bool handle_keypad(); + #endif + #if HAS_SLOW_BUTTONS + static volatile uint8_t slow_buttons; + static uint8_t read_slow_buttons(); + #endif + static void update_buttons(); + static inline bool button_pressed() { return BUTTON_CLICK(); } + #if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(G26_MESH_VALIDATION) + static void wait_for_release(); + #endif + + static uint32_t encoderPosition; + + #if ENABLED(REVERSE_ENCODER_DIRECTION) + #define ENCODERBASE -1 + #else + #define ENCODERBASE +1 + #endif + #if ENABLED(REVERSE_MENU_DIRECTION) + static int8_t encoderDirection; + static inline void encoder_direction_normal() { encoderDirection = +(ENCODERBASE); } + static inline void encoder_direction_menus() { encoderDirection = -(ENCODERBASE); } + #else + static constexpr int8_t encoderDirection = ENCODERBASE; + static inline void encoder_direction_normal() {} + static inline void encoder_direction_menus() {} + #endif + + #else + + static inline void update_buttons() {} + + #endif + +private: + + static void _synchronize(); + + #if HAS_SPI_LCD || ENABLED(EXTENSIBLE_UI) + static void finishstatus(const bool persist); + #endif + + #if HAS_SPI_LCD + #if HAS_LCD_MENU + #if LCD_TIMEOUT_TO_STATUS + static bool defer_return_to_status; + #else + static constexpr bool defer_return_to_status = false; + #endif + #endif + static void draw_status_screen(); + #endif +}; + +extern MarlinUI ui; + +#define LCD_MESSAGEPGM(x) ui.set_status_P(PSTR(x)) +#define LCD_ALERTMESSAGEPGM(x) ui.set_alert_status_P(PSTR(x)) diff --git a/Marlin/src/lcd/ultralcd_common_HD44780.h b/Marlin/src/lcd/ultralcd_common_HD44780.h deleted file mode 100644 index 970dbbf35a..0000000000 --- a/Marlin/src/lcd/ultralcd_common_HD44780.h +++ /dev/null @@ -1,199 +0,0 @@ -/** - * 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 . - * - */ - -#ifndef ULTRALCD_COMMON_HD44780_H -#define ULTRALCD_COMMON_HD44780_H - -/** - * Implementation of the LCD display routines for a Hitachi HD44780 display. - * These are the most common LCD character displays. - */ - -#include "../inc/MarlinConfig.h" - -#if LCD_HEIGHT > 3 - #include "../libs/duration_t.h" -#endif - -#if ENABLED(AUTO_BED_LEVELING_UBL) - #include "../feature/bedlevel/ubl/ubl.h" - - #if ENABLED(ULTIPANEL) - #define ULTRA_X_PIXELS_PER_CHAR 5 - #define ULTRA_Y_PIXELS_PER_CHAR 8 - #define ULTRA_COLUMNS_FOR_MESH_MAP 7 - #define ULTRA_ROWS_FOR_MESH_MAP 4 - - #define N_USER_CHARS 8 - - #define TOP_LEFT _BV(0) - #define TOP_RIGHT _BV(1) - #define LOWER_LEFT _BV(2) - #define LOWER_RIGHT _BV(3) - #endif -#endif - -extern volatile uint8_t buttons; //an extended version of the last checked buttons in a bit array. - -//////////////////////////////////// -// Setup button and encode mappings for each panel (into 'buttons' variable -// -// This is just to map common functions (across different panels) onto the same -// macro name. The mapping is independent of whether the button is directly connected or -// via a shift/i2c register. - -#if ENABLED(ULTIPANEL) - - // - // Setup other button mappings of each panel - // - #if ENABLED(LCD_I2C_VIKI) - #define B_I2C_BTN_OFFSET 3 // (the first three bit positions reserved for EN_A, EN_B, EN_C) - - // button and encoder bit positions within 'buttons' - #define B_LE (BUTTON_LEFT << B_I2C_BTN_OFFSET) // The remaining normalized buttons are all read via I2C - #define B_UP (BUTTON_UP << B_I2C_BTN_OFFSET) - #define B_MI (BUTTON_SELECT << B_I2C_BTN_OFFSET) - #define B_DW (BUTTON_DOWN << B_I2C_BTN_OFFSET) - #define B_RI (BUTTON_RIGHT << B_I2C_BTN_OFFSET) - - #undef LCD_CLICKED - #if BUTTON_EXISTS(ENC) - // the pause/stop/restart button is connected to BTN_ENC when used - #define B_ST (EN_C) // Map the pause/stop/resume button into its normalized functional name - #define LCD_CLICKED (buttons & (B_MI|B_RI|B_ST)) // pause/stop button also acts as click until we implement proper pause/stop. - #else - #define LCD_CLICKED (buttons & (B_MI|B_RI)) - #endif - - // I2C buttons take too long to read inside an interrupt context and so we read them during lcd_update - #define LCD_HAS_SLOW_BUTTONS - - #elif ENABLED(LCD_I2C_PANELOLU2) - - #if !BUTTON_EXISTS(ENC) // Use I2C if not directly connected to a pin - - #define B_I2C_BTN_OFFSET 3 // (the first three bit positions reserved for EN_A, EN_B, EN_C) - - #define B_MI (PANELOLU2_ENCODER_C << B_I2C_BTN_OFFSET) // requires LiquidTWI2 library v1.2.3 or later - - #undef LCD_CLICKED - #define LCD_CLICKED (buttons & B_MI) - - // I2C buttons take too long to read inside an interrupt context and so we read them during lcd_update - #define LCD_HAS_SLOW_BUTTONS - - #endif - - #elif DISABLED(NEWPANEL) // old style ULTIPANEL - // Shift register bits correspond to buttons: - #define BL_LE 7 // Left - #define BL_UP 6 // Up - #define BL_MI 5 // Middle - #define BL_DW 4 // Down - #define BL_RI 3 // Right - #define BL_ST 2 // Red Button - #define B_LE (_BV(BL_LE)) - #define B_UP (_BV(BL_UP)) - #define B_MI (_BV(BL_MI)) - #define B_DW (_BV(BL_DW)) - #define B_RI (_BV(BL_RI)) - #define B_ST (_BV(BL_ST)) - #define LCD_CLICKED (buttons & (B_MI|B_ST)) - #endif - -#endif // ULTIPANEL - -//////////////////////////////////// -// Create LCD class instance and chipset-specific information -#if ENABLED(LCD_I2C_TYPE_PCF8575) - // NOTE: These are register-mapped pins on the PCF8575 controller, not Arduino pins. - #define LCD_I2C_PIN_BL 3 - #define LCD_I2C_PIN_EN 2 - #define LCD_I2C_PIN_RW 1 - #define LCD_I2C_PIN_RS 0 - #define LCD_I2C_PIN_D4 4 - #define LCD_I2C_PIN_D5 5 - #define LCD_I2C_PIN_D6 6 - #define LCD_I2C_PIN_D7 7 - - #include - #include - #include - #define LCD_CLASS LiquidCrystal_I2C - -#elif ENABLED(LCD_I2C_TYPE_MCP23017) - // For the LED indicators (which may be mapped to different events in lcd_implementation_update_indicators()) - #define LED_A 0x04 //100 - #define LED_B 0x02 //010 - #define LED_C 0x01 //001 - - #define LCD_HAS_STATUS_INDICATORS - - #include - #include - #define LCD_CLASS LiquidTWI2 - -#elif ENABLED(LCD_I2C_TYPE_MCP23008) - #include - #include - #define LCD_CLASS LiquidTWI2 - -#elif ENABLED(LCD_I2C_TYPE_PCA8574) - #include - #define LCD_CLASS LiquidCrystal_I2C - -// 2 wire Non-latching LCD SR from: -// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection -#elif ENABLED(SR_LCD_2W_NL) - extern "C" void __cxa_pure_virtual() { while (1); } - #include - #include - #define LCD_CLASS LiquidCrystal_SR - -#elif ENABLED(LCM1602) - #include - #include - #include - #define LCD_CLASS LiquidCrystal_I2C - -#else - // Standard directly connected LCD implementations - #include - #define LCD_CLASS LiquidCrystal - -#endif - -#include "fontutils.h" -#include "lcdprint.h" - -#if ENABLED(LCD_PROGRESS_BAR) - #define LCD_STR_PROGRESS "\x03\x04\x05" -#endif - -enum HD44780CharSet : char { - CHARSET_MENU, - CHARSET_INFO, - CHARSET_BOOT -}; - -#endif // ULTRALCD_COMMON_HD44780_H diff --git a/Marlin/src/lcd/ultralcd_impl_DOGM.h b/Marlin/src/lcd/ultralcd_impl_DOGM.h deleted file mode 100644 index 16d6c11991..0000000000 --- a/Marlin/src/lcd/ultralcd_impl_DOGM.h +++ /dev/null @@ -1,656 +0,0 @@ -/** - * 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 . - * - */ - -/** - * ultralcd_impl_DOGM.h - * - * Graphics LCD implementation for 128x64 pixel LCDs by STB for ErikZalm/Marlin - * Demonstrator: http://www.reprap.org/wiki/STB_Electronics - * License: http://opensource.org/licenses/BSD-3-Clause - * - * With the use of: - * u8glib by Oliver Kraus - * https://github.com/olikraus/U8glib_Arduino - * License: http://opensource.org/licenses/BSD-3-Clause - */ - -#ifndef ULTRALCD_IMPL_DOGM_H -#define ULTRALCD_IMPL_DOGM_H - -#include "../inc/MarlinConfig.h" - -/** - * Implementation of the LCD display routines for a DOGM128 graphic display. - * These are common LCD 128x64 pixel graphic displays. - */ -#include "ultralcd.h" - -/* -#if ENABLED(U8GLIB_ST7565_64128N) - #include "dogm/ultralcd_st7565_u8glib_VIKI.h" -#elif ENABLED(U8GLIB_ST7920) - #include "dogm/ultralcd_st7920_u8glib_rrd.h" -#endif -*/ - -#include "dogm/dogm_bitmaps.h" - -#if ENABLED(SDSUPPORT) - #include "../libs/duration_t.h" -#endif - -#include - -#include "fontutils.h" -#include "u8g_fontutf8.h" - -#include "dogm/HAL_LCD_class_defines.h" - -#if ENABLED(AUTO_BED_LEVELING_UBL) - #include "../feature/bedlevel/ubl/ubl.h" -#endif - -// Only Western languages support big / small fonts -#if DISABLED(DISPLAY_CHARSET_ISO10646_1) - #undef USE_BIG_EDIT_FONT - #undef USE_SMALL_INFOFONT -#endif - -#if ENABLED(USE_SMALL_INFOFONT) - #include "dogm/dogm_font_data_6x9_marlin.h" - #define FONT_STATUSMENU_NAME u8g_font_6x9 - #define INFO_FONT_HEIGHT 7 -#else - #define FONT_STATUSMENU_NAME FONT_MENU_NAME - #define INFO_FONT_HEIGHT 8 -#endif - -// The Marlin special symbols is now in the dogm_font_data_ISO10646_1.h -#define FONT_SPECIAL_NAME ISO10646_1_5x7 - -#include LANGUAGE_DATA_INCL(LCD_LANGUAGE) - -#include "dogm/dogm_font_data_ISO10646_1.h" -#define FONT_MENU_NAME ISO10646_1_5x7 - -//#define FONT_STATUSMENU_NAME FONT_MENU_NAME - -#define FONT_STATUSMENU 1 -#define FONT_SPECIAL 2 -#define FONT_MENU_EDIT 3 -#define FONT_MENU 4 - -// DOGM parameters (size in pixels) -#define DOG_CHAR_WIDTH 6 -#define DOG_CHAR_HEIGHT 12 -#if ENABLED(USE_BIG_EDIT_FONT) - #define FONT_MENU_EDIT_NAME u8g_font_9x18 - #define DOG_CHAR_WIDTH_EDIT 9 - #define DOG_CHAR_HEIGHT_EDIT 18 -#else - #define FONT_MENU_EDIT_NAME FONT_MENU_NAME - #define DOG_CHAR_WIDTH_EDIT DOG_CHAR_WIDTH - #define DOG_CHAR_HEIGHT_EDIT DOG_CHAR_HEIGHT -#endif - -#ifndef TALL_FONT_CORRECTION - #define TALL_FONT_CORRECTION 0 -#endif - -#define START_COL 0 - -// LCD selection -#if ENABLED(REPRAPWORLD_GRAPHICAL_LCD) - #if DISABLED(SDSUPPORT) && (LCD_PINS_D4 == SCK_PIN) && (LCD_PINS_ENABLE == MOSI_PIN) - U8GLIB_ST7920_128X64_4X u8g(LCD_PINS_RS); // 2 stripes, HW SPI (shared with SD card) - #else - U8GLIB_ST7920_128X64_4X u8g(LCD_PINS_D4, LCD_PINS_ENABLE, LCD_PINS_RS); // Original u8glib device. 2 stripes, SW SPI - #endif - -#elif ENABLED(U8GLIB_ST7920) - // RepRap Discount Full Graphics Smart Controller - #if DISABLED(SDSUPPORT) && (LCD_PINS_D4 == SCK_PIN) && (LCD_PINS_ENABLE == MOSI_PIN) - U8GLIB_ST7920_128X64_4X_HAL u8g(LCD_PINS_RS); // 2 stripes, HW SPI (shared with SD card, on AVR does not use standard LCD adapter) - #else - //U8GLIB_ST7920_128X64_4X u8g(LCD_PINS_D4, LCD_PINS_ENABLE, LCD_PINS_RS); // Original u8glib device. 2 stripes, SW SPI - U8GLIB_ST7920_128X64_RRD u8g(LCD_PINS_D4, LCD_PINS_ENABLE, LCD_PINS_RS); // Number of stripes can be adjusted in ultralcd_st7920_u8glib_rrd.h with PAGE_HEIGHT - // AVR version ignores these pin settings - // HAL version uses these pin settings - #endif - -#elif ENABLED(CARTESIO_UI) - // The CartesioUI display - //U8GLIB_DOGM128_2X u8g(DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0); // 4 stripes - U8GLIB_DOGM128_2X u8g(DOGLCD_CS, DOGLCD_A0); // 4 stripes - -#elif ENABLED(U8GLIB_LM6059_AF) - // Based on the Adafruit ST7565 (http://www.adafruit.com/products/250) - //U8GLIB_LM6059 u8g(DOGLCD_CS, DOGLCD_A0); // 8 stripes - U8GLIB_LM6059_2X u8g(DOGLCD_CS, DOGLCD_A0); // 4 stripes - -#elif ENABLED(U8GLIB_ST7565_64128N) - // The MaKrPanel, Mini Viki, Viki 2.0 & AZSMZ 12864 ST7565 controller - #define SMART_RAMPS (MB(RAMPS_SMART_EFB) || MB(RAMPS_SMART_EEB) || MB(RAMPS_SMART_EFF) || MB(RAMPS_SMART_EEF) || MB(RAMPS_SMART_SF)) - #if DOGLCD_SCK == SCK_PIN && DOGLCD_MOSI == MOSI_PIN && !SMART_RAMPS - U8GLIB_64128N_2X_HAL u8g(DOGLCD_CS, DOGLCD_A0); // using HW-SPI - #else - U8GLIB_64128N_2X_HAL u8g(DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0); // using SW-SPI - #endif - -#elif ENABLED(MKS_12864OLED_SSD1306) - // MKS 128x64 (SSD1306) OLED I2C LCD - U8GLIB_SSD1306_128X64 u8g(DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0); // 8 stripes - //U8GLIB_SSD1306_128X64_2X u8g(DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0); // 4 stripes - -#elif ENABLED(U8GLIB_SSD1306) - // Generic support for SSD1306 OLED I2C LCDs - //U8GLIB_SSD1306_128X64_2X_I2C_2_WIRE u8g(U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST); // 4 stripes - U8GLIB_SSD1306_128X64_2X u8g(U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST); // 4 stripes - -#elif ENABLED(MKS_12864OLED) - // MKS 128x64 (SH1106) OLED I2C LCD - U8GLIB_SH1106_128X64 u8g(DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0); // 8 stripes - //U8GLIB_SH1106_128X64_2X u8g(DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0); // 4 stripes -#elif ENABLED(U8GLIB_SH1106) - // Generic support for SH1106 OLED I2C LCDs - //U8GLIB_SH1106_128X64_2X_I2C_2_WIRE u8g(U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST); // 4 stripes - U8GLIB_SH1106_128X64_2X u8g(U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST); // 4 stripes -#elif ENABLED(U8GLIB_SSD1309) - // Generic support for SSD1309 OLED I2C LCDs - U8GLIB_SSD1309_128X64 u8g(U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST); -#elif ENABLED(MINIPANEL) - // The MINIPanel display - //U8GLIB_MINI12864 u8g(DOGLCD_CS, DOGLCD_A0); // 8 stripes - U8GLIB_MINI12864_2X u8g(DOGLCD_CS, DOGLCD_A0); // 4 stripes -#elif ENABLED(U8GLIB_SH1106_EINSTART) - // Connected via motherboard header - U8GLIB_SH1106_128X64 u8g(DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, LCD_PINS_DC, LCD_PINS_RS); -#else - // for regular DOGM128 display with HW-SPI - //U8GLIB_DOGM128 u8g(DOGLCD_CS, DOGLCD_A0); // HW-SPI Com: CS, A0 // 8 stripes - U8GLIB_DOGM128_2X u8g(DOGLCD_CS, DOGLCD_A0); // HW-SPI Com: CS, A0 // 4 stripes -#endif - -U8GLIB *pu8g = &u8g; - -#ifndef LCD_PIXEL_WIDTH - #define LCD_PIXEL_WIDTH 128 -#endif -#ifndef LCD_PIXEL_HEIGHT - #define LCD_PIXEL_HEIGHT 64 -#endif - -#include "lcdprint.h" - -int16_t lcd_contrast; // Initialized by settings.load() -static char currentfont = 0; - -// The current graphical page being rendered -u8g_page_t &page = ((u8g_pb_t *)((u8g.getU8g())->dev->dev_mem))->p; - -// For selective rendering within a Y range -#define PAGE_UNDER(yb) (u8g.getU8g()->current_page.y0 <= (yb)) -#define PAGE_CONTAINS(ya, yb) (PAGE_UNDER(yb) && u8g.getU8g()->current_page.y1 >= (ya)) - -static void lcd_setFont(const char font_nr) { - switch (font_nr) { - case FONT_STATUSMENU : {u8g.setFont(FONT_STATUSMENU_NAME); currentfont = FONT_STATUSMENU;}; break; - default: - case FONT_MENU : {u8g.setFont(FONT_MENU_NAME); currentfont = FONT_MENU;}; break; - case FONT_SPECIAL : {u8g.setFont(FONT_SPECIAL_NAME); currentfont = FONT_SPECIAL;}; break; - case FONT_MENU_EDIT : {u8g.setFont(FONT_MENU_EDIT_NAME); currentfont = FONT_MENU_EDIT;}; break; - } -} - -#if ENABLED(SHOW_BOOTSCREEN) - - #if ENABLED(SHOW_CUSTOM_BOOTSCREEN) - - void lcd_custom_bootscreen() { - constexpr u8g_uint_t left = (LCD_PIXEL_WIDTH - (CUSTOM_BOOTSCREEN_BMPWIDTH)) / 2, - top = (LCD_PIXEL_HEIGHT - (CUSTOM_BOOTSCREEN_BMPHEIGHT)) / 2; - #if ENABLED(CUSTOM_BOOTSCREEN_INVERTED) - constexpr u8g_uint_t right = left + CUSTOM_BOOTSCREEN_BMPWIDTH, - bottom = top + CUSTOM_BOOTSCREEN_BMPHEIGHT; - #endif - u8g.firstPage(); - do { - u8g.drawBitmapP( - left, top, - CEILING(CUSTOM_BOOTSCREEN_BMPWIDTH, 8), CUSTOM_BOOTSCREEN_BMPHEIGHT, custom_start_bmp - ); - #if ENABLED(CUSTOM_BOOTSCREEN_INVERTED) - u8g.setColorIndex(1); - if (top) u8g.drawBox(0, 0, LCD_PIXEL_WIDTH, top); - if (left) u8g.drawBox(0, top, left, CUSTOM_BOOTSCREEN_BMPHEIGHT); - if (right < LCD_PIXEL_WIDTH) u8g.drawBox(right, top, LCD_PIXEL_WIDTH - right, CUSTOM_BOOTSCREEN_BMPHEIGHT); - if (bottom < LCD_PIXEL_HEIGHT) u8g.drawBox(0, bottom, LCD_PIXEL_WIDTH, LCD_PIXEL_HEIGHT - bottom); - #endif - } while (u8g.nextPage()); - safe_delay(CUSTOM_BOOTSCREEN_TIMEOUT); - } - - #endif // SHOW_CUSTOM_BOOTSCREEN - - void lcd_bootscreen() { - #if ENABLED(SHOW_CUSTOM_BOOTSCREEN) - lcd_custom_bootscreen(); - #endif - - constexpr uint8_t offy = - #if ENABLED(START_BMPHIGH) - (LCD_PIXEL_HEIGHT - (START_BMPHEIGHT)) / 2 - #else - DOG_CHAR_HEIGHT - #endif - ; - - const uint8_t width = u8g.getWidth(), height = u8g.getHeight(), - offx = (width - (START_BMPWIDTH)) / 2; - - u8g.firstPage(); - do { - u8g.drawBitmapP(offx, offy, (START_BMPWIDTH + 7) / 8, START_BMPHEIGHT, start_bmp); - lcd_setFont(FONT_MENU); - #ifndef STRING_SPLASH_LINE2 - const uint8_t txt1X = width - (sizeof(STRING_SPLASH_LINE1) - 1) * (DOG_CHAR_WIDTH); - u8g.drawStr(txt1X, (height + DOG_CHAR_HEIGHT) / 2, STRING_SPLASH_LINE1); - #else - const uint8_t txt1X = (width - (sizeof(STRING_SPLASH_LINE1) - 1) * (DOG_CHAR_WIDTH)) / 2, - txt2X = (width - (sizeof(STRING_SPLASH_LINE2) - 1) * (DOG_CHAR_WIDTH)) / 2; - u8g.drawStr(txt1X, height - (DOG_CHAR_HEIGHT) * 3 / 2, STRING_SPLASH_LINE1); - u8g.drawStr(txt2X, height - (DOG_CHAR_HEIGHT) * 1 / 2, STRING_SPLASH_LINE2); - #endif - } while (u8g.nextPage()); - safe_delay(BOOTSCREEN_TIMEOUT); - } - -#endif // SHOW_BOOTSCREEN - -#if ENABLED(LIGHTWEIGHT_UI) - #include "dogm/status_screen_lite_ST7920.h" -#else - #include "dogm/status_screen_DOGM.h" -#endif - -// Initialize or re-initialize the LCD -static void lcd_implementation_init() { - - #if PIN_EXISTS(LCD_BACKLIGHT) // Enable LCD backlight - OUT_WRITE(LCD_BACKLIGHT_PIN, HIGH); - #endif - - #if ENABLED(MKS_12864OLED) || ENABLED(MKS_12864OLED_SSD1306) - SET_OUTPUT(LCD_PINS_DC); - #if !defined(LCD_RESET_PIN) - #define LCD_RESET_PIN LCD_PINS_RS - #endif - #endif - - #if PIN_EXISTS(LCD_RESET) - OUT_WRITE(LCD_RESET_PIN, LOW); // perform a clean hardware reset - _delay_ms(5); - OUT_WRITE(LCD_RESET_PIN, HIGH); - _delay_ms(5); // delay to allow the display to initalize - #endif - - #if PIN_EXISTS(LCD_RESET) - u8g.begin(); - #endif - - #if DISABLED(MINIPANEL) // setContrast not working for Mini Panel - u8g.setContrast(lcd_contrast); - #endif - - #if ENABLED(LCD_SCREEN_ROT_90) - u8g.setRot90(); // Rotate screen by 90° - #elif ENABLED(LCD_SCREEN_ROT_180) - u8g.setRot180(); // Rotate screen by 180° - #elif ENABLED(LCD_SCREEN_ROT_270) - u8g.setRot270(); // Rotate screen by 270° - #endif - - uxg_SetUtf8Fonts (g_fontinfo, NUM_ARRAY(g_fontinfo)); -} - -// The kill screen is displayed for unrecoverable conditions -void lcd_kill_screen() { - #if ENABLED(LIGHTWEIGHT_UI) - ST7920_Lite_Status_Screen::clear_text_buffer(); - #endif - const uint8_t h4 = u8g.getHeight() / 4; - u8g.firstPage(); - do { - lcd_setFont(FONT_MENU); - lcd_moveto(0, h4 * 1); - lcd_put_u8str(lcd_status_message); - lcd_moveto(0, h4 * 2); - lcd_put_u8str_P(PSTR(MSG_HALTED)); - lcd_moveto(0, h4 * 3); - lcd_put_u8str_P(PSTR(MSG_PLEASE_RESET)); - } while (u8g.nextPage()); -} - -void lcd_implementation_clear() { } // Automatically cleared by Picture Loop - -#if ENABLED(ULTIPANEL) - - uint8_t row_y1, row_y2; - uint8_t constexpr row_height = DOG_CHAR_HEIGHT + 2 * (TALL_FONT_CORRECTION); - - #if ENABLED(ADVANCED_PAUSE_FEATURE) - - static void lcd_implementation_hotend_status(const uint8_t row, const uint8_t extruder=active_extruder) { - row_y1 = row * row_height + 1; - row_y2 = row_y1 + row_height - 1; - - if (!PAGE_CONTAINS(row_y1 + 1, row_y2 + 2)) return; - - lcd_moveto(LCD_PIXEL_WIDTH - 11 * (DOG_CHAR_WIDTH), row_y2); - lcd_put_wchar('E'); - lcd_put_wchar((char)('1' + extruder)); - lcd_put_wchar(' '); - lcd_put_u8str(itostr3(thermalManager.degHotend(extruder))); - lcd_put_wchar('/'); - - if (lcd_blink() || !thermalManager.is_heater_idle(extruder)) - lcd_put_u8str(itostr3(thermalManager.degTargetHotend(extruder))); - } - - #endif // ADVANCED_PAUSE_FEATURE - - // Set the colors for a menu item based on whether it is selected - static bool lcd_implementation_mark_as_selected(const uint8_t row, const bool isSelected) { - row_y1 = row * row_height + 1; - row_y2 = row_y1 + row_height - 1; - - if (!PAGE_CONTAINS(row_y1 + 1, row_y2 + 2)) return false; - - if (isSelected) { - #if ENABLED(MENU_HOLLOW_FRAME) - u8g.drawHLine(0, row_y1 + 1, LCD_PIXEL_WIDTH); - u8g.drawHLine(0, row_y2 + 2, LCD_PIXEL_WIDTH); - #else - u8g.setColorIndex(1); // black on white - u8g.drawBox(0, row_y1 + 2, LCD_PIXEL_WIDTH, row_height - 1); - u8g.setColorIndex(0); // white on black - #endif - } - #if DISABLED(MENU_HOLLOW_FRAME) - else { - u8g.setColorIndex(1); // unmarked text is black on white - } - #endif - - if (!PAGE_CONTAINS(row_y1, row_y2)) return false; - - lcd_moveto((START_COL) * (DOG_CHAR_WIDTH), row_y2); - return true; - } - - // Draw a static line of text in the same idiom as a menu item - static void lcd_implementation_drawmenu_static(const uint8_t row, const char* pstr, const bool center=true, const bool invert=false, const char* valstr=NULL) { - - if (lcd_implementation_mark_as_selected(row, invert)) { - - uint8_t n = LCD_PIXEL_WIDTH - (DOG_CHAR_WIDTH) * (START_COL); // pixel width of string allowed - - if (center && !valstr) { - int8_t pad = (LCD_WIDTH - utf8_strlen_P(pstr)) / 2; - while (--pad >= 0) { lcd_put_wchar(' '); n--; } - } - n -= lcd_put_u8str_max_P(pstr, n); - if (NULL != valstr) { - n -= lcd_put_u8str_max(valstr, n); - } - - while (n - DOG_CHAR_WIDTH > 0) { n -= lcd_put_wchar(' '); } - } - } - - // Draw a generic menu item - static void lcd_implementation_drawmenu_generic(const bool isSelected, const uint8_t row, const char* pstr, const char pre_char, const char post_char) { - UNUSED(pre_char); - - if (lcd_implementation_mark_as_selected(row, isSelected)) { - uint8_t n = LCD_WIDTH - (START_COL) - 2; - n *= DOG_CHAR_WIDTH; - n -= lcd_put_u8str_max_P(pstr, n); - while (n - DOG_CHAR_WIDTH > 0) { n -= lcd_put_wchar(' '); } - lcd_moveto(LCD_PIXEL_WIDTH - (DOG_CHAR_WIDTH), row_y2); - lcd_put_wchar(post_char); - lcd_put_wchar(' '); - } - } - - // Macros for specific types of menu items - #define lcd_implementation_drawmenu_back(sel, row, pstr, dummy) lcd_implementation_drawmenu_generic(sel, row, pstr, LCD_STR_UPLEVEL[0], LCD_STR_UPLEVEL[0]) - #define lcd_implementation_drawmenu_submenu(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', LCD_STR_ARROW_RIGHT[0]) - #define lcd_implementation_drawmenu_gcode(sel, row, pstr, gcode) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ') - #define lcd_implementation_drawmenu_function(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ') - - // Draw a menu item with an editable value - static void _drawmenu_setting_edit_generic(const bool isSelected, const uint8_t row, const char* pstr, const char* const data, const bool pgm) { - if (lcd_implementation_mark_as_selected(row, isSelected)) { - const uint8_t vallen = (pgm ? utf8_strlen_P(data) : utf8_strlen((char*)data)); - uint8_t n = LCD_WIDTH - (START_COL) - 2 - vallen; - n *= DOG_CHAR_WIDTH; - n -= lcd_put_u8str_max_P(pstr, n); - lcd_put_wchar(':'); - while (n - DOG_CHAR_WIDTH > 0) { n -= lcd_put_wchar(' '); } - lcd_moveto(LCD_PIXEL_WIDTH - (DOG_CHAR_WIDTH) * vallen, row_y2); - if (pgm) lcd_put_u8str_P(data); else lcd_put_u8str((char*)data); - } - } - - // Macros for edit items - #define lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, data) _drawmenu_setting_edit_generic(sel, row, pstr, data, false) - #define lcd_implementation_drawmenu_setting_edit_generic_P(sel, row, pstr, data) _drawmenu_setting_edit_generic(sel, row, pstr, data, true) - - #define DRAWMENU_SETTING_EDIT_GENERIC(_src) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, _src) - #define DRAW_BOOL_SETTING(sel, row, pstr, data) lcd_implementation_drawmenu_setting_edit_generic_P(sel, row, pstr, (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF)) - - void lcd_implementation_drawedit(const char* const pstr, const char* const value=NULL) { - const uint8_t labellen = utf8_strlen_P(pstr), - vallen = utf8_strlen(value); - - uint8_t rows = (labellen > LCD_WIDTH - 2 - vallen) ? 2 : 1; - - #if ENABLED(USE_BIG_EDIT_FONT) - constexpr uint8_t lcd_width_edit = (LCD_PIXEL_WIDTH) / (DOG_CHAR_WIDTH_EDIT); - - uint8_t lcd_width, char_width; - if (labellen <= lcd_width_edit - 1) { - if (labellen + vallen + 2 >= lcd_width_edit) rows = 2; - lcd_width = lcd_width_edit + 1; - char_width = DOG_CHAR_WIDTH_EDIT; - lcd_setFont(FONT_MENU_EDIT); - } - else { - lcd_width = LCD_WIDTH - (START_COL); - char_width = DOG_CHAR_WIDTH; - lcd_setFont(FONT_MENU); - } - #else - constexpr uint8_t lcd_width = LCD_WIDTH - (START_COL), - char_width = DOG_CHAR_WIDTH; - #endif - - // Center either one or two rows - const uint8_t segmentHeight = u8g.getHeight() / (rows + 1); // 1 / (rows+1) = 1/2 or 1/3 - uint8_t baseline = segmentHeight + (DOG_CHAR_HEIGHT_EDIT + 1) / 2; - - bool onpage = PAGE_CONTAINS(baseline + 1 - (DOG_CHAR_HEIGHT_EDIT), baseline); - if (onpage) { - lcd_moveto(0, baseline); - lcd_put_u8str_P(pstr); - } - - if (value != NULL) { - lcd_put_wchar(':'); - if (rows == 2) { - baseline += segmentHeight; - onpage = PAGE_CONTAINS(baseline + 1 - (DOG_CHAR_HEIGHT_EDIT), baseline); - } - if (onpage) { - lcd_moveto(((lcd_width - 1) - (vallen + 1)) * char_width, baseline); // Right-justified, leaving padded by spaces - lcd_put_wchar(' '); // overwrite char if value gets shorter - lcd_put_u8str(value); - } - } - } - - #if ENABLED(SDSUPPORT) - - static void _drawmenu_sd(const bool isSelected, const uint8_t row, const char* const pstr, CardReader &theCard, const bool isDir) { - UNUSED(pstr); - - lcd_implementation_mark_as_selected(row, isSelected); - - if (!PAGE_CONTAINS(row_y1, row_y2)) return; - - constexpr uint8_t maxlen = LCD_WIDTH - (START_COL) - 1; - const char *outstr = theCard.longest_filename(); - if (theCard.longFilename[0]) { - #if ENABLED(SCROLL_LONG_FILENAMES) - if (isSelected) { - uint8_t name_hash = row; - for (uint8_t l = FILENAME_LENGTH; l--;) - name_hash = ((name_hash << 1) | (name_hash >> 7)) ^ theCard.filename[l]; // rotate, xor - if (filename_scroll_hash != name_hash) { // If the hash changed... - filename_scroll_hash = name_hash; // Save the new hash - filename_scroll_max = MAX(0, utf8_strlen(theCard.longFilename) - maxlen); // Update the scroll limit - filename_scroll_pos = 0; // Reset scroll to the start - lcd_status_update_delay = 8; // Don't scroll right away - } - outstr += filename_scroll_pos; - } - #else - theCard.longFilename[maxlen] = '\0'; // cutoff at screen edge - #endif - } - - if (isDir) lcd_put_wchar(LCD_STR_FOLDER[0]); - - int n; - n = lcd_put_u8str_max(outstr, maxlen * (DOG_CHAR_WIDTH)); - n = maxlen * (DOG_CHAR_WIDTH) - n; - while (n - DOG_CHAR_WIDTH > 0) { n -= lcd_put_wchar(' '); } - } - - #define lcd_implementation_drawmenu_sdfile(sel, row, pstr, theCard) _drawmenu_sd(sel, row, pstr, theCard, false) - #define lcd_implementation_drawmenu_sddirectory(sel, row, pstr, theCard) _drawmenu_sd(sel, row, pstr, theCard, true) - - #endif // SDSUPPORT - - #if ENABLED(AUTO_BED_LEVELING_UBL) - - /** - * UBL LCD "radar" map data - */ - #define MAP_UPPER_LEFT_CORNER_X 35 // These probably should be moved to the .h file But for now, - #define MAP_UPPER_LEFT_CORNER_Y 8 // it is easier to play with things having them here - #define MAP_MAX_PIXELS_X 53 - #define MAP_MAX_PIXELS_Y 49 - - void lcd_implementation_ubl_plot(const uint8_t x_plot, const uint8_t y_plot) { - // Scale the box pixels appropriately - uint8_t x_map_pixels = ((MAP_MAX_PIXELS_X - 4) / (GRID_MAX_POINTS_X)) * (GRID_MAX_POINTS_X), - y_map_pixels = ((MAP_MAX_PIXELS_Y - 4) / (GRID_MAX_POINTS_Y)) * (GRID_MAX_POINTS_Y), - - pixels_per_x_mesh_pnt = x_map_pixels / (GRID_MAX_POINTS_X), - pixels_per_y_mesh_pnt = y_map_pixels / (GRID_MAX_POINTS_Y), - - x_offset = MAP_UPPER_LEFT_CORNER_X + 1 + (MAP_MAX_PIXELS_X - x_map_pixels - 2) / 2, - y_offset = MAP_UPPER_LEFT_CORNER_Y + 1 + (MAP_MAX_PIXELS_Y - y_map_pixels - 2) / 2; - - // Clear the Mesh Map - - if (PAGE_CONTAINS(y_offset - 2, y_offset + y_map_pixels + 4)) { - u8g.setColorIndex(1); // First draw the bigger box in White so we have a border around the mesh map box - u8g.drawBox(x_offset - 2, y_offset - 2, x_map_pixels + 4, y_map_pixels + 4); - if (PAGE_CONTAINS(y_offset, y_offset + y_map_pixels)) { - u8g.setColorIndex(0); // Now actually clear the mesh map box - u8g.drawBox(x_offset, y_offset, x_map_pixels, y_map_pixels); - } - } - - // Display Mesh Point Locations - - u8g.setColorIndex(1); - const uint8_t sx = x_offset + pixels_per_x_mesh_pnt / 2; - uint8_t y = y_offset + pixels_per_y_mesh_pnt / 2; - for (uint8_t j = 0; j < GRID_MAX_POINTS_Y; j++, y += pixels_per_y_mesh_pnt) - if (PAGE_CONTAINS(y, y)) - for (uint8_t i = 0, x = sx; i < GRID_MAX_POINTS_X; i++, x += pixels_per_x_mesh_pnt) - u8g.drawBox(x, y, 1, 1); - - // Fill in the Specified Mesh Point - - uint8_t inverted_y = GRID_MAX_POINTS_Y - y_plot - 1; // The origin is typically in the lower right corner. We need to - // invert the Y to get it to plot in the right location. - - const uint8_t by = y_offset + inverted_y * pixels_per_y_mesh_pnt; - if (PAGE_CONTAINS(by, by + pixels_per_y_mesh_pnt)) - u8g.drawBox( - x_offset + x_plot * pixels_per_x_mesh_pnt, by, - pixels_per_x_mesh_pnt, pixels_per_y_mesh_pnt - ); - - // Put Relevant Text on Display - - // Show X and Y positions at top of screen - u8g.setColorIndex(1); - if (PAGE_UNDER(7)) { - lcd_moveto(5, 7); - lcd_put_u8str("X:"); - lcd_put_u8str(ftostr52(LOGICAL_X_POSITION(pgm_read_float(&ubl._mesh_index_to_xpos[x_plot])))); - lcd_moveto(74, 7); - lcd_put_u8str("Y:"); - lcd_put_u8str(ftostr52(LOGICAL_Y_POSITION(pgm_read_float(&ubl._mesh_index_to_ypos[y_plot])))); - } - - // Print plot position - if (PAGE_CONTAINS(LCD_PIXEL_HEIGHT - (INFO_FONT_HEIGHT - 1), LCD_PIXEL_HEIGHT)) { - lcd_moveto(5, LCD_PIXEL_HEIGHT); - lcd_put_wchar('('); - u8g.print(x_plot); - lcd_put_wchar(','); - u8g.print(y_plot); - lcd_put_wchar(')'); - - // Show the location value - lcd_moveto(74, LCD_PIXEL_HEIGHT); - lcd_put_u8str("Z:"); - if (!isnan(ubl.z_values[x_plot][y_plot])) - lcd_put_u8str(ftostr43sign(ubl.z_values[x_plot][y_plot])); - else - lcd_put_u8str_P(PSTR(" -----")); - } - - } - - #endif // AUTO_BED_LEVELING_UBL - -#endif // ULTIPANEL - -#endif // __ULTRALCD_IMPL_DOGM_H diff --git a/Marlin/src/libs/buzzer.cpp b/Marlin/src/libs/buzzer.cpp index 117104001e..997c226436 100644 --- a/Marlin/src/libs/buzzer.cpp +++ b/Marlin/src/libs/buzzer.cpp @@ -27,6 +27,10 @@ #include "buzzer.h" #include "../module/temperature.h" +#if ENABLED(EXTENSIBLE_UI) + #include "../lcd/extensible_ui/ui_api.h" +#endif + Buzzer::state_t Buzzer::state; CircularQueue Buzzer::buffer; Buzzer buzzer; @@ -58,7 +62,11 @@ void Buzzer::tick() { state.endtime = now + state.tone.duration; if (state.tone.frequency > 0) { - #if ENABLED(SPEAKER) + #if ENABLED(EXTENSIBLE_UI) + CRITICAL_SECTION_START; + ExtUI::onPlayTone(state.tone.frequency, state.tone.duration); + CRITICAL_SECTION_END; + #elif ENABLED(SPEAKER) CRITICAL_SECTION_START; ::tone(BEEPER_PIN, state.tone.frequency, state.tone.duration); CRITICAL_SECTION_END; diff --git a/Marlin/src/libs/buzzer.h b/Marlin/src/libs/buzzer.h index 2da9b8dee7..c0ed8d9fa2 100644 --- a/Marlin/src/libs/buzzer.h +++ b/Marlin/src/libs/buzzer.h @@ -19,100 +19,99 @@ * along with this program. If not, see . * */ - -#ifndef __BUZZER_H__ -#define __BUZZER_H__ +#pragma once #include "../inc/MarlinConfig.h" -// Make a buzzer and macro #if ENABLED(LCD_USE_I2C_BUZZER) - // BUZZ() will be defined in ultralcd.h + + #define BUZZ(d,f) ui.buzz(d,f) + #elif PIN_EXISTS(BEEPER) -#include "circularqueue.h" + #include "circularqueue.h" -#define TONE_QUEUE_LENGTH 4 + #define TONE_QUEUE_LENGTH 4 -/** - * @brief Tone structure - * @details Simple abstraction of a tone based on a duration and a frequency. - */ -struct tone_t { - uint16_t duration; - uint16_t frequency; -}; + /** + * @brief Tone structure + * @details Simple abstraction of a tone based on a duration and a frequency. + */ + struct tone_t { + uint16_t duration; + uint16_t frequency; + }; -/** - * @brief Buzzer class - */ -class Buzzer { - public: + /** + * @brief Buzzer class + */ + class Buzzer { + public: - typedef struct { - tone_t tone; - uint32_t endtime; - } state_t; + typedef struct { + tone_t tone; + uint32_t endtime; + } state_t; - private: - static state_t state; + private: + static state_t state; - protected: - static CircularQueue buffer; + protected: + static CircularQueue buffer; - /** - * @brief Inverts the sate of a digital PIN - * @details This will invert the current state of an digital IO pin. - */ - FORCE_INLINE static void invert() { TOGGLE(BEEPER_PIN); } + /** + * @brief Inverts the sate of a digital PIN + * @details This will invert the current state of an digital IO pin. + */ + FORCE_INLINE static void invert() { TOGGLE(BEEPER_PIN); } - /** - * @brief Turn off a digital PIN - * @details Alias of digitalWrite(PIN, LOW) using FastIO - */ - FORCE_INLINE static void off() { WRITE(BEEPER_PIN, LOW); } + /** + * @brief Turn off a digital PIN + * @details Alias of digitalWrite(PIN, LOW) using FastIO + */ + FORCE_INLINE static void off() { WRITE(BEEPER_PIN, LOW); } - /** - * @brief Turn on a digital PIN - * @details Alias of digitalWrite(PIN, HIGH) using FastIO - */ - FORCE_INLINE static void on() { WRITE(BEEPER_PIN, HIGH); } + /** + * @brief Turn on a digital PIN + * @details Alias of digitalWrite(PIN, HIGH) using FastIO + */ + FORCE_INLINE static void on() { WRITE(BEEPER_PIN, HIGH); } - /** - * @brief Resets the state of the class - * @details Brings the class state to a known one. - */ - static inline void reset() { - off(); - state.endtime = 0; - } + /** + * @brief Resets the state of the class + * @details Brings the class state to a known one. + */ + static inline void reset() { + off(); + state.endtime = 0; + } - public: - /** - * @brief Class constructor - */ - Buzzer() { - SET_OUTPUT(BEEPER_PIN); - reset(); - } + public: + /** + * @brief Class constructor + */ + Buzzer() { + SET_OUTPUT(BEEPER_PIN); + reset(); + } - /** - * @brief Add a tone to the queue - * @details Adds a tone_t structure to the ring buffer, will block IO if the - * queue is full waiting for one slot to get available. - * - * @param duration Duration of the tone in milliseconds - * @param frequency Frequency of the tone in hertz - */ - static void tone(const uint16_t duration, const uint16_t frequency=0); + /** + * @brief Add a tone to the queue + * @details Adds a tone_t structure to the ring buffer, will block IO if the + * queue is full waiting for one slot to get available. + * + * @param duration Duration of the tone in milliseconds + * @param frequency Frequency of the tone in hertz + */ + static void tone(const uint16_t duration, const uint16_t frequency=0); - /** - * @brief Tick function - * @details This function should be called at loop, it will take care of - * playing the tones in the queue. - */ - static void tick(); -}; + /** + * @brief Tick function + * @details This function should be called at loop, it will take care of + * playing the tones in the queue. + */ + static void tick(); + }; // Provide a buzzer instance extern Buzzer buzzer; @@ -123,5 +122,3 @@ class Buzzer { #define BUZZ(d,f) NOOP #endif - -#endif diff --git a/Marlin/src/libs/circularqueue.h b/Marlin/src/libs/circularqueue.h index d10e79bac9..1cd051c2fa 100644 --- a/Marlin/src/libs/circularqueue.h +++ b/Marlin/src/libs/circularqueue.h @@ -19,9 +19,7 @@ * along with this program. If not, see . * */ - -#ifndef __CIRCULARQUEUE_H__ -#define __CIRCULARQUEUE_H__ +#pragma once #include @@ -141,5 +139,3 @@ class CircularQueue { return this->buffer.count; } }; - -#endif diff --git a/Marlin/src/libs/duration_t.h b/Marlin/src/libs/duration_t.h index f38ab0224d..091bae0e57 100644 --- a/Marlin/src/libs/duration_t.h +++ b/Marlin/src/libs/duration_t.h @@ -19,9 +19,9 @@ * along with this program. If not, see . * */ +#pragma once -#ifndef __DURATION_T__ -#define __DURATION_T__ +#include struct duration_t { /** @@ -163,5 +163,3 @@ struct duration_t { } } }; - -#endif // __DURATION_T__ diff --git a/Marlin/src/libs/hex_print_routines.h b/Marlin/src/libs/hex_print_routines.h index 859b79fe31..2033e5670b 100644 --- a/Marlin/src/libs/hex_print_routines.h +++ b/Marlin/src/libs/hex_print_routines.h @@ -19,9 +19,7 @@ * along with this program. If not, see . * */ - -#ifndef HEX_PRINT_ROUTINES_H -#define HEX_PRINT_ROUTINES_H +#pragma once #include @@ -46,5 +44,3 @@ void print_hex_address(const void * const w); #else typedef uint16_t ptr_int_t; #endif - -#endif // HEX_PRINT_ROUTINES_H diff --git a/Marlin/src/libs/least_squares_fit.h b/Marlin/src/libs/least_squares_fit.h index cbd42d2c6b..02ed9cfbd9 100644 --- a/Marlin/src/libs/least_squares_fit.h +++ b/Marlin/src/libs/least_squares_fit.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Incremental Least Squares Best Fit By Roxy and Ed Williams @@ -32,9 +33,6 @@ * */ -#ifndef _LEAST_SQUARES_FIT_H_ -#define _LEAST_SQUARES_FIT_H_ - #include "../inc/MarlinConfig.h" #include @@ -83,5 +81,3 @@ void inline incremental_LSF(struct linear_fit_data *lsf, const float &x, const f } int finish_incremental_LSF(struct linear_fit_data *); - -#endif // _LEAST_SQUARES_FIT_H_ diff --git a/Marlin/src/libs/nozzle.h b/Marlin/src/libs/nozzle.h index 3adf6f3ac8..5e56618e3f 100644 --- a/Marlin/src/libs/nozzle.h +++ b/Marlin/src/libs/nozzle.h @@ -19,9 +19,7 @@ * along with this program. If not, see . * */ - -#ifndef __NOZZLE_H__ -#define __NOZZLE_H__ +#pragma once #include "../inc/MarlinConfig.h" #include "point_t.h" @@ -90,5 +88,3 @@ class Nozzle { #endif }; - -#endif // __NOZZLE_H__ diff --git a/Marlin/src/libs/point_t.h b/Marlin/src/libs/point_t.h index 37ade7eba7..7a065cb33b 100644 --- a/Marlin/src/libs/point_t.h +++ b/Marlin/src/libs/point_t.h @@ -19,9 +19,9 @@ * along with this program. If not, see . * */ +#pragma once -#ifndef __POINT_T__ -#define __POINT_T__ +#include /** * @brief Cartesian Point @@ -53,5 +53,3 @@ struct point_t { point_t(const float x, const float y) : point_t(x, y, NAN) {} }; - -#endif // __POINT_T__ diff --git a/Marlin/src/libs/private_spi.h b/Marlin/src/libs/private_spi.h index 7998de7bea..89c591a2a4 100644 --- a/Marlin/src/libs/private_spi.h +++ b/Marlin/src/libs/private_spi.h @@ -19,9 +19,7 @@ * along with this program. If not, see . * */ - -#ifndef __PRIVATE_SPI_H__ -#define __PRIVATE_SPI_H__ +#pragma once #include "softspi.h" #include @@ -53,5 +51,3 @@ class SPIclass { } }; - -#endif // __PRIVATE_SPI_H__ diff --git a/Marlin/src/libs/softspi.h b/Marlin/src/libs/softspi.h index e3a28fdc73..819567df81 100644 --- a/Marlin/src/libs/softspi.h +++ b/Marlin/src/libs/softspi.h @@ -1,655 +1,635 @@ -//https://github.com/niteris/ArduinoSoftSpi +// https://github.com/niteris/ArduinoSoftSpi #include + +#ifndef FORCE_INLINE + #define FORCE_INLINE inline __attribute__((always_inline)) +#endif + +#ifndef _BV + #define _BV(B) (1 << (B)) + #define SBI(A,B) (A |= (1 << (B))) + #define CBI(A,B) (A &= ~(1 << (B))) +#endif + +#define nop __asm__ volatile ("nop") // NOP for timing + #ifdef __arm__ -#ifdef CORE_TEENSY -//------------------------------------------------------------------------------ -/** read pin value - * @param[in] pin Arduino pin number - * @return value read - */ -static inline __attribute__((always_inline)) -bool fastDigitalRead(uint8_t pin) { - return *portInputRegister(pin); -} -//------------------------------------------------------------------------------ -/** Set pin value - * @param[in] pin Arduino pin number - * @param[in] level value to write - */ -static inline __attribute__((always_inline)) -void fastDigitalWrite(uint8_t pin, bool value) { - if (value) { - *portSetRegister(pin) = 1; - } else { - *portClearRegister(pin) = 1; - } -} -#else // CORE_TEENSY -//------------------------------------------------------------------------------ -/** read pin value - * @param[in] pin Arduino pin number - * @return value read - */ -static inline __attribute__((always_inline)) -bool fastDigitalRead(uint8_t pin){ - return g_APinDescription[pin].pPort->PIO_PDSR & g_APinDescription[pin].ulPin; -} -//------------------------------------------------------------------------------ -/** Set pin value - * @param[in] pin Arduino pin number - * @param[in] level value to write - */ -static inline __attribute__((always_inline)) -void fastDigitalWrite(uint8_t pin, bool value){ - if(value) { - g_APinDescription[pin].pPort->PIO_SODR = g_APinDescription[pin].ulPin; - } else { - g_APinDescription[pin].pPort->PIO_CODR = g_APinDescription[pin].ulPin; - } -} -#endif // CORE_TEENSY -//------------------------------------------------------------------------------ -inline void fastDigitalToggle(uint8_t pin) { - fastDigitalWrite(pin, !fastDigitalRead(pin)); - } -//------------------------------------------------------------------------------ -inline void fastPinMode(uint8_t pin, bool mode) {pinMode(pin, mode);} -#else // __arm__ -#include -#include -//------------------------------------------------------------------------------ -/** - * @class pin_map_t - * @brief struct for mapping digital pins - */ -struct pin_map_t { - volatile uint8_t* ddr; /**< address of DDR for this pin */ - volatile uint8_t* pin; /**< address of PIN for this pin */ - volatile uint8_t* port; /**< address of PORT for this pin */ - uint8_t bit; /**< bit number for this pin */ -}; -//------------------------------------------------------------------------------ -#if defined(__AVR_ATmega168__)\ -||defined(__AVR_ATmega168P__)\ -||defined(__AVR_ATmega328P__) -// 168 and 328 Arduinos -const static pin_map_t pinMap[] = { - {&DDRD, &PIND, &PORTD, 0}, // D0 0 - {&DDRD, &PIND, &PORTD, 1}, // D1 1 - {&DDRD, &PIND, &PORTD, 2}, // D2 2 - {&DDRD, &PIND, &PORTD, 3}, // D3 3 - {&DDRD, &PIND, &PORTD, 4}, // D4 4 - {&DDRD, &PIND, &PORTD, 5}, // D5 5 - {&DDRD, &PIND, &PORTD, 6}, // D6 6 - {&DDRD, &PIND, &PORTD, 7}, // D7 7 - {&DDRB, &PINB, &PORTB, 0}, // B0 8 - {&DDRB, &PINB, &PORTB, 1}, // B1 9 - {&DDRB, &PINB, &PORTB, 2}, // B2 10 - {&DDRB, &PINB, &PORTB, 3}, // B3 11 - {&DDRB, &PINB, &PORTB, 4}, // B4 12 - {&DDRB, &PINB, &PORTB, 5}, // B5 13 - {&DDRC, &PINC, &PORTC, 0}, // C0 14 - {&DDRC, &PINC, &PORTC, 1}, // C1 15 - {&DDRC, &PINC, &PORTC, 2}, // C2 16 - {&DDRC, &PINC, &PORTC, 3}, // C3 17 - {&DDRC, &PINC, &PORTC, 4}, // C4 18 - {&DDRC, &PINC, &PORTC, 5} // C5 19 -}; -//------------------------------------------------------------------------------ -#elif defined(__AVR_ATmega1280__)\ -|| defined(__AVR_ATmega2560__) -// Mega -static const pin_map_t pinMap[] = { - {&DDRE, &PINE, &PORTE, 0}, // E0 0 - {&DDRE, &PINE, &PORTE, 1}, // E1 1 - {&DDRE, &PINE, &PORTE, 4}, // E4 2 - {&DDRE, &PINE, &PORTE, 5}, // E5 3 - {&DDRG, &PING, &PORTG, 5}, // G5 4 - {&DDRE, &PINE, &PORTE, 3}, // E3 5 - {&DDRH, &PINH, &PORTH, 3}, // H3 6 - {&DDRH, &PINH, &PORTH, 4}, // H4 7 - {&DDRH, &PINH, &PORTH, 5}, // H5 8 - {&DDRH, &PINH, &PORTH, 6}, // H6 9 - {&DDRB, &PINB, &PORTB, 4}, // B4 10 - {&DDRB, &PINB, &PORTB, 5}, // B5 11 - {&DDRB, &PINB, &PORTB, 6}, // B6 12 - {&DDRB, &PINB, &PORTB, 7}, // B7 13 - {&DDRJ, &PINJ, &PORTJ, 1}, // J1 14 - {&DDRJ, &PINJ, &PORTJ, 0}, // J0 15 - {&DDRH, &PINH, &PORTH, 1}, // H1 16 - {&DDRH, &PINH, &PORTH, 0}, // H0 17 - {&DDRD, &PIND, &PORTD, 3}, // D3 18 - {&DDRD, &PIND, &PORTD, 2}, // D2 19 - {&DDRD, &PIND, &PORTD, 1}, // D1 20 - {&DDRD, &PIND, &PORTD, 0}, // D0 21 - {&DDRA, &PINA, &PORTA, 0}, // A0 22 - {&DDRA, &PINA, &PORTA, 1}, // A1 23 - {&DDRA, &PINA, &PORTA, 2}, // A2 24 - {&DDRA, &PINA, &PORTA, 3}, // A3 25 - {&DDRA, &PINA, &PORTA, 4}, // A4 26 - {&DDRA, &PINA, &PORTA, 5}, // A5 27 - {&DDRA, &PINA, &PORTA, 6}, // A6 28 - {&DDRA, &PINA, &PORTA, 7}, // A7 29 - {&DDRC, &PINC, &PORTC, 7}, // C7 30 - {&DDRC, &PINC, &PORTC, 6}, // C6 31 - {&DDRC, &PINC, &PORTC, 5}, // C5 32 - {&DDRC, &PINC, &PORTC, 4}, // C4 33 - {&DDRC, &PINC, &PORTC, 3}, // C3 34 - {&DDRC, &PINC, &PORTC, 2}, // C2 35 - {&DDRC, &PINC, &PORTC, 1}, // C1 36 - {&DDRC, &PINC, &PORTC, 0}, // C0 37 - {&DDRD, &PIND, &PORTD, 7}, // D7 38 - {&DDRG, &PING, &PORTG, 2}, // G2 39 - {&DDRG, &PING, &PORTG, 1}, // G1 40 - {&DDRG, &PING, &PORTG, 0}, // G0 41 - {&DDRL, &PINL, &PORTL, 7}, // L7 42 - {&DDRL, &PINL, &PORTL, 6}, // L6 43 - {&DDRL, &PINL, &PORTL, 5}, // L5 44 - {&DDRL, &PINL, &PORTL, 4}, // L4 45 - {&DDRL, &PINL, &PORTL, 3}, // L3 46 - {&DDRL, &PINL, &PORTL, 2}, // L2 47 - {&DDRL, &PINL, &PORTL, 1}, // L1 48 - {&DDRL, &PINL, &PORTL, 0}, // L0 49 - {&DDRB, &PINB, &PORTB, 3}, // B3 50 - {&DDRB, &PINB, &PORTB, 2}, // B2 51 - {&DDRB, &PINB, &PORTB, 1}, // B1 52 - {&DDRB, &PINB, &PORTB, 0}, // B0 53 - {&DDRF, &PINF, &PORTF, 0}, // F0 54 - {&DDRF, &PINF, &PORTF, 1}, // F1 55 - {&DDRF, &PINF, &PORTF, 2}, // F2 56 - {&DDRF, &PINF, &PORTF, 3}, // F3 57 - {&DDRF, &PINF, &PORTF, 4}, // F4 58 - {&DDRF, &PINF, &PORTF, 5}, // F5 59 - {&DDRF, &PINF, &PORTF, 6}, // F6 60 - {&DDRF, &PINF, &PORTF, 7}, // F7 61 - {&DDRK, &PINK, &PORTK, 0}, // K0 62 - {&DDRK, &PINK, &PORTK, 1}, // K1 63 - {&DDRK, &PINK, &PORTK, 2}, // K2 64 - {&DDRK, &PINK, &PORTK, 3}, // K3 65 - {&DDRK, &PINK, &PORTK, 4}, // K4 66 - {&DDRK, &PINK, &PORTK, 5}, // K5 67 - {&DDRK, &PINK, &PORTK, 6}, // K6 68 - {&DDRK, &PINK, &PORTK, 7}, // K7 69 -//pins_MIGHTYBOARD_REVE.h - {&DDRG, &PING, &PORTG, 4}, // G4 70 - {&DDRG, &PING, &PORTG, 3}, // G3 71 - {&DDRJ, &PINJ, &PORTJ, 2}, // J2 72 - {&DDRJ, &PINJ, &PORTJ, 3}, // J3 73 - {&DDRJ, &PINJ, &PORTJ, 7}, // J7 74 - {&DDRJ, &PINJ, &PORTJ, 4}, // J4 75 - {&DDRJ, &PINJ, &PORTJ, 5}, // J5 76 - {&DDRJ, &PINJ, &PORTJ, 6}, // J6 77 - {&DDRE, &PINE, &PORTE, 2}, // E2 78 - {&DDRE, &PINE, &PORTE, 6} // E6 79 + #ifdef CORE_TEENSY -}; -//------------------------------------------------------------------------------ -#elif defined(__AVR_ATmega1284P__)\ -|| defined(__AVR_ATmega1284__)\ -|| defined(__AVR_ATmega644P__)\ -|| defined(__AVR_ATmega644__)\ -|| defined(__AVR_ATmega64__)\ -|| defined(__AVR_ATmega32__)\ -|| defined(__AVR_ATmega324__)\ -|| defined(__AVR_ATmega16__) - -#ifdef VARIANT_MIGHTY -// Mighty Layout -static const pin_map_t pinMap[] = { - {&DDRB, &PINB, &PORTB, 0}, // B0 0 - {&DDRB, &PINB, &PORTB, 1}, // B1 1 - {&DDRB, &PINB, &PORTB, 2}, // B2 2 - {&DDRB, &PINB, &PORTB, 3}, // B3 3 - {&DDRB, &PINB, &PORTB, 4}, // B4 4 - {&DDRB, &PINB, &PORTB, 5}, // B5 5 - {&DDRB, &PINB, &PORTB, 6}, // B6 6 - {&DDRB, &PINB, &PORTB, 7}, // B7 7 - {&DDRD, &PIND, &PORTD, 0}, // D0 8 - {&DDRD, &PIND, &PORTD, 1}, // D1 9 - {&DDRD, &PIND, &PORTD, 2}, // D2 10 - {&DDRD, &PIND, &PORTD, 3}, // D3 11 - {&DDRD, &PIND, &PORTD, 4}, // D4 12 - {&DDRD, &PIND, &PORTD, 5}, // D5 13 - {&DDRD, &PIND, &PORTD, 6}, // D6 14 - {&DDRD, &PIND, &PORTD, 7}, // D7 15 - {&DDRC, &PINC, &PORTC, 0}, // C0 16 - {&DDRC, &PINC, &PORTC, 1}, // C1 17 - {&DDRC, &PINC, &PORTC, 2}, // C2 18 - {&DDRC, &PINC, &PORTC, 3}, // C3 19 - {&DDRC, &PINC, &PORTC, 4}, // C4 20 - {&DDRC, &PINC, &PORTC, 5}, // C5 21 - {&DDRC, &PINC, &PORTC, 6}, // C6 22 - {&DDRC, &PINC, &PORTC, 7}, // C7 23 - {&DDRA, &PINA, &PORTA, 0}, // A0 24 - {&DDRA, &PINA, &PORTA, 1}, // A1 25 - {&DDRA, &PINA, &PORTA, 2}, // A2 26 - {&DDRA, &PINA, &PORTA, 3}, // A3 27 - {&DDRA, &PINA, &PORTA, 4}, // A4 28 - {&DDRA, &PINA, &PORTA, 5}, // A5 29 - {&DDRA, &PINA, &PORTA, 6}, // A6 30 - {&DDRA, &PINA, &PORTA, 7} // A7 31 -}; -#elif defined(VARIANT_BOBUINO) -// Bobuino Layout -static const pin_map_t pinMap[] = { - {&DDRD, &PIND, &PORTD, 0}, // D0 0 - {&DDRD, &PIND, &PORTD, 1}, // D1 1 - {&DDRD, &PIND, &PORTD, 2}, // D2 2 - {&DDRD, &PIND, &PORTD, 3}, // D3 3 - {&DDRB, &PINB, &PORTB, 0}, // B0 4 - {&DDRB, &PINB, &PORTB, 1}, // B1 5 - {&DDRB, &PINB, &PORTB, 2}, // B2 6 - {&DDRB, &PINB, &PORTB, 3}, // B3 7 - {&DDRD, &PIND, &PORTD, 5}, // D5 8 - {&DDRD, &PIND, &PORTD, 6}, // D6 9 - {&DDRB, &PINB, &PORTB, 4}, // B4 10 - {&DDRB, &PINB, &PORTB, 5}, // B5 11 - {&DDRB, &PINB, &PORTB, 6}, // B6 12 - {&DDRB, &PINB, &PORTB, 7}, // B7 13 - {&DDRA, &PINA, &PORTA, 7}, // A7 14 - {&DDRA, &PINA, &PORTA, 6}, // A6 15 - {&DDRA, &PINA, &PORTA, 5}, // A5 16 - {&DDRA, &PINA, &PORTA, 4}, // A4 17 - {&DDRA, &PINA, &PORTA, 3}, // A3 18 - {&DDRA, &PINA, &PORTA, 2}, // A2 19 - {&DDRA, &PINA, &PORTA, 1}, // A1 20 - {&DDRA, &PINA, &PORTA, 0}, // A0 21 - {&DDRC, &PINC, &PORTC, 0}, // C0 22 - {&DDRC, &PINC, &PORTC, 1}, // C1 23 - {&DDRC, &PINC, &PORTC, 2}, // C2 24 - {&DDRC, &PINC, &PORTC, 3}, // C3 25 - {&DDRC, &PINC, &PORTC, 4}, // C4 26 - {&DDRC, &PINC, &PORTC, 5}, // C5 27 - {&DDRC, &PINC, &PORTC, 6}, // C6 28 - {&DDRC, &PINC, &PORTC, 7}, // C7 29 - {&DDRD, &PIND, &PORTD, 4}, // D4 30 - {&DDRD, &PIND, &PORTD, 7} // D7 31 -}; -#elif defined(VARIANT_STANDARD) -// Standard Layout -static const pin_map_t pinMap[] = { - {&DDRB, &PINB, &PORTB, 0}, // B0 0 - {&DDRB, &PINB, &PORTB, 1}, // B1 1 - {&DDRB, &PINB, &PORTB, 2}, // B2 2 - {&DDRB, &PINB, &PORTB, 3}, // B3 3 - {&DDRB, &PINB, &PORTB, 4}, // B4 4 - {&DDRB, &PINB, &PORTB, 5}, // B5 5 - {&DDRB, &PINB, &PORTB, 6}, // B6 6 - {&DDRB, &PINB, &PORTB, 7}, // B7 7 - {&DDRD, &PIND, &PORTD, 0}, // D0 8 - {&DDRD, &PIND, &PORTD, 1}, // D1 9 - {&DDRD, &PIND, &PORTD, 2}, // D2 10 - {&DDRD, &PIND, &PORTD, 3}, // D3 11 - {&DDRD, &PIND, &PORTD, 4}, // D4 12 - {&DDRD, &PIND, &PORTD, 5}, // D5 13 - {&DDRD, &PIND, &PORTD, 6}, // D6 14 - {&DDRD, &PIND, &PORTD, 7}, // D7 15 - {&DDRC, &PINC, &PORTC, 0}, // C0 16 - {&DDRC, &PINC, &PORTC, 1}, // C1 17 - {&DDRC, &PINC, &PORTC, 2}, // C2 18 - {&DDRC, &PINC, &PORTC, 3}, // C3 19 - {&DDRC, &PINC, &PORTC, 4}, // C4 20 - {&DDRC, &PINC, &PORTC, 5}, // C5 21 - {&DDRC, &PINC, &PORTC, 6}, // C6 22 - {&DDRC, &PINC, &PORTC, 7}, // C7 23 - {&DDRA, &PINA, &PORTA, 7}, // A7 24 - {&DDRA, &PINA, &PORTA, 6}, // A6 25 - {&DDRA, &PINA, &PORTA, 5}, // A5 26 - {&DDRA, &PINA, &PORTA, 4}, // A4 27 - {&DDRA, &PINA, &PORTA, 3}, // A3 28 - {&DDRA, &PINA, &PORTA, 2}, // A2 29 - {&DDRA, &PINA, &PORTA, 1}, // A1 30 - {&DDRA, &PINA, &PORTA, 0} // A0 31 -}; -#else // VARIANT_MIGHTY -#error Undefined variant 1284, 644, 324, 64, 32 -#endif // VARIANT_MIGHTY -//------------------------------------------------------------------------------ -#elif defined(__AVR_ATmega32U4__) -#ifdef CORE_TEENSY -// Teensy 2.0 -static const pin_map_t pinMap[] = { - {&DDRB, &PINB, &PORTB, 0}, // B0 0 - {&DDRB, &PINB, &PORTB, 1}, // B1 1 - {&DDRB, &PINB, &PORTB, 2}, // B2 2 - {&DDRB, &PINB, &PORTB, 3}, // B3 3 - {&DDRB, &PINB, &PORTB, 7}, // B7 4 - {&DDRD, &PIND, &PORTD, 0}, // D0 5 - {&DDRD, &PIND, &PORTD, 1}, // D1 6 - {&DDRD, &PIND, &PORTD, 2}, // D2 7 - {&DDRD, &PIND, &PORTD, 3}, // D3 8 - {&DDRC, &PINC, &PORTC, 6}, // C6 9 - {&DDRC, &PINC, &PORTC, 7}, // C7 10 - {&DDRD, &PIND, &PORTD, 6}, // D6 11 - {&DDRD, &PIND, &PORTD, 7}, // D7 12 - {&DDRB, &PINB, &PORTB, 4}, // B4 13 - {&DDRB, &PINB, &PORTB, 5}, // B5 14 - {&DDRB, &PINB, &PORTB, 6}, // B6 15 - {&DDRF, &PINF, &PORTF, 7}, // F7 16 - {&DDRF, &PINF, &PORTF, 6}, // F6 17 - {&DDRF, &PINF, &PORTF, 5}, // F5 18 - {&DDRF, &PINF, &PORTF, 4}, // F4 19 - {&DDRF, &PINF, &PORTF, 1}, // F1 20 - {&DDRF, &PINF, &PORTF, 0}, // F0 21 - {&DDRD, &PIND, &PORTD, 4}, // D4 22 - {&DDRD, &PIND, &PORTD, 5}, // D5 23 - {&DDRE, &PINE, &PORTE, 6} // E6 24 -}; -//------------------------------------------------------------------------------ -#else // CORE_TEENSY -// Leonardo -static const pin_map_t pinMap[] = { - {&DDRD, &PIND, &PORTD, 2}, // D2 0 - {&DDRD, &PIND, &PORTD, 3}, // D3 1 - {&DDRD, &PIND, &PORTD, 1}, // D1 2 - {&DDRD, &PIND, &PORTD, 0}, // D0 3 - {&DDRD, &PIND, &PORTD, 4}, // D4 4 - {&DDRC, &PINC, &PORTC, 6}, // C6 5 - {&DDRD, &PIND, &PORTD, 7}, // D7 6 - {&DDRE, &PINE, &PORTE, 6}, // E6 7 - {&DDRB, &PINB, &PORTB, 4}, // B4 8 - {&DDRB, &PINB, &PORTB, 5}, // B5 9 - {&DDRB, &PINB, &PORTB, 6}, // B6 10 - {&DDRB, &PINB, &PORTB, 7}, // B7 11 - {&DDRD, &PIND, &PORTD, 6}, // D6 12 - {&DDRC, &PINC, &PORTC, 7}, // C7 13 - {&DDRB, &PINB, &PORTB, 3}, // B3 14 - {&DDRB, &PINB, &PORTB, 1}, // B1 15 - {&DDRB, &PINB, &PORTB, 2}, // B2 16 - {&DDRB, &PINB, &PORTB, 0}, // B0 17 - {&DDRF, &PINF, &PORTF, 7}, // F7 18 - {&DDRF, &PINF, &PORTF, 6}, // F6 19 - {&DDRF, &PINF, &PORTF, 5}, // F5 20 - {&DDRF, &PINF, &PORTF, 4}, // F4 21 - {&DDRF, &PINF, &PORTF, 1}, // F1 22 - {&DDRF, &PINF, &PORTF, 0}, // F0 23 - {&DDRD, &PIND, &PORTD, 4}, // D4 24 - {&DDRD, &PIND, &PORTD, 7}, // D7 25 - {&DDRB, &PINB, &PORTB, 4}, // B4 26 - {&DDRB, &PINB, &PORTB, 5}, // B5 27 - {&DDRB, &PINB, &PORTB, 6}, // B6 28 - {&DDRD, &PIND, &PORTD, 6} // D6 29 -}; -#endif // CORE_TEENSY -//------------------------------------------------------------------------------ -#elif defined(__AVR_AT90USB646__)\ -|| defined(__AVR_AT90USB1286__) -// Teensy++ 1.0 & 2.0 -static const pin_map_t pinMap[] = { - {&DDRD, &PIND, &PORTD, 0}, // D0 0 - {&DDRD, &PIND, &PORTD, 1}, // D1 1 - {&DDRD, &PIND, &PORTD, 2}, // D2 2 - {&DDRD, &PIND, &PORTD, 3}, // D3 3 - {&DDRD, &PIND, &PORTD, 4}, // D4 4 - {&DDRD, &PIND, &PORTD, 5}, // D5 5 - {&DDRD, &PIND, &PORTD, 6}, // D6 6 - {&DDRD, &PIND, &PORTD, 7}, // D7 7 - {&DDRE, &PINE, &PORTE, 0}, // E0 8 - {&DDRE, &PINE, &PORTE, 1}, // E1 9 - {&DDRC, &PINC, &PORTC, 0}, // C0 10 - {&DDRC, &PINC, &PORTC, 1}, // C1 11 - {&DDRC, &PINC, &PORTC, 2}, // C2 12 - {&DDRC, &PINC, &PORTC, 3}, // C3 13 - {&DDRC, &PINC, &PORTC, 4}, // C4 14 - {&DDRC, &PINC, &PORTC, 5}, // C5 15 - {&DDRC, &PINC, &PORTC, 6}, // C6 16 - {&DDRC, &PINC, &PORTC, 7}, // C7 17 - {&DDRE, &PINE, &PORTE, 6}, // E6 18 - {&DDRE, &PINE, &PORTE, 7}, // E7 19 - {&DDRB, &PINB, &PORTB, 0}, // B0 20 - {&DDRB, &PINB, &PORTB, 1}, // B1 21 - {&DDRB, &PINB, &PORTB, 2}, // B2 22 - {&DDRB, &PINB, &PORTB, 3}, // B3 23 - {&DDRB, &PINB, &PORTB, 4}, // B4 24 - {&DDRB, &PINB, &PORTB, 5}, // B5 25 - {&DDRB, &PINB, &PORTB, 6}, // B6 26 - {&DDRB, &PINB, &PORTB, 7}, // B7 27 - {&DDRA, &PINA, &PORTA, 0}, // A0 28 - {&DDRA, &PINA, &PORTA, 1}, // A1 29 - {&DDRA, &PINA, &PORTA, 2}, // A2 30 - {&DDRA, &PINA, &PORTA, 3}, // A3 31 - {&DDRA, &PINA, &PORTA, 4}, // A4 32 - {&DDRA, &PINA, &PORTA, 5}, // A5 33 - {&DDRA, &PINA, &PORTA, 6}, // A6 34 - {&DDRA, &PINA, &PORTA, 7}, // A7 35 - {&DDRE, &PINE, &PORTE, 4}, // E4 36 - {&DDRE, &PINE, &PORTE, 5}, // E5 37 - {&DDRF, &PINF, &PORTF, 0}, // F0 38 - {&DDRF, &PINF, &PORTF, 1}, // F1 39 - {&DDRF, &PINF, &PORTF, 2}, // F2 40 - {&DDRF, &PINF, &PORTF, 3}, // F3 41 - {&DDRF, &PINF, &PORTF, 4}, // F4 42 - {&DDRF, &PINF, &PORTF, 5}, // F5 43 - {&DDRF, &PINF, &PORTF, 6}, // F6 44 - {&DDRF, &PINF, &PORTF, 7} // F7 45 -}; -//------------------------------------------------------------------------------ -#else // CPU type -#error unknown CPU type -#endif // CPU type -//------------------------------------------------------------------------------ -/** count of pins */ -static const uint8_t digitalPinCount = sizeof(pinMap)/sizeof(pin_map_t); -//============================================================================== -/** generate bad pin number error */ -void badPinNumber(void) - __attribute__((error("Pin number is too large or not a constant"))); -//------------------------------------------------------------------------------ -/** Check for valid pin number - * @param[in] pin Number of pin to be checked. - */ -static inline __attribute__((always_inline)) -void badPinCheck(uint8_t pin) { - if (!__builtin_constant_p(pin) || pin >= digitalPinCount) { - badPinNumber(); - } -} -//------------------------------------------------------------------------------ -/** fast write helper - * @param[in] address I/O register address - * @param[in] bit bit number to write - * @param[in] level value for bit - */ -static inline __attribute__((always_inline)) -void fastBitWriteSafe(volatile uint8_t* address, uint8_t bit, bool level) { - uint8_t oldSREG; - if (address > (uint8_t*)0x5F) { - oldSREG = SREG; - cli(); - } - if (level) { - *address |= 1 << bit; - } else { - *address &= ~(1 << bit); - } - if (address > (uint8_t*)0x5F) { - SREG = oldSREG; - } -} -//------------------------------------------------------------------------------ -/** read pin value - * @param[in] pin Arduino pin number - * @return value read - */ -static inline __attribute__((always_inline)) -bool fastDigitalRead(uint8_t pin) { - badPinCheck(pin); - return (*pinMap[pin].pin >> pinMap[pin].bit) & 1; -} -//------------------------------------------------------------------------------ -/** toggle a pin - * @param[in] pin Arduino pin number - * - * If the pin is in output mode toggle the pin level. - * If the pin is in input mode toggle the state of the 20K pullup. - */ -static inline __attribute__((always_inline)) -void fastDigitalToggle(uint8_t pin) { - badPinCheck(pin); - if (pinMap[pin].pin > (uint8_t*)0x5F) { - // must write bit to high address port - *pinMap[pin].pin = 1 << pinMap[pin].bit; - } else { - // will compile to sbi and PIN register will not be read. - *pinMap[pin].pin |= 1 << pinMap[pin].bit; + /** + * Read pin value + * @param[in] pin Arduino pin number + * @return value read + */ + FORCE_INLINE static bool fastDigitalRead(uint8_t pin) { + return *portInputRegister(pin); } -} -//------------------------------------------------------------------------------ -/** Set pin value - * @param[in] pin Arduino pin number - * @param[in] level value to write - */ -static inline __attribute__((always_inline)) -void fastDigitalWrite(uint8_t pin, bool level) { - badPinCheck(pin); - fastBitWriteSafe(pinMap[pin].port, pinMap[pin].bit, level); -} -//------------------------------------------------------------------------------ -/** set pin mode - * @param[in] pin Arduino pin number - * @param[in] mode if true set output mode else input mode - * - * fastPinMode does not enable or disable the 20K pullup for input mode. - */ -static inline __attribute__((always_inline)) -void fastPinMode(uint8_t pin, bool mode) { - badPinCheck(pin); - fastBitWriteSafe(pinMap[pin].ddr, pinMap[pin].bit, mode); -} -#endif // __arm__ -//------------------------------------------------------------------------------ -/** set pin configuration + /** + * Set pin value + * @param[in] pin Arduino pin number + * @param[in] level value to write + */ + FORCE_INLINE static void fastDigitalWrite(uint8_t pin, bool value) { + if (value) + *portSetRegister(pin) = 1; + else + *portClearRegister(pin) = 1; + } + + #else // !CORE_TEENSY + + /** + * Read pin value + * @param[in] pin Arduino pin number + * @return value read + */ + FORCE_INLINE static bool fastDigitalRead(uint8_t pin) { + return g_APinDescription[pin].pPort->PIO_PDSR & g_APinDescription[pin].ulPin; + } + + /** + * Set pin value + * @param[in] pin Arduino pin number + * @param[in] level value to write + */ + FORCE_INLINE static void fastDigitalWrite(uint8_t pin, bool value) { + if (value) + g_APinDescription[pin].pPort->PIO_SODR = g_APinDescription[pin].ulPin; + else + g_APinDescription[pin].pPort->PIO_CODR = g_APinDescription[pin].ulPin; + } + + #endif // !CORE_TEENSY + + inline void fastDigitalToggle(uint8_t pin) { fastDigitalWrite(pin, !fastDigitalRead(pin)); } + + inline void fastPinMode(uint8_t pin, bool mode) { pinMode(pin, mode); } + +#else // !__arm__ + + #include + #include + + /** + * @class pin_map_t + * @brief struct for mapping digital pins + */ + struct pin_map_t { + volatile uint8_t* ddr; /**< address of DDR for this pin */ + volatile uint8_t* pin; /**< address of PIN for this pin */ + volatile uint8_t* port; /**< address of PORT for this pin */ + uint8_t bit; /**< bit number for this pin */ + }; + + #if defined(__AVR_ATmega168__) || defined(__AVR_ATmega168P__) || defined(__AVR_ATmega328P__) + + // 168 and 328 Arduinos + const static pin_map_t pinMap[] = { + {&DDRD, &PIND, &PORTD, 0}, // D0 0 + {&DDRD, &PIND, &PORTD, 1}, // D1 1 + {&DDRD, &PIND, &PORTD, 2}, // D2 2 + {&DDRD, &PIND, &PORTD, 3}, // D3 3 + {&DDRD, &PIND, &PORTD, 4}, // D4 4 + {&DDRD, &PIND, &PORTD, 5}, // D5 5 + {&DDRD, &PIND, &PORTD, 6}, // D6 6 + {&DDRD, &PIND, &PORTD, 7}, // D7 7 + {&DDRB, &PINB, &PORTB, 0}, // B0 8 + {&DDRB, &PINB, &PORTB, 1}, // B1 9 + {&DDRB, &PINB, &PORTB, 2}, // B2 10 + {&DDRB, &PINB, &PORTB, 3}, // B3 11 + {&DDRB, &PINB, &PORTB, 4}, // B4 12 + {&DDRB, &PINB, &PORTB, 5}, // B5 13 + {&DDRC, &PINC, &PORTC, 0}, // C0 14 + {&DDRC, &PINC, &PORTC, 1}, // C1 15 + {&DDRC, &PINC, &PORTC, 2}, // C2 16 + {&DDRC, &PINC, &PORTC, 3}, // C3 17 + {&DDRC, &PINC, &PORTC, 4}, // C4 18 + {&DDRC, &PINC, &PORTC, 5} // C5 19 + }; + + #elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) + + // Mega + static const pin_map_t pinMap[] = { + {&DDRE, &PINE, &PORTE, 0}, // E0 0 + {&DDRE, &PINE, &PORTE, 1}, // E1 1 + {&DDRE, &PINE, &PORTE, 4}, // E4 2 + {&DDRE, &PINE, &PORTE, 5}, // E5 3 + {&DDRG, &PING, &PORTG, 5}, // G5 4 + {&DDRE, &PINE, &PORTE, 3}, // E3 5 + {&DDRH, &PINH, &PORTH, 3}, // H3 6 + {&DDRH, &PINH, &PORTH, 4}, // H4 7 + {&DDRH, &PINH, &PORTH, 5}, // H5 8 + {&DDRH, &PINH, &PORTH, 6}, // H6 9 + {&DDRB, &PINB, &PORTB, 4}, // B4 10 + {&DDRB, &PINB, &PORTB, 5}, // B5 11 + {&DDRB, &PINB, &PORTB, 6}, // B6 12 + {&DDRB, &PINB, &PORTB, 7}, // B7 13 + {&DDRJ, &PINJ, &PORTJ, 1}, // J1 14 + {&DDRJ, &PINJ, &PORTJ, 0}, // J0 15 + {&DDRH, &PINH, &PORTH, 1}, // H1 16 + {&DDRH, &PINH, &PORTH, 0}, // H0 17 + {&DDRD, &PIND, &PORTD, 3}, // D3 18 + {&DDRD, &PIND, &PORTD, 2}, // D2 19 + {&DDRD, &PIND, &PORTD, 1}, // D1 20 + {&DDRD, &PIND, &PORTD, 0}, // D0 21 + {&DDRA, &PINA, &PORTA, 0}, // A0 22 + {&DDRA, &PINA, &PORTA, 1}, // A1 23 + {&DDRA, &PINA, &PORTA, 2}, // A2 24 + {&DDRA, &PINA, &PORTA, 3}, // A3 25 + {&DDRA, &PINA, &PORTA, 4}, // A4 26 + {&DDRA, &PINA, &PORTA, 5}, // A5 27 + {&DDRA, &PINA, &PORTA, 6}, // A6 28 + {&DDRA, &PINA, &PORTA, 7}, // A7 29 + {&DDRC, &PINC, &PORTC, 7}, // C7 30 + {&DDRC, &PINC, &PORTC, 6}, // C6 31 + {&DDRC, &PINC, &PORTC, 5}, // C5 32 + {&DDRC, &PINC, &PORTC, 4}, // C4 33 + {&DDRC, &PINC, &PORTC, 3}, // C3 34 + {&DDRC, &PINC, &PORTC, 2}, // C2 35 + {&DDRC, &PINC, &PORTC, 1}, // C1 36 + {&DDRC, &PINC, &PORTC, 0}, // C0 37 + {&DDRD, &PIND, &PORTD, 7}, // D7 38 + {&DDRG, &PING, &PORTG, 2}, // G2 39 + {&DDRG, &PING, &PORTG, 1}, // G1 40 + {&DDRG, &PING, &PORTG, 0}, // G0 41 + {&DDRL, &PINL, &PORTL, 7}, // L7 42 + {&DDRL, &PINL, &PORTL, 6}, // L6 43 + {&DDRL, &PINL, &PORTL, 5}, // L5 44 + {&DDRL, &PINL, &PORTL, 4}, // L4 45 + {&DDRL, &PINL, &PORTL, 3}, // L3 46 + {&DDRL, &PINL, &PORTL, 2}, // L2 47 + {&DDRL, &PINL, &PORTL, 1}, // L1 48 + {&DDRL, &PINL, &PORTL, 0}, // L0 49 + {&DDRB, &PINB, &PORTB, 3}, // B3 50 + {&DDRB, &PINB, &PORTB, 2}, // B2 51 + {&DDRB, &PINB, &PORTB, 1}, // B1 52 + {&DDRB, &PINB, &PORTB, 0}, // B0 53 + {&DDRF, &PINF, &PORTF, 0}, // F0 54 + {&DDRF, &PINF, &PORTF, 1}, // F1 55 + {&DDRF, &PINF, &PORTF, 2}, // F2 56 + {&DDRF, &PINF, &PORTF, 3}, // F3 57 + {&DDRF, &PINF, &PORTF, 4}, // F4 58 + {&DDRF, &PINF, &PORTF, 5}, // F5 59 + {&DDRF, &PINF, &PORTF, 6}, // F6 60 + {&DDRF, &PINF, &PORTF, 7}, // F7 61 + {&DDRK, &PINK, &PORTK, 0}, // K0 62 + {&DDRK, &PINK, &PORTK, 1}, // K1 63 + {&DDRK, &PINK, &PORTK, 2}, // K2 64 + {&DDRK, &PINK, &PORTK, 3}, // K3 65 + {&DDRK, &PINK, &PORTK, 4}, // K4 66 + {&DDRK, &PINK, &PORTK, 5}, // K5 67 + {&DDRK, &PINK, &PORTK, 6}, // K6 68 + {&DDRK, &PINK, &PORTK, 7}, // K7 69 + + // pins_MIGHTYBOARD_REVE.h + {&DDRG, &PING, &PORTG, 4}, // G4 70 + {&DDRG, &PING, &PORTG, 3}, // G3 71 + {&DDRJ, &PINJ, &PORTJ, 2}, // J2 72 + {&DDRJ, &PINJ, &PORTJ, 3}, // J3 73 + {&DDRJ, &PINJ, &PORTJ, 7}, // J7 74 + {&DDRJ, &PINJ, &PORTJ, 4}, // J4 75 + {&DDRJ, &PINJ, &PORTJ, 5}, // J5 76 + {&DDRJ, &PINJ, &PORTJ, 6}, // J6 77 + {&DDRE, &PINE, &PORTE, 2}, // E2 78 + {&DDRE, &PINE, &PORTE, 6} // E6 79 + }; + + #elif defined(__AVR_ATmega1284P__) || defined(__AVR_ATmega1284__) \ + || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644__) \ + || defined(__AVR_ATmega64__) || defined(__AVR_ATmega32__) \ + || defined(__AVR_ATmega324__) || defined(__AVR_ATmega16__) + + #ifdef VARIANT_MIGHTY + + // Mighty Layout + static const pin_map_t pinMap[] = { + {&DDRB, &PINB, &PORTB, 0}, // B0 0 + {&DDRB, &PINB, &PORTB, 1}, // B1 1 + {&DDRB, &PINB, &PORTB, 2}, // B2 2 + {&DDRB, &PINB, &PORTB, 3}, // B3 3 + {&DDRB, &PINB, &PORTB, 4}, // B4 4 + {&DDRB, &PINB, &PORTB, 5}, // B5 5 + {&DDRB, &PINB, &PORTB, 6}, // B6 6 + {&DDRB, &PINB, &PORTB, 7}, // B7 7 + {&DDRD, &PIND, &PORTD, 0}, // D0 8 + {&DDRD, &PIND, &PORTD, 1}, // D1 9 + {&DDRD, &PIND, &PORTD, 2}, // D2 10 + {&DDRD, &PIND, &PORTD, 3}, // D3 11 + {&DDRD, &PIND, &PORTD, 4}, // D4 12 + {&DDRD, &PIND, &PORTD, 5}, // D5 13 + {&DDRD, &PIND, &PORTD, 6}, // D6 14 + {&DDRD, &PIND, &PORTD, 7}, // D7 15 + {&DDRC, &PINC, &PORTC, 0}, // C0 16 + {&DDRC, &PINC, &PORTC, 1}, // C1 17 + {&DDRC, &PINC, &PORTC, 2}, // C2 18 + {&DDRC, &PINC, &PORTC, 3}, // C3 19 + {&DDRC, &PINC, &PORTC, 4}, // C4 20 + {&DDRC, &PINC, &PORTC, 5}, // C5 21 + {&DDRC, &PINC, &PORTC, 6}, // C6 22 + {&DDRC, &PINC, &PORTC, 7}, // C7 23 + {&DDRA, &PINA, &PORTA, 0}, // A0 24 + {&DDRA, &PINA, &PORTA, 1}, // A1 25 + {&DDRA, &PINA, &PORTA, 2}, // A2 26 + {&DDRA, &PINA, &PORTA, 3}, // A3 27 + {&DDRA, &PINA, &PORTA, 4}, // A4 28 + {&DDRA, &PINA, &PORTA, 5}, // A5 29 + {&DDRA, &PINA, &PORTA, 6}, // A6 30 + {&DDRA, &PINA, &PORTA, 7} // A7 31 + }; + + #elif defined(VARIANT_BOBUINO) + + // Bobuino Layout + static const pin_map_t pinMap[] = { + {&DDRD, &PIND, &PORTD, 0}, // D0 0 + {&DDRD, &PIND, &PORTD, 1}, // D1 1 + {&DDRD, &PIND, &PORTD, 2}, // D2 2 + {&DDRD, &PIND, &PORTD, 3}, // D3 3 + {&DDRB, &PINB, &PORTB, 0}, // B0 4 + {&DDRB, &PINB, &PORTB, 1}, // B1 5 + {&DDRB, &PINB, &PORTB, 2}, // B2 6 + {&DDRB, &PINB, &PORTB, 3}, // B3 7 + {&DDRD, &PIND, &PORTD, 5}, // D5 8 + {&DDRD, &PIND, &PORTD, 6}, // D6 9 + {&DDRB, &PINB, &PORTB, 4}, // B4 10 + {&DDRB, &PINB, &PORTB, 5}, // B5 11 + {&DDRB, &PINB, &PORTB, 6}, // B6 12 + {&DDRB, &PINB, &PORTB, 7}, // B7 13 + {&DDRA, &PINA, &PORTA, 7}, // A7 14 + {&DDRA, &PINA, &PORTA, 6}, // A6 15 + {&DDRA, &PINA, &PORTA, 5}, // A5 16 + {&DDRA, &PINA, &PORTA, 4}, // A4 17 + {&DDRA, &PINA, &PORTA, 3}, // A3 18 + {&DDRA, &PINA, &PORTA, 2}, // A2 19 + {&DDRA, &PINA, &PORTA, 1}, // A1 20 + {&DDRA, &PINA, &PORTA, 0}, // A0 21 + {&DDRC, &PINC, &PORTC, 0}, // C0 22 + {&DDRC, &PINC, &PORTC, 1}, // C1 23 + {&DDRC, &PINC, &PORTC, 2}, // C2 24 + {&DDRC, &PINC, &PORTC, 3}, // C3 25 + {&DDRC, &PINC, &PORTC, 4}, // C4 26 + {&DDRC, &PINC, &PORTC, 5}, // C5 27 + {&DDRC, &PINC, &PORTC, 6}, // C6 28 + {&DDRC, &PINC, &PORTC, 7}, // C7 29 + {&DDRD, &PIND, &PORTD, 4}, // D4 30 + {&DDRD, &PIND, &PORTD, 7} // D7 31 + }; + + #elif defined(VARIANT_STANDARD) + + // Standard Layout + static const pin_map_t pinMap[] = { + {&DDRB, &PINB, &PORTB, 0}, // B0 0 + {&DDRB, &PINB, &PORTB, 1}, // B1 1 + {&DDRB, &PINB, &PORTB, 2}, // B2 2 + {&DDRB, &PINB, &PORTB, 3}, // B3 3 + {&DDRB, &PINB, &PORTB, 4}, // B4 4 + {&DDRB, &PINB, &PORTB, 5}, // B5 5 + {&DDRB, &PINB, &PORTB, 6}, // B6 6 + {&DDRB, &PINB, &PORTB, 7}, // B7 7 + {&DDRD, &PIND, &PORTD, 0}, // D0 8 + {&DDRD, &PIND, &PORTD, 1}, // D1 9 + {&DDRD, &PIND, &PORTD, 2}, // D2 10 + {&DDRD, &PIND, &PORTD, 3}, // D3 11 + {&DDRD, &PIND, &PORTD, 4}, // D4 12 + {&DDRD, &PIND, &PORTD, 5}, // D5 13 + {&DDRD, &PIND, &PORTD, 6}, // D6 14 + {&DDRD, &PIND, &PORTD, 7}, // D7 15 + {&DDRC, &PINC, &PORTC, 0}, // C0 16 + {&DDRC, &PINC, &PORTC, 1}, // C1 17 + {&DDRC, &PINC, &PORTC, 2}, // C2 18 + {&DDRC, &PINC, &PORTC, 3}, // C3 19 + {&DDRC, &PINC, &PORTC, 4}, // C4 20 + {&DDRC, &PINC, &PORTC, 5}, // C5 21 + {&DDRC, &PINC, &PORTC, 6}, // C6 22 + {&DDRC, &PINC, &PORTC, 7}, // C7 23 + {&DDRA, &PINA, &PORTA, 7}, // A7 24 + {&DDRA, &PINA, &PORTA, 6}, // A6 25 + {&DDRA, &PINA, &PORTA, 5}, // A5 26 + {&DDRA, &PINA, &PORTA, 4}, // A4 27 + {&DDRA, &PINA, &PORTA, 3}, // A3 28 + {&DDRA, &PINA, &PORTA, 2}, // A2 29 + {&DDRA, &PINA, &PORTA, 1}, // A1 30 + {&DDRA, &PINA, &PORTA, 0} // A0 31 + }; + + #else // !(VARIANT_MIGHTY || VARIANT_BOBUINO || VARIANT_STANDARD) + + #error Undefined variant 1284, 644, 324, 64, 32 + + #endif + + #elif defined(__AVR_ATmega32U4__) + + #ifdef CORE_TEENSY + + // Teensy 2.0 + static const pin_map_t pinMap[] = { + {&DDRB, &PINB, &PORTB, 0}, // B0 0 + {&DDRB, &PINB, &PORTB, 1}, // B1 1 + {&DDRB, &PINB, &PORTB, 2}, // B2 2 + {&DDRB, &PINB, &PORTB, 3}, // B3 3 + {&DDRB, &PINB, &PORTB, 7}, // B7 4 + {&DDRD, &PIND, &PORTD, 0}, // D0 5 + {&DDRD, &PIND, &PORTD, 1}, // D1 6 + {&DDRD, &PIND, &PORTD, 2}, // D2 7 + {&DDRD, &PIND, &PORTD, 3}, // D3 8 + {&DDRC, &PINC, &PORTC, 6}, // C6 9 + {&DDRC, &PINC, &PORTC, 7}, // C7 10 + {&DDRD, &PIND, &PORTD, 6}, // D6 11 + {&DDRD, &PIND, &PORTD, 7}, // D7 12 + {&DDRB, &PINB, &PORTB, 4}, // B4 13 + {&DDRB, &PINB, &PORTB, 5}, // B5 14 + {&DDRB, &PINB, &PORTB, 6}, // B6 15 + {&DDRF, &PINF, &PORTF, 7}, // F7 16 + {&DDRF, &PINF, &PORTF, 6}, // F6 17 + {&DDRF, &PINF, &PORTF, 5}, // F5 18 + {&DDRF, &PINF, &PORTF, 4}, // F4 19 + {&DDRF, &PINF, &PORTF, 1}, // F1 20 + {&DDRF, &PINF, &PORTF, 0}, // F0 21 + {&DDRD, &PIND, &PORTD, 4}, // D4 22 + {&DDRD, &PIND, &PORTD, 5}, // D5 23 + {&DDRE, &PINE, &PORTE, 6} // E6 24 + }; + + #else // !CORE_TEENSY + + // Leonardo + static const pin_map_t pinMap[] = { + {&DDRD, &PIND, &PORTD, 2}, // D2 0 + {&DDRD, &PIND, &PORTD, 3}, // D3 1 + {&DDRD, &PIND, &PORTD, 1}, // D1 2 + {&DDRD, &PIND, &PORTD, 0}, // D0 3 + {&DDRD, &PIND, &PORTD, 4}, // D4 4 + {&DDRC, &PINC, &PORTC, 6}, // C6 5 + {&DDRD, &PIND, &PORTD, 7}, // D7 6 + {&DDRE, &PINE, &PORTE, 6}, // E6 7 + {&DDRB, &PINB, &PORTB, 4}, // B4 8 + {&DDRB, &PINB, &PORTB, 5}, // B5 9 + {&DDRB, &PINB, &PORTB, 6}, // B6 10 + {&DDRB, &PINB, &PORTB, 7}, // B7 11 + {&DDRD, &PIND, &PORTD, 6}, // D6 12 + {&DDRC, &PINC, &PORTC, 7}, // C7 13 + {&DDRB, &PINB, &PORTB, 3}, // B3 14 + {&DDRB, &PINB, &PORTB, 1}, // B1 15 + {&DDRB, &PINB, &PORTB, 2}, // B2 16 + {&DDRB, &PINB, &PORTB, 0}, // B0 17 + {&DDRF, &PINF, &PORTF, 7}, // F7 18 + {&DDRF, &PINF, &PORTF, 6}, // F6 19 + {&DDRF, &PINF, &PORTF, 5}, // F5 20 + {&DDRF, &PINF, &PORTF, 4}, // F4 21 + {&DDRF, &PINF, &PORTF, 1}, // F1 22 + {&DDRF, &PINF, &PORTF, 0}, // F0 23 + {&DDRD, &PIND, &PORTD, 4}, // D4 24 + {&DDRD, &PIND, &PORTD, 7}, // D7 25 + {&DDRB, &PINB, &PORTB, 4}, // B4 26 + {&DDRB, &PINB, &PORTB, 5}, // B5 27 + {&DDRB, &PINB, &PORTB, 6}, // B6 28 + {&DDRD, &PIND, &PORTD, 6} // D6 29 + }; + + #endif // !CORE_TEENSY + + #elif defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__) + + // Teensy++ 1.0 & 2.0 + static const pin_map_t pinMap[] = { + {&DDRD, &PIND, &PORTD, 0}, // D0 0 + {&DDRD, &PIND, &PORTD, 1}, // D1 1 + {&DDRD, &PIND, &PORTD, 2}, // D2 2 + {&DDRD, &PIND, &PORTD, 3}, // D3 3 + {&DDRD, &PIND, &PORTD, 4}, // D4 4 + {&DDRD, &PIND, &PORTD, 5}, // D5 5 + {&DDRD, &PIND, &PORTD, 6}, // D6 6 + {&DDRD, &PIND, &PORTD, 7}, // D7 7 + {&DDRE, &PINE, &PORTE, 0}, // E0 8 + {&DDRE, &PINE, &PORTE, 1}, // E1 9 + {&DDRC, &PINC, &PORTC, 0}, // C0 10 + {&DDRC, &PINC, &PORTC, 1}, // C1 11 + {&DDRC, &PINC, &PORTC, 2}, // C2 12 + {&DDRC, &PINC, &PORTC, 3}, // C3 13 + {&DDRC, &PINC, &PORTC, 4}, // C4 14 + {&DDRC, &PINC, &PORTC, 5}, // C5 15 + {&DDRC, &PINC, &PORTC, 6}, // C6 16 + {&DDRC, &PINC, &PORTC, 7}, // C7 17 + {&DDRE, &PINE, &PORTE, 6}, // E6 18 + {&DDRE, &PINE, &PORTE, 7}, // E7 19 + {&DDRB, &PINB, &PORTB, 0}, // B0 20 + {&DDRB, &PINB, &PORTB, 1}, // B1 21 + {&DDRB, &PINB, &PORTB, 2}, // B2 22 + {&DDRB, &PINB, &PORTB, 3}, // B3 23 + {&DDRB, &PINB, &PORTB, 4}, // B4 24 + {&DDRB, &PINB, &PORTB, 5}, // B5 25 + {&DDRB, &PINB, &PORTB, 6}, // B6 26 + {&DDRB, &PINB, &PORTB, 7}, // B7 27 + {&DDRA, &PINA, &PORTA, 0}, // A0 28 + {&DDRA, &PINA, &PORTA, 1}, // A1 29 + {&DDRA, &PINA, &PORTA, 2}, // A2 30 + {&DDRA, &PINA, &PORTA, 3}, // A3 31 + {&DDRA, &PINA, &PORTA, 4}, // A4 32 + {&DDRA, &PINA, &PORTA, 5}, // A5 33 + {&DDRA, &PINA, &PORTA, 6}, // A6 34 + {&DDRA, &PINA, &PORTA, 7}, // A7 35 + {&DDRE, &PINE, &PORTE, 4}, // E4 36 + {&DDRE, &PINE, &PORTE, 5}, // E5 37 + {&DDRF, &PINF, &PORTF, 0}, // F0 38 + {&DDRF, &PINF, &PORTF, 1}, // F1 39 + {&DDRF, &PINF, &PORTF, 2}, // F2 40 + {&DDRF, &PINF, &PORTF, 3}, // F3 41 + {&DDRF, &PINF, &PORTF, 4}, // F4 42 + {&DDRF, &PINF, &PORTF, 5}, // F5 43 + {&DDRF, &PINF, &PORTF, 6}, // F6 44 + {&DDRF, &PINF, &PORTF, 7} // F7 45 + }; + + #else // CPU type + + #error "Unknown CPU type for Software SPI" + + #endif // CPU type + + /** count of pins */ + static constexpr uint8_t digitalPinCount = sizeof(pinMap) / sizeof(pin_map_t); + + /** generate bad pin number error */ + void badPinNumber(void) + __attribute__((error("Pin number is too large or not a constant"))); + + /** + * Check for valid pin number + * @param[in] pin Number of pin to be checked. + */ + FORCE_INLINE static void badPinCheck(const uint8_t pin) { + if (!__builtin_constant_p(pin) || pin >= digitalPinCount) badPinNumber(); + } + + /** + * Fast write helper + * @param[in] address I/O register address + * @param[in] bit bit number to write + * @param[in] level value for bit + */ + FORCE_INLINE static void fastBitWriteSafe(volatile uint8_t* address, uint8_t bit, bool level) { + uint8_t oldSREG; + if (address > (uint8_t*)0x5F) { oldSREG = SREG; cli(); } + if (level) SBI(*address, bit); else CBI(*address, bit); + if (address > (uint8_t*)0x5F) SREG = oldSREG; + } + + /** + * Read pin value + * @param[in] pin Arduino pin number + * @return value read + */ + FORCE_INLINE static bool fastDigitalRead(uint8_t pin) { + badPinCheck(pin); + return (*pinMap[pin].pin >> pinMap[pin].bit) & 1; + } + + /** + * Toggle a pin + * @param[in] pin Arduino pin number + * + * If the pin is in output mode toggle the pin level. + * If the pin is in input mode toggle the state of the 20K pullup. + */ + FORCE_INLINE static void fastDigitalToggle(uint8_t pin) { + badPinCheck(pin); + if (pinMap[pin].pin > (uint8_t*)0x5F) + *pinMap[pin].pin = _BV(pinMap[pin].bit); // Must write bit to high address port + else + SBI(*pinMap[pin].pin, pinMap[pin].bit); // Compiles to sbi and PIN register will not be read + } + + /** + * Set pin value + * @param[in] pin Arduino pin number + * @param[in] level value to write + */ + FORCE_INLINE static void fastDigitalWrite(uint8_t pin, bool level) { + badPinCheck(pin); + fastBitWriteSafe(pinMap[pin].port, pinMap[pin].bit, level); + } + + /** + * Set pin mode + * @param[in] pin Arduino pin number + * @param[in] mode if true set output mode else input mode + * + * fastPinMode does not enable or disable the 20K pullup for input mode. + */ + FORCE_INLINE static void fastPinMode(uint8_t pin, bool mode) { + badPinCheck(pin); + fastBitWriteSafe(pinMap[pin].ddr, pinMap[pin].bit, mode); + } + +#endif // !__arm__ + +/** + * Set pin configuration * @param[in] pin Arduino pin number * @param[in] mode If true set output mode else input mode * @param[in] level If mode is output, set level high/low. * If mode is input, enable or disable the pin's 20K pullup. */ -static inline __attribute__((always_inline)) -void fastPinConfig(uint8_t pin, bool mode, bool level) { +FORCE_INLINE static void fastPinConfig(uint8_t pin, bool mode, bool level) { fastPinMode(pin, mode); fastDigitalWrite(pin, level); } -//============================================================================== + /** * @class DigitalPin * @brief Fast digital port I/O */ template class DigitalPin { - public: - //---------------------------------------------------------------------------- +public: + /** Constructor */ DigitalPin() {} - //---------------------------------------------------------------------------- - /** Constructor + + /** + * Constructor * @param[in] pinMode if true set output mode else input mode. */ - explicit DigitalPin(bool pinMode) { - mode(pinMode); - } - //---------------------------------------------------------------------------- - /** Constructor + explicit DigitalPin(bool pinMode) { mode(pinMode); } + + /** + * Constructor * @param[in] mode If true set output mode else input mode * @param[in] level If mode is output, set level high/low. * If mode is input, enable or disable the pin's 20K pullup. */ - DigitalPin(bool mode, bool level) { - config(mode, level); - } - //---------------------------------------------------------------------------- - /** Asignment operator + DigitalPin(bool mode, bool level) { config(mode, level); } + + /** + * Assignment operator * @param[in] value If true set the pin's level high else set the * pin's level low. * * @return This DigitalPin instance. */ - inline DigitalPin & operator = (bool value) __attribute__((always_inline)) { - write(value); - return *this; - } - //---------------------------------------------------------------------------- - /** Parenthesis operator + FORCE_INLINE DigitalPin & operator = (bool value) { write(value); return *this; } + + /** + * Parentheses operator * @return Pin's level */ - inline operator bool () const __attribute__((always_inline)) { - return read(); - } - //---------------------------------------------------------------------------- - /** set pin configuration + FORCE_INLINE operator bool () const { return read(); } + + /** + * Set pin configuration * @param[in] mode If true set output mode else input mode * @param[in] level If mode is output, set level high/low. * If mode is input, enable or disable the pin's 20K pullup. */ - inline __attribute__((always_inline)) - void config(bool mode, bool level) { - fastPinConfig(PinNumber, mode, level); - } - //---------------------------------------------------------------------------- + FORCE_INLINE void config(bool mode, bool level) { fastPinConfig(PinNumber, mode, level); } + /** * Set pin level high if output mode or enable 20K pullup if input mode. */ - inline __attribute__((always_inline)) - void high() {write(true);} - //---------------------------------------------------------------------------- + FORCE_INLINE void high() { write(true); } + /** * Set pin level low if output mode or disable 20K pullup if input mode. */ - inline __attribute__((always_inline)) - void low() {write(false);} - //---------------------------------------------------------------------------- + FORCE_INLINE void low() { write(false); } + /** * Set pin mode * @param[in] pinMode if true set output mode else input mode. * * mode() does not enable or disable the 20K pullup for input mode. */ - inline __attribute__((always_inline)) - void mode(bool pinMode) { - fastPinMode(PinNumber, pinMode); - } - //---------------------------------------------------------------------------- + FORCE_INLINE void mode(bool pinMode) { fastPinMode(PinNumber, pinMode); } + /** @return Pin's level */ - inline __attribute__((always_inline)) - bool read() const { - return fastDigitalRead(PinNumber); - } - //---------------------------------------------------------------------------- - /** toggle a pin - * + FORCE_INLINE bool read() const { return fastDigitalRead(PinNumber); } + + /** + * Toggle a pin * If the pin is in output mode toggle the pin's level. * If the pin is in input mode toggle the state of the 20K pullup. */ - inline __attribute__((always_inline)) - void toggle() { - fastDigitalToggle(PinNumber); - } - //---------------------------------------------------------------------------- - /** Write the pin's level. + FORCE_INLINE void toggle() { fastDigitalToggle(PinNumber); } + + /** + * Write the pin's level. * @param[in] value If true set the pin's level high else set the * pin's level low. */ - inline __attribute__((always_inline)) - void write(bool value) { - fastDigitalWrite(PinNumber, value); - } + FORCE_INLINE void write(bool value) { fastDigitalWrite(PinNumber, value); } }; -//------------------------------------------------------------------------------ -/** Nop for timing. */ -#define nop __asm__ volatile ("nop") -//------------------------------------------------------------------------------ -/** Pin Mode for MISO is input.*/ -const bool MISO_MODE = false; -/** Pullups disabled for MISO are disabled. */ -const bool MISO_LEVEL = false; -/** Pin Mode for MOSI is output.*/ -const bool MOSI_MODE = true; -/** Pin Mode for SCK is output. */ -const bool SCK_MODE = true; -//------------------------------------------------------------------------------ +const bool MISO_MODE = false, // Pin Mode for MISO is input. + MISO_LEVEL = false, // Pullups disabled for MISO are disabled. + MOSI_MODE = true, // Pin Mode for MOSI is output. + SCK_MODE = true; // Pin Mode for SCK is output. + /** * @class SoftSPI * @brief Fast software SPI. @@ -657,19 +637,19 @@ const bool SCK_MODE = true; template class SoftSPI { public: - //---------------------------------------------------------------------------- + /** Initialize SoftSPI pins. */ void begin() { fastPinConfig(MisoPin, MISO_MODE, MISO_LEVEL); fastPinConfig(MosiPin, MOSI_MODE, !MODE_CPHA(Mode)); fastPinConfig(SckPin, SCK_MODE, MODE_CPOL(Mode)); } - //---------------------------------------------------------------------------- - /** Soft SPI receive byte. + + /** + * Soft SPI receive byte. * @return Data byte received. */ - inline __attribute__((always_inline)) - uint8_t receive() { + FORCE_INLINE uint8_t receive() { uint8_t data = 0; receiveBit(7, &data); receiveBit(6, &data); @@ -681,12 +661,12 @@ class SoftSPI { receiveBit(0, &data); return data; } - //---------------------------------------------------------------------------- - /** Soft SPI send byte. + + /** + * Soft SPI send byte. * @param[in] data Data byte to send. */ - inline __attribute__((always_inline)) - void send(uint8_t data) { + FORCE_INLINE void send(uint8_t data) { sendBit(7, data); sendBit(6, data); sendBit(5, data); @@ -696,13 +676,13 @@ class SoftSPI { sendBit(1, data); sendBit(0, data); } - //---------------------------------------------------------------------------- - /** Soft SPI transfer byte. + + /** + * Soft SPI transfer byte. * @param[in] txData Data byte to send. * @return Data byte received. */ - inline __attribute__((always_inline)) - uint8_t transfer(uint8_t txData) { + FORCE_INLINE uint8_t transfer(uint8_t txData) { uint8_t rxData = 0; transferBit(7, &rxData, txData); transferBit(6, &rxData, txData); @@ -716,53 +696,35 @@ class SoftSPI { } private: - //---------------------------------------------------------------------------- - inline __attribute__((always_inline)) - bool MODE_CPHA(uint8_t mode) {return (mode & 1) != 0;} - inline __attribute__((always_inline)) - bool MODE_CPOL(uint8_t mode) {return (mode & 2) != 0;} - inline __attribute__((always_inline)) - void receiveBit(uint8_t bit, uint8_t* data) { - if (MODE_CPHA(Mode)) { - fastDigitalWrite(SckPin, !MODE_CPOL(Mode)); - } + + FORCE_INLINE bool MODE_CPHA(uint8_t mode) { return bool(mode & 1); } + FORCE_INLINE bool MODE_CPOL(uint8_t mode) { return bool(mode & 2); } + FORCE_INLINE void receiveBit(uint8_t bit, uint8_t* data) { + if (MODE_CPHA(Mode)) fastDigitalWrite(SckPin, !MODE_CPOL(Mode)); nop; nop; fastDigitalWrite(SckPin, MODE_CPHA(Mode) ? MODE_CPOL(Mode) : !MODE_CPOL(Mode)); - if (fastDigitalRead(MisoPin)) *data |= 1 << bit; - if (!MODE_CPHA(Mode)) { - fastDigitalWrite(SckPin, MODE_CPOL(Mode)); - } + if (fastDigitalRead(MisoPin)) SBI(*data, bit); + if (!MODE_CPHA(Mode)) fastDigitalWrite(SckPin, MODE_CPOL(Mode)); } - //---------------------------------------------------------------------------- - inline __attribute__((always_inline)) - void sendBit(uint8_t bit, uint8_t data) { - if (MODE_CPHA(Mode)) { - fastDigitalWrite(SckPin, !MODE_CPOL(Mode)); - } - fastDigitalWrite(MosiPin, data & (1 << bit)); - fastDigitalWrite(SckPin, - MODE_CPHA(Mode) ? MODE_CPOL(Mode) : !MODE_CPOL(Mode)); + + FORCE_INLINE void sendBit(uint8_t bit, uint8_t data) { + if (MODE_CPHA(Mode)) fastDigitalWrite(SckPin, !MODE_CPOL(Mode)); + fastDigitalWrite(MosiPin, data & _BV(bit)); + fastDigitalWrite(SckPin, MODE_CPHA(Mode) ? MODE_CPOL(Mode) : !MODE_CPOL(Mode)); nop; nop; - if (!MODE_CPHA(Mode)) { - fastDigitalWrite(SckPin, MODE_CPOL(Mode)); - } + if (!MODE_CPHA(Mode)) fastDigitalWrite(SckPin, MODE_CPOL(Mode)); } - //---------------------------------------------------------------------------- - inline __attribute__((always_inline)) - void transferBit(uint8_t bit, uint8_t* rxData, uint8_t txData) { - if (MODE_CPHA(Mode)) { - fastDigitalWrite(SckPin, !MODE_CPOL(Mode)); - } - fastDigitalWrite(MosiPin, txData & (1 << bit)); + + FORCE_INLINE void transferBit(uint8_t bit, uint8_t* rxData, uint8_t txData) { + if (MODE_CPHA(Mode)) fastDigitalWrite(SckPin, !MODE_CPOL(Mode)); + fastDigitalWrite(MosiPin, txData & _BV(bit)); fastDigitalWrite(SckPin, MODE_CPHA(Mode) ? MODE_CPOL(Mode) : !MODE_CPOL(Mode)); - if (fastDigitalRead(MisoPin)) *rxData |= 1 << bit; - if (!MODE_CPHA(Mode)) { - fastDigitalWrite(SckPin, MODE_CPOL(Mode)); - } + if (fastDigitalRead(MisoPin)) SBI(*rxData, bit); + if (!MODE_CPHA(Mode)) fastDigitalWrite(SckPin, MODE_CPOL(Mode)); } - //---------------------------------------------------------------------------- + }; diff --git a/Marlin/src/libs/stopwatch.h b/Marlin/src/libs/stopwatch.h index 69efe0c3a2..c1e9ea74f8 100644 --- a/Marlin/src/libs/stopwatch.h +++ b/Marlin/src/libs/stopwatch.h @@ -19,15 +19,13 @@ * along with this program. If not, see . * */ - -#ifndef STOPWATCH_H -#define STOPWATCH_H +#pragma once // Print debug messages with M111 S2 (Uses 156 bytes of PROGMEM) //#define DEBUG_STOPWATCH -#include "../core/macros.h" -#include "../core/types.h" +#include "../core/macros.h" // for FORCE_INLINE +#include "../core/millis_t.h" /** * @brief Stopwatch class @@ -36,11 +34,7 @@ */ class Stopwatch { private: - enum State : char { - STOPPED, - RUNNING, - PAUSED - }; + enum State : char { STOPPED, RUNNING, PAUSED }; static Stopwatch::State state; static millis_t accumulator; @@ -120,5 +114,3 @@ class Stopwatch { #endif }; - -#endif // STOPWATCH_H diff --git a/Marlin/src/libs/vector_3.cpp b/Marlin/src/libs/vector_3.cpp index e4fe0afaac..cb9f3272f1 100644 --- a/Marlin/src/libs/vector_3.cpp +++ b/Marlin/src/libs/vector_3.cpp @@ -51,22 +51,22 @@ vector_3::vector_3() : x(0), y(0), z(0) { } vector_3::vector_3(float x_, float y_, float z_) : x(x_), y(y_), z(z_) { } -vector_3 vector_3::cross(vector_3 left, vector_3 right) { +vector_3 vector_3::cross(const vector_3 &left, const vector_3 &right) { return vector_3(left.y * right.z - left.z * right.y, left.z * right.x - left.x * right.z, left.x * right.y - left.y * right.x); } -vector_3 vector_3::operator+(vector_3 v) { return vector_3((x + v.x), (y + v.y), (z + v.z)); } -vector_3 vector_3::operator-(vector_3 v) { return vector_3((x - v.x), (y - v.y), (z - v.z)); } +vector_3 vector_3::operator+(const vector_3 &v) { return vector_3((x + v.x), (y + v.y), (z + v.z)); } +vector_3 vector_3::operator-(const vector_3 &v) { return vector_3((x - v.x), (y - v.y), (z - v.z)); } -vector_3 vector_3::get_normal() { +vector_3 vector_3::get_normal() const { vector_3 normalized = vector_3(x, y, z); normalized.normalize(); return normalized; } -float vector_3::get_length() { return SQRT(sq(x) + sq(y) + sq(z)); } +float vector_3::get_length() const { return SQRT(sq(x) + sq(y) + sq(z)); } void vector_3::normalize() { const float inv_length = RSQRT(sq(x) + sq(y) + sq(z)); @@ -75,16 +75,14 @@ void vector_3::normalize() { z *= inv_length; } -void vector_3::apply_rotation(matrix_3x3 matrix) { - const float resultX = x * matrix.matrix[3 * 0 + 0] + y * matrix.matrix[3 * 1 + 0] + z * matrix.matrix[3 * 2 + 0], - resultY = x * matrix.matrix[3 * 0 + 1] + y * matrix.matrix[3 * 1 + 1] + z * matrix.matrix[3 * 2 + 1], - resultZ = x * matrix.matrix[3 * 0 + 2] + y * matrix.matrix[3 * 1 + 2] + z * matrix.matrix[3 * 2 + 2]; - x = resultX; - y = resultY; - z = resultZ; +void vector_3::apply_rotation(const matrix_3x3 &matrix) { + const float _x = x, _y = y; + x = _x * matrix.matrix[3 * 0 + 0] + _y * matrix.matrix[3 * 1 + 0] + z * matrix.matrix[3 * 2 + 0]; + y = _x * matrix.matrix[3 * 0 + 1] + _y * matrix.matrix[3 * 1 + 1] + z * matrix.matrix[3 * 2 + 1]; + z = _x * matrix.matrix[3 * 0 + 2] + _y * matrix.matrix[3 * 1 + 2] + z * matrix.matrix[3 * 2 + 2]; } -void vector_3::debug(const char * const title) { +void vector_3::debug(PGM_P const title) { serialprintPGM(title); SERIAL_PROTOCOLPGM(" x: "); SERIAL_PROTOCOL_F(x, 6); @@ -95,7 +93,7 @@ void vector_3::debug(const char * const title) { SERIAL_EOL(); } -void apply_rotation_xyz(matrix_3x3 matrix, float &x, float &y, float &z) { +void apply_rotation_xyz(const matrix_3x3 &matrix, float &x, float &y, float &z) { vector_3 vector = vector_3(x, y, z); vector.apply_rotation(matrix); x = vector.x; @@ -103,7 +101,7 @@ void apply_rotation_xyz(matrix_3x3 matrix, float &x, float &y, float &z) { z = vector.z; } -matrix_3x3 matrix_3x3::create_from_rows(vector_3 row_0, vector_3 row_1, vector_3 row_2) { +matrix_3x3 matrix_3x3::create_from_rows(const vector_3 &row_0, const vector_3 &row_1, const vector_3 &row_2) { //row_0.debug(PSTR("row_0")); //row_1.debug(PSTR("row_1")); //row_2.debug(PSTR("row_2")); @@ -121,10 +119,10 @@ void matrix_3x3::set_to_identity() { matrix[6] = 0; matrix[7] = 0; matrix[8] = 1; } -matrix_3x3 matrix_3x3::create_look_at(vector_3 target) { - vector_3 z_row = target.get_normal(); - vector_3 x_row = vector_3(1, 0, -target.x / target.z).get_normal(); - vector_3 y_row = vector_3::cross(z_row, x_row).get_normal(); +matrix_3x3 matrix_3x3::create_look_at(const vector_3 &target) { + vector_3 z_row = target.get_normal(), + x_row = vector_3(1, 0, -target.x / target.z).get_normal(), + y_row = vector_3::cross(z_row, x_row).get_normal(); // x_row.debug(PSTR("x_row")); // y_row.debug(PSTR("y_row")); @@ -137,7 +135,7 @@ matrix_3x3 matrix_3x3::create_look_at(vector_3 target) { return rot; } -matrix_3x3 matrix_3x3::transpose(matrix_3x3 original) { +matrix_3x3 matrix_3x3::transpose(const matrix_3x3 &original) { matrix_3x3 new_matrix; new_matrix.matrix[0] = original.matrix[0]; new_matrix.matrix[1] = original.matrix[3]; new_matrix.matrix[2] = original.matrix[6]; new_matrix.matrix[3] = original.matrix[1]; new_matrix.matrix[4] = original.matrix[4]; new_matrix.matrix[5] = original.matrix[7]; @@ -145,7 +143,7 @@ matrix_3x3 matrix_3x3::transpose(matrix_3x3 original) { return new_matrix; } -void matrix_3x3::debug(const char * const title) { +void matrix_3x3::debug(PGM_P const title) { if (title != NULL) { serialprintPGM(title); SERIAL_EOL(); @@ -163,4 +161,3 @@ void matrix_3x3::debug(const char * const title) { } #endif // HAS_ABL - diff --git a/Marlin/src/libs/vector_3.h b/Marlin/src/libs/vector_3.h index aed4364b91..b1f0f7977f 100644 --- a/Marlin/src/libs/vector_3.h +++ b/Marlin/src/libs/vector_3.h @@ -39,8 +39,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef VECTOR_3_H -#define VECTOR_3_H +#pragma once class matrix_3x3; @@ -50,32 +49,29 @@ struct vector_3 { vector_3(); vector_3(float x, float y, float z); - static vector_3 cross(vector_3 a, vector_3 b); + static vector_3 cross(const vector_3 &a, const vector_3 &b); - vector_3 operator+(vector_3 v); - vector_3 operator-(vector_3 v); + vector_3 operator+(const vector_3 &v); + vector_3 operator-(const vector_3 &v); void normalize(); - float get_length(); - vector_3 get_normal(); + float get_length() const; + vector_3 get_normal() const; - void debug(const char * const title); - - void apply_rotation(matrix_3x3 matrix); + void debug(PGM_P const title); + void apply_rotation(const matrix_3x3 &matrix); }; struct matrix_3x3 { float matrix[9]; - static matrix_3x3 create_from_rows(vector_3 row_0, vector_3 row_1, vector_3 row_2); - static matrix_3x3 create_look_at(vector_3 target); - static matrix_3x3 transpose(matrix_3x3 original); + static matrix_3x3 create_from_rows(const vector_3 &row_0, const vector_3 &row_1, const vector_3 &row_2); + static matrix_3x3 create_look_at(const vector_3 &target); + static matrix_3x3 transpose(const matrix_3x3 &original); void set_to_identity(); - void debug(const char * const title); + void debug(PGM_P const title); }; -void apply_rotation_xyz(matrix_3x3 rotationMatrix, float &x, float &y, float &z); - -#endif // VECTOR_3_H +void apply_rotation_xyz(const matrix_3x3 &rotationMatrix, float &x, float &y, float &z); diff --git a/Marlin/src/module/configuration_store.cpp b/Marlin/src/module/configuration_store.cpp index 81dd1db206..2da6ea3eb2 100644 --- a/Marlin/src/module/configuration_store.cpp +++ b/Marlin/src/module/configuration_store.cpp @@ -37,7 +37,7 @@ */ // Change EEPROM version if the structure changes -#define EEPROM_VERSION "V58" +#define EEPROM_VERSION "V63" #define EEPROM_OFFSET 100 // Check the integrity of data offsets. @@ -66,40 +66,52 @@ #include "../gcode/gcode.h" #include "../Marlin.h" +#if ENABLED(EEPROM_SETTINGS) || ENABLED(SD_FIRMWARE_UPDATE) + #include "../HAL/shared/persistent_store_api.h" +#endif + #if HAS_LEVELING #include "../feature/bedlevel/bedlevel.h" #endif #if HAS_SERVOS #include "servo.h" +#else + #undef NUM_SERVOS + #define NUM_SERVOS NUM_SERVO_PLUGS #endif #if HAS_BED_PROBE #include "../module/probe.h" #endif +#include "../feature/fwretract.h" + +#if ENABLED(POWER_LOSS_RECOVERY) + #include "../feature/power_loss_recovery.h" +#endif + +#include "../feature/pause.h" + +#if EXTRUDERS > 1 + #include "tool_change.h" + void M217_report(const bool eeprom); +#endif + #if HAS_TRINAMIC #include "stepper_indirection.h" #include "../feature/tmc_util.h" - #define TMC_GET_PWMTHRS(A,Q) _tmc_thrs(stepper##Q.microsteps(), stepper##Q.TPWMTHRS(), planner.axis_steps_per_mm[_AXIS(A)]) -#endif - -#if ENABLED(FWRETRACT) - #include "../feature/fwretract.h" -#endif - -#if ENABLED(ADVANCED_PAUSE_FEATURE) - #include "../feature/pause.h" -#endif - -#if ENABLED(PID_EXTRUSION_SCALING) - #define LPQ_LEN thermalManager.lpq_len + #define TMC_GET_PWMTHRS(A,Q) _tmc_thrs(stepper##Q.microsteps(), stepper##Q.TPWMTHRS(), planner.settings.axis_steps_per_mm[_AXIS(A)]) #endif #pragma pack(push, 1) // No padding between variables -typedef struct PID { float Kp, Ki, Kd; } PID; -typedef struct PIDC { float Kp, Ki, Kd, Kc; } PIDC; +typedef struct { uint16_t X, Y, Z, X2, Y2, Z2, Z3, E0, E1, E2, E3, E4, E5; } tmc_stepper_current_t; +typedef struct { uint32_t X, Y, Z, X2, Y2, Z2, Z3, E0, E1, E2, E3, E4, E5; } tmc_hybrid_threshold_t; +typedef struct { int16_t X, Y, Z; } tmc_sgt_t; + +// Limit an index to an array size +#define ALIM(I,ARR) MIN(I, COUNT(ARR) - 1) /** * Current EEPROM Layout @@ -116,19 +128,12 @@ typedef struct SettingsDataStruct { // uint8_t esteppers; // XYZE_N - XYZ - uint32_t planner_max_acceleration_mm_per_s2[XYZE_N], // M201 XYZE planner.max_acceleration_mm_per_s2[XYZE_N] - planner_min_segment_time_us; // M205 B planner.min_segment_time_us - float planner_axis_steps_per_mm[XYZE_N], // M92 XYZE planner.axis_steps_per_mm[XYZE_N] - planner_max_feedrate_mm_s[XYZE_N], // M203 XYZE planner.max_feedrate_mm_s[XYZE_N] - planner_acceleration, // M204 P planner.acceleration - planner_retract_acceleration, // M204 R planner.retract_acceleration - planner_travel_acceleration, // M204 T planner.travel_acceleration - planner_min_feedrate_mm_s, // M205 S planner.min_feedrate_mm_s - planner_min_travel_feedrate_mm_s, // M205 T planner.min_travel_feedrate_mm_s - planner_max_jerk[XYZE], // M205 XYZE planner.max_jerk[XYZE] - planner_junction_deviation_mm; // M205 J planner.junction_deviation_mm + planner_settings_t planner_settings; - float home_offset[XYZ]; // M206 XYZ + float planner_max_jerk[XYZE], // M205 XYZE planner.max_jerk[XYZE] + planner_junction_deviation_mm; // M205 J planner.junction_deviation_mm + + float home_offset[XYZ]; // M206 XYZ / M665 TPZ #if HAS_HOTEND_OFFSET float hotend_offset[XYZ][HOTENDS - 1]; // M218 XYZ @@ -182,7 +187,7 @@ typedef struct SettingsDataStruct { // // SERVO_ANGLES // - uint16_t servo_angles[NUM_SERVO_PLUGS][2]; // M281 P L U + uint16_t servo_angles[NUM_SERVOS][2]; // M281 P L U // // DELTA / [XYZ]_DUAL_ENDSTOPS @@ -196,50 +201,45 @@ typedef struct SettingsDataStruct { delta_calibration_radius, // M665 B delta_tower_angle_trim[ABC]; // M665 XYZ #elif ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS - float x2_endstop_adj, // M666 X - y2_endstop_adj, // M666 Y - z2_endstop_adj; // M666 Z - #if ENABLED(Z_TRIPLE_ENDSTOPS) - float z3_endstop_adj; // M666 Z - #endif + float x2_endstop_adj, // M666 X + y2_endstop_adj, // M666 Y + z2_endstop_adj, // M666 Z (S2) + z3_endstop_adj; // M666 Z (S3) #endif // // ULTIPANEL // - int16_t lcd_preheat_hotend_temp[2], // M145 S0 H - lcd_preheat_bed_temp[2], // M145 S0 B - lcd_preheat_fan_speed[2]; // M145 S0 F + int16_t ui_preheat_hotend_temp[2], // M145 S0 H + ui_preheat_bed_temp[2]; // M145 S0 B + uint8_t ui_preheat_fan_speed[2]; // M145 S0 F // // PIDTEMP // - PIDC hotendPID[HOTENDS]; // M301 En PIDC / M303 En U - + PIDC_t hotendPID[HOTENDS]; // M301 En PIDC / M303 En U int16_t lpq_len; // M301 L // // PIDTEMPBED // - PID bedPID; // M304 PID / M303 E-1 U + PID_t bedPID; // M304 PID / M303 E-1 U // // HAS_LCD_CONTRAST // - int16_t lcd_contrast; // M250 C + int16_t lcd_contrast; // M250 C + + // + // POWER_LOSS_RECOVERY + // + bool recovery_enabled; // M413 S // // FWRETRACT // + fwretract_settings_t fwretract_settings; // M207 S F Z W, M208 S F W R bool autoretract_enabled; // M209 S - float retract_length, // M207 S - retract_feedrate_mm_s, // M207 F - retract_zlift, // M207 Z - retract_recover_length, // M208 S - retract_recover_feedrate_mm_s, // M208 F - swap_retract_length, // M207 W - swap_retract_recover_length, // M208 W - swap_retract_recover_feedrate_mm_s; // M208 R // // !NO_VOLUMETRIC @@ -250,10 +250,9 @@ typedef struct SettingsDataStruct { // // HAS_TRINAMIC // - #define TMC_AXES (MAX_EXTRUDERS + 7) - uint16_t tmc_stepper_current[TMC_AXES]; // M906 X Y Z X2 Y2 Z2 Z3 E0 E1 E2 E3 E4 E5 - uint32_t tmc_hybrid_threshold[TMC_AXES]; // M913 X Y Z X2 Y2 Z2 Z3 E0 E1 E2 E3 E4 E5 - int16_t tmc_sgt[XYZ]; // M914 X Y Z + tmc_stepper_current_t tmc_stepper_current; // M906 X Y Z X2 Y2 Z2 Z3 E0 E1 E2 E3 E4 E5 + tmc_hybrid_threshold_t tmc_hybrid_threshold; // M913 X Y Z X2 Y2 Z2 Z3 E0 E1 E2 E3 E4 E5 + tmc_sgt_t tmc_sgt; // M914 X Y Z // // LIN_ADVANCE @@ -263,7 +262,7 @@ typedef struct SettingsDataStruct { // // HAS_MOTOR_CURRENT_PWM // - uint32_t motor_current_setting[XYZ]; // M907 X Z E + uint32_t motor_current_setting[3]; // M907 X Z E // // CNC_COORDINATE_SYSTEMS @@ -273,20 +272,22 @@ typedef struct SettingsDataStruct { // // SKEW_CORRECTION // - float planner_xy_skew_factor, // M852 I planner.xy_skew_factor - planner_xz_skew_factor, // M852 J planner.xz_skew_factor - planner_yz_skew_factor; // M852 K planner.yz_skew_factor + skew_factor_t planner_skew_factor; // M852 I J K planner.skew_factor // // ADVANCED_PAUSE_FEATURE // - float filament_change_unload_length[EXTRUDERS], // M603 T U - filament_change_load_length[EXTRUDERS]; // M603 T L + fil_change_settings_t fc_settings[EXTRUDERS]; // M603 T U L + + // + // Tool-change settings + // + #if EXTRUDERS > 1 + toolchange_settings_t toolchange_settings; // M217 S P R + #endif } SettingsData; -#pragma pack(pop) - MarlinSettings settings; uint16_t MarlinSettings::datasize() { return sizeof(SettingsData); } @@ -300,7 +301,7 @@ uint16_t MarlinSettings::datasize() { return sizeof(SettingsData); } #endif void MarlinSettings::postprocess() { - const float oldpos[] = { current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] }; + const float oldpos[XYZE] = { current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS] }; // steps per s2 needs to be updated to agree with units per s2 planner.reset_acceleration_rates(); @@ -322,10 +323,11 @@ void MarlinSettings::postprocess() { planner.refresh_e_factor(i); #endif - #if HAS_HOME_OFFSET || ENABLED(DUAL_X_CARRIAGE) - // Software endstops depend on home_offset - LOOP_XYZ(i) update_software_endstops((AxisEnum)i); - #endif + // Software endstops depend on home_offset + LOOP_XYZ(i) { + update_workspace_offset((AxisEnum)i); + update_software_endstops((AxisEnum)i); + } #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) set_z_fade_height(new_z_fade_height, false); // false = no report @@ -356,17 +358,41 @@ void MarlinSettings::postprocess() { report_current_position(); } -#if ENABLED(EEPROM_SETTINGS) - #include "../HAL/shared/persistent_store_api.h" +#if ENABLED(SD_FIRMWARE_UPDATE) + + #if ENABLED(EEPROM_SETTINGS) + static_assert( + !WITHIN(SD_FIRMWARE_UPDATE_EEPROM_ADDR, EEPROM_OFFSET, EEPROM_OFFSET + sizeof(SettingsData)), + "SD_FIRMWARE_UPDATE_EEPROM_ADDR collides with EEPROM settings storage." + ); + #endif + + bool MarlinSettings::sd_update_status() { + uint8_t val; + persistentStore.read_data(SD_FIRMWARE_UPDATE_EEPROM_ADDR, &val); + return (val == SD_FIRMWARE_UPDATE_ACTIVE_VALUE); + } + + bool MarlinSettings::set_sd_update_status(const bool enable) { + if (enable != sd_update_status()) + persistentStore.write_data( + SD_FIRMWARE_UPDATE_EEPROM_ADDR, + enable ? SD_FIRMWARE_UPDATE_ACTIVE_VALUE : SD_FIRMWARE_UPDATE_INACTIVE_VALUE + ); + return true; + } + +#endif // SD_FIRMWARE_UPDATE + +#if ENABLED(EEPROM_SETTINGS) - #define DUMMY_PID_VALUE 3000.0f #define EEPROM_START() int eeprom_index = EEPROM_OFFSET; persistentStore.access_start() #define EEPROM_FINISH() persistentStore.access_finish() #define EEPROM_SKIP(VAR) eeprom_index += sizeof(VAR) #define EEPROM_WRITE(VAR) persistentStore.write_data(eeprom_index, (uint8_t*)&VAR, sizeof(VAR), &working_crc) #define EEPROM_READ(VAR) persistentStore.read_data(eeprom_index, (uint8_t*)&VAR, sizeof(VAR), &working_crc, !validating) #define EEPROM_READ_ALWAYS(VAR) persistentStore.read_data(eeprom_index, (uint8_t*)&VAR, sizeof(VAR), &working_crc) - #define EEPROM_ASSERT(TST,ERR) if (!(TST)) do{ SERIAL_ERROR_START_P(port); SERIAL_ERRORLNPGM_P(port, ERR); eeprom_error = true; }while(0) + #define EEPROM_ASSERT(TST,ERR) do{ if (!(TST)) { SERIAL_ERROR_START_P(port); SERIAL_ERRORLNPGM_P(port, ERR); eeprom_error = true; } }while(0) #if ENABLED(DEBUG_EEPROM_READWRITE) #define _FIELD_TEST(FIELD) \ @@ -416,386 +442,433 @@ void MarlinSettings::postprocess() { _FIELD_TEST(esteppers); - const uint8_t esteppers = COUNT(planner.axis_steps_per_mm) - XYZ; + const uint8_t esteppers = COUNT(planner.settings.axis_steps_per_mm) - XYZ; EEPROM_WRITE(esteppers); - EEPROM_WRITE(planner.max_acceleration_mm_per_s2); - EEPROM_WRITE(planner.min_segment_time_us); - EEPROM_WRITE(planner.axis_steps_per_mm); - EEPROM_WRITE(planner.max_feedrate_mm_s); - EEPROM_WRITE(planner.acceleration); - EEPROM_WRITE(planner.retract_acceleration); - EEPROM_WRITE(planner.travel_acceleration); - EEPROM_WRITE(planner.min_feedrate_mm_s); - EEPROM_WRITE(planner.min_travel_feedrate_mm_s); + // + // Planner Motion + // + { + EEPROM_WRITE(planner.settings); - #if HAS_CLASSIC_JERK - EEPROM_WRITE(planner.max_jerk); - #if ENABLED(JUNCTION_DEVIATION) && ENABLED(LIN_ADVANCE) - dummy = float(DEFAULT_EJERK); + #if HAS_CLASSIC_JERK + EEPROM_WRITE(planner.max_jerk); + #if ENABLED(JUNCTION_DEVIATION) && ENABLED(LIN_ADVANCE) + dummy = float(DEFAULT_EJERK); + EEPROM_WRITE(dummy); + #endif + #else + const float planner_max_jerk[XYZE] = { float(DEFAULT_XJERK), float(DEFAULT_YJERK), float(DEFAULT_ZJERK), float(DEFAULT_EJERK) }; + EEPROM_WRITE(planner_max_jerk); + #endif + + #if ENABLED(JUNCTION_DEVIATION) + EEPROM_WRITE(planner.junction_deviation_mm); + #else + dummy = 0.02f; EEPROM_WRITE(dummy); #endif - #else - const float planner_max_jerk[] = { float(DEFAULT_XJERK), float(DEFAULT_YJERK), float(DEFAULT_ZJERK), float(DEFAULT_EJERK) }; - EEPROM_WRITE(planner_max_jerk); - #endif + } - #if ENABLED(JUNCTION_DEVIATION) - EEPROM_WRITE(planner.junction_deviation_mm); - #else - dummy = 0.02f; - EEPROM_WRITE(dummy); - #endif + // + // Home Offset + // + { + _FIELD_TEST(home_offset); - _FIELD_TEST(home_offset); + #if HAS_SCARA_OFFSET + EEPROM_WRITE(scara_home_offset); + #else + #if !HAS_HOME_OFFSET + const float home_offset[XYZ] = { 0 }; + #endif + EEPROM_WRITE(home_offset); + #endif - #if !HAS_HOME_OFFSET - const float home_offset[XYZ] = { 0 }; - #endif - EEPROM_WRITE(home_offset); - - #if HAS_HOTEND_OFFSET - // Skip hotend 0 which must be 0 - for (uint8_t e = 1; e < HOTENDS; e++) - LOOP_XYZ(i) EEPROM_WRITE(hotend_offset[i][e]); - #endif + #if HAS_HOTEND_OFFSET + // Skip hotend 0 which must be 0 + for (uint8_t e = 1; e < HOTENDS; e++) + LOOP_XYZ(i) EEPROM_WRITE(hotend_offset[i][e]); + #endif + } // // Global Leveling // - - #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) - const float zfh = planner.z_fade_height; - #else - const float zfh = 10.0; - #endif - EEPROM_WRITE(zfh); + { + const float zfh = ( + #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) + planner.z_fade_height + #else + 10.0 + #endif + ); + EEPROM_WRITE(zfh); + } // // Mesh Bed Leveling // + { + #if ENABLED(MESH_BED_LEVELING) + // Compile time test that sizeof(mbl.z_values) is as expected + static_assert( + sizeof(mbl.z_values) == (GRID_MAX_POINTS) * sizeof(mbl.z_values[0][0]), + "MBL Z array is the wrong size." + ); + const uint8_t mesh_num_x = GRID_MAX_POINTS_X, mesh_num_y = GRID_MAX_POINTS_Y; + EEPROM_WRITE(mbl.z_offset); + EEPROM_WRITE(mesh_num_x); + EEPROM_WRITE(mesh_num_y); + EEPROM_WRITE(mbl.z_values); + #else // For disabled MBL write a default mesh + dummy = 0; + const uint8_t mesh_num_x = 3, mesh_num_y = 3; + EEPROM_WRITE(dummy); // z_offset + EEPROM_WRITE(mesh_num_x); + EEPROM_WRITE(mesh_num_y); + for (uint8_t q = mesh_num_x * mesh_num_y; q--;) EEPROM_WRITE(dummy); + #endif + } - #if ENABLED(MESH_BED_LEVELING) - // Compile time test that sizeof(mbl.z_values) is as expected - static_assert( - sizeof(mbl.z_values) == GRID_MAX_POINTS * sizeof(mbl.z_values[0][0]), - "MBL Z array is the wrong size." - ); - const uint8_t mesh_num_x = GRID_MAX_POINTS_X, mesh_num_y = GRID_MAX_POINTS_Y; - EEPROM_WRITE(mbl.z_offset); - EEPROM_WRITE(mesh_num_x); - EEPROM_WRITE(mesh_num_y); - EEPROM_WRITE(mbl.z_values); - #else // For disabled MBL write a default mesh - dummy = 0; - const uint8_t mesh_num_x = 3, mesh_num_y = 3; - EEPROM_WRITE(dummy); // z_offset - EEPROM_WRITE(mesh_num_x); - EEPROM_WRITE(mesh_num_y); - for (uint8_t q = mesh_num_x * mesh_num_y; q--;) EEPROM_WRITE(dummy); - #endif // MESH_BED_LEVELING + // + // Probe Z Offset + // + { + _FIELD_TEST(zprobe_zoffset); - _FIELD_TEST(zprobe_zoffset); - - #if !HAS_BED_PROBE - const float zprobe_zoffset = 0; - #endif - EEPROM_WRITE(zprobe_zoffset); + #if !HAS_BED_PROBE + const float zprobe_zoffset = 0; + #endif + EEPROM_WRITE(zprobe_zoffset); + } // // Planar Bed Leveling matrix // - - #if ABL_PLANAR - EEPROM_WRITE(planner.bed_level_matrix); - #else - dummy = 0; - for (uint8_t q = 9; q--;) EEPROM_WRITE(dummy); - #endif + { + #if ABL_PLANAR + EEPROM_WRITE(planner.bed_level_matrix); + #else + dummy = 0; + for (uint8_t q = 9; q--;) EEPROM_WRITE(dummy); + #endif + } // // Bilinear Auto Bed Leveling // - - #if ENABLED(AUTO_BED_LEVELING_BILINEAR) - // Compile time test that sizeof(z_values) is as expected - static_assert( - sizeof(z_values) == GRID_MAX_POINTS * sizeof(z_values[0][0]), - "Bilinear Z array is the wrong size." - ); - const uint8_t grid_max_x = GRID_MAX_POINTS_X, grid_max_y = GRID_MAX_POINTS_Y; - EEPROM_WRITE(grid_max_x); // 1 byte - EEPROM_WRITE(grid_max_y); // 1 byte - EEPROM_WRITE(bilinear_grid_spacing); // 2 ints - EEPROM_WRITE(bilinear_start); // 2 ints - EEPROM_WRITE(z_values); // 9-256 floats - #else - // For disabled Bilinear Grid write an empty 3x3 grid - const uint8_t grid_max_x = 3, grid_max_y = 3; - const int bilinear_start[2] = { 0 }, bilinear_grid_spacing[2] = { 0 }; - dummy = 0; - EEPROM_WRITE(grid_max_x); - EEPROM_WRITE(grid_max_y); - EEPROM_WRITE(bilinear_grid_spacing); - EEPROM_WRITE(bilinear_start); - for (uint16_t q = grid_max_x * grid_max_y; q--;) EEPROM_WRITE(dummy); - #endif // AUTO_BED_LEVELING_BILINEAR - - _FIELD_TEST(planner_leveling_active); - - #if ENABLED(AUTO_BED_LEVELING_UBL) - EEPROM_WRITE(planner.leveling_active); - EEPROM_WRITE(ubl.storage_slot); - #else - const bool ubl_active = false; - const int8_t storage_slot = -1; - EEPROM_WRITE(ubl_active); - EEPROM_WRITE(storage_slot); - #endif // AUTO_BED_LEVELING_UBL - - #if !HAS_SERVOS || DISABLED(EDITABLE_SERVO_ANGLES) - #if ENABLED(SWITCHING_EXTRUDER) - constexpr uint16_t sesa[][2] = SWITCHING_EXTRUDER_SERVO_ANGLES; + { + #if ENABLED(AUTO_BED_LEVELING_BILINEAR) + // Compile time test that sizeof(z_values) is as expected + static_assert( + sizeof(z_values) == (GRID_MAX_POINTS) * sizeof(z_values[0][0]), + "Bilinear Z array is the wrong size." + ); + const uint8_t grid_max_x = GRID_MAX_POINTS_X, grid_max_y = GRID_MAX_POINTS_Y; + EEPROM_WRITE(grid_max_x); // 1 byte + EEPROM_WRITE(grid_max_y); // 1 byte + EEPROM_WRITE(bilinear_grid_spacing); // 2 ints + EEPROM_WRITE(bilinear_start); // 2 ints + EEPROM_WRITE(z_values); // 9-256 floats + #else + // For disabled Bilinear Grid write an empty 3x3 grid + const uint8_t grid_max_x = 3, grid_max_y = 3; + const int bilinear_start[2] = { 0 }, bilinear_grid_spacing[2] = { 0 }; + dummy = 0; + EEPROM_WRITE(grid_max_x); + EEPROM_WRITE(grid_max_y); + EEPROM_WRITE(bilinear_grid_spacing); + EEPROM_WRITE(bilinear_start); + for (uint16_t q = grid_max_x * grid_max_y; q--;) EEPROM_WRITE(dummy); #endif - constexpr uint16_t servo_angles[NUM_SERVO_PLUGS][2] = { + } + + // + // Unified Bed Leveling + // + { + _FIELD_TEST(planner_leveling_active); + + #if ENABLED(AUTO_BED_LEVELING_UBL) + EEPROM_WRITE(planner.leveling_active); + EEPROM_WRITE(ubl.storage_slot); + #else + const bool ubl_active = false; + const int8_t storage_slot = -1; + EEPROM_WRITE(ubl_active); + EEPROM_WRITE(storage_slot); + #endif // AUTO_BED_LEVELING_UBL + } + + // + // Servo Angles + // + { + #if !(HAS_SERVOS && ENABLED(EDITABLE_SERVO_ANGLES)) + + uint16_t servo_angles[NUM_SERVOS][2] = { { 0, 0 } }; + #if ENABLED(SWITCHING_EXTRUDER) - [SWITCHING_EXTRUDER_SERVO_NR] = { sesa[0][0], sesa[0][1] } + + constexpr uint16_t sesa[][2] = SWITCHING_EXTRUDER_SERVO_ANGLES; + servo_angles[SWITCHING_EXTRUDER_SERVO_NR][0] = sesa[0][0]; + servo_angles[SWITCHING_EXTRUDER_SERVO_NR][1] = sesa[0][1]; #if EXTRUDERS > 3 - , [SWITCHING_EXTRUDER_E23_SERVO_NR] = { sesa[1][0], sesa[1][1] } + servo_angles[SWITCHING_EXTRUDER_E23_SERVO_NR][0] = sesa[1][0]; + servo_angles[SWITCHING_EXTRUDER_E23_SERVO_NR][1] = sesa[1][1]; #endif + #elif ENABLED(SWITCHING_NOZZLE) - [SWITCHING_NOZZLE_SERVO_NR] = SWITCHING_NOZZLE_SERVO_ANGLES + + constexpr uint16_t snsa[] = SWITCHING_NOZZLE_SERVO_ANGLES; + servo_angles[SWITCHING_NOZZLE_SERVO_NR][0] = snsa[0]; + servo_angles[SWITCHING_NOZZLE_SERVO_NR][1] = snsa[1]; + #elif defined(Z_SERVO_ANGLES) && defined(Z_PROBE_SERVO_NR) - [Z_PROBE_SERVO_NR] = Z_SERVO_ANGLES + + constexpr uint16_t zsa[] = Z_SERVO_ANGLES; + servo_angles[Z_PROBE_SERVO_NR][0] = zsa[0]; + servo_angles[Z_PROBE_SERVO_NR][1] = zsa[1]; + #endif - }; - #endif - EEPROM_WRITE(servo_angles); + #endif // !HAS_SERVOS || !EDITABLE_SERVO_ANGLES - // 11 floats for DELTA / [XYZ]_DUAL_ENDSTOPS - #if ENABLED(DELTA) + EEPROM_WRITE(servo_angles); + } - _FIELD_TEST(delta_height); + // + // DELTA Geometry or Dual Endstops offsets + // + { + #if ENABLED(DELTA) - EEPROM_WRITE(delta_height); // 1 float - EEPROM_WRITE(delta_endstop_adj); // 3 floats - EEPROM_WRITE(delta_radius); // 1 float - EEPROM_WRITE(delta_diagonal_rod); // 1 float - EEPROM_WRITE(delta_segments_per_second); // 1 float - EEPROM_WRITE(delta_calibration_radius); // 1 float - EEPROM_WRITE(delta_tower_angle_trim); // 3 floats + _FIELD_TEST(delta_height); - #elif ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS + EEPROM_WRITE(delta_height); // 1 float + EEPROM_WRITE(delta_endstop_adj); // 3 floats + EEPROM_WRITE(delta_radius); // 1 float + EEPROM_WRITE(delta_diagonal_rod); // 1 float + EEPROM_WRITE(delta_segments_per_second); // 1 float + EEPROM_WRITE(delta_calibration_radius); // 1 float + EEPROM_WRITE(delta_tower_angle_trim); // 3 floats - _FIELD_TEST(x2_endstop_adj); + #elif ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS - // Write dual endstops in X, Y, Z order. Unused = 0.0 - dummy = 0; - #if ENABLED(X_DUAL_ENDSTOPS) - EEPROM_WRITE(endstops.x2_endstop_adj); // 1 float - #else - EEPROM_WRITE(dummy); - #endif + _FIELD_TEST(x2_endstop_adj); - #if ENABLED(Y_DUAL_ENDSTOPS) - EEPROM_WRITE(endstops.y2_endstop_adj); // 1 float - #else - EEPROM_WRITE(dummy); - #endif - - #if Z_MULTI_ENDSTOPS - EEPROM_WRITE(endstops.z2_endstop_adj); // 1 float - #else - EEPROM_WRITE(dummy); - #endif - - #if ENABLED(Z_TRIPLE_ENDSTOPS) - EEPROM_WRITE(endstops.z3_endstop_adj); // 1 float - #else - EEPROM_WRITE(dummy); - #endif - - #endif - - _FIELD_TEST(lcd_preheat_hotend_temp); - - #if DISABLED(ULTIPANEL) - constexpr int16_t lcd_preheat_hotend_temp[2] = { PREHEAT_1_TEMP_HOTEND, PREHEAT_2_TEMP_HOTEND }, - lcd_preheat_bed_temp[2] = { PREHEAT_1_TEMP_BED, PREHEAT_2_TEMP_BED }, - lcd_preheat_fan_speed[2] = { PREHEAT_1_FAN_SPEED, PREHEAT_2_FAN_SPEED }; - #endif - - EEPROM_WRITE(lcd_preheat_hotend_temp); - EEPROM_WRITE(lcd_preheat_bed_temp); - EEPROM_WRITE(lcd_preheat_fan_speed); - - for (uint8_t e = 0; e < HOTENDS; e++) { - #if ENABLED(PIDTEMP) - EEPROM_WRITE(PID_PARAM(Kp, e)); - EEPROM_WRITE(PID_PARAM(Ki, e)); - EEPROM_WRITE(PID_PARAM(Kd, e)); - #if ENABLED(PID_EXTRUSION_SCALING) - EEPROM_WRITE(PID_PARAM(Kc, e)); + // Write dual endstops in X, Y, Z order. Unused = 0.0 + dummy = 0; + #if ENABLED(X_DUAL_ENDSTOPS) + EEPROM_WRITE(endstops.x2_endstop_adj); // 1 float #else - dummy = 1.0f; // 1.0 = default kc EEPROM_WRITE(dummy); #endif - #else - dummy = DUMMY_PID_VALUE; // When read, will not change the existing value - EEPROM_WRITE(dummy); // Kp - dummy = 0; - for (uint8_t q = 3; q--;) EEPROM_WRITE(dummy); // Ki, Kd, Kc + + #if ENABLED(Y_DUAL_ENDSTOPS) + EEPROM_WRITE(endstops.y2_endstop_adj); // 1 float + #else + EEPROM_WRITE(dummy); + #endif + + #if Z_MULTI_ENDSTOPS + EEPROM_WRITE(endstops.z2_endstop_adj); // 1 float + #else + EEPROM_WRITE(dummy); + #endif + + #if ENABLED(Z_TRIPLE_ENDSTOPS) + EEPROM_WRITE(endstops.z3_endstop_adj); // 1 float + #else + EEPROM_WRITE(dummy); + #endif + #endif - } // Hotends Loop + } - _FIELD_TEST(lpq_len); + // + // LCD Preheat settings + // + { + _FIELD_TEST(lcd_preheat_hotend_temp); - #if DISABLED(PID_EXTRUSION_SCALING) - const int16_t LPQ_LEN = 20; - #endif - EEPROM_WRITE(LPQ_LEN); - - #if DISABLED(PIDTEMPBED) - dummy = DUMMY_PID_VALUE; - for (uint8_t q = 3; q--;) EEPROM_WRITE(dummy); - #else - EEPROM_WRITE(thermalManager.bedKp); - EEPROM_WRITE(thermalManager.bedKi); - EEPROM_WRITE(thermalManager.bedKd); - #endif - - _FIELD_TEST(lcd_contrast); - - #if !HAS_LCD_CONTRAST - const int16_t lcd_contrast = 32; - #endif - EEPROM_WRITE(lcd_contrast); - - const bool autoretract_enabled = - #if DISABLED(FWRETRACT_AUTORETRACT) - false + #if HAS_LCD_MENU + const int16_t (&ui_preheat_hotend_temp)[2] = ui.preheat_hotend_temp, + (&ui_preheat_bed_temp)[2] = ui.preheat_bed_temp; + const uint8_t (&ui_preheat_fan_speed)[2] = ui.preheat_fan_speed; #else - fwretract.autoretract_enabled + constexpr int16_t ui_preheat_hotend_temp[2] = { PREHEAT_1_TEMP_HOTEND, PREHEAT_2_TEMP_HOTEND }, + ui_preheat_bed_temp[2] = { PREHEAT_1_TEMP_BED, PREHEAT_2_TEMP_BED }; + constexpr uint8_t ui_preheat_fan_speed[2] = { PREHEAT_1_FAN_SPEED, PREHEAT_2_FAN_SPEED }; #endif - ; - EEPROM_WRITE(autoretract_enabled); - #if DISABLED(FWRETRACT) - const float autoretract_defaults[] = { 3, 45, 0, 0, 0, 13, 0, 8 }; - EEPROM_WRITE(autoretract_defaults); - #else - EEPROM_WRITE(fwretract.retract_length); - EEPROM_WRITE(fwretract.retract_feedrate_mm_s); - EEPROM_WRITE(fwretract.retract_zlift); - EEPROM_WRITE(fwretract.retract_recover_length); - EEPROM_WRITE(fwretract.retract_recover_feedrate_mm_s); - EEPROM_WRITE(fwretract.swap_retract_length); - EEPROM_WRITE(fwretract.swap_retract_recover_length); - EEPROM_WRITE(fwretract.swap_retract_recover_feedrate_mm_s); - #endif + EEPROM_WRITE(ui_preheat_hotend_temp); + EEPROM_WRITE(ui_preheat_bed_temp); + EEPROM_WRITE(ui_preheat_fan_speed); + } + + // + // PIDTEMP + // + { + _FIELD_TEST(hotendPID); + HOTEND_LOOP() { + PIDC_t pidc = { + PID_PARAM(Kp, e), PID_PARAM(Ki, e), PID_PARAM(Kd, e), PID_PARAM(Kc, e) + }; + EEPROM_WRITE(pidc); + } + + _FIELD_TEST(lpq_len); + #if ENABLED(PID_EXTRUSION_SCALING) + EEPROM_WRITE(thermalManager.lpq_len); + #else + const int16_t lpq_len = 20; + EEPROM_WRITE(lpq_len); + #endif + } + + // + // PIDTEMPBED + // + { + _FIELD_TEST(bedPID); + + #if DISABLED(PIDTEMPBED) + const PID_t bed_pid = { DUMMY_PID_VALUE, DUMMY_PID_VALUE, DUMMY_PID_VALUE }; + EEPROM_WRITE(bed_pid); + #else + EEPROM_WRITE(thermalManager.bed_pid); + #endif + } + + // + // LCD Contrast + // + { + _FIELD_TEST(lcd_contrast); + + const int16_t lcd_contrast = + #if HAS_LCD_CONTRAST + ui.contrast + #else + 32 + #endif + ; + EEPROM_WRITE(lcd_contrast); + } + + // + // Power-Loss Recovery + // + { + _FIELD_TEST(recovery_enabled); + + const bool recovery_enabled = + #if ENABLED(POWER_LOSS_RECOVERY) + recovery.enabled + #else + true + #endif + ; + EEPROM_WRITE(recovery_enabled); + } + + // + // Firmware Retraction + // + { + _FIELD_TEST(fwretract_settings); + + #if ENABLED(FWRETRACT) + EEPROM_WRITE(fwretract.settings); + #else + const fwretract_settings_t autoretract_defaults = { 3, 45, 0, 0, 0, 13, 0, 8 }; + EEPROM_WRITE(autoretract_defaults); + #endif + #if ENABLED(FWRETRACT) && ENABLED(FWRETRACT_AUTORETRACT) + EEPROM_WRITE(fwretract.autoretract_enabled); + #else + const bool autoretract_enabled = false; + EEPROM_WRITE(autoretract_enabled); + #endif + } // // Volumetric & Filament Size // + { + _FIELD_TEST(parser_volumetric_enabled); - _FIELD_TEST(parser_volumetric_enabled); + #if DISABLED(NO_VOLUMETRICS) - #if DISABLED(NO_VOLUMETRICS) + EEPROM_WRITE(parser.volumetric_enabled); + EEPROM_WRITE(planner.filament_size); - EEPROM_WRITE(parser.volumetric_enabled); + #else - // Save filament sizes - for (uint8_t q = 0; q < COUNT(planner.filament_size); q++) - EEPROM_WRITE(planner.filament_size[q]); + const bool volumetric_enabled = false; + dummy = DEFAULT_NOMINAL_FILAMENT_DIA; + EEPROM_WRITE(volumetric_enabled); + for (uint8_t q = EXTRUDERS; q--;) EEPROM_WRITE(dummy); - #else - - const bool volumetric_enabled = false; - dummy = DEFAULT_NOMINAL_FILAMENT_DIA; - EEPROM_WRITE(volumetric_enabled); - for (uint8_t q = EXTRUDERS; q--;) EEPROM_WRITE(dummy); - - #endif + #endif + } // - // Save TMC2130 or TMC2208 Configuration, and placeholder values + // TMC Configuration // + { + _FIELD_TEST(tmc_stepper_current); - _FIELD_TEST(tmc_stepper_current); + tmc_stepper_current_t tmc_stepper_current = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - uint16_t tmc_stepper_current[TMC_AXES] = { #if HAS_TRINAMIC #if AXIS_IS_TMC(X) - stepperX.getCurrent(), - #else - 0, + tmc_stepper_current.X = stepperX.getMilliamps(); #endif #if AXIS_IS_TMC(Y) - stepperY.getCurrent(), - #else - 0, + tmc_stepper_current.Y = stepperY.getMilliamps(); #endif #if AXIS_IS_TMC(Z) - stepperZ.getCurrent(), - #else - 0, + tmc_stepper_current.Z = stepperZ.getMilliamps(); #endif #if AXIS_IS_TMC(X2) - stepperX2.getCurrent(), - #else - 0, + tmc_stepper_current.X2 = stepperX2.getMilliamps(); #endif #if AXIS_IS_TMC(Y2) - stepperY2.getCurrent(), - #else - 0, + tmc_stepper_current.Y2 = stepperY2.getMilliamps(); #endif #if AXIS_IS_TMC(Z2) - stepperZ2.getCurrent(), - #else - 0, + tmc_stepper_current.Z2 = stepperZ2.getMilliamps(); #endif #if AXIS_IS_TMC(Z3) - stepperZ3.getCurrent(), - #else - 0, + tmc_stepper_current.Z3 = stepperZ3.getMilliamps(); #endif #if MAX_EXTRUDERS #if AXIS_IS_TMC(E0) - stepperE0.getCurrent(), - #else - 0, + tmc_stepper_current.E0 = stepperE0.getMilliamps(); #endif #if MAX_EXTRUDERS > 1 #if AXIS_IS_TMC(E1) - stepperE1.getCurrent(), - #else - 0, + tmc_stepper_current.E1 = stepperE1.getMilliamps(); #endif #if MAX_EXTRUDERS > 2 #if AXIS_IS_TMC(E2) - stepperE2.getCurrent(), - #else - 0, + tmc_stepper_current.E2 = stepperE2.getMilliamps(); #endif #if MAX_EXTRUDERS > 3 #if AXIS_IS_TMC(E3) - stepperE3.getCurrent(), - #else - 0, + tmc_stepper_current.E3 = stepperE3.getMilliamps(); #endif #if MAX_EXTRUDERS > 4 #if AXIS_IS_TMC(E4) - stepperE4.getCurrent() - #else - 0 + tmc_stepper_current.E4 = stepperE4.getMilliamps(); #endif #if MAX_EXTRUDERS > 5 #if AXIS_IS_TMC(E5) - stepperE5.getCurrent() - #else - 0 + tmc_stepper_current.E5 = stepperE5.getMilliamps(); #endif #endif // MAX_EXTRUDERS > 5 #endif // MAX_EXTRUDERS > 4 @@ -803,90 +876,62 @@ void MarlinSettings::postprocess() { #endif // MAX_EXTRUDERS > 2 #endif // MAX_EXTRUDERS > 1 #endif // MAX_EXTRUDERS - #else - 0 #endif - }; - EEPROM_WRITE(tmc_stepper_current); + EEPROM_WRITE(tmc_stepper_current); + } // - // Save TMC2130 or TMC2208 Hybrid Threshold, and placeholder values + // TMC Hybrid Threshold, and placeholder values // + { + _FIELD_TEST(tmc_hybrid_threshold); - _FIELD_TEST(tmc_hybrid_threshold); - - uint32_t tmc_hybrid_threshold[TMC_AXES] = { #if ENABLED(HYBRID_THRESHOLD) + tmc_hybrid_threshold_t tmc_hybrid_threshold = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; #if AXIS_HAS_STEALTHCHOP(X) - TMC_GET_PWMTHRS(X, X), - #else - X_HYBRID_THRESHOLD, + tmc_hybrid_threshold.X = TMC_GET_PWMTHRS(X, X); #endif #if AXIS_HAS_STEALTHCHOP(Y) - TMC_GET_PWMTHRS(Y, Y), - #else - Y_HYBRID_THRESHOLD, + tmc_hybrid_threshold.Y = TMC_GET_PWMTHRS(Y, Y); #endif #if AXIS_HAS_STEALTHCHOP(Z) - TMC_GET_PWMTHRS(Z, Z), - #else - Z_HYBRID_THRESHOLD, + tmc_hybrid_threshold.Z = TMC_GET_PWMTHRS(Z, Z); #endif #if AXIS_HAS_STEALTHCHOP(X2) - TMC_GET_PWMTHRS(X, X2), - #else - X2_HYBRID_THRESHOLD, + tmc_hybrid_threshold.X2 = TMC_GET_PWMTHRS(X, X2); #endif #if AXIS_HAS_STEALTHCHOP(Y2) - TMC_GET_PWMTHRS(Y, Y2), - #else - Y2_HYBRID_THRESHOLD, + tmc_hybrid_threshold.Y2 = TMC_GET_PWMTHRS(Y, Y2); #endif #if AXIS_HAS_STEALTHCHOP(Z2) - TMC_GET_PWMTHRS(Z, Z2), - #else - Z2_HYBRID_THRESHOLD, + tmc_hybrid_threshold.Z2 = TMC_GET_PWMTHRS(Z, Z2); #endif #if AXIS_HAS_STEALTHCHOP(Z3) - TMC_GET_PWMTHRS(Z, Z3), - #else - Z3_HYBRID_THRESHOLD, + tmc_hybrid_threshold.Z3 = TMC_GET_PWMTHRS(Z, Z3); #endif #if MAX_EXTRUDERS #if AXIS_HAS_STEALTHCHOP(E0) - TMC_GET_PWMTHRS(E, E0), - #else - E0_HYBRID_THRESHOLD, + tmc_hybrid_threshold.E0 = TMC_GET_PWMTHRS(E, E0); #endif #if MAX_EXTRUDERS > 1 #if AXIS_HAS_STEALTHCHOP(E1) - TMC_GET_PWMTHRS(E, E1), - #else - E1_HYBRID_THRESHOLD, + tmc_hybrid_threshold.E1 = TMC_GET_PWMTHRS(E, E1); #endif #if MAX_EXTRUDERS > 2 #if AXIS_HAS_STEALTHCHOP(E2) - TMC_GET_PWMTHRS(E, E2), - #else - E2_HYBRID_THRESHOLD, + tmc_hybrid_threshold.E2 = TMC_GET_PWMTHRS(E, E2); #endif #if MAX_EXTRUDERS > 3 #if AXIS_HAS_STEALTHCHOP(E3) - TMC_GET_PWMTHRS(E, E3), - #else - E3_HYBRID_THRESHOLD, + tmc_hybrid_threshold.E3 = TMC_GET_PWMTHRS(E, E3); #endif #if MAX_EXTRUDERS > 4 #if AXIS_HAS_STEALTHCHOP(E4) - TMC_GET_PWMTHRS(E, E4) - #else - E4_HYBRID_THRESHOLD + tmc_hybrid_threshold.E4 = TMC_GET_PWMTHRS(E, E4); #endif #if MAX_EXTRUDERS > 5 #if AXIS_HAS_STEALTHCHOP(E5) - TMC_GET_PWMTHRS(E, E5) - #else - E5_HYBRID_THRESHOLD + tmc_hybrid_threshold.E5 = TMC_GET_PWMTHRS(E, E5); #endif #endif // MAX_EXTRUDERS > 5 #endif // MAX_EXTRUDERS > 4 @@ -895,76 +940,62 @@ void MarlinSettings::postprocess() { #endif // MAX_EXTRUDERS > 1 #endif // MAX_EXTRUDERS #else - 100, 100, 3, // X, Y, Z - 100, 100, 3, 3 // X2, Y2, Z2, Z3 - #if MAX_EXTRUDERS - , 30 // E0 - #if MAX_EXTRUDERS > 1 - , 30 // E1 - #if MAX_EXTRUDERS > 2 - , 30 // E2 - #if MAX_EXTRUDERS > 3 - , 30 // E3 - #if MAX_EXTRUDERS > 4 - , 30 // E4 - #if MAX_EXTRUDERS > 5 - , 30 // E5 - #endif - #endif - #endif - #endif - #endif - #endif + const tmc_hybrid_threshold_t tmc_hybrid_threshold = { + .X = 100, .Y = 100, .Z = 3, + .X2 = 100, .Y2 = 100, .Z2 = 3, .Z3 = 3, + .E0 = 30, .E1 = 30, .E2 = 30, + .E3 = 30, .E4 = 30, .E5 = 30 + }; #endif - }; - EEPROM_WRITE(tmc_hybrid_threshold); + EEPROM_WRITE(tmc_hybrid_threshold); + } // - // TMC2130 Sensorless homing threshold + // TMC StallGuard threshold // - int16_t tmc_sgt[XYZ] = { - #if ENABLED(SENSORLESS_HOMING) + { + tmc_sgt_t tmc_sgt = { 0, 0, 0 }; + #if USE_SENSORLESS #if X_SENSORLESS - stepperX.sgt(), - #else - 0, + tmc_sgt.X = stepperX.sgt(); #endif #if Y_SENSORLESS - stepperY.sgt(), - #else - 0, + tmc_sgt.Y = stepperY.sgt(); #endif #if Z_SENSORLESS - stepperZ.sgt() - #else - 0 + tmc_sgt.Z = stepperZ.sgt(); #endif - #else - 0 #endif - }; - EEPROM_WRITE(tmc_sgt); + EEPROM_WRITE(tmc_sgt); + } // // Linear Advance // - _FIELD_TEST(planner_extruder_advance_K); + { + _FIELD_TEST(planner_extruder_advance_K); - #if ENABLED(LIN_ADVANCE) - LOOP_L_N(i, EXTRUDERS) EEPROM_WRITE(planner.extruder_advance_K[i]); - #else - dummy = 0; - LOOP_L_N(i, EXTRUDERS) EEPROM_WRITE(dummy); - #endif + #if ENABLED(LIN_ADVANCE) + EEPROM_WRITE(planner.extruder_advance_K); + #else + dummy = 0; + for (uint8_t q = EXTRUDERS; q--;) EEPROM_WRITE(dummy); + #endif + } - _FIELD_TEST(motor_current_setting); + // + // Motor Current PWM + // + { + _FIELD_TEST(motor_current_setting); - #if HAS_MOTOR_CURRENT_PWM - for (uint8_t q = XYZ; q--;) EEPROM_WRITE(stepper.motor_current_setting[q]); - #else - const uint32_t dummyui32[XYZ] = { 0 }; - EEPROM_WRITE(dummyui32); - #endif + #if HAS_MOTOR_CURRENT_PWM + EEPROM_WRITE(stepper.motor_current_setting); + #else + const uint32_t dummyui32[XYZ] = { 0 }; + EEPROM_WRITE(dummyui32); + #endif + } // // CNC Coordinate Systems @@ -973,41 +1004,36 @@ void MarlinSettings::postprocess() { _FIELD_TEST(coordinate_system); #if ENABLED(CNC_COORDINATE_SYSTEMS) - EEPROM_WRITE(gcode.coordinate_system); // 27 floats + EEPROM_WRITE(gcode.coordinate_system); #else - dummy = 0; - for (uint8_t q = MAX_COORDINATE_SYSTEMS * XYZ; q--;) EEPROM_WRITE(dummy); + const float coordinate_system[MAX_COORDINATE_SYSTEMS][XYZ] = { { 0 } }; + EEPROM_WRITE(coordinate_system); #endif // // Skew correction factors // - - _FIELD_TEST(planner_xy_skew_factor); - - #if ENABLED(SKEW_CORRECTION) - EEPROM_WRITE(planner.xy_skew_factor); - EEPROM_WRITE(planner.xz_skew_factor); - EEPROM_WRITE(planner.yz_skew_factor); - #else - dummy = 0; - for (uint8_t q = 3; q--;) EEPROM_WRITE(dummy); - #endif + _FIELD_TEST(planner_skew_factor); + EEPROM_WRITE(planner.skew_factor); // // Advanced Pause filament load & unload lengths // + { + #if DISABLED(ADVANCED_PAUSE_FEATURE) + const fil_change_settings_t fc_settings[EXTRUDERS] = { 0, 0 }; + #endif + _FIELD_TEST(fc_settings); + EEPROM_WRITE(fc_settings); + } - _FIELD_TEST(filament_change_unload_length); + // + // Multiple Extruders + // - #if ENABLED(ADVANCED_PAUSE_FEATURE) - for (uint8_t q = 0; q < COUNT(filament_change_unload_length); q++) { - EEPROM_WRITE(filament_change_unload_length[q]); - EEPROM_WRITE(filament_change_load_length[q]); - } - #else - dummy = 0; - for (uint8_t q = EXTRUDERS * 2; q--;) EEPROM_WRITE(dummy); + #if EXTRUDERS > 1 + _FIELD_TEST(toolchange_settings); + EEPROM_WRITE(toolchange_settings); #endif // @@ -1076,10 +1102,6 @@ void MarlinSettings::postprocess() { } else { float dummy = 0; - #if DISABLED(AUTO_BED_LEVELING_UBL) || DISABLED(FWRETRACT) || DISABLED(FWRETRACT_AUTORETRACT) || ENABLED(NO_VOLUMETRICS) - bool dummyb; - #endif - working_crc = 0; // Init to 0. Accumulated by EEPROM_READ _FIELD_TEST(esteppers); @@ -1091,557 +1113,593 @@ void MarlinSettings::postprocess() { // // Planner Motion // + { + // Get only the number of E stepper parameters previously stored + // Any steppers added later are set to their defaults + const uint32_t def1[] = DEFAULT_MAX_ACCELERATION; + const float def2[] = DEFAULT_AXIS_STEPS_PER_UNIT, def3[] = DEFAULT_MAX_FEEDRATE; - // Get only the number of E stepper parameters previously stored - // Any steppers added later are set to their defaults - const uint32_t def1[] = DEFAULT_MAX_ACCELERATION; - const float def2[] = DEFAULT_AXIS_STEPS_PER_UNIT, def3[] = DEFAULT_MAX_FEEDRATE; + uint32_t tmp1[XYZ + esteppers]; + EEPROM_READ(tmp1); // max_acceleration_mm_per_s2 + EEPROM_READ(planner.settings.min_segment_time_us); - uint32_t tmp1[XYZ + esteppers]; - EEPROM_READ(tmp1); // max_acceleration_mm_per_s2 - EEPROM_READ(planner.min_segment_time_us); + float tmp2[XYZ + esteppers], tmp3[XYZ + esteppers]; + EEPROM_READ(tmp2); // axis_steps_per_mm + EEPROM_READ(tmp3); // max_feedrate_mm_s + if (!validating) LOOP_XYZE_N(i) { + const bool in = (i < esteppers + XYZ); + planner.settings.max_acceleration_mm_per_s2[i] = in ? tmp1[i] : def1[ALIM(i, def1)]; + planner.settings.axis_steps_per_mm[i] = in ? tmp2[i] : def2[ALIM(i, def2)]; + planner.settings.max_feedrate_mm_s[i] = in ? tmp3[i] : def3[ALIM(i, def3)]; + } - float tmp2[XYZ + esteppers], tmp3[XYZ + esteppers]; - EEPROM_READ(tmp2); // axis_steps_per_mm - EEPROM_READ(tmp3); // max_feedrate_mm_s - if (!validating) LOOP_XYZE_N(i) { - planner.max_acceleration_mm_per_s2[i] = i < XYZ + esteppers ? tmp1[i] : def1[i < COUNT(def1) ? i : COUNT(def1) - 1]; - planner.axis_steps_per_mm[i] = i < XYZ + esteppers ? tmp2[i] : def2[i < COUNT(def2) ? i : COUNT(def2) - 1]; - planner.max_feedrate_mm_s[i] = i < XYZ + esteppers ? tmp3[i] : def3[i < COUNT(def3) ? i : COUNT(def3) - 1]; - } + EEPROM_READ(planner.settings.acceleration); + EEPROM_READ(planner.settings.retract_acceleration); + EEPROM_READ(planner.settings.travel_acceleration); + EEPROM_READ(planner.settings.min_feedrate_mm_s); + EEPROM_READ(planner.settings.min_travel_feedrate_mm_s); - EEPROM_READ(planner.acceleration); - EEPROM_READ(planner.retract_acceleration); - EEPROM_READ(planner.travel_acceleration); - EEPROM_READ(planner.min_feedrate_mm_s); - EEPROM_READ(planner.min_travel_feedrate_mm_s); + #if HAS_CLASSIC_JERK + EEPROM_READ(planner.max_jerk); + #if ENABLED(JUNCTION_DEVIATION) && ENABLED(LIN_ADVANCE) + EEPROM_READ(dummy); + #endif + #else + for (uint8_t q = 4; q--;) EEPROM_READ(dummy); + #endif - #if HAS_CLASSIC_JERK - EEPROM_READ(planner.max_jerk); - #if ENABLED(JUNCTION_DEVIATION) && ENABLED(LIN_ADVANCE) + #if ENABLED(JUNCTION_DEVIATION) + EEPROM_READ(planner.junction_deviation_mm); + #else EEPROM_READ(dummy); #endif - #else - for (uint8_t q = 4; q--;) EEPROM_READ(dummy); - #endif - - #if ENABLED(JUNCTION_DEVIATION) - EEPROM_READ(planner.junction_deviation_mm); - #else - EEPROM_READ(dummy); - #endif + } // - // Home Offset (M206) + // Home Offset (M206 / M665) // + { + _FIELD_TEST(home_offset); - _FIELD_TEST(home_offset); - - #if !HAS_HOME_OFFSET - float home_offset[XYZ]; - #endif - EEPROM_READ(home_offset); + #if HAS_SCARA_OFFSET + EEPROM_READ(scara_home_offset); + #else + #if !HAS_HOME_OFFSET + float home_offset[XYZ]; + #endif + EEPROM_READ(home_offset); + #endif + } // // Hotend Offsets, if any // - - #if HAS_HOTEND_OFFSET - // Skip hotend 0 which must be 0 - for (uint8_t e = 1; e < HOTENDS; e++) - LOOP_XYZ(i) EEPROM_READ(hotend_offset[i][e]); - #endif + { + #if HAS_HOTEND_OFFSET + // Skip hotend 0 which must be 0 + for (uint8_t e = 1; e < HOTENDS; e++) + LOOP_XYZ(i) EEPROM_READ(hotend_offset[i][e]); + #endif + } // // Global Leveling // - - #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) - EEPROM_READ(new_z_fade_height); - #else - EEPROM_READ(dummy); - #endif + { + #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) + EEPROM_READ(new_z_fade_height); + #else + EEPROM_READ(dummy); + #endif + } // // Mesh (Manual) Bed Leveling // + { + uint8_t mesh_num_x, mesh_num_y; + EEPROM_READ(dummy); + EEPROM_READ_ALWAYS(mesh_num_x); + EEPROM_READ_ALWAYS(mesh_num_y); - uint8_t mesh_num_x, mesh_num_y; - EEPROM_READ(dummy); - EEPROM_READ_ALWAYS(mesh_num_x); - EEPROM_READ_ALWAYS(mesh_num_y); - - #if ENABLED(MESH_BED_LEVELING) - if (!validating) mbl.z_offset = dummy; - if (mesh_num_x == GRID_MAX_POINTS_X && mesh_num_y == GRID_MAX_POINTS_Y) { - // EEPROM data fits the current mesh - EEPROM_READ(mbl.z_values); - } - else { - // EEPROM data is stale - if (!validating) mbl.reset(); + #if ENABLED(MESH_BED_LEVELING) + if (!validating) mbl.z_offset = dummy; + if (mesh_num_x == GRID_MAX_POINTS_X && mesh_num_y == GRID_MAX_POINTS_Y) { + // EEPROM data fits the current mesh + EEPROM_READ(mbl.z_values); + } + else { + // EEPROM data is stale + if (!validating) mbl.reset(); + for (uint16_t q = mesh_num_x * mesh_num_y; q--;) EEPROM_READ(dummy); + } + #else + // MBL is disabled - skip the stored data for (uint16_t q = mesh_num_x * mesh_num_y; q--;) EEPROM_READ(dummy); - } - #else - // MBL is disabled - skip the stored data - for (uint16_t q = mesh_num_x * mesh_num_y; q--;) EEPROM_READ(dummy); - #endif // MESH_BED_LEVELING + #endif // MESH_BED_LEVELING + } - _FIELD_TEST(zprobe_zoffset); + // + // Probe Z Offset + // + { + _FIELD_TEST(zprobe_zoffset); - #if !HAS_BED_PROBE - float zprobe_zoffset; - #endif - EEPROM_READ(zprobe_zoffset); + #if !HAS_BED_PROBE + float zprobe_zoffset; + #endif + EEPROM_READ(zprobe_zoffset); + } // // Planar Bed Leveling matrix // - - #if ABL_PLANAR - EEPROM_READ(planner.bed_level_matrix); - #else - for (uint8_t q = 9; q--;) EEPROM_READ(dummy); - #endif + { + #if ABL_PLANAR + EEPROM_READ(planner.bed_level_matrix); + #else + for (uint8_t q = 9; q--;) EEPROM_READ(dummy); + #endif + } // // Bilinear Auto Bed Leveling // - - uint8_t grid_max_x, grid_max_y; - EEPROM_READ_ALWAYS(grid_max_x); // 1 byte - EEPROM_READ_ALWAYS(grid_max_y); // 1 byte - #if ENABLED(AUTO_BED_LEVELING_BILINEAR) - if (grid_max_x == GRID_MAX_POINTS_X && grid_max_y == GRID_MAX_POINTS_Y) { - if (!validating) set_bed_leveling_enabled(false); - EEPROM_READ(bilinear_grid_spacing); // 2 ints - EEPROM_READ(bilinear_start); // 2 ints - EEPROM_READ(z_values); // 9 to 256 floats - } - else // EEPROM data is stale - #endif // AUTO_BED_LEVELING_BILINEAR - { - // Skip past disabled (or stale) Bilinear Grid data - int bgs[2], bs[2]; - EEPROM_READ(bgs); - EEPROM_READ(bs); - for (uint16_t q = grid_max_x * grid_max_y; q--;) EEPROM_READ(dummy); - } + { + uint8_t grid_max_x, grid_max_y; + EEPROM_READ_ALWAYS(grid_max_x); // 1 byte + EEPROM_READ_ALWAYS(grid_max_y); // 1 byte + #if ENABLED(AUTO_BED_LEVELING_BILINEAR) + if (grid_max_x == GRID_MAX_POINTS_X && grid_max_y == GRID_MAX_POINTS_Y) { + if (!validating) set_bed_leveling_enabled(false); + EEPROM_READ(bilinear_grid_spacing); // 2 ints + EEPROM_READ(bilinear_start); // 2 ints + EEPROM_READ(z_values); // 9 to 256 floats + } + else // EEPROM data is stale + #endif // AUTO_BED_LEVELING_BILINEAR + { + // Skip past disabled (or stale) Bilinear Grid data + int bgs[2], bs[2]; + EEPROM_READ(bgs); + EEPROM_READ(bs); + for (uint16_t q = grid_max_x * grid_max_y; q--;) EEPROM_READ(dummy); + } + } // // Unified Bed Leveling active state // + { + _FIELD_TEST(planner_leveling_active); - _FIELD_TEST(planner_leveling_active); - - #if ENABLED(AUTO_BED_LEVELING_UBL) - EEPROM_READ(planner.leveling_active); - EEPROM_READ(ubl.storage_slot); - #else - uint8_t dummyui8; - EEPROM_READ(dummyb); - EEPROM_READ(dummyui8); - #endif // AUTO_BED_LEVELING_UBL + #if ENABLED(AUTO_BED_LEVELING_UBL) + EEPROM_READ(planner.leveling_active); + EEPROM_READ(ubl.storage_slot); + #else + bool planner_leveling_active; + uint8_t ubl_storage_slot; + EEPROM_READ(planner_leveling_active); + EEPROM_READ(ubl_storage_slot); + #endif + } // // SERVO_ANGLES // - #if !HAS_SERVOS || DISABLED(EDITABLE_SERVO_ANGLES) - uint16_t servo_angles[NUM_SERVO_PLUGS][2]; - #endif - EEPROM_READ(servo_angles); + { + #if !(HAS_SERVOS && ENABLED(EDITABLE_SERVO_ANGLES)) + uint16_t servo_angles[NUM_SERVOS][2]; + #endif + EEPROM_READ(servo_angles); + } // // DELTA Geometry or Dual Endstops offsets // + { + #if ENABLED(DELTA) - #if ENABLED(DELTA) + _FIELD_TEST(delta_height); - _FIELD_TEST(delta_height); + EEPROM_READ(delta_height); // 1 float + EEPROM_READ(delta_endstop_adj); // 3 floats + EEPROM_READ(delta_radius); // 1 float + EEPROM_READ(delta_diagonal_rod); // 1 float + EEPROM_READ(delta_segments_per_second); // 1 float + EEPROM_READ(delta_calibration_radius); // 1 float + EEPROM_READ(delta_tower_angle_trim); // 3 floats - EEPROM_READ(delta_height); // 1 float - EEPROM_READ(delta_endstop_adj); // 3 floats - EEPROM_READ(delta_radius); // 1 float - EEPROM_READ(delta_diagonal_rod); // 1 float - EEPROM_READ(delta_segments_per_second); // 1 float - EEPROM_READ(delta_calibration_radius); // 1 float - EEPROM_READ(delta_tower_angle_trim); // 3 floats + #elif ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS - #elif ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS + _FIELD_TEST(x2_endstop_adj); - _FIELD_TEST(x2_endstop_adj); + #if ENABLED(X_DUAL_ENDSTOPS) + EEPROM_READ(endstops.x2_endstop_adj); // 1 float + #else + EEPROM_READ(dummy); + #endif + #if ENABLED(Y_DUAL_ENDSTOPS) + EEPROM_READ(endstops.y2_endstop_adj); // 1 float + #else + EEPROM_READ(dummy); + #endif + #if Z_MULTI_ENDSTOPS + EEPROM_READ(endstops.z2_endstop_adj); // 1 float + #else + EEPROM_READ(dummy); + #endif + #if ENABLED(Z_TRIPLE_ENDSTOPS) + EEPROM_READ(endstops.z3_endstop_adj); // 1 float + #else + EEPROM_READ(dummy); + #endif - #if ENABLED(X_DUAL_ENDSTOPS) - EEPROM_READ(endstops.x2_endstop_adj); // 1 float - #else - EEPROM_READ(dummy); #endif - #if ENABLED(Y_DUAL_ENDSTOPS) - EEPROM_READ(endstops.y2_endstop_adj); // 1 float - #else - EEPROM_READ(dummy); - #endif - #if Z_MULTI_ENDSTOPS - EEPROM_READ(endstops.z2_endstop_adj); // 1 float - #else - EEPROM_READ(dummy); - #endif - #if ENABLED(Z_TRIPLE_ENDSTOPS) - EEPROM_READ(endstops.z3_endstop_adj); // 1 float - #else - EEPROM_READ(dummy); - #endif - - #endif + } // // LCD Preheat settings // + { + _FIELD_TEST(ui_preheat_hotend_temp); - _FIELD_TEST(lcd_preheat_hotend_temp); - - #if DISABLED(ULTIPANEL) - int16_t lcd_preheat_hotend_temp[2], lcd_preheat_bed_temp[2], lcd_preheat_fan_speed[2]; - #endif - EEPROM_READ(lcd_preheat_hotend_temp); // 2 floats - EEPROM_READ(lcd_preheat_bed_temp); // 2 floats - EEPROM_READ(lcd_preheat_fan_speed); // 2 floats - - //EEPROM_ASSERT( - // WITHIN(lcd_preheat_fan_speed, 0, 255), - // "lcd_preheat_fan_speed out of range" - //); + #if HAS_LCD_MENU + int16_t (&ui_preheat_hotend_temp)[2] = ui.preheat_hotend_temp, + (&ui_preheat_bed_temp)[2] = ui.preheat_bed_temp; + uint8_t (&ui_preheat_fan_speed)[2] = ui.preheat_fan_speed; + #else + int16_t ui_preheat_hotend_temp[2], ui_preheat_bed_temp[2]; + uint8_t ui_preheat_fan_speed[2]; + #endif + EEPROM_READ(ui_preheat_hotend_temp); // 2 floats + EEPROM_READ(ui_preheat_bed_temp); // 2 floats + EEPROM_READ(ui_preheat_fan_speed); // 2 floats + } // // Hotend PID // - - #if ENABLED(PIDTEMP) - for (uint8_t e = 0; e < HOTENDS; e++) { - EEPROM_READ(dummy); // Kp - if (dummy != DUMMY_PID_VALUE) { - // do not need to scale PID values as the values in EEPROM are already scaled - if (!validating) PID_PARAM(Kp, e) = dummy; - EEPROM_READ(PID_PARAM(Ki, e)); - EEPROM_READ(PID_PARAM(Kd, e)); - #if ENABLED(PID_EXTRUSION_SCALING) - EEPROM_READ(PID_PARAM(Kc, e)); - #else - EEPROM_READ(dummy); - #endif - } - else - for (uint8_t q=3; q--;) EEPROM_READ(dummy); // Ki, Kd, Kc + { + HOTEND_LOOP() { + PIDC_t pidc; + EEPROM_READ(pidc); + #if ENABLED(PIDTEMP) + if (!validating && pidc.Kp != DUMMY_PID_VALUE) { + // No need to scale PID values since EEPROM values are scaled + PID_PARAM(Kp, e) = pidc.Kp; + PID_PARAM(Ki, e) = pidc.Ki; + PID_PARAM(Kd, e) = pidc.Kd; + #if ENABLED(PID_EXTRUSION_SCALING) + PID_PARAM(Kc, e) = pidc.Kc; + #endif + } + #endif } - #else // !PIDTEMP - // 4 x 4 = 16 slots for PID parameters - for (uint8_t q = HOTENDS * 4; q--;) EEPROM_READ(dummy); // Kp, Ki, Kd, Kc - #endif // !PIDTEMP + } // // PID Extrusion Scaling // - - _FIELD_TEST(lpq_len); - - #if DISABLED(PID_EXTRUSION_SCALING) - int16_t LPQ_LEN; - #endif - EEPROM_READ(LPQ_LEN); + { + _FIELD_TEST(lpq_len); + #if ENABLED(PID_EXTRUSION_SCALING) + EEPROM_READ(thermalManager.lpq_len); + #else + int16_t lpq_len; + EEPROM_READ(lpq_len); + #endif + } // // Heated Bed PID // - - #if ENABLED(PIDTEMPBED) - EEPROM_READ(dummy); // bedKp - if (dummy != DUMMY_PID_VALUE) { - if (!validating) thermalManager.bedKp = dummy; - EEPROM_READ(thermalManager.bedKi); - EEPROM_READ(thermalManager.bedKd); - } - #else - for (uint8_t q=3; q--;) EEPROM_READ(dummy); // bedKp, bedKi, bedKd - #endif + { + PID_t pid; + EEPROM_READ(pid); + #if ENABLED(PIDTEMPBED) + if (!validating && pid.Kp != DUMMY_PID_VALUE) + memcpy(&thermalManager.bed_pid, &pid, sizeof(pid)); + #endif + } // // LCD Contrast // + { + _FIELD_TEST(lcd_contrast); - _FIELD_TEST(lcd_contrast); - - #if !HAS_LCD_CONTRAST int16_t lcd_contrast; - #endif - EEPROM_READ(lcd_contrast); + EEPROM_READ(lcd_contrast); + #if HAS_LCD_CONTRAST + ui.set_contrast(lcd_contrast); + #endif + } + + // + // Power-Loss Recovery + // + { + _FIELD_TEST(recovery_enabled); + + #if ENABLED(POWER_LOSS_RECOVERY) + EEPROM_READ(recovery.enabled); + #else + bool recovery_enabled; + EEPROM_READ(recovery_enabled); + #endif + } // // Firmware Retraction // + { + _FIELD_TEST(fwretract_settings); - #if ENABLED(FWRETRACT) - #if DISABLED(FWRETRACT_AUTORETRACT) - EEPROM_READ(dummyb); + #if ENABLED(FWRETRACT) + EEPROM_READ(fwretract.settings); #else - EEPROM_READ(fwretract.autoretract_enabled); + fwretract_settings_t fwretract_settings; + EEPROM_READ(fwretract_settings); #endif - EEPROM_READ(fwretract.retract_length); - EEPROM_READ(fwretract.retract_feedrate_mm_s); - EEPROM_READ(fwretract.retract_zlift); - EEPROM_READ(fwretract.retract_recover_length); - EEPROM_READ(fwretract.retract_recover_feedrate_mm_s); - EEPROM_READ(fwretract.swap_retract_length); - EEPROM_READ(fwretract.swap_retract_recover_length); - EEPROM_READ(fwretract.swap_retract_recover_feedrate_mm_s); - #else - EEPROM_READ(dummyb); - for (uint8_t q=8; q--;) EEPROM_READ(dummy); - #endif + #if ENABLED(FWRETRACT) && ENABLED(FWRETRACT_AUTORETRACT) + EEPROM_READ(fwretract.autoretract_enabled); + #else + bool autoretract_enabled; + EEPROM_READ(autoretract_enabled); + #endif + } // // Volumetric & Filament Size // + { + struct { + bool volumetric_enabled; + float filament_size[EXTRUDERS]; + } storage; - _FIELD_TEST(parser_volumetric_enabled); + _FIELD_TEST(parser_volumetric_enabled); + EEPROM_READ(storage); - #if DISABLED(NO_VOLUMETRICS) + #if DISABLED(NO_VOLUMETRICS) + if (!validating) { + parser.volumetric_enabled = storage.volumetric_enabled; + COPY(planner.filament_size, storage.filament_size); + } + #endif + } - EEPROM_READ(parser.volumetric_enabled); - - for (uint8_t q = 0; q < COUNT(planner.filament_size); q++) { - EEPROM_READ(dummy); - if (!validating) planner.filament_size[q] = dummy; - } - - #else - - EEPROM_READ(dummyb); - for (uint8_t q=EXTRUDERS; q--;) EEPROM_READ(dummy); - - #endif + // + // TMC Stepper Settings + // if (!validating) reset_stepper_drivers(); - // - // TMC2130 Stepper Settings - // + // TMC Stepper Current + { + _FIELD_TEST(tmc_stepper_current); - _FIELD_TEST(tmc_stepper_current); - - #if HAS_TRINAMIC - - #define SET_CURR(Q) stepper##Q.setCurrent(currents[TMC_##Q] ? currents[TMC_##Q] : Q##_CURRENT, R_SENSE, HOLD_MULTIPLIER) - uint16_t currents[TMC_AXES]; + tmc_stepper_current_t currents; EEPROM_READ(currents); - if (!validating) { - #if AXIS_IS_TMC(X) - SET_CURR(X); - #endif - #if AXIS_IS_TMC(Y) - SET_CURR(Y); - #endif - #if AXIS_IS_TMC(Z) - SET_CURR(Z); - #endif - #if AXIS_IS_TMC(X2) - SET_CURR(X2); - #endif - #if AXIS_IS_TMC(Y2) - SET_CURR(Y2); - #endif - #if AXIS_IS_TMC(Z2) - SET_CURR(Z2); - #endif - #if AXIS_IS_TMC(Z3) - SET_CURR(Z3); - #endif - #if AXIS_IS_TMC(E0) - SET_CURR(E0); - #endif - #if AXIS_IS_TMC(E1) - SET_CURR(E1); - #endif - #if AXIS_IS_TMC(E2) - SET_CURR(E2); - #endif - #if AXIS_IS_TMC(E3) - SET_CURR(E3); - #endif - #if AXIS_IS_TMC(E4) - SET_CURR(E4); - #endif - #if AXIS_IS_TMC(E5) - SET_CURR(E5); - #endif - } - #else - uint16_t val; - for (uint8_t q=TMC_AXES; q--;) EEPROM_READ(val); - #endif - #if ENABLED(HYBRID_THRESHOLD) - #define TMC_SET_PWMTHRS(A,Q) tmc_set_pwmthrs(stepper##Q, tmc_hybrid_threshold[TMC_##Q], planner.axis_steps_per_mm[_AXIS(A)]) - uint32_t tmc_hybrid_threshold[TMC_AXES]; + #if HAS_TRINAMIC + + #define SET_CURR(Q) stepper##Q.rms_current(currents.Q ? currents.Q : Q##_CURRENT) + if (!validating) { + #if AXIS_IS_TMC(X) + SET_CURR(X); + #endif + #if AXIS_IS_TMC(Y) + SET_CURR(Y); + #endif + #if AXIS_IS_TMC(Z) + SET_CURR(Z); + #endif + #if AXIS_IS_TMC(X2) + SET_CURR(X2); + #endif + #if AXIS_IS_TMC(Y2) + SET_CURR(Y2); + #endif + #if AXIS_IS_TMC(Z2) + SET_CURR(Z2); + #endif + #if AXIS_IS_TMC(Z3) + SET_CURR(Z3); + #endif + #if AXIS_IS_TMC(E0) + SET_CURR(E0); + #endif + #if AXIS_IS_TMC(E1) + SET_CURR(E1); + #endif + #if AXIS_IS_TMC(E2) + SET_CURR(E2); + #endif + #if AXIS_IS_TMC(E3) + SET_CURR(E3); + #endif + #if AXIS_IS_TMC(E4) + SET_CURR(E4); + #endif + #if AXIS_IS_TMC(E5) + SET_CURR(E5); + #endif + } + #endif + } + + // TMC Hybrid Threshold + { + tmc_hybrid_threshold_t tmc_hybrid_threshold; + _FIELD_TEST(tmc_hybrid_threshold); EEPROM_READ(tmc_hybrid_threshold); - if (!validating) { - #if AXIS_HAS_STEALTHCHOP(X) - TMC_SET_PWMTHRS(X, X); - #endif - #if AXIS_HAS_STEALTHCHOP(Y) - TMC_SET_PWMTHRS(Y, Y); - #endif - #if AXIS_HAS_STEALTHCHOP(Z) - TMC_SET_PWMTHRS(Z, Z); - #endif - #if AXIS_HAS_STEALTHCHOP(X2) - TMC_SET_PWMTHRS(X, X2); - #endif - #if AXIS_HAS_STEALTHCHOP(Y2) - TMC_SET_PWMTHRS(Y, Y2); - #endif - #if AXIS_HAS_STEALTHCHOP(Z2) - TMC_SET_PWMTHRS(Z, Z2); - #endif - #if AXIS_HAS_STEALTHCHOP(Z3) - TMC_SET_PWMTHRS(Z, Z3); - #endif - #if AXIS_HAS_STEALTHCHOP(E0) - TMC_SET_PWMTHRS(E, E0); - #endif - #if AXIS_HAS_STEALTHCHOP(E1) - TMC_SET_PWMTHRS(E, E1); - #endif - #if AXIS_HAS_STEALTHCHOP(E2) - TMC_SET_PWMTHRS(E, E2); - #endif - #if AXIS_HAS_STEALTHCHOP(E3) - TMC_SET_PWMTHRS(E, E3); - #endif - #if AXIS_HAS_STEALTHCHOP(E4) - TMC_SET_PWMTHRS(E, E4); - #endif - #if AXIS_HAS_STEALTHCHOP(E5) - TMC_SET_PWMTHRS(E, E5); - #endif - } - #else - uint32_t thrs_val; - for (uint8_t q=TMC_AXES; q--;) EEPROM_READ(thrs_val); - #endif - /* - * TMC2130 Sensorless homing threshold. - * X and X2 use the same value - * Y and Y2 use the same value - * Z, Z2 and Z3 use the same value - */ - int16_t tmc_sgt[XYZ]; - EEPROM_READ(tmc_sgt); - #if ENABLED(SENSORLESS_HOMING) - if (!validating) { - #ifdef X_HOMING_SENSITIVITY - #if AXIS_HAS_STALLGUARD(X) - stepperX.sgt(tmc_sgt[0]); + #if ENABLED(HYBRID_THRESHOLD) + #define TMC_SET_PWMTHRS(A,Q) tmc_set_pwmthrs(stepper##Q, tmc_hybrid_threshold.Q, planner.settings.axis_steps_per_mm[_AXIS(A)]) + if (!validating) { + #if AXIS_HAS_STEALTHCHOP(X) + TMC_SET_PWMTHRS(X, X); #endif - #if AXIS_HAS_STALLGUARD(X2) - stepperX2.sgt(tmc_sgt[0]); + #if AXIS_HAS_STEALTHCHOP(Y) + TMC_SET_PWMTHRS(Y, Y); #endif - #endif - #ifdef Y_HOMING_SENSITIVITY - #if AXIS_HAS_STALLGUARD(Y) - stepperY.sgt(tmc_sgt[1]); + #if AXIS_HAS_STEALTHCHOP(Z) + TMC_SET_PWMTHRS(Z, Z); #endif - #if AXIS_HAS_STALLGUARD(Y2) - stepperY2.sgt(tmc_sgt[1]); + #if AXIS_HAS_STEALTHCHOP(X2) + TMC_SET_PWMTHRS(X, X2); #endif - #endif - #ifdef Z_HOMING_SENSITIVITY - #if AXIS_HAS_STALLGUARD(Z) - stepperZ.sgt(tmc_sgt[2]); + #if AXIS_HAS_STEALTHCHOP(Y2) + TMC_SET_PWMTHRS(Y, Y2); #endif - #if AXIS_HAS_STALLGUARD(Z2) - stepperZ2.sgt(tmc_sgt[2]); + #if AXIS_HAS_STEALTHCHOP(Z2) + TMC_SET_PWMTHRS(Z, Z2); #endif - #if AXIS_HAS_STALLGUARD(Z3) - stepperZ3.sgt(tmc_sgt[2]); + #if AXIS_HAS_STEALTHCHOP(Z3) + TMC_SET_PWMTHRS(Z, Z3); #endif - #endif - } - #endif + #if AXIS_HAS_STEALTHCHOP(E0) + TMC_SET_PWMTHRS(E, E0); + #endif + #if AXIS_HAS_STEALTHCHOP(E1) + TMC_SET_PWMTHRS(E, E1); + #endif + #if AXIS_HAS_STEALTHCHOP(E2) + TMC_SET_PWMTHRS(E, E2); + #endif + #if AXIS_HAS_STEALTHCHOP(E3) + TMC_SET_PWMTHRS(E, E3); + #endif + #if AXIS_HAS_STEALTHCHOP(E4) + TMC_SET_PWMTHRS(E, E4); + #endif + #if AXIS_HAS_STEALTHCHOP(E5) + TMC_SET_PWMTHRS(E, E5); + #endif + } + #endif + } + + // + // TMC StallGuard threshold. + // X and X2 use the same value + // Y and Y2 use the same value + // Z, Z2 and Z3 use the same value + // + { + tmc_sgt_t tmc_sgt; + _FIELD_TEST(tmc_sgt); + EEPROM_READ(tmc_sgt); + #if USE_SENSORLESS + if (!validating) { + #ifdef X_STALL_SENSITIVITY + #if AXIS_HAS_STALLGUARD(X) + stepperX.sgt(tmc_sgt.X); + #endif + #if AXIS_HAS_STALLGUARD(X2) + stepperX2.sgt(tmc_sgt.X); + #endif + #endif + #ifdef Y_STALL_SENSITIVITY + #if AXIS_HAS_STALLGUARD(Y) + stepperY.sgt(tmc_sgt.Y); + #endif + #if AXIS_HAS_STALLGUARD(Y2) + stepperY2.sgt(tmc_sgt.Y); + #endif + #endif + #ifdef Z_STALL_SENSITIVITY + #if AXIS_HAS_STALLGUARD(Z) + stepperZ.sgt(tmc_sgt.Z); + #endif + #if AXIS_HAS_STALLGUARD(Z2) + stepperZ2.sgt(tmc_sgt.Z); + #endif + #if AXIS_HAS_STALLGUARD(Z3) + stepperZ3.sgt(tmc_sgt.Z); + #endif + #endif + } + #endif + } // // Linear Advance // - _FIELD_TEST(planner_extruder_advance_K); - - LOOP_L_N(i, EXTRUDERS) { + { + float extruder_advance_K[EXTRUDERS]; + _FIELD_TEST(planner_extruder_advance_K); + EEPROM_READ(extruder_advance_K); #if ENABLED(LIN_ADVANCE) - EEPROM_READ(planner.extruder_advance_K[i]); - #else - EEPROM_READ(dummy); + if (!validating) + COPY(planner.extruder_advance_K, extruder_advance_K); #endif } // // Motor Current PWM // - - _FIELD_TEST(motor_current_setting); - - #if HAS_MOTOR_CURRENT_PWM - for (uint8_t q = XYZ; q--;) EEPROM_READ(stepper.motor_current_setting[q]); - #else - uint32_t dummyui32[XYZ]; - EEPROM_READ(dummyui32); - #endif + { + uint32_t motor_current_setting[3]; + _FIELD_TEST(motor_current_setting); + EEPROM_READ(motor_current_setting); + #if HAS_MOTOR_CURRENT_PWM + if (!validating) + COPY(stepper.motor_current_setting, motor_current_setting); + #endif + } // // CNC Coordinate System // - - _FIELD_TEST(coordinate_system); - - #if ENABLED(CNC_COORDINATE_SYSTEMS) - if (!validating) (void)gcode.select_coordinate_system(-1); // Go back to machine space - EEPROM_READ(gcode.coordinate_system); // 27 floats - #else - for (uint8_t q = MAX_COORDINATE_SYSTEMS * XYZ; q--;) EEPROM_READ(dummy); - #endif + { + _FIELD_TEST(coordinate_system); + #if ENABLED(CNC_COORDINATE_SYSTEMS) + if (!validating) (void)gcode.select_coordinate_system(-1); // Go back to machine space + EEPROM_READ(gcode.coordinate_system); + #else + float coordinate_system[MAX_COORDINATE_SYSTEMS][XYZ]; + EEPROM_READ(coordinate_system); + #endif + } // // Skew correction factors // - - _FIELD_TEST(planner_xy_skew_factor); - - #if ENABLED(SKEW_CORRECTION_GCODE) - EEPROM_READ(planner.xy_skew_factor); - #if ENABLED(SKEW_CORRECTION_FOR_Z) - EEPROM_READ(planner.xz_skew_factor); - EEPROM_READ(planner.yz_skew_factor); - #else - EEPROM_READ(dummy); - EEPROM_READ(dummy); + { + skew_factor_t skew_factor; + _FIELD_TEST(planner_skew_factor); + EEPROM_READ(skew_factor); + #if ENABLED(SKEW_CORRECTION_GCODE) + if (!validating) { + planner.skew_factor.xy = skew_factor.xy; + #if ENABLED(SKEW_CORRECTION_FOR_Z) + planner.skew_factor.xz = skew_factor.xz; + planner.skew_factor.yz = skew_factor.yz; + #endif + } #endif - #else - for (uint8_t q = 3; q--;) EEPROM_READ(dummy); - #endif + } // // Advanced Pause filament load & unload lengths // + { + #if DISABLED(ADVANCED_PAUSE_FEATURE) + fil_change_settings_t fc_settings[EXTRUDERS]; + #endif + _FIELD_TEST(fc_settings); + EEPROM_READ(fc_settings); + } - _FIELD_TEST(filament_change_unload_length); - - #if ENABLED(ADVANCED_PAUSE_FEATURE) - for (uint8_t q = 0; q < COUNT(filament_change_unload_length); q++) { - EEPROM_READ(dummy); - if (!validating && q < COUNT(filament_change_unload_length)) filament_change_unload_length[q] = dummy; - EEPROM_READ(dummy); - if (!validating && q < COUNT(filament_change_load_length)) filament_change_load_length[q] = dummy; - } - #else - for (uint8_t q = EXTRUDERS * 2; q--;) EEPROM_READ(dummy); + // + // Tool-change settings + // + #if EXTRUDERS > 1 + _FIELD_TEST(toolchange_settings); + EEPROM_READ(toolchange_settings); #endif eeprom_error = size_error(eeprom_index - (EEPROM_OFFSET)); @@ -1861,21 +1919,17 @@ void MarlinSettings::reset(PORTARG_SOLO) { static const float tmp1[] PROGMEM = DEFAULT_AXIS_STEPS_PER_UNIT, tmp2[] PROGMEM = DEFAULT_MAX_FEEDRATE; static const uint32_t tmp3[] PROGMEM = DEFAULT_MAX_ACCELERATION; LOOP_XYZE_N(i) { - planner.axis_steps_per_mm[i] = pgm_read_float(&tmp1[i < COUNT(tmp1) ? i : COUNT(tmp1) - 1]); - planner.max_feedrate_mm_s[i] = pgm_read_float(&tmp2[i < COUNT(tmp2) ? i : COUNT(tmp2) - 1]); - planner.max_acceleration_mm_per_s2[i] = pgm_read_dword_near(&tmp3[i < COUNT(tmp3) ? i : COUNT(tmp3) - 1]); + planner.settings.axis_steps_per_mm[i] = pgm_read_float(&tmp1[ALIM(i, tmp1)]); + planner.settings.max_feedrate_mm_s[i] = pgm_read_float(&tmp2[ALIM(i, tmp2)]); + planner.settings.max_acceleration_mm_per_s2[i] = pgm_read_dword(&tmp3[ALIM(i, tmp3)]); } - planner.min_segment_time_us = DEFAULT_MINSEGMENTTIME; - planner.acceleration = DEFAULT_ACCELERATION; - planner.retract_acceleration = DEFAULT_RETRACT_ACCELERATION; - planner.travel_acceleration = DEFAULT_TRAVEL_ACCELERATION; - planner.min_feedrate_mm_s = DEFAULT_MINIMUMFEEDRATE; - planner.min_travel_feedrate_mm_s = DEFAULT_MINTRAVELFEEDRATE; - - #if ENABLED(JUNCTION_DEVIATION) - planner.junction_deviation_mm = float(JUNCTION_DEVIATION_MM); - #endif + planner.settings.min_segment_time_us = DEFAULT_MINSEGMENTTIME; + planner.settings.acceleration = DEFAULT_ACCELERATION; + planner.settings.retract_acceleration = DEFAULT_RETRACT_ACCELERATION; + planner.settings.travel_acceleration = DEFAULT_TRAVEL_ACCELERATION; + planner.settings.min_feedrate_mm_s = DEFAULT_MINIMUMFEEDRATE; + planner.settings.min_travel_feedrate_mm_s = DEFAULT_MINTRAVELFEEDRATE; #if HAS_CLASSIC_JERK planner.max_jerk[X_AXIS] = DEFAULT_XJERK; @@ -1886,7 +1940,13 @@ void MarlinSettings::reset(PORTARG_SOLO) { #endif #endif - #if HAS_HOME_OFFSET + #if ENABLED(JUNCTION_DEVIATION) + planner.junction_deviation_mm = float(JUNCTION_DEVIATION_MM); + #endif + + #if HAS_SCARA_OFFSET + ZERO(scara_home_offset); + #elif HAS_HOME_OFFSET ZERO(home_offset); #endif @@ -1902,6 +1962,18 @@ void MarlinSettings::reset(PORTARG_SOLO) { #endif #endif + #if EXTRUDERS > 1 + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + toolchange_settings.swap_length = TOOLCHANGE_FIL_SWAP_LENGTH; + toolchange_settings.prime_speed = TOOLCHANGE_FIL_SWAP_PRIME_SPEED; + toolchange_settings.retract_speed = TOOLCHANGE_FIL_SWAP_RETRACT_SPEED; + #endif + #if ENABLED(TOOLCHANGE_PARK) + toolchange_settings.change_point = TOOLCHANGE_PARK_XY; + #endif + toolchange_settings.z_raise = TOOLCHANGE_ZRAISE; + #endif + // // Global Leveling // @@ -1931,34 +2003,33 @@ void MarlinSettings::reset(PORTARG_SOLO) { #else #define REQ_ANGLES 2 #endif - constexpr uint16_t extruder_angles[] = SWITCHING_EXTRUDER_SERVO_ANGLES; - static_assert(COUNT(extruder_angles) == REQ_ANGLES, "SWITCHING_EXTRUDER_SERVO_ANGLES needs " STRINGIFY(REQ_ANGLES) " angles."); - servo_angles[SWITCHING_EXTRUDER_SERVO_NR][0] = extruder_angles[0]; - servo_angles[SWITCHING_EXTRUDER_SERVO_NR][1] = extruder_angles[1]; + constexpr uint16_t sesa[] = SWITCHING_EXTRUDER_SERVO_ANGLES; + static_assert(COUNT(sesa) == REQ_ANGLES, "SWITCHING_EXTRUDER_SERVO_ANGLES needs " STRINGIFY(REQ_ANGLES) " angles."); + servo_angles[SWITCHING_EXTRUDER_SERVO_NR][0] = sesa[0]; + servo_angles[SWITCHING_EXTRUDER_SERVO_NR][1] = sesa[1]; #if EXTRUDERS > 3 - servo_angles[SWITCHING_EXTRUDER_E23_SERVO_NR][0] = extruder_angles[2]; - servo_angles[SWITCHING_EXTRUDER_E23_SERVO_NR][1] = extruder_angles[3]; + servo_angles[SWITCHING_EXTRUDER_E23_SERVO_NR][0] = sesa[2]; + servo_angles[SWITCHING_EXTRUDER_E23_SERVO_NR][1] = sesa[3]; #endif #elif ENABLED(SWITCHING_NOZZLE) - constexpr uint16_t nozzle_angles[2] = SWITCHING_NOZZLE_SERVO_ANGLES; - servo_angles[SWITCHING_NOZZLE_SERVO_NR][0] = nozzle_angles[0]; - servo_angles[SWITCHING_NOZZLE_SERVO_NR][1] = nozzle_angles[1]; + constexpr uint16_t snsa[2] = SWITCHING_NOZZLE_SERVO_ANGLES; + servo_angles[SWITCHING_NOZZLE_SERVO_NR][0] = snsa[0]; + servo_angles[SWITCHING_NOZZLE_SERVO_NR][1] = snsa[1]; #elif defined(Z_SERVO_ANGLES) && defined(Z_PROBE_SERVO_NR) - constexpr uint16_t z_probe_angles[2] = Z_SERVO_ANGLES; - servo_angles[Z_PROBE_SERVO_NR][0] = z_probe_angles[0]; - servo_angles[Z_PROBE_SERVO_NR][1] = z_probe_angles[1]; + constexpr uint16_t zsa[2] = Z_SERVO_ANGLES; + servo_angles[Z_PROBE_SERVO_NR][0] = zsa[0]; + servo_angles[Z_PROBE_SERVO_NR][1] = zsa[1]; #endif #endif // HAS_SERVOS && EDITABLE_SERVO_ANGLES #if ENABLED(DELTA) - const float adj[ABC] = DELTA_ENDSTOP_ADJ, - dta[ABC] = DELTA_TOWER_ANGLE_TRIM; + const float adj[ABC] = DELTA_ENDSTOP_ADJ, dta[ABC] = DELTA_TOWER_ANGLE_TRIM; delta_height = DELTA_HEIGHT; COPY(delta_endstop_adj, adj); delta_radius = DELTA_RADIUS; @@ -2014,20 +2085,17 @@ void MarlinSettings::reset(PORTARG_SOLO) { #endif - #if ENABLED(ULTIPANEL) - lcd_preheat_hotend_temp[0] = PREHEAT_1_TEMP_HOTEND; - lcd_preheat_hotend_temp[1] = PREHEAT_2_TEMP_HOTEND; - lcd_preheat_bed_temp[0] = PREHEAT_1_TEMP_BED; - lcd_preheat_bed_temp[1] = PREHEAT_2_TEMP_BED; - lcd_preheat_fan_speed[0] = PREHEAT_1_FAN_SPEED; - lcd_preheat_fan_speed[1] = PREHEAT_2_FAN_SPEED; + #if HAS_LCD_MENU + ui.preheat_hotend_temp[0] = PREHEAT_1_TEMP_HOTEND; + ui.preheat_hotend_temp[1] = PREHEAT_2_TEMP_HOTEND; + ui.preheat_bed_temp[0] = PREHEAT_1_TEMP_BED; + ui.preheat_bed_temp[1] = PREHEAT_2_TEMP_BED; + ui.preheat_fan_speed[0] = PREHEAT_1_FAN_SPEED; + ui.preheat_fan_speed[1] = PREHEAT_2_FAN_SPEED; #endif #if ENABLED(PIDTEMP) - #if ENABLED(PID_PARAMS_PER_HOTEND) && HOTENDS > 1 - HOTEND_LOOP() - #endif - { + HOTEND_LOOP() { PID_PARAM(Kp, e) = float(DEFAULT_Kp); PID_PARAM(Ki, e) = scalePID_i(DEFAULT_Ki); PID_PARAM(Kd, e) = scalePID_d(DEFAULT_Kd); @@ -2041,13 +2109,17 @@ void MarlinSettings::reset(PORTARG_SOLO) { #endif // PIDTEMP #if ENABLED(PIDTEMPBED) - thermalManager.bedKp = DEFAULT_bedKp; - thermalManager.bedKi = scalePID_i(DEFAULT_bedKi); - thermalManager.bedKd = scalePID_d(DEFAULT_bedKd); + thermalManager.bed_pid.Kp = DEFAULT_bedKp; + thermalManager.bed_pid.Ki = scalePID_i(DEFAULT_bedKi); + thermalManager.bed_pid.Kd = scalePID_d(DEFAULT_bedKd); #endif #if HAS_LCD_CONTRAST - lcd_contrast = DEFAULT_LCD_CONTRAST; + ui.set_contrast(DEFAULT_LCD_CONTRAST); + #endif + + #if ENABLED(POWER_LOSS_RECOVERY) + recovery.enable(true); #endif #if ENABLED(FWRETRACT) @@ -2083,23 +2155,23 @@ void MarlinSettings::reset(PORTARG_SOLO) { #endif #if HAS_MOTOR_CURRENT_PWM - uint32_t tmp_motor_current_setting[XYZ] = PWM_MOTOR_CURRENT; - for (uint8_t q = XYZ; q--;) + uint32_t tmp_motor_current_setting[3] = PWM_MOTOR_CURRENT; + for (uint8_t q = 3; q--;) stepper.digipot_current(q, (stepper.motor_current_setting[q] = tmp_motor_current_setting[q])); #endif #if ENABLED(SKEW_CORRECTION_GCODE) - planner.xy_skew_factor = XY_SKEW_FACTOR; + planner.skew_factor.xy = XY_SKEW_FACTOR; #if ENABLED(SKEW_CORRECTION_FOR_Z) - planner.xz_skew_factor = XZ_SKEW_FACTOR; - planner.yz_skew_factor = YZ_SKEW_FACTOR; + planner.skew_factor.xz = XZ_SKEW_FACTOR; + planner.skew_factor.yz = YZ_SKEW_FACTOR; #endif #endif #if ENABLED(ADVANCED_PAUSE_FEATURE) for (uint8_t e = 0; e < EXTRUDERS; e++) { - filament_change_unload_length[e] = FILAMENT_CHANGE_UNLOAD_LENGTH; - filament_change_load_length[e] = FILAMENT_CHANGE_FAST_LOAD_LENGTH; + fc_settings[e].unload_length = FILAMENT_CHANGE_UNLOAD_LENGTH; + fc_settings[e].load_length = FILAMENT_CHANGE_FAST_LOAD_LENGTH; } #endif @@ -2120,7 +2192,7 @@ void MarlinSettings::reset(PORTARG_SOLO) { #if ENABLED(HYBRID_THRESHOLD) void say_M913(PORTARG_SOLO) { SERIAL_ECHOPGM_P(port, " M913"); } #endif - #if ENABLED(SENSORLESS_HOMING) + #if USE_SENSORLESS void say_M914(PORTARG_SOLO) { SERIAL_ECHOPGM_P(port, " M914"); } #endif #endif @@ -2164,33 +2236,27 @@ void MarlinSettings::reset(PORTARG_SOLO) { */ CONFIG_ECHO_START; #if ENABLED(INCH_MODE_SUPPORT) - #define LINEAR_UNIT(N) (float(N) / parser.linear_unit_factor) - #define VOLUMETRIC_UNIT(N) (float(N) / (parser.volumetric_enabled ? parser.volumetric_unit_factor : parser.linear_unit_factor)) SERIAL_ECHOPGM_P(port, " G2"); SERIAL_CHAR_P(port, parser.linear_unit_factor == 1.0 ? '1' : '0'); SERIAL_ECHOPGM_P(port, " ;"); SAY_UNITS_P(port, false); #else - #define LINEAR_UNIT(N) (N) - #define VOLUMETRIC_UNIT(N) (N) SERIAL_ECHOPGM_P(port, " G21 ; Units in mm"); SAY_UNITS_P(port, false); #endif SERIAL_EOL_P(port); - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU // Temperature units - for Ultipanel temperature options CONFIG_ECHO_START; #if ENABLED(TEMPERATURE_UNITS_SUPPORT) - #define TEMP_UNIT(N) parser.to_temp_units(N) SERIAL_ECHOPGM_P(port, " M149 "); SERIAL_CHAR_P(port, parser.temp_units_code()); SERIAL_ECHOPGM_P(port, " ; Units in "); serialprintPGM_P(port, parser.temp_units_name()); #else - #define TEMP_UNIT(N) (N) SERIAL_ECHOLNPGM_P(port, " M149 C ; Units in Celsius"); #endif @@ -2253,18 +2319,18 @@ void MarlinSettings::reset(PORTARG_SOLO) { SERIAL_ECHOLNPGM_P(port, "Steps per unit:"); } CONFIG_ECHO_START; - SERIAL_ECHOPAIR_P(port, " M92 X", LINEAR_UNIT(planner.axis_steps_per_mm[X_AXIS])); - SERIAL_ECHOPAIR_P(port, " Y", LINEAR_UNIT(planner.axis_steps_per_mm[Y_AXIS])); - SERIAL_ECHOPAIR_P(port, " Z", LINEAR_UNIT(planner.axis_steps_per_mm[Z_AXIS])); + SERIAL_ECHOPAIR_P(port, " M92 X", LINEAR_UNIT(planner.settings.axis_steps_per_mm[X_AXIS])); + SERIAL_ECHOPAIR_P(port, " Y", LINEAR_UNIT(planner.settings.axis_steps_per_mm[Y_AXIS])); + SERIAL_ECHOPAIR_P(port, " Z", LINEAR_UNIT(planner.settings.axis_steps_per_mm[Z_AXIS])); #if DISABLED(DISTINCT_E_FACTORS) - SERIAL_ECHOPAIR_P(port, " E", VOLUMETRIC_UNIT(planner.axis_steps_per_mm[E_AXIS])); + SERIAL_ECHOPAIR_P(port, " E", VOLUMETRIC_UNIT(planner.settings.axis_steps_per_mm[E_AXIS])); #endif SERIAL_EOL_P(port); #if ENABLED(DISTINCT_E_FACTORS) CONFIG_ECHO_START; for (uint8_t i = 0; i < E_STEPPERS; i++) { SERIAL_ECHOPAIR_P(port, " M92 T", (int)i); - SERIAL_ECHOLNPAIR_P(port, " E", VOLUMETRIC_UNIT(planner.axis_steps_per_mm[E_AXIS + i])); + SERIAL_ECHOLNPAIR_P(port, " E", VOLUMETRIC_UNIT(planner.settings.axis_steps_per_mm[E_AXIS + i])); } #endif @@ -2273,18 +2339,18 @@ void MarlinSettings::reset(PORTARG_SOLO) { SERIAL_ECHOLNPGM_P(port, "Maximum feedrates (units/s):"); } CONFIG_ECHO_START; - SERIAL_ECHOPAIR_P(port, " M203 X", LINEAR_UNIT(planner.max_feedrate_mm_s[X_AXIS])); - SERIAL_ECHOPAIR_P(port, " Y", LINEAR_UNIT(planner.max_feedrate_mm_s[Y_AXIS])); - SERIAL_ECHOPAIR_P(port, " Z", LINEAR_UNIT(planner.max_feedrate_mm_s[Z_AXIS])); + SERIAL_ECHOPAIR_P(port, " M203 X", LINEAR_UNIT(planner.settings.max_feedrate_mm_s[X_AXIS])); + SERIAL_ECHOPAIR_P(port, " Y", LINEAR_UNIT(planner.settings.max_feedrate_mm_s[Y_AXIS])); + SERIAL_ECHOPAIR_P(port, " Z", LINEAR_UNIT(planner.settings.max_feedrate_mm_s[Z_AXIS])); #if DISABLED(DISTINCT_E_FACTORS) - SERIAL_ECHOPAIR_P(port, " E", VOLUMETRIC_UNIT(planner.max_feedrate_mm_s[E_AXIS])); + SERIAL_ECHOPAIR_P(port, " E", VOLUMETRIC_UNIT(planner.settings.max_feedrate_mm_s[E_AXIS])); #endif SERIAL_EOL_P(port); #if ENABLED(DISTINCT_E_FACTORS) CONFIG_ECHO_START; for (uint8_t i = 0; i < E_STEPPERS; i++) { SERIAL_ECHOPAIR_P(port, " M203 T", (int)i); - SERIAL_ECHOLNPAIR_P(port, " E", VOLUMETRIC_UNIT(planner.max_feedrate_mm_s[E_AXIS + i])); + SERIAL_ECHOLNPAIR_P(port, " E", VOLUMETRIC_UNIT(planner.settings.max_feedrate_mm_s[E_AXIS + i])); } #endif @@ -2293,18 +2359,18 @@ void MarlinSettings::reset(PORTARG_SOLO) { SERIAL_ECHOLNPGM_P(port, "Maximum Acceleration (units/s2):"); } CONFIG_ECHO_START; - SERIAL_ECHOPAIR_P(port, " M201 X", LINEAR_UNIT(planner.max_acceleration_mm_per_s2[X_AXIS])); - SERIAL_ECHOPAIR_P(port, " Y", LINEAR_UNIT(planner.max_acceleration_mm_per_s2[Y_AXIS])); - SERIAL_ECHOPAIR_P(port, " Z", LINEAR_UNIT(planner.max_acceleration_mm_per_s2[Z_AXIS])); + SERIAL_ECHOPAIR_P(port, " M201 X", LINEAR_UNIT(planner.settings.max_acceleration_mm_per_s2[X_AXIS])); + SERIAL_ECHOPAIR_P(port, " Y", LINEAR_UNIT(planner.settings.max_acceleration_mm_per_s2[Y_AXIS])); + SERIAL_ECHOPAIR_P(port, " Z", LINEAR_UNIT(planner.settings.max_acceleration_mm_per_s2[Z_AXIS])); #if DISABLED(DISTINCT_E_FACTORS) - SERIAL_ECHOPAIR_P(port, " E", VOLUMETRIC_UNIT(planner.max_acceleration_mm_per_s2[E_AXIS])); + SERIAL_ECHOPAIR_P(port, " E", VOLUMETRIC_UNIT(planner.settings.max_acceleration_mm_per_s2[E_AXIS])); #endif SERIAL_EOL_P(port); #if ENABLED(DISTINCT_E_FACTORS) CONFIG_ECHO_START; for (uint8_t i = 0; i < E_STEPPERS; i++) { SERIAL_ECHOPAIR_P(port, " M201 T", (int)i); - SERIAL_ECHOLNPAIR_P(port, " E", VOLUMETRIC_UNIT(planner.max_acceleration_mm_per_s2[E_AXIS + i])); + SERIAL_ECHOLNPAIR_P(port, " E", VOLUMETRIC_UNIT(planner.settings.max_acceleration_mm_per_s2[E_AXIS + i])); } #endif @@ -2313,9 +2379,9 @@ void MarlinSettings::reset(PORTARG_SOLO) { SERIAL_ECHOLNPGM_P(port, "Acceleration (units/s2): P R T"); } CONFIG_ECHO_START; - SERIAL_ECHOPAIR_P(port, " M204 P", LINEAR_UNIT(planner.acceleration)); - SERIAL_ECHOPAIR_P(port, " R", LINEAR_UNIT(planner.retract_acceleration)); - SERIAL_ECHOLNPAIR_P(port, " T", LINEAR_UNIT(planner.travel_acceleration)); + SERIAL_ECHOPAIR_P(port, " M204 P", LINEAR_UNIT(planner.settings.acceleration)); + SERIAL_ECHOPAIR_P(port, " R", LINEAR_UNIT(planner.settings.retract_acceleration)); + SERIAL_ECHOLNPAIR_P(port, " T", LINEAR_UNIT(planner.settings.travel_acceleration)); if (!forReplay) { CONFIG_ECHO_START; @@ -2332,9 +2398,9 @@ void MarlinSettings::reset(PORTARG_SOLO) { SERIAL_EOL_P(port); } CONFIG_ECHO_START; - SERIAL_ECHOPAIR_P(port, " M205 B", LINEAR_UNIT(planner.min_segment_time_us)); - SERIAL_ECHOPAIR_P(port, " S", LINEAR_UNIT(planner.min_feedrate_mm_s)); - SERIAL_ECHOPAIR_P(port, " T", LINEAR_UNIT(planner.min_travel_feedrate_mm_s)); + SERIAL_ECHOPAIR_P(port, " M205 B", LINEAR_UNIT(planner.settings.min_segment_time_us)); + SERIAL_ECHOPAIR_P(port, " S", LINEAR_UNIT(planner.settings.min_feedrate_mm_s)); + SERIAL_ECHOPAIR_P(port, " T", LINEAR_UNIT(planner.settings.min_travel_feedrate_mm_s)); #if ENABLED(JUNCTION_DEVIATION) SERIAL_ECHOPAIR_P(port, " J", LINEAR_UNIT(planner.junction_deviation_mm)); @@ -2488,7 +2554,20 @@ void MarlinSettings::reset(PORTARG_SOLO) { #endif // HAS_SERVOS && EDITABLE_SERVO_ANGLES - #if ENABLED(DELTA) + #if HAS_SCARA_OFFSET + + if (!forReplay) { + CONFIG_ECHO_START; + SERIAL_ECHOLNPGM_P(port, "SCARA settings: S P T"); + } + CONFIG_ECHO_START; + SERIAL_ECHOPAIR_P(port, " M665 S", delta_segments_per_second); + SERIAL_ECHOPAIR_P(port, " P", scara_home_offset[A_AXIS]); + SERIAL_ECHOPAIR_P(port, " T", scara_home_offset[B_AXIS]); + SERIAL_ECHOPAIR_P(port, " Z", LINEAR_UNIT(scara_home_offset[Z_AXIS])); + SERIAL_EOL_P(port); + + #elif ENABLED(DELTA) if (!forReplay) { CONFIG_ECHO_START; @@ -2538,19 +2617,21 @@ void MarlinSettings::reset(PORTARG_SOLO) { #endif // [XYZ]_DUAL_ENDSTOPS - #if ENABLED(ULTIPANEL) + #if HAS_LCD_MENU + if (!forReplay) { CONFIG_ECHO_START; SERIAL_ECHOLNPGM_P(port, "Material heatup parameters:"); } - for (uint8_t i = 0; i < COUNT(lcd_preheat_hotend_temp); i++) { + for (uint8_t i = 0; i < COUNT(ui.preheat_hotend_temp); i++) { CONFIG_ECHO_START; SERIAL_ECHOPAIR_P(port, " M145 S", (int)i); - SERIAL_ECHOPAIR_P(port, " H", TEMP_UNIT(lcd_preheat_hotend_temp[i])); - SERIAL_ECHOPAIR_P(port, " B", TEMP_UNIT(lcd_preheat_bed_temp[i])); - SERIAL_ECHOLNPAIR_P(port, " F", lcd_preheat_fan_speed[i]); + SERIAL_ECHOPAIR_P(port, " H", TEMP_UNIT(ui.preheat_hotend_temp[i])); + SERIAL_ECHOPAIR_P(port, " B", TEMP_UNIT(ui.preheat_bed_temp[i])); + SERIAL_ECHOLNPAIR_P(port, " F", int(ui.preheat_fan_speed[i])); } - #endif // ULTIPANEL + + #endif #if HAS_PID_HEATING @@ -2592,9 +2673,9 @@ void MarlinSettings::reset(PORTARG_SOLO) { #if ENABLED(PIDTEMPBED) CONFIG_ECHO_START; - SERIAL_ECHOPAIR_P(port, " M304 P", thermalManager.bedKp); - SERIAL_ECHOPAIR_P(port, " I", unscalePID_i(thermalManager.bedKi)); - SERIAL_ECHOPAIR_P(port, " D", unscalePID_d(thermalManager.bedKd)); + SERIAL_ECHOPAIR_P(port, " M304 P", thermalManager.bed_pid.Kp); + SERIAL_ECHOPAIR_P(port, " I", unscalePID_i(thermalManager.bed_pid.Ki)); + SERIAL_ECHOPAIR_P(port, " D", unscalePID_d(thermalManager.bed_pid.Kd)); SERIAL_EOL_P(port); #endif @@ -2606,7 +2687,16 @@ void MarlinSettings::reset(PORTARG_SOLO) { SERIAL_ECHOLNPGM_P(port, "LCD Contrast:"); } CONFIG_ECHO_START; - SERIAL_ECHOLNPAIR_P(port, " M250 C", lcd_contrast); + SERIAL_ECHOLNPAIR_P(port, " M250 C", ui.contrast); + #endif + + #if ENABLED(POWER_LOSS_RECOVERY) + if (!forReplay) { + CONFIG_ECHO_START; + SERIAL_ECHOLNPGM_P(port, "Power-Loss Recovery:"); + } + CONFIG_ECHO_START; + SERIAL_ECHOLNPAIR_P(port, " M413 S", int(recovery.enabled)); #endif #if ENABLED(FWRETRACT) @@ -2616,19 +2706,19 @@ void MarlinSettings::reset(PORTARG_SOLO) { SERIAL_ECHOLNPGM_P(port, "Retract: S F Z"); } CONFIG_ECHO_START; - SERIAL_ECHOPAIR_P(port, " M207 S", LINEAR_UNIT(fwretract.retract_length)); - SERIAL_ECHOPAIR_P(port, " W", LINEAR_UNIT(fwretract.swap_retract_length)); - SERIAL_ECHOPAIR_P(port, " F", MMS_TO_MMM(LINEAR_UNIT(fwretract.retract_feedrate_mm_s))); - SERIAL_ECHOLNPAIR_P(port, " Z", LINEAR_UNIT(fwretract.retract_zlift)); + SERIAL_ECHOPAIR_P(port, " M207 S", LINEAR_UNIT(fwretract.settings.retract_length)); + SERIAL_ECHOPAIR_P(port, " W", LINEAR_UNIT(fwretract.settings.swap_retract_length)); + SERIAL_ECHOPAIR_P(port, " F", MMS_TO_MMM(LINEAR_UNIT(fwretract.settings.retract_feedrate_mm_s))); + SERIAL_ECHOLNPAIR_P(port, " Z", LINEAR_UNIT(fwretract.settings.retract_zraise)); if (!forReplay) { CONFIG_ECHO_START; SERIAL_ECHOLNPGM_P(port, "Recover: S F"); } CONFIG_ECHO_START; - SERIAL_ECHOPAIR_P(port, " M208 S", LINEAR_UNIT(fwretract.retract_recover_length)); - SERIAL_ECHOPAIR_P(port, " W", LINEAR_UNIT(fwretract.swap_retract_recover_length)); - SERIAL_ECHOLNPAIR_P(port, " F", MMS_TO_MMM(LINEAR_UNIT(fwretract.retract_recover_feedrate_mm_s))); + SERIAL_ECHOPAIR_P(port, " M208 S", LINEAR_UNIT(fwretract.settings.retract_recover_length)); + SERIAL_ECHOPAIR_P(port, " W", LINEAR_UNIT(fwretract.settings.swap_retract_recover_length)); + SERIAL_ECHOLNPAIR_P(port, " F", MMS_TO_MMM(LINEAR_UNIT(fwretract.settings.retract_recover_feedrate_mm_s))); #if ENABLED(FWRETRACT_AUTORETRACT) @@ -2649,7 +2739,7 @@ void MarlinSettings::reset(PORTARG_SOLO) { #if HAS_BED_PROBE if (!forReplay) { CONFIG_ECHO_START; - SERIAL_ECHOPGM_P(port, "Z-Probe Offset (mm):"); + SERIAL_ECHOPGM_P(port, "Z-Probe Offset"); SAY_UNITS_P(port, true); } CONFIG_ECHO_START; @@ -2667,15 +2757,15 @@ void MarlinSettings::reset(PORTARG_SOLO) { CONFIG_ECHO_START; #if ENABLED(SKEW_CORRECTION_FOR_Z) SERIAL_ECHOPGM_P(port, " M852 I"); - SERIAL_ECHO_F_P(port, LINEAR_UNIT(planner.xy_skew_factor), 6); + SERIAL_ECHO_F_P(port, LINEAR_UNIT(planner.skew_factor.xy), 6); SERIAL_ECHOPGM_P(port, " J"); - SERIAL_ECHO_F_P(port, LINEAR_UNIT(planner.xz_skew_factor), 6); + SERIAL_ECHO_F_P(port, LINEAR_UNIT(planner.skew_factor.xz), 6); SERIAL_ECHOPGM_P(port, " K"); - SERIAL_ECHO_F_P(port, LINEAR_UNIT(planner.yz_skew_factor), 6); + SERIAL_ECHO_F_P(port, LINEAR_UNIT(planner.skew_factor.yz), 6); SERIAL_EOL_P(port); #else SERIAL_ECHOPGM_P(port, " M852 S"); - SERIAL_ECHO_F_P(port, LINEAR_UNIT(planner.xy_skew_factor), 6); + SERIAL_ECHO_F_P(port, LINEAR_UNIT(planner.skew_factor.xy), 6); SERIAL_EOL_P(port); #endif #endif @@ -2683,7 +2773,7 @@ void MarlinSettings::reset(PORTARG_SOLO) { #if HAS_TRINAMIC /** - * TMC2130 / TMC2208 stepper driver current + * TMC stepper driver current */ if (!forReplay) { CONFIG_ECHO_START; @@ -2694,65 +2784,68 @@ void MarlinSettings::reset(PORTARG_SOLO) { say_M906(PORTVAR_SOLO); #endif #if AXIS_IS_TMC(X) - SERIAL_ECHOPAIR_P(port, " X", stepperX.getCurrent()); + SERIAL_ECHOPAIR_P(port, " X", stepperX.getMilliamps()); #endif #if AXIS_IS_TMC(Y) - SERIAL_ECHOPAIR_P(port, " Y", stepperY.getCurrent()); + SERIAL_ECHOPAIR_P(port, " Y", stepperY.getMilliamps()); #endif #if AXIS_IS_TMC(Z) - SERIAL_ECHOPAIR_P(port, " Z", stepperZ.getCurrent()); + SERIAL_ECHOPAIR_P(port, " Z", stepperZ.getMilliamps()); #endif #if AXIS_IS_TMC(X) || AXIS_IS_TMC(Y) || AXIS_IS_TMC(Z) SERIAL_EOL_P(port); #endif + #if AXIS_IS_TMC(X2) || AXIS_IS_TMC(Y2) || AXIS_IS_TMC(Z2) say_M906(PORTVAR_SOLO); SERIAL_ECHOPGM_P(port, " I1"); #endif #if AXIS_IS_TMC(X2) - SERIAL_ECHOPAIR_P(port, " X", stepperX2.getCurrent()); + SERIAL_ECHOPAIR_P(port, " X", stepperX2.getMilliamps()); #endif #if AXIS_IS_TMC(Y2) - SERIAL_ECHOPAIR_P(port, " Y", stepperY2.getCurrent()); + SERIAL_ECHOPAIR_P(port, " Y", stepperY2.getMilliamps()); #endif #if AXIS_IS_TMC(Z2) - SERIAL_ECHOPAIR_P(port, " Z", stepperZ2.getCurrent()); + SERIAL_ECHOPAIR_P(port, " Z", stepperZ2.getMilliamps()); #endif #if AXIS_IS_TMC(X2) || AXIS_IS_TMC(Y2) || AXIS_IS_TMC(Z2) SERIAL_EOL_P(port); #endif + #if AXIS_IS_TMC(Z3) say_M906(PORTVAR_SOLO); - SERIAL_ECHOLNPAIR_P(port, " I2 Z", stepperZ3.getCurrent()); + SERIAL_ECHOLNPAIR_P(port, " I2 Z", stepperZ3.getMilliamps()); #endif + #if AXIS_IS_TMC(E0) say_M906(PORTVAR_SOLO); - SERIAL_ECHOLNPAIR_P(port, " T0 E", stepperE0.getCurrent()); + SERIAL_ECHOLNPAIR_P(port, " T0 E", stepperE0.getMilliamps()); #endif #if AXIS_IS_TMC(E1) say_M906(PORTVAR_SOLO); - SERIAL_ECHOLNPAIR_P(port, " T1 E", stepperE1.getCurrent()); + SERIAL_ECHOLNPAIR_P(port, " T1 E", stepperE1.getMilliamps()); #endif #if AXIS_IS_TMC(E2) say_M906(PORTVAR_SOLO); - SERIAL_ECHOLNPAIR_P(port, " T2 E", stepperE2.getCurrent()); + SERIAL_ECHOLNPAIR_P(port, " T2 E", stepperE2.getMilliamps()); #endif #if AXIS_IS_TMC(E3) say_M906(PORTVAR_SOLO); - SERIAL_ECHOLNPAIR_P(port, " T3 E", stepperE3.getCurrent()); + SERIAL_ECHOLNPAIR_P(port, " T3 E", stepperE3.getMilliamps()); #endif #if AXIS_IS_TMC(E4) say_M906(PORTVAR_SOLO); - SERIAL_ECHOLNPAIR_P(port, " T4 E", stepperE4.getCurrent()); + SERIAL_ECHOLNPAIR_P(port, " T4 E", stepperE4.getMilliamps()); #endif #if AXIS_IS_TMC(E5) say_M906(PORTVAR_SOLO); - SERIAL_ECHOLNPAIR_P(port, " T5 E", stepperE5.getCurrent()); + SERIAL_ECHOLNPAIR_P(port, " T5 E", stepperE5.getMilliamps()); #endif SERIAL_EOL_P(port); /** - * TMC2130 / TMC2208 / TRAMS Hybrid Threshold + * TMC Hybrid Threshold */ #if ENABLED(HYBRID_THRESHOLD) if (!forReplay) { @@ -2760,63 +2853,66 @@ void MarlinSettings::reset(PORTARG_SOLO) { SERIAL_ECHOLNPGM_P(port, "Hybrid Threshold:"); } CONFIG_ECHO_START; - #if AXIS_IS_TMC(X) || AXIS_IS_TMC(Y) || AXIS_IS_TMC(Z) + #if AXIS_HAS_STEALTHCHOP(X) || AXIS_HAS_STEALTHCHOP(Y) || AXIS_HAS_STEALTHCHOP(Z) say_M913(PORTVAR_SOLO); #endif - #if AXIS_IS_TMC(X) + #if AXIS_HAS_STEALTHCHOP(X) SERIAL_ECHOPAIR_P(port, " X", TMC_GET_PWMTHRS(X, X)); #endif - #if AXIS_IS_TMC(Y) + #if AXIS_HAS_STEALTHCHOP(Y) SERIAL_ECHOPAIR_P(port, " Y", TMC_GET_PWMTHRS(Y, Y)); #endif - #if AXIS_IS_TMC(Z) + #if AXIS_HAS_STEALTHCHOP(Z) SERIAL_ECHOPAIR_P(port, " Z", TMC_GET_PWMTHRS(Z, Z)); #endif - #if AXIS_IS_TMC(X) || AXIS_IS_TMC(Y) || AXIS_IS_TMC(Z) + #if AXIS_HAS_STEALTHCHOP(X) || AXIS_HAS_STEALTHCHOP(Y) || AXIS_HAS_STEALTHCHOP(Z) SERIAL_EOL_P(port); #endif - #if AXIS_IS_TMC(X2) || AXIS_IS_TMC(Y2) || AXIS_IS_TMC(Z2) + + #if AXIS_HAS_STEALTHCHOP(X2) || AXIS_HAS_STEALTHCHOP(Y2) || AXIS_HAS_STEALTHCHOP(Z2) say_M913(PORTVAR_SOLO); SERIAL_ECHOPGM_P(port, " I1"); #endif - #if AXIS_IS_TMC(X2) + #if AXIS_HAS_STEALTHCHOP(X2) SERIAL_ECHOPAIR_P(port, " X", TMC_GET_PWMTHRS(X, X2)); #endif - #if AXIS_IS_TMC(Y2) + #if AXIS_HAS_STEALTHCHOP(Y2) SERIAL_ECHOPAIR_P(port, " Y", TMC_GET_PWMTHRS(Y, Y2)); #endif - #if AXIS_IS_TMC(Z2) + #if AXIS_HAS_STEALTHCHOP(Z2) SERIAL_ECHOPAIR_P(port, " Z", TMC_GET_PWMTHRS(Z, Z2)); #endif - #if AXIS_IS_TMC(X2) || AXIS_IS_TMC(Y2) || AXIS_IS_TMC(Z2) + #if AXIS_HAS_STEALTHCHOP(X2) || AXIS_HAS_STEALTHCHOP(Y2) || AXIS_HAS_STEALTHCHOP(Z2) SERIAL_EOL_P(port); #endif - #if AXIS_IS_TMC(Z3) + + #if AXIS_HAS_STEALTHCHOP(Z3) say_M913(PORTVAR_SOLO); SERIAL_ECHOPGM_P(port, " I2"); SERIAL_ECHOLNPAIR_P(port, " Z", TMC_GET_PWMTHRS(Z, Z3)); #endif - #if AXIS_IS_TMC(E0) + + #if AXIS_HAS_STEALTHCHOP(E0) say_M913(PORTVAR_SOLO); SERIAL_ECHOLNPAIR_P(port, " T0 E", TMC_GET_PWMTHRS(E, E0)); #endif - #if AXIS_IS_TMC(E1) + #if AXIS_HAS_STEALTHCHOP(E1) say_M913(PORTVAR_SOLO); SERIAL_ECHOLNPAIR_P(port, " T1 E", TMC_GET_PWMTHRS(E, E1)); #endif - #if AXIS_IS_TMC(E2) + #if AXIS_HAS_STEALTHCHOP(E2) say_M913(PORTVAR_SOLO); SERIAL_ECHOLNPAIR_P(port, " T2 E", TMC_GET_PWMTHRS(E, E2)); #endif - #if AXIS_IS_TMC(E3) + #if AXIS_HAS_STEALTHCHOP(E3) say_M913(PORTVAR_SOLO); SERIAL_ECHOLNPAIR_P(port, " T3 E", TMC_GET_PWMTHRS(E, E3)); #endif - #if AXIS_IS_TMC(E4) + #if AXIS_HAS_STEALTHCHOP(E4) say_M913(PORTVAR_SOLO); SERIAL_ECHOLNPAIR_P(port, " T4 E", TMC_GET_PWMTHRS(E, E4)); #endif - #if AXIS_IS_TMC(E5) + #if AXIS_HAS_STEALTHCHOP(E5) say_M913(PORTVAR_SOLO); SERIAL_ECHOLNPAIR_P(port, " T5 E", TMC_GET_PWMTHRS(E, E5)); #endif @@ -2824,12 +2920,12 @@ void MarlinSettings::reset(PORTARG_SOLO) { #endif // HYBRID_THRESHOLD /** - * TMC2130 Sensorless homing thresholds + * TMC Sensorless homing thresholds */ - #if ENABLED(SENSORLESS_HOMING) + #if USE_SENSORLESS if (!forReplay) { CONFIG_ECHO_START; - SERIAL_ECHOLNPGM_P(port, "Sensorless homing threshold:"); + SERIAL_ECHOLNPGM_P(port, "TMC2130 StallGuard threshold:"); } CONFIG_ECHO_START; #if X_SENSORLESS || Y_SENSORLESS || Z_SENSORLESS @@ -2846,10 +2942,10 @@ void MarlinSettings::reset(PORTARG_SOLO) { SERIAL_EOL_P(port); #endif - #define HAS_X2_SENSORLESS (defined(X_HOMING_SENSITIVITY) && AXIS_HAS_STALLGUARD(X2)) - #define HAS_Y2_SENSORLESS (defined(Y_HOMING_SENSITIVITY) && AXIS_HAS_STALLGUARD(Y2)) - #define HAS_Z2_SENSORLESS (defined(Z_HOMING_SENSITIVITY) && AXIS_HAS_STALLGUARD(Z2)) - #define HAS_Z3_SENSORLESS (defined(Z_HOMING_SENSITIVITY) && AXIS_HAS_STALLGUARD(Z3)) + #define HAS_X2_SENSORLESS (defined(X_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(X2)) + #define HAS_Y2_SENSORLESS (defined(Y_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(Y2)) + #define HAS_Z2_SENSORLESS (defined(Z_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(Z2)) + #define HAS_Z3_SENSORLESS (defined(Z_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(Z3)) #if HAS_X2_SENSORLESS || HAS_Y2_SENSORLESS || HAS_Z2_SENSORLESS say_M914(PORTVAR_SOLO); SERIAL_ECHOPGM_P(port, " I1"); @@ -2871,7 +2967,7 @@ void MarlinSettings::reset(PORTARG_SOLO) { SERIAL_ECHOLNPAIR_P(port, " Z", stepperZ3.sgt()); #endif - #endif // SENSORLESS_HOMING + #endif // USE_SENSORLESS #endif // HAS_TRINAMIC @@ -2918,42 +3014,53 @@ void MarlinSettings::reset(PORTARG_SOLO) { CONFIG_ECHO_START; #if EXTRUDERS == 1 say_M603(PORTVAR_SOLO); - SERIAL_ECHOPAIR_P(port, "L", LINEAR_UNIT(filament_change_load_length[0])); - SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(filament_change_unload_length[0])); + SERIAL_ECHOPAIR_P(port, "L", LINEAR_UNIT(fc_settings[0].load_length)); + SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(fc_settings[0].unload_length)); #else say_M603(PORTVAR_SOLO); - SERIAL_ECHOPAIR_P(port, "T0 L", LINEAR_UNIT(filament_change_load_length[0])); - SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(filament_change_unload_length[0])); + SERIAL_ECHOPAIR_P(port, "T0 L", LINEAR_UNIT(fc_settings[0].load_length)); + SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(fc_settings[0].unload_length)); CONFIG_ECHO_START; say_M603(PORTVAR_SOLO); - SERIAL_ECHOPAIR_P(port, "T1 L", LINEAR_UNIT(filament_change_load_length[1])); - SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(filament_change_unload_length[1])); + SERIAL_ECHOPAIR_P(port, "T1 L", LINEAR_UNIT(fc_settings[1].load_length)); + SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(fc_settings[1].unload_length)); #if EXTRUDERS > 2 CONFIG_ECHO_START; say_M603(PORTVAR_SOLO); - SERIAL_ECHOPAIR_P(port, "T2 L", LINEAR_UNIT(filament_change_load_length[2])); - SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(filament_change_unload_length[2])); + SERIAL_ECHOPAIR_P(port, "T2 L", LINEAR_UNIT(fc_settings[2].load_length)); + SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(fc_settings[2].unload_length)); #if EXTRUDERS > 3 CONFIG_ECHO_START; say_M603(PORTVAR_SOLO); - SERIAL_ECHOPAIR_P(port, "T3 L", LINEAR_UNIT(filament_change_load_length[3])); - SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(filament_change_unload_length[3])); + SERIAL_ECHOPAIR_P(port, "T3 L", LINEAR_UNIT(fc_settings[3].load_length)); + SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(fc_settings[3].unload_length)); #if EXTRUDERS > 4 CONFIG_ECHO_START; say_M603(PORTVAR_SOLO); - SERIAL_ECHOPAIR_P(port, "T4 L", LINEAR_UNIT(filament_change_load_length[4])); - SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(filament_change_unload_length[4])); + SERIAL_ECHOPAIR_P(port, "T4 L", LINEAR_UNIT(fc_settings[4].load_length)); + SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(fc_settings[4].unload_length)); #if EXTRUDERS > 5 CONFIG_ECHO_START; say_M603(PORTVAR_SOLO); - SERIAL_ECHOPAIR_P(port, "T5 L", LINEAR_UNIT(filament_change_load_length[5])); - SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(filament_change_unload_length[5])); + SERIAL_ECHOPAIR_P(port, "T5 L", LINEAR_UNIT(fc_settings[5].load_length)); + SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(fc_settings[5].unload_length)); #endif // EXTRUDERS > 5 #endif // EXTRUDERS > 4 #endif // EXTRUDERS > 3 #endif // EXTRUDERS > 2 #endif // EXTRUDERS == 1 #endif // ADVANCED_PAUSE_FEATURE + + #if EXTRUDERS > 1 + CONFIG_ECHO_START; + if (!forReplay) { + SERIAL_ECHOLNPGM_P(port, "Tool-changing:"); + CONFIG_ECHO_START; + } + M217_report(true); + #endif } #endif // !DISABLE_M503 + +#pragma pack(pop) diff --git a/Marlin/src/module/configuration_store.h b/Marlin/src/module/configuration_store.h index 84e90527b3..88f36a492f 100644 --- a/Marlin/src/module/configuration_store.h +++ b/Marlin/src/module/configuration_store.h @@ -19,9 +19,7 @@ * along with this program. If not, see . * */ - -#ifndef CONFIGURATION_STORE_H -#define CONFIGURATION_STORE_H +#pragma once #include "../inc/MarlinConfig.h" @@ -61,6 +59,11 @@ class MarlinSettings { #endif } + #if ENABLED(SD_FIRMWARE_UPDATE) + static bool sd_update_status(); // True if the SD-Firmware-Update EEPROM flag is set + static bool set_sd_update_status(const bool enable); // Return 'true' after EEPROM is set (-> always true) + #endif + #if ENABLED(EEPROM_SETTINGS) static bool load(PORTINIT_SOLO); // Return 'true' if data was loaded ok static bool validate(PORTINIT_SOLO); // Return 'true' if EEPROM data is ok @@ -115,5 +118,3 @@ extern MarlinSettings settings; #undef PORTINIT_SOLO #undef PORTINIT_AFTER - -#endif // CONFIGURATION_STORE_H diff --git a/Marlin/src/module/delta.cpp b/Marlin/src/module/delta.cpp index f0832d13a5..7d246aac40 100644 --- a/Marlin/src/module/delta.cpp +++ b/Marlin/src/module/delta.cpp @@ -73,7 +73,7 @@ void recalc_delta_settings() { delta_diagonal_rod_2_tower[B_AXIS] = sq(delta_diagonal_rod + drt[B_AXIS]); delta_diagonal_rod_2_tower[C_AXIS] = sq(delta_diagonal_rod + drt[C_AXIS]); update_software_endstops(Z_AXIS); - axis_homed = 0; + set_all_unhomed(); } /** diff --git a/Marlin/src/module/endstops.cpp b/Marlin/src/module/endstops.cpp index 38f0aae0bf..988bc21b17 100644 --- a/Marlin/src/module/endstops.cpp +++ b/Marlin/src/module/endstops.cpp @@ -36,9 +36,13 @@ #include HAL_PATH(../HAL, endstop_interrupts.h) #endif +#if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED) && ENABLED(SDSUPPORT) + #include "../module/printcounter.h" // for print_job_timer +#endif + Endstops endstops; -// public: +// private: bool Endstops::enabled, Endstops::enabled_globally; // Initialized by settings.load() volatile uint8_t Endstops::hit_state; @@ -255,36 +259,18 @@ void Endstops::poll() { void Endstops::enable_globally(const bool onoff) { enabled_globally = enabled = onoff; - - #if ENABLED(ENDSTOP_INTERRUPTS_FEATURE) - update(); - #endif + resync(); } // Enable / disable endstop checking void Endstops::enable(const bool onoff) { enabled = onoff; - - #if ENABLED(ENDSTOP_INTERRUPTS_FEATURE) - update(); - #endif + resync(); } // Disable / Enable endstops based on ENSTOPS_ONLY_FOR_HOMING and global enable void Endstops::not_homing() { enabled = enabled_globally; - - #if ENABLED(ENDSTOP_INTERRUPTS_FEATURE) - // Still 'enabled'? Then endstops are always on and kept in sync. - // Otherwise reset 'live's variables to let axes move in both directions. - if (!enabled) { - #if ENDSTOP_NOISE_THRESHOLD - endstop_poll_count = 0; // Stop filtering (MUST be done first to prevent race condition) - validated_live_state = 0; - #endif - live_state = 0; - } - #endif } #if ENABLED(VALIDATE_HOMING_ENDSTOPS) @@ -299,13 +285,24 @@ void Endstops::not_homing() { #if HAS_BED_PROBE void Endstops::enable_z_probe(const bool onoff) { z_probe_enabled = onoff; - - #if ENABLED(ENDSTOP_INTERRUPTS_FEATURE) - update(); - #endif + resync(); } #endif +// Get the stable endstop states when enabled +void Endstops::resync() { + if (!abort_enabled()) return; // If endstops/probes are disabled the loop below can hang + + #if ENABLED(ENDSTOP_INTERRUPTS_FEATURE) + update(); + #else + safe_delay(2); // Wait for Temperature ISR to run at least once (runs at 1KHz) + #endif + #if ENDSTOP_NOISE_THRESHOLD + while (endstop_poll_count) safe_delay(1); + #endif +} + #if ENABLED(PINS_DEBUGGING) void Endstops::run_monitor() { if (!monitor_flag) return; @@ -351,22 +348,22 @@ void Endstops::event_handler() { SERIAL_EOL(); #if ENABLED(ULTRA_LCD) - lcd_status_printf_P(0, PSTR(MSG_LCD_ENDSTOPS " %c %c %c %c"), chrX, chrY, chrZ, chrP); + ui.status_printf_P(0, PSTR(MSG_LCD_ENDSTOPS " %c %c %c %c"), chrX, chrY, chrZ, chrP); #endif #if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED) && ENABLED(SDSUPPORT) if (planner.abort_on_endstop_hit) { - card.sdprinting = false; - card.closefile(); + card.stopSDPrint(); quickstop_stepper(); - thermalManager.disable_all_heaters(); // switch off all heaters. + thermalManager.disable_all_heaters(); + print_job_timer.stop(); } #endif } prev_hit_state = hit_state; -} // Endstops::report_state +} -static void print_es_state(const bool is_hit, const char * const label=NULL) { +static void print_es_state(const bool is_hit, PGM_P const label=NULL) { if (label) serialprintPGM(label); SERIAL_PROTOCOLPGM(": "); serialprintPGM(is_hit ? PSTR(MSG_ENDSTOP_HIT) : PSTR(MSG_ENDSTOP_OPEN)); diff --git a/Marlin/src/module/endstops.h b/Marlin/src/module/endstops.h index f4c9181e93..7892ea81da 100644 --- a/Marlin/src/module/endstops.h +++ b/Marlin/src/module/endstops.h @@ -19,14 +19,12 @@ * along with this program. If not, see . * */ +#pragma once /** * endstops.h - manages endstops */ -#ifndef __ENDSTOPS_H__ -#define __ENDSTOPS_H__ - #include "../inc/MarlinConfig.h" #include @@ -164,6 +162,8 @@ class Endstops { static void enable_z_probe(const bool onoff=true); #endif + static void resync(); + // Debugging of endstops #if ENABLED(PINS_DEBUGGING) static bool monitor_flag; @@ -173,5 +173,3 @@ class Endstops { }; extern Endstops endstops; - -#endif // __ENDSTOPS_H__ diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index a08482166a..ec888f12b5 100644 --- a/Marlin/src/module/motion.cpp +++ b/Marlin/src/module/motion.cpp @@ -68,6 +68,17 @@ XYZ_CONSTS(float, max_length, MAX_LENGTH); XYZ_CONSTS(float, home_bump_mm, HOME_BUMP_MM); XYZ_CONSTS(signed char, home_dir, HOME_DIR); +/** + * axis_homed + * Flags that each linear axis was homed. + * XYZ on cartesian, ABC on delta, ABZ on SCARA. + * + * axis_known_position + * Flags that the position is known in each linear axis. Set when homed. + * Cleared whenever a stepper powers off, potentially losing its position. + */ +uint8_t axis_homed, axis_known_position; // = 0 + // Relative Mode. Enable with G91, disable with G90. bool relative_mode; // = false; @@ -118,29 +129,30 @@ const float homing_feedrate_mm_s[4] PROGMEM = { // Cartesian conversion result goes here: float cartes[XYZ]; -// Until kinematics.cpp is created, create this here #if IS_KINEMATIC float delta[ABC]; #endif +#if HAS_SCARA_OFFSET + float scara_home_offset[ABC]; +#endif + /** * The workspace can be offset by some commands, or * these offsets may be omitted to save on computation. */ -#if HAS_WORKSPACE_OFFSET - #if HAS_POSITION_SHIFT - // The distance that XYZ has been offset by G92. Reset by G28. - float position_shift[XYZ] = { 0 }; - #endif - #if HAS_HOME_OFFSET - // This offset is added to the configured home position. - // Set by M206, M428, or menu item. Saved to EEPROM. - float home_offset[XYZ] = { 0 }; - #endif - #if HAS_HOME_OFFSET && HAS_POSITION_SHIFT - // The above two are combined to save on computes - float workspace_offset[XYZ] = { 0 }; - #endif +#if HAS_POSITION_SHIFT + // The distance that XYZ has been offset by G92. Reset by G28. + float position_shift[XYZ] = { 0 }; +#endif +#if HAS_HOME_OFFSET + // This offset is added to the configured home position. + // Set by M206, M428, or menu item. Saved to EEPROM. + float home_offset[XYZ] = { 0 }; +#endif +#if HAS_HOME_OFFSET && HAS_POSITION_SHIFT + // The above two are combined to save on computes + float workspace_offset[XYZ] = { 0 }; #endif #if OLDSCHOOL_ABL @@ -287,7 +299,6 @@ void buffer_line_to_destination(const float fr_mm_s) { /** * Plan a move to (X, Y, Z) and set the current_position - * The final current_position may not be the one that was requested */ void do_blocking_move_to(const float rx, const float ry, const float rz, const float &fr_mm_s/*=0.0*/) { const float old_feedrate_mm_s = feedrate_mm_s; @@ -421,8 +432,6 @@ void do_blocking_move_to_xy(const float &rx, const float &ry, const float &fr_mm // // - Save current feedrates // - Reset the rate multiplier -// - Reset the command timeout -// - Enable the endstops (for endstop moves) // void bracket_probe_move(const bool before) { static float saved_feedrate_mm_s; @@ -444,15 +453,14 @@ void bracket_probe_move(const bool before) { void setup_for_endstop_or_probe_move() { bracket_probe_move(true); } void clean_up_after_endstop_or_probe_move() { bracket_probe_move(false); } -// Software Endstops are based on the configured limits. -float soft_endstop_min[XYZ] = { X_MIN_BED, Y_MIN_BED, Z_MIN_POS }, - soft_endstop_max[XYZ] = { X_MAX_BED, Y_MAX_BED, Z_MAX_POS }; - #if HAS_SOFTWARE_ENDSTOPS - // Software Endstops are based on the configured limits. bool soft_endstops_enabled = true; + // Software Endstops are based on the configured limits. + float soft_endstop_min[XYZ] = { X_MIN_BED, Y_MIN_BED, Z_MIN_POS }, + soft_endstop_max[XYZ] = { X_MAX_BED, Y_MAX_BED, Z_MAX_POS }; + #if IS_KINEMATIC float soft_endstop_radius, soft_endstop_radius_2; #endif @@ -494,6 +502,79 @@ float soft_endstop_min[XYZ] = { X_MIN_BED, Y_MIN_BED, Z_MIN_POS }, #endif } + /** + * Software endstops can be used to monitor the open end of + * an axis that has a hardware endstop on the other end. Or + * they can prevent axes from moving past endstops and grinding. + * + * To keep doing their job as the coordinate system changes, + * the software endstop positions must be refreshed to remain + * at the same positions relative to the machine. + */ + void update_software_endstops(const AxisEnum axis) { + + #if ENABLED(DUAL_X_CARRIAGE) + + if (axis == X_AXIS) { + + // In Dual X mode hotend_offset[X] is T1's home position + const float dual_max_x = MAX(hotend_offset[X_AXIS][1], X2_MAX_POS); + + if (active_extruder != 0) { + // T1 can move from X2_MIN_POS to X2_MAX_POS or X2 home position (whichever is larger) + soft_endstop_min[X_AXIS] = X2_MIN_POS; + soft_endstop_max[X_AXIS] = dual_max_x; + } + else if (dxc_is_duplicating()) { + // In Duplication Mode, T0 can move as far left as X1_MIN_POS + // but not so far to the right that T1 would move past the end + soft_endstop_min[X_AXIS] = X1_MIN_POS; + soft_endstop_max[X_AXIS] = MIN(X1_MAX_POS, dual_max_x - duplicate_extruder_x_offset); + } + else { + // In other modes, T0 can move from X1_MIN_POS to X1_MAX_POS + soft_endstop_min[X_AXIS] = X1_MIN_POS; + soft_endstop_max[X_AXIS] = X1_MAX_POS; + } + } + + #elif ENABLED(DELTA) + + soft_endstop_min[axis] = base_min_pos(axis); + soft_endstop_max[axis] = (axis == Z_AXIS ? delta_height + #if HAS_BED_PROBE + - zprobe_zoffset + Z_PROBE_OFFSET_FROM_EXTRUDER + #endif + : base_max_pos(axis)); + + switch (axis) { + case X_AXIS: + case Y_AXIS: + // Get a minimum radius for clamping + soft_endstop_radius = MIN(ABS(MAX(soft_endstop_min[X_AXIS], soft_endstop_min[Y_AXIS])), soft_endstop_max[X_AXIS], soft_endstop_max[Y_AXIS]); + soft_endstop_radius_2 = sq(soft_endstop_radius); + break; + case Z_AXIS: + delta_clip_start_height = soft_endstop_max[axis] - delta_safe_distance_from_top(); + default: break; + } + + #else + + soft_endstop_min[axis] = base_min_pos(axis); + soft_endstop_max[axis] = base_max_pos(axis); + + #endif + + #if ENABLED(DEBUG_LEVELING_FEATURE) + if (DEBUGGING(LEVELING)) { + SERIAL_ECHOPAIR("For ", axis_codes[axis]); + SERIAL_ECHOPAIR(" axis:\n soft_endstop_min = ", soft_endstop_min[axis]); + SERIAL_ECHOLNPAIR("\n soft_endstop_max = ", soft_endstop_max[axis]); + } + #endif + } + #endif #if !UBL_SEGMENTED @@ -818,9 +899,9 @@ float soft_endstop_min[XYZ] = { X_MIN_BED, Y_MIN_BED, Z_MIN_POS }, #define RAISED_Y raised_parked_position[Y_AXIS] #define RAISED_Z raised_parked_position[Z_AXIS] - if ( planner.buffer_line(RAISED_X, RAISED_Y, RAISED_Z, CUR_E, planner.max_feedrate_mm_s[Z_AXIS], active_extruder)) + if ( planner.buffer_line(RAISED_X, RAISED_Y, RAISED_Z, CUR_E, planner.settings.max_feedrate_mm_s[Z_AXIS], active_extruder)) if (planner.buffer_line( CUR_X, CUR_Y, RAISED_Z, CUR_E, PLANNER_XY_FEEDRATE(), active_extruder)) - planner.buffer_line( CUR_X, CUR_Y, CUR_Z, CUR_E, planner.max_feedrate_mm_s[Z_AXIS], active_extruder); + planner.buffer_line( CUR_X, CUR_Y, CUR_Z, CUR_E, planner.settings.max_feedrate_mm_s[Z_AXIS], active_extruder); delayed_move_time = 0; active_extruder_parked = false; #if ENABLED(DEBUG_LEVELING_FEATURE) @@ -842,7 +923,7 @@ float soft_endstop_min[XYZ] = { X_MIN_BED, Y_MIN_BED, Z_MIN_POS }, if (!planner.buffer_line( dual_x_carriage_mode == DXC_DUPLICATION_MODE ? duplicate_extruder_x_offset + current_position[X_AXIS] : inactive_extruder_x_pos, current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], - planner.max_feedrate_mm_s[X_AXIS], 1 + planner.settings.max_feedrate_mm_s[X_AXIS], 1 ) ) break; planner.synchronize(); @@ -945,7 +1026,7 @@ void prepare_move_to_destination() { SERIAL_ECHOLNPGM(" " MSG_FIRST); #if ENABLED(ULTRA_LCD) - lcd_status_printf_P(0, PSTR(MSG_HOME " %s%s%s " MSG_FIRST), xx ? MSG_X : "", yy ? MSG_Y : "", zz ? MSG_Z : ""); + ui.status_printf_P(0, PSTR(MSG_HOME " %s%s%s " MSG_FIRST), xx ? MSG_X : "", yy ? MSG_Y : "", zz ? MSG_Z : ""); #endif return true; } @@ -981,31 +1062,31 @@ inline float get_homing_bump_feedrate(const AxisEnum axis) { default: break; #if X_SENSORLESS case X_AXIS: - tmc_sensorless_homing(stepperX, enable); + tmc_stallguard(stepperX, enable); #if CORE_IS_XY && Y_SENSORLESS - tmc_sensorless_homing(stepperY, enable); + tmc_stallguard(stepperY, enable); #elif CORE_IS_XZ && Z_SENSORLESS - tmc_sensorless_homing(stepperZ, enable); + tmc_stallguard(stepperZ, enable); #endif break; #endif #if Y_SENSORLESS case Y_AXIS: - tmc_sensorless_homing(stepperY, enable); + tmc_stallguard(stepperY, enable); #if CORE_IS_XY && X_SENSORLESS - tmc_sensorless_homing(stepperX, enable); + tmc_stallguard(stepperX, enable); #elif CORE_IS_YZ && Z_SENSORLESS - tmc_sensorless_homing(stepperZ, enable); + tmc_stallguard(stepperZ, enable); #endif break; #endif #if Z_SENSORLESS case Z_AXIS: - tmc_sensorless_homing(stepperZ, enable); + tmc_stallguard(stepperZ, enable); #if CORE_IS_XZ && X_SENSORLESS - tmc_sensorless_homing(stepperX, enable); + tmc_stallguard(stepperX, enable); #elif CORE_IS_YZ && Y_SENSORLESS - tmc_sensorless_homing(stepperY, enable); + tmc_stallguard(stepperY, enable); #endif break; #endif @@ -1040,7 +1121,7 @@ void do_homing_move(const AxisEnum axis, const float distance, const float fr_mm serialprintPGM(msg_wait_for_bed_heating); LCD_MESSAGEPGM(MSG_BED_HEATING); while (thermalManager.isHeatingBed()) safe_delay(200); - lcd_reset_status(); + ui.reset_status(); } #endif @@ -1146,7 +1227,7 @@ void set_axis_is_at_home(const AxisEnum axis) { #if HAS_POSITION_SHIFT position_shift[axis] = 0; - update_software_endstops(axis); + update_workspace_offset(axis); #endif #if ENABLED(DUAL_X_CARRIAGE) @@ -1159,7 +1240,11 @@ void set_axis_is_at_home(const AxisEnum axis) { #if ENABLED(MORGAN_SCARA) scara_set_axis_is_at_home(axis); #elif ENABLED(DELTA) - current_position[axis] = (axis == Z_AXIS ? delta_height : base_home_pos(axis)); + current_position[axis] = (axis == Z_AXIS ? delta_height + #if HAS_BED_PROBE + - zprobe_zoffset + Z_PROBE_OFFSET_FROM_EXTRUDER + #endif + : base_home_pos(axis)); #else current_position[axis] = base_home_pos(axis); #endif @@ -1206,6 +1291,34 @@ void set_axis_is_at_home(const AxisEnum axis) { #endif } +/** + * Set an axis' to be unhomed. + */ +void set_axis_is_not_at_home(const AxisEnum axis) { + #if ENABLED(DEBUG_LEVELING_FEATURE) + if (DEBUGGING(LEVELING)) { + SERIAL_ECHOPAIR(">>> set_axis_is_not_at_home(", axis_codes[axis]); + SERIAL_CHAR(')'); + SERIAL_EOL(); + } + #endif + + CBI(axis_known_position, axis); + CBI(axis_homed, axis); + + #if ENABLED(DEBUG_LEVELING_FEATURE) + if (DEBUGGING(LEVELING)) { + SERIAL_ECHOPAIR("<<< set_axis_is_not_at_home(", axis_codes[axis]); + SERIAL_CHAR(')'); + SERIAL_EOL(); + } + #endif + + #if ENABLED(I2C_POSITION_ENCODERS) + I2CPEM.unhomed(axis); + #endif +} + /** * Home an individual "raw axis" to its endstop. * This applies to XYZ on Cartesian and Core robots, and @@ -1257,17 +1370,7 @@ void homeaxis(const AxisEnum axis) { #if ENABLED(Y_DUAL_ENDSTOPS) case Y_AXIS: #endif - #if ENABLED(Z_DUAL_ENDSTOPS) - case Z_AXIS: - #endif - stepper.set_separate_multi_axis(true); - default: break; - } - #endif - - #if ENABLED(Z_TRIPLE_ENDSTOPS) - switch (axis) { - #if ENABLED(Z_TRIPLE_ENDSTOPS) + #if Z_MULTI_ENDSTOPS case Z_AXIS: #endif stepper.set_separate_multi_axis(true); @@ -1419,6 +1522,20 @@ void homeaxis(const AxisEnum axis) { } #endif + // Reset flags for X, Y, Z motor locking + switch (axis) { + #if ENABLED(X_DUAL_ENDSTOPS) + case X_AXIS: + #endif + #if ENABLED(Y_DUAL_ENDSTOPS) + case Y_AXIS: + #endif + #if Z_MULTI_ENDSTOPS + case Z_AXIS: + #endif + stepper.set_separate_multi_axis(false); + default: break; + } #endif #if IS_SCARA @@ -1474,85 +1591,18 @@ void homeaxis(const AxisEnum axis) { #endif } // homeaxis() -#if HAS_WORKSPACE_OFFSET || ENABLED(DUAL_X_CARRIAGE) || ENABLED(DELTA) - - /** - * Software endstops can be used to monitor the open end of - * an axis that has a hardware endstop on the other end. Or - * they can prevent axes from moving past endstops and grinding. - * - * To keep doing their job as the coordinate system changes, - * the software endstop positions must be refreshed to remain - * at the same positions relative to the machine. - */ - void update_software_endstops(const AxisEnum axis) { - #if HAS_HOME_OFFSET && HAS_POSITION_SHIFT - workspace_offset[axis] = home_offset[axis] + position_shift[axis]; - #endif - - #if ENABLED(DUAL_X_CARRIAGE) - if (axis == X_AXIS) { - - // In Dual X mode hotend_offset[X] is T1's home position - const float dual_max_x = MAX(hotend_offset[X_AXIS][1], X2_MAX_POS); - - if (active_extruder != 0) { - // T1 can move from X2_MIN_POS to X2_MAX_POS or X2 home position (whichever is larger) - soft_endstop_min[X_AXIS] = X2_MIN_POS; - soft_endstop_max[X_AXIS] = dual_max_x; - } - else if (dxc_is_duplicating()) { - // In Duplication Mode, T0 can move as far left as X1_MIN_POS - // but not so far to the right that T1 would move past the end - soft_endstop_min[X_AXIS] = X1_MIN_POS; - soft_endstop_max[X_AXIS] = MIN(X1_MAX_POS, dual_max_x - duplicate_extruder_x_offset); - } - else { - // In other modes, T0 can move from X1_MIN_POS to X1_MAX_POS - soft_endstop_min[X_AXIS] = X1_MIN_POS; - soft_endstop_max[X_AXIS] = X1_MAX_POS; - } - } - #elif ENABLED(DELTA) - soft_endstop_min[axis] = base_min_pos(axis); - soft_endstop_max[axis] = (axis == Z_AXIS ? delta_height : base_max_pos(axis)); - #else - soft_endstop_min[axis] = base_min_pos(axis); - soft_endstop_max[axis] = base_max_pos(axis); - #endif - +#if HAS_WORKSPACE_OFFSET + void update_workspace_offset(const AxisEnum axis) { + workspace_offset[axis] = home_offset[axis] + position_shift[axis]; #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) { SERIAL_ECHOPAIR("For ", axis_codes[axis]); - #if HAS_HOME_OFFSET - SERIAL_ECHOPAIR(" axis:\n home_offset = ", home_offset[axis]); - #endif - #if HAS_POSITION_SHIFT - SERIAL_ECHOPAIR("\n position_shift = ", position_shift[axis]); - #endif - SERIAL_ECHOPAIR("\n soft_endstop_min = ", soft_endstop_min[axis]); - SERIAL_ECHOLNPAIR("\n soft_endstop_max = ", soft_endstop_max[axis]); - } - #endif - - #if ENABLED(DELTA) - switch (axis) { - #if HAS_SOFTWARE_ENDSTOPS - case X_AXIS: - case Y_AXIS: - // Get a minimum radius for clamping - soft_endstop_radius = MIN3(ABS(MAX(soft_endstop_min[X_AXIS], soft_endstop_min[Y_AXIS])), soft_endstop_max[X_AXIS], soft_endstop_max[Y_AXIS]); - soft_endstop_radius_2 = sq(soft_endstop_radius); - break; - #endif - case Z_AXIS: - delta_clip_start_height = soft_endstop_max[axis] - delta_safe_distance_from_top(); - default: break; + SERIAL_ECHOPAIR(" axis:\n home_offset = ", home_offset[axis]); + SERIAL_ECHOLNPAIR("\n position_shift = ", position_shift[axis]); } #endif } - -#endif // HAS_WORKSPACE_OFFSET || DUAL_X_CARRIAGE || DELTA +#endif #if HAS_M206_COMMAND /** @@ -1561,6 +1611,6 @@ void homeaxis(const AxisEnum axis) { */ void set_home_offset(const AxisEnum axis, const float v) { home_offset[axis] = v; - update_software_endstops(axis); + update_workspace_offset(axis); } #endif // HAS_M206_COMMAND diff --git a/Marlin/src/module/motion.h b/Marlin/src/module/motion.h index 1b4f727c8e..702df69aec 100644 --- a/Marlin/src/module/motion.h +++ b/Marlin/src/module/motion.h @@ -26,9 +26,7 @@ * High-level motion commands to feed the planner * Some of these methods may migrate to the planner class. */ - -#ifndef MOTION_H -#define MOTION_H +#pragma once #include "../inc/MarlinConfig.h" @@ -36,6 +34,14 @@ #include "../module/scara.h" #endif +// Axis homed and known-position states +extern uint8_t axis_homed, axis_known_position; +constexpr uint8_t xyz_bits = _BV(X_AXIS) | _BV(Y_AXIS) | _BV(Z_AXIS); +FORCE_INLINE bool all_axes_homed() { return (axis_homed & xyz_bits) == xyz_bits; } +FORCE_INLINE bool all_axes_known() { return (axis_known_position & xyz_bits) == xyz_bits; } +FORCE_INLINE void set_all_unhomed() { axis_homed = 0; } +FORCE_INLINE void set_all_unknown() { axis_known_position = 0; } + // Error margin to work around float imprecision constexpr float slop = 0.0001; @@ -87,10 +93,8 @@ extern int16_t feedrate_percentage; extern float hotend_offset[XYZ][HOTENDS]; #endif -extern float soft_endstop_min[XYZ], soft_endstop_max[XYZ]; - -FORCE_INLINE float pgm_read_any(const float *p) { return pgm_read_float_near(p); } -FORCE_INLINE signed char pgm_read_any(const signed char *p) { return pgm_read_byte_near(p); } +FORCE_INLINE float pgm_read_any(const float *p) { return pgm_read_float(p); } +FORCE_INLINE signed char pgm_read_any(const signed char *p) { return pgm_read_byte(p); } #define XYZ_DEFS(type, array, CONFIG) \ extern const type array##_P[XYZ]; \ @@ -104,12 +108,23 @@ XYZ_DEFS(float, max_length, MAX_LENGTH); XYZ_DEFS(float, home_bump_mm, HOME_BUMP_MM); XYZ_DEFS(signed char, home_dir, HOME_DIR); +#if HAS_WORKSPACE_OFFSET + void update_workspace_offset(const AxisEnum axis); +#else + #define update_workspace_offset(x) NOOP +#endif + #if HAS_SOFTWARE_ENDSTOPS extern bool soft_endstops_enabled; + extern float soft_endstop_min[XYZ], soft_endstop_max[XYZ]; void clamp_to_software_endstops(float target[XYZ]); + void update_software_endstops(const AxisEnum axis); #else - #define soft_endstops_enabled false + constexpr bool soft_endstops_enabled = false; + constexpr float soft_endstop_min[XYZ] = { X_MIN_BED, Y_MIN_BED, Z_MIN_POS }, + soft_endstop_max[XYZ] = { X_MAX_BED, Y_MAX_BED, Z_MAX_POS }; #define clamp_to_software_endstops(x) NOOP + #define update_software_endstops(x) NOOP #endif void report_current_position(); @@ -155,6 +170,14 @@ void do_blocking_move_to_x(const float &rx, const float &fr_mm_s=0); void do_blocking_move_to_z(const float &rz, const float &fr_mm_s=0); void do_blocking_move_to_xy(const float &rx, const float &ry, const float &fr_mm_s=0); +FORCE_INLINE void do_blocking_move_to(const float (&raw)[XYZ], const float &fr_mm_s) { + do_blocking_move_to(raw[X_AXIS], raw[Y_AXIS], raw[Z_AXIS], fr_mm_s); +} + +FORCE_INLINE void do_blocking_move_to(const float (&raw)[XYZE], const float &fr_mm_s) { + do_blocking_move_to(raw[X_AXIS], raw[Y_AXIS], raw[Z_AXIS], fr_mm_s); +} + void setup_for_endstop_or_probe_move(); void clean_up_after_endstop_or_probe_move(); @@ -189,20 +212,18 @@ void clean_up_after_endstop_or_probe_move(); void set_axis_is_at_home(const AxisEnum axis); +void set_axis_is_not_at_home(const AxisEnum axis); + void homeaxis(const AxisEnum axis); #if ENABLED(SENSORLESS_HOMING) void sensorless_homing_per_axis(const AxisEnum axis, const bool enable=true); #endif -// -// Macros -// - /** * Workspace offsets */ -#if HAS_WORKSPACE_OFFSET +#if HAS_HOME_OFFSET || HAS_POSITION_SHIFT #if HAS_HOME_OFFSET extern float home_offset[XYZ]; #endif @@ -214,7 +235,7 @@ void homeaxis(const AxisEnum axis); #define WORKSPACE_OFFSET(AXIS) workspace_offset[AXIS] #elif HAS_HOME_OFFSET #define WORKSPACE_OFFSET(AXIS) home_offset[AXIS] - #elif HAS_POSITION_SHIFT + #else #define WORKSPACE_OFFSET(AXIS) position_shift[AXIS] #endif #define NATIVE_TO_LOGICAL(POS, AXIS) ((POS) + WORKSPACE_OFFSET(AXIS)) @@ -240,6 +261,10 @@ void homeaxis(const AxisEnum axis); extern const float L1, L2; #endif + #if HAS_SCARA_OFFSET + extern float scara_home_offset[ABC]; // A and B angular offsets, Z mm offset + #endif + // Return true if the given point is within the printable area inline bool position_is_reachable(const float &rx, const float &ry, const float inset=0) { #if ENABLED(DELTA) @@ -342,12 +367,6 @@ void homeaxis(const AxisEnum axis); #endif -#if HAS_WORKSPACE_OFFSET || ENABLED(DUAL_X_CARRIAGE) || ENABLED(DELTA) - void update_software_endstops(const AxisEnum axis); -#endif - #if HAS_M206_COMMAND void set_home_offset(const AxisEnum axis, const float v); #endif - -#endif // MOTION_H diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index 26a386a5f9..c185678ad0 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -111,18 +111,11 @@ volatile uint8_t Planner::block_buffer_head, // Index of the next block to be uint16_t Planner::cleaning_buffer_counter; // A counter to disable queuing of blocks uint8_t Planner::delay_before_delivering; // This counter delays delivery of blocks when queue becomes empty to allow the opportunity of merging blocks -uint32_t Planner::max_acceleration_mm_per_s2[XYZE_N], // (mm/s^2) M201 XYZE - Planner::max_acceleration_steps_per_s2[XYZE_N], // (steps/s^2) Derived from mm_per_s2 - Planner::min_segment_time_us; // (µs) M205 B +planner_settings_t Planner::settings; // Initialized by settings.load() -float Planner::max_feedrate_mm_s[XYZE_N], // (mm/s) M203 XYZE - Max speeds - Planner::axis_steps_per_mm[XYZE_N], // (steps) M92 XYZE - Steps per millimeter - Planner::steps_to_mm[XYZE_N], // (mm) Millimeters per step - Planner::min_feedrate_mm_s, // (mm/s) M205 S - Minimum linear feedrate - Planner::acceleration, // (mm/s^2) M204 S - Normal acceleration. DEFAULT ACCELERATION for all printing moves. - Planner::retract_acceleration, // (mm/s^2) M204 R - Retract acceleration. Filament pull-back and push-forward while standing still in the other axes - Planner::travel_acceleration, // (mm/s^2) M204 T - Travel acceleration. DEFAULT ACCELERATION for all NON printing moves. - Planner::min_travel_feedrate_mm_s; // (mm/s) M205 T - Minimum travel feedrate +uint32_t Planner::max_acceleration_steps_per_s2[XYZE_N]; // (steps/s^2) Derived from mm_per_s2 + +float Planner::steps_to_mm[XYZE_N]; // (mm) Millimeters per step #if ENABLED(JUNCTION_DEVIATION) float Planner::junction_deviation_mm; // (mm) M205 J @@ -148,9 +141,6 @@ float Planner::max_feedrate_mm_s[XYZE_N], // (mm/s) M203 XYZE - Max speeds #if ENABLED(DISTINCT_E_FACTORS) uint8_t Planner::last_extruder = 0; // Respond to extruder change - #define _EINDEX (E_AXIS + active_extruder) -#else - #define _EINDEX E_AXIS #endif int16_t Planner::flow_percentage[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(100); // Extrusion factor for each extruder @@ -177,18 +167,7 @@ float Planner::e_factor[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(1.0f); // The flow perc constexpr bool Planner::leveling_active; #endif -#if ENABLED(SKEW_CORRECTION) - #if ENABLED(SKEW_CORRECTION_GCODE) - float Planner::xy_skew_factor; - #else - constexpr float Planner::xy_skew_factor; - #endif - #if ENABLED(SKEW_CORRECTION_FOR_Z) && ENABLED(SKEW_CORRECTION_GCODE) - float Planner::xz_skew_factor, Planner::yz_skew_factor; - #else - constexpr float Planner::xz_skew_factor, Planner::yz_skew_factor; - #endif -#endif +skew_factor_t Planner::skew_factor; // Initialized by settings.load() #if ENABLED(AUTOTEMP) float Planner::autotemp_max = 250, @@ -376,11 +355,11 @@ void Planner::init() { // For small divisors, it is best to directly retrieve the results if (d <= 110) return pgm_read_dword(&small_inv_tab[d]); - register uint8_t r8 = d & 0xFF, - r9 = (d >> 8) & 0xFF, - r10 = (d >> 16) & 0xFF, - r2,r3,r4,r5,r6,r7,r11,r12,r13,r14,r15,r16,r17,r18; - register const uint8_t* ptab = inv_tab; + uint8_t r8 = d & 0xFF, + r9 = (d >> 8) & 0xFF, + r10 = (d >> 16) & 0xFF, + r2,r3,r4,r5,r6,r7,r11,r12,r13,r14,r15,r16,r17,r18; + const uint8_t* ptab = inv_tab; __asm__ __volatile__( // %8:%7:%6 = interval @@ -1094,7 +1073,7 @@ void Planner::recalculate_trapezoids() { calculate_trapezoid_for_block(current, current_entry_speed * nomr, next_entry_speed * nomr); #if ENABLED(LIN_ADVANCE) if (current->use_advance_lead) { - const float comp = current->e_D_ratio * extruder_advance_K[active_extruder] * axis_steps_per_mm[E_AXIS]; + const float comp = current->e_D_ratio * extruder_advance_K[active_extruder] * settings.axis_steps_per_mm[E_AXIS]; current->max_adv_steps = current_nominal_speed * comp; current->final_adv_steps = next_entry_speed * comp; } @@ -1133,7 +1112,7 @@ void Planner::recalculate_trapezoids() { calculate_trapezoid_for_block(next, next_entry_speed * nomr, float(MINIMUM_PLANNER_SPEED) * nomr); #if ENABLED(LIN_ADVANCE) if (next->use_advance_lead) { - const float comp = next->e_D_ratio * extruder_advance_K[active_extruder] * axis_steps_per_mm[E_AXIS]; + const float comp = next->e_D_ratio * extruder_advance_K[active_extruder] * settings.axis_steps_per_mm[E_AXIS]; next->max_adv_steps = next_nominal_speed * comp; next->final_adv_steps = (MINIMUM_PLANNER_SPEED) * comp; } @@ -1187,8 +1166,8 @@ void Planner::recalculate() { * Maintain fans, paste extruder pressure, */ void Planner::check_axes_activity() { - unsigned char axis_active[NUM_AXIS] = { 0 }, - tail_fan_speed[FAN_COUNT]; + uint8_t axis_active[NUM_AXIS] = { 0 }, + tail_fan_speed[FAN_COUNT]; #if ENABLED(BARICUDA) #if HAS_HEATER_1 @@ -1225,7 +1204,7 @@ void Planner::check_axes_activity() { } else { #if FAN_COUNT > 0 - for (uint8_t i = 0; i < FAN_COUNT; i++) tail_fan_speed[i] = fanSpeeds[i]; + for (uint8_t i = 0; i < FAN_COUNT; i++) tail_fan_speed[i] = fan_speed[i]; #endif #if ENABLED(BARICUDA) @@ -1687,7 +1666,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move, } #endif // PREVENT_COLD_EXTRUSION #if ENABLED(PREVENT_LENGTHY_EXTRUDE) - if (ABS(de * e_factor[extruder]) > (int32_t)axis_steps_per_mm[E_AXIS_N] * (EXTRUDE_MAXLENGTH)) { // It's not important to get max. extrusion length in a precision < 1mm, so save some cycles and cast to int + if (ABS(de * e_factor[extruder]) > (int32_t)settings.axis_steps_per_mm[E_AXIS_N(extruder)] * (EXTRUDE_MAXLENGTH)) { // It's not important to get max. extrusion length in a precision < 1mm, so save some cycles and cast to int position[E_AXIS] = target[E_AXIS]; // Behave as if the move really took place, but ignore E part #if HAS_POSITION_FLOAT position_float[E_AXIS] = target_float[E_AXIS]; @@ -1762,25 +1741,17 @@ bool Planner::_populate_block(block_t * const block, bool split_move, #endif block->steps[E_AXIS] = esteps; - block->step_event_count = MAX4(block->steps[A_AXIS], block->steps[B_AXIS], block->steps[C_AXIS], esteps); + block->step_event_count = MAX(block->steps[A_AXIS], block->steps[B_AXIS], block->steps[C_AXIS], esteps); // Bail if this is a zero-length block if (block->step_event_count < MIN_STEPS_PER_SEGMENT) return false; - // For a mixing extruder, get a magnified esteps for each #if ENABLED(MIXING_EXTRUDER) - for (uint8_t i = 0; i < MIXING_STEPPERS; i++) - block->mix_steps[i] = mixing_factor[i] * ( - #if ENABLED(LIN_ADVANCE) - esteps - #else - block->step_event_count - #endif - ); + MIXER_POPULATE_BLOCK(); #endif #if FAN_COUNT > 0 - for (uint8_t i = 0; i < FAN_COUNT; i++) block->fan_speed[i] = fanSpeeds[i]; + for (uint8_t i = 0; i < FAN_COUNT; i++) block->fan_speed[i] = fan_speed[i]; #endif #if ENABLED(BARICUDA) @@ -1789,7 +1760,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move, #endif #if EXTRUDERS > 1 - block->active_extruder = extruder; + block->extruder = extruder; #endif #if ENABLED(AUTO_POWER_CONTROL) @@ -1952,9 +1923,9 @@ bool Planner::_populate_block(block_t * const block, bool split_move, } if (esteps) - NOLESS(fr_mm_s, min_feedrate_mm_s); + NOLESS(fr_mm_s, settings.min_feedrate_mm_s); else - NOLESS(fr_mm_s, min_travel_feedrate_mm_s); + NOLESS(fr_mm_s, settings.min_travel_feedrate_mm_s); /** * This part of the code calculates the total length of the movement. @@ -1991,7 +1962,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move, delta_mm[B_AXIS] = db * steps_to_mm[B_AXIS]; delta_mm[C_AXIS] = dc * steps_to_mm[C_AXIS]; #endif - delta_mm[E_AXIS] = esteps_float * steps_to_mm[E_AXIS_N]; + delta_mm[E_AXIS] = esteps_float * steps_to_mm[E_AXIS_N(extruder)]; if (block->steps[A_AXIS] < MIN_STEPS_PER_SEGMENT && block->steps[B_AXIS] < MIN_STEPS_PER_SEGMENT && block->steps[C_AXIS] < MIN_STEPS_PER_SEGMENT) { block->millimeters = ABS(delta_mm[E_AXIS]); @@ -2029,9 +2000,9 @@ bool Planner::_populate_block(block_t * const block, bool split_move, #if ENABLED(SLOWDOWN) if (WITHIN(moves_queued, 2, (BLOCK_BUFFER_SIZE) / 2 - 1)) { - if (segment_time_us < min_segment_time_us) { + if (segment_time_us < settings.min_segment_time_us) { // buffer is draining, add extra time. The amount of time added increases if the buffer is still emptied more. - const uint32_t nst = segment_time_us + LROUND(2 * (min_segment_time_us - segment_time_us) / moves_queued); + const uint32_t nst = segment_time_us + LROUND(2 * (settings.min_segment_time_us - segment_time_us) / moves_queued); inverse_secs = 1000000.0f / nst; #if defined(XY_FREQUENCY_LIMIT) || ENABLED(ULTRA_LCD) segment_time_us = nst; @@ -2090,11 +2061,22 @@ bool Planner::_populate_block(block_t * const block, bool split_move, // Calculate and limit speed in mm/sec for each axis float current_speed[NUM_AXIS], speed_factor = 1.0f; // factor <1 decreases speed LOOP_XYZE(i) { - const float cs = ABS((current_speed[i] = delta_mm[i] * inverse_secs)); + #if ENABLED(MIXING_EXTRUDER) && ENABLED(RETRACT_SYNC_MIXING) + // In worst case, only one extruder running, no change is needed. + // In best case, all extruders run the same amount, we can divide by MIXING_STEPPERS + float delta_mm_i = 0; + if (i == E_AXIS && mixer.get_current_v_tool() == MIXER_AUTORETRACT_TOOL) + delta_mm_i = delta_mm[i] / MIXING_STEPPERS; + else + delta_mm_i = delta_mm[i]; + #else + const float delta_mm_i = delta_mm[i]; + #endif + const float cs = ABS(current_speed[i] = delta_mm_i * inverse_secs); #if ENABLED(DISTINCT_E_FACTORS) if (i == E_AXIS) i += extruder; #endif - if (cs > max_feedrate_mm_s[i]) NOMORE(speed_factor, max_feedrate_mm_s[i] / cs); + if (cs > settings.max_feedrate_mm_s[i]) NOMORE(speed_factor, settings.max_feedrate_mm_s[i] / cs); } // Max segment time in µs. @@ -2126,8 +2108,8 @@ bool Planner::_populate_block(block_t * const block, bool split_move, } ys0 = axis_segment_time_us[Y_AXIS][0] = ys0 + segment_time_us; - const uint32_t max_x_segment_time = MAX3(xs0, xs1, xs2), - max_y_segment_time = MAX3(ys0, ys1, ys2), + const uint32_t max_x_segment_time = MAX(xs0, xs1, xs2), + max_y_segment_time = MAX(ys0, ys1, ys2), min_xy_segment_time = MIN(max_x_segment_time, max_y_segment_time); if (min_xy_segment_time < MAX_FREQ_TIME_US) { const float low_sf = speed_factor * min_xy_segment_time / (MAX_FREQ_TIME_US); @@ -2147,7 +2129,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move, uint32_t accel; if (!block->steps[A_AXIS] && !block->steps[B_AXIS] && !block->steps[C_AXIS]) { // convert to: acceleration steps/sec^2 - accel = CEIL(retract_acceleration * steps_per_mm); + accel = CEIL(settings.retract_acceleration * steps_per_mm); #if ENABLED(LIN_ADVANCE) block->use_advance_lead = false; #endif @@ -2168,7 +2150,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move, }while(0) // Start with print or travel acceleration - accel = CEIL((esteps ? acceleration : travel_acceleration) * steps_per_mm); + accel = CEIL((esteps ? settings.acceleration : settings.travel_acceleration) * steps_per_mm); #if ENABLED(LIN_ADVANCE) @@ -2248,7 +2230,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move, #endif #if ENABLED(LIN_ADVANCE) if (block->use_advance_lead) { - block->advance_speed = (STEPPER_TIMER_RATE) / (extruder_advance_K[active_extruder] * block->e_D_ratio * block->acceleration * axis_steps_per_mm[E_AXIS_N]); + block->advance_speed = (STEPPER_TIMER_RATE) / (extruder_advance_K[active_extruder] * block->e_D_ratio * block->acceleration * settings.axis_steps_per_mm[E_AXIS_N(extruder)]); #if ENABLED(LA_DEBUG) if (extruder_advance_K[active_extruder] * block->e_D_ratio * block->acceleration * 2 < SQRT(block->nominal_speed_sqr) * block->e_D_ratio) SERIAL_ECHOLNPGM("More than 2 steps per eISR loop executed."); @@ -2360,7 +2342,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move, } // Get the lowest speed - vmax_junction_sqr = MIN3(vmax_junction_sqr, block->nominal_speed_sqr, previous_nominal_speed_sqr); + vmax_junction_sqr = MIN(vmax_junction_sqr, block->nominal_speed_sqr, previous_nominal_speed_sqr); } else // Init entry speed to zero. Assume it starts from rest. Planner will correct this later. vmax_junction_sqr = 0; @@ -2560,8 +2542,8 @@ bool Planner::buffer_segment(const float &a, const float &b, const float &c, con // When changing extruders recalculate steps corresponding to the E position #if ENABLED(DISTINCT_E_FACTORS) - if (last_extruder != extruder && axis_steps_per_mm[E_AXIS_N] != axis_steps_per_mm[E_AXIS + last_extruder]) { - position[E_AXIS] = LROUND(position[E_AXIS] * axis_steps_per_mm[E_AXIS_N] * steps_to_mm[E_AXIS + last_extruder]); + if (last_extruder != extruder && settings.axis_steps_per_mm[E_AXIS_N(extruder)] != settings.axis_steps_per_mm[E_AXIS + last_extruder]) { + position[E_AXIS] = LROUND(position[E_AXIS] * settings.axis_steps_per_mm[E_AXIS_N(extruder)] * steps_to_mm[E_AXIS + last_extruder]); last_extruder = extruder; } #endif @@ -2569,10 +2551,10 @@ bool Planner::buffer_segment(const float &a, const float &b, const float &c, con // The target position of the tool in absolute steps // Calculate target position in absolute steps const int32_t target[ABCE] = { - LROUND(a * axis_steps_per_mm[A_AXIS]), - LROUND(b * axis_steps_per_mm[B_AXIS]), - LROUND(c * axis_steps_per_mm[C_AXIS]), - LROUND(e * axis_steps_per_mm[E_AXIS_N]) + LROUND(a * settings.axis_steps_per_mm[A_AXIS]), + LROUND(b * settings.axis_steps_per_mm[B_AXIS]), + LROUND(c * settings.axis_steps_per_mm[C_AXIS]), + LROUND(e * settings.axis_steps_per_mm[E_AXIS_N(extruder)]) }; #if HAS_POSITION_FLOAT @@ -2708,10 +2690,10 @@ void Planner::set_machine_position_mm(const float &a, const float &b, const floa #if ENABLED(DISTINCT_E_FACTORS) last_extruder = active_extruder; #endif - position[A_AXIS] = LROUND(a * axis_steps_per_mm[A_AXIS]); - position[B_AXIS] = LROUND(b * axis_steps_per_mm[B_AXIS]); - position[C_AXIS] = LROUND(c * axis_steps_per_mm[C_AXIS]); - position[E_AXIS] = LROUND(e * axis_steps_per_mm[_EINDEX]); + position[A_AXIS] = LROUND(a * settings.axis_steps_per_mm[A_AXIS]); + position[B_AXIS] = LROUND(b * settings.axis_steps_per_mm[B_AXIS]); + position[C_AXIS] = LROUND(c * settings.axis_steps_per_mm[C_AXIS]); + position[E_AXIS] = LROUND(e * settings.axis_steps_per_mm[E_AXIS_N(active_extruder)]); #if HAS_POSITION_FLOAT position_float[A_AXIS] = a; position_float[B_AXIS] = b; @@ -2753,18 +2735,16 @@ void Planner::set_position_mm(const float &rx, const float &ry, const float &rz, * Setters for planner position (also setting stepper position). */ void Planner::set_e_position_mm(const float &e) { + const uint8_t axis_index = E_AXIS_N(active_extruder); #if ENABLED(DISTINCT_E_FACTORS) - const uint8_t axis_index = E_AXIS + active_extruder; last_extruder = active_extruder; - #else - const uint8_t axis_index = E_AXIS; #endif #if ENABLED(FWRETRACT) float e_new = e - fwretract.current_retract[active_extruder]; #else const float e_new = e; #endif - position[E_AXIS] = LROUND(axis_steps_per_mm[axis_index] * e_new); + position[E_AXIS] = LROUND(settings.axis_steps_per_mm[axis_index] * e_new); #if HAS_POSITION_FLOAT position_float[E_AXIS] = e_new; #endif @@ -2780,13 +2760,13 @@ void Planner::set_e_position_mm(const float &e) { // Recalculate the steps/s^2 acceleration rates, based on the mm/s^2 void Planner::reset_acceleration_rates() { #if ENABLED(DISTINCT_E_FACTORS) - #define AXIS_CONDITION (i < E_AXIS || i == E_AXIS + active_extruder) + #define AXIS_CONDITION (i < E_AXIS || i == E_AXIS_N(active_extruder)) #else #define AXIS_CONDITION true #endif uint32_t highest_rate = 1; LOOP_XYZE_N(i) { - max_acceleration_steps_per_s2[i] = max_acceleration_mm_per_s2[i] * axis_steps_per_mm[i]; + max_acceleration_steps_per_s2[i] = settings.max_acceleration_mm_per_s2[i] * settings.axis_steps_per_mm[i]; if (AXIS_CONDITION) NOLESS(highest_rate, max_acceleration_steps_per_s2[i]); } cutoff_long = 4294967295UL / highest_rate; // 0xFFFFFFFFUL @@ -2795,9 +2775,9 @@ void Planner::reset_acceleration_rates() { #endif } -// Recalculate position, steps_to_mm if axis_steps_per_mm changes! +// Recalculate position, steps_to_mm if settings.axis_steps_per_mm changes! void Planner::refresh_positioning() { - LOOP_XYZE_N(i) steps_to_mm[i] = 1.0f / axis_steps_per_mm[i]; + LOOP_XYZE_N(i) steps_to_mm[i] = 1.0f / settings.axis_steps_per_mm[i]; set_position_mm(current_position); reset_acceleration_rates(); } diff --git a/Marlin/src/module/planner.h b/Marlin/src/module/planner.h index acdfbd816c..8cf37f0758 100644 --- a/Marlin/src/module/planner.h +++ b/Marlin/src/module/planner.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * planner.h @@ -29,9 +30,6 @@ * Copyright (c) 2009-2011 Simen Svale Skogsrud */ -#ifndef PLANNER_H -#define PLANNER_H - #include "../Marlin.h" #include "motion.h" @@ -49,6 +47,10 @@ #include "../feature/fwretract.h" #endif +#if ENABLED(MIXING_EXTRUDER) + #include "../feature/mixing.h" +#endif + enum BlockFlagBit : char { // Recalculate trapezoids on entry junction. For optimization. BLOCK_BIT_RECALCULATE, @@ -81,7 +83,7 @@ enum BlockFlag : char { * The "nominal" values are as-specified by gcode, and * may never actually be reached due to acceleration limits. */ -typedef struct { +typedef struct block_t { volatile uint8_t flag; // Block flags (See BlockFlag enum above) - Modified by ISR and main thread! @@ -106,11 +108,13 @@ typedef struct { uint32_t step_event_count; // The number of step events required to complete this block #if EXTRUDERS > 1 - uint8_t active_extruder; // The extruder to move (if E move) + uint8_t extruder; // The extruder to move (if E move) + #else + static constexpr uint8_t extruder = 0; #endif #if ENABLED(MIXING_EXTRUDER) - uint32_t mix_steps[MIXING_STEPPERS]; // Scaled steps[E_AXIS] for the mixing steppers + MIXER_BLOCK_DEFINITION; // Normalized color for the mixing steppers #endif // Settings for the trapezoid generator @@ -144,7 +148,7 @@ typedef struct { acceleration_steps_per_s2; // acceleration steps/sec^2 #if FAN_COUNT > 0 - uint16_t fan_speed[FAN_COUNT]; + uint8_t fan_speed[FAN_COUNT]; #endif #if ENABLED(BARICUDA) @@ -159,6 +163,42 @@ typedef struct { #define BLOCK_MOD(n) ((n)&(BLOCK_BUFFER_SIZE-1)) +typedef struct { + uint32_t max_acceleration_mm_per_s2[XYZE_N], // (mm/s^2) M201 XYZE + min_segment_time_us; // (µs) M205 B + float axis_steps_per_mm[XYZE_N], // (steps) M92 XYZE - Steps per millimeter + max_feedrate_mm_s[XYZE_N], // (mm/s) M203 XYZE - Max speeds + acceleration, // (mm/s^2) M204 S - Normal acceleration. DEFAULT ACCELERATION for all printing moves. + retract_acceleration, // (mm/s^2) M204 R - Retract acceleration. Filament pull-back and push-forward while standing still in the other axes + travel_acceleration, // (mm/s^2) M204 T - Travel acceleration. DEFAULT ACCELERATION for all NON printing moves. + min_feedrate_mm_s, // (mm/s) M205 S - Minimum linear feedrate + min_travel_feedrate_mm_s; // (mm/s) M205 T - Minimum travel feedrate +} planner_settings_t; + +#ifndef XY_SKEW_FACTOR + #define XY_SKEW_FACTOR 0 +#endif +#ifndef XZ_SKEW_FACTOR + #define XZ_SKEW_FACTOR 0 +#endif +#ifndef YZ_SKEW_FACTOR + #define YZ_SKEW_FACTOR 0 +#endif + +typedef struct { + #if ENABLED(SKEW_CORRECTION_GCODE) + float xy; + #if ENABLED(SKEW_CORRECTION_FOR_Z) + float xz, yz; + #else + const float xz = XZ_SKEW_FACTOR, yz = YZ_SKEW_FACTOR; + #endif + #else + const float xy = XY_SKEW_FACTOR, + xz = XZ_SKEW_FACTOR, yz = YZ_SKEW_FACTOR; + #endif +} skew_factor_t; + class Planner { public: @@ -199,17 +239,10 @@ class Planner { // May be auto-adjusted by a filament width sensor #endif - static uint32_t max_acceleration_mm_per_s2[XYZE_N], // (mm/s^2) M201 XYZE - max_acceleration_steps_per_s2[XYZE_N], // (steps/s^2) Derived from mm_per_s2 - min_segment_time_us; // (µs) M205 B - static float max_feedrate_mm_s[XYZE_N], // (mm/s) M203 XYZE - Max speeds - axis_steps_per_mm[XYZE_N], // (steps) M92 XYZE - Steps per millimeter - steps_to_mm[XYZE_N], // (mm) Millimeters per step - min_feedrate_mm_s, // (mm/s) M205 S - Minimum linear feedrate - acceleration, // (mm/s^2) M204 S - Normal acceleration. DEFAULT ACCELERATION for all printing moves. - retract_acceleration, // (mm/s^2) M204 R - Retract acceleration. Filament pull-back and push-forward while standing still in the other axes - travel_acceleration, // (mm/s^2) M204 T - Travel acceleration. DEFAULT ACCELERATION for all NON printing moves. - min_travel_feedrate_mm_s; // (mm/s) M205 T - Minimum travel feedrate + static planner_settings_t settings; + + static uint32_t max_acceleration_steps_per_s2[XYZE_N]; // (steps/s^2) Derived from mm_per_s2 + static float steps_to_mm[XYZE_N]; // Millimeters per step #if ENABLED(JUNCTION_DEVIATION) static float junction_deviation_mm; // (mm) M205 J @@ -256,22 +289,7 @@ class Planner { static float position_cart[XYZE]; #endif - #if ENABLED(SKEW_CORRECTION) - #if ENABLED(SKEW_CORRECTION_GCODE) - static float xy_skew_factor; - #else - static constexpr float xy_skew_factor = XY_SKEW_FACTOR; - #endif - #if ENABLED(SKEW_CORRECTION_FOR_Z) - #if ENABLED(SKEW_CORRECTION_GCODE) - static float xz_skew_factor, yz_skew_factor; - #else - static constexpr float xz_skew_factor = XZ_SKEW_FACTOR, yz_skew_factor = YZ_SKEW_FACTOR; - #endif - #else - static constexpr float xz_skew_factor = 0, yz_skew_factor = 0; - #endif - #endif + static skew_factor_t skew_factor; #if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED) static bool abort_on_endstop_hit; @@ -419,8 +437,8 @@ class Planner { FORCE_INLINE static void skew(float &cx, float &cy, const float &cz) { if (WITHIN(cx, X_MIN_POS + 1, X_MAX_POS) && WITHIN(cy, Y_MIN_POS + 1, Y_MAX_POS)) { - const float sx = cx - cy * xy_skew_factor - cz * (xz_skew_factor - (xy_skew_factor * yz_skew_factor)), - sy = cy - cz * yz_skew_factor; + const float sx = cx - cy * skew_factor.xy - cz * (skew_factor.xz - (skew_factor.xy * skew_factor.yz)), + sy = cy - cz * skew_factor.yz; if (WITHIN(sx, X_MIN_POS, X_MAX_POS) && WITHIN(sy, Y_MIN_POS, Y_MAX_POS)) { cx = sx; cy = sy; } @@ -431,8 +449,8 @@ class Planner { FORCE_INLINE static void unskew(float &cx, float &cy, const float &cz) { if (WITHIN(cx, X_MIN_POS, X_MAX_POS) && WITHIN(cy, Y_MIN_POS, Y_MAX_POS)) { - const float sx = cx + cy * xy_skew_factor + cz * xz_skew_factor, - sy = cy + cz * yz_skew_factor; + const float sx = cx + cy * skew_factor.xy + cz * skew_factor.xz, + sy = cy + cz * skew_factor.yz; if (WITHIN(sx, X_MIN_POS, X_MAX_POS) && WITHIN(sy, Y_MIN_POS, Y_MAX_POS)) { cx = sx; cy = sy; } @@ -848,9 +866,9 @@ class Planner { #define GET_MAX_E_JERK(N) SQRT(SQRT(0.5) * junction_deviation_mm * (N) * RECIPROCAL(1.0 - SQRT(0.5))) #if ENABLED(DISTINCT_E_FACTORS) for (uint8_t i = 0; i < EXTRUDERS; i++) - max_e_jerk[i] = GET_MAX_E_JERK(max_acceleration_mm_per_s2[E_AXIS + i]); + max_e_jerk[i] = GET_MAX_E_JERK(settings.max_acceleration_mm_per_s2[E_AXIS + i]); #else - max_e_jerk = GET_MAX_E_JERK(max_acceleration_mm_per_s2[E_AXIS]); + max_e_jerk = GET_MAX_E_JERK(settings.max_acceleration_mm_per_s2[E_AXIS]); #endif } #endif @@ -927,15 +945,13 @@ class Planner { FORCE_INLINE static float limit_value_by_axis_maximum(const float &max_value, float (&unit_vec)[XYZE]) { float limit_value = max_value; LOOP_XYZE(idx) if (unit_vec[idx]) // Avoid divide by zero - NOMORE(limit_value, ABS(max_acceleration_mm_per_s2[idx] / unit_vec[idx])); + NOMORE(limit_value, ABS(settings.max_acceleration_mm_per_s2[idx] / unit_vec[idx])); return limit_value; } #endif // JUNCTION_DEVIATION }; -#define PLANNER_XY_FEEDRATE() (MIN(planner.max_feedrate_mm_s[X_AXIS], planner.max_feedrate_mm_s[Y_AXIS])) +#define PLANNER_XY_FEEDRATE() (MIN(planner.settings.max_feedrate_mm_s[X_AXIS], planner.settings.max_feedrate_mm_s[Y_AXIS])) extern Planner planner; - -#endif // PLANNER_H diff --git a/Marlin/src/module/planner_bezier.h b/Marlin/src/module/planner_bezier.h index 7e4ea23657..ec4031f155 100644 --- a/Marlin/src/module/planner_bezier.h +++ b/Marlin/src/module/planner_bezier.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * planner_bezier.h @@ -27,10 +28,8 @@ * */ -#ifndef PLANNER_BEZIER_H -#define PLANNER_BEZIER_H - -#include "../inc/MarlinConfig.h" +#include +#include "../core/macros.h" void cubic_b_spline( const float position[NUM_AXIS], // current position @@ -39,5 +38,3 @@ void cubic_b_spline( float fr_mm_s, uint8_t extruder ); - -#endif // PLANNER_BEZIER_H diff --git a/Marlin/src/module/printcounter.h b/Marlin/src/module/printcounter.h index 461c689e51..ce3fd05b3c 100644 --- a/Marlin/src/module/printcounter.h +++ b/Marlin/src/module/printcounter.h @@ -19,9 +19,7 @@ * along with this program. If not, see . * */ - -#ifndef PRINTCOUNTER_H -#define PRINTCOUNTER_H +#pragma once #include "../libs/stopwatch.h" #include "../libs/duration_t.h" @@ -193,5 +191,3 @@ class PrintCounter: public Stopwatch { #else extern Stopwatch print_job_timer; #endif - -#endif // PRINTCOUNTER_H diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp index 251861fcfe..6d535eeef0 100644 --- a/Marlin/src/module/probe.cpp +++ b/Marlin/src/module/probe.cpp @@ -58,6 +58,11 @@ float zprobe_zoffset; // Initialized by settings.load() #include "../module/servo.h" #endif +#if ENABLED(SENSORLESS_PROBING) + #include "stepper.h" + #include "../feature/tmc_util.h" +#endif + #if ENABLED(Z_PROBE_SLED) #ifndef SLED_DOCKING_OFFSET @@ -89,10 +94,6 @@ float zprobe_zoffset; // Initialized by settings.load() #elif ENABLED(Z_PROBE_ALLEN_KEY) - FORCE_INLINE void do_blocking_move_to(const float (&raw)[XYZ], const float &fr_mm_s) { - do_blocking_move_to(raw[X_AXIS], raw[Y_AXIS], raw[Z_AXIS], fr_mm_s); - } - void run_deploy_moves_script() { #if defined(Z_PROBE_ALLEN_KEY_DEPLOY_1_X) || defined(Z_PROBE_ALLEN_KEY_DEPLOY_1_Y) || defined(Z_PROBE_ALLEN_KEY_DEPLOY_1_Z) #ifndef Z_PROBE_ALLEN_KEY_DEPLOY_1_X @@ -268,12 +269,12 @@ float zprobe_zoffset; // Initialized by settings.load() fans_paused = p; if (p) for (uint8_t x = 0; x < FAN_COUNT; x++) { - paused_fanSpeeds[x] = fanSpeeds[x]; - fanSpeeds[x] = 0; + paused_fan_speed[x] = fan_speed[x]; + fan_speed[x] = 0; } else for (uint8_t x = 0; x < FAN_COUNT; x++) - fanSpeeds[x] = paused_fanSpeeds[x]; + fan_speed[x] = paused_fan_speed[x]; } } @@ -287,6 +288,12 @@ float zprobe_zoffset; // Initialized by settings.load() #if ENABLED(PROBING_FANS_OFF) fans_pause(p); #endif + #if ENABLED(PROBING_STEPPERS_OFF) + disable_e_steppers(); + #if DISABLED(DELTA) + disable_X(); disable_Y(); + #endif + #endif if (p) safe_delay( #if DELAY_BEFORE_PROBING > 25 DELAY_BEFORE_PROBING @@ -356,18 +363,54 @@ inline void do_probe_raise(const float z_raise) { do_blocking_move_to_z(z_dest); } +FORCE_INLINE void probe_specific_action(const bool deploy) { + #if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + + BUZZ(100, 659); + BUZZ(100, 698); + + PGM_P const ds_str = deploy ? PSTR(MSG_MANUAL_DEPLOY) : PSTR(MSG_MANUAL_STOW); + ui.return_to_status(); // To display the new status message + ui.set_status_P(ds_str, 99); + serialprintPGM(ds_str); + SERIAL_EOL(); + + KEEPALIVE_STATE(PAUSED_FOR_USER); + wait_for_user = true; + while (wait_for_user) idle(); + ui.reset_status(); + KEEPALIVE_STATE(IN_HANDLER); + + #endif // PAUSE_BEFORE_DEPLOY_STOW + + #if ENABLED(SOLENOID_PROBE) + + #if HAS_SOLENOID_1 + WRITE(SOL1_PIN, deploy); + #endif + + #elif ENABLED(Z_PROBE_SLED) + + dock_sled(!deploy); + + #elif HAS_Z_SERVO_PROBE && DISABLED(BLTOUCH) + + MOVE_SERVO(Z_PROBE_SERVO_NR, servo_angles[Z_PROBE_SERVO_NR][deploy ? 0 : 1]); + + #elif ENABLED(Z_PROBE_ALLEN_KEY) + + deploy ? run_deploy_moves_script() : run_stow_moves_script(); + + #elif ENABLED(RACK_AND_PINION_PROBE) + + do_blocking_move_to_x(deploy ? Z_PROBE_DEPLOY_X : Z_PROBE_RETRACT_X); + + #endif +} + // returns false for ok and true for failure bool set_probe_deployed(const bool deploy) { - // Can be extended to servo probes, if needed. - #if ENABLED(PROBE_IS_TRIGGERED_WHEN_STOWED_TEST) - #if ENABLED(Z_MIN_PROBE_ENDSTOP) - #define _TRIGGERED_WHEN_STOWED_TEST (READ(Z_MIN_PROBE_PIN) != Z_MIN_PROBE_ENDSTOP_INVERTING) - #else - #define _TRIGGERED_WHEN_STOWED_TEST (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING) - #endif - #endif - #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) { DEBUG_POS("set_probe_deployed", current_position); @@ -413,61 +456,24 @@ bool set_probe_deployed(const bool deploy) { const float oldXpos = current_position[X_AXIS], oldYpos = current_position[Y_AXIS]; - #ifdef _TRIGGERED_WHEN_STOWED_TEST - - // If endstop is already false, the Z probe is deployed - if (_TRIGGERED_WHEN_STOWED_TEST == deploy) { // closed after the probe specific actions. - // Would a goto be less ugly? - //while (!_TRIGGERED_WHEN_STOWED_TEST) idle(); // would offer the opportunity - // for a triggered when stowed manual probe. - - if (!deploy) endstops.enable_z_probe(false); // Switch off triggered when stowed probes early - // otherwise an Allen-Key probe can't be stowed. + #if ENABLED(PROBE_TRIGGERED_WHEN_STOWED_TEST) + #if ENABLED(Z_MIN_PROBE_ENDSTOP) + #define PROBE_STOWED() (READ(Z_MIN_PROBE_PIN) != Z_MIN_PROBE_ENDSTOP_INVERTING) + #else + #define PROBE_STOWED() (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING) + #endif #endif - #if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + #ifdef PROBE_STOWED - BUZZ(100, 659); - BUZZ(100, 698); - - const char * const ds_str = deploy ? PSTR(MSG_MANUAL_DEPLOY) : PSTR(MSG_MANUAL_STOW); - lcd_setstatusPGM(ds_str); - serialprintPGM(ds_str); - SERIAL_EOL(); - - KEEPALIVE_STATE(PAUSED_FOR_USER); - wait_for_user = true; - while (wait_for_user) idle(); - lcd_reset_status(); - KEEPALIVE_STATE(IN_HANDLER); - - #endif // PAUSE_BEFORE_DEPLOY_STOW - - #if ENABLED(SOLENOID_PROBE) - - #if HAS_SOLENOID_1 - WRITE(SOL1_PIN, deploy); - #endif - - #elif ENABLED(Z_PROBE_SLED) - - dock_sled(!deploy); - - #elif HAS_Z_SERVO_PROBE && DISABLED(BLTOUCH) - - MOVE_SERVO(Z_PROBE_SERVO_NR, servo_angles[Z_PROBE_SERVO_NR][deploy ? 0 : 1]); - - #elif ENABLED(Z_PROBE_ALLEN_KEY) - - deploy ? run_deploy_moves_script() : run_stow_moves_script(); - - #endif - - #ifdef _TRIGGERED_WHEN_STOWED_TEST - } // _TRIGGERED_WHEN_STOWED_TEST == deploy - - if (_TRIGGERED_WHEN_STOWED_TEST == deploy) { // State hasn't changed? + // Only deploy/stow if needed + if (PROBE_STOWED() == deploy) { + if (!deploy) endstops.enable_z_probe(false); // Switch off triggered when stowed probes early + // otherwise an Allen-Key probe can't be stowed. + probe_specific_action(deploy); + } + if (PROBE_STOWED() == deploy) { // Unchanged after deploy/stow action? if (IsRunning()) { SERIAL_ERROR_START(); SERIAL_ERRORLNPGM("Z-Probe failed"); @@ -475,8 +481,11 @@ bool set_probe_deployed(const bool deploy) { } stop(); return true; + } - } // _TRIGGERED_WHEN_STOWED_TEST == deploy + #else + + probe_specific_action(deploy); #endif @@ -518,7 +527,7 @@ static bool do_probe_move(const float z, const float fr_mm_s) { serialprintPGM(msg_wait_for_bed_heating); LCD_MESSAGEPGM(MSG_BED_HEATING); while (thermalManager.isHeatingBed()) safe_delay(200); - lcd_reset_status(); + ui.reset_status(); } #endif @@ -527,31 +536,58 @@ static bool do_probe_move(const float z, const float fr_mm_s) { if (set_bltouch_deployed(true)) return true; #endif + // Disable stealthChop if used. Enable diag1 pin on driver. + #if ENABLED(SENSORLESS_PROBING) + #if ENABLED(DELTA) + tmc_stallguard(stepperX); + tmc_stallguard(stepperY); + #endif + tmc_stallguard(stepperZ); + endstops.enable(true); + #endif + #if QUIET_PROBING probing_pause(true); #endif - // Move down until probe triggered + // Move down until the probe is triggered do_blocking_move_to_z(z, fr_mm_s); // Check to see if the probe was triggered - const bool probe_triggered = TEST(endstops.trigger_state(), - #if ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) - Z_MIN + const bool probe_triggered = + #if ENABLED(DELTA) && ENABLED(SENSORLESS_PROBING) + endstops.trigger_state() & (_BV(X_MIN) | _BV(Y_MIN) | _BV(Z_MIN)) #else - Z_MIN_PROBE + TEST(endstops.trigger_state(), + #if ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) + Z_MIN + #else + Z_MIN_PROBE + #endif + ) #endif - ); + ; #if QUIET_PROBING probing_pause(false); #endif + // Re-enable stealthChop if used. Disable diag1 pin on driver. + #if ENABLED(SENSORLESS_PROBING) + endstops.not_homing(); + #if ENABLED(DELTA) + tmc_stallguard(stepperX, false); + tmc_stallguard(stepperY, false); + #endif + tmc_stallguard(stepperZ, false); + #endif + // Retract BLTouch immediately after a probe if it was triggered #if ENABLED(BLTOUCH) if (probe_triggered && set_bltouch_deployed(false)) return true; #endif + // Clear endstop flags endstops.hit_on_purpose(); // Get Z where the steppers were interrupted @@ -606,13 +642,11 @@ static float run_z_probe() { // move up to make clearance for the probe do_blocking_move_to_z(current_position[Z_AXIS] + Z_CLEARANCE_MULTI_PROBE, MMM_TO_MMS(Z_PROBE_SPEED_FAST)); - #else + #elif Z_PROBE_SPEED_FAST != Z_PROBE_SPEED_SLOW // If the nozzle is well over the travel height then // move down quickly before doing the slow probe - float z = Z_CLEARANCE_DEPLOY_PROBE + 5.0; - if (zprobe_zoffset < 0) z -= zprobe_zoffset; - + const float z = Z_CLEARANCE_DEPLOY_PROBE + 5.0 + (zprobe_zoffset < 0 ? -zprobe_zoffset : 0); if (current_position[Z_AXIS] > z) { // If we don't make it to the z position (i.e. the probe triggered), move up to make clearance for the probe if (!do_probe_move(z, MMM_TO_MMS(Z_PROBE_SPEED_FAST))) diff --git a/Marlin/src/module/probe.h b/Marlin/src/module/probe.h index f81482dcec..830911a6ba 100644 --- a/Marlin/src/module/probe.h +++ b/Marlin/src/module/probe.h @@ -19,14 +19,12 @@ * along with this program. If not, see . * */ +#pragma once /** * probe.h - Move, deploy, enable, etc. */ -#ifndef PROBE_H -#define PROBE_H - #include "../inc/MarlinConfig.h" #if HAS_BED_PROBE @@ -73,5 +71,3 @@ set_bltouch_deployed(false); } #endif - -#endif // PROBE_H diff --git a/Marlin/src/module/scara.cpp b/Marlin/src/module/scara.cpp index 225e4a25d8..8063c44443 100644 --- a/Marlin/src/module/scara.cpp +++ b/Marlin/src/module/scara.cpp @@ -60,12 +60,7 @@ void scara_set_axis_is_at_home(const AxisEnum axis) { current_position[axis] = cartes[axis]; - /** - * SCARA home positions are based on configuration since the actual - * limits are determined by the inverse kinematic transform. - */ - soft_endstop_min[axis] = base_min_pos(axis); // + (cartes[axis] - base_home_pos(axis)); - soft_endstop_max[axis] = base_max_pos(axis); // + (cartes[axis] - base_home_pos(axis)); + update_software_endstops(axis); } } diff --git a/Marlin/src/module/servo.h b/Marlin/src/module/servo.h index bd7e2acf5c..7dc70559c7 100644 --- a/Marlin/src/module/servo.h +++ b/Marlin/src/module/servo.h @@ -19,14 +19,13 @@ * along with this program. If not, see . * */ +#pragma once /** * module/servo.h */ -#ifndef _SERVO_H_ -#define _SERVO_H_ - +#include "../inc/MarlinConfig.h" #include "../HAL/shared/servo.h" extern HAL_SERVO_LIB servo[NUM_SERVOS]; @@ -35,11 +34,7 @@ extern void servo_init(); #define MOVE_SERVO(I, P) servo[I].move(P) -#include "../inc/MarlinConfig.h" - #if HAS_Z_SERVO_PROBE #define DEPLOY_Z_SERVO() MOVE_SERVO(Z_PROBE_SERVO_NR, servo_angles[Z_PROBE_SERVO_NR][0]) #define STOW_Z_SERVO() MOVE_SERVO(Z_PROBE_SERVO_NR, servo_angles[Z_PROBE_SERVO_NR][1]) #endif - -#endif // _SERVO_H_ diff --git a/Marlin/src/module/speed_lookuptable.h b/Marlin/src/module/speed_lookuptable.h index c251a7ffc1..ade4e01bd4 100644 --- a/Marlin/src/module/speed_lookuptable.h +++ b/Marlin/src/module/speed_lookuptable.h @@ -19,9 +19,7 @@ * along with this program. If not, see . * */ - -#ifndef SPEED_LOOKUPTABLE_H -#define SPEED_LOOKUPTABLE_H +#pragma once #if F_CPU == 16000000 @@ -168,5 +166,3 @@ }; #endif - -#endif // SPEED_LOOKUPTABLE_H diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index 76c068977f..e9593730c3 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -103,11 +103,19 @@ #include #endif +#if ENABLED(MIXING_EXTRUDER) + #include "../feature/mixing.h" +#endif + Stepper stepper; // Singleton +#if FILAMENT_RUNOUT_DISTANCE_MM > 0 + #include "../feature/runout.h" +#endif + // public: -#if ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS +#if ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS || ENABLED(Z_STEPPER_AUTO_ALIGN) bool Stepper::separate_multi_axis = false; #endif @@ -134,10 +142,10 @@ bool Stepper::abort_current_block; #if ENABLED(Y_DUAL_ENDSTOPS) bool Stepper::locked_Y_motor = false, Stepper::locked_Y2_motor = false; #endif -#if Z_MULTI_ENDSTOPS +#if Z_MULTI_ENDSTOPS || ENABLED(Z_STEPPER_AUTO_ALIGN) bool Stepper::locked_Z_motor = false, Stepper::locked_Z2_motor = false; #endif -#if ENABLED(Z_TRIPLE_ENDSTOPS) +#if ENABLED(Z_TRIPLE_ENDSTOPS) || (ENABLED(Z_STEPPER_AUTO_ALIGN) && ENABLED(Z_TRIPLE_STEPPER_DRIVERS)) bool Stepper::locked_Z3_motor = false; #endif @@ -158,12 +166,10 @@ uint32_t Stepper::advance_dividend[XYZE] = { 0 }, Stepper::decelerate_after, // The point from where we need to start decelerating Stepper::step_event_count; // The total event count for the current block -#if ENABLED(MIXING_EXTRUDER) - int32_t Stepper::delta_error_m[MIXING_STEPPERS]; - uint32_t Stepper::advance_dividend_m[MIXING_STEPPERS], - Stepper::advance_divisor_m; -#elif EXTRUDERS > 1 - uint8_t Stepper::active_extruder; // Active extruder +#if EXTRUDERS > 1 || ENABLED(MIXING_EXTRUDER) + uint8_t Stepper::stepper_extruder; +#else + constexpr uint8_t Stepper::stepper_extruder; #endif #if ENABLED(S_CURVE_ACCELERATION) @@ -205,7 +211,7 @@ volatile int32_t Stepper::endstops_trigsteps[XYZ]; volatile int32_t Stepper::count_position[NUM_AXIS] = { 0 }; int8_t Stepper::count_direction[NUM_AXIS] = { 0, 0, 0, 0 }; -#define DUAL_ENDSTOP_APPLY_STEP(A,V) \ +#define DUAL_ENDSTOP_APPLY_STEP(A,V) \ if (separate_multi_axis) { \ if (A##_HOME_DIR < 0) { \ if (!(TEST(endstops.state(), A##_MIN) && count_direction[_AXIS(A)] < 0) && !locked_##A##_motor) A##_STEP_WRITE(V); \ @@ -221,7 +227,17 @@ int8_t Stepper::count_direction[NUM_AXIS] = { 0, 0, 0, 0 }; A##2_STEP_WRITE(V); \ } -#define TRIPLE_ENDSTOP_APPLY_STEP(A,V) \ +#define DUAL_SEPARATE_APPLY_STEP(A,V) \ + if (separate_multi_axis) { \ + if (!locked_##A##_motor) A##_STEP_WRITE(V); \ + if (!locked_##A##2_motor) A##2_STEP_WRITE(V); \ + } \ + else { \ + A##_STEP_WRITE(V); \ + A##2_STEP_WRITE(V); \ + } + +#define TRIPLE_ENDSTOP_APPLY_STEP(A,V) \ if (separate_multi_axis) { \ if (A##_HOME_DIR < 0) { \ if (!(TEST(endstops.state(), A##_MIN) && count_direction[_AXIS(A)] < 0) && !locked_##A##_motor) A##_STEP_WRITE(V); \ @@ -292,6 +308,8 @@ int8_t Stepper::count_direction[NUM_AXIS] = { 0, 0, 0, 0 }; #define Z_APPLY_DIR(v,Q) do{ Z_DIR_WRITE(v); Z2_DIR_WRITE(v); }while(0) #if ENABLED(Z_DUAL_ENDSTOPS) #define Z_APPLY_STEP(v,Q) DUAL_ENDSTOP_APPLY_STEP(Z,v) + #elif ENABLED(Z_STEPPER_AUTO_ALIGN) + #define Z_APPLY_STEP(v,Q) DUAL_SEPARATE_APPLY_STEP(Z,v) #else #define Z_APPLY_STEP(v,Q) do{ Z_STEP_WRITE(v); Z2_STEP_WRITE(v); }while(0) #endif @@ -301,7 +319,7 @@ int8_t Stepper::count_direction[NUM_AXIS] = { 0, 0, 0, 0 }; #endif #if DISABLED(MIXING_EXTRUDER) - #define E_APPLY_STEP(v,Q) E_STEP_WRITE(active_extruder, v) + #define E_APPLY_STEP(v,Q) E_STEP_WRITE(stepper_extruder, v) #endif void Stepper::wake_up() { @@ -340,21 +358,23 @@ void Stepper::set_directions() { #if DISABLED(LIN_ADVANCE) #if ENABLED(MIXING_EXTRUDER) + // Because this is valid for the whole block we don't know + // what e-steppers will step. Likely all. Set all. if (motor_direction(E_AXIS)) { - MIXING_STEPPERS_LOOP(j) REV_E_DIR(j); + MIXER_STEPPER_LOOP(j) REV_E_DIR(j); count_direction[E_AXIS] = -1; } else { - MIXING_STEPPERS_LOOP(j) NORM_E_DIR(j); + MIXER_STEPPER_LOOP(j) NORM_E_DIR(j); count_direction[E_AXIS] = 1; } #else if (motor_direction(E_AXIS)) { - REV_E_DIR(active_extruder); + REV_E_DIR(stepper_extruder); count_direction[E_AXIS] = -1; } else { - NORM_E_DIR(active_extruder); + NORM_E_DIR(stepper_extruder); count_direction[E_AXIS] = 1; } #endif @@ -478,14 +498,14 @@ void Stepper::set_directions() { * rhi = int32_t((mul >> 32) & 0xFFFFFFFF); * } * int32_t _eval_bezier_curve_arm(uint32_t curr_step) { - * register uint32_t flo = 0; - * register uint32_t fhi = bezier_AV * curr_step; - * register uint32_t t = fhi; - * register int32_t alo = bezier_F; - * register int32_t ahi = 0; - * register int32_t A = bezier_A; - * register int32_t B = bezier_B; - * register int32_t C = bezier_C; + * uint32_t flo = 0; + * uint32_t fhi = bezier_AV * curr_step; + * uint32_t t = fhi; + * int32_t alo = bezier_F; + * int32_t ahi = 0; + * int32_t A = bezier_A; + * int32_t B = bezier_B; + * int32_t C = bezier_C; * * lsrs(ahi, alo, 1); // a = F << 31 * lsls(alo, alo, 31); // @@ -570,29 +590,29 @@ void Stepper::set_directions() { * uint16_t t; * umul24x24to16hi(t, bezier_AV, curr_step); // t: Range 0 - 1^16 = 16 bits * uint16_t f = t; - * umul16x16to16hi(f, f, t); // Range 16 bits (unsigned) - * umul16x16to16hi(f, f, t); // Range 16 bits : f = t^3 (unsigned) - * uint24_t acc = bezier_F; // Range 20 bits (unsigned) + * umul16x16to16hi(f, f, t); // Range 16 bits (unsigned) + * umul16x16to16hi(f, f, t); // Range 16 bits : f = t^3 (unsigned) + * uint24_t acc = bezier_F; // Range 20 bits (unsigned) * if (A_negative) { * uint24_t v; - * umul16x24to24hi(v, f, bezier_C); // Range 21bits + * umul16x24to24hi(v, f, bezier_C); // Range 21bits * acc -= v; - * umul16x16to16hi(f, f, t); // Range 16 bits : f = t^4 (unsigned) - * umul16x24to24hi(v, f, bezier_B); // Range 22bits + * umul16x16to16hi(f, f, t); // Range 16 bits : f = t^4 (unsigned) + * umul16x24to24hi(v, f, bezier_B); // Range 22bits * acc += v; - * umul16x16to16hi(f, f, t); // Range 16 bits : f = t^5 (unsigned) - * umul16x24to24hi(v, f, bezier_A); // Range 21bits + 15 = 36bits (plus sign) + * umul16x16to16hi(f, f, t); // Range 16 bits : f = t^5 (unsigned) + * umul16x24to24hi(v, f, bezier_A); // Range 21bits + 15 = 36bits (plus sign) * acc -= v; * } * else { * uint24_t v; - * umul16x24to24hi(v, f, bezier_C); // Range 21bits + * umul16x24to24hi(v, f, bezier_C); // Range 21bits * acc += v; - * umul16x16to16hi(f, f, t); // Range 16 bits : f = t^4 (unsigned) - * umul16x24to24hi(v, f, bezier_B); // Range 22bits + * umul16x16to16hi(f, f, t); // Range 16 bits : f = t^4 (unsigned) + * umul16x24to24hi(v, f, bezier_B); // Range 22bits * acc -= v; - * umul16x16to16hi(f, f, t); // Range 16 bits : f = t^5 (unsigned) - * umul16x24to24hi(v, f, bezier_A); // Range 21bits + 15 = 36bits (plus sign) + * umul16x16to16hi(f, f, t); // Range 16 bits : f = t^5 (unsigned) + * umul16x24to24hi(v, f, bezier_A); // Range 21bits + 15 = 36bits (plus sign) * acc += v; * } * return acc; @@ -610,13 +630,13 @@ void Stepper::set_directions() { bezier_AV = av; // Calculate the rest of the coefficients - register uint8_t r2 = v0 & 0xFF; - register uint8_t r3 = (v0 >> 8) & 0xFF; - register uint8_t r12 = (v0 >> 16) & 0xFF; - register uint8_t r5 = v1 & 0xFF; - register uint8_t r6 = (v1 >> 8) & 0xFF; - register uint8_t r7 = (v1 >> 16) & 0xFF; - register uint8_t r4,r8,r9,r10,r11; + uint8_t r2 = v0 & 0xFF; + uint8_t r3 = (v0 >> 8) & 0xFF; + uint8_t r12 = (v0 >> 16) & 0xFF; + uint8_t r5 = v1 & 0xFF; + uint8_t r6 = (v1 >> 8) & 0xFF; + uint8_t r7 = (v1 >> 16) & 0xFF; + uint8_t r4,r8,r9,r10,r11; __asm__ __volatile__( /* Calculate the Bézier coefficients */ @@ -712,11 +732,11 @@ void Stepper::set_directions() { if (!curr_step) return bezier_F; - register uint8_t r0 = 0; /* Zero register */ - register uint8_t r2 = (curr_step) & 0xFF; - register uint8_t r3 = (curr_step >> 8) & 0xFF; - register uint8_t r4 = (curr_step >> 16) & 0xFF; - register uint8_t r1,r5,r6,r7,r8,r9,r10,r11; /* Temporary registers */ + uint8_t r0 = 0; /* Zero register */ + uint8_t r2 = (curr_step) & 0xFF; + uint8_t r3 = (curr_step >> 8) & 0xFF; + uint8_t r4 = (curr_step >> 16) & 0xFF; + uint8_t r1,r5,r6,r7,r8,r9,r10,r11; /* Temporary registers */ __asm__ __volatile( /* umul24x24to16hi(t, bezier_AV, curr_step); t: Range 0 - 1^16 = 16 bits*/ @@ -1107,14 +1127,14 @@ void Stepper::set_directions() { #if defined(__ARM__) || defined(__thumb__) // For ARM Cortex M3/M4 CPUs, we have the optimized assembler version, that takes 43 cycles to execute - register uint32_t flo = 0; - register uint32_t fhi = bezier_AV * curr_step; - register uint32_t t = fhi; - register int32_t alo = bezier_F; - register int32_t ahi = 0; - register int32_t A = bezier_A; - register int32_t B = bezier_B; - register int32_t C = bezier_C; + uint32_t flo = 0; + uint32_t fhi = bezier_AV * curr_step; + uint32_t t = fhi; + int32_t alo = bezier_F; + int32_t ahi = 0; + int32_t A = bezier_A; + int32_t B = bezier_B; + int32_t C = bezier_C; __asm__ __volatile__( ".syntax unified" "\n\t" // is to prevent CM0,CM1 non-unified syntax @@ -1387,39 +1407,27 @@ void Stepper::stepper_pulse_phase_isr() { PULSE_START(Z); #endif - // Pulse E/Mixing extruders - #if ENABLED(LIN_ADVANCE) - // Tick the E axis, correct error term and update position + // Pulse Extruders + // Tick the E axis, correct error term and update position + #if ENABLED(LIN_ADVANCE) || ENABLED(MIXING_EXTRUDER) delta_error[E_AXIS] += advance_dividend[E_AXIS]; if (delta_error[E_AXIS] >= 0) { count_position[E_AXIS] += count_direction[E_AXIS]; - delta_error[E_AXIS] -= advance_divisor; - - // Don't step E here - But remember the number of steps to perform - motor_direction(E_AXIS) ? --LA_steps : ++LA_steps; - } - #else // !LIN_ADVANCE - use linear interpolation for E also - #if ENABLED(MIXING_EXTRUDER) - - // Tick the E axis - delta_error[E_AXIS] += advance_dividend[E_AXIS]; - if (delta_error[E_AXIS] >= 0) { - count_position[E_AXIS] += count_direction[E_AXIS]; + #if ENABLED(LIN_ADVANCE) delta_error[E_AXIS] -= advance_divisor; - } - - // Tick the counters used for this mix in proper proportion - MIXING_STEPPERS_LOOP(j) { - // Step mixing steppers (proportionally) - delta_error_m[j] += advance_dividend_m[j]; - // Step when the counter goes over zero - if (delta_error_m[j] >= 0) E_STEP_WRITE(j, !INVERT_E_STEP_PIN); - } - - #else // !MIXING_EXTRUDER + // Don't step E here - But remember the number of steps to perform + motor_direction(E_AXIS) ? --LA_steps : ++LA_steps; + #else // !LIN_ADVANCE && MIXING_EXTRUDER + // Don't adjust delta_error[E_AXIS] here! + // Being positive is the criteria for ending the pulse. + E_STEP_WRITE(mixer.get_next_stepper(), !INVERT_E_STEP_PIN); + #endif + } + #else // !LIN_ADVANCE && !MIXING_EXTRUDER + #if HAS_E0_STEP PULSE_START(E); #endif - #endif // !LIN_ADVANCE + #endif #if MINIMUM_STEPPER_PULSE // Just wait for the requested pulse duration @@ -1442,14 +1450,14 @@ void Stepper::stepper_pulse_phase_isr() { #if DISABLED(LIN_ADVANCE) #if ENABLED(MIXING_EXTRUDER) - MIXING_STEPPERS_LOOP(j) { - if (delta_error_m[j] >= 0) { - delta_error_m[j] -= advance_divisor_m; - E_STEP_WRITE(j, INVERT_E_STEP_PIN); - } + if (delta_error[E_AXIS] >= 0) { + delta_error[E_AXIS] -= advance_divisor; + E_STEP_WRITE(mixer.get_stepper(), INVERT_E_STEP_PIN); } #else // !MIXING_EXTRUDER - PULSE_STOP(E); + #if HAS_E0_STEP + PULSE_STOP(E); + #endif #endif #endif // !LIN_ADVANCE @@ -1483,6 +1491,9 @@ uint32_t Stepper::stepper_block_phase_isr() { // If current block is finished, reset pointer if (step_events_completed >= step_event_count) { + #if FILAMENT_RUNOUT_DISTANCE_MM > 0 + runout.block_completed(current_block); + #endif axis_did_move = 0; current_block = NULL; planner.discard_current_block(); @@ -1717,27 +1728,18 @@ uint32_t Stepper::stepper_block_phase_isr() { decelerate_after = current_block->decelerate_after << oversampling; #if ENABLED(MIXING_EXTRUDER) - const uint32_t e_steps = ( - #if ENABLED(LIN_ADVANCE) - current_block->steps[E_AXIS] - #else - step_event_count - #endif - ); - MIXING_STEPPERS_LOOP(i) { - delta_error_m[i] = -int32_t(e_steps); - advance_dividend_m[i] = current_block->mix_steps[i] << 1; - } - advance_divisor_m = e_steps << 1; - #elif EXTRUDERS > 1 - active_extruder = current_block->active_extruder; + MIXER_STEPPER_SETUP(); + #endif + + #if EXTRUDERS > 1 + stepper_extruder = current_block->extruder; #endif // Initialize the trapezoid generator from the current block. #if ENABLED(LIN_ADVANCE) #if DISABLED(MIXING_EXTRUDER) && E_STEPPERS > 1 // If the now active extruder wasn't in use during the last move, its pressure is most likely gone. - if (active_extruder != last_moved_extruder) LA_current_adv_steps = 0; + if (stepper_extruder != last_moved_extruder) LA_current_adv_steps = 0; #endif if ((LA_use_advance_lead = current_block->use_advance_lead)) { @@ -1751,13 +1753,13 @@ uint32_t Stepper::stepper_block_phase_isr() { #endif if (current_block->direction_bits != last_direction_bits - #if DISABLED(MIXING_EXTRUDER) - || active_extruder != last_moved_extruder - #endif + #if DISABLED(MIXING_EXTRUDER) + || stepper_extruder != last_moved_extruder + #endif ) { last_direction_bits = current_block->direction_bits; - #if DISABLED(MIXING_EXTRUDER) && EXTRUDERS > 1 - last_moved_extruder = active_extruder; + #if EXTRUDERS > 1 + last_moved_extruder = stepper_extruder; #endif set_directions(); } @@ -1827,15 +1829,17 @@ uint32_t Stepper::stepper_block_phase_isr() { interval = LA_ADV_NEVER; #if ENABLED(MIXING_EXTRUDER) + // We don't know which steppers will be stepped because LA loop follows, + // with potentially multiple steps. Set all. if (LA_steps >= 0) - MIXING_STEPPERS_LOOP(j) NORM_E_DIR(j); + MIXER_STEPPER_LOOP(j) NORM_E_DIR(j); else - MIXING_STEPPERS_LOOP(j) REV_E_DIR(j); + MIXER_STEPPER_LOOP(j) REV_E_DIR(j); #else if (LA_steps >= 0) - NORM_E_DIR(active_extruder); + NORM_E_DIR(stepper_extruder); else - REV_E_DIR(active_extruder); + REV_E_DIR(stepper_extruder); #endif // Get the timer count and estimate the end of the pulse @@ -1848,14 +1852,9 @@ uint32_t Stepper::stepper_block_phase_isr() { // Set the STEP pulse ON #if ENABLED(MIXING_EXTRUDER) - MIXING_STEPPERS_LOOP(j) { - // Step mixing steppers (proportionally) - delta_error_m[j] += advance_dividend_m[j]; - // Step when the counter goes over zero - if (delta_error_m[j] >= 0) E_STEP_WRITE(j, !INVERT_E_STEP_PIN); - } + E_STEP_WRITE(mixer.get_next_stepper(), !INVERT_E_STEP_PIN); #else - E_STEP_WRITE(active_extruder, !INVERT_E_STEP_PIN); + E_STEP_WRITE(stepper_extruder, !INVERT_E_STEP_PIN); #endif // Enforce a minimum duration for STEP pulse ON @@ -1871,14 +1870,9 @@ uint32_t Stepper::stepper_block_phase_isr() { // Set the STEP pulse OFF #if ENABLED(MIXING_EXTRUDER) - MIXING_STEPPERS_LOOP(j) { - if (delta_error_m[j] >= 0) { - delta_error_m[j] -= advance_divisor_m; - E_STEP_WRITE(j, INVERT_E_STEP_PIN); - } - } + E_STEP_WRITE(mixer.get_stepper(), INVERT_E_STEP_PIN); #else - E_STEP_WRITE(active_extruder, INVERT_E_STEP_PIN); + E_STEP_WRITE(stepper_extruder, INVERT_E_STEP_PIN); #endif // For minimum pulse time wait before looping @@ -2104,10 +2098,8 @@ void Stepper::init() { ENABLE_STEPPER_DRIVER_INTERRUPT(); - endstops.enable(true); // Start with endstops active. After homing they can be disabled sei(); - - set_directions(); // Init directions to last_direction_bits = 0 + set_directions(); // Init directions to last_direction_bits = 0 Keeps Z from being reversed } /** @@ -2225,21 +2217,21 @@ void Stepper::report_positions() { if (was_enabled) ENABLE_STEPPER_DRIVER_INTERRUPT(); - #if CORE_IS_XY || CORE_IS_XZ || IS_DELTA || IS_SCARA + #if CORE_IS_XY || CORE_IS_XZ || ENABLED(DELTA) || IS_SCARA SERIAL_PROTOCOLPGM(MSG_COUNT_A); #else SERIAL_PROTOCOLPGM(MSG_COUNT_X); #endif SERIAL_PROTOCOL(xpos); - #if CORE_IS_XY || CORE_IS_YZ || IS_DELTA || IS_SCARA + #if CORE_IS_XY || CORE_IS_YZ || ENABLED(DELTA) || IS_SCARA SERIAL_PROTOCOLPGM(" B:"); #else SERIAL_PROTOCOLPGM(" Y:"); #endif SERIAL_PROTOCOL(ypos); - #if CORE_IS_XZ || CORE_IS_YZ || IS_DELTA + #if CORE_IS_XZ || CORE_IS_YZ || ENABLED(DELTA) SERIAL_PROTOCOLPGM(" C:"); #else SERIAL_PROTOCOLPGM(" Z:"); @@ -2413,15 +2405,15 @@ void Stepper::report_positions() { #if HAS_MOTOR_CURRENT_PWM void Stepper::refresh_motor_power() { - for (uint8_t i = 0; i < COUNT(motor_current_setting); ++i) { + LOOP_L_N(i, COUNT(motor_current_setting)) { switch (i) { - #if PIN_EXISTS(MOTOR_CURRENT_PWM_XY) + #if PIN_EXISTS(MOTOR_CURRENT_PWM_XY) || PIN_EXISTS(MOTOR_CURRENT_PWM_X) || PIN_EXISTS(MOTOR_CURRENT_PWM_Y) case 0: #endif #if PIN_EXISTS(MOTOR_CURRENT_PWM_Z) case 1: #endif - #if PIN_EXISTS(MOTOR_CURRENT_PWM_E) + #if PIN_EXISTS(MOTOR_CURRENT_PWM_E) || PIN_EXISTS(MOTOR_CURRENT_PWM_E0) || PIN_EXISTS(MOTOR_CURRENT_PWM_E1) case 2: #endif digipot_current(i, motor_current_setting[i]); @@ -2434,7 +2426,7 @@ void Stepper::report_positions() { #if HAS_DIGIPOTSS || HAS_MOTOR_CURRENT_PWM - void Stepper::digipot_current(const uint8_t driver, const int current) { + void Stepper::digipot_current(const uint8_t driver, const int16_t current) { #if HAS_DIGIPOTSS @@ -2443,20 +2435,38 @@ void Stepper::report_positions() { #elif HAS_MOTOR_CURRENT_PWM - if (WITHIN(driver, 0, 2)) + if (WITHIN(driver, 0, COUNT(motor_current_setting) - 1)) motor_current_setting[driver] = current; // update motor_current_setting #define _WRITE_CURRENT_PWM(P) analogWrite(MOTOR_CURRENT_PWM_## P ##_PIN, 255L * current / (MOTOR_CURRENT_PWM_RANGE)) switch (driver) { - #if PIN_EXISTS(MOTOR_CURRENT_PWM_XY) - case 0: _WRITE_CURRENT_PWM(XY); break; - #endif - #if PIN_EXISTS(MOTOR_CURRENT_PWM_Z) - case 1: _WRITE_CURRENT_PWM(Z); break; - #endif - #if PIN_EXISTS(MOTOR_CURRENT_PWM_E) - case 2: _WRITE_CURRENT_PWM(E); break; - #endif + case 0: + #if PIN_EXISTS(MOTOR_CURRENT_PWM_X) + _WRITE_CURRENT_PWM(X); + #endif + #if PIN_EXISTS(MOTOR_CURRENT_PWM_Y) + _WRITE_CURRENT_PWM(Y); + #endif + #if PIN_EXISTS(MOTOR_CURRENT_PWM_XY) + _WRITE_CURRENT_PWM(XY); + #endif + break; + case 1: + #if PIN_EXISTS(MOTOR_CURRENT_PWM_Z) + _WRITE_CURRENT_PWM(Z); + #endif + break; + case 2: + #if PIN_EXISTS(MOTOR_CURRENT_PWM_E) + _WRITE_CURRENT_PWM(E); + #endif + #if PIN_EXISTS(MOTOR_CURRENT_PWM_E0) + _WRITE_CURRENT_PWM(E0); + #endif + #if PIN_EXISTS(MOTOR_CURRENT_PWM_E1) + _WRITE_CURRENT_PWM(E1); + #endif + break; } #endif } @@ -2477,6 +2487,12 @@ void Stepper::report_positions() { #elif HAS_MOTOR_CURRENT_PWM + #if PIN_EXISTS(MOTOR_CURRENT_PWM_X) + SET_OUTPUT(MOTOR_CURRENT_PWM_X_PIN); + #endif + #if PIN_EXISTS(MOTOR_CURRENT_PWM_Y) + SET_OUTPUT(MOTOR_CURRENT_PWM_Y_PIN); + #endif #if PIN_EXISTS(MOTOR_CURRENT_PWM_XY) SET_OUTPUT(MOTOR_CURRENT_PWM_XY_PIN); #endif @@ -2486,12 +2502,19 @@ void Stepper::report_positions() { #if PIN_EXISTS(MOTOR_CURRENT_PWM_E) SET_OUTPUT(MOTOR_CURRENT_PWM_E_PIN); #endif + #if PIN_EXISTS(MOTOR_CURRENT_PWM_E0) + SET_OUTPUT(MOTOR_CURRENT_PWM_E0_PIN); + #endif + #if PIN_EXISTS(MOTOR_CURRENT_PWM_E1) + SET_OUTPUT(MOTOR_CURRENT_PWM_E1_PIN); + #endif refresh_motor_power(); // Set Timer5 to 31khz so the PWM of the motor power is as constant as possible. (removes a buzzing noise) - SET_CS5(PRESCALER_1); - + #ifdef __AVR__ + SET_CS5(PRESCALER_1); + #endif #endif } @@ -2504,53 +2527,137 @@ void Stepper::report_positions() { */ void Stepper::microstep_init() { - SET_OUTPUT(X_MS1_PIN); - SET_OUTPUT(X_MS2_PIN); + #if HAS_X_MICROSTEPS + SET_OUTPUT(X_MS1_PIN); + SET_OUTPUT(X_MS2_PIN); + #if PIN_EXISTS(X_MS3) + SET_OUTPUT(X_MS3_PIN); + #endif + #endif + #if HAS_X2_MICROSTEPS + SET_OUTPUT(X2_MS1_PIN); + SET_OUTPUT(X2_MS2_PIN); + #if PIN_EXISTS(X2_MS3) + SET_OUTPUT(X2_MS3_PIN); + #endif + #endif #if HAS_Y_MICROSTEPS SET_OUTPUT(Y_MS1_PIN); SET_OUTPUT(Y_MS2_PIN); + #if PIN_EXISTS(Y_MS3) + SET_OUTPUT(Y_MS3_PIN); + #endif + #endif + #if HAS_Y2_MICROSTEPS + SET_OUTPUT(Y2_MS1_PIN); + SET_OUTPUT(Y2_MS2_PIN); + #if PIN_EXISTS(Y2_MS3) + SET_OUTPUT(Y2_MS3_PIN); + #endif #endif #if HAS_Z_MICROSTEPS SET_OUTPUT(Z_MS1_PIN); SET_OUTPUT(Z_MS2_PIN); + #if PIN_EXISTS(Z_MS3) + SET_OUTPUT(Z_MS3_PIN); + #endif + #endif + #if HAS_Z2_MICROSTEPS + SET_OUTPUT(Z2_MS1_PIN); + SET_OUTPUT(Z2_MS2_PIN); + #if PIN_EXISTS(Z2_MS3) + SET_OUTPUT(Z2_MS3_PIN); + #endif + #endif + #if HAS_Z3_MICROSTEPS + SET_OUTPUT(Z3_MS1_PIN); + SET_OUTPUT(Z3_MS2_PIN); + #if PIN_EXISTS(Z3_MS3) + SET_OUTPUT(Z3_MS3_PIN); + #endif #endif #if HAS_E0_MICROSTEPS SET_OUTPUT(E0_MS1_PIN); SET_OUTPUT(E0_MS2_PIN); + #if PIN_EXISTS(E0_MS3) + SET_OUTPUT(E0_MS3_PIN); + #endif #endif #if HAS_E1_MICROSTEPS SET_OUTPUT(E1_MS1_PIN); SET_OUTPUT(E1_MS2_PIN); + #if PIN_EXISTS(E1_MS3) + SET_OUTPUT(E1_MS3_PIN); + #endif #endif #if HAS_E2_MICROSTEPS SET_OUTPUT(E2_MS1_PIN); SET_OUTPUT(E2_MS2_PIN); + #if PIN_EXISTS(E2_MS3) + SET_OUTPUT(E2_MS3_PIN); + #endif #endif #if HAS_E3_MICROSTEPS SET_OUTPUT(E3_MS1_PIN); SET_OUTPUT(E3_MS2_PIN); + #if PIN_EXISTS(E3_MS3) + SET_OUTPUT(E3_MS3_PIN); + #endif #endif #if HAS_E4_MICROSTEPS SET_OUTPUT(E4_MS1_PIN); SET_OUTPUT(E4_MS2_PIN); + #if PIN_EXISTS(E4_MS3) + SET_OUTPUT(E4_MS3_PIN); + #endif #endif #if HAS_E5_MICROSTEPS SET_OUTPUT(E5_MS1_PIN); SET_OUTPUT(E5_MS2_PIN); + #if PIN_EXISTS(E5_MS3) + SET_OUTPUT(E5_MS3_PIN); + #endif #endif + static const uint8_t microstep_modes[] = MICROSTEP_MODES; for (uint16_t i = 0; i < COUNT(microstep_modes); i++) microstep_mode(i, microstep_modes[i]); } - void Stepper::microstep_ms(const uint8_t driver, const int8_t ms1, const int8_t ms2) { + void Stepper::microstep_ms(const uint8_t driver, const int8_t ms1, const int8_t ms2, const int8_t ms3) { if (ms1 >= 0) switch (driver) { - case 0: WRITE(X_MS1_PIN, ms1); break; - #if HAS_Y_MICROSTEPS - case 1: WRITE(Y_MS1_PIN, ms1); break; + #if HAS_X_MICROSTEPS || HAS_X2_MICROSTEPS + case 0: + #if HAS_X_MICROSTEPS + WRITE(X_MS1_PIN, ms1); + #endif + #if HAS_X2_MICROSTEPS + WRITE(X2_MS1_PIN, ms1); + #endif + break; #endif - #if HAS_Z_MICROSTEPS - case 2: WRITE(Z_MS1_PIN, ms1); break; + #if HAS_Y_MICROSTEPS || HAS_Y2_MICROSTEPS + case 1: + #if HAS_Y_MICROSTEPS + WRITE(Y_MS1_PIN, ms1); + #endif + #if HAS_Y2_MICROSTEPS + WRITE(Y2_MS1_PIN, ms1); + #endif + break; + #endif + #if HAS_Z_MICROSTEPS || HAS_Z2_MICROSTEPS || HAS_Z3_MICROSTEPS + case 2: + #if HAS_Z_MICROSTEPS + WRITE(Z_MS1_PIN, ms1); + #endif + #if HAS_Z2_MICROSTEPS + WRITE(Z2_MS1_PIN, ms1); + #endif + #if HAS_Z3_MICROSTEPS + WRITE(Z3_MS1_PIN, ms1); + #endif + break; #endif #if HAS_E0_MICROSTEPS case 3: WRITE(E0_MS1_PIN, ms1); break; @@ -2572,12 +2679,38 @@ void Stepper::report_positions() { #endif } if (ms2 >= 0) switch (driver) { - case 0: WRITE(X_MS2_PIN, ms2); break; - #if HAS_Y_MICROSTEPS - case 1: WRITE(Y_MS2_PIN, ms2); break; + #if HAS_X_MICROSTEPS || HAS_X2_MICROSTEPS + case 0: + #if HAS_X_MICROSTEPS + WRITE(X_MS2_PIN, ms2); + #endif + #if HAS_X2_MICROSTEPS + WRITE(X2_MS2_PIN, ms2); + #endif + break; #endif - #if HAS_Z_MICROSTEPS - case 2: WRITE(Z_MS2_PIN, ms2); break; + #if HAS_Y_MICROSTEPS || HAS_Y2_MICROSTEPS + case 1: + #if HAS_Y_MICROSTEPS + WRITE(Y_MS2_PIN, ms2); + #endif + #if HAS_Y2_MICROSTEPS + WRITE(Y2_MS2_PIN, ms2); + #endif + break; + #endif + #if HAS_Z_MICROSTEPS || HAS_Z2_MICROSTEPS || HAS_Z3_MICROSTEPS + case 2: + #if HAS_Z_MICROSTEPS + WRITE(Z_MS2_PIN, ms2); + #endif + #if HAS_Z2_MICROSTEPS + WRITE(Z2_MS2_PIN, ms2); + #endif + #if HAS_Z3_MICROSTEPS + WRITE(Z3_MS2_PIN, ms2); + #endif + break; #endif #if HAS_E0_MICROSTEPS case 3: WRITE(E0_MS2_PIN, ms2); break; @@ -2598,70 +2731,165 @@ void Stepper::report_positions() { case 8: WRITE(E5_MS2_PIN, ms2); break; #endif } + if (ms3 >= 0) switch (driver) { + #if HAS_X_MICROSTEPS || HAS_X2_MICROSTEPS + case 0: + #if HAS_X_MICROSTEPS && PIN_EXISTS(X_MS3) + WRITE(X_MS3_PIN, ms3); + #endif + #if HAS_X2_MICROSTEPS && PIN_EXISTS(X2_MS3) + WRITE(X2_MS3_PIN, ms3); + #endif + break; + #endif + #if HAS_Y_MICROSTEPS || HAS_Y2_MICROSTEPS + case 1: + #if HAS_Y_MICROSTEPS && PIN_EXISTS(Y_MS3) + WRITE(Y_MS3_PIN, ms3); + #endif + #if HAS_Y2_MICROSTEPS && PIN_EXISTS(Y2_MS3) + WRITE(Y2_MS3_PIN, ms3); + #endif + break; + #endif + #if HAS_Z_MICROSTEPS || HAS_Z2_MICROSTEPS || HAS_Z3_MICROSTEPS + case 2: + #if HAS_Z_MICROSTEPS && PIN_EXISTS(Z_MS3) + WRITE(Z_MS3_PIN, ms3); + #endif + #if HAS_Z2_MICROSTEPS && PIN_EXISTS(Z2_MS3) + WRITE(Z2_MS3_PIN, ms3); + #endif + #if HAS_Z3_MICROSTEPS && PIN_EXISTS(Z3_MS3) + WRITE(Z3_MS3_PIN, ms3); + #endif + break; + #endif + #if HAS_E0_MICROSTEPS && PIN_EXISTS(E0_MS3) + case 3: WRITE(E0_MS3_PIN, ms3); break; + #endif + #if HAS_E1_MICROSTEPS && PIN_EXISTS(E1_MS3) + case 4: WRITE(E1_MS3_PIN, ms3); break; + #endif + #if HAS_E2_MICROSTEPS && PIN_EXISTS(E2_MS3) + case 5: WRITE(E2_MS3_PIN, ms3); break; + #endif + #if HAS_E3_MICROSTEPS && PIN_EXISTS(E3_MS3) + case 6: WRITE(E3_MS3_PIN, ms3); break; + #endif + #if HAS_E4_MICROSTEPS && PIN_EXISTS(E4_MS3) + case 7: WRITE(E4_MS3_PIN, ms3); break; + #endif + #if HAS_E5_MICROSTEPS && PIN_EXISTS(E5_MS3) + case 8: WRITE(E5_MS3_PIN, ms3); break; + #endif + } } void Stepper::microstep_mode(const uint8_t driver, const uint8_t stepping_mode) { switch (stepping_mode) { - case 1: microstep_ms(driver, MICROSTEP1); break; - #if ENABLED(HEROIC_STEPPER_DRIVERS) - case 128: microstep_ms(driver, MICROSTEP128); break; - #else + #if HAS_MICROSTEP1 + case 1: microstep_ms(driver, MICROSTEP1); break; + #endif + #if HAS_MICROSTEP2 case 2: microstep_ms(driver, MICROSTEP2); break; + #endif + #if HAS_MICROSTEP4 case 4: microstep_ms(driver, MICROSTEP4); break; #endif - case 8: microstep_ms(driver, MICROSTEP8); break; - case 16: microstep_ms(driver, MICROSTEP16); break; - #if MB(ALLIGATOR) + #if HAS_MICROSTEP8 + case 8: microstep_ms(driver, MICROSTEP8); break; + #endif + #if HAS_MICROSTEP16 + case 16: microstep_ms(driver, MICROSTEP16); break; + #endif + #if HAS_MICROSTEP32 case 32: microstep_ms(driver, MICROSTEP32); break; #endif + #if HAS_MICROSTEP64 + case 64: microstep_ms(driver, MICROSTEP64); break; + #endif + #if HAS_MICROSTEP128 + case 128: microstep_ms(driver, MICROSTEP128); break; + #endif + default: SERIAL_ERROR_START(); SERIAL_ERRORLNPGM("Microsteps unavailable"); break; } } void Stepper::microstep_readings() { - SERIAL_PROTOCOLLNPGM("MS1,MS2 Pins"); + SERIAL_PROTOCOLLNPGM("MS1,MS2,MS3 Pins"); SERIAL_PROTOCOLPGM("X: "); - SERIAL_PROTOCOL(READ(X_MS1_PIN)); - SERIAL_PROTOCOLLN(READ(X_MS2_PIN)); + #if HAS_X_MICROSTEPS + SERIAL_PROTOCOL(READ(X_MS1_PIN)); + SERIAL_PROTOCOL(READ(X_MS2_PIN)); + #if PIN_EXISTS(X_MS3) + SERIAL_PROTOCOLLN(READ(X_MS3_PIN)); + #endif + #endif #if HAS_Y_MICROSTEPS SERIAL_PROTOCOLPGM("Y: "); SERIAL_PROTOCOL(READ(Y_MS1_PIN)); - SERIAL_PROTOCOLLN(READ(Y_MS2_PIN)); + SERIAL_PROTOCOL(READ(Y_MS2_PIN)); + #if PIN_EXISTS(Y_MS3) + SERIAL_PROTOCOLLN(READ(Y_MS3_PIN)); + #endif #endif #if HAS_Z_MICROSTEPS SERIAL_PROTOCOLPGM("Z: "); SERIAL_PROTOCOL(READ(Z_MS1_PIN)); - SERIAL_PROTOCOLLN(READ(Z_MS2_PIN)); + SERIAL_PROTOCOL(READ(Z_MS2_PIN)); + #if PIN_EXISTS(Z_MS3) + SERIAL_PROTOCOLLN(READ(Z_MS3_PIN)); + #endif #endif #if HAS_E0_MICROSTEPS SERIAL_PROTOCOLPGM("E0: "); SERIAL_PROTOCOL(READ(E0_MS1_PIN)); - SERIAL_PROTOCOLLN(READ(E0_MS2_PIN)); + SERIAL_PROTOCOL(READ(E0_MS2_PIN)); + #if PIN_EXISTS(E0_MS3) + SERIAL_PROTOCOLLN(READ(E0_MS3_PIN)); + #endif #endif #if HAS_E1_MICROSTEPS SERIAL_PROTOCOLPGM("E1: "); SERIAL_PROTOCOL(READ(E1_MS1_PIN)); - SERIAL_PROTOCOLLN(READ(E1_MS2_PIN)); + SERIAL_PROTOCOL(READ(E1_MS2_PIN)); + #if PIN_EXISTS(E1_MS3) + SERIAL_PROTOCOLLN(READ(E1_MS3_PIN)); + #endif #endif #if HAS_E2_MICROSTEPS SERIAL_PROTOCOLPGM("E2: "); SERIAL_PROTOCOL(READ(E2_MS1_PIN)); - SERIAL_PROTOCOLLN(READ(E2_MS2_PIN)); + SERIAL_PROTOCOL(READ(E2_MS2_PIN)); + #if PIN_EXISTS(E2_MS3) + SERIAL_PROTOCOLLN(READ(E2_MS3_PIN)); + #endif #endif #if HAS_E3_MICROSTEPS SERIAL_PROTOCOLPGM("E3: "); SERIAL_PROTOCOL(READ(E3_MS1_PIN)); - SERIAL_PROTOCOLLN(READ(E3_MS2_PIN)); + SERIAL_PROTOCOL(READ(E3_MS2_PIN)); + #if PIN_EXISTS(E3_MS3) + SERIAL_PROTOCOLLN(READ(E3_MS3_PIN)); + #endif #endif #if HAS_E4_MICROSTEPS SERIAL_PROTOCOLPGM("E4: "); SERIAL_PROTOCOL(READ(E4_MS1_PIN)); - SERIAL_PROTOCOLLN(READ(E4_MS2_PIN)); + SERIAL_PROTOCOL(READ(E4_MS2_PIN)); + #if PIN_EXISTS(E4_MS3) + SERIAL_PROTOCOLLN(READ(E4_MS3_PIN)); + #endif #endif #if HAS_E5_MICROSTEPS SERIAL_PROTOCOLPGM("E5: "); SERIAL_PROTOCOL(READ(E5_MS1_PIN)); SERIAL_PROTOCOLLN(READ(E5_MS2_PIN)); + #if PIN_EXISTS(E5_MS3) + SERIAL_PROTOCOLLN(READ(E5_MS3_PIN)); + #endif #endif } diff --git a/Marlin/src/module/stepper.h b/Marlin/src/module/stepper.h index 0ebe1d6e20..5f7cdc54cc 100644 --- a/Marlin/src/module/stepper.h +++ b/Marlin/src/module/stepper.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * stepper.h - stepper motor driver: executes motion plans of planner.c using the stepper motors @@ -40,9 +41,6 @@ * along with Grbl. If not, see . */ -#ifndef STEPPER_H -#define STEPPER_H - #include "../inc/MarlinConfig.h" // Disable multiple steps per ISR @@ -150,7 +148,12 @@ #define ISR_E_STEPPER_CYCLES ISR_STEPPER_CYCLES // If linear advance is disabled, then the loop also handles them -#if DISABLED(LIN_ADVANCE) && ENABLED(MIXING_EXTRUDER) +#if DISABLED(LIN_ADVANCE) && ENABLED(MIXING_EXTRUDER) // ToDo: ??? + // HELP ME: What is what? + // Directions are set up for MIXING_STEPPERS - like before. + // Finding the right stepper may last up to MIXING_STEPPERS loops in get_next_stepper(). + // These loops are a bit faster than advancing a bresenham counter. + // Always only one e-stepper is stepped. #define ISR_START_MIXING_STEPPER_CYCLES ((MIXING_STEPPERS) * (ISR_START_STEPPER_CYCLES)) #define ISR_MIXING_STEPPER_CYCLES ((MIXING_STEPPERS) * (ISR_STEPPER_CYCLES)) #else @@ -188,7 +191,12 @@ #if ENABLED(LIN_ADVANCE) // Estimate the minimum LA loop time - #if ENABLED(MIXING_EXTRUDER) + #if ENABLED(MIXING_EXTRUDER) // ToDo: ??? + // HELP ME: What is what? + // Directions are set up for MIXING_STEPPERS - like before. + // Finding the right stepper may last up to MIXING_STEPPERS loops in get_next_stepper(). + // These loops are a bit faster than advancing a bresenham counter. + // Always only one e-stepper is stepped. #define MIN_ISR_LA_LOOP_CYCLES ((MIXING_STEPPERS) * (ISR_STEPPER_CYCLES)) #else #define MIN_ISR_LA_LOOP_CYCLES ISR_STEPPER_CYCLES @@ -234,7 +242,7 @@ class Stepper { public: - #if ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS + #if ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS || ENABLED(Z_STEPPER_AUTO_ALIGN) static bool separate_multi_axis; #endif @@ -267,10 +275,10 @@ class Stepper { #if ENABLED(Y_DUAL_ENDSTOPS) static bool locked_Y_motor, locked_Y2_motor; #endif - #if Z_MULTI_ENDSTOPS + #if Z_MULTI_ENDSTOPS || ENABLED(Z_STEPPER_AUTO_ALIGN) static bool locked_Z_motor, locked_Z2_motor; #endif - #if ENABLED(Z_TRIPLE_ENDSTOPS) + #if ENABLED(Z_TRIPLE_ENDSTOPS) || (ENABLED(Z_STEPPER_AUTO_ALIGN) && ENABLED(Z_TRIPLE_STEPPER_DRIVERS)) static bool locked_Z3_motor; #endif @@ -292,17 +300,10 @@ class Stepper { decelerate_after, // The point from where we need to start decelerating step_event_count; // The total event count for the current block - // Mixing extruder mix delta_errors for bresenham tracing - #if ENABLED(MIXING_EXTRUDER) - static int32_t delta_error_m[MIXING_STEPPERS]; - static uint32_t advance_dividend_m[MIXING_STEPPERS], - advance_divisor_m; - #define MIXING_STEPPERS_LOOP(VAR) \ - for (uint8_t VAR = 0; VAR < MIXING_STEPPERS; VAR++) - #elif EXTRUDERS > 1 - static uint8_t active_extruder; + #if EXTRUDERS > 1 || ENABLED(MIXING_EXTRUDER) + static uint8_t stepper_extruder; #else - static constexpr uint8_t active_extruder = 0; + static constexpr uint8_t stepper_extruder = 0; #endif #if ENABLED(S_CURVE_ACCELERATION) @@ -413,12 +414,12 @@ class Stepper { #endif #if HAS_MICROSTEPS - static void microstep_ms(const uint8_t driver, const int8_t ms1, const int8_t ms2); + static void microstep_ms(const uint8_t driver, const int8_t ms1, const int8_t ms2, const int8_t ms3); static void microstep_mode(const uint8_t driver, const uint8_t stepping); static void microstep_readings(); #endif - #if ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS + #if ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS || ENABLED(Z_STEPPER_AUTO_ALIGN) FORCE_INLINE static void set_separate_multi_axis(const bool state) { separate_multi_axis = state; } #endif #if ENABLED(X_DUAL_ENDSTOPS) @@ -429,11 +430,11 @@ class Stepper { FORCE_INLINE static void set_y_lock(const bool state) { locked_Y_motor = state; } FORCE_INLINE static void set_y2_lock(const bool state) { locked_Y2_motor = state; } #endif - #if Z_MULTI_ENDSTOPS + #if Z_MULTI_ENDSTOPS || (ENABLED(Z_STEPPER_AUTO_ALIGN) && Z_MULTI_STEPPER_DRIVERS) FORCE_INLINE static void set_z_lock(const bool state) { locked_Z_motor = state; } FORCE_INLINE static void set_z2_lock(const bool state) { locked_Z2_motor = state; } #endif - #if ENABLED(Z_TRIPLE_ENDSTOPS) + #if ENABLED(Z_TRIPLE_ENDSTOPS) || (ENABLED(Z_STEPPER_AUTO_ALIGN) && ENABLED(Z_TRIPLE_STEPPER_DRIVERS)) FORCE_INLINE static void set_z3_lock(const bool state) { locked_Z3_motor = state; } #endif @@ -523,15 +524,15 @@ class Stepper { if (step_rate >= (8 * 256)) { // higher step rate const uint8_t tmp_step_rate = (step_rate & 0x00FF); const uint16_t table_address = (uint16_t)&speed_lookuptable_fast[(uint8_t)(step_rate >> 8)][0], - gain = (uint16_t)pgm_read_word_near(table_address + 2); + gain = (uint16_t)pgm_read_word(table_address + 2); timer = MultiU16X8toH16(tmp_step_rate, gain); - timer = (uint16_t)pgm_read_word_near(table_address) - timer; + timer = (uint16_t)pgm_read_word(table_address) - timer; } else { // lower step rates uint16_t table_address = (uint16_t)&speed_lookuptable_slow[0][0]; table_address += ((step_rate) >> 1) & 0xFFFC; - timer = (uint16_t)pgm_read_word_near(table_address) - - (((uint16_t)pgm_read_word_near(table_address + 2) * (uint8_t)(step_rate & 0x0007)) >> 3); + timer = (uint16_t)pgm_read_word(table_address) + - (((uint16_t)pgm_read_word(table_address + 2) * (uint8_t)(step_rate & 0x0007)) >> 3); } // (there is no need to limit the timer value here. All limits have been // applied above, and AVR is able to keep up at 30khz Stepping ISR rate) @@ -556,5 +557,3 @@ class Stepper { }; extern Stepper stepper; - -#endif // STEPPER_H diff --git a/Marlin/src/module/stepper_indirection.cpp b/Marlin/src/module/stepper_indirection.cpp index 1927cad230..bf0cb7f681 100644 --- a/Marlin/src/module/stepper_indirection.cpp +++ b/Marlin/src/module/stepper_indirection.cpp @@ -139,171 +139,104 @@ } #endif // TMC26X +#if HAS_TRINAMIC + #define _TMC_INIT(ST, SPMM) tmc_init(stepper##ST, ST##_CURRENT, ST##_MICROSTEPS, ST##_HYBRID_THRESHOLD, SPMM) +#endif + // // TMC2130 Driver objects and inits // #if HAS_DRIVER(TMC2130) #include - #include #include "planner.h" #include "../core/enum.h" - #if TMC2130STEPPER_VERSION < 0x020201 - #error "Update TMC2130Stepper library to 2.2.1 or newer." - #endif - #if ENABLED(TMC_USE_SW_SPI) - #define _TMC2130_DEFINE(ST) TMC2130Stepper stepper##ST(ST##_ENABLE_PIN, ST##_DIR_PIN, ST##_STEP_PIN, ST##_CS_PIN, TMC_SW_MOSI, TMC_SW_MISO, TMC_SW_SCK) + #define _TMC2130_DEFINE(ST, L) TMCMarlin stepper##ST(ST##_CS_PIN, R_SENSE, TMC_SW_MOSI, TMC_SW_MISO, TMC_SW_SCK) + #define TMC2130_DEFINE(ST) _TMC2130_DEFINE(ST, TMC_##ST##_LABEL) #else - #define _TMC2130_DEFINE(ST) TMC2130Stepper stepper##ST(ST##_ENABLE_PIN, ST##_DIR_PIN, ST##_STEP_PIN, ST##_CS_PIN) + #define _TMC2130_DEFINE(ST, L) TMCMarlin stepper##ST(ST##_CS_PIN, R_SENSE) + #define TMC2130_DEFINE(ST) _TMC2130_DEFINE(ST, TMC_##ST##_LABEL) #endif - // Stepper objects of TMC2130 steppers used #if AXIS_DRIVER_TYPE(X, TMC2130) - _TMC2130_DEFINE(X); + TMC2130_DEFINE(X); #endif #if AXIS_DRIVER_TYPE(X2, TMC2130) - _TMC2130_DEFINE(X2); + TMC2130_DEFINE(X2); #endif #if AXIS_DRIVER_TYPE(Y, TMC2130) - _TMC2130_DEFINE(Y); + TMC2130_DEFINE(Y); #endif #if AXIS_DRIVER_TYPE(Y2, TMC2130) - _TMC2130_DEFINE(Y2); + TMC2130_DEFINE(Y2); #endif #if AXIS_DRIVER_TYPE(Z, TMC2130) - _TMC2130_DEFINE(Z); + TMC2130_DEFINE(Z); #endif #if AXIS_DRIVER_TYPE(Z2, TMC2130) - _TMC2130_DEFINE(Z2); + TMC2130_DEFINE(Z2); #endif #if AXIS_DRIVER_TYPE(Z3, TMC2130) - _TMC2130_DEFINE(Z3); + TMC2130_DEFINE(Z3); #endif #if AXIS_DRIVER_TYPE(E0, TMC2130) - _TMC2130_DEFINE(E0); + TMC2130_DEFINE(E0); #endif #if AXIS_DRIVER_TYPE(E1, TMC2130) - _TMC2130_DEFINE(E1); + TMC2130_DEFINE(E1); #endif #if AXIS_DRIVER_TYPE(E2, TMC2130) - _TMC2130_DEFINE(E2); + TMC2130_DEFINE(E2); #endif #if AXIS_DRIVER_TYPE(E3, TMC2130) - _TMC2130_DEFINE(E3); + TMC2130_DEFINE(E3); #endif #if AXIS_DRIVER_TYPE(E4, TMC2130) - _TMC2130_DEFINE(E4); + TMC2130_DEFINE(E4); #endif #if AXIS_DRIVER_TYPE(E5, TMC2130) - _TMC2130_DEFINE(E5); + TMC2130_DEFINE(E5); #endif - // Use internal reference voltage for current calculations. This is the default. - // Following values from Trinamic's spreadsheet with values for a NEMA17 (42BYGHW609) - // https://www.trinamic.com/products/integrated-circuits/details/tmc2130/ - void tmc2130_init(TMC2130Stepper &st, const uint16_t mA, const uint16_t microsteps, const uint32_t thrs, const float spmm) { + template + void tmc_init(TMCMarlin &st, const uint16_t mA, const uint16_t microsteps, const uint32_t thrs, const float spmm) { #if DISABLED(STEALTHCHOP) || DISABLED(HYBRID_THRESHOLD) UNUSED(thrs); UNUSED(spmm); #endif st.begin(); - st.setCurrent(mA, R_SENSE, HOLD_MULTIPLIER); + + CHOPCONF_t chopconf{0}; + chopconf.tbl = 1; + chopconf.toff = 3; + chopconf.intpol = INTERPOLATE; + chopconf.hstrt = 2; + chopconf.hend = 5; + st.CHOPCONF(chopconf.sr); + + st.rms_current(mA, HOLD_MULTIPLIER); st.microsteps(microsteps); - st.blank_time(24); - st.off_time(5); // Only enables the driver if used with stealthChop - st.interpolate(INTERPOLATE); - st.power_down_delay(128); // ~2s until driver lowers to hold current - st.hysteresis_start(3); - st.hysteresis_end(2); + st.iholddelay(10); + st.TPOWERDOWN(128); // ~2s until driver lowers to hold current + #if ENABLED(STEALTHCHOP) - st.stealth_freq(1); // f_pwm = 2/683 f_clk - st.stealth_autoscale(1); - st.stealth_gradient(5); - st.stealth_amplitude(255); - st.stealthChop(1); + st.en_pwm_mode(true); + + PWMCONF_t pwmconf{0}; + pwmconf.pwm_freq = 0b01; // f_pwm = 2/683 f_clk + pwmconf.pwm_autoscale = true; + pwmconf.pwm_grad = 5; + pwmconf.pwm_ampl = 180; + st.PWMCONF(pwmconf.sr); + #if ENABLED(HYBRID_THRESHOLD) - st.stealth_max_speed(12650000UL*microsteps/(256*thrs*spmm)); + st.TPWMTHRS(12650000UL*microsteps/(256*thrs*spmm)); #endif #endif st.GSTAT(); // Clear GSTAT } - - #define _TMC2130_INIT(ST, SPMM) tmc2130_init(stepper##ST, ST##_CURRENT, ST##_MICROSTEPS, ST##_HYBRID_THRESHOLD, SPMM) - - void tmc2130_init_to_defaults() { - #if AXIS_DRIVER_TYPE(X, TMC2130) - _TMC2130_INIT( X, planner.axis_steps_per_mm[X_AXIS]); - #endif - #if AXIS_DRIVER_TYPE(X2, TMC2130) - _TMC2130_INIT(X2, planner.axis_steps_per_mm[X_AXIS]); - #endif - #if AXIS_DRIVER_TYPE(Y, TMC2130) - _TMC2130_INIT( Y, planner.axis_steps_per_mm[Y_AXIS]); - #endif - #if AXIS_DRIVER_TYPE(Y2, TMC2130) - _TMC2130_INIT(Y2, planner.axis_steps_per_mm[Y_AXIS]); - #endif - #if AXIS_DRIVER_TYPE(Z, TMC2130) - _TMC2130_INIT( Z, planner.axis_steps_per_mm[Z_AXIS]); - #endif - #if AXIS_DRIVER_TYPE(Z2, TMC2130) - _TMC2130_INIT(Z2, planner.axis_steps_per_mm[Z_AXIS]); - #endif - #if AXIS_DRIVER_TYPE(Z3, TMC2130) - _TMC2130_INIT(Z3, planner.axis_steps_per_mm[Z_AXIS]); - #endif - #if AXIS_DRIVER_TYPE(E0, TMC2130) - _TMC2130_INIT(E0, planner.axis_steps_per_mm[E_AXIS]); - #endif - #if AXIS_DRIVER_TYPE(E1, TMC2130) - { constexpr uint8_t extruder = 1; _TMC2130_INIT(E1, planner.axis_steps_per_mm[E_AXIS_N]); UNUSED(extruder); } - #endif - #if AXIS_DRIVER_TYPE(E2, TMC2130) - { constexpr uint8_t extruder = 2; _TMC2130_INIT(E2, planner.axis_steps_per_mm[E_AXIS_N]); UNUSED(extruder); } - #endif - #if AXIS_DRIVER_TYPE(E3, TMC2130) - { constexpr uint8_t extruder = 3; _TMC2130_INIT(E3, planner.axis_steps_per_mm[E_AXIS_N]); UNUSED(extruder); } - #endif - #if AXIS_DRIVER_TYPE(E4, TMC2130) - { constexpr uint8_t extruder = 4; _TMC2130_INIT(E4, planner.axis_steps_per_mm[E_AXIS_N]); UNUSED(extruder); } - #endif - #if AXIS_DRIVER_TYPE(E5, TMC2130) - { constexpr uint8_t extruder = 5; _TMC2130_INIT(E5, planner.axis_steps_per_mm[E_AXIS_N]); UNUSED(extruder); } - #endif - - #if ENABLED(SENSORLESS_HOMING) - #define TMC_INIT_SGT(P,Q) stepper##Q.sgt(P##_HOMING_SENSITIVITY); - #if X_SENSORLESS - #if AXIS_DRIVER_TYPE(X, TMC2130) - stepperX.sgt(X_HOMING_SENSITIVITY); - #endif - #if AXIS_DRIVER_TYPE(X2, TMC2130) - stepperX2.sgt(X_HOMING_SENSITIVITY); - #endif - #endif - #if Y_SENSORLESS - #if AXIS_DRIVER_TYPE(Y, TMC2130) - stepperY.sgt(Y_HOMING_SENSITIVITY); - #endif - #if AXIS_DRIVER_TYPE(Y2, TMC2130) - stepperY2.sgt(Y_HOMING_SENSITIVITY); - #endif - #endif - #if Z_SENSORLESS - #if AXIS_DRIVER_TYPE(Z, TMC2130) - stepperZ.sgt(Z_HOMING_SENSITIVITY); - #endif - #if AXIS_DRIVER_TYPE(Z2, TMC2130) - stepperZ2.sgt(Z_HOMING_SENSITIVITY); - #endif - #if ENABLED(Z3_IS_TMC2130) - stepperZ3.sgt(Z_HOMING_SENSITIVITY); - #endif - #endif - #endif - } #endif // TMC2130 // @@ -311,106 +244,104 @@ // #if HAS_DRIVER(TMC2208) #include - #include #include "planner.h" - #if TMC2208STEPPER_VERSION < 0x000101 - #error "Update TMC2208Stepper library to 0.1.1 or newer." - #endif + #define _TMC2208_DEFINE_HARDWARE(ST, L) TMCMarlin stepper##ST(&ST##_HARDWARE_SERIAL, R_SENSE) + #define TMC2208_DEFINE_HARDWARE(ST) _TMC2208_DEFINE_HARDWARE(ST, TMC_##ST##_LABEL) - #define _TMC2208_DEFINE_HARDWARE(ST) TMC2208Stepper stepper##ST(&ST##_HARDWARE_SERIAL) - #define _TMC2208_DEFINE_SOFTWARE(ST) TMC2208Stepper stepper##ST(ST##_SERIAL_RX_PIN, ST##_SERIAL_TX_PIN, ST##_SERIAL_RX_PIN > -1) + #define _TMC2208_DEFINE_SOFTWARE(ST, L) TMCMarlin stepper##ST(ST##_SERIAL_RX_PIN, ST##_SERIAL_TX_PIN, R_SENSE, ST##_SERIAL_RX_PIN > -1) + #define TMC2208_DEFINE_SOFTWARE(ST) _TMC2208_DEFINE_SOFTWARE(ST, TMC_##ST##_LABEL) // Stepper objects of TMC2208 steppers used #if AXIS_DRIVER_TYPE(X, TMC2208) #ifdef X_HARDWARE_SERIAL - _TMC2208_DEFINE_HARDWARE(X); + TMC2208_DEFINE_HARDWARE(X); #else - _TMC2208_DEFINE_SOFTWARE(X); + TMC2208_DEFINE_SOFTWARE(X); #endif #endif #if AXIS_DRIVER_TYPE(X2, TMC2208) #ifdef X2_HARDWARE_SERIAL - _TMC2208_DEFINE_HARDWARE(X2); + TMC2208_DEFINE_HARDWARE(X2); #else - _TMC2208_DEFINE_SOFTWARE(X2); + TMC2208_DEFINE_SOFTWARE(X2); #endif #endif #if AXIS_DRIVER_TYPE(Y, TMC2208) #ifdef Y_HARDWARE_SERIAL - _TMC2208_DEFINE_HARDWARE(Y); + TMC2208_DEFINE_HARDWARE(Y); #else - _TMC2208_DEFINE_SOFTWARE(Y); + TMC2208_DEFINE_SOFTWARE(Y); #endif #endif #if AXIS_DRIVER_TYPE(Y2, TMC2208) #ifdef Y2_HARDWARE_SERIAL - _TMC2208_DEFINE_HARDWARE(Y2); + TMC2208_DEFINE_HARDWARE(Y2); #else - _TMC2208_DEFINE_SOFTWARE(Y2); + TMC2208_DEFINE_SOFTWARE(Y2); #endif #endif #if AXIS_DRIVER_TYPE(Z, TMC2208) #ifdef Z_HARDWARE_SERIAL - _TMC2208_DEFINE_HARDWARE(Z); + TMC2208_DEFINE_HARDWARE(Z); #else - _TMC2208_DEFINE_SOFTWARE(Z); + TMC2208_DEFINE_SOFTWARE(Z); #endif #endif #if AXIS_DRIVER_TYPE(Z2, TMC2208) #ifdef Z2_HARDWARE_SERIAL - _TMC2208_DEFINE_HARDWARE(Z2); + TMC2208_DEFINE_HARDWARE(Z2); #else - _TMC2208_DEFINE_SOFTWARE(Z2); + TMC2208_DEFINE_SOFTWARE(Z2); #endif #endif #if AXIS_DRIVER_TYPE(Z3, TMC2208) #ifdef Z3_HARDWARE_SERIAL - _TMC2208_DEFINE_HARDWARE(Z3); + TMC2208_DEFINE_HARDWARE(Z3); #else - _TMC2208_DEFINE_SOFTWARE(Z3); + TMC2208_DEFINE_SOFTWARE(Z3); #endif #endif #if AXIS_DRIVER_TYPE(E0, TMC2208) #ifdef E0_HARDWARE_SERIAL - _TMC2208_DEFINE_HARDWARE(E0); + TMC2208_DEFINE_HARDWARE(E0); #else - _TMC2208_DEFINE_SOFTWARE(E0); + TMC2208_DEFINE_SOFTWARE(E0); #endif #endif #if AXIS_DRIVER_TYPE(E1, TMC2208) #ifdef E1_HARDWARE_SERIAL - _TMC2208_DEFINE_HARDWARE(E1); + TMC2208_DEFINE_HARDWARE(E1); #else - _TMC2208_DEFINE_SOFTWARE(E1); + TMC2208_DEFINE_SOFTWARE(E1); #endif #endif #if AXIS_DRIVER_TYPE(E2, TMC2208) #ifdef E2_HARDWARE_SERIAL - _TMC2208_DEFINE_HARDWARE(E2); + TMC2208_DEFINE_HARDWARE(E2); #else - _TMC2208_DEFINE_SOFTWARE(E2); + TMC2208_DEFINE_SOFTWARE(E2); #endif #endif #if AXIS_DRIVER_TYPE(E3, TMC2208) #ifdef E3_HARDWARE_SERIAL - _TMC2208_DEFINE_HARDWARE(E3); + TMC2208_DEFINE_HARDWARE(E3); #else - _TMC2208_DEFINE_SOFTWARE(E3); + TMC2208_DEFINE_SOFTWARE(E3); #endif #endif #if AXIS_DRIVER_TYPE(E4, TMC2208) #ifdef E4_HARDWARE_SERIAL - _TMC2208_DEFINE_HARDWARE(E4); + TMC2208_DEFINE_HARDWARE(E4); #else - _TMC2208_DEFINE_SOFTWARE(E4); + TMC2208_DEFINE_SOFTWARE(E4); #endif #endif #if AXIS_DRIVER_TYPE(E5, TMC2208) #ifdef E5_HARDWARE_SERIAL - _TMC2208_DEFINE_HARDWARE(E5); + TMC2208_DEFINE_HARDWARE(E5); #else - _TMC2208_DEFINE_SOFTWARE(E5); + TMC2208_DEFINE_SOFTWARE(E5); #endif #endif @@ -508,87 +439,122 @@ #endif } - // Use internal reference voltage for current calculations. This is the default. - // Following values from Trinamic's spreadsheet with values for a NEMA17 (42BYGHW609) - void tmc2208_init(TMC2208Stepper &st, const uint16_t mA, const uint16_t microsteps, const uint32_t thrs, const float spmm) { - st.pdn_disable(true); // Use UART - st.mstep_reg_select(true); // Select microsteps with UART - st.I_scale_analog(false); - st.rms_current(mA, HOLD_MULTIPLIER, R_SENSE); + template + void tmc_init(TMCMarlin &st, const uint16_t mA, const uint16_t microsteps, const uint32_t thrs, const float spmm) { + #if DISABLED(STEALTHCHOP) || DISABLED(HYBRID_THRESHOLD) + UNUSED(thrs); + UNUSED(spmm); + #endif + + TMC2208_n::GCONF_t gconf{0}; + gconf.pdn_disable = true; // Use UART + gconf.mstep_reg_select = true; // Select microsteps with UART + gconf.i_scale_analog = false; + + TMC2208_n::CHOPCONF_t chopconf{0}; + chopconf.tbl = 0b01; // blank_time = 24 + chopconf.toff = 5; + chopconf.intpol = INTERPOLATE; + chopconf.hstrt = 2; + chopconf.hend = 5; + st.CHOPCONF(chopconf.sr); + + st.rms_current(mA, HOLD_MULTIPLIER); st.microsteps(microsteps); - st.blank_time(24); - st.toff(5); - st.intpol(INTERPOLATE); + st.iholddelay(10); st.TPOWERDOWN(128); // ~2s until driver lowers to hold current - st.hysteresis_start(3); - st.hysteresis_end(2); #if ENABLED(STEALTHCHOP) - st.pwm_lim(12); - st.pwm_reg(8); - st.pwm_autograd(1); - st.pwm_autoscale(1); - st.pwm_freq(1); - st.pwm_grad(14); - st.pwm_ofs(36); - st.en_spreadCycle(false); + gconf.en_spreadcycle = false; + + TMC2208_n::PWMCONF_t pwmconf{0}; + pwmconf.pwm_lim = 12; + pwmconf.pwm_reg = 8; + pwmconf.pwm_autograd = true; + pwmconf.pwm_autoscale = true; + pwmconf.pwm_freq = 0b01; + pwmconf.pwm_grad = 14; + pwmconf.pwm_ofs = 36; + st.PWMCONF(pwmconf.sr); #if ENABLED(HYBRID_THRESHOLD) st.TPWMTHRS(12650000UL*microsteps/(256*thrs*spmm)); - #else - UNUSED(thrs); - UNUSED(spmm); #endif #else - st.en_spreadCycle(true); + gconf.en_spreadcycle = true; #endif + st.GCONF(gconf.sr); st.GSTAT(0b111); // Clear delay(200); } - - #define _TMC2208_INIT(ST, SPMM) tmc2208_init(stepper##ST, ST##_CURRENT, ST##_MICROSTEPS, ST##_HYBRID_THRESHOLD, SPMM) - - void tmc2208_init_to_defaults() { - #if AXIS_DRIVER_TYPE(X, TMC2208) - _TMC2208_INIT(X, planner.axis_steps_per_mm[X_AXIS]); - #endif - #if AXIS_DRIVER_TYPE(X2, TMC2208) - _TMC2208_INIT(X2, planner.axis_steps_per_mm[X_AXIS]); - #endif - #if AXIS_DRIVER_TYPE(Y, TMC2208) - _TMC2208_INIT(Y, planner.axis_steps_per_mm[Y_AXIS]); - #endif - #if AXIS_DRIVER_TYPE(Y2, TMC2208) - _TMC2208_INIT(Y2, planner.axis_steps_per_mm[Y_AXIS]); - #endif - #if AXIS_DRIVER_TYPE(Z, TMC2208) - _TMC2208_INIT(Z, planner.axis_steps_per_mm[Z_AXIS]); - #endif - #if AXIS_DRIVER_TYPE(Z2, TMC2208) - _TMC2208_INIT(Z2, planner.axis_steps_per_mm[Z_AXIS]); - #endif - #if AXIS_DRIVER_TYPE(Z3, TMC2208) - _TMC2208_INIT(Z3, planner.axis_steps_per_mm[Z_AXIS]); - #endif - #if AXIS_DRIVER_TYPE(E0, TMC2208) - _TMC2208_INIT(E0, planner.axis_steps_per_mm[E_AXIS]); - #endif - #if AXIS_DRIVER_TYPE(E1, TMC2208) - { constexpr int extruder = 1; _TMC2208_INIT(E1, planner.axis_steps_per_mm[E_AXIS_N]); } - #endif - #if AXIS_DRIVER_TYPE(E2, TMC2208) - { constexpr int extruder = 2; _TMC2208_INIT(E2, planner.axis_steps_per_mm[E_AXIS_N]); } - #endif - #if AXIS_DRIVER_TYPE(E3, TMC2208) - { constexpr int extruder = 3; _TMC2208_INIT(E3, planner.axis_steps_per_mm[E_AXIS_N]); } - #endif - #if AXIS_DRIVER_TYPE(E4, TMC2208) - { constexpr int extruder = 4; _TMC2208_INIT(E4, planner.axis_steps_per_mm[E_AXIS_N]); } - #endif - #if AXIS_DRIVER_TYPE(E5, TMC2208) - { constexpr int extruder = 5; _TMC2208_INIT(E5, planner.axis_steps_per_mm[E_AXIS_N]); } - #endif - } #endif // TMC2208 +// +// TMC2660 Driver objects and inits +// +#if HAS_DRIVER(TMC2660) + + #include + #include "planner.h" + #include "../core/enum.h" + + #if ENABLED(TMC_USE_SW_SPI) + #define _TMC2660_DEFINE(ST, L) TMCMarlin stepper##ST(ST##_CS_PIN, R_SENSE, TMC_SW_MOSI, TMC_SW_MISO, TMC_SW_SCK) + #define TMC2660_DEFINE(ST) _TMC2660_DEFINE(ST, TMC_##ST##_LABEL) + #else + #define _TMC2660_DEFINE(ST, L) TMCMarlin stepper##ST(ST##_CS_PIN, R_SENSE) + #define TMC2660_DEFINE(ST) _TMC2660_DEFINE(ST, TMC_##ST##_LABEL) + #endif + + // Stepper objects of TMC2660 steppers used + #if AXIS_DRIVER_TYPE(X, TMC2660) + TMC2660_DEFINE(X); + #endif + #if AXIS_DRIVER_TYPE(X2, TMC2660) + TMC2660_DEFINE(X2); + #endif + #if AXIS_DRIVER_TYPE(Y, TMC2660) + TMC2660_DEFINE(Y); + #endif + #if AXIS_DRIVER_TYPE(Y2, TMC2660) + TMC2660_DEFINE(Y2); + #endif + #if AXIS_DRIVER_TYPE(Z, TMC2660) + TMC2660_DEFINE(Z); + #endif + #if AXIS_DRIVER_TYPE(Z2, TMC2660) + TMC2660_DEFINE(Z2); + #endif + #if AXIS_DRIVER_TYPE(E0, TMC2660) + TMC2660_DEFINE(E0); + #endif + #if AXIS_DRIVER_TYPE(E1, TMC2660) + TMC2660_DEFINE(E1); + #endif + #if AXIS_DRIVER_TYPE(E2, TMC2660) + TMC2660_DEFINE(E2); + #endif + #if AXIS_DRIVER_TYPE(E3, TMC2660) + TMC2660_DEFINE(E3); + #endif + #if AXIS_DRIVER_TYPE(E4, TMC2660) + TMC2660_DEFINE(E4); + #endif + #if AXIS_DRIVER_TYPE(E5, TMC2660) + TMC2660_DEFINE(E5); + #endif + + template + void tmc_init(TMCMarlin &st, const uint16_t mA, const uint16_t microsteps, const uint32_t, const float) { + st.begin(); + st.rms_current(mA); + st.microsteps(microsteps); + st.blank_time(24); + st.toff(5); // Only enables the driver if used with stealthChop + st.intpol(INTERPOLATE); + //st.hysteresis_start(3); + //st.hysteresis_end(2); + } +#endif // TMC2660 + void restore_stepper_drivers() { #if AXIS_IS_TMC(X) stepperX.push(); @@ -635,20 +601,84 @@ void reset_stepper_drivers() { #if HAS_DRIVER(TMC26X) tmc26x_init_to_defaults(); #endif - #if HAS_DRIVER(TMC2130) - delay(100); - tmc2130_init_to_defaults(); + #if ENABLED(HAVE_L6470DRIVER) + L6470_init_to_defaults(); #endif - #if HAS_DRIVER(TMC2208) - delay(100); - tmc2208_init_to_defaults(); + + #if AXIS_IS_TMC(X) + _TMC_INIT(X, planner.settings.axis_steps_per_mm[X_AXIS]); #endif + #if AXIS_IS_TMC(X2) + _TMC_INIT(X2, planner.settings.axis_steps_per_mm[X_AXIS]); + #endif + #if AXIS_IS_TMC(Y) + _TMC_INIT(Y, planner.settings.axis_steps_per_mm[Y_AXIS]); + #endif + #if AXIS_IS_TMC(Y2) + _TMC_INIT(Y2, planner.settings.axis_steps_per_mm[Y_AXIS]); + #endif + #if AXIS_IS_TMC(Z) + _TMC_INIT(Z, planner.settings.axis_steps_per_mm[Z_AXIS]); + #endif + #if AXIS_IS_TMC(Z2) + _TMC_INIT(Z2, planner.settings.axis_steps_per_mm[Z_AXIS]); + #endif + #if AXIS_IS_TMC(Z3) + _TMC_INIT(Z3, planner.settings.axis_steps_per_mm[Z_AXIS]); + #endif + #if AXIS_IS_TMC(E0) + _TMC_INIT(E0, planner.settings.axis_steps_per_mm[E_AXIS_N(0)]); + #endif + #if AXIS_IS_TMC(E1) + _TMC_INIT(E1, planner.settings.axis_steps_per_mm[E_AXIS_N(1)]); + #endif + #if AXIS_IS_TMC(E2) + _TMC_INIT(E2, planner.settings.axis_steps_per_mm[E_AXIS_N(2)]); + #endif + #if AXIS_IS_TMC(E3) + _TMC_INIT(E3, planner.settings.axis_steps_per_mm[E_AXIS_N(3)]); + #endif + #if AXIS_IS_TMC(E4) + _TMC_INIT(E4, planner.settings.axis_steps_per_mm[E_AXIS_N(4)]); + #endif + #if AXIS_IS_TMC(E5) + _TMC_INIT(E5, planner.settings.axis_steps_per_mm[E_AXIS_N(5)]); + #endif + + #if USE_SENSORLESS + #if X_SENSORLESS + #if AXIS_HAS_STALLGUARD(X) + stepperX.sgt(X_STALL_SENSITIVITY); + #endif + #if AXIS_HAS_STALLGUARD(X2) + stepperX2.sgt(X_STALL_SENSITIVITY); + #endif + #endif + #if Y_SENSORLESS + #if AXIS_HAS_STALLGUARD(Y) + stepperY.sgt(Y_STALL_SENSITIVITY); + #endif + #if AXIS_HAS_STALLGUARD(Y2) + stepperY2.sgt(Y_STALL_SENSITIVITY); + #endif + #endif + #if Z_SENSORLESS + #if AXIS_HAS_STALLGUARD(Z) + stepperZ.sgt(Z_STALL_SENSITIVITY); + #endif + #if AXIS_HAS_STALLGUARD(Z2) + stepperZ2.sgt(Z_STALL_SENSITIVITY); + #endif + #if AXIS_HAS_STALLGUARD(Z3) + stepperZ3.sgt(Z_STALL_SENSITIVITY); + #endif + #endif + #endif + #ifdef TMC_ADV TMC_ADV() #endif - #if HAS_DRIVER(L6470) - L6470_init_to_defaults(); - #endif + stepper.set_directions(); } diff --git a/Marlin/src/module/stepper_indirection.h b/Marlin/src/module/stepper_indirection.h index 1a615e395c..1b0e6c883d 100644 --- a/Marlin/src/module/stepper_indirection.h +++ b/Marlin/src/module/stepper_indirection.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * stepper_indirection.h - stepper motor driver indirection macros @@ -41,9 +42,6 @@ * along with Marlin. If not, see . */ -#ifndef STEPPER_INDIRECTION_H -#define STEPPER_INDIRECTION_H - #include "../inc/MarlinConfig.h" // TMC26X drivers have STEP/DIR on normal pins, but ENABLE via SPI @@ -57,15 +55,20 @@ void tmc26x_init_to_defaults(); #endif -#if HAS_DRIVER(TMC2130) - #include - void tmc2130_init_to_defaults(); -#endif +#if HAS_TRINAMIC + #include + #include "../feature/tmc_util.h" + #if TMCSTEPPER_VERSION < 0x000202 + #error "Update TMCStepper library to 0.2.2 or newer." + #endif -#if HAS_DRIVER(TMC2208) - #include - void tmc2208_serial_begin(); - void tmc2208_init_to_defaults(); + #define __TMC_CLASS(MODEL, A, I) TMCMarlin + #define _TMC_CLASS(MODEL, L) __TMC_CLASS(MODEL, L) + #define TMC_CLASS(ST) _TMC_CLASS(ST##_DRIVER_TYPE, TMC_##ST##_LABEL) + + #if HAS_DRIVER(TMC2208) + void tmc2208_serial_begin(); + #endif #endif // L6470 has STEP on normal pins, but DIR/ENABLE via SPI @@ -88,17 +91,19 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset #define X_DIR_WRITE(STATE) stepperX.Step_Clock(STATE) #define X_DIR_READ (stepperX.getStatus() & STATUS_DIR) #else + #if AXIS_IS_TMC(X) + extern TMC_CLASS(X) stepperX; + #endif #if AXIS_DRIVER_TYPE(X, TMC26X) extern TMC26XStepper stepperX; #define X_ENABLE_INIT NOOP #define X_ENABLE_WRITE(STATE) stepperX.setEnabled(STATE) #define X_ENABLE_READ stepperX.isEnabled() + #elif AXIS_DRIVER_TYPE(X, TMC2660) + #define X_ENABLE_INIT NOOP + #define X_ENABLE_WRITE(STATE) stepperX.toff((STATE)==X_ENABLE_ON ? stepperX.savedToff() : 0) + #define X_ENABLE_READ stepperX.isEnabled() #else - #if AXIS_DRIVER_TYPE(X, TMC2130) - extern TMC2130Stepper stepperX; - #elif AXIS_DRIVER_TYPE(X, TMC2208) - extern TMC2208Stepper stepperX; - #endif #define X_ENABLE_INIT SET_OUTPUT(X_ENABLE_PIN) #define X_ENABLE_WRITE(STATE) WRITE(X_ENABLE_PIN,STATE) #define X_ENABLE_READ READ(X_ENABLE_PIN) @@ -121,17 +126,19 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset #define Y_DIR_WRITE(STATE) stepperY.Step_Clock(STATE) #define Y_DIR_READ (stepperY.getStatus() & STATUS_DIR) #else + #if AXIS_IS_TMC(Y) + extern TMC_CLASS(Y) stepperY; + #endif #if AXIS_DRIVER_TYPE(Y, TMC26X) extern TMC26XStepper stepperY; #define Y_ENABLE_INIT NOOP #define Y_ENABLE_WRITE(STATE) stepperY.setEnabled(STATE) #define Y_ENABLE_READ stepperY.isEnabled() + #elif AXIS_DRIVER_TYPE(Y, TMC2660) + #define Y_ENABLE_INIT NOOP + #define Y_ENABLE_WRITE(STATE) stepperY.toff((STATE)==Y_ENABLE_ON ? stepperY.savedToff() : 0) + #define Y_ENABLE_READ stepperY.isEnabled() #else - #if AXIS_DRIVER_TYPE(Y, TMC2130) - extern TMC2130Stepper stepperY; - #elif AXIS_DRIVER_TYPE(Y, TMC2208) - extern TMC2208Stepper stepperY; - #endif #define Y_ENABLE_INIT SET_OUTPUT(Y_ENABLE_PIN) #define Y_ENABLE_WRITE(STATE) WRITE(Y_ENABLE_PIN,STATE) #define Y_ENABLE_READ READ(Y_ENABLE_PIN) @@ -154,17 +161,19 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset #define Z_DIR_WRITE(STATE) stepperZ.Step_Clock(STATE) #define Z_DIR_READ (stepperZ.getStatus() & STATUS_DIR) #else + #if AXIS_IS_TMC(Z) + extern TMC_CLASS(Z) stepperZ; + #endif #if AXIS_DRIVER_TYPE(Z, TMC26X) extern TMC26XStepper stepperZ; #define Z_ENABLE_INIT NOOP #define Z_ENABLE_WRITE(STATE) stepperZ.setEnabled(STATE) #define Z_ENABLE_READ stepperZ.isEnabled() + #elif AXIS_DRIVER_TYPE(Z, TMC2660) + #define Z_ENABLE_INIT NOOP + #define Z_ENABLE_WRITE(STATE) stepperZ.toff((STATE)==Z_ENABLE_ON ? stepperZ.savedToff() : 0) + #define Z_ENABLE_READ stepperZ.isEnabled() #else - #if AXIS_DRIVER_TYPE(Z, TMC2130) - extern TMC2130Stepper stepperZ; - #elif AXIS_DRIVER_TYPE(Z, TMC2208) - extern TMC2208Stepper stepperZ; - #endif #define Z_ENABLE_INIT SET_OUTPUT(Z_ENABLE_PIN) #define Z_ENABLE_WRITE(STATE) WRITE(Z_ENABLE_PIN,STATE) #define Z_ENABLE_READ READ(Z_ENABLE_PIN) @@ -188,17 +197,19 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset #define X2_DIR_WRITE(STATE) stepperX2.Step_Clock(STATE) #define X2_DIR_READ (stepperX2.getStatus() & STATUS_DIR) #else + #if AXIS_IS_TMC(X2) + extern TMC_CLASS(X2) stepperX2; + #endif #if AXIS_DRIVER_TYPE(X2, TMC26X) extern TMC26XStepper stepperX2; #define X2_ENABLE_INIT NOOP #define X2_ENABLE_WRITE(STATE) stepperX2.setEnabled(STATE) #define X2_ENABLE_READ stepperX2.isEnabled() + #elif AXIS_DRIVER_TYPE(X2, TMC2660) + #define X2_ENABLE_INIT NOOP + #define X2_ENABLE_WRITE(STATE) stepperX2.toff((STATE)==X_ENABLE_ON ? stepperX2.savedToff() : 0) + #define X2_ENABLE_READ stepperX2.isEnabled() #else - #if AXIS_DRIVER_TYPE(X2, TMC2130) - extern TMC2130Stepper stepperX2; - #elif AXIS_DRIVER_TYPE(X2, TMC2208) - extern TMC2208Stepper stepperX2; - #endif #define X2_ENABLE_INIT SET_OUTPUT(X2_ENABLE_PIN) #define X2_ENABLE_WRITE(STATE) WRITE(X2_ENABLE_PIN,STATE) #define X2_ENABLE_READ READ(X2_ENABLE_PIN) @@ -223,17 +234,19 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset #define Y2_DIR_WRITE(STATE) stepperY2.Step_Clock(STATE) #define Y2_DIR_READ (stepperY2.getStatus() & STATUS_DIR) #else + #if AXIS_IS_TMC(Y2) + extern TMC_CLASS(Y2) stepperY2; + #endif #if AXIS_DRIVER_TYPE(Y2, TMC26X) extern TMC26XStepper stepperY2; #define Y2_ENABLE_INIT NOOP #define Y2_ENABLE_WRITE(STATE) stepperY2.setEnabled(STATE) #define Y2_ENABLE_READ stepperY2.isEnabled() + #elif AXIS_DRIVER_TYPE(Y2, TMC2660) + #define Y2_ENABLE_INIT NOOP + #define Y2_ENABLE_WRITE(STATE) stepperY2.toff((STATE)==Y_ENABLE_ON ? stepperY2.savedToff() : 0) + #define Y2_ENABLE_READ stepperY2.isEnabled() #else - #if AXIS_DRIVER_TYPE(Y2, TMC2130) - extern TMC2130Stepper stepperY2; - #elif AXIS_DRIVER_TYPE(Y2, TMC2208) - extern TMC2208Stepper stepperY2; - #endif #define Y2_ENABLE_INIT SET_OUTPUT(Y2_ENABLE_PIN) #define Y2_ENABLE_WRITE(STATE) WRITE(Y2_ENABLE_PIN,STATE) #define Y2_ENABLE_READ READ(Y2_ENABLE_PIN) @@ -258,17 +271,19 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset #define Z2_DIR_WRITE(STATE) stepperZ2.Step_Clock(STATE) #define Z2_DIR_READ (stepperZ2.getStatus() & STATUS_DIR) #else + #if AXIS_IS_TMC(Z2) + extern TMC_CLASS(Z2) stepperZ2; + #endif #if AXIS_DRIVER_TYPE(Z2, TMC26X) extern TMC26XStepper stepperZ2; #define Z2_ENABLE_INIT NOOP #define Z2_ENABLE_WRITE(STATE) stepperZ2.setEnabled(STATE) #define Z2_ENABLE_READ stepperZ2.isEnabled() + #elif AXIS_DRIVER_TYPE(Z2, TMC2660) + #define Z2_ENABLE_INIT NOOP + #define Z2_ENABLE_WRITE(STATE) stepperZ2.toff((STATE)==Z_ENABLE_ON ? stepperZ2.savedToff() : 0) + #define Z2_ENABLE_READ stepperZ2.isEnabled() #else - #if AXIS_DRIVER_TYPE(Z2, TMC2130) - extern TMC2130Stepper stepperZ2; - #elif AXIS_DRIVER_TYPE(Z2, TMC2208) - extern TMC2208Stepper stepperZ2; - #endif #define Z2_ENABLE_INIT SET_OUTPUT(Z2_ENABLE_PIN) #define Z2_ENABLE_WRITE(STATE) WRITE(Z2_ENABLE_PIN,STATE) #define Z2_ENABLE_READ READ(Z2_ENABLE_PIN) @@ -293,17 +308,19 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset #define Z3_DIR_WRITE(STATE) stepperZ3.Step_Clock(STATE) #define Z3_DIR_READ (stepperZ3.getStatus() & STATUS_DIR) #else + #if AXIS_IS_TMC(Z3) + extern TMC_CLASS(Z3) stepperZ3; + #endif #if ENABLED(Z3_IS_TMC26X) extern TMC26XStepper stepperZ3; #define Z3_ENABLE_INIT NOOP #define Z3_ENABLE_WRITE(STATE) stepperZ3.setEnabled(STATE) #define Z3_ENABLE_READ stepperZ3.isEnabled() + #elif AXIS_DRIVER_TYPE(Z3, TMC2660) + #define Z3_ENABLE_INIT NOOP + #define Z3_ENABLE_WRITE(STATE) stepperZ3.toff((STATE)==Z_ENABLE_ON ? stepperZ3.savedToff() : 0) + #define Z3_ENABLE_READ stepperZ3.isEnabled() #else - #if ENABLED(Z3_IS_TMC2130) - extern TMC2130Stepper stepperZ3; - #elif ENABLED(Z3_IS_TMC2208) - extern TMC2208Stepper stepperZ3; - #endif #define Z3_ENABLE_INIT SET_OUTPUT(Z3_ENABLE_PIN) #define Z3_ENABLE_WRITE(STATE) WRITE(Z3_ENABLE_PIN,STATE) #define Z3_ENABLE_READ READ(Z3_ENABLE_PIN) @@ -327,17 +344,19 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset #define E0_DIR_WRITE(STATE) stepperE0.Step_Clock(STATE) #define E0_DIR_READ (stepperE0.getStatus() & STATUS_DIR) #else + #if AXIS_IS_TMC(E0) + extern TMC_CLASS(E0) stepperE0; + #endif #if AXIS_DRIVER_TYPE(E0, TMC26X) extern TMC26XStepper stepperE0; #define E0_ENABLE_INIT NOOP #define E0_ENABLE_WRITE(STATE) stepperE0.setEnabled(STATE) #define E0_ENABLE_READ stepperE0.isEnabled() + #elif AXIS_DRIVER_TYPE(E0, TMC2660) + #define E0_ENABLE_INIT NOOP + #define E0_ENABLE_WRITE(STATE) stepperE0.toff((STATE)==E_ENABLE_ON ? stepperE0.savedToff() : 0) + #define E0_ENABLE_READ stepperE0.isEnabled() #else - #if AXIS_DRIVER_TYPE(E0, TMC2130) - extern TMC2130Stepper stepperE0; - #elif AXIS_DRIVER_TYPE(E0, TMC2208) - extern TMC2208Stepper stepperE0; - #endif #define E0_ENABLE_INIT SET_OUTPUT(E0_ENABLE_PIN) #define E0_ENABLE_WRITE(STATE) WRITE(E0_ENABLE_PIN,STATE) #define E0_ENABLE_READ READ(E0_ENABLE_PIN) @@ -360,17 +379,19 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset #define E1_DIR_WRITE(STATE) stepperE1.Step_Clock(STATE) #define E1_DIR_READ (stepperE1.getStatus() & STATUS_DIR) #else + #if AXIS_IS_TMC(E1) + extern TMC_CLASS(E1) stepperE1; + #endif #if AXIS_DRIVER_TYPE(E1, TMC26X) extern TMC26XStepper stepperE1; #define E1_ENABLE_INIT NOOP #define E1_ENABLE_WRITE(STATE) stepperE1.setEnabled(STATE) #define E1_ENABLE_READ stepperE1.isEnabled() + #elif AXIS_DRIVER_TYPE(E1, TMC2660) + #define E1_ENABLE_INIT NOOP + #define E1_ENABLE_WRITE(STATE) stepperE1.toff((STATE)==E_ENABLE_ON ? stepperE1.savedToff() : 0) + #define E1_ENABLE_READ stepperE1.isEnabled() #else - #if AXIS_DRIVER_TYPE(E1, TMC2130) - extern TMC2130Stepper stepperE1; - #elif AXIS_DRIVER_TYPE(E1, TMC2208) - extern TMC2208Stepper stepperE1; - #endif #define E1_ENABLE_INIT SET_OUTPUT(E1_ENABLE_PIN) #define E1_ENABLE_WRITE(STATE) WRITE(E1_ENABLE_PIN,STATE) #define E1_ENABLE_READ READ(E1_ENABLE_PIN) @@ -393,17 +414,19 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset #define E2_DIR_WRITE(STATE) stepperE2.Step_Clock(STATE) #define E2_DIR_READ (stepperE2.getStatus() & STATUS_DIR) #else + #if AXIS_IS_TMC(E2) + extern TMC_CLASS(E2) stepperE2; + #endif #if AXIS_DRIVER_TYPE(E2, TMC26X) extern TMC26XStepper stepperE2; #define E2_ENABLE_INIT NOOP #define E2_ENABLE_WRITE(STATE) stepperE2.setEnabled(STATE) #define E2_ENABLE_READ stepperE2.isEnabled() + #elif AXIS_DRIVER_TYPE(E2, TMC2660) + #define E2_ENABLE_INIT NOOP + #define E2_ENABLE_WRITE(STATE) stepperE2.toff((STATE)==E_ENABLE_ON ? stepperE2.savedToff() : 0) + #define E2_ENABLE_READ stepperE2.isEnabled() #else - #if AXIS_DRIVER_TYPE(E2, TMC2130) - extern TMC2130Stepper stepperE2; - #elif AXIS_DRIVER_TYPE(E2, TMC2208) - extern TMC2208Stepper stepperE2; - #endif #define E2_ENABLE_INIT SET_OUTPUT(E2_ENABLE_PIN) #define E2_ENABLE_WRITE(STATE) WRITE(E2_ENABLE_PIN,STATE) #define E2_ENABLE_READ READ(E2_ENABLE_PIN) @@ -426,17 +449,19 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset #define E3_DIR_WRITE(STATE) stepperE3.Step_Clock(STATE) #define E3_DIR_READ (stepperE3.getStatus() & STATUS_DIR) #else + #if AXIS_IS_TMC(E3) + extern TMC_CLASS(E3) stepperE3; + #endif #if AXIS_DRIVER_TYPE(E3, TMC26X) extern TMC26XStepper stepperE3; #define E3_ENABLE_INIT NOOP #define E3_ENABLE_WRITE(STATE) stepperE3.setEnabled(STATE) #define E3_ENABLE_READ stepperE3.isEnabled() + #elif AXIS_DRIVER_TYPE(E3, TMC2660) + #define E3_ENABLE_INIT NOOP + #define E3_ENABLE_WRITE(STATE) stepperE3.toff((STATE)==E_ENABLE_ON ? stepperE3.savedToff() : 0) + #define E3_ENABLE_READ stepperE3.isEnabled() #else - #if AXIS_DRIVER_TYPE(E3, TMC2130) - extern TMC2130Stepper stepperE3; - #elif AXIS_DRIVER_TYPE(E3, TMC2208) - extern TMC2208Stepper stepperE3; - #endif #define E3_ENABLE_INIT SET_OUTPUT(E3_ENABLE_PIN) #define E3_ENABLE_WRITE(STATE) WRITE(E3_ENABLE_PIN,STATE) #define E3_ENABLE_READ READ(E3_ENABLE_PIN) @@ -459,17 +484,19 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset #define E4_DIR_WRITE(STATE) stepperE4.Step_Clock(STATE) #define E4_DIR_READ (stepperE4.getStatus() & STATUS_DIR) #else + #if AXIS_IS_TMC(E4) + extern TMC_CLASS(E4) stepperE4; + #endif #if AXIS_DRIVER_TYPE(E4, TMC26X) extern TMC26XStepper stepperE4; #define E4_ENABLE_INIT NOOP #define E4_ENABLE_WRITE(STATE) stepperE4.setEnabled(STATE) #define E4_ENABLE_READ stepperE4.isEnabled() + #elif AXIS_DRIVER_TYPE(E4, TMC2660) + #define E4_ENABLE_INIT NOOP + #define E4_ENABLE_WRITE(STATE) stepperE4.toff((STATE)==E_ENABLE_ON ? stepperE4.savedToff() : 0) + #define E4_ENABLE_READ stepperE4.isEnabled() #else - #if AXIS_DRIVER_TYPE(E4, TMC2130) - extern TMC2130Stepper stepperE4; - #elif AXIS_DRIVER_TYPE(E4, TMC2208) - extern TMC2208Stepper stepperE4; - #endif #define E4_ENABLE_INIT SET_OUTPUT(E4_ENABLE_PIN) #define E4_ENABLE_WRITE(STATE) WRITE(E4_ENABLE_PIN,STATE) #define E4_ENABLE_READ READ(E4_ENABLE_PIN) @@ -492,17 +519,19 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset #define E5_DIR_WRITE(STATE) stepperE5.Step_Clock(STATE) #define E5_DIR_READ (stepperE5.getStatus() & STATUS_DIR) #else + #if AXIS_IS_TMC(E5) + extern TMC_CLASS(E5) stepperE5; + #endif #if AXIS_DRIVER_TYPE(E5, TMC26X) extern TMC26XStepper stepperE5; #define E5_ENABLE_INIT NOOP #define E5_ENABLE_WRITE(STATE) stepperE5.setEnabled(STATE) #define E5_ENABLE_READ stepperE5.isEnabled() + #elif AXIS_DRIVER_TYPE(E5, TMC2660) + #define E5_ENABLE_INIT NOOP + #define E5_ENABLE_WRITE(STATE) stepperE5.toff((STATE)==E_ENABLE_ON ? stepperE5.savedToff() : 0) + #define E5_ENABLE_READ stepperE5.isEnabled() #else - #if AXIS_DRIVER_TYPE(E5, TMC2130) - extern TMC2130Stepper stepperE5; - #elif AXIS_DRIVER_TYPE(E5, TMC2208) - extern TMC2208Stepper stepperE5; - #endif #define E5_ENABLE_INIT SET_OUTPUT(E5_ENABLE_PIN) #define E5_ENABLE_WRITE(STATE) WRITE(E5_ENABLE_PIN,STATE) #define E5_ENABLE_READ READ(E5_ENABLE_PIN) @@ -584,5 +613,3 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset #define NORM_E_DIR(E) E0_DIR_WRITE(!INVERT_E0_DIR) #define REV_E_DIR(E) E0_DIR_WRITE( INVERT_E0_DIR) #endif - -#endif // STEPPER_INDIRECTION_H diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 6a91f8a1b9..5756eda8ac 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -51,6 +51,10 @@ #include "../feature/emergency_parser.h" #endif +#if ENABLED(PRINTER_EVENT_LEDS) + #include "../feature/leds/printer_event_leds.h" +#endif + #if HOTEND_USES_THERMISTOR #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT) static void* heater_ttbl_map[2] = { (void*)HEATER_0_TEMPTABLE, (void*)HEATER_1_TEMPTABLE }; @@ -93,7 +97,7 @@ int16_t Temperature::current_temperature_raw[HOTENDS] = { 0 }, Temperature::target_temperature[HOTENDS] = { 0 }; #if ENABLED(AUTO_POWER_E_FANS) - int16_t Temperature::autofan_speed[HOTENDS] = { 0 }; + uint8_t Temperature::autofan_speed[HOTENDS] = { 0 }; #endif #if HAS_HEATED_BED @@ -112,13 +116,7 @@ int16_t Temperature::current_temperature_raw[HOTENDS] = { 0 }, millis_t Temperature::watch_bed_next_ms = 0; #endif #if ENABLED(PIDTEMPBED) - float Temperature::bedKp, Temperature::bedKi, Temperature::bedKd, // Initialized by settings.load() - Temperature::temp_iState_bed = { 0 }, - Temperature::temp_dState_bed = { 0 }, - Temperature::pTerm_bed, - Temperature::iTerm_bed, - Temperature::dTerm_bed, - Temperature::pid_error_bed; + PID_t Temperature::bed_pid; // Initialized by settings.load() #else millis_t Temperature::next_bed_check_ms; #endif @@ -137,17 +135,7 @@ int16_t Temperature::current_temperature_raw[HOTENDS] = { 0 }, // Initialized by settings.load() #if ENABLED(PIDTEMP) - #if ENABLED(PID_PARAMS_PER_HOTEND) && HOTENDS > 1 - float Temperature::Kp[HOTENDS], Temperature::Ki[HOTENDS], Temperature::Kd[HOTENDS]; - #if ENABLED(PID_EXTRUSION_SCALING) - float Temperature::Kc[HOTENDS]; - #endif - #else - float Temperature::Kp, Temperature::Ki, Temperature::Kd; - #if ENABLED(PID_EXTRUSION_SCALING) - float Temperature::Kc; - #endif - #endif + hotend_pid_t Temperature::pid[HOTENDS]; #endif #if ENABLED(BABYSTEPPING) @@ -178,21 +166,11 @@ int16_t Temperature::current_temperature_raw[HOTENDS] = { 0 }, volatile bool Temperature::temp_meas_ready = false; #if ENABLED(PIDTEMP) - float Temperature::temp_iState[HOTENDS] = { 0 }, - Temperature::temp_dState[HOTENDS] = { 0 }, - Temperature::pTerm[HOTENDS], - Temperature::iTerm[HOTENDS], - Temperature::dTerm[HOTENDS]; - #if ENABLED(PID_EXTRUSION_SCALING) - float Temperature::cTerm[HOTENDS]; long Temperature::last_e_position; long Temperature::lpq[LPQ_MAX_LEN]; int Temperature::lpq_ptr = 0; #endif - - float Temperature::pid_error[HOTENDS]; - bool Temperature::pid_reset[HOTENDS]; #endif uint16_t Temperature::raw_temp_value[MAX_EXTRUDERS] = { 0 }; @@ -239,7 +217,7 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS]; bool Temperature::heater_idle_timeout_exceeded[HOTENDS] = { false }; #endif -#if ENABLED(ADC_KEYPAD) +#if HAS_ADC_BUTTONS uint32_t Temperature::current_ADCKey_raw = 0; uint8_t Temperature::ADCKey_count = 0; #endif @@ -250,13 +228,15 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS]; #if HAS_PID_HEATING + inline void say_default_() { SERIAL_PROTOCOLPGM("#define DEFAULT_"); } + /** * PID Autotuning (M303) * * Alternately heat and cool the nozzle, observing its behavior to * determine the best PID values to achieve a stable temperature. */ - void Temperature::PID_autotune(const float &target, const int8_t hotend, const int8_t ncycles, const bool set_result/*=false*/) { + void Temperature::PID_autotune(const float &target, const int8_t heater, const int8_t ncycles, const bool set_result/*=false*/) { float current = 0.0; int cycles = 0; bool heating = true; @@ -265,25 +245,30 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS]; long t_high = 0, t_low = 0; long bias, d; - float Ku, Tu, - workKp = 0, workKi = 0, workKd = 0, - max = 0, min = 10000; + PID_t tune_pid = { 0, 0, 0 }; + float max = 0, min = 10000; #if HAS_PID_FOR_BOTH - #define GHV(B,H) (hotend < 0 ? (B) : (H)) - #define SHV(S,B,H) if (hotend < 0) S##_bed = B; else S [hotend] = H; + #define GHV(B,H) (heater < 0 ? (B) : (H)) + #define SHV(S,B,H) do{ if (heater < 0) S##_bed = B; else S [heater] = H; }while(0) + #define ONHEATINGSTART() (heater < 0 ? printerEventLEDs.onBedHeatingStart() : printerEventLEDs.onHotendHeatingStart()) + #define ONHEATING(S,C,T) do{ if (heater < 0) printerEventLEDs.onBedHeating(S,C,T); else printerEventLEDs.onHotendHeating(S,C,T); }while(0) #elif ENABLED(PIDTEMPBED) #define GHV(B,H) B #define SHV(S,B,H) (S##_bed = B) + #define ONHEATINGSTART() printerEventLEDs.onBedHeatingStart() + #define ONHEATING(S,C,T) printerEventLEDs.onBedHeating(S,C,T) #else #define GHV(B,H) H - #define SHV(S,B,H) (S [hotend] = H) + #define SHV(S,B,H) (S [heater] = H) + #define ONHEATINGSTART() printerEventLEDs.onHotendHeatingStart() + #define ONHEATING(S,C,T) printerEventLEDs.onHotendHeating(S,C,T) #endif #if WATCH_THE_BED || WATCH_HOTENDS #define HAS_TP_BED (ENABLED(THERMAL_PROTECTION_BED) && ENABLED(PIDTEMPBED)) #if HAS_TP_BED && ENABLED(THERMAL_PROTECTION_HOTENDS) && ENABLED(PIDTEMP) - #define GTV(B,H) (hotend < 0 ? (B) : (H)) + #define GTV(B,H) (heater < 0 ? (B) : (H)) #elif HAS_TP_BED #define GTV(B,H) (B) #else @@ -301,29 +286,17 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS]; next_auto_fan_check_ms = next_temp_ms + 2500UL; #endif - #if ENABLED(PIDTEMP) - #define _TOP_HOTEND HOTENDS - 1 - #else - #define _TOP_HOTEND -1 - #endif - #if ENABLED(PIDTEMPBED) - #define _BOT_HOTEND -1 - #else - #define _BOT_HOTEND 0 - #endif - - if (!WITHIN(hotend, _BOT_HOTEND, _TOP_HOTEND)) { - SERIAL_ECHOLNPGM(MSG_PID_BAD_EXTRUDER_NUM); - return; - } - SERIAL_ECHOLNPGM(MSG_PID_AUTOTUNE_START); - disable_all_heaters(); // switch off all heaters. + disable_all_heaters(); SHV(soft_pwm_amount, bias = d = (MAX_BED_POWER) >> 1, bias = d = (PID_MAX) >> 1); wait_for_heatup = true; // Can be interrupted with M108 + #if ENABLED(PRINTER_EVENT_LEDS) + const float start_temp = GHV(current_temperature_bed, current_temperature[heater]); + LEDColor color = ONHEATINGSTART(); + #endif // PID Tuning loop while (wait_for_heatup) { @@ -334,10 +307,14 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS]; updateTemperaturesFromRawValues(); // Get the current temperature and constrain it - current = GHV(current_temperature_bed, current_temperature[hotend]); + current = GHV(current_temperature_bed, current_temperature[heater]); NOLESS(max, current); NOMORE(min, current); + #if ENABLED(PRINTER_EVENT_LEDS) + ONHEATING(start_temp, current, target); + #endif + #if HAS_AUTO_FAN if (ELAPSED(ms, next_auto_fan_check_ms)) { checkExtruderAutoFans(); @@ -371,32 +348,32 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS]; SERIAL_PROTOCOLPAIR(MSG_T_MIN, min); SERIAL_PROTOCOLPAIR(MSG_T_MAX, max); if (cycles > 2) { - Ku = (4.0f * d) / (float(M_PI) * (max - min) * 0.5f); - Tu = ((float)(t_low + t_high) * 0.001f); + float Ku = (4.0f * d) / (float(M_PI) * (max - min) * 0.5f), + Tu = ((float)(t_low + t_high) * 0.001f); SERIAL_PROTOCOLPAIR(MSG_KU, Ku); SERIAL_PROTOCOLPAIR(MSG_TU, Tu); - workKp = 0.6f * Ku; - workKi = 2 * workKp / Tu; - workKd = workKp * Tu * 0.125f; + tune_pid.Kp = 0.6f * Ku; + tune_pid.Ki = 2 * tune_pid.Kp / Tu; + tune_pid.Kd = tune_pid.Kp * Tu * 0.125f; SERIAL_PROTOCOLLNPGM("\n" MSG_CLASSIC_PID); - SERIAL_PROTOCOLPAIR(MSG_KP, workKp); - SERIAL_PROTOCOLPAIR(MSG_KI, workKi); - SERIAL_PROTOCOLLNPAIR(MSG_KD, workKd); + SERIAL_PROTOCOLPAIR(MSG_KP, tune_pid.Kp); + SERIAL_PROTOCOLPAIR(MSG_KI, tune_pid.Ki); + SERIAL_PROTOCOLLNPAIR(MSG_KD, tune_pid.Kd); /** - workKp = 0.33*Ku; - workKi = workKp/Tu; - workKd = workKp*Tu/3; + tune_pid.Kp = 0.33*Ku; + tune_pid.Ki = tune_pid.Kp/Tu; + tune_pid.Kd = tune_pid.Kp*Tu/3; SERIAL_PROTOCOLLNPGM(" Some overshoot"); - SERIAL_PROTOCOLPAIR(" Kp: ", workKp); - SERIAL_PROTOCOLPAIR(" Ki: ", workKi); - SERIAL_PROTOCOLPAIR(" Kd: ", workKd); - workKp = 0.2*Ku; - workKi = 2*workKp/Tu; - workKd = workKp*Tu/3; + SERIAL_PROTOCOLPAIR(" Kp: ", tune_pid.Kp); + SERIAL_PROTOCOLPAIR(" Ki: ", tune_pid.Ki); + SERIAL_PROTOCOLPAIR(" Kd: ", tune_pid.Kd); + tune_pid.Kp = 0.2*Ku; + tune_pid.Ki = 2*tune_pid.Kp/Tu; + tune_pid.Kd = tune_pid.Kp*Tu/3; SERIAL_PROTOCOLLNPGM(" No overshoot"); - SERIAL_PROTOCOLPAIR(" Kp: ", workKp); - SERIAL_PROTOCOLPAIR(" Ki: ", workKi); - SERIAL_PROTOCOLPAIR(" Kd: ", workKd); + SERIAL_PROTOCOLPAIR(" Kp: ", tune_pid.Kp); + SERIAL_PROTOCOLPAIR(" Ki: ", tune_pid.Ki); + SERIAL_PROTOCOLPAIR(" Kd: ", tune_pid.Kd); */ } } @@ -419,7 +396,7 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS]; // Report heater states every 2 seconds if (ELAPSED(ms, next_temp_ms)) { #if HAS_TEMP_SENSOR - print_heaterstates(); + print_heater_states(heater >= 0 ? heater : active_extruder); SERIAL_EOL(); #endif next_temp_ms = ms + 2000UL; @@ -430,9 +407,9 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS]; #if WATCH_THE_BED && WATCH_HOTENDS true #elif WATCH_HOTENDS - hotend >= 0 + heater >= 0 #else - hotend < 0 + heater < 0 #endif ) { if (!heated) { // If not yet reached target... @@ -442,10 +419,10 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS]; if (current > watch_temp_target) heated = true; // - Flag if target temperature reached } else if (ELAPSED(ms, temp_change_ms)) // Watch timer expired - _temp_error(hotend, PSTR(MSG_T_HEATING_FAILED), TEMP_ERR_PSTR(MSG_HEATING_FAILED_LCD, hotend)); + _temp_error(heater, PSTR(MSG_T_HEATING_FAILED), TEMP_ERR_PSTR(MSG_HEATING_FAILED_LCD, heater)); } else if (current < target - (MAX_OVERSHOOT_PID_AUTOTUNE)) // Heated, then temperature fell too far? - _temp_error(hotend, PSTR(MSG_T_THERMAL_RUNAWAY), TEMP_ERR_PSTR(MSG_THERMAL_RUNAWAY, hotend)); + _temp_error(heater, PSTR(MSG_T_THERMAL_RUNAWAY), TEMP_ERR_PSTR(MSG_THERMAL_RUNAWAY, heater)); } #endif } // every 2 seconds @@ -463,50 +440,54 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS]; SERIAL_PROTOCOLLNPGM(MSG_PID_AUTOTUNE_FINISHED); #if HAS_PID_FOR_BOTH - const char* estring = GHV("bed", ""); - SERIAL_PROTOCOLPAIR("#define DEFAULT_", estring); SERIAL_PROTOCOLPAIR("Kp ", workKp); SERIAL_EOL(); - SERIAL_PROTOCOLPAIR("#define DEFAULT_", estring); SERIAL_PROTOCOLPAIR("Ki ", workKi); SERIAL_EOL(); - SERIAL_PROTOCOLPAIR("#define DEFAULT_", estring); SERIAL_PROTOCOLPAIR("Kd ", workKd); SERIAL_EOL(); + const char * const estring = GHV(PSTR("bed"), PSTR("")); + say_default_(); serialprintPGM(estring); SERIAL_PROTOCOLLNPAIR("Kp ", tune_pid.Kp); + say_default_(); serialprintPGM(estring); SERIAL_PROTOCOLLNPAIR("Ki ", tune_pid.Ki); + say_default_(); serialprintPGM(estring); SERIAL_PROTOCOLLNPAIR("Kd ", tune_pid.Kd); #elif ENABLED(PIDTEMP) - SERIAL_PROTOCOLPAIR("#define DEFAULT_Kp ", workKp); SERIAL_EOL(); - SERIAL_PROTOCOLPAIR("#define DEFAULT_Ki ", workKi); SERIAL_EOL(); - SERIAL_PROTOCOLPAIR("#define DEFAULT_Kd ", workKd); SERIAL_EOL(); + say_default_(); SERIAL_PROTOCOLLNPAIR("Kp ", tune_pid.Kp); + say_default_(); SERIAL_PROTOCOLLNPAIR("Ki ", tune_pid.Ki); + say_default_(); SERIAL_PROTOCOLLNPAIR("Kd ", tune_pid.Kd); #else - SERIAL_PROTOCOLPAIR("#define DEFAULT_bedKp ", workKp); SERIAL_EOL(); - SERIAL_PROTOCOLPAIR("#define DEFAULT_bedKi ", workKi); SERIAL_EOL(); - SERIAL_PROTOCOLPAIR("#define DEFAULT_bedKd ", workKd); SERIAL_EOL(); + say_default_(); SERIAL_PROTOCOLLNPAIR("bedKp ", tune_pid.Kp); + say_default_(); SERIAL_PROTOCOLLNPAIR("bedKi ", tune_pid.Ki); + say_default_(); SERIAL_PROTOCOLLNPAIR("bedKd ", tune_pid.Kd); #endif #define _SET_BED_PID() do { \ - bedKp = workKp; \ - bedKi = scalePID_i(workKi); \ - bedKd = scalePID_d(workKd); \ + bed_pid.Kp = tune_pid.Kp; \ + bed_pid.Ki = scalePID_i(tune_pid.Ki); \ + bed_pid.Kd = scalePID_d(tune_pid.Kd); \ }while(0) #define _SET_EXTRUDER_PID() do { \ - PID_PARAM(Kp, hotend) = workKp; \ - PID_PARAM(Ki, hotend) = scalePID_i(workKi); \ - PID_PARAM(Kd, hotend) = scalePID_d(workKd); \ + PID_PARAM(Kp, heater) = tune_pid.Kp; \ + PID_PARAM(Ki, heater) = scalePID_i(tune_pid.Ki); \ + PID_PARAM(Kd, heater) = scalePID_d(tune_pid.Kd); \ updatePID(); }while(0) // Use the result? (As with "M303 U1") if (set_result) { #if HAS_PID_FOR_BOTH - if (hotend < 0) - _SET_BED_PID(); - else - _SET_EXTRUDER_PID(); + if (heater < 0) _SET_BED_PID(); else _SET_EXTRUDER_PID(); #elif ENABLED(PIDTEMP) _SET_EXTRUDER_PID(); #else _SET_BED_PID(); #endif } + #if ENABLED(PRINTER_EVENT_LEDS) + printerEventLEDs.onPidTuningDone(color); + #endif + return; } - lcd_update(); + ui.update(); } disable_all_heaters(); + #if ENABLED(PRINTER_EVENT_LEDS) + printerEventLEDs.onPidTuningDone(color); + #endif } #endif // HAS_PID_HEATING @@ -578,13 +559,13 @@ int Temperature::getHeaterPower(const int heater) { // // Temperature Error Handlers // -void Temperature::_temp_error(const int8_t e, const char * const serial_msg, const char * const lcd_msg) { +void Temperature::_temp_error(const int8_t heater, PGM_P const serial_msg, PGM_P const lcd_msg) { static bool killed = false; if (IsRunning()) { SERIAL_ERROR_START(); serialprintPGM(serial_msg); SERIAL_ERRORPGM(MSG_STOPPED_HEATER); - if (e >= 0) SERIAL_ERRORLN((int)e); else SERIAL_ERRORLNPGM(MSG_HEATER_BED); + if (heater >= 0) SERIAL_ERRORLN((int)heater); else SERIAL_ERRORLNPGM(MSG_HEATER_BED); } #if DISABLED(BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE) if (!killed) { @@ -597,26 +578,30 @@ void Temperature::_temp_error(const int8_t e, const char * const serial_msg, con #endif } -void Temperature::max_temp_error(const int8_t e) { - _temp_error(e, PSTR(MSG_T_MAXTEMP), TEMP_ERR_PSTR(MSG_ERR_MAXTEMP, e)); +void Temperature::max_temp_error(const int8_t heater) { + _temp_error(heater, PSTR(MSG_T_MAXTEMP), TEMP_ERR_PSTR(MSG_ERR_MAXTEMP, heater)); } -void Temperature::min_temp_error(const int8_t e) { - _temp_error(e, PSTR(MSG_T_MINTEMP), TEMP_ERR_PSTR(MSG_ERR_MINTEMP, e)); +void Temperature::min_temp_error(const int8_t heater) { + _temp_error(heater, PSTR(MSG_T_MINTEMP), TEMP_ERR_PSTR(MSG_ERR_MINTEMP, heater)); } float Temperature::get_pid_output(const int8_t e) { #if HOTENDS == 1 UNUSED(e); - #define _HOTEND_TEST true + #define _HOTEND_TEST true #else - #define _HOTEND_TEST e == active_extruder + #define _HOTEND_TEST (e == active_extruder) #endif - float pid_output; #if ENABLED(PIDTEMP) #if DISABLED(PID_OPENLOOP) - pid_error[HOTEND_INDEX] = target_temperature[HOTEND_INDEX] - current_temperature[HOTEND_INDEX]; - dTerm[HOTEND_INDEX] = PID_K2 * PID_PARAM(Kd, HOTEND_INDEX) * (current_temperature[HOTEND_INDEX] - temp_dState[HOTEND_INDEX]) + float(PID_K1) * dTerm[HOTEND_INDEX]; + static hotend_pid_t work_pid[HOTENDS]; + static float temp_iState[HOTENDS] = { 0 }, + temp_dState[HOTENDS] = { 0 }; + static bool pid_reset[HOTENDS] = { false }; + float pid_output, + pid_error = target_temperature[HOTEND_INDEX] - current_temperature[HOTEND_INDEX]; + work_pid[HOTEND_INDEX].Kd = PID_K2 * PID_PARAM(Kd, HOTEND_INDEX) * (current_temperature[HOTEND_INDEX] - temp_dState[HOTEND_INDEX]) + float(PID_K1) * work_pid[HOTEND_INDEX].Kd; temp_dState[HOTEND_INDEX] = current_temperature[HOTEND_INDEX]; #if HEATER_IDLE_HANDLER if (heater_idle_timeout_exceeded[HOTEND_INDEX]) { @@ -625,57 +610,60 @@ float Temperature::get_pid_output(const int8_t e) { } else #endif - if (pid_error[HOTEND_INDEX] > PID_FUNCTIONAL_RANGE) { - pid_output = BANG_MAX; - pid_reset[HOTEND_INDEX] = true; - } - else if (pid_error[HOTEND_INDEX] < -(PID_FUNCTIONAL_RANGE) || target_temperature[HOTEND_INDEX] == 0 - #if HEATER_IDLE_HANDLER - || heater_idle_timeout_exceeded[HOTEND_INDEX] - #endif - ) { - pid_output = 0; - pid_reset[HOTEND_INDEX] = true; - } - else { - if (pid_reset[HOTEND_INDEX]) { - temp_iState[HOTEND_INDEX] = 0.0; - pid_reset[HOTEND_INDEX] = false; - } - pTerm[HOTEND_INDEX] = PID_PARAM(Kp, HOTEND_INDEX) * pid_error[HOTEND_INDEX]; - temp_iState[HOTEND_INDEX] += pid_error[HOTEND_INDEX]; - iTerm[HOTEND_INDEX] = PID_PARAM(Ki, HOTEND_INDEX) * temp_iState[HOTEND_INDEX]; - - pid_output = pTerm[HOTEND_INDEX] + iTerm[HOTEND_INDEX] - dTerm[HOTEND_INDEX]; - - #if ENABLED(PID_EXTRUSION_SCALING) - cTerm[HOTEND_INDEX] = 0; - if (_HOTEND_TEST) { - const long e_position = stepper.position(E_AXIS); - if (e_position > last_e_position) { - lpq[lpq_ptr] = e_position - last_e_position; - last_e_position = e_position; - } - else - lpq[lpq_ptr] = 0; - - if (++lpq_ptr >= lpq_len) lpq_ptr = 0; - cTerm[HOTEND_INDEX] = (lpq[lpq_ptr] * planner.steps_to_mm[E_AXIS]) * PID_PARAM(Kc, HOTEND_INDEX); - pid_output += cTerm[HOTEND_INDEX]; + if (pid_error > PID_FUNCTIONAL_RANGE) { + pid_output = BANG_MAX; + pid_reset[HOTEND_INDEX] = true; } - #endif // PID_EXTRUSION_SCALING + else if (pid_error < -(PID_FUNCTIONAL_RANGE) || target_temperature[HOTEND_INDEX] == 0 + #if HEATER_IDLE_HANDLER + || heater_idle_timeout_exceeded[HOTEND_INDEX] + #endif + ) { + pid_output = 0; + pid_reset[HOTEND_INDEX] = true; + } + else { + if (pid_reset[HOTEND_INDEX]) { + temp_iState[HOTEND_INDEX] = 0.0; + pid_reset[HOTEND_INDEX] = false; + } + temp_iState[HOTEND_INDEX] += pid_error; + work_pid[HOTEND_INDEX].Kp = PID_PARAM(Kp, HOTEND_INDEX) * pid_error; + work_pid[HOTEND_INDEX].Ki = PID_PARAM(Ki, HOTEND_INDEX) * temp_iState[HOTEND_INDEX]; + + pid_output = work_pid[HOTEND_INDEX].Kp + work_pid[HOTEND_INDEX].Ki - work_pid[HOTEND_INDEX].Kd; + + #if ENABLED(PID_EXTRUSION_SCALING) + work_pid[HOTEND_INDEX].Kc = 0; + if (_HOTEND_TEST) { + const long e_position = stepper.position(E_AXIS); + if (e_position > last_e_position) { + lpq[lpq_ptr] = e_position - last_e_position; + last_e_position = e_position; + } + else + lpq[lpq_ptr] = 0; + + if (++lpq_ptr >= lpq_len) lpq_ptr = 0; + work_pid[HOTEND_INDEX].Kc = (lpq[lpq_ptr] * planner.steps_to_mm[E_AXIS]) * PID_PARAM(Kc, HOTEND_INDEX); + pid_output += work_pid[HOTEND_INDEX].Kc; + } + #endif // PID_EXTRUSION_SCALING + + if (pid_output > PID_MAX) { + if (pid_error > 0) temp_iState[HOTEND_INDEX] -= pid_error; // conditional un-integration + pid_output = PID_MAX; + } + else if (pid_output < 0) { + if (pid_error < 0) temp_iState[HOTEND_INDEX] -= pid_error; // conditional un-integration + pid_output = 0; + } + } + + #else // PID_OPENLOOP + + const float pid_output = constrain(target_temperature[HOTEND_INDEX], 0, PID_MAX); - if (pid_output > PID_MAX) { - if (pid_error[HOTEND_INDEX] > 0) temp_iState[HOTEND_INDEX] -= pid_error[HOTEND_INDEX]; // conditional un-integration - pid_output = PID_MAX; - } - else if (pid_output < 0) { - if (pid_error[HOTEND_INDEX] < 0) temp_iState[HOTEND_INDEX] -= pid_error[HOTEND_INDEX]; // conditional un-integration - pid_output = 0; - } - } - #else - pid_output = constrain(target_temperature[HOTEND_INDEX], 0, PID_MAX); #endif // PID_OPENLOOP #if ENABLED(PID_DEBUG) @@ -683,11 +671,13 @@ float Temperature::get_pid_output(const int8_t e) { SERIAL_ECHOPAIR(MSG_PID_DEBUG, HOTEND_INDEX); SERIAL_ECHOPAIR(MSG_PID_DEBUG_INPUT, current_temperature[HOTEND_INDEX]); SERIAL_ECHOPAIR(MSG_PID_DEBUG_OUTPUT, pid_output); - SERIAL_ECHOPAIR(MSG_PID_DEBUG_PTERM, pTerm[HOTEND_INDEX]); - SERIAL_ECHOPAIR(MSG_PID_DEBUG_ITERM, iTerm[HOTEND_INDEX]); - SERIAL_ECHOPAIR(MSG_PID_DEBUG_DTERM, dTerm[HOTEND_INDEX]); - #if ENABLED(PID_EXTRUSION_SCALING) - SERIAL_ECHOPAIR(MSG_PID_DEBUG_CTERM, cTerm[HOTEND_INDEX]); + #if DISABLED(PID_OPENLOOP) + SERIAL_ECHOPAIR(MSG_PID_DEBUG_PTERM, work_pid[HOTEND_INDEX].Kp); + SERIAL_ECHOPAIR(MSG_PID_DEBUG_ITERM, work_pid[HOTEND_INDEX].Ki); + SERIAL_ECHOPAIR(MSG_PID_DEBUG_DTERM, work_pid[HOTEND_INDEX].Kd); + #if ENABLED(PID_EXTRUSION_SCALING) + SERIAL_ECHOPAIR(MSG_PID_DEBUG_CTERM, work_pid[HOTEND_INDEX].Kc); + #endif #endif SERIAL_EOL(); #endif // PID_DEBUG @@ -705,47 +695,52 @@ float Temperature::get_pid_output(const int8_t e) { } #if ENABLED(PIDTEMPBED) + float Temperature::get_pid_output_bed() { - float pid_output; + #if DISABLED(PID_OPENLOOP) - pid_error_bed = target_temperature_bed - current_temperature_bed; - pTerm_bed = bedKp * pid_error_bed; - temp_iState_bed += pid_error_bed; - iTerm_bed = bedKi * temp_iState_bed; - dTerm_bed = PID_K2 * bedKd * (current_temperature_bed - temp_dState_bed) + PID_K1 * dTerm_bed; - temp_dState_bed = current_temperature_bed; + static PID_t work_pid = { 0 }; + static float temp_iState = 0, temp_dState = 0; - pid_output = pTerm_bed + iTerm_bed - dTerm_bed; + float pid_error = target_temperature_bed - current_temperature_bed; + temp_iState += pid_error; + work_pid.Kp = bed_pid.Kp * pid_error; + work_pid.Ki = bed_pid.Ki * temp_iState; + work_pid.Kd = PID_K2 * bed_pid.Kd * (current_temperature_bed - temp_dState) + PID_K1 * work_pid.Kd; + + temp_dState = current_temperature_bed; + + float pid_output = work_pid.Kp + work_pid.Ki - work_pid.Kd; if (pid_output > MAX_BED_POWER) { - if (pid_error_bed > 0) temp_iState_bed -= pid_error_bed; // conditional un-integration + if (pid_error > 0) temp_iState -= pid_error; // conditional un-integration pid_output = MAX_BED_POWER; } else if (pid_output < 0) { - if (pid_error_bed < 0) temp_iState_bed -= pid_error_bed; // conditional un-integration + if (pid_error < 0) temp_iState -= pid_error; // conditional un-integration pid_output = 0; } - #else - pid_output = constrain(target_temperature_bed, 0, MAX_BED_POWER); + + #else // PID_OPENLOOP + + const float pid_output = constrain(target_temperature_bed, 0, MAX_BED_POWER); + #endif // PID_OPENLOOP #if ENABLED(PID_BED_DEBUG) SERIAL_ECHO_START(); - SERIAL_ECHOPGM(" PID_BED_DEBUG "); - SERIAL_ECHOPGM(": Input "); - SERIAL_ECHO(current_temperature_bed); - SERIAL_ECHOPGM(" Output "); - SERIAL_ECHO(pid_output); - SERIAL_ECHOPGM(" pTerm "); - SERIAL_ECHO(pTerm_bed); - SERIAL_ECHOPGM(" iTerm "); - SERIAL_ECHO(iTerm_bed); - SERIAL_ECHOPGM(" dTerm "); - SERIAL_ECHOLN(dTerm_bed); - #endif // PID_BED_DEBUG + SERIAL_ECHOPAIR(" PID_BED_DEBUG : Input ", current_temperature_bed); + SERIAL_ECHOPAIR(" Output ", pid_output); + #if DISABLED(PID_OPENLOOP) + SERIAL_ECHOPAIR(MSG_PID_DEBUG_PTERM, work_pid.Kp); + SERIAL_ECHOPAIR(MSG_PID_DEBUG_ITERM, work_pid.Ki); + SERIAL_ECHOLNPAIR(MSG_PID_DEBUG_DTERM, work_pid.Kd); + #endif + #endif return pid_output; } + #endif // PIDTEMPBED /** @@ -772,7 +767,7 @@ void Temperature::manage_heater() { #endif #if ENABLED(EMERGENCY_PARSER) - if (emergency_parser.killed_by_M112) kill(PSTR(MSG_KILLED)); + if (emergency_parser.killed_by_M112) kill(); #endif if (!temp_meas_ready) return; @@ -780,8 +775,13 @@ void Temperature::manage_heater() { updateTemperaturesFromRawValues(); // also resets the watchdog #if ENABLED(HEATER_0_USES_MAX6675) - if (current_temperature[0] > MIN(HEATER_0_MAXTEMP, MAX6675_TMAX - 1.0)) max_temp_error(0); - if (current_temperature[0] < MAX(HEATER_0_MINTEMP, MAX6675_TMIN + .01)) min_temp_error(0); + if (current_temperature[0] > MIN(HEATER_0_MAXTEMP, HEATER_0_MAX6675_TMAX - 1.0)) max_temp_error(0); + if (current_temperature[0] < MAX(HEATER_0_MINTEMP, HEATER_0_MAX6675_TMIN + .01)) min_temp_error(0); + #endif + + #if ENABLED(HEATER_1_USES_MAX6675) + if (current_temperature[1] > MIN(HEATER_1_MAXTEMP, HEATER_1_MAX6675_TMAX - 1.0)) max_temp_error(1); + if (current_temperature[1] < MAX(HEATER_1_MINTEMP, HEATER_1_MAX6675_TMIN + .01)) min_temp_error(1); #endif #if WATCH_HOTENDS || WATCH_THE_BED || DISABLED(PIDTEMPBED) || HAS_AUTO_FAN || HEATER_IDLE_HANDLER @@ -932,7 +932,7 @@ void Temperature::manage_heater() { // Derived from RepRap FiveD extruder::getTemperature() // For hot end temperature measurement. -float Temperature::analog2temp(const int raw, const uint8_t e) { +float Temperature::analog_to_celsius_hotend(const int raw, const uint8_t e) { #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT) if (e > HOTENDS) #else @@ -942,7 +942,7 @@ float Temperature::analog2temp(const int raw, const uint8_t e) { SERIAL_ERROR_START(); SERIAL_ERROR((int)e); SERIAL_ERRORLNPGM(MSG_INVALID_EXTRUDER_NUM); - kill(PSTR(MSG_KILLED)); + kill(); return 0.0; } @@ -958,7 +958,9 @@ float Temperature::analog2temp(const int raw, const uint8_t e) { break; #endif case 1: - #if ENABLED(HEATER_1_USES_AD595) + #if ENABLED(HEATER_1_USES_MAX6675) + return raw * 0.25; + #elif ENABLED(HEATER_1_USES_AD595) return TEMP_AD595(raw); #elif ENABLED(HEATER_1_USES_AD8495) return TEMP_AD8495(raw); @@ -1004,7 +1006,7 @@ float Temperature::analog2temp(const int raw, const uint8_t e) { #if HAS_HEATED_BED // Derived from RepRap FiveD extruder::getTemperature() // For bed temperature measurement. - float Temperature::analog2tempBed(const int raw) { + float Temperature::analog_to_celsius_bed(const int raw) { #if ENABLED(HEATER_BED_USES_THERMISTOR) SCAN_THERMISTOR_TABLE(BEDTEMPTABLE, BEDTEMPTABLE_LEN); #elif ENABLED(HEATER_BED_USES_AD595) @@ -1020,7 +1022,7 @@ float Temperature::analog2temp(const int raw, const uint8_t e) { #if HAS_TEMP_CHAMBER // Derived from RepRap FiveD extruder::getTemperature() // For chamber temperature measurement. - float Temperature::analog2tempChamber(const int raw) { + float Temperature::analog_to_celsiusChamber(const int raw) { #if ENABLED(HEATER_CHAMBER_USES_THERMISTOR) SCAN_THERMISTOR_TABLE(CHAMBERTEMPTABLE, CHAMBERTEMPTABLE_LEN); #elif ENABLED(HEATER_CHAMBER_USES_AD595) @@ -1041,20 +1043,23 @@ float Temperature::analog2temp(const int raw, const uint8_t e) { */ void Temperature::updateTemperaturesFromRawValues() { #if ENABLED(HEATER_0_USES_MAX6675) - current_temperature_raw[0] = read_max6675(); + current_temperature_raw[0] = READ_MAX6675(0); #endif - HOTEND_LOOP() current_temperature[e] = Temperature::analog2temp(current_temperature_raw[e], e); + #if ENABLED(HEATER_1_USES_MAX6675) + current_temperature_raw[1] = READ_MAX6675(1); + #endif + HOTEND_LOOP() current_temperature[e] = analog_to_celsius_hotend(current_temperature_raw[e], e); #if HAS_HEATED_BED - current_temperature_bed = Temperature::analog2tempBed(current_temperature_bed_raw); + current_temperature_bed = analog_to_celsius_bed(current_temperature_bed_raw); #endif #if HAS_TEMP_CHAMBER - current_temperature_chamber = Temperature::analog2tempChamber(current_temperature_chamber_raw); + current_temperature_chamber = analog_to_celsiusChamber(current_temperature_chamber_raw); #endif #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT) - redundant_temperature = Temperature::analog2temp(redundant_temperature_raw, 1); + redundant_temperature = analog_to_celsius_hotend(redundant_temperature_raw, 1); #endif #if ENABLED(FILAMENT_WIDTH_SENSOR) - filament_width_meas = analog2widthFil(); + filament_width_meas = analog_to_mm_fil_width(); #endif #if ENABLED(USE_WATCHDOG) @@ -1069,7 +1074,7 @@ void Temperature::updateTemperaturesFromRawValues() { #if ENABLED(FILAMENT_WIDTH_SENSOR) // Convert raw Filament Width to millimeters - float Temperature::analog2widthFil() { + float Temperature::analog_to_mm_fil_width() { return current_raw_filwidth * 5.0f * (1.0f / 16383.0f); } @@ -1166,6 +1171,13 @@ void Temperature::init() { #endif #endif + #if ENABLED(USE_CONTROLLER_FAN) + SET_OUTPUT(CONTROLLER_FAN_PIN); + #if ENABLED(FAST_PWM_FAN) + setPwmFrequency(CONTROLLER_FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8 + #endif + #endif + #if ENABLED(HEATER_0_USES_MAX6675) OUT_WRITE(SCK_PIN, LOW); @@ -1175,10 +1187,14 @@ void Temperature::init() { max6675_spi.init(); OUT_WRITE(SS_PIN, HIGH); - OUT_WRITE(MAX6675_SS, HIGH); + OUT_WRITE(MAX6675_SS_PIN, HIGH); #endif // HEATER_0_USES_MAX6675 + #if ENABLED(HEATER_1_USES_MAX6675) + OUT_WRITE(MAX6675_SS2_PIN, HIGH); + #endif + HAL_adc_init(); #if HAS_TEMP_ADC_0 @@ -1288,7 +1304,7 @@ void Temperature::init() { #define TEMP_MIN_ROUTINE(NR) \ minttemp[NR] = HEATER_ ##NR## _MINTEMP; \ - while (analog2temp(minttemp_raw[NR], NR) < HEATER_ ##NR## _MINTEMP) { \ + while (analog_to_celsius_hotend(minttemp_raw[NR], NR) < HEATER_ ##NR## _MINTEMP) { \ if (HEATER_ ##NR## _RAW_LO_TEMP < HEATER_ ##NR## _RAW_HI_TEMP) \ minttemp_raw[NR] += OVERSAMPLENR; \ else \ @@ -1296,7 +1312,7 @@ void Temperature::init() { } #define TEMP_MAX_ROUTINE(NR) \ maxttemp[NR] = HEATER_ ##NR## _MAXTEMP; \ - while (analog2temp(maxttemp_raw[NR], NR) > HEATER_ ##NR## _MAXTEMP) { \ + while (analog_to_celsius_hotend(maxttemp_raw[NR], NR) > HEATER_ ##NR## _MAXTEMP) { \ if (HEATER_ ##NR## _RAW_LO_TEMP < HEATER_ ##NR## _RAW_HI_TEMP) \ maxttemp_raw[NR] -= OVERSAMPLENR; \ else \ @@ -1352,7 +1368,7 @@ void Temperature::init() { #if HAS_HEATED_BED #ifdef BED_MINTEMP - while (analog2tempBed(bed_minttemp_raw) < BED_MINTEMP) { + while (analog_to_celsius_bed(bed_minttemp_raw) < BED_MINTEMP) { #if HEATER_BED_RAW_LO_TEMP < HEATER_BED_RAW_HI_TEMP bed_minttemp_raw += OVERSAMPLENR; #else @@ -1361,7 +1377,7 @@ void Temperature::init() { } #endif // BED_MINTEMP #ifdef BED_MAXTEMP - while (analog2tempBed(bed_maxttemp_raw) > BED_MAXTEMP) { + while (analog_to_celsius_bed(bed_maxttemp_raw) > BED_MAXTEMP) { #if HEATER_BED_RAW_LO_TEMP < HEATER_BED_RAW_HI_TEMP bed_maxttemp_raw -= OVERSAMPLENR; #else @@ -1427,7 +1443,7 @@ void Temperature::init() { #if HOTENDS == 1 UNUSED(e); #endif - if (degHotend(HOTEND_INDEX) < degTargetHotend(HOTEND_INDEX) - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1)) { + if (degTargetHotend(HOTEND_INDEX) && degHotend(HOTEND_INDEX) < degTargetHotend(HOTEND_INDEX) - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1)) { watch_target_temp[HOTEND_INDEX] = degHotend(HOTEND_INDEX) + WATCH_TEMP_INCREASE; watch_heater_next_ms[HOTEND_INDEX] = millis() + (WATCH_TEMP_PERIOD) * 1000UL; } @@ -1443,7 +1459,7 @@ void Temperature::init() { * This is called when the temperature is set. (M140, M190) */ void Temperature::start_watching_bed() { - if (degBed() < degTargetBed() - (WATCH_BED_TEMP_INCREASE + TEMP_BED_HYSTERESIS + 1)) { + if (degTargetBed() && degBed() < degTargetBed() - (WATCH_BED_TEMP_INCREASE + TEMP_BED_HYSTERESIS + 1)) { watch_target_bed_temp = degBed() + WATCH_BED_TEMP_INCREASE; watch_bed_next_ms = millis() + (WATCH_BED_TEMP_PERIOD) * 1000UL; } @@ -1544,9 +1560,6 @@ void Temperature::disable_all_heaters() { pause(false); #endif - // If all heaters go down then for sure our print job has stopped - print_job_timer.stop(); - #define DISABLE_HEATER(NR) { \ setTargetHotend(0, NR); \ soft_pwm_amount[NR] = 0; \ @@ -1603,47 +1616,71 @@ void Temperature::disable_all_heaters() { #endif // PROBING_HEATERS_OFF -#if ENABLED(HEATER_0_USES_MAX6675) +#if HAS_MAX6675 - #define MAX6675_HEAT_INTERVAL 250u + int Temperature::read_max6675( + #if COUNT_6675 > 1 + const uint8_t hindex + #endif + ) { + #if COUNT_6675 == 1 + constexpr uint8_t hindex = 0; + #endif - #if ENABLED(MAX6675_IS_MAX31855) - uint32_t max6675_temp = 2000; - #define MAX6675_ERROR_MASK 7 - #define MAX6675_DISCARD_BITS 18 - #define MAX6675_SPEED_BITS 3 // (_BV(SPR1)) // clock ÷ 64 - #else - uint16_t max6675_temp = 2000; - #define MAX6675_ERROR_MASK 4 - #define MAX6675_DISCARD_BITS 3 - #define MAX6675_SPEED_BITS 2 // (_BV(SPR0)) // clock ÷ 16 - #endif + #define MAX6675_HEAT_INTERVAL 250UL - int Temperature::read_max6675() { - - static millis_t next_max6675_ms = 0; + #if ENABLED(MAX6675_IS_MAX31855) + static uint32_t max6675_temp = 2000; + #define MAX6675_ERROR_MASK 7 + #define MAX6675_DISCARD_BITS 18 + #define MAX6675_SPEED_BITS 3 // (_BV(SPR1)) // clock ÷ 64 + #else + static uint16_t max6675_temp = 2000; + #define MAX6675_ERROR_MASK 4 + #define MAX6675_DISCARD_BITS 3 + #define MAX6675_SPEED_BITS 2 // (_BV(SPR0)) // clock ÷ 16 + #endif + // Return last-read value between readings + static millis_t next_max6675_ms[COUNT_6675] = { 0 }; millis_t ms = millis(); + if (PENDING(ms, next_max6675_ms[hindex])) return int(max6675_temp); + next_max6675_ms[hindex] = ms + MAX6675_HEAT_INTERVAL; - if (PENDING(ms, next_max6675_ms)) return (int)max6675_temp; + // + // TODO: spiBegin, spiRec and spiInit doesn't work when soft spi is used. + // + #if MB(MIGHTYBOARD_REVE) + spiBegin(); + spiInit(MAX6675_SPEED_BITS); + #endif - next_max6675_ms = ms + MAX6675_HEAT_INTERVAL; + #if COUNT_6675 > 1 + #define WRITE_MAX6675(V) do{ switch (hindex) { case 1: WRITE(MAX6675_SS2_PIN, V); break; default: WRITE(MAX6675_SS_PIN, V); } }while(0) + #elif ENABLED(HEATER_1_USES_MAX6675) + #define WRITE_MAX6675(V) WRITE(MAX6675_SS2_PIN, V) + #else + #define WRITE_MAX6675(V) WRITE(MAX6675_SS_PIN, V) + #endif - spiBegin(); - spiInit(MAX6675_SPEED_BITS); - - WRITE(MAX6675_SS, 0); // enable TT_MAX6675 + WRITE_MAX6675(LOW); // enable TT_MAX6675 DELAY_NS(100); // Ensure 100ns delay // Read a big-endian temperature value max6675_temp = 0; for (uint8_t i = sizeof(max6675_temp); i--;) { - max6675_temp |= spiRec(); + max6675_temp |= ( + #if MB(MIGHTYBOARD_REVE) + max6675_spi.receive() + #else + spiRec() + #endif + ); if (i > 0) max6675_temp <<= 8; // shift left if not the last byte } - WRITE(MAX6675_SS, 1); // disable TT_MAX6675 + WRITE_MAX6675(HIGH); // disable TT_MAX6675 if (max6675_temp & MAX6675_ERROR_MASK) { SERIAL_ERROR_START(); @@ -1659,7 +1696,17 @@ void Temperature::disable_all_heaters() { #else SERIAL_ERRORLNPGM("MAX6675"); #endif - max6675_temp = MAX6675_TMAX * 4; // thermocouple open + + // Thermocouple open + max6675_temp = 4 * ( + #if COUNT_6675 > 1 + hindex ? HEATER_1_MAX6675_TMAX : HEATER_0_MAX6675_TMAX + #elif ENABLED(HEATER_1_USES_MAX6675) + HEATER_1_MAX6675_TMAX + #else + HEATER_0_MAX6675_TMAX + #endif + ); } else max6675_temp >>= MAX6675_DISCARD_BITS; @@ -1668,24 +1715,28 @@ void Temperature::disable_all_heaters() { if (max6675_temp & 0x00002000) max6675_temp |= 0xFFFFC000; #endif - return (int)max6675_temp; + return int(max6675_temp); } -#endif // HEATER_0_USES_MAX6675 +#endif // HAS_MAX6675 /** * Get raw temperatures */ void Temperature::set_current_temp_raw() { + #if HAS_TEMP_ADC_0 && DISABLED(HEATER_0_USES_MAX6675) current_temperature_raw[0] = raw_temp_value[0]; #endif + #if HAS_TEMP_ADC_1 + #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT) redundant_temperature_raw = raw_temp_value[1]; - #else + #elif DISABLED(HEATER_1_USES_MAX6675) current_temperature_raw[1] = raw_temp_value[1]; #endif + #if HAS_TEMP_ADC_2 current_temperature_raw[2] = raw_temp_value[2]; #if HAS_TEMP_ADC_3 @@ -1698,6 +1749,7 @@ void Temperature::set_current_temp_raw() { #endif // HAS_TEMP_ADC_4 #endif // HAS_TEMP_ADC_3 #endif // HAS_TEMP_ADC_2 + #endif // HAS_TEMP_ADC_1 #if HAS_HEATED_BED @@ -1779,17 +1831,17 @@ void Temperature::readings_ready() { #if HAS_HEATED_BED #if HEATER_BED_RAW_LO_TEMP > HEATER_BED_RAW_HI_TEMP - #define GEBED <= + #define BEDCMP(A,B) ((A)<=(B)) #else - #define GEBED >= + #define BEDCMP(A,B) ((A)>=(B)) #endif const bool bed_on = (target_temperature_bed > 0) #if ENABLED(PIDTEMPBED) || (soft_pwm_amount_bed > 0) #endif ; - if (current_temperature_bed_raw GEBED bed_maxttemp_raw) max_temp_error(-1); - if (bed_minttemp_raw GEBED current_temperature_bed_raw && bed_on) min_temp_error(-1); + if (BEDCMP(current_temperature_bed_raw, bed_maxttemp_raw)) max_temp_error(-1); + if (BEDCMP(bed_minttemp_raw, current_temperature_bed_raw) && bed_on) min_temp_error(-1); #endif } @@ -1823,7 +1875,8 @@ void Temperature::isr() { static uint8_t pwm_count = _BV(SOFT_PWM_SCALE); // avoid multiple loads of pwm_count uint8_t pwm_count_tmp = pwm_count; - #if ENABLED(ADC_KEYPAD) + + #if HAS_ADC_BUTTONS static unsigned int raw_ADCKey_value = 0; #endif @@ -2114,7 +2167,7 @@ void Temperature::isr() { // Update lcd buttons 488 times per second // static bool do_buttons; - if ((do_buttons ^= true)) lcd_buttons_update(); + if ((do_buttons ^= true)) ui.update_buttons(); /** * One sensor is sampled on every other call of the ISR. @@ -2244,7 +2297,7 @@ void Temperature::isr() { break; #endif - #if ENABLED(ADC_KEYPAD) + #if HAS_ADC_BUTTONS case Prepare_ADC_KEY: HAL_START_ADC(ADC_KEYPAD_PIN); break; @@ -2337,15 +2390,15 @@ void Temperature::isr() { delay(2); } - void Temperature::print_heaterstates( + void Temperature::print_heater_states(const uint8_t target_extruder #if NUM_SERIAL > 1 - const int8_t port + , const int8_t port #endif ) { #if HAS_TEMP_HOTEND - print_heater_state(degHotend(gcode.target_extruder), degTargetHotend(gcode.target_extruder) + print_heater_state(degHotend(target_extruder), degTargetHotend(target_extruder) #if ENABLED(SHOW_TEMP_ADC_VALUES) - , rawHotendTemp(gcode.target_extruder) + , rawHotendTemp(target_extruder) #endif #if NUM_SERIAL > 1 , port @@ -2383,7 +2436,7 @@ void Temperature::isr() { ); #endif SERIAL_PROTOCOLPGM_P(port, " @:"); - SERIAL_PROTOCOL_P(port, getHeaterPower(gcode.target_extruder)); + SERIAL_PROTOCOL_P(port, getHeaterPower(target_extruder)); #if HAS_HEATED_BED SERIAL_PROTOCOLPGM_P(port, " B@:"); SERIAL_PROTOCOL_P(port, getHeaterPower(-1)); @@ -2405,11 +2458,262 @@ void Temperature::isr() { void Temperature::auto_report_temperatures() { if (auto_report_temp_interval && ELAPSED(millis(), next_temp_report_ms)) { next_temp_report_ms = millis() + 1000UL * auto_report_temp_interval; - print_heaterstates(); + print_heater_states(active_extruder); SERIAL_EOL(); } } #endif // AUTO_REPORT_TEMPERATURES + #if ENABLED(ULTRA_LCD) + void Temperature::set_heating_message(const uint8_t e) { + const bool heating = isHeatingHotend(e); + #if HOTENDS > 1 + ui.status_printf_P(0, heating ? PSTR("E%i " MSG_HEATING) : PSTR("E%i " MSG_COOLING), int(e + 1)); + #else + ui.set_status_P(heating ? PSTR("E " MSG_HEATING) : PSTR("E " MSG_COOLING)); + #endif + } + #endif + + #if HAS_TEMP_HOTEND + + #ifndef MIN_COOLING_SLOPE_DEG + #define MIN_COOLING_SLOPE_DEG 1.50 + #endif + #ifndef MIN_COOLING_SLOPE_TIME + #define MIN_COOLING_SLOPE_TIME 60 + #endif + + bool Temperature::wait_for_hotend(const uint8_t target_extruder, const bool no_wait_for_cooling/*=true*/ + #if G26_CLICK_CAN_CANCEL + , const bool click_to_cancel/*=false*/ + #endif + ) { + #if TEMP_RESIDENCY_TIME > 0 + millis_t residency_start_ms = 0; + // Loop until the temperature has stabilized + #define TEMP_CONDITIONS (!residency_start_ms || PENDING(now, residency_start_ms + (TEMP_RESIDENCY_TIME) * 1000UL)) + #else + // Loop until the temperature is very close target + #define TEMP_CONDITIONS (wants_to_cool ? isCoolingHotend(target_extruder) : isHeatingHotend(target_extruder)) + #endif + + #if DISABLED(BUSY_WHILE_HEATING) && ENABLED(HOST_KEEPALIVE_FEATURE) + const GcodeSuite::MarlinBusyState old_busy_state = gcode.busy_state; + KEEPALIVE_STATE(NOT_BUSY); + #endif + + #if ENABLED(PRINTER_EVENT_LEDS) + const float start_temp = degHotend(target_extruder); + printerEventLEDs.onHotendHeatingStart(); + #endif + + float target_temp = -1.0, old_temp = 9999.0; + bool wants_to_cool = false; + wait_for_heatup = true; + millis_t now, next_temp_ms = 0, next_cool_check_ms = 0; + do { + // Target temperature might be changed during the loop + if (target_temp != degTargetHotend(target_extruder)) { + wants_to_cool = isCoolingHotend(target_extruder); + target_temp = degTargetHotend(target_extruder); + + // Exit if S, continue if S, R, or R + if (no_wait_for_cooling && wants_to_cool) break; + } + + now = millis(); + if (ELAPSED(now, next_temp_ms)) { // Print temp & remaining time every 1s while waiting + next_temp_ms = now + 1000UL; + print_heater_states(target_extruder); + #if TEMP_RESIDENCY_TIME > 0 + SERIAL_PROTOCOLPGM(" W:"); + if (residency_start_ms) + SERIAL_PROTOCOL(long((((TEMP_RESIDENCY_TIME) * 1000UL) - (now - residency_start_ms)) / 1000UL)); + else + SERIAL_PROTOCOLCHAR('?'); + #endif + SERIAL_EOL(); + } + + idle(); + gcode.reset_stepper_timeout(); // Keep steppers powered + + const float temp = degHotend(target_extruder); + + #if ENABLED(PRINTER_EVENT_LEDS) + // Gradually change LED strip from violet to red as nozzle heats up + if (!wants_to_cool) printerEventLEDs.onHotendHeating(start_temp, temp, target_temp); + #endif + + #if TEMP_RESIDENCY_TIME > 0 + + const float temp_diff = ABS(target_temp - temp); + + if (!residency_start_ms) { + // Start the TEMP_RESIDENCY_TIME timer when we reach target temp for the first time. + if (temp_diff < TEMP_WINDOW) residency_start_ms = now; + } + else if (temp_diff > TEMP_HYSTERESIS) { + // Restart the timer whenever the temperature falls outside the hysteresis. + residency_start_ms = now; + } + + #endif + + // Prevent a wait-forever situation if R is misused i.e. M109 R0 + if (wants_to_cool) { + // break after MIN_COOLING_SLOPE_TIME seconds + // if the temperature did not drop at least MIN_COOLING_SLOPE_DEG + if (!next_cool_check_ms || ELAPSED(now, next_cool_check_ms)) { + if (old_temp - temp < float(MIN_COOLING_SLOPE_DEG)) break; + next_cool_check_ms = now + 1000UL * MIN_COOLING_SLOPE_TIME; + old_temp = temp; + } + } + + #if G26_CLICK_CAN_CANCEL + if (click_to_cancel && ui.use_click()) { + wait_for_heatup = false; + ui.quick_feedback(); + } + #endif + + } while (wait_for_heatup && TEMP_CONDITIONS); + + if (wait_for_heatup) { + ui.reset_status(); + #if ENABLED(PRINTER_EVENT_LEDS) + printerEventLEDs.onHeatingDone(); + #endif + } + + #if DISABLED(BUSY_WHILE_HEATING) && ENABLED(HOST_KEEPALIVE_FEATURE) + gcode.busy_state = old_busy_state; + #endif + + return wait_for_heatup; + } + + #endif // HAS_TEMP_HOTEND + + #if HAS_HEATED_BED + + #ifndef MIN_COOLING_SLOPE_DEG_BED + #define MIN_COOLING_SLOPE_DEG_BED 1.50 + #endif + #ifndef MIN_COOLING_SLOPE_TIME_BED + #define MIN_COOLING_SLOPE_TIME_BED 60 + #endif + + bool Temperature::wait_for_bed(const bool no_wait_for_cooling + #if G26_CLICK_CAN_CANCEL + , const bool click_to_cancel/*=false*/ + #endif + ) { + #if TEMP_BED_RESIDENCY_TIME > 0 + millis_t residency_start_ms = 0; + // Loop until the temperature has stabilized + #define TEMP_BED_CONDITIONS (!residency_start_ms || PENDING(now, residency_start_ms + (TEMP_BED_RESIDENCY_TIME) * 1000UL)) + #else + // Loop until the temperature is very close target + #define TEMP_BED_CONDITIONS (wants_to_cool ? isCoolingBed() : isHeatingBed()) + #endif + + float target_temp = -1, old_temp = 9999; + bool wants_to_cool = false; + wait_for_heatup = true; + millis_t now, next_temp_ms = 0, next_cool_check_ms = 0; + + #if DISABLED(BUSY_WHILE_HEATING) && ENABLED(HOST_KEEPALIVE_FEATURE) + const GcodeSuite::MarlinBusyState old_busy_state = gcode.busy_state; + KEEPALIVE_STATE(NOT_BUSY); + #endif + + #if ENABLED(PRINTER_EVENT_LEDS) + const float start_temp = degBed(); + printerEventLEDs.onBedHeatingStart(); + #endif + + do { + // Target temperature might be changed during the loop + if (target_temp != degTargetBed()) { + wants_to_cool = isCoolingBed(); + target_temp = degTargetBed(); + + // Exit if S, continue if S, R, or R + if (no_wait_for_cooling && wants_to_cool) break; + } + + now = millis(); + if (ELAPSED(now, next_temp_ms)) { //Print Temp Reading every 1 second while heating up. + next_temp_ms = now + 1000UL; + print_heater_states(active_extruder); + #if TEMP_BED_RESIDENCY_TIME > 0 + SERIAL_PROTOCOLPGM(" W:"); + if (residency_start_ms) + SERIAL_PROTOCOL(long((((TEMP_BED_RESIDENCY_TIME) * 1000UL) - (now - residency_start_ms)) / 1000UL)); + else + SERIAL_PROTOCOLCHAR('?'); + #endif + SERIAL_EOL(); + } + + idle(); + gcode.reset_stepper_timeout(); // Keep steppers powered + + const float temp = degBed(); + + #if ENABLED(PRINTER_EVENT_LEDS) + // Gradually change LED strip from blue to violet as bed heats up + if (!wants_to_cool) printerEventLEDs.onBedHeating(start_temp, temp, target_temp); + #endif + + #if TEMP_BED_RESIDENCY_TIME > 0 + + const float temp_diff = ABS(target_temp - temp); + + if (!residency_start_ms) { + // Start the TEMP_BED_RESIDENCY_TIME timer when we reach target temp for the first time. + if (temp_diff < TEMP_BED_WINDOW) residency_start_ms = now; + } + else if (temp_diff > TEMP_BED_HYSTERESIS) { + // Restart the timer whenever the temperature falls outside the hysteresis. + residency_start_ms = now; + } + + #endif // TEMP_BED_RESIDENCY_TIME > 0 + + // Prevent a wait-forever situation if R is misused i.e. M190 R0 + if (wants_to_cool) { + // Break after MIN_COOLING_SLOPE_TIME_BED seconds + // if the temperature did not drop at least MIN_COOLING_SLOPE_DEG_BED + if (!next_cool_check_ms || ELAPSED(now, next_cool_check_ms)) { + if (old_temp - temp < float(MIN_COOLING_SLOPE_DEG_BED)) break; + next_cool_check_ms = now + 1000UL * MIN_COOLING_SLOPE_TIME_BED; + old_temp = temp; + } + } + + #if G26_CLICK_CAN_CANCEL + if (click_to_cancel && ui.use_click()) { + wait_for_heatup = false; + ui.quick_feedback(); + } + #endif + + } while (wait_for_heatup && TEMP_BED_CONDITIONS); + + if (wait_for_heatup) ui.reset_status(); + + #if DISABLED(BUSY_WHILE_HEATING) && ENABLED(HOST_KEEPALIVE_FEATURE) + gcode.busy_state = old_busy_state; + #endif + + return wait_for_heatup; + } + + #endif // HAS_HEATED_BED + #endif // HAS_TEMP_SENSOR diff --git a/Marlin/src/module/temperature.h b/Marlin/src/module/temperature.h index f91de03b57..28365913dc 100644 --- a/Marlin/src/module/temperature.h +++ b/Marlin/src/module/temperature.h @@ -19,14 +19,12 @@ * along with this program. If not, see . * */ +#pragma once /** * temperature.h - temperature controller */ -#ifndef TEMPERATURE_H -#define TEMPERATURE_H - #include "thermistor/thermistors.h" #include "../inc/MarlinConfig.h" @@ -48,6 +46,35 @@ #define HOTEND_INDEX e #endif +// PID storage +typedef struct { float Kp, Ki, Kd; } PID_t; +typedef struct { float Kp, Ki, Kd, Kc; } PIDC_t; +#if ENABLED(PID_EXTRUSION_SCALING) + typedef PIDC_t hotend_pid_t; +#else + typedef PID_t hotend_pid_t; +#endif + +#define DUMMY_PID_VALUE 3000.0f + +#if ENABLED(PIDTEMP) + #define _PID_Kp(H) Temperature::pid[H].Kp + #define _PID_Ki(H) Temperature::pid[H].Ki + #define _PID_Kd(H) Temperature::pid[H].Kd + #if ENABLED(PID_EXTRUSION_SCALING) + #define _PID_Kc(H) Temperature::pid[H].Kc + #else + #define _PID_Kc(H) 1 + #endif +#else + #define _PID_Kp(H) DUMMY_PID_VALUE + #define _PID_Ki(H) DUMMY_PID_VALUE + #define _PID_Kd(H) DUMMY_PID_VALUE + #define _PID_Kc(H) 1 +#endif + +#define PID_PARAM(F,H) _PID_##F(H) + /** * States for ADC reading in the ISR */ @@ -85,7 +112,7 @@ enum ADCSensorState : char { Prepare_FILWIDTH, Measure_FILWIDTH, #endif - #if ENABLED(ADC_KEYPAD) + #if HAS_ADC_BUTTONS Prepare_ADC_KEY, Measure_ADC_KEY, #endif @@ -111,6 +138,8 @@ enum ADCSensorState : char { #define unscalePID_d(d) ( float(d) * PID_dT ) #endif +#define G26_CLICK_CAN_CANCEL (HAS_LCD_MENU && ENABLED(G26_MESH_VALIDATION)) + class Temperature { public: @@ -123,7 +152,7 @@ class Temperature { static uint8_t soft_pwm_amount[HOTENDS]; #if ENABLED(AUTO_POWER_E_FANS) - static int16_t autofan_speed[HOTENDS]; + static uint8_t autofan_speed[HOTENDS]; #endif #if ENABLED(FAN_SOFT_PWM) @@ -132,25 +161,7 @@ class Temperature { #endif #if ENABLED(PIDTEMP) - - #if ENABLED(PID_PARAMS_PER_HOTEND) && HOTENDS > 1 - - static float Kp[HOTENDS], Ki[HOTENDS], Kd[HOTENDS]; - #if ENABLED(PID_EXTRUSION_SCALING) - static float Kc[HOTENDS]; - #endif - #define PID_PARAM(param, h) Temperature::param[h] - - #else - - static float Kp, Ki, Kd; - #if ENABLED(PID_EXTRUSION_SCALING) - static float Kc; - #endif - #define PID_PARAM(param, h) Temperature::param - - #endif // PID_PARAMS_PER_HOTEND - + static hotend_pid_t pid[HOTENDS]; #endif #if HAS_HEATED_BED @@ -158,7 +169,7 @@ class Temperature { static int16_t current_temperature_bed_raw, target_temperature_bed; static uint8_t soft_pwm_amount_bed; #if ENABLED(PIDTEMPBED) - static float bedKp, bedKi, bedKd; + static PID_t bed_pid; #endif #endif @@ -210,21 +221,11 @@ class Temperature { #endif #if ENABLED(PIDTEMP) - static float temp_iState[HOTENDS], - temp_dState[HOTENDS], - pTerm[HOTENDS], - iTerm[HOTENDS], - dTerm[HOTENDS]; - #if ENABLED(PID_EXTRUSION_SCALING) - static float cTerm[HOTENDS]; static long last_e_position; static long lpq[LPQ_MAX_LEN]; static int lpq_ptr; #endif - - static float pid_error[HOTENDS]; - static bool pid_reset[HOTENDS]; #endif // Init min and max temp with extreme values to prevent false errors during startup @@ -239,14 +240,7 @@ class Temperature { static uint16_t watch_target_bed_temp; static millis_t watch_bed_next_ms; #endif - #if ENABLED(PIDTEMPBED) - static float temp_iState_bed, - temp_dState_bed, - pTerm_bed, - iTerm_bed, - dTerm_bed, - pid_error_bed; - #else + #if DISABLED(PIDTEMPBED) static millis_t next_bed_check_ms; #endif #if HEATER_IDLE_HANDLER @@ -297,7 +291,7 @@ class Temperature { #endif public: - #if ENABLED(ADC_KEYPAD) + #if HAS_ADC_BUTTONS static uint32_t current_ADCKey_raw; static uint8_t ADCKey_count; #endif @@ -317,13 +311,13 @@ class Temperature { /** * Static (class) methods */ - static float analog2temp(const int raw, const uint8_t e); + static float analog_to_celsius_hotend(const int raw, const uint8_t e); #if HAS_HEATED_BED - static float analog2tempBed(const int raw); + static float analog_to_celsius_bed(const int raw); #endif #if HAS_TEMP_CHAMBER - static float analog2tempChamber(const int raw); + static float analog_to_celsiusChamber(const int raw); #endif /** @@ -364,7 +358,7 @@ class Temperature { #endif #if ENABLED(FILAMENT_WIDTH_SENSOR) - static float analog2widthFil(); // Convert raw Filament Width to millimeters + static float analog_to_mm_fil_width(); // Convert raw Filament Width to millimeters static int8_t widthFil_to_size_ratio(); // Convert Filament Width (mm) to an extrusion ratio #endif @@ -433,7 +427,16 @@ class Temperature { return target_temperature[HOTEND_INDEX] < current_temperature[HOTEND_INDEX]; } + #if HAS_TEMP_HOTEND + static bool wait_for_hotend(const uint8_t target_extruder, const bool no_wait_for_cooling=true + #if G26_CLICK_CAN_CANCEL + , const bool click_to_cancel=false + #endif + ); + #endif + #if HAS_HEATED_BED + #if ENABLED(SHOW_TEMP_ADC_VALUES) FORCE_INLINE static int16_t rawBedTemp() { return current_temperature_bed_raw; } #endif @@ -461,7 +464,14 @@ class Temperature { #if WATCH_THE_BED static void start_watching_bed(); #endif - #endif + + static bool wait_for_bed(const bool no_wait_for_cooling + #if G26_CLICK_CAN_CANCEL + , const bool click_to_cancel=false + #endif + ); + + #endif // HAS_HEATED_BED #if HAS_TEMP_CHAMBER #if ENABLED(SHOW_TEMP_ADC_VALUES) @@ -470,7 +480,7 @@ class Temperature { FORCE_INLINE static float degChamber() { return current_temperature_chamber; } #endif - FORCE_INLINE static bool wait_for_heating(const uint8_t e) { + FORCE_INLINE static bool still_heating(const uint8_t e) { return degTargetHotend(e) > TEMP_HYSTERESIS && ABS(degHotend(e) - degTargetHotend(e)) > TEMP_HYSTERESIS; } @@ -519,6 +529,7 @@ class Temperature { babystepsTodo[CORE_AXIS_2] -= CORESIGN(distance * 2); break; case NORMAL_AXIS: // Z on CoreXY, Y on CoreXZ, X on CoreYZ + default: babystepsTodo[NORMAL_AXIS] += distance; break; } @@ -590,9 +601,9 @@ class Temperature { #endif // HEATER_IDLE_HANDLER #if HAS_TEMP_SENSOR - static void print_heaterstates( + static void print_heater_states(const uint8_t target_extruder #if NUM_SERIAL > 1 - const int8_t port = -1 + , const int8_t port = -1 #endif ); #if ENABLED(AUTO_REPORT_TEMPERATURES) @@ -607,6 +618,10 @@ class Temperature { #endif #endif + #if ENABLED(ULTRA_LCD) + static void set_heating_message(const uint8_t e); + #endif + private: #if ENABLED(FAST_PWM_FAN) @@ -617,8 +632,23 @@ class Temperature { static void updateTemperaturesFromRawValues(); - #if ENABLED(HEATER_0_USES_MAX6675) - static int read_max6675(); + #define HAS_MAX6675 (ENABLED(HEATER_0_USES_MAX6675) || ENABLED(HEATER_1_USES_MAX6675)) + #if HAS_MAX6675 + #if ENABLED(HEATER_0_USES_MAX6675) && ENABLED(HEATER_1_USES_MAX6675) + #define COUNT_6675 2 + #else + #define COUNT_6675 1 + #endif + #if COUNT_6675 > 1 + #define READ_MAX6675(N) read_max6675(N) + #else + #define READ_MAX6675(N) read_max6675() + #endif + static int read_max6675( + #if COUNT_6675 > 1 + const uint8_t hindex=0 + #endif + ); #endif static void checkExtruderAutoFans(); @@ -629,7 +659,7 @@ class Temperature { static float get_pid_output_bed(); #endif - static void _temp_error(const int8_t e, const char * const serial_msg, const char * const lcd_msg); + static void _temp_error(const int8_t e, PGM_P const serial_msg, PGM_P const lcd_msg); static void min_temp_error(const int8_t e); static void max_temp_error(const int8_t e); @@ -650,9 +680,6 @@ class Temperature { #endif #endif // THERMAL_PROTECTION - }; extern Temperature thermalManager; - -#endif // TEMPERATURE_H diff --git a/Marlin/src/module/thermistor/thermistor_1010.h b/Marlin/src/module/thermistor/thermistor_1010.h index 79a557954e..863a92fff8 100644 --- a/Marlin/src/module/thermistor/thermistor_1010.h +++ b/Marlin/src/module/thermistor/thermistor_1010.h @@ -22,17 +22,17 @@ // Pt1000 with 1k0 pullup const short temptable_1010[][2] PROGMEM = { - PtLine( 0, 1000, 1000) - PtLine( 25, 1000, 1000) - PtLine( 50, 1000, 1000) - PtLine( 75, 1000, 1000) - PtLine(100, 1000, 1000) - PtLine(125, 1000, 1000) - PtLine(150, 1000, 1000) - PtLine(175, 1000, 1000) - PtLine(200, 1000, 1000) - PtLine(225, 1000, 1000) - PtLine(250, 1000, 1000) - PtLine(275, 1000, 1000) + PtLine( 0, 1000, 1000), + PtLine( 25, 1000, 1000), + PtLine( 50, 1000, 1000), + PtLine( 75, 1000, 1000), + PtLine(100, 1000, 1000), + PtLine(125, 1000, 1000), + PtLine(150, 1000, 1000), + PtLine(175, 1000, 1000), + PtLine(200, 1000, 1000), + PtLine(225, 1000, 1000), + PtLine(250, 1000, 1000), + PtLine(275, 1000, 1000), PtLine(300, 1000, 1000) }; diff --git a/Marlin/src/module/thermistor/thermistor_1047.h b/Marlin/src/module/thermistor/thermistor_1047.h index 01997abc3a..b4c69f5803 100644 --- a/Marlin/src/module/thermistor/thermistor_1047.h +++ b/Marlin/src/module/thermistor/thermistor_1047.h @@ -23,11 +23,11 @@ // Pt1000 with 4k7 pullup const short temptable_1047[][2] PROGMEM = { // only a few values are needed as the curve is very flat - PtLine( 0, 1000, 4700) - PtLine( 50, 1000, 4700) - PtLine(100, 1000, 4700) - PtLine(150, 1000, 4700) - PtLine(200, 1000, 4700) - PtLine(250, 1000, 4700) + PtLine( 0, 1000, 4700), + PtLine( 50, 1000, 4700), + PtLine(100, 1000, 4700), + PtLine(150, 1000, 4700), + PtLine(200, 1000, 4700), + PtLine(250, 1000, 4700), PtLine(300, 1000, 4700) }; diff --git a/Marlin/src/module/thermistor/thermistor_110.h b/Marlin/src/module/thermistor/thermistor_110.h index 7a4c80df71..5a5d387d4d 100644 --- a/Marlin/src/module/thermistor/thermistor_110.h +++ b/Marlin/src/module/thermistor/thermistor_110.h @@ -23,11 +23,11 @@ // Pt100 with 1k0 pullup const short temptable_110[][2] PROGMEM = { // only a few values are needed as the curve is very flat - PtLine( 0, 100, 1000) - PtLine( 50, 100, 1000) - PtLine(100, 100, 1000) - PtLine(150, 100, 1000) - PtLine(200, 100, 1000) - PtLine(250, 100, 1000) + PtLine( 0, 100, 1000), + PtLine( 50, 100, 1000), + PtLine(100, 100, 1000), + PtLine(150, 100, 1000), + PtLine(200, 100, 1000), + PtLine(250, 100, 1000), PtLine(300, 100, 1000) }; diff --git a/Marlin/src/module/thermistor/thermistor_147.h b/Marlin/src/module/thermistor/thermistor_147.h index 7e4a3b6fb6..22fe8a8e76 100644 --- a/Marlin/src/module/thermistor/thermistor_147.h +++ b/Marlin/src/module/thermistor/thermistor_147.h @@ -23,11 +23,11 @@ // Pt100 with 4k7 pullup const short temptable_147[][2] PROGMEM = { // only a few values are needed as the curve is very flat - PtLine( 0, 100, 4700) - PtLine( 50, 100, 4700) - PtLine(100, 100, 4700) - PtLine(150, 100, 4700) - PtLine(200, 100, 4700) - PtLine(250, 100, 4700) + PtLine( 0, 100, 4700), + PtLine( 50, 100, 4700), + PtLine(100, 100, 4700), + PtLine(150, 100, 4700), + PtLine(200, 100, 4700), + PtLine(250, 100, 4700), PtLine(300, 100, 4700) }; diff --git a/Marlin/src/module/thermistor/thermistor_75.h b/Marlin/src/module/thermistor/thermistor_75.h index 5d9350a9ce..488535aaad 100644 --- a/Marlin/src/module/thermistor/thermistor_75.h +++ b/Marlin/src/module/thermistor/thermistor_75.h @@ -20,51 +20,60 @@ * */ -// R25 = 100 kOhm, beta25 = 4100 K, 4.7 kOhm pull-up, -// Generic Silicon Heat Pad with NTC 100K thermistor -// -// Many of the generic silicon heat pads use the MGB18-104F39050L32 Thermistor It is used for various -// wattage and voltage heat pads. This table is correct if this part is used. It has been -// optimized to provide good granularity around the 60 C. and 110 C. which corrisponds to bed temperatures -// for PLA and ABS. If you are printing higher temperature filament such as nylon you can uncomment -// the higher earlier entries in the table to give better accuracy. But for speed reasons, if these -// temperatures are not going to be used, it is better to leave them commented out. +/** + * R25 = 100 kOhm, beta25 = 4100 K, 4.7 kOhm pull-up, + * Generic Silicon Heat Pad with NTC 100K thermistor + * + * Many generic silicone heat pads use the MGB18-104F39050L32 thermistor, applicable to various + * wattages and voltages. This table is correct if this part is used. It's been optimized + * to provide good granularity in the 60-110C range, good for PLA and ABS. For higher temperature + * filament (e.g., nylon) uncomment HIGH_TEMP_RANGE_75 for increased accuracy. If higher + * temperatures aren't used it can improve performance slightly to leave it commented out. + */ + +//#define HIGH_TEMP_RANGE_75 const short temptable_75[][2] PROGMEM = { // Generic Silicon Heat Pad with NTC 100K MGB18-104F39050L32 thermistor - { (short) ( 111.06 * OVERSAMPLENR ), 200 }, // v=0.542 r=571.747 res=0.501 degC/count -// { (short) ( 174.87 * OVERSAMPLENR ), 175 }, // v=0.854 r=967.950 res=0.311 degC/count These values are valid. But they serve no -// { (short) ( 191.64 * OVERSAMPLENR ), 170 }, // v=0.936 r=1082.139 res=0.284 degC/count purpose. It is better to delete them so -// { (short) ( 209.99 * OVERSAMPLENR ), 165 }, // v=1.025 r=1212.472 res=0.260 degC/count the search is quicker and get to the meaningful -// { (short) ( 230.02 * OVERSAMPLENR ), 160 }, // v=1.123 r=1361.590 res=0.239 degC/count part of the table sooner. -// { (short) ( 251.80 * OVERSAMPLENR ), 155 }, // v=1.230 r=1532.621 res=0.220 degC/count - { (short) ( 275.43 * OVERSAMPLENR ), 150 }, // v=1.345 r=1729.283 res=0.203 degC/count -// { (short) ( 300.92 * OVERSAMPLENR ), 145 }, // v=1.469 r=1956.004 res=0.189 degC/coun - { (short) ( 328.32 * OVERSAMPLENR ), 140 }, // v=1.603 r=2218.081 res=0.176 degC/count - { (short) ( 388.65 * OVERSAMPLENR ), 130 }, // v=1.898 r=2874.980 res=0.156 degC/count - { (short) ( 421.39 * OVERSAMPLENR ), 125 }, // v=2.058 r=3286.644 res=0.149 degC/count - { (short) ( 455.65 * OVERSAMPLENR ), 120 }, // v=2.225 r=3768.002 res=0.143 degC/count - { (short) ( 491.17 * OVERSAMPLENR ), 115 }, // v=2.398 r=4332.590 res=0.139 degC/count - { (short) ( 527.68 * OVERSAMPLENR ), 110 }, // v=2.577 r=4996.905 res=0.136 degC/count - { (short) ( 564.81 * OVERSAMPLENR ), 105 }, // v=2.758 r=5781.120 res=0.134 degC/count - { (short) ( 602.19 * OVERSAMPLENR ), 100 }, // v=2.940 r=6710.000 res=0.134 degC/count - { (short) ( 676.03 * OVERSAMPLENR ), 90 }, // v=3.301 r=9131.018 res=0.138 degC/count - { (short) ( 745.85 * OVERSAMPLENR ), 80 }, // v=3.642 r=12602.693 res=0.150 degC/count - { (short) ( 778.31 * OVERSAMPLENR ), 75 }, // v=3.800 r=14889.001 res=0.159 degC/count - { (short) ( 808.75 * OVERSAMPLENR ), 70 }, // v=3.949 r=17658.700 res=0.171 degC/count - { (short) ( 836.94 * OVERSAMPLENR ), 65 }, // v=4.087 r=21028.040 res=0.185 degC/count - { (short) ( 862.74 * OVERSAMPLENR ), 60 }, // v=4.213 r=25144.568 res=0.204 degC/count - { (short) ( 886.08 * OVERSAMPLENR ), 55 }, // v=4.327 r=30196.449 res=0.227 degC/count - { (short) ( 906.97 * OVERSAMPLENR ), 50 }, // v=4.429 r=36424.838 res=0.255 degC/count - { (short) ( 941.65 * OVERSAMPLENR ), 40 }, // v=4.598 r=53745.337 res=0.333 degC/count - { (short) ( 967.76 * OVERSAMPLENR ), 30 }, // v=4.725 r=80880.630 res=0.452 degC/count - { (short) ( 978.03 * OVERSAMPLENR ), 25 }, // v=4.776 r=100000.000 res=0.535 degC/count - { (short) ( 981.68 * OVERSAMPLENR ), 23 }, // v=4.793 r=109024.395 res=0.573 degC/count - { (short) ( 983.41 * OVERSAMPLENR ), 22 }, // v=4.802 r=113875.430 res=0.594 degC/count - { (short) ( 985.08 * OVERSAMPLENR ), 21 }, // v=4.810 r=118968.955 res=0.616 degC/count - { (short) ( 986.70 * OVERSAMPLENR ), 20 }, // v=4.818 r=124318.354 res=0.638 degC/count - { (short) ( 993.94 * OVERSAMPLENR ), 15 }, // v=4.853 r=155431.302 res=0.768 degC/count - { (short) ( 999.96 * OVERSAMPLENR ), 10 }, // v=4.883 r=195480.023 res=0.934 degC/count - { (short) (1008.95 * OVERSAMPLENR ), 0 } // v=4.926 r=314997.575 res=1.418 degC/count + { OV(111.06), 200 }, // v=0.542 r=571.747 res=0.501 degC/count + + #ifdef HIGH_TEMP_RANGE_75 + { OV(174.87), 175 }, // v=0.854 r=967.950 res=0.311 degC/count These values are valid. But they serve no + { OV(191.64), 170 }, // v=0.936 r=1082.139 res=0.284 degC/count purpose. It is better to delete them so + { OV(209.99), 165 }, // v=1.025 r=1212.472 res=0.260 degC/count the search is quicker and get to the meaningful + { OV(230.02), 160 }, // v=1.123 r=1361.590 res=0.239 degC/count part of the table sooner. + { OV(251.80), 155 }, // v=1.230 r=1532.621 res=0.220 degC/count + #endif + + { OV(275.43), 150 }, // v=1.345 r=1729.283 res=0.203 degC/count + + #ifdef HIGH_TEMP_RANGE_75 + { OV(300.92), 145 }, // v=1.469 r=1956.004 res=0.189 degC/coun + #endif + + { OV(328.32), 140 }, // v=1.603 r=2218.081 res=0.176 degC/count + { OV(388.65), 130 }, // v=1.898 r=2874.980 res=0.156 degC/count + { OV(421.39), 125 }, // v=2.058 r=3286.644 res=0.149 degC/count + { OV(455.65), 120 }, // v=2.225 r=3768.002 res=0.143 degC/count + { OV(491.17), 115 }, // v=2.398 r=4332.590 res=0.139 degC/count + { OV(527.68), 110 }, // v=2.577 r=4996.905 res=0.136 degC/count + { OV(564.81), 105 }, // v=2.758 r=5781.120 res=0.134 degC/count + { OV(602.19), 100 }, // v=2.940 r=6710.000 res=0.134 degC/count + { OV(676.03), 90 }, // v=3.301 r=9131.018 res=0.138 degC/count + { OV(745.85), 80 }, // v=3.642 r=12602.693 res=0.150 degC/count + { OV(778.31), 75 }, // v=3.800 r=14889.001 res=0.159 degC/count + { OV(808.75), 70 }, // v=3.949 r=17658.700 res=0.171 degC/count + { OV(836.94), 65 }, // v=4.087 r=21028.040 res=0.185 degC/count + { OV(862.74), 60 }, // v=4.213 r=25144.568 res=0.204 degC/count + { OV(886.08), 55 }, // v=4.327 r=30196.449 res=0.227 degC/count + { OV(906.97), 50 }, // v=4.429 r=36424.838 res=0.255 degC/count + { OV(941.65), 40 }, // v=4.598 r=53745.337 res=0.333 degC/count + { OV(967.76), 30 }, // v=4.725 r=80880.630 res=0.452 degC/count + { OV(978.03), 25 }, // v=4.776 r=100000.000 res=0.535 degC/count + { OV(981.68), 23 }, // v=4.793 r=109024.395 res=0.573 degC/count + { OV(983.41), 22 }, // v=4.802 r=113875.430 res=0.594 degC/count + { OV(985.08), 21 }, // v=4.810 r=118968.955 res=0.616 degC/count + { OV(986.70), 20 }, // v=4.818 r=124318.354 res=0.638 degC/count + { OV(993.94), 15 }, // v=4.853 r=155431.302 res=0.768 degC/count + { OV(999.96), 10 }, // v=4.883 r=195480.023 res=0.934 degC/count + { OV(008.95), 0 } // v=4.926 r=314997.575 res=1.418 degC/count }; - - diff --git a/Marlin/src/module/thermistor/thermistors.h b/Marlin/src/module/thermistor/thermistors.h index 56b75e1739..953fdf7fea 100644 --- a/Marlin/src/module/thermistor/thermistors.h +++ b/Marlin/src/module/thermistor/thermistors.h @@ -19,9 +19,7 @@ * along with this program. If not, see . * */ - -#ifndef THERMISTORS_H_ -#define THERMISTORS_H_ +#pragma once #include "../../inc/MarlinConfig.h" @@ -36,9 +34,9 @@ // a=3.9083E-3, b=-5.775E-7 #define PtA 3.9083E-3 #define PtB -5.775E-7 -#define PtRt(T,R0) ((R0)*(1.0+(PtA)*(T)+(PtB)*(T)*(T))) -#define PtAdVal(T,R0,Rup) (short)(1024/(Rup/PtRt(T,R0)+1)) -#define PtLine(T,R0,Rup) { OV(PtAdVal(T,R0,Rup)), T }, +#define PtRt(T,R0) ((R0) * (1.0 + (PtA) * (T) + (PtB) * (T) * (T))) +#define PtAdVal(T,R0,Rup) (short)(1024 / (Rup / PtRt(T, R0) + 1)) +#define PtLine(T,R0,Rup) { OV(PtAdVal(T, R0, Rup)), T } #if ANY_THERMISTOR_IS(1) // beta25 = 4092 K, R25 = 100 kOhm, Pull-up = 4.7 kOhm, "EPCOS" #include "thermistor_1.h" @@ -276,5 +274,3 @@ static_assert(HEATER_0_TEMPTABLE_LEN < 256 && HEATER_1_TEMPTABLE_LEN < 256 && HE #define HEATER_CHAMBER_RAW_LO_TEMP 0 #endif #endif - -#endif // THERMISTORS_H_ diff --git a/Marlin/src/module/tool_change.cpp b/Marlin/src/module/tool_change.cpp index 2b840491c8..a4e202c515 100644 --- a/Marlin/src/module/tool_change.cpp +++ b/Marlin/src/module/tool_change.cpp @@ -20,14 +20,28 @@ * */ +#include "../inc/MarlinConfigPre.h" + #include "tool_change.h" #include "probe.h" #include "motion.h" #include "planner.h" +#include "temperature.h" #include "../Marlin.h" +#if EXTRUDERS > 1 + toolchange_settings_t toolchange_settings; // Initialized by settings.load() +#endif + +#if ENABLED(SINGLENOZZLE) + uint16_t singlenozzle_temp[EXTRUDERS]; + #if FAN_COUNT > 0 + uint8_t singlenozzle_fan_speed[EXTRUDERS]; + #endif +#endif + #if ENABLED(PARKING_EXTRUDER) && PARKING_EXTRUDER_SOLENOIDS_DELAY > 0 #include "../gcode/gcode.h" // for dwell() #endif @@ -56,7 +70,7 @@ #include "../feature/fanmux.h" #endif -#if ENABLED(ULTIPANEL) +#if HAS_LCD_MENU #include "../lcd/ultralcd.h" #endif @@ -82,13 +96,11 @@ #endif // DO_SWITCH_EXTRUDER #if ENABLED(SWITCHING_NOZZLE) - void move_nozzle_servo(const uint8_t e) { planner.synchronize(); MOVE_SERVO(SWITCHING_NOZZLE_SERVO_NR, servo_angles[SWITCHING_NOZZLE_SERVO_NR][e]); safe_delay(500); } - #endif // SWITCHING_NOZZLE #if ENABLED(PARKING_EXTRUDER) @@ -115,10 +127,17 @@ inline void parking_extruder_tool_change(const uint8_t tmp_extruder, bool no_move) { if (!no_move) { - const float parkingposx[] = PARKING_EXTRUDER_PARKING_X, - midpos = (parkingposx[0] + parkingposx[1]) * 0.5 + hotend_offset[X_AXIS][active_extruder], - grabpos = parkingposx[tmp_extruder] + hotend_offset[X_AXIS][active_extruder] - + (tmp_extruder == 0 ? -(PARKING_EXTRUDER_GRAB_DISTANCE) : PARKING_EXTRUDER_GRAB_DISTANCE); + constexpr float parkingposx[] = PARKING_EXTRUDER_PARKING_X; + + #if HAS_HOTEND_OFFSET + const float x_offset = hotend_offset[X_AXIS][active_extruder]; + #else + constexpr float x_offset = 0; + #endif + + const float midpos = (parkingposx[0] + parkingposx[1]) * 0.5 + x_offset, + grabpos = parkingposx[tmp_extruder] + (tmp_extruder ? PARKING_EXTRUDER_GRAB_DISTANCE : -(PARKING_EXTRUDER_GRAB_DISTANCE)) + x_offset; + /** * 1. Raise Z-Axis to give enough clearance * 2. Move to park position of old extruder @@ -130,43 +149,55 @@ */ // STEP 1 + #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) DEBUG_POS("Start Autopark", current_position); #endif - current_position[Z_AXIS] += PARKING_EXTRUDER_SECURITY_RAISE; + + current_position[Z_AXIS] += toolchange_settings.z_raise; + #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) DEBUG_POS("(1) Raise Z-Axis", current_position); #endif - planner.buffer_line(current_position, planner.max_feedrate_mm_s[Z_AXIS], active_extruder); + + planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[Z_AXIS], active_extruder); planner.synchronize(); // STEP 2 - current_position[X_AXIS] = parkingposx[active_extruder] + hotend_offset[X_AXIS][active_extruder]; + + current_position[X_AXIS] = parkingposx[active_extruder] + x_offset; + #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) { SERIAL_ECHOLNPAIR("(2) Park extruder ", int(active_extruder)); DEBUG_POS("Moving ParkPos", current_position); } #endif - planner.buffer_line(current_position, planner.max_feedrate_mm_s[X_AXIS], active_extruder); + + planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[X_AXIS], active_extruder); planner.synchronize(); // STEP 3 + #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("(3) Disengage magnet "); #endif + pe_deactivate_magnet(active_extruder); // STEP 4 + #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("(4) Move to position near new extruder"); #endif + current_position[X_AXIS] += active_extruder ? -10 : 10; // move 10mm away from parked extruder #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) DEBUG_POS("Move away from parked extruder", current_position); #endif - planner.buffer_line(current_position, planner.max_feedrate_mm_s[X_AXIS], active_extruder); + + planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[X_AXIS], active_extruder); planner.synchronize(); // STEP 5 @@ -177,25 +208,35 @@ #if ENABLED(PARKING_EXTRUDER_SOLENOIDS_INVERT) pe_activate_magnet(active_extruder); //just save power for inverted magnets #endif + pe_activate_magnet(tmp_extruder); // STEP 6 + current_position[X_AXIS] = grabpos + (tmp_extruder ? -10 : 10); - planner.buffer_line(current_position, planner.max_feedrate_mm_s[X_AXIS], active_extruder); + planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[X_AXIS], active_extruder); current_position[X_AXIS] = grabpos; #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) DEBUG_POS("(6) Unpark extruder", current_position); #endif - planner.buffer_line(current_position, planner.max_feedrate_mm_s[X_AXIS]/2, active_extruder); + planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[X_AXIS]/2, active_extruder); planner.synchronize(); - // Step 7 - current_position[X_AXIS] = midpos - hotend_offset[X_AXIS][tmp_extruder]; + // STEP 7 + + current_position[X_AXIS] = midpos + #if HAS_HOTEND_OFFSET + - hotend_offset[X_AXIS][tmp_extruder] + #endif + ; + #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) DEBUG_POS("(7) Move midway between hotends", current_position); #endif - planner.buffer_line(current_position, planner.max_feedrate_mm_s[X_AXIS], active_extruder); + + planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[X_AXIS], active_extruder); planner.synchronize(); + #if ENABLED(DEBUG_LEVELING_FEATURE) SERIAL_ECHOLNPGM("Autopark done."); #endif @@ -207,7 +248,10 @@ pe_activate_magnet(active_extruder); // Just save power for inverted magnets #endif } - current_position[Z_AXIS] += hotend_offset[Z_AXIS][active_extruder] - hotend_offset[Z_AXIS][tmp_extruder]; + + #if HAS_HOTEND_OFFSET + current_position[Z_AXIS] += hotend_offset[Z_AXIS][active_extruder] - hotend_offset[Z_AXIS][tmp_extruder]; + #endif #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) DEBUG_POS("Applying Z-offset", current_position); @@ -237,81 +281,106 @@ */ // STEP 1 + #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) DEBUG_POS("Starting Toolhead change", current_position); #endif - current_position[Z_AXIS] += SWITCHING_TOOLHEAD_SECURITY_RAISE; + + current_position[Z_AXIS] += toolchange_settings.z_raise; + #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) DEBUG_POS("(1) Raise Z-Axis", current_position); #endif - planner.buffer_line(current_position, planner.max_feedrate_mm_s[Z_AXIS], active_extruder); + + planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[Z_AXIS], active_extruder); planner.synchronize(); // STEP 2 + current_position[X_AXIS] = placexpos; + #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) { SERIAL_ECHOLNPAIR("(2) Place old tool ", int(active_extruder)); DEBUG_POS("Move X SwitchPos", current_position); } #endif - planner.buffer_line(current_position, planner.max_feedrate_mm_s[X_AXIS], active_extruder); + + 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 - SWITCHING_TOOLHEAD_Y_SECURITY; + #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) DEBUG_POS("Move Y SwitchPos + Security", current_position); #endif - planner.buffer_line(current_position, planner.max_feedrate_mm_s[Y_AXIS], active_extruder); + + planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[Y_AXIS], active_extruder); planner.synchronize(); // STEP 3 + #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("(3) Unlock and Place Toolhead"); #endif + MOVE_SERVO(SWITCHING_TOOLHEAD_SERVO_NR, angles[1]); safe_delay(500); current_position[Y_AXIS] = SWITCHING_TOOLHEAD_Y_POS; + #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) DEBUG_POS("Move Y SwitchPos", current_position); #endif - planner.buffer_line(current_position,(planner.max_feedrate_mm_s[Y_AXIS] * 0.5), active_extruder); + + planner.buffer_line(current_position,(planner.settings.max_feedrate_mm_s[Y_AXIS] * 0.5), active_extruder); planner.synchronize(); safe_delay(200); current_position[Y_AXIS] -= SWITCHING_TOOLHEAD_Y_CLEAR; + #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) DEBUG_POS("Move back Y clear", current_position); #endif - planner.buffer_line(current_position, planner.max_feedrate_mm_s[Y_AXIS], active_extruder); // move away from docked toolhead + + planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[Y_AXIS], active_extruder); // move away from docked toolhead planner.synchronize(); // STEP 4 + #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("(4) Move to new toolhead position"); #endif + current_position[X_AXIS] = grabxpos; + #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) DEBUG_POS("Move to new toolhead X", current_position); #endif - planner.buffer_line(current_position, planner.max_feedrate_mm_s[X_AXIS], active_extruder); + + 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 - SWITCHING_TOOLHEAD_Y_SECURITY; + #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) DEBUG_POS("Move Y SwitchPos + Security", current_position); #endif - planner.buffer_line(current_position, planner.max_feedrate_mm_s[Y_AXIS], active_extruder); + + planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[Y_AXIS], active_extruder); planner.synchronize(); // STEP 5 + #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("(5) Grab and lock new toolhead "); #endif + current_position[Y_AXIS] = SWITCHING_TOOLHEAD_Y_POS; + #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) DEBUG_POS("Move Y SwitchPos", current_position); #endif - planner.buffer_line(current_position, planner.max_feedrate_mm_s[Y_AXIS] * 0.5, active_extruder); + + planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[Y_AXIS] * 0.5, active_extruder); planner.synchronize(); safe_delay(200); @@ -319,14 +388,19 @@ safe_delay(500); current_position[Y_AXIS] -= SWITCHING_TOOLHEAD_Y_CLEAR; + #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) DEBUG_POS("Move back Y clear", current_position); #endif - planner.buffer_line(current_position, planner.max_feedrate_mm_s[Y_AXIS], active_extruder); // move away from docked toolhead + + planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[Y_AXIS], active_extruder); // move away from docked toolhead planner.synchronize(); // STEP 6 - current_position[Z_AXIS] += hotend_offset[Z_AXIS][active_extruder] - hotend_offset[Z_AXIS][tmp_extruder]; + + #if HAS_HOTEND_OFFSET + current_position[Z_AXIS] += hotend_offset[Z_AXIS][active_extruder] - hotend_offset[Z_AXIS][tmp_extruder]; + #endif #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) DEBUG_POS("(6) Apply Z offset", current_position); @@ -341,25 +415,10 @@ inline void invalid_extruder_error(const uint8_t e) { SERIAL_ECHO_START(); - SERIAL_CHAR('T'); - SERIAL_ECHO_F(e, DEC); - SERIAL_CHAR(' '); - SERIAL_ECHOLNPGM(MSG_INVALID_EXTRUDER); + SERIAL_CHAR('T'); SERIAL_ECHO(int(e)); + SERIAL_CHAR(' '); SERIAL_ECHOLNPGM(MSG_INVALID_EXTRUDER); } -#if ENABLED(MIXING_EXTRUDER) && MIXING_VIRTUAL_TOOLS > 1 - - inline void mixing_tool_change(const uint8_t tmp_extruder) { - if (tmp_extruder >= MIXING_VIRTUAL_TOOLS) - return invalid_extruder_error(tmp_extruder); - - // T0-Tnnn: Switch virtual tool by changing the mix - for (uint8_t j = 0; j < MIXING_STEPPERS; j++) - mixing_factor[j] = mixing_virtual_tool_mix[tmp_extruder][j]; - } - -#endif // MIXING_EXTRUDER && MIXING_VIRTUAL_TOOLS > 1 - #if ENABLED(DUAL_X_CARRIAGE) inline void dualx_tool_change(const uint8_t tmp_extruder, bool &no_move) { @@ -378,30 +437,16 @@ inline void invalid_extruder_error(const uint8_t e) { const float xhome = x_home_pos(active_extruder); if (dual_x_carriage_mode == DXC_AUTO_PARK_MODE && IsRunning() - && (delayed_move_time || current_position[X_AXIS] != xhome) + && (delayed_move_time || current_position[X_AXIS] != xhome) && ! no_move ) { - float raised_z = current_position[Z_AXIS] + TOOLCHANGE_PARK_ZLIFT; - #if ENABLED(MAX_SOFTWARE_ENDSTOPS) - NOMORE(raised_z, soft_endstop_max[Z_AXIS]); - #endif + #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) { - SERIAL_ECHOLNPAIR("Raise to ", raised_z); SERIAL_ECHOLNPAIR("MoveX to ", xhome); - SERIAL_ECHOLNPAIR("Lower to ", current_position[Z_AXIS]); } #endif - // Park old head: 1) raise 2) move to park position 3) lower - - #define CUR_X current_position[X_AXIS] - #define CUR_Y current_position[Y_AXIS] - #define CUR_Z current_position[Z_AXIS] - #define CUR_E current_position[E_AXIS] - - planner.buffer_line(CUR_X, CUR_Y, raised_z, CUR_E, planner.max_feedrate_mm_s[Z_AXIS], active_extruder); - planner.buffer_line(xhome, CUR_Y, raised_z, CUR_E, planner.max_feedrate_mm_s[X_AXIS], active_extruder); - planner.buffer_line(xhome, CUR_Y, CUR_Z, CUR_E, planner.max_feedrate_mm_s[Z_AXIS], active_extruder); - + // Park old head + planner.buffer_line(xhome, current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], planner.settings.max_feedrate_mm_s[X_AXIS], active_extruder); planner.synchronize(); } @@ -419,9 +464,6 @@ inline void invalid_extruder_error(const uint8_t e) { if (DEBUGGING(LEVELING)) DEBUG_POS("New Extruder", current_position); #endif - // Only when auto-parking are carriages safe to move - if (dual_x_carriage_mode != DXC_AUTO_PARK_MODE) no_move = true; - switch (dual_x_carriage_mode) { case DXC_FULL_CONTROL_MODE: // New current position is the position of the activated extruder @@ -430,15 +472,13 @@ inline void invalid_extruder_error(const uint8_t e) { inactive_extruder_x_pos = destination[X_AXIS]; break; case DXC_AUTO_PARK_MODE: - // record raised toolhead position for use by unpark + // record current raised toolhead position for use by unpark COPY(raised_parked_position, current_position); - raised_parked_position[Z_AXIS] += TOOLCHANGE_UNPARK_ZLIFT; - #if ENABLED(MAX_SOFTWARE_ENDSTOPS) - NOMORE(raised_parked_position[Z_AXIS], soft_endstop_max[Z_AXIS]); - #endif active_extruder_parked = true; delayed_move_time = 0; break; + default: + break; } #if ENABLED(DEBUG_LEVELING_FEATURE) @@ -447,8 +487,6 @@ inline void invalid_extruder_error(const uint8_t e) { DEBUG_POS("New extruder (parked)", current_position); } #endif - - // No extra case for HAS_ABL in DUAL_X_CARRIAGE. Does that mean they don't work together? } #endif // DUAL_X_CARRIAGE @@ -458,185 +496,242 @@ 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*/) { - planner.synchronize(); + #if ENABLED(MIXING_EXTRUDER) - #if ENABLED(DUAL_X_CARRIAGE) // Only T0 allowed if the Printer is in DXC_DUPLICATION_MODE or DXC_SCALED_DUPLICATION_MODE - if (tmp_extruder != 0 && dxc_is_duplicating()) - return invalid_extruder_error(tmp_extruder); - #endif + UNUSED(fr_mm_s); UNUSED(no_move); - #if HAS_LEVELING - // Set current position to the physical position - const bool leveling_was_active = planner.leveling_active; - set_bed_leveling_enabled(false); - #endif + if (tmp_extruder >= MIXING_VIRTUAL_TOOLS) + return invalid_extruder_error(tmp_extruder); - #if ENABLED(MIXING_EXTRUDER) && MIXING_VIRTUAL_TOOLS > 1 + #if MIXING_VIRTUAL_TOOLS > 1 + // T0-Tnnn: Switch virtual tool by changing the index to the mix + mixer.T(uint_fast8_t(tmp_extruder)); + #endif - mixing_tool_change(tmp_extruder); + #elif EXTRUDERS < 2 - #else // !MIXING_EXTRUDER || MIXING_VIRTUAL_TOOLS <= 1 + UNUSED(fr_mm_s); UNUSED(no_move); + + if (tmp_extruder) invalid_extruder_error(tmp_extruder); + return; + + #else // EXTRUDERS > 1 + + planner.synchronize(); + + #if ENABLED(DUAL_X_CARRIAGE) // Only T0 allowed if the Printer is in DXC_DUPLICATION_MODE or DXC_SCALED_DUPLICATION_MODE + if (tmp_extruder != 0 && dxc_is_duplicating()) + return invalid_extruder_error(tmp_extruder); + #endif + + #if HAS_LEVELING + // Set current position to the physical position + const bool leveling_was_active = planner.leveling_active; + set_bed_leveling_enabled(false); + #endif if (tmp_extruder >= EXTRUDERS) return invalid_extruder_error(tmp_extruder); - #if HOTENDS > 1 + if (!no_move && !all_axes_homed()) { + no_move = true; + #if ENABLED(DEBUG_LEVELING_FEATURE) + if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("No move on toolchange"); + #endif + } + #if HAS_LCD_MENU + ui.return_to_status(); + #endif + + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + const bool should_swap = !no_move && toolchange_settings.swap_length; + #if ENABLED(PREVENT_COLD_EXTRUSION) + const bool too_cold = !DEBUGGING(DRYRUN) && (thermalManager.targetTooColdToExtrude(active_extruder) || thermalManager.targetTooColdToExtrude(tmp_extruder)); + #else + constexpr bool too_cold = false; + #endif + if (should_swap) { + if (too_cold) { + SERIAL_ERROR_START(); + SERIAL_ERRORLNPGM(MSG_ERR_HOTEND_TOO_COLD); + #if ENABLED(SINGLENOZZLE) + active_extruder = tmp_extruder; + return; + #endif + } + else { + #if ENABLED(ADVANCED_PAUSE_FEATURE) + do_pause_e_move(-toolchange_settings.swap_length, MMM_TO_MMS(toolchange_settings.retract_speed)); + #else + current_position[E_AXIS] -= toolchange_settings.swap_length / planner.e_factor[active_extruder]; + planner.buffer_line(current_position, MMM_TO_MMS(toolchange_settings.retract_speed), active_extruder); + #endif + } + } + #endif // TOOLCHANGE_FILAMENT_SWAP + + if (tmp_extruder != active_extruder) { const float old_feedrate_mm_s = fr_mm_s > 0.0 ? fr_mm_s : feedrate_mm_s; - feedrate_mm_s = fr_mm_s > 0.0 ? fr_mm_s : XY_PROBE_FEEDRATE_MM_S; - if (tmp_extruder != active_extruder) { - if (!no_move && axis_unhomed_error()) { - no_move = true; - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("No move on toolchange"); - #endif - } + #if ENABLED(DUAL_X_CARRIAGE) - #if ENABLED(DUAL_X_CARRIAGE) - - #if HAS_SOFTWARE_ENDSTOPS - // Update the X software endstops early - active_extruder = tmp_extruder; - update_software_endstops(X_AXIS); - active_extruder = !tmp_extruder; - - // Don't move the new extruder out of bounds - if (!WITHIN(current_position[X_AXIS], soft_endstop_min[X_AXIS], soft_endstop_max[X_AXIS])) - no_move = true; - - #else - // No software endstops? Use the configured limits - if (active_extruder == 0) { - if (!WITHIN(current_position[X_AXIS], X2_MIN_POS, X2_MAX_POS)) - no_move = true; - } - else if (!WITHIN(current_position[X_AXIS], X1_MIN_POS, X1_MAX_POS)) - no_move = true; - #endif - - #if ENABLED(ULTIPANEL) - lcd_return_to_status(); - #endif - - if (!no_move) set_destination_from_current(); - dualx_tool_change(tmp_extruder, no_move); // Can modify no_move - - #else // !DUAL_X_CARRIAGE - - set_destination_from_current(); - - const float xdiff = hotend_offset[X_AXIS][tmp_extruder] - hotend_offset[X_AXIS][active_extruder], - ydiff = hotend_offset[Y_AXIS][tmp_extruder] - hotend_offset[Y_AXIS][active_extruder]; - - #if ENABLED(PARKING_EXTRUDER) // Dual Parking extruder - constexpr float zdiff = 0; - parking_extruder_tool_change(tmp_extruder, no_move); - #elif ENABLED(SWITCHING_TOOLHEAD) // Switching Toolhead - constexpr float zdiff = 0; - switching_toolhead_tool_change(tmp_extruder, fr_mm_s, no_move); - #else - const float zdiff = hotend_offset[Z_AXIS][tmp_extruder] - hotend_offset[Z_AXIS][active_extruder]; - #if ENABLED(SWITCHING_NOZZLE) - // Always raise by at least 1 to avoid workpiece - current_position[Z_AXIS] += MAX(-zdiff, 0.0) + 1; - planner.buffer_line(current_position, planner.max_feedrate_mm_s[Z_AXIS], active_extruder); - move_nozzle_servo(tmp_extruder); - #endif - #endif - - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) { - SERIAL_ECHOPAIR("Offset Tool XY by { ", xdiff); - SERIAL_ECHOPAIR(", ", ydiff); - SERIAL_ECHOPAIR(", ", zdiff); - SERIAL_ECHOLNPGM(" }"); - } - #endif - - // The newly-selected extruder XY is actually at... - current_position[X_AXIS] += xdiff; - current_position[Y_AXIS] += ydiff; - current_position[Z_AXIS] += zdiff; - - // Set the new active extruder + #if HAS_SOFTWARE_ENDSTOPS + // Update the X software endstops early active_extruder = tmp_extruder; - - #endif // !DUAL_X_CARRIAGE - - // Tell the planner the new "current position" - sync_plan_position(); - - #if ENABLED(DELTA) - //LOOP_XYZ(i) update_software_endstops(i); // or modify the constrain function - const bool safe_to_move = current_position[Z_AXIS] < delta_clip_start_height - 1; + update_software_endstops(X_AXIS); + active_extruder = !tmp_extruder; + const float minx = soft_endstop_min[X_AXIS], maxx = soft_endstop_max[X_AXIS]; #else - constexpr bool safe_to_move = true; + // No software endstops? Use the configured limits + const float minx = tmp_extruder ? X2_MIN_POS : X1_MIN_POS, + maxx = tmp_extruder ? X2_MAX_POS : X1_MAX_POS; #endif - // Raise, move, and lower again - if (safe_to_move && !no_move && IsRunning()) { - #if DISABLED(SWITCHING_NOZZLE) - // Do a small lift to avoid the workpiece in the move back (below) - current_position[Z_AXIS] += 1.0; - planner.buffer_line(current_position, planner.max_feedrate_mm_s[Z_AXIS], active_extruder); + // Don't move the new extruder out of bounds + if (!WITHIN(current_position[X_AXIS], minx, maxx)) no_move = true; + + #endif + + set_destination_from_current(); + + if (!no_move) { + #if DISABLED(SWITCHING_NOZZLE) + // Do a small lift to avoid the workpiece in the move back (below) + #if ENABLED(TOOLCHANGE_PARK) + current_position[X_AXIS] = toolchange_settings.change_point.x; + current_position[Y_AXIS] = toolchange_settings.change_point.y; #endif - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) DEBUG_POS("Move back", destination); - #endif - #if ENABLED(DUAL_X_CARRIAGE) - // Dual x carriage does not properly apply these to current position due to command ordering - // So we apply the offsets for y and z to the destination here. X cannot have an offset in this mode - // as it is utilized for X2 home position. - destination[Y_AXIS] -= hotend_offset[Y_AXIS][active_extruder] - hotend_offset[Y_AXIS][tmp_extruder]; - destination[Z_AXIS] -= hotend_offset[Z_AXIS][active_extruder] - hotend_offset[Z_AXIS][tmp_extruder]; - #endif - // Move back to the original (or tweaked) position - do_blocking_move_to(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS]); - #if ENABLED(DUAL_X_CARRIAGE) - active_extruder_parked = false; + current_position[Z_AXIS] += toolchange_settings.z_raise; + #if HAS_SOFTWARE_ENDSTOPS + NOMORE(current_position[Z_AXIS], soft_endstop_max[Z_AXIS]); #endif + planner.buffer_line(current_position, feedrate_mm_s, active_extruder); + #endif + planner.synchronize(); + } + + #if HOTENDS > 1 + #if ENABLED(DUAL_X_CARRIAGE) + constexpr float xdiff = 0; + #else + const float xdiff = hotend_offset[X_AXIS][tmp_extruder] - hotend_offset[X_AXIS][active_extruder]; + #endif + const float ydiff = hotend_offset[Y_AXIS][tmp_extruder] - hotend_offset[Y_AXIS][active_extruder], + zdiff = hotend_offset[Z_AXIS][tmp_extruder] - hotend_offset[Z_AXIS][active_extruder]; + #else + constexpr float xdiff = 0, ydiff = 0, zdiff = 0; + #endif + + #if ENABLED(DUAL_X_CARRIAGE) + dualx_tool_change(tmp_extruder, no_move); + #elif ENABLED(PARKING_EXTRUDER) // Dual Parking extruder + parking_extruder_tool_change(tmp_extruder, no_move); + #elif ENABLED(SWITCHING_TOOLHEAD) // Switching Toolhead + switching_toolhead_tool_change(tmp_extruder, fr_mm_s, no_move); + #elif ENABLED(SWITCHING_NOZZLE) + // Always raise by a configured distance to avoid workpiece + current_position[Z_AXIS] += MAX(-zdiff, 0.0) + toolchange_settings.z_raise; + #if HAS_SOFTWARE_ENDSTOPS + NOMORE(current_position[Z_AXIS], soft_endstop_max[Z_AXIS]); + #endif + if (!no_move)planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[Z_AXIS], active_extruder); + move_nozzle_servo(tmp_extruder); + #endif + + #if ENABLED(DEBUG_LEVELING_FEATURE) + if (DEBUGGING(LEVELING)) { + SERIAL_ECHOPAIR("Offset Tool XY by { ", xdiff); + SERIAL_ECHOPAIR(", ", ydiff); + SERIAL_ECHOPAIR(", ", zdiff); + SERIAL_ECHOLNPGM(" }"); } - #if ENABLED(SWITCHING_NOZZLE) - else { - // Move back down. (Including when the new tool is higher.) - do_blocking_move_to_z(destination[Z_AXIS], planner.max_feedrate_mm_s[Z_AXIS]); + #endif + + // The newly-selected extruder XY is actually at... + current_position[X_AXIS] += xdiff; + current_position[Y_AXIS] += ydiff; + current_position[Z_AXIS] += zdiff; + + // Set the new active extruder if not already done in tool specific function above + active_extruder = tmp_extruder; + + // Tell the planner the new "current position" + sync_plan_position(); + + #if ENABLED(DELTA) + //LOOP_XYZ(i) update_software_endstops(i); // or modify the constrain function + const bool safe_to_move = current_position[Z_AXIS] < delta_clip_start_height - 1; + #else + constexpr bool safe_to_move = true; + #endif + + // Return to position and lower again + if (safe_to_move && !no_move && IsRunning()) { + #if ENABLED(DEBUG_LEVELING_FEATURE) + if (DEBUGGING(LEVELING)) DEBUG_POS("Move back", destination); + #endif + + #if ENABLED(SINGLENOZZLE) + #if FAN_COUNT > 0 + singlenozzle_fan_speed[active_extruder] = fan_speed[0]; + fan_speed[0] = singlenozzle_fan_speed[tmp_extruder]; + #endif + + singlenozzle_temp[active_extruder] = thermalManager.target_temperature[0]; + if (singlenozzle_temp[tmp_extruder] && singlenozzle_temp[tmp_extruder] != singlenozzle_temp[active_extruder]) { + thermalManager.setTargetHotend(singlenozzle_temp[tmp_extruder], 0); + #if ENABLED(ULTRA_LCD) + thermalManager.set_heating_message(0); + #endif + (void)thermalManager.wait_for_hotend(0, false); // Wait for heating or cooling + } + active_extruder = tmp_extruder; + #endif + + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + if (should_swap && !too_cold) { + #if ENABLED(ADVANCED_PAUSE_FEATURE) + do_pause_e_move(toolchange_settings.swap_length, toolchange_settings.prime_speed); + #else + current_position[E_AXIS] += toolchange_settings.swap_length / planner.e_factor[tmp_extruder]; + planner.buffer_line(current_position, toolchange_settings.prime_speed, tmp_extruder); + #endif + planner.synchronize(); } #endif - } // (tmp_extruder != active_extruder) - planner.synchronize(); - - #if ENABLED(EXT_SOLENOID) && DISABLED(PARKING_EXTRUDER) - disable_all_solenoids(); - enable_solenoid_on_active_extruder(); + // Move back to the original (or tweaked) position + do_blocking_move_to(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS]); + #if ENABLED(DUAL_X_CARRIAGE) + active_extruder_parked = false; + #endif + feedrate_mm_s = old_feedrate_mm_s; + } + #if ENABLED(SWITCHING_NOZZLE) + else { + // Move back down. (Including when the new tool is higher.) + do_blocking_move_to_z(destination[Z_AXIS], planner.settings.max_feedrate_mm_s[Z_AXIS]); + } #endif + } // (tmp_extruder != active_extruder) - feedrate_mm_s = old_feedrate_mm_s; + planner.synchronize(); - #if HAS_SOFTWARE_ENDSTOPS && ENABLED(DUAL_X_CARRIAGE) - update_software_endstops(X_AXIS); - #endif + #if ENABLED(EXT_SOLENOID) && DISABLED(PARKING_EXTRUDER) + disable_all_solenoids(); + enable_solenoid_on_active_extruder(); + #endif - #else // HOTENDS <= 1 + #if HAS_SOFTWARE_ENDSTOPS && ENABLED(DUAL_X_CARRIAGE) + update_software_endstops(X_AXIS); + #endif - UNUSED(fr_mm_s); - UNUSED(no_move); - - #if ENABLED(MK2_MULTIPLEXER) - if (tmp_extruder >= E_STEPPERS) - return invalid_extruder_error(tmp_extruder); - - select_multiplexed_stepper(tmp_extruder); - #endif - - #if EXTRUDERS > 1 - // Set the new active extruder - active_extruder = tmp_extruder; - #endif - - #endif // HOTENDS <= 1 + #if ENABLED(MK2_MULTIPLEXER) + if (tmp_extruder >= E_STEPPERS) return invalid_extruder_error(tmp_extruder); + select_multiplexed_stepper(tmp_extruder); + #endif #if DO_SWITCH_EXTRUDER planner.synchronize(); @@ -655,5 +750,5 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n SERIAL_ECHO_START(); SERIAL_ECHOLNPAIR(MSG_ACTIVE_EXTRUDER, int(active_extruder)); - #endif // !MIXING_EXTRUDER || MIXING_VIRTUAL_TOOLS <= 1 + #endif // EXTRUDERS > 1 } diff --git a/Marlin/src/module/tool_change.h b/Marlin/src/module/tool_change.h index 53da00d178..39f6a4b52f 100644 --- a/Marlin/src/module/tool_change.h +++ b/Marlin/src/module/tool_change.h @@ -19,11 +19,26 @@ * along with this program. If not, see . * */ +#pragma once -#ifndef TOOL_CHANGE_H -#define TOOL_CHANGE_H +#include "../inc/MarlinConfigPre.h" -#include "../inc/MarlinConfig.h" +#if EXTRUDERS > 1 + + typedef struct { + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) + float swap_length; + int16_t prime_speed, retract_speed; + #endif + #if ENABLED(TOOLCHANGE_PARK) + struct { float x, y; } change_point; + #endif + float z_raise; + } toolchange_settings_t; + + extern toolchange_settings_t toolchange_settings; + +#endif #if DO_SWITCH_EXTRUDER void move_extruder_servo(const uint8_t e); @@ -50,10 +65,15 @@ #endif // PARKING_EXTRUDER +#if ENABLED(SINGLENOZZLE) + extern uint16_t singlenozzle_temp[EXTRUDERS]; + #if FAN_COUNT > 0 + extern uint8_t singlenozzle_fan_speed[EXTRUDERS]; + #endif +#endif + /** * Perform a tool-change, which may result in moving the * 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); - -#endif // TOOL_CHANGE_H diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 6a45a7dcbd..da233c1b28 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Include pins definitions @@ -32,10 +33,7 @@ * These numbers are the same in any pin mapping. */ -#ifndef __PINS_H__ -#define __PINS_H__ - -#include "../inc/MarlinConfig.h" +#define MAX_EXTRUDERS 6 #if MB(RAMPS_13_EFB) || MB(RAMPS_14_EFB) || MB(RAMPS_PLUS_EFB) || MB(RAMPS_14_RE_ARM_EFB) || MB(RAMPS_SMART_EFB) || MB(RAMPS_DUO_EFB) || MB(RAMPS4DUE_EFB) #define IS_RAMPS_EFB @@ -134,6 +132,8 @@ #include "pins_ULTIMAIN_2.h" // ATmega2560 env:megaatmega2560 #elif MB(FORMBOT_RAPTOR) #include "pins_FORMBOT_RAPTOR.h" // ATmega2560 env:megaatmega2560 +#elif MB(FORMBOT_RAPTOR2) + #include "pins_FORMBOT_RAPTOR2.h" // ATmega2560 env:megaatmega2560 #elif MB(FORMBOT_TREX2PLUS) #include "pins_FORMBOT_TREX2PLUS.h" // ATmega2560 env:megaatmega2560 #elif MB(FORMBOT_TREX3) @@ -150,8 +150,8 @@ #include "pins_TRIGORILLA_14.h" // ATmega2560 env:megaatmega2560 #elif MB(RAMPS_ENDER_4) #include "pins_RAMPS_ENDER_4.h" // ATmega2560 env:megaatmega2560 -#elif MB(GT2560_V3) - #include "pins_GT2560_V3.h" // ATmega2560 env:megaatmega2560 +#elif MB(RAMPS_CREALITY) + #include "pins_RAMPS_CREALITY.h" // ATmega2560 env:megaatmega2560 #elif MB(FYSETC_F6_13) #include "pins_FYSETC_F6_13.h" // ATmega2560 env:megaatmega2560 @@ -195,6 +195,10 @@ #include "pins_GT2560_REV_A.h" // ATmega1280, ATmega2560 env:megaatmega1280 env:megaatmega2560 #elif MB(GT2560_REV_A_PLUS) #include "pins_GT2560_REV_A_PLUS.h" // ATmega1280, ATmega2560 env:megaatmega1280 env:megaatmega2560 +#elif MB(GT2560_V3) + #include "pins_GT2560_V3.h" // ATmega2560 env:megaatmega2560 +#elif MB(GT2560_V3_MC2) + #include "pins_GT2560_V3_MC2.h" // ATmega2560 env:megaatmega2560 #elif MB(EINSTART_S) #include "pins_EINSTART-S.h" // ATmega1280, ATmega2560 env:megaatmega1280 env:megaatmega2560 @@ -299,19 +303,19 @@ #elif MB(AZSMZ_MINI) #include "pins_AZSMZ_MINI.h" // LPC1768 env:LPC1768 #elif MB(AZTEEG_X5_GT) - #include "pins_AZTEEG_X5_GT.h" // LPC1769 env:LPC1768 + #include "pins_AZTEEG_X5_GT.h" // LPC1769 env:LPC1769 #elif MB(AZTEEG_X5_MINI_WIFI) - #include "pins_AZTEEG_X5_MINI_WIFI.h" // LPC1769 env:LPC1768 + #include "pins_AZTEEG_X5_MINI_WIFI.h" // LPC1769 env:LPC1769 #elif MB(BIQU_BQ111_A4) #include "pins_BIQU_BQ111_A4.h" // LPC1768 env:LPC1768 #elif MB(SELENA_COMPACT) #include "pins_SELENA_COMPACT.h" // LPC1768 env:LPC1768 #elif MB(COHESION3D_REMIX) - #include "pins_COHESION3D_REMIX.h" // LPC1769 env:LPC1768 + #include "pins_COHESION3D_REMIX.h" // LPC1769 env:LPC1769 #elif MB(COHESION3D_MINI) - #include "pins_COHESION3D_MINI.h" // LPC1769 env:LPC1768 + #include "pins_COHESION3D_MINI.h" // LPC1769 env:LPC1769 #elif MB(SMOOTHIEBOARD) - #include "pins_SMOOTHIEBOARD.h" // LPC1769 env:LPC1768 + #include "pins_SMOOTHIEBOARD.h" // LPC1769 env:LPC1769 // // Other 32-bit Boards @@ -363,6 +367,8 @@ #include "pins_RAMPS4DUE.h" // SAM3X8E env:DUE env:DUE_USB env:DUE_debug #elif MB(ULTRATRONICS_PRO) #include "pins_ULTRATRONICS_PRO.h" // SAM3X8E env:DUE env:DUE_debug +#elif MB(ARCHIM1) + #include "pins_ARCHIM1.h" // SAM3X8E env:DUE env:DUE_debug #elif MB(ARCHIM2) #include "pins_ARCHIM2.h" // SAM3X8E env:DUE env:DUE_debug #elif MB(ALLIGATOR) @@ -397,6 +403,8 @@ #include "pins_BEAST.h" // STM32F4 env:STM32F4 #elif MB(STM32F4) #include "pins_STM32F4.h" // STM32F4 env:STM32F4 +#elif MB(ARMED) + #include "pins_ARMED.h" // STM32F4 env:ARMED // // ARM Cortex M7 @@ -404,6 +412,8 @@ #elif MB(THE_BORG) #include "pins_THE_BORG.h" // STM32F7 env:STM32F7 +#elif MB(REMRAM_V1) + #include "pins_REMRAM_V1.h" // STM32F7 env:STM32F7xx // // Espressif ESP32 @@ -423,12 +433,18 @@ #ifndef X_MS2_PIN #define X_MS2_PIN -1 #endif +#ifndef X_MS3_PIN + #define X_MS3_PIN -1 +#endif #ifndef Y_MS1_PIN #define Y_MS1_PIN -1 #endif #ifndef Y_MS2_PIN #define Y_MS2_PIN -1 #endif +#ifndef Y_MS3_PIN + #define Y_MS3_PIN -1 +#endif #ifndef Z_MS1_PIN #define Z_MS1_PIN -1 #endif @@ -444,18 +460,27 @@ #ifndef E0_MS2_PIN #define E0_MS2_PIN -1 #endif +#ifndef E0_MS3_PIN + #define E0_MS3_PIN -1 +#endif #ifndef E1_MS1_PIN #define E1_MS1_PIN -1 #endif #ifndef E1_MS2_PIN #define E1_MS2_PIN -1 #endif +#ifndef E1_MS3_PIN + #define E1_MS3_PIN -1 +#endif #ifndef E2_MS1_PIN #define E2_MS1_PIN -1 #endif #ifndef E2_MS2_PIN #define E2_MS2_PIN -1 #endif +#ifndef E2_MS3_PIN + #define E2_MS3_PIN -1 +#endif #ifndef E3_MS1_PIN #define E3_MS1_PIN -1 #endif @@ -646,7 +671,8 @@ #ifndef LED_PIN #define LED_PIN -1 #endif -#ifndef PS_ON_PIN +#if POWER_SUPPLY == 0 || !defined(PS_ON_PIN) + #undef PS_ON_PIN #define PS_ON_PIN -1 #endif #ifndef KILL_PIN @@ -656,10 +682,6 @@ #define SUICIDE_PIN -1 #endif -#ifndef MAX_EXTRUDERS - #define MAX_EXTRUDERS 5 -#endif - #ifndef NUM_SERVO_PLUGS #define NUM_SERVO_PLUGS 4 #endif @@ -717,94 +739,6 @@ #endif #endif -// List of pins which to ignore when asked to change by gcode, 0 and 1 are RX and TX, do not mess with those! -#define _E0_PINS E0_STEP_PIN, E0_DIR_PIN, E0_ENABLE_PIN, E0_MS1_PIN, E0_MS2_PIN, E0_CS_PIN, -#define _E1_PINS -#define _E2_PINS -#define _E3_PINS -#define _E4_PINS -#define _E5_PINS - -#if ENABLED(SWITCHING_EXTRUDER) - // Tools 0 and 1 use E0 - #if EXTRUDERS > 2 // Tools 2 and 3 use E1 - #undef _E1_PINS - #define _E1_PINS E1_STEP_PIN, E1_DIR_PIN, E1_ENABLE_PIN, E1_MS1_PIN, E1_MS2_PIN, E1_CS_PIN, - #if EXTRUDERS > 4 // Tools 4 and 5 use E2 - #undef _E2_PINS - #define _E2_PINS E2_STEP_PIN, E2_DIR_PIN, E2_ENABLE_PIN, E2_MS1_PIN, E2_MS2_PIN, E2_CS_PIN, - #endif - #endif -#elif EXTRUDERS > 1 - #undef _E1_PINS - #define _E1_PINS E1_STEP_PIN, E1_DIR_PIN, E1_ENABLE_PIN, E1_MS1_PIN, E1_MS2_PIN, E1_CS_PIN, - #if EXTRUDERS > 2 - #undef _E2_PINS - #define _E2_PINS E2_STEP_PIN, E2_DIR_PIN, E2_ENABLE_PIN, E2_MS1_PIN, E2_MS2_PIN, E2_CS_PIN, - #if EXTRUDERS > 3 - #undef _E3_PINS - #define _E3_PINS E3_STEP_PIN, E3_DIR_PIN, E3_ENABLE_PIN, E3_MS1_PIN, E3_MS2_PIN, E3_MS3_PIN, E3_CS_PIN, - #if EXTRUDERS > 4 - #undef _E4_PINS - #define _E4_PINS E4_STEP_PIN, E4_DIR_PIN, E4_ENABLE_PIN, E4_MS1_PIN, E4_MS2_PIN, E4_MS3_PIN, E4_CS_PIN, - #if EXTRUDERS > 5 - #undef _E5_PINS - #define _E5_PINS E5_STEP_PIN, E5_DIR_PIN, E5_ENABLE_PIN, E5_MS1_PIN, E5_MS2_PIN, E5_MS3_PIN, E5_CS_PIN, - #endif // EXTRUDERS > 5 - #endif // EXTRUDERS > 4 - #endif // EXTRUDERS > 3 - #endif // EXTRUDERS > 2 -#endif // EXTRUDERS > 1 - -#define _H0_PINS HEATER_0_PIN, E0_AUTO_FAN_PIN, analogInputToDigitalPin(TEMP_0_PIN), -#define _H1_PINS -#define _H2_PINS -#define _H3_PINS -#define _H4_PINS -#define _H5_PINS - -#if HOTENDS > 1 - #undef _H1_PINS - #define _H1_PINS HEATER_1_PIN, E1_AUTO_FAN_PIN, analogInputToDigitalPin(TEMP_1_PIN), - #if HOTENDS > 2 - #undef _H2_PINS - #define _H2_PINS HEATER_2_PIN, E2_AUTO_FAN_PIN, analogInputToDigitalPin(TEMP_2_PIN), - #if HOTENDS > 3 - #undef _H3_PINS - #define _H3_PINS HEATER_3_PIN, E3_AUTO_FAN_PIN, analogInputToDigitalPin(TEMP_3_PIN), - #if HOTENDS > 4 - #undef _H4_PINS - #define _H4_PINS HEATER_4_PIN, E4_AUTO_FAN_PIN, analogInputToDigitalPin(TEMP_4_PIN), - #if HOTENDS > 5 - #undef _H5_PINS - #define _H5_PINS HEATER_5_PIN, E5_AUTO_FAN_PIN, analogInputToDigitalPin(TEMP_5_PIN), - #endif // HOTENDS > 5 - #endif // HOTENDS > 4 - #endif // HOTENDS > 3 - #endif // HOTENDS > 2 -#elif ENABLED(MIXING_EXTRUDER) - #undef _E1_PINS - #define _E1_PINS E1_STEP_PIN, E1_DIR_PIN, E1_ENABLE_PIN, E1_MS1_PIN, E1_MS2_PIN, E1_CS_PIN, - #if MIXING_STEPPERS > 2 - #undef _E2_PINS - #define _E2_PINS E2_STEP_PIN, E2_DIR_PIN, E2_ENABLE_PIN, E2_MS1_PIN, E2_MS2_PIN, E2_CS_PIN, - #if MIXING_STEPPERS > 3 - #undef _E3_PINS - #define _E3_PINS E3_STEP_PIN, E3_DIR_PIN, E3_ENABLE_PIN, E3_MS1_PIN, E3_MS2_PIN, E3_CS_PIN, - #if MIXING_STEPPERS > 4 - #undef _E4_PINS - #define _E4_PINS E4_STEP_PIN, E4_DIR_PIN, E4_ENABLE_PIN, E4_MS1_PIN, E4_MS2_PIN, E4_CS_PIN, - #if MIXING_STEPPERS > 5 - #undef _E5_PINS - #define _E5_PINS E5_STEP_PIN, E5_DIR_PIN, E5_ENABLE_PIN, E5_MS1_PIN, E5_MS2_PIN, E5_CS_PIN, - #endif // MIXING_STEPPERS > 5 - #endif // MIXING_STEPPERS > 4 - #endif // MIXING_STEPPERS > 3 - #endif // MIXING_STEPPERS > 2 -#endif // MIXING_STEPPERS > 1 - -#define BED_PINS HEATER_BED_PIN, analogInputToDigitalPin(TEMP_BED_PIN), - // // Assign endstop pins for boards with only 3 connectors // @@ -841,7 +775,7 @@ // // Disable unused endstop / probe pins // -#if DISABLED(Z_MIN_PROBE_ENDSTOP) +#if !HAS_BED_PROBE || DISABLED(Z_MIN_PROBE_ENDSTOP) #undef Z_MIN_PROBE_PIN #define Z_MIN_PROBE_PIN -1 #endif @@ -889,14 +823,13 @@ #define LCD_PINS_D7 -1 #endif -// -// Dual X-carriage, Dual Y, Dual Z support -// - -#define _X2_PINS -#define _Y2_PINS -#define _Z2_PINS -#define _Z3_PINS +/** + * Auto-Assignment for Dual X, Dual Y, Multi-Z Steppers + * + * By default X2 is assigned to the next open E plug + * on the board, then in order, Y2, Z2, Z3. These can be + * overridden in Configuration.h or Configuration_adv.h. + */ #define __EPIN(p,q) E##p##_##q##_PIN #define _EPIN(p,q) __EPIN(p,q) @@ -907,19 +840,21 @@ #define X2_STEP_PIN _EPIN(E_STEPPERS, STEP) #define X2_DIR_PIN _EPIN(E_STEPPERS, DIR) #define X2_ENABLE_PIN _EPIN(E_STEPPERS, ENABLE) - #ifndef X2_CS_PIN - #define X2_CS_PIN _EPIN(E_STEPPERS, CS) - #endif - #if E_STEPPERS > MAX_EXTRUDERS || !PIN_EXISTS(X2_ENABLE) + #if E_STEPPERS >= MAX_EXTRUDERS || !PIN_EXISTS(X2_STEP) #error "No E stepper plug left for X2!" #endif #endif - #undef _X2_PINS - #define __X2_PINS X2_STEP_PIN, X2_DIR_PIN, X2_ENABLE_PIN, - #ifdef X2_CS_PIN - #define _X2_PINS __X2_PINS X2_CS_PIN, - #else - #define _X2_PINS __X2_PINS + #ifndef X2_CS_PIN + #define X2_CS_PIN _EPIN(E_STEPPERS, CS) + #endif + #ifndef X2_MS1_PIN + #define X2_MS1_PIN _EPIN(E_STEPPERS, MS1) + #endif + #ifndef X2_MS2_PIN + #define X2_MS2_PIN _EPIN(E_STEPPERS, MS2) + #endif + #ifndef X2_MS3_PIN + #define X2_MS3_PIN _EPIN(E_STEPPERS, MS3) #endif #define Y2_E_INDEX INCREMENT(E_STEPPERS) #else @@ -932,19 +867,21 @@ #define Y2_STEP_PIN _EPIN(Y2_E_INDEX, STEP) #define Y2_DIR_PIN _EPIN(Y2_E_INDEX, DIR) #define Y2_ENABLE_PIN _EPIN(Y2_E_INDEX, ENABLE) - #ifndef Y2_CS_PIN - #define Y2_CS_PIN _EPIN(Y2_E_INDEX, CS) - #endif - #if Y2_E_INDEX > MAX_EXTRUDERS || !PIN_EXISTS(Y2_ENABLE) + #if Y2_E_INDEX >= MAX_EXTRUDERS || !PIN_EXISTS(Y2_STEP) #error "No E stepper plug left for Y2!" #endif #endif - #undef _Y2_PINS - #define __Y2_PINS Y2_STEP_PIN, Y2_DIR_PIN, Y2_ENABLE_PIN, - #ifdef Y2_CS_PIN - #define _Y2_PINS __Y2_PINS Y2_CS_PIN, - #else - #define _Y2_PINS __Y2_PINS + #ifndef Y2_CS_PIN + #define Y2_CS_PIN _EPIN(Y2_E_INDEX, CS) + #endif + #ifndef Y2_MS1_PIN + #define Y2_MS1_PIN _EPIN(Y2_E_INDEX, MS1) + #endif + #ifndef Y2_MS2_PIN + #define Y2_MS2_PIN _EPIN(Y2_E_INDEX, MS2) + #endif + #ifndef Y2_MS3_PIN + #define Y2_MS3_PIN _EPIN(Y2_E_INDEX, MS3) #endif #define Z2_E_INDEX INCREMENT(Y2_E_INDEX) #else @@ -957,19 +894,21 @@ #define Z2_STEP_PIN _EPIN(Z2_E_INDEX, STEP) #define Z2_DIR_PIN _EPIN(Z2_E_INDEX, DIR) #define Z2_ENABLE_PIN _EPIN(Z2_E_INDEX, ENABLE) - #ifndef Z2_CS_PIN - #define Z2_CS_PIN _EPIN(Z2_E_INDEX, CS) - #endif - #if Z2_E_INDEX > MAX_EXTRUDERS || !PIN_EXISTS(Z2_ENABLE) + #if Z2_E_INDEX >= MAX_EXTRUDERS || !PIN_EXISTS(Z2_STEP) #error "No E stepper plug left for Z2!" #endif #endif - #undef _Z2_PINS - #define __Z2_PINS Z2_STEP_PIN, Z2_DIR_PIN, Z2_ENABLE_PIN, - #ifdef Z2_CS_PIN - #define _Z2_PINS __Z2_PINS Z2_CS_PIN, - #else - #define _Z2_PINS __Z2_PINS + #ifndef Z2_CS_PIN + #define Z2_CS_PIN _EPIN(Z2_E_INDEX, CS) + #endif + #ifndef Z2_MS1_PIN + #define Z2_MS1_PIN _EPIN(Z2_E_INDEX, MS1) + #endif + #ifndef Z2_MS2_PIN + #define Z2_MS2_PIN _EPIN(Z2_E_INDEX, MS2) + #endif + #ifndef Z2_MS3_PIN + #define Z2_MS3_PIN _EPIN(Z2_E_INDEX, MS3) #endif #define Z3_E_INDEX INCREMENT(Z2_E_INDEX) #else @@ -981,41 +920,20 @@ #define Z3_STEP_PIN _EPIN(Z3_E_INDEX, STEP) #define Z3_DIR_PIN _EPIN(Z3_E_INDEX, DIR) #define Z3_ENABLE_PIN _EPIN(Z3_E_INDEX, ENABLE) - #ifndef Z3_CS_PIN - #define Z3_CS_PIN _EPIN(Z3_E_INDEX, CS) - #endif - #if Z3_E_INDEX > 4 || !PIN_EXISTS(Z3_ENABLE) + #if Z3_E_INDEX >= MAX_EXTRUDERS || !PIN_EXISTS(Z3_STEP) #error "No E stepper plug left for Z3!" #endif #endif - #undef _Z3_PINS - #define __Z3_PINS Z3_STEP_PIN, Z3_DIR_PIN, Z3_ENABLE_PIN, - #ifdef Z3_CS_PIN - #define _Z3_PINS __Z3_PINS Z3_CS_PIN, - #else - #define _Z3_PINS __Z3_PINS + #ifndef Z3_CS_PIN + #define Z3_CS_PIN _EPIN(Z3_E_INDEX, CS) + #endif + #ifndef Z3_MS1_PIN + #define Z3_MS1_PIN _EPIN(Z3_E_INDEX, MS1) + #endif + #ifndef Z3_MS2_PIN + #define Z3_MS2_PIN _EPIN(Z3_E_INDEX, MS2) + #endif + #ifndef Z3_MS3_PIN + #define Z3_MS3_PIN _EPIN(Z3_E_INDEX, MS3) #endif #endif - -#ifndef HAL_SENSITIVE_PINS - #define HAL_SENSITIVE_PINS -#endif - -#define SENSITIVE_PINS { \ - X_STEP_PIN, X_DIR_PIN, X_ENABLE_PIN, X_MIN_PIN, X_MAX_PIN, X_MS1_PIN, X_MS2_PIN, X_CS_PIN, \ - Y_STEP_PIN, Y_DIR_PIN, Y_ENABLE_PIN, Y_MIN_PIN, Y_MAX_PIN, Y_MS1_PIN, Y_MS2_PIN, Y_CS_PIN, \ - Z_STEP_PIN, Z_DIR_PIN, Z_ENABLE_PIN, Z_MIN_PIN, Z_MAX_PIN, Z_MS1_PIN, Z_MS2_PIN, Z_MS3_PIN, Z_CS_PIN, Z_MIN_PROBE_PIN, \ - PS_ON_PIN, HEATER_BED_PIN, FAN_PIN, FAN1_PIN, FAN2_PIN, CONTROLLER_FAN_PIN, \ - _E0_PINS _E1_PINS _E2_PINS _E3_PINS _E4_PINS _E5_PINS BED_PINS \ - _H0_PINS _H1_PINS _H2_PINS _H3_PINS _H4_PINS _H5_PINS \ - _X2_PINS _Y2_PINS _Z2_PINS _Z3_PINS \ - HAL_SENSITIVE_PINS \ - } - -#define HAS_DIGIPOTSS (PIN_EXISTS(DIGIPOTSS)) - -// Note: default SPI pins are defined in the HAL - -#include HAL_PATH(../HAL, spi_pins.h) - -#endif // __PINS_H__ diff --git a/Marlin/src/pins/pinsDebug.h b/Marlin/src/pins/pinsDebug.h index 2ec747cd44..108a16b92f 100644 --- a/Marlin/src/pins/pinsDebug.h +++ b/Marlin/src/pins/pinsDebug.h @@ -67,7 +67,7 @@ typedef struct { - const char * const name; + PGM_P const name; pin_t pin; bool is_digital; } PinInfo; @@ -151,7 +151,7 @@ inline void report_pin_state_extended(pin_t pin, bool ignore, bool extended = fa #endif { if (!GET_ARRAY_IS_DIGITAL(x)) { - sprintf_P(buffer, PSTR("Analog in = %5ld"), analogRead(DIGITAL_PIN_TO_ANALOG_PIN(pin))); + sprintf_P(buffer, PSTR("Analog in = %5ld"), (long)analogRead(DIGITAL_PIN_TO_ANALOG_PIN(pin))); SERIAL_ECHO(buffer); } else { @@ -213,7 +213,7 @@ inline void report_pin_state_extended(pin_t pin, bool ignore, bool extended = fa } else { if (IS_ANALOG(pin)) { - sprintf_P(buffer, PSTR(" Analog in = %5ld"), analogRead(DIGITAL_PIN_TO_ANALOG_PIN(pin))); + sprintf_P(buffer, PSTR(" Analog in = %5ld"), (long)analogRead(DIGITAL_PIN_TO_ANALOG_PIN(pin))); SERIAL_ECHO(buffer); SERIAL_ECHOPGM(" "); } diff --git a/Marlin/src/pins/pinsDebug_list.h b/Marlin/src/pins/pinsDebug_list.h index e6ac174c17..e7e38256e0 100644 --- a/Marlin/src/pins/pinsDebug_list.h +++ b/Marlin/src/pins/pinsDebug_list.h @@ -268,6 +268,9 @@ #if PIN_EXISTS(E0_MS2) REPORT_NAME_DIGITAL(__LINE__, E0_MS2_PIN) #endif +#if PIN_EXISTS(E0_MS3) + REPORT_NAME_DIGITAL(__LINE__, E0_MS3_PIN) +#endif #if PIN_EXISTS(E0_STEP) REPORT_NAME_DIGITAL(__LINE__, E0_STEP_PIN) #endif @@ -289,6 +292,9 @@ #if PIN_EXISTS(E1_MS2) REPORT_NAME_DIGITAL(__LINE__, E1_MS2_PIN) #endif +#if PIN_EXISTS(E1_MS3) + REPORT_NAME_DIGITAL(__LINE__, E1_MS3_PIN) +#endif #if PIN_EXISTS(E1_STEP) REPORT_NAME_DIGITAL(__LINE__, E1_STEP_PIN) #endif @@ -310,6 +316,9 @@ #if PIN_EXISTS(E2_MS2) REPORT_NAME_DIGITAL(__LINE__, E2_MS2_PIN) #endif +#if PIN_EXISTS(E2_MS3) + REPORT_NAME_DIGITAL(__LINE__, E2_MS3_PIN) +#endif #if PIN_EXISTS(E2_STEP) REPORT_NAME_DIGITAL(__LINE__, E2_STEP_PIN) #endif @@ -563,8 +572,11 @@ #if PIN_EXISTS(MAX6675_SCK) REPORT_NAME_DIGITAL(__LINE__, MAX6675_SCK_PIN) #endif -#if defined(MAX6675_SS) && MAX6675_SS >= 0 - REPORT_NAME_DIGITAL(__LINE__, MAX6675_SS) +#if PIN_EXISTS(MAX6675_SS) + REPORT_NAME_DIGITAL(__LINE__, MAX6675_SS_PIN) +#endif +#if PIN_EXISTS(MAX6675_SS2) + REPORT_NAME_DIGITAL(__LINE__, MAX6675_SS2_PIN) #endif // #if defined(MISO) && MISO >= 0 // REPORT_NAME_DIGITAL(__LINE__, MISO) @@ -794,11 +806,11 @@ #if PIN_EXISTS(SUICIDE) REPORT_NAME_DIGITAL(__LINE__, SUICIDE_PIN) #endif -#if defined(THERMO_CS1) && THERMO_CS1 >= 0 - REPORT_NAME_DIGITAL(__LINE__, THERMO_CS1) +#if PIN_EXISTS(THERMO_CS1) + REPORT_NAME_DIGITAL(__LINE__, THERMO_CS1_PIN) #endif -#if defined(THERMO_CS2) && THERMO_CS2 >= 0 - REPORT_NAME_DIGITAL(__LINE__, THERMO_CS2) +#if PIN_EXISTS(THERMO_CS2) + REPORT_NAME_DIGITAL(__LINE__, THERMO_CS2_PIN) #endif #if PIN_EXISTS(THERMO_DO) REPORT_NAME_DIGITAL(__LINE__, THERMO_DO_PIN) @@ -881,6 +893,9 @@ #if PIN_EXISTS(X_MS2) REPORT_NAME_DIGITAL(__LINE__, X_MS2_PIN) #endif +#if PIN_EXISTS(X_MS3) + REPORT_NAME_DIGITAL(__LINE__, X_MS3_PIN) +#endif #if PIN_EXISTS(X_STEP) REPORT_NAME_DIGITAL(__LINE__, X_STEP_PIN) #endif @@ -893,6 +908,15 @@ #if PIN_EXISTS(X2_ENABLE) REPORT_NAME_DIGITAL(__LINE__, X2_ENABLE_PIN) #endif +#if PIN_EXISTS(X2_MS1) + REPORT_NAME_DIGITAL(__LINE__, X2_MS1_PIN) +#endif +#if PIN_EXISTS(X2_MS2) + REPORT_NAME_DIGITAL(__LINE__, X2_MS2_PIN) +#endif +#if PIN_EXISTS(X2_MS3) + REPORT_NAME_DIGITAL(__LINE__, X2_MS3_PIN) +#endif #if PIN_EXISTS(X2_STEP) REPORT_NAME_DIGITAL(__LINE__, X2_STEP_PIN) #endif @@ -920,6 +944,9 @@ #if PIN_EXISTS(Y_MS2) REPORT_NAME_DIGITAL(__LINE__, Y_MS2_PIN) #endif +#if PIN_EXISTS(Y_MS3) + REPORT_NAME_DIGITAL(__LINE__, Y_MS3_PIN) +#endif #if PIN_EXISTS(Y_STEP) REPORT_NAME_DIGITAL(__LINE__, Y_STEP_PIN) #endif @@ -932,6 +959,15 @@ #if PIN_EXISTS(Y2_ENABLE) REPORT_NAME_DIGITAL(__LINE__, Y2_ENABLE_PIN) #endif +#if PIN_EXISTS(Y2_MS1) + REPORT_NAME_DIGITAL(__LINE__, Y2_MS1_PIN) +#endif +#if PIN_EXISTS(Y2_MS2) + REPORT_NAME_DIGITAL(__LINE__, Y2_MS2_PIN) +#endif +#if PIN_EXISTS(Y2_MS3) + REPORT_NAME_DIGITAL(__LINE__, Y2_MS3_PIN) +#endif #if PIN_EXISTS(Y2_STEP) REPORT_NAME_DIGITAL(__LINE__, Y2_STEP_PIN) #endif @@ -962,6 +998,9 @@ #if PIN_EXISTS(Z_MS2) REPORT_NAME_DIGITAL(__LINE__, Z_MS2_PIN) #endif +#if PIN_EXISTS(Z_MS3) + REPORT_NAME_DIGITAL(__LINE__, Z_MS3_PIN) +#endif #if PIN_EXISTS(Z_STEP) REPORT_NAME_DIGITAL(__LINE__, Z_STEP_PIN) #endif diff --git a/Marlin/src/pins/pins_5DPRINT.h b/Marlin/src/pins/pins_5DPRINT.h index 415cc23bce..b90926c252 100644 --- a/Marlin/src/pins/pins_5DPRINT.h +++ b/Marlin/src/pins/pins_5DPRINT.h @@ -31,7 +31,7 @@ * and with the mainstream Marlin software. * * Teensyduino - http://www.pjrc.com/teensy/teensyduino.html - * Select Teensy++ 2.0 in Arduino IDE from the 'Tools -> Boards' menu + * Select Teensy++ 2.0 in Arduino IDE from the 'Tools > Board' menu * * Installation instructions are at the above URL. Don't bother loading the * libraries - they are not used with the Marlin software. @@ -46,7 +46,7 @@ * hardware directory in Arduino. The Arduino hardware directory will probably * be located in a path similar to this: C:\Program Files (x86)\Arduino\hardware. * 3. Restart Arduino. - * 4. Select "Printrboard" from the 'Tools -> Boards' menu. + * 4. Select "Printrboard" from the 'Tools > Board' menu. * * Teensyduino is the most popular option. Printrboard is used if your board doesn't have * the Teensyduino bootloader on it. @@ -68,7 +68,7 @@ */ #ifndef __AVR_AT90USB1286__ - #error "Oops! Make sure you have 'Teensy++ 2.0' or 'Printrboard' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Teensy++ 2.0' or 'Printrboard' in 'Tools > Board.'" #endif #define DEFAULT_MACHINE_NAME "Makibox" diff --git a/Marlin/src/pins/pins_ALLIGATOR_R2.h b/Marlin/src/pins/pins_ALLIGATOR_R2.h index 1bfbcdf224..2eb38c0c9d 100644 --- a/Marlin/src/pins/pins_ALLIGATOR_R2.h +++ b/Marlin/src/pins/pins_ALLIGATOR_R2.h @@ -26,7 +26,7 @@ */ #ifndef __SAM3X8E__ - #error "Oops! Make sure you have 'Arduino Due' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Arduino Due' in 'Tools > Board.'" #endif #define BOARD_NAME "Alligator Board R2" diff --git a/Marlin/src/pins/pins_ANET_10.h b/Marlin/src/pins/pins_ANET_10.h index a8cbd5f29c..85b4f53f8f 100644 --- a/Marlin/src/pins/pins_ANET_10.h +++ b/Marlin/src/pins/pins_ANET_10.h @@ -89,12 +89,10 @@ */ #ifndef __AVR_ATmega1284P__ - #error "Oops! Make sure you have 'Anet V1.0', 'Anet V1.0 (Optiboot)' or 'Sanguino' selected in the 'Tools -> Boards' menu and ATmega1284P selected in 'Tools -> Processor' menu." + #error "Oops! Select 'Anet V1.0', 'Anet V1.0 (Optiboot)' or 'Sanguino' in 'Tools > Board' and 'ATmega1284P' in 'Tools > Processor.'" #endif -#ifndef BOARD_NAME - #define BOARD_NAME "Anet" -#endif +#define BOARD_NAME "Anet 1.0" // // Limit Switches @@ -163,9 +161,6 @@ #define LCD_PINS_D5 11 #define LCD_PINS_D6 16 #define LCD_PINS_D7 17 - #define BTN_EN1 -1 - #define BTN_EN2 -1 - #define BTN_ENC -1 #define ADC_KEYPAD_PIN 1 #elif ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) || ENABLED(ANET_FULL_GRAPHICS_LCD) // Pin definitions for the Anet A6 Full Graphics display and the RepRapDiscount Full Graphics diff --git a/Marlin/src/pins/pins_ARCHIM1.h b/Marlin/src/pins/pins_ARCHIM1.h new file mode 100644 index 0000000000..5a69561d41 --- /dev/null +++ b/Marlin/src/pins/pins_ARCHIM1.h @@ -0,0 +1,195 @@ +/** + * 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 . + * + */ + +/** + * ARCHIM1 pin assignment + * + * The Archim 1.0 board requires Arduino Archim addons installed. + * + * - Add the following URL to Arduino IDE's Additional Board Manager URLs: + * https://raw.githubusercontent.com/ultimachine/ArduinoAddons/master/package_ultimachine_index.json + * + * - In the Arduino IDE Board Manager search for Archim and install the package. + * + * - Change your target board to "Archim". + * + * Further information on the UltiMachine website... + * https://github.com/ultimachine/Archim/wiki + */ + +#ifndef __SAM3X8E__ + #error "Oops! Select 'Archim' in 'Tools > Board.'" +#endif + +#define BOARD_NAME "Archim 1.0" + +// +// Items marked * have been altered from Archim v1.0 +// + +// +// Servos +// +#define SERVO0_PIN 20 // D20 PB12 (Header J20 20) +#define SERVO1_PIN 21 // D21 PB13 (Header J20 19) + + +// +// Limit Switches +// +#define X_MIN_PIN 14 // PD4 MIN ES1 +#define X_MAX_PIN 32 // PD10 MAX ES1 +#define Y_MIN_PIN 29 // PD6 MIN ES2 +#define Y_MAX_PIN 15 // PD5 MAX ES2 +#define Z_MIN_PIN 31 // PA7 MIN ES3 +#define Z_MAX_PIN 30 // PD9 MAX ES3 + +// +// Z Probe (when not Z_MIN_PIN) +// +#ifndef Z_MIN_PROBE_PIN + #define Z_MIN_PROBE_PIN 32 +#endif + +#ifndef FIL_RUNOUT_PIN + #define FIL_RUNOUT_PIN 66 // D66 PB15 (Header J20 15) +#endif +#ifndef FIL_RUNOUT2_PIN + #define FIL_RUNOUT2_PIN 67 // D67 PB16 (Header J20 16) +#endif + + +// +// Steppers +// +#define X_STEP_PIN 40 // PC8 STEP1 * +#define X_DIR_PIN 59 // PA4 DIR1 * +#define X_ENABLE_PIN 41 // PC9 EN1 + +#define Y_STEP_PIN 49 // PC14 STEP2 * +#define Y_DIR_PIN 47 // PC16 DIR2 * +#define Y_ENABLE_PIN 48 // PC15 EN2 * + +#define Z_STEP_PIN 36 // PC4 STEP Z * +#define Z_DIR_PIN 107 // PB10 DIR Z * +#define Z_ENABLE_PIN 96 // PC10 EN Z -AddOns * + +#define E0_STEP_PIN 78 // PB23 STEP3 * +#define E0_DIR_PIN 22 // PB26 DIR3 * +#define E0_ENABLE_PIN 97 // PB24 EN3 -Addons * + +#define E1_STEP_PIN 26 // PD1 STEP4 * +#define E1_DIR_PIN 27 // PD2 DIR4 * +#define E1_ENABLE_PIN 28 // PD3 EN4 * + +// Microstepping mode pins * +#define X_MS1_PIN 39 // PC7 MOD0E1 - As listed in schematic +#define X_MS2_PIN 38 // PC6 MOD1E1 +#define X_MS3_PIN 37 // PC5 MOD2E1 + +#define Y_MS1_PIN 50 // PC13 MODE0E2 +#define Y_MS2_PIN 51 // PC12 MODE1E2 +#define Y_MS3_PIN 92 // PC11 MODE2E2 - AddOns + +#define Z_MS1_PIN 44 // PC19 MOD0E Z +#define Z_MS2_PIN 45 // PC18 MOD1E Z +#define Z_MS3_PIN 46 // PC17 MOD2E Z + +#define E0_MS1_PIN 105 // PB22 MOD0E3 - AddOns +#define E0_MS2_PIN 106 // PC27 MOD1E3 - AddOns +#define E0_MS3_PIN 104 // PC20 MOD2E3 - AddOns + +#define E1_MS1_PIN 25 // PD0 MOD0E4 +#define E1_MS2_PIN 18 // PA11 MOD1E4 +#define E1_MS3_PIN 19 // PA10 MOD2E4 + +// Motor current PWM pins * +#define MOTOR_CURRENT_PWM_X_PIN 58 // PA6 X-REF TIOB2 +#define MOTOR_CURRENT_PWM_Y_PIN 12 // PD8 Y-REF TIOB8 +#define MOTOR_CURRENT_PWM_Z_PIN 10 // PC29 Z-REF TIOB7 +#define MOTOR_CURRENT_PWM_E0_PIN 3 // PC28 E1-REF TIOA7 +#define MOTOR_CURRENT_PWM_E1_PIN 11 // PD7 E2-REF TIOA8 + +#define MOTOR_CURRENT_PWM_RANGE 2750 // (3.3 Volts * 100000 Ohms) / (100000 Ohms + 20000 Ohms) = 2.75 Volts (max vref) +#define DEFAULT_PWM_MOTOR_CURRENT { 1000, 1000, 1000 } //, 1000, 1000} // X Y Z E0 E1, 1000 = 1000mAh + +// +// Temperature Sensors +// +#define TEMP_0_PIN 10 // D10 PB19 THERM AN1 * +#define TEMP_1_PIN 9 // D9 PB18 THERM AN2 * +#define TEMP_2_PIN 8 // D8 PB17 THERM AN4 * +#define TEMP_BED_PIN 11 // D11 PB20 THERM AN3 * + +// +// Heaters / Fans +// +#define HEATER_0_PIN 6 // D6 PC24 FET_PWM3 +#define HEATER_1_PIN 7 // D7 PC23 FET_PWM4 +#define HEATER_2_PIN 8 // D8 PC22 FET_PWM5 +#define HEATER_BED_PIN 9 // D9 PC21 BED_PWM + +#ifndef FAN_PIN + #define FAN_PIN 4 // D4 PC26 FET_PWM1 +#endif +#define FAN1_PIN 5 // D5 PC25 FET_PWM2 + +// +// Misc. Functions +// + +// Internal MicroSD card reader on the PCB +#define INT_SCK_PIN 42 // D42 PA19/MCCK +#define INT_MISO_PIN 43 // D43 PA20/MCCDA +#define INT_MOSI_PIN 73 // D73 PA21/MCDA0 +#define INT_SDSS 55 // D55 PA24/MCDA3 + +// External SD card reader on SC2 +#define SCK_PIN 76 // D76 PA27 +#define MISO_PIN 74 // D74 PA25 +#define MOSI_PIN 75 // D75 PA26 +#define SDSS 87 // D87 PA29 + +// 2MB SPI Flash +#define SPI_FLASH_SS 52 // D52 PB21 + +// +// LCD / Controller +// +#if ENABLED(ULTRA_LCD) + #define BEEPER_PIN 23 // D24 PA15_CTS1 + #define LCD_PINS_RS 17 // D17 PA12_RXD1 + #define LCD_PINS_ENABLE 24 // D23 PA14_RTS1 + #define LCD_PINS_D4 69 // D69 PA0_CANTX0 + #define LCD_PINS_D5 54 // D54 PA16_SCK1 + #define LCD_PINS_D6 68 // D68 PA1_CANRX0 + #define LCD_PINS_D7 34 // D34 PC2_PWML0 + + #define SD_DETECT_PIN 2 // D2 PB25_TIOA0 + + #if ENABLED(NEWPANEL) + // Buttons on AUX-2 + #define BTN_EN1 60 // D60 PA3_TIOB1 + #define BTN_EN2 13 // D13 PB27_TIOB0 + #define BTN_ENC 16 // D16 PA13_TXD1 + #endif // NEWPANEL +#endif // ULTRA_LCD diff --git a/Marlin/src/pins/pins_ARCHIM2.h b/Marlin/src/pins/pins_ARCHIM2.h index ea9348cef0..3d532a426f 100644 --- a/Marlin/src/pins/pins_ARCHIM2.h +++ b/Marlin/src/pins/pins_ARCHIM2.h @@ -21,47 +21,53 @@ */ /** - * ARCHIM2 pin assignment (pins_ARCHIM2.h) + * ARCHIM2 pin assignment * - * The Archim2 board requires Arduino Archim addons installed. - * Add the following URL to Arduino IDE's Additional Board Manager URLs: - * https://raw.githubusercontent.com/ultimachine/ArduinoAddons/master/package_ultimachine_index.json - * In the Arduino IDE Board Manager search for Archim and install the package. - * Change your target board to "Archim". + * The Archim 2.0 board requires Arduino Archim addons installed. * - * Further information is provided by UltiMachine - * https://github.com/ultimachine/Archim/wiki/Archim-v2.0 - * https://github.com/ultimachine/Archim/wiki + * - Add the following URL to Arduino IDE's Additional Board Manager URLs: + * https://raw.githubusercontent.com/ultimachine/ArduinoAddons/master/package_ultimachine_index.json * + * - In the Arduino IDE Board Manager search for Archim and install the package. + * + * - Change your target board to "Archim". + * + * Further information on the UltiMachine website... + * https://github.com/ultimachine/Archim/wiki */ #ifndef __SAM3X8E__ - #error "Oops! Make sure you have 'Archim' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Archim' in 'Tools > Board.'" #endif +#define BOARD_NAME "Archim 2.0" + // // Items marked * have been altered from Archim v1.0 // -// TMC2130 Diag Pins (currently just for reference) -#define X_DIAG_PIN 59 // PA4 X_DIAG -#define Y_DIAG_PIN 48 // PC15 Y_DIAG -#define Z_DIAG_PIN 36 // PC4 Z_DIAG -#define E0_DIAG_PIN 78 // PB23 E1_DIAG -#define E1_DIAG_PIN 25 // PD0 E2_DIAG +// +// Servos +// +#define SERVO0_PIN 20 // D20 PB12 (Header J20 20) +#define SERVO1_PIN 21 // D21 PB13 (Header J20 19) // // Limit Switches // -// Only use Diag Pins when SENSORLESS_HOMING is enabled for the TMC2130 drivers. -// Otherwise use a physical endstop based configuration. -#if DISABLED(SENSORLESS_HOMING) - #define X_MIN_PIN 14 // PD4 MIN ES1 - #define X_MAX_PIN 32 // PD10 MAX ES1 - #define Y_MIN_PIN 29 // PD6 MIN ES2 - #define Y_MAX_PIN 15 // PD5 MAX ES2 -#else +#if ENABLED(SENSORLESS_HOMING) + + // Only use Diag Pins when SENSORLESS_HOMING is enabled for the TMC2130 drivers. + // Otherwise use a physical endstop based configuration. + + // TMC2130 Diag Pins + #define X_DIAG_PIN 59 // PA4 + #define Y_DIAG_PIN 48 // PC15 + #define Z_DIAG_PIN 36 // PC4 + #define E0_DIAG_PIN 78 // PB23 + #define E1_DIAG_PIN 25 // PD0 + #if X_HOME_DIR == -1 #define X_MIN_PIN X_DIAG_PIN #define X_MAX_PIN 32 @@ -77,10 +83,18 @@ #define Y_MIN_PIN 29 #define Y_MAX_PIN Y_DIAG_PIN #endif + +#else + + #define X_MIN_PIN 14 // PD4 MIN ES1 + #define X_MAX_PIN 32 // PD10 MAX ES1 + #define Y_MIN_PIN 29 // PD6 MIN ES2 + #define Y_MAX_PIN 15 // PD5 MAX ES2 + #endif - #define Z_MIN_PIN 31 // PA7 MIN ES3 - #define Z_MAX_PIN 30 // PD9 MAX ES3 +#define Z_MIN_PIN 31 // PA7 MIN ES3 +#define Z_MAX_PIN 30 // PD9 MAX ES3 // // Z Probe (when not Z_MIN_PIN) @@ -148,40 +162,81 @@ // // Heaters / Fans // -#ifndef FAN_PIN - #define FAN_PIN 4 // D4 PC26 FET_PWM1 -#endif -#define FAN1_PIN 5 // D5 PC25 FET_PWM2 - #define HEATER_0_PIN 6 // D6 PC24 FET_PWM3 #define HEATER_1_PIN 7 // D7 PC23 FET_PWM4 #define HEATER_2_PIN 8 // D8 PC22 FET_PWM5 #define HEATER_BED_PIN 9 // D9 PC21 BED_PWM +#ifndef FAN_PIN + #define FAN_PIN 4 // D4 PC26 FET_PWM1 +#endif +#define FAN1_PIN 5 // D5 PC25 FET_PWM2 + // // Misc. Functions // -#define SDSS 87 // D87 PA29 CS -////////////////////////// -// LCDs and Controllers // -////////////////////////// +// Internal MicroSD card reader on the PCB +#define INT_SCK_PIN 42 // D42 PA19/MCCK +#define INT_MISO_PIN 43 // D43 PA20/MCCDA +#define INT_MOSI_PIN 73 // D73 PA21/MCDA0 +#define INT_SDSS 55 // D55 PA24/MCDA3 +// External SD card reader on SC2 +#define SCK_PIN 76 // D76 PA27 +#define MISO_PIN 74 // D74 PA25 +#define MOSI_PIN 75 // D75 PA26 +#define SDSS 87 // D87 PA29 + +// Unused Digital GPIO J20 Pins +#define GPIO_PB1_J20_5 94 // D94 PB1 (Header J20 5) +#define GPIO_PB0_J20_6 95 // D95 PB0 (Header J20 6) +#define GPIO_PB3_J20_7 103 // D103 PB3 (Header J20 7) +#define GPIO_PB2_J20_8 93 // D93 PB2 (Header J20 8) +#define GPIO_PB6_J20_9 99 // D99 PB6 (Header J20 9) +#define GPIO_PB5_J20_10 101 // D101 PB5 (Header J20 10) +#define GPIO_PB8_J20_11 100 // D100 PB8 (Header J20 11) +#define GPIO_PB4_J20_12 102 // D102 PB4 (Header J20 12) +#define GPIO_PB9_J20_13 108 // D108 PB9 (Header J20 13) +#define GPIO_PB7_J20_14 98 // D98 PB7 (Header J20 14) +#define GPIO_PB15_J20_15 66 // D66 PB15 (Header J20 15) +#define GPIO_PB16_J20_16 67 // D67 PB16 (Header J20 16) +#define GPIO_PB14_J20_17 53 // D53 PB14 (Header J20 17) +#define GPIO_PA18_J20_21 71 // D71 PA17 (Header J20 21) +#define GPIO_PA17_J20_22 70 // D70 PA17 (Header J20 22) + +// 2MB SPI Flash +#define SPI_FLASH_SS 52 // D52 PB21 + +// +// Filament Runout Sensor +// + +#ifndef FIL_RUNOUT_PIN + #define FIL_RUNOUT_PIN GPIO_PB15_J20_15 +#endif +#ifndef FIL_RUNOUT2_PIN + #define FIL_RUNOUT2_PIN GPIO_PB16_J20_16 +#endif + +// +// LCD / Controller +// #if ENABLED(ULTRA_LCD) + #define BEEPER_PIN 23 // D24 PA15_CTS1 + #define LCD_PINS_RS 17 // D17 PA12_RXD1 + #define LCD_PINS_ENABLE 24 // D23 PA14_RTS1 + #define LCD_PINS_D4 69 // D69 PA0_CANTX0 + #define LCD_PINS_D5 54 // D54 PA16_SCK1 + #define LCD_PINS_D6 68 // D68 PA1_CANRX0 + #define LCD_PINS_D7 34 // D34 PC2_PWML0 + + #define SD_DETECT_PIN 2 // D2 PB25_TIOA0 + #if ENABLED(NEWPANEL) - #define BEEPER_PIN 23 // D24 PA15_CTS1 - #define LCD_PINS_RS 17 // D17 PA12_RXD1 - #define LCD_PINS_ENABLE 24 // D23 PA14_RTS1 - #define LCD_PINS_D4 69 // D69 PA0_CANTX0 - #define LCD_PINS_D5 54 // D54 PA16_SCK1 - #define LCD_PINS_D6 68 // D68 PA1_CANRX0 - #define LCD_PINS_D7 34 // D34 PC2_PWML0 - - #define SD_DETECT_PIN 2 // D2 PB25_TIOA0 - // Buttons on AUX-2 #define BTN_EN1 60 // D60 PA3_TIOB1 #define BTN_EN2 13 // D13 PB27_TIOB0 #define BTN_ENC 16 // D16 PA13_TXD1 // the click - #endif // NEWPANEL + #endif // NEWPANEL #endif // ULTRA_LCD diff --git a/Marlin/src/pins/pins_ARMED.h b/Marlin/src/pins/pins_ARMED.h new file mode 100644 index 0000000000..fd6ffe6e0e --- /dev/null +++ b/Marlin/src/pins/pins_ARMED.h @@ -0,0 +1,166 @@ +/** + * 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 . + * + */ + +#ifndef STM32F4 + #error "Oops! Select an STM32F4 board in 'Tools > Board.'" +#endif + +#ifndef ARMED_V1_0 + #define ARMED_V1_1 +#endif + +#define DEFAULT_MACHINE_NAME "Arm'ed" +#define BOARD_NAME "Arm'ed" + +#define I2C_EEPROM + +#define E2END 0xFFF // EEPROM end address (4kB) + +#if HOTENDS > 2 || E_STEPPERS > 2 + #error "Arm'ed supports up to 2 hotends / E-steppers." +#endif + +// +// Limit Switches +// +#define X_MIN_PIN PE0 +#define X_MAX_PIN -1 +#define Y_MIN_PIN PE1 +#define Y_MAX_PIN -1 +#define Z_MIN_PIN PE14 +#define Z_MAX_PIN -1 + +// +// Z Probe (when not Z_MIN_PIN) +// +// #ifndef Z_MIN_PROBE_PIN +// #define Z_MIN_PROBE_PIN PA4 +// #endif + +// +// Steppers +// + +#ifdef ARMED_SWAP_X_E1 + #define X_STEP_PIN PE4 + #define X_DIR_PIN PE2 + #define X_ENABLE_PIN PE3 + #define X_CS_PIN PE5 +#else + #define X_STEP_PIN PD3 + #define X_DIR_PIN PD2 + #define X_ENABLE_PIN PD0 + #define X_CS_PIN PD1 +#endif + +#define Y_STEP_PIN PE11 +#define Y_DIR_PIN PE10 +#define Y_ENABLE_PIN PE13 +#define Y_CS_PIN PE12 + +#define Z_STEP_PIN PD6 +#define Z_DIR_PIN PD7 +#define Z_ENABLE_PIN PD4 +#define Z_CS_PIN PD5 + +#define E0_STEP_PIN PB5 +#define E0_DIR_PIN PB6 +#define E0_CS_PIN PB4 + +#ifdef ARMED_V1_0 + #define E0_ENABLE_PIN PB3 +#else + #define E0_ENABLE_PIN PC12 +#endif + +#ifdef ARMED_SWAP_X_E1 + #define E1_STEP_PIN PD3 + #define E1_DIR_PIN PD2 + #define E1_ENABLE_PIN PD0 + #define E1_CS_PIN PD1 +#else + #define E1_STEP_PIN PE4 + #define E1_DIR_PIN PE2 + #define E1_ENABLE_PIN PE3 + #define E1_CS_PIN PE5 +#endif + +// +// Temperature Sensors +// +#define TEMP_0_PIN PC0 // Analog Input +#define TEMP_1_PIN PC1 // Analog Input +#define TEMP_BED_PIN PC2 // Analog Input + +// +// Heaters / Fans +// +#define HEATER_0_PIN PA1 // PWM pin +#define HEATER_1_PIN PA2 // PWM pin +#define HEATER_BED_PIN PA0 // PWM pin + +#define FAN_PIN PC6 // PWM pin, Part cooling fan +#define FAN1_PIN PC7 // PWM pin, Extruder fan +#define FAN2_PIN PC8 // PWM pin, Controller fan + +// +// Misc functions +// +#define SDSS PE7 +#define LED_PIN PB7 // Heart beat +#define PS_ON_PIN PA10 +#define KILL_PIN PA8 +#define PWR_LOSS PA4 // Power loss / nAC_FAULT + +// +// LCD / Controller +// +#define SD_DETECT_PIN PA15 +#define BEEPER_PIN PC9 +#define LCD_PINS_RS PE9 +#define LCD_PINS_ENABLE PE8 +#define LCD_PINS_D4 PB12 +#define LCD_PINS_D5 PB13 +#define LCD_PINS_D6 PB14 +#define LCD_PINS_D7 PB15 +#define BTN_EN1 PC4 +#define BTN_EN2 PC5 +#define BTN_ENC PC3 + +// +// Filament runout detection +// +#define FIL_RUNOUT_PIN PA3 + +// +// Extension pins +// +#define EXT0_PIN PB0 +#define EXT1_PIN PB1 +#define EXT2_PIN PB2 +#define EXT3_PIN PD8 +#define EXT4_PIN PD9 +#define EXT5_PIN PD10 +#define EXT6_PIN PD11 +#define EXT7_PIN PD12 +#define EXT8_PIN PB10 +#define EXT9_PIN PB11 diff --git a/Marlin/src/pins/pins_AZSMZ_MINI.h b/Marlin/src/pins/pins_AZSMZ_MINI.h index 6d4971b954..e83ebf46a2 100644 --- a/Marlin/src/pins/pins_AZSMZ_MINI.h +++ b/Marlin/src/pins/pins_AZSMZ_MINI.h @@ -25,12 +25,10 @@ */ #ifndef TARGET_LPC1768 - #error "Oops! Make sure you have the LPC1768 environment selected in your IDE." + #error "Oops! Make sure you have the LPC1768 environment selected in your IDE." #endif -#ifndef BOARD_NAME - #define BOARD_NAME "AZSMZ MINI" -#endif +#define BOARD_NAME "AZSMZ MINI" // // Servos diff --git a/Marlin/src/pins/pins_AZTEEG_X3.h b/Marlin/src/pins/pins_AZTEEG_X3.h index 0abc9b87d6..13d9b35fd7 100644 --- a/Marlin/src/pins/pins_AZTEEG_X3.h +++ b/Marlin/src/pins/pins_AZTEEG_X3.h @@ -25,7 +25,7 @@ */ #ifndef __AVR_ATmega2560__ - #error "Oops! Make sure you have 'Arduino Mega 2560' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Arduino/Genuino Mega or Mega 2560' in 'Tools > Board.'" #endif #if HOTENDS > 2 || E_STEPPERS > 2 diff --git a/Marlin/src/pins/pins_AZTEEG_X3_PRO.h b/Marlin/src/pins/pins_AZTEEG_X3_PRO.h index fa17120651..832dfe429e 100644 --- a/Marlin/src/pins/pins_AZTEEG_X3_PRO.h +++ b/Marlin/src/pins/pins_AZTEEG_X3_PRO.h @@ -25,7 +25,7 @@ */ #ifndef __AVR_ATmega2560__ - #error "Oops! Make sure you have 'Arduino Mega 2560' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Arduino/Genuino Mega or Mega 2560' in 'Tools > Board.'" #endif #if HOTENDS > 5 || E_STEPPERS > 5 @@ -174,4 +174,3 @@ #define SPINDLE_LASER_ENABLE_PIN 20 // Pin should have a pullup! #define SPINDLE_DIR_PIN 21 #endif - diff --git a/Marlin/src/pins/pins_AZTEEG_X5_GT.h b/Marlin/src/pins/pins_AZTEEG_X5_GT.h index 3b41b9c4f2..4d1d824eb3 100644 --- a/Marlin/src/pins/pins_AZTEEG_X5_GT.h +++ b/Marlin/src/pins/pins_AZTEEG_X5_GT.h @@ -26,13 +26,11 @@ */ #ifndef TARGET_LPC1768 - #error "Oops! Make sure you have the LPC1768 environment selected in your IDE." + #error "Oops! Make sure you have the LPC1768 environment selected in your IDE." #endif -#ifndef BOARD_NAME - #define BOARD_NAME "Azteeg X5 GT" - #define DEFAULT_WEBSITE_URL "https://www.panucatt.com/azteeg_X5_GT_reprap_3d_printer_controller_p/ax5gt.htm" -#endif +#define BOARD_NAME "Azteeg X5 GT" +#define DEFAULT_WEBSITE_URL "https://www.panucatt.com/azteeg_X5_GT_reprap_3d_printer_controller_p/ax5gt.htm" // // Set CPU @@ -58,22 +56,37 @@ #define X_STEP_PIN P2_01 #define X_DIR_PIN P0_11 #define X_ENABLE_PIN P0_10 +#ifndef X_CS_PIN + #define X_CS_PIN P0_10 // BSD2660 default +#endif #define Y_STEP_PIN P2_02 #define Y_DIR_PIN P0_20 #define Y_ENABLE_PIN P0_19 +#ifndef Y_CS_PIN + #define Y_CS_PIN P0_19 // BSD2660 default +#endif #define Z_STEP_PIN P2_03 #define Z_DIR_PIN P0_22 #define Z_ENABLE_PIN P0_21 +#ifndef Z_CS_PIN + #define Z_CS_PIN P0_21 // BSD2660 default +#endif #define E0_STEP_PIN P2_00 #define E0_DIR_PIN P0_05 #define E0_ENABLE_PIN P0_04 +#ifndef E0_CS_PIN + #define E0_CS_PIN P0_04 // BSD2660 default +#endif #define E1_STEP_PIN P2_08 #define E1_DIR_PIN P2_13 #define E1_ENABLE_PIN P4_29 +#ifndef E1_CS_PIN + #define E1_CS_PIN P4_29 // BSD2660 default +#endif // // Temperature Sensors diff --git a/Marlin/src/pins/pins_AZTEEG_X5_MINI_WIFI.h b/Marlin/src/pins/pins_AZTEEG_X5_MINI_WIFI.h index 78af567a35..dee7a783ac 100644 --- a/Marlin/src/pins/pins_AZTEEG_X5_MINI_WIFI.h +++ b/Marlin/src/pins/pins_AZTEEG_X5_MINI_WIFI.h @@ -26,24 +26,21 @@ */ #ifndef TARGET_LPC1768 - #error "Oops! Make sure you have the LPC1768 environment selected in your IDE." + #error "Oops! Make sure you have the LPC1768 environment selected in your IDE." #endif -#ifndef BOARD_NAME - #define BOARD_NAME "Azteeg X5 MINI WIFI" - #define DEFAULT_WEBSITE_URL "http://www.panucatt.com/azteeg_X5_mini_reprap_3d_printer_controller_p/ax5mini.htm" -#endif +#define BOARD_NAME "Azteeg X5 MINI WIFI" +#define DEFAULT_WEBSITE_URL "http://www.panucatt.com/azteeg_X5_mini_reprap_3d_printer_controller_p/ax5mini.htm" // -// Set CPU +// LED // -#undef F_CPU -#define F_CPU 120000000 +#define LED_PIN P1_18 // // Servo // -#define SERVO0_PIN P1_23 +#define SERVO0_PIN P1_29 // // Limit Switches @@ -163,11 +160,6 @@ #define DOGLCD_CS P0_16 // (16) #endif - //#define MISO_PIN P0_17 // (50) system defined J3-10 & AUX-3 - //#define MOSI_PIN P0_18 // (51) system defined J3-10 & AUX-3 - //#define SCK_PIN P0_15 // (52) system defined J3-9 & AUX-3 - //#define SS_PIN P1_23 // (53) system defined J3-5 & AUX-3 - sometimes called SDSS - #if ENABLED(MINIPANEL) // GLCD features //#define LCD_CONTRAST 190 @@ -180,3 +172,38 @@ #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_BEAST.h b/Marlin/src/pins/pins_BEAST.h index 28fb8539a2..64f5614806 100644 --- a/Marlin/src/pins/pins_BEAST.h +++ b/Marlin/src/pins/pins_BEAST.h @@ -21,7 +21,7 @@ */ #if !defined(__STM32F1__) && !defined(__STM32F4__) - #error "Oops! Make sure you have an STM32F1/4 board selected from the 'Tools -> Boards' menu." + #error "Oops! Select an STM32F1/4 board in 'Tools > Board.'" #endif /** @@ -288,4 +288,3 @@ #define U_MIN_PIN -1 #define V_MIN_PIN -1 #define W_MIN_PIN -1 - diff --git a/Marlin/src/pins/pins_BIQU_BQ111_A4.h b/Marlin/src/pins/pins_BIQU_BQ111_A4.h index 1b481e2e41..f499241ab9 100644 --- a/Marlin/src/pins/pins_BIQU_BQ111_A4.h +++ b/Marlin/src/pins/pins_BIQU_BQ111_A4.h @@ -31,12 +31,10 @@ */ #ifndef TARGET_LPC1768 - #error "Oops! Make sure you have the LPC1768 environment selected in your IDE." + #error "Oops! Make sure you have the LPC1768 environment selected in your IDE." #endif -#ifndef BOARD_NAME - #define BOARD_NAME "BIQU BQ111-A4" -#endif +#define BOARD_NAME "BIQU BQ111-A4" // // Limit Switches diff --git a/Marlin/src/pins/pins_BQ_ZUM_MEGA_3D.h b/Marlin/src/pins/pins_BQ_ZUM_MEGA_3D.h index f80379eda2..c25115c7bb 100644 --- a/Marlin/src/pins/pins_BQ_ZUM_MEGA_3D.h +++ b/Marlin/src/pins/pins_BQ_ZUM_MEGA_3D.h @@ -25,7 +25,7 @@ */ #ifndef __AVR_ATmega2560__ - #error "Oops! Make sure you have 'Arduino Mega 2560' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Arduino/Genuino Mega or Mega 2560' in 'Tools > Board.'" #endif #define BOARD_NAME "ZUM Mega 3D" @@ -33,10 +33,10 @@ // // Heaters / Fans // -#define RAMPS_D8_PIN 10 -#define RAMPS_D9_PIN 12 -#define RAMPS_D10_PIN 9 -#define MOSFET_D_PIN 7 +#define RAMPS_D8_PIN 10 +#define RAMPS_D9_PIN 12 +#define RAMPS_D10_PIN 9 +#define MOSFET_D_PIN 7 // // Auto fans @@ -46,11 +46,6 @@ #define ORIG_E2_AUTO_FAN_PIN 6 #define ORIG_E3_AUTO_FAN_PIN 6 -// -// Misc. Functions -// -#define CASE_LIGHT_PIN 44 // MUST BE HARDWARE PWM - // // M3/M4/M5 - Spindle/Laser Control // @@ -64,37 +59,39 @@ // Limit Switches // #undef X_MAX_PIN -#define X_MAX_PIN 79 // 2 +#define X_MAX_PIN 79 // 2 // // Z Probe (when not Z_MIN_PIN) // #undef Z_MIN_PROBE_PIN -#define Z_MIN_PROBE_PIN 19 // IND_S_5V +#define Z_MIN_PROBE_PIN 19 // IND_S_5V #undef Z_ENABLE_PIN -#define Z_ENABLE_PIN 77 // 62 +#define Z_ENABLE_PIN 77 // 62 // // Steppers // -#define DIGIPOTSS_PIN 22 -#define DIGIPOT_CHANNELS { 4, 5, 3, 0, 1 } +#define DIGIPOTSS_PIN 22 +#define DIGIPOT_CHANNELS { 4, 5, 3, 0, 1 } // // Temperature Sensors // #undef TEMP_1_PIN -#define TEMP_1_PIN 14 // Analog Input (15) +#define TEMP_1_PIN 14 // Analog Input (15) #undef TEMP_BED_PIN -#define TEMP_BED_PIN 15 // Analog Input (14) +#define TEMP_BED_PIN 15 // Analog Input (14) // // Misc. Functions // -#undef PS_ON_PIN // 12 -#define PS_ON_PIN 81 // External Power Supply +#undef PS_ON_PIN // 12 +#define PS_ON_PIN 81 // External Power Supply + +#define CASE_LIGHT_PIN 44 // MUST BE HARDWARE PWM // This board has headers for Z-min, Z-max and IND_S_5V *but* as the bq team @@ -104,15 +101,14 @@ #ifdef Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN #undef Z_MIN_PIN #undef Z_MAX_PIN - #define Z_MIN_PIN 19 // IND_S_5V - #define Z_MAX_PIN 18 // Z-MIN Label + #define Z_MIN_PIN 19 // IND_S_5V + #define Z_MAX_PIN 18 // Z-MIN Label #endif - // -// This pin is used by the official Hephestos 2 heated bed upgrade kit +// Used by the Hephestos 2 heated bed upgrade kit // #if ENABLED(HEPHESTOS2_HEATED_BED_KIT) #undef HEATER_BED_PIN - #define HEATER_BED_PIN 8 + #define HEATER_BED_PIN 8 #endif diff --git a/Marlin/src/pins/pins_BRAINWAVE.h b/Marlin/src/pins/pins_BRAINWAVE.h index a43c6be95c..e798dfb890 100644 --- a/Marlin/src/pins/pins_BRAINWAVE.h +++ b/Marlin/src/pins/pins_BRAINWAVE.h @@ -53,9 +53,9 @@ * * 1. In the Arduino IDE, under Files -> Preferences paste the following URL * https://rawgit.com/Bob-the-Kuhn/Marlin_AT90USB/master/package_MARLIN_AT90USB_index.json - * 2. Under Tools -> Board -> Boards manager, scroll to the bottom, click on MARLIN_AT90USB + * 2. Under Tools > Board -> Boards manager, scroll to the bottom, click on MARLIN_AT90USB * and then click on "Install" - * 3. Select "AT90USB646_TEENSYPP" from the 'Tools -> Boards' menu. + * 3. Select "AT90USB646_TEENSYPP" from the 'Tools > Board' menu. */ /** @@ -68,10 +68,10 @@ */ #ifndef __AVR_AT90USB646__ - #error "Oops! Make sure you have 'AT90USB646_TEENSYPP' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'AT90USB646_TEENSYPP' in 'Tools > Board.'" #endif -#define BOARD_NAME "Brainwave" +#define BOARD_NAME "Brainwave" // // Limit Switches diff --git a/Marlin/src/pins/pins_BRAINWAVE_PRO.h b/Marlin/src/pins/pins_BRAINWAVE_PRO.h index 49c8ab6b59..84542f69fe 100644 --- a/Marlin/src/pins/pins_BRAINWAVE_PRO.h +++ b/Marlin/src/pins/pins_BRAINWAVE_PRO.h @@ -44,7 +44,7 @@ * and with the mainstream Marlin software. * * Teensyduino - http://www.pjrc.com/teensy/teensyduino.html - * Select Teensy++ 2.0 in Arduino IDE from the 'Tools -> Boards' menu + * Select Teensy++ 2.0 in Arduino IDE from the 'Tools > Board' menu * * Installation instructions are at the above URL. Don't bother loading the * libraries - they are not used with the Marlin software. @@ -59,7 +59,7 @@ * hardware directory in Arduino. The Arduino hardware directory will probably * be located in a path similar to this: C:\Program Files (x86)\Arduino\hardware. * 3. Restart Arduino. - * 4. Select "Printrboard" from the 'Tools -> Boards' menu. + * 4. Select "Printrboard" from the 'Tools > Board' menu. * * Teensyduino is the most popular option. Printrboard is used if your board doesn't have * the Teensyduino bootloader on it. @@ -75,10 +75,10 @@ */ #ifndef __AVR_AT90USB1286__ - #error "Oops! Make sure you have 'Teensy++ 2.0' or 'Printrboard' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Teensy++ 2.0' or 'Printrboard' in 'Tools > Board.'" #endif -#define BOARD_NAME "Brainwave Pro" +#define BOARD_NAME "Brainwave Pro" // // Limit Switches diff --git a/Marlin/src/pins/pins_CHEAPTRONIC.h b/Marlin/src/pins/pins_CHEAPTRONIC.h index e8f2c5f67e..65e81ae45d 100644 --- a/Marlin/src/pins/pins_CHEAPTRONIC.h +++ b/Marlin/src/pins/pins_CHEAPTRONIC.h @@ -25,10 +25,10 @@ */ #ifndef __AVR_ATmega2560__ - #error "Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Arduino/Genuino Mega or Mega 2560' in 'Tools > Board.'" #endif -#define BOARD_NAME "Cheaptronic v1.0" +#define BOARD_NAME "Cheaptronic v1.0" // // Limit Switches // diff --git a/Marlin/src/pins/pins_CHEAPTRONICv2.h b/Marlin/src/pins/pins_CHEAPTRONICv2.h index eea57d23ec..56617c537e 100644 --- a/Marlin/src/pins/pins_CHEAPTRONICv2.h +++ b/Marlin/src/pins/pins_CHEAPTRONICv2.h @@ -27,10 +27,10 @@ */ #ifndef __AVR_ATmega2560__ - #error "Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Arduino/Genuino Mega or Mega 2560' in 'Tools > Board.'" #endif -#define BOARD_NAME "Cheaptronic v2.0" +#define BOARD_NAME "Cheaptronic v2.0" // // Limit Switches diff --git a/Marlin/src/pins/pins_CHITU3D.h b/Marlin/src/pins/pins_CHITU3D.h index bfa92357ef..522193a824 100644 --- a/Marlin/src/pins/pins_CHITU3D.h +++ b/Marlin/src/pins/pins_CHITU3D.h @@ -21,7 +21,7 @@ */ #if !defined(__STM32F1__) && !defined(__STM32F4__) - #error "Oops! Make sure you have an STM32F1/4 board selected from the 'Tools -> Boards' menu." + #error "Oops! Select an STM32F1/4 board in 'Tools > Board.'" #endif /** @@ -286,4 +286,3 @@ #define U_MIN_PIN -1 #define V_MIN_PIN -1 #define W_MIN_PIN -1 - diff --git a/Marlin/src/pins/pins_CNCONTROLS_11.h b/Marlin/src/pins/pins_CNCONTROLS_11.h index 0a32d04a18..91bafb9e0e 100644 --- a/Marlin/src/pins/pins_CNCONTROLS_11.h +++ b/Marlin/src/pins/pins_CNCONTROLS_11.h @@ -3,7 +3,7 @@ */ #if !defined(__AVR_ATmega1280__) && !defined(__AVR_ATmega2560__) - #error Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu. + #error "Oops! Select 'Arduino/Genuino Mega or Mega 2560' in 'Tools > Board.'" #endif #define BOARD_NAME "CN Controls V11" diff --git a/Marlin/src/pins/pins_CNCONTROLS_12.h b/Marlin/src/pins/pins_CNCONTROLS_12.h index f073b19c96..a7fcb18162 100644 --- a/Marlin/src/pins/pins_CNCONTROLS_12.h +++ b/Marlin/src/pins/pins_CNCONTROLS_12.h @@ -3,10 +3,10 @@ */ #if !defined(__AVR_ATmega1280__) && !defined(__AVR_ATmega2560__) - #error Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu. + #error "Oops! Select 'Arduino/Genuino Mega or Mega 2560' in 'Tools > Board.'" #endif -#define BOARD_NAME "CN Controls V12" +#define BOARD_NAME "CN Controls V12" // // Limit Switches diff --git a/Marlin/src/pins/pins_COHESION3D_MINI.h b/Marlin/src/pins/pins_COHESION3D_MINI.h index ea568b266f..649403b7bb 100644 --- a/Marlin/src/pins/pins_COHESION3D_MINI.h +++ b/Marlin/src/pins/pins_COHESION3D_MINI.h @@ -26,12 +26,10 @@ */ #ifndef TARGET_LPC1768 - #error "Oops! Make sure you have the LPC1768 environment selected in your IDE." + #error "Oops! Make sure you have the LPC1768 environment selected in your IDE." #endif -#ifndef BOARD_NAME - #define BOARD_NAME "Cohesion3D Mini" -#endif +#define BOARD_NAME "Cohesion3D Mini" // // Servos diff --git a/Marlin/src/pins/pins_COHESION3D_REMIX.h b/Marlin/src/pins/pins_COHESION3D_REMIX.h index 77346914fb..23e8d21d02 100644 --- a/Marlin/src/pins/pins_COHESION3D_REMIX.h +++ b/Marlin/src/pins/pins_COHESION3D_REMIX.h @@ -26,12 +26,10 @@ */ #ifndef TARGET_LPC1768 - #error "Oops! Make sure you have the LPC1768 environment selected in your IDE." + #error "Oops! Make sure you have the LPC1768 environment selected in your IDE." #endif -#ifndef BOARD_NAME - #define BOARD_NAME "Cohesion3D ReMix" -#endif +#define BOARD_NAME "Cohesion3D ReMix" // // Servos diff --git a/Marlin/src/pins/pins_DUE3DOM.h b/Marlin/src/pins/pins_DUE3DOM.h index 76cc39c9ca..aa84053452 100644 --- a/Marlin/src/pins/pins_DUE3DOM.h +++ b/Marlin/src/pins/pins_DUE3DOM.h @@ -25,7 +25,7 @@ */ #ifndef __SAM3X8E__ - #error "Oops! Make sure you have 'Arduino Due' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Arduino Due' in 'Tools > Board.'" #endif #define BOARD_NAME "DUE3DOM" @@ -85,9 +85,9 @@ // SPI for Max6675 or Max31855 Thermocouple #if DISABLED(SDSUPPORT) - #define MAX6675_SS -1 + #define MAX6675_SS_PIN -1 #else - #define MAX6675_SS -1 + #define MAX6675_SS_PIN -1 #endif // diff --git a/Marlin/src/pins/pins_DUE3DOM_MINI.h b/Marlin/src/pins/pins_DUE3DOM_MINI.h index bf525d3059..3cd252a195 100644 --- a/Marlin/src/pins/pins_DUE3DOM_MINI.h +++ b/Marlin/src/pins/pins_DUE3DOM_MINI.h @@ -25,7 +25,7 @@ */ #ifndef __SAM3X8E__ - #error "Oops! Make sure you have 'Arduino Due' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Arduino Due' in 'Tools > Board.'" #endif #define BOARD_NAME "DUE3DOM MINI" @@ -77,9 +77,9 @@ // SPI for Max6675 or Max31855 Thermocouple #if DISABLED(SDSUPPORT) - #define MAX6675_SS 53 + #define MAX6675_SS_PIN 53 #else - #define MAX6675_SS 53 + #define MAX6675_SS_PIN 53 #endif // diff --git a/Marlin/src/pins/pins_EINSTART-S.h b/Marlin/src/pins/pins_EINSTART-S.h index 7fd88f8fc5..59fa5b0c66 100644 --- a/Marlin/src/pins/pins_EINSTART-S.h +++ b/Marlin/src/pins/pins_EINSTART-S.h @@ -21,25 +21,23 @@ */ /** - * Einstart S pin assignments + * Einstart-S pin assignments * PCB Silkscreen: 3DPrinterCon_v3.5 */ #if ENABLED(TARGET_LPC1768) - #error "Oops! Set MOTHERBOARD to an LPC1768-based board when building for LPC1768." + #error "Oops! Set MOTHERBOARD to an LPC1768-based board when building for LPC1768." #elif defined(__STM32F1__) - #error "Oops! Set MOTHERBOARD to an STM32F1-based board when building for STM32F1." + #error "Oops! Set MOTHERBOARD to an STM32F1-based board when building for STM32F1." #endif #if DISABLED(IS_RAMPS_SMART) && DISABLED(IS_RAMPS_DUO) && DISABLED(IS_RAMPS4DUE) && DISABLED(TARGET_LPC1768) #if !defined(__AVR_ATmega1280__) && !defined(__AVR_ATmega2560__) - #error "Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Arduino/Genuino Mega or Mega 2560' in 'Tools > Board.'" #endif #endif -#ifndef BOARD_NAME - #define BOARD_NAME "EINSTART_S" -#endif +#define BOARD_NAME "Einstart-S" // // Limit Switches diff --git a/Marlin/src/pins/pins_EINSY_RAMBO.h b/Marlin/src/pins/pins_EINSY_RAMBO.h index e3f67059fa..420edfd65f 100644 --- a/Marlin/src/pins/pins_EINSY_RAMBO.h +++ b/Marlin/src/pins/pins_EINSY_RAMBO.h @@ -25,10 +25,10 @@ */ #ifndef __AVR_ATmega2560__ - #error "Oops! Make sure you have 'Arduino Mega 2560 or Rambo' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Arduino Mega 2560 or Rambo' in 'Tools > Board.'" #endif -#define BOARD_NAME "Einsy Rambo" +#define BOARD_NAME "Einsy Rambo" // // TMC2130 Configuration_adv defaults for EinsyRambo diff --git a/Marlin/src/pins/pins_EINSY_RETRO.h b/Marlin/src/pins/pins_EINSY_RETRO.h index a100d9329e..23cf3da91e 100644 --- a/Marlin/src/pins/pins_EINSY_RETRO.h +++ b/Marlin/src/pins/pins_EINSY_RETRO.h @@ -25,10 +25,10 @@ */ #ifndef __AVR_ATmega2560__ - #error "Oops! Make sure you have 'Arduino Mega 2560 or Rambo' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Arduino Mega 2560 or Rambo' in 'Tools > Board.'" #endif -#define BOARD_NAME "Einsy Retro" +#define BOARD_NAME "Einsy Retro" // // TMC2130 Configuration_adv defaults for EinsyRetro diff --git a/Marlin/src/pins/pins_ELEFU_3.h b/Marlin/src/pins/pins_ELEFU_3.h index 79a4bce712..e87b3e15a7 100644 --- a/Marlin/src/pins/pins_ELEFU_3.h +++ b/Marlin/src/pins/pins_ELEFU_3.h @@ -25,7 +25,7 @@ */ #ifndef __AVR_ATmega2560__ - #error "Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Arduino/Genuino Mega or Mega 2560' in 'Tools > Board.'" #endif #define BOARD_NAME "Elefu Ra v3" diff --git a/Marlin/src/pins/pins_ESP32.h b/Marlin/src/pins/pins_ESP32.h index ffad5890b2..681b89b0ac 100644 --- a/Marlin/src/pins/pins_ESP32.h +++ b/Marlin/src/pins/pins_ESP32.h @@ -24,9 +24,7 @@ * Espressif ESP32 (Tensilica Xtensa LX6) pin assignments */ -#ifndef BOARD_NAME - #define BOARD_NAME "Espressif ESP32" -#endif +#define BOARD_NAME "Espressif ESP32" // // Limit Switches diff --git a/Marlin/src/pins/pins_FORMBOT_RAPTOR.h b/Marlin/src/pins/pins_FORMBOT_RAPTOR.h index 28c92394ad..c79dd03352 100644 --- a/Marlin/src/pins/pins_FORMBOT_RAPTOR.h +++ b/Marlin/src/pins/pins_FORMBOT_RAPTOR.h @@ -25,10 +25,10 @@ */ #ifndef __AVR_ATmega2560__ - #error "Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Arduino/Genuino Mega or Mega 2560' in 'Tools > Board.'" #endif -#if E_STEPPERS > 3 || HOTENDS > 3 +#if HOTENDS > 3 || E_STEPPERS > 3 #error "Formbot supports up to 3 hotends / E-steppers. Comment this line to keep going." #endif @@ -113,9 +113,9 @@ // SPI for Max6675 or Max31855 Thermocouple #if DISABLED(SDSUPPORT) - #define MAX6675_SS 66 // Do not use pin 53 if there is even the remote possibility of using Display/SD card + #define MAX6675_SS_PIN 66 // Do not use pin 53 if there is even the remote possibility of using Display/SD card #else - #define MAX6675_SS 66 // Do not use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present + #define MAX6675_SS_PIN 66 // Do not use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present #endif // diff --git a/Marlin/src/pins/pins_FORMBOT_RAPTOR2.h b/Marlin/src/pins/pins_FORMBOT_RAPTOR2.h new file mode 100644 index 0000000000..4392315492 --- /dev/null +++ b/Marlin/src/pins/pins_FORMBOT_RAPTOR2.h @@ -0,0 +1,191 @@ +/** + * 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 . + * + */ + +/** + * Formbot pin assignments + */ + +#ifndef __AVR_ATmega2560__ + #error "Oops! Select 'Arduino/Genuino Mega or Mega 2560' in 'Tools > Board.'" +#endif + +#if HOTENDS > 3 || E_STEPPERS > 3 + #error "Formbot supports up to 3 hotends / E-steppers. Comment this line to keep going." +#endif + +#define DEFAULT_MACHINE_NAME "Formbot Raptor2" +#define BOARD_NAME "Formbot Raptor2" + +// +// Servos +// +#define SERVO0_PIN 11 +#define SERVO1_PIN 6 +#define SERVO2_PIN 5 +#define SERVO3_PIN -1 + +// +// Limit Switches +// +#define X_MIN_PIN 3 +#ifndef X_MAX_PIN + #define X_MAX_PIN 2 +#endif +#define Y_MIN_PIN 14 +#define Y_MAX_PIN 15 +#define Z_MIN_PIN 18 +#define Z_MAX_PIN 19 + +// +// Z Probe (when not Z_MIN_PIN) +// +#ifndef Z_MIN_PROBE_PIN + #define Z_MIN_PROBE_PIN 32 +#endif + +// +// Steppers +// +#define X_STEP_PIN 54 +#define X_DIR_PIN 55 +#define X_ENABLE_PIN 38 +#ifndef X_CS_PIN + #define X_CS_PIN 53 +#endif + +#define Y_STEP_PIN 60 +#define Y_DIR_PIN 61 +#define Y_ENABLE_PIN 56 +#ifndef Y_CS_PIN + #define Y_CS_PIN 49 +#endif + +#define Z_STEP_PIN 46 +#define Z_DIR_PIN 48 +#define Z_ENABLE_PIN 62 +#ifndef Z_CS_PIN + #define Z_CS_PIN 40 +#endif + +#define E0_STEP_PIN 26 +#define E0_DIR_PIN 28 +#define E0_ENABLE_PIN 24 +#ifndef E0_CS_PIN + #define E0_CS_PIN 42 +#endif + +#define E1_STEP_PIN 36 +#define E1_DIR_PIN 34 +#define E1_ENABLE_PIN 30 +#ifndef E1_CS_PIN + #define E1_CS_PIN 44 +#endif + +#define E2_STEP_PIN 42 +#define E2_DIR_PIN 43 +#define E2_ENABLE_PIN 44 + +// +// Temperature Sensors +// +#define TEMP_0_PIN 13 // Analog Input +#define TEMP_1_PIN 15 // Analog Input +#define TEMP_BED_PIN 14 // Analog Input + +// SPI for Max6675 or Max31855 Thermocouple +#if DISABLED(SDSUPPORT) + #define MAX6675_SS_PIN 66 // Do not use pin 53 if there is even the remote possibility of using Display/SD card +#else + #define MAX6675_SS_PIN 66 // Do not use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present +#endif + +// +// Heaters / Fans +// +#define HEATER_0_PIN 10 +#define HEATER_1_PIN 7 +#define HEATER_BED_PIN 8 +#define LED4_PIN 5 +#define FAN_PIN 6 + +#ifndef FIL_RUNOUT_PIN + #define FIL_RUNOUT_PIN 22 +#endif + +// +// M3/M4/M5 - Spindle/Laser Control +// +#if ENABLED(SPINDLE_LASER_ENABLE) && !PIN_EXISTS(SPINDLE_LASER_ENABLE) + #if !defined(NUM_SERVOS) || NUM_SERVOS == 0 // try to use servo connector first + #define SPINDLE_LASER_ENABLE_PIN 6 // Pin should have a pullup/pulldown! + #define SPINDLE_LASER_PWM_PIN 4 // MUST BE HARDWARE PWM + #define SPINDLE_DIR_PIN 5 + #elif !(ENABLED(ULTRA_LCD) && ENABLED(NEWPANEL) \ + && (ENABLED(PANEL_ONE) || ENABLED(VIKI2) || ENABLED(miniVIKI) || ENABLED(MINIPANEL) || ENABLED(REPRAPWORLD_KEYPAD))) // try to use AUX 2 + #define SPINDLE_LASER_ENABLE_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 + + +// +// Misc. Functions +// +#define SDSS 5 +#if ENABLED(CASE_LIGHT_ENABLE) && !defined(CASE_LIGHT_PIN) && !defined(SPINDLE_LASER_ENABLE_PIN) + #if NUM_SERVOS <= 1 // try to use servo connector first + #define CASE_LIGHT_PIN 6 // MUST BE HARDWARE PWM + #elif !(ENABLED(ULTRA_LCD) && ENABLED(NEWPANEL) \ + && (ENABLED(PANEL_ONE) || ENABLED(VIKI2) || ENABLED(miniVIKI) || ENABLED(MINIPANEL) || ENABLED(REPRAPWORLD_KEYPAD))) // try to use AUX 2 + #define CASE_LIGHT_PIN 44 // MUST BE HARDWARE PWM + #endif +#endif + +#define LED_PIN 13 + +// Use the RAMPS 1.4 Analog input 5 on the AUX2 connector +#define FILWIDTH_PIN 5 // Analog Input + +#ifndef PS_ON_PIN + #define PS_ON_PIN 12 +#endif + +// +// LCD / Controller +// +// Formbot only supports REPRAP_DISCOUNT_SMART_CONTROLLER +// +#if ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER) + #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 + #define BEEPER_PIN 37 + #define BTN_EN1 31 + #define BTN_EN2 33 + #define BTN_ENC 35 + #define SD_DETECT_PIN 49 + #define KILL_PIN 41 +#endif \ No newline at end of file diff --git a/Marlin/src/pins/pins_FORMBOT_TREX2PLUS.h b/Marlin/src/pins/pins_FORMBOT_TREX2PLUS.h index e02ee5e1f3..b5d77c7214 100644 --- a/Marlin/src/pins/pins_FORMBOT_TREX2PLUS.h +++ b/Marlin/src/pins/pins_FORMBOT_TREX2PLUS.h @@ -25,10 +25,10 @@ */ #ifndef __AVR_ATmega2560__ - #error "Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Arduino/Genuino Mega or Mega 2560' in 'Tools > Board.'" #endif -#if E_STEPPERS > 2 || HOTENDS > 2 +#if HOTENDS > 2 || E_STEPPERS > 2 #error "Formbot supports up to 2 hotends / E-steppers. Comment this line to keep going." #endif @@ -113,9 +113,9 @@ // SPI for Max6675 or Max31855 Thermocouple #if DISABLED(SDSUPPORT) - #define MAX6675_SS 66 // Do not use pin 53 if there is even the remote possibility of using Display/SD card + #define MAX6675_SS_PIN 66 // Do not use pin 53 if there is even the remote possibility of using Display/SD card #else - #define MAX6675_SS 66 // Do not use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present + #define MAX6675_SS_PIN 66 // Do not use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present #endif // diff --git a/Marlin/src/pins/pins_FORMBOT_TREX3.h b/Marlin/src/pins/pins_FORMBOT_TREX3.h index 5591edcbfe..622c2d50c2 100644 --- a/Marlin/src/pins/pins_FORMBOT_TREX3.h +++ b/Marlin/src/pins/pins_FORMBOT_TREX3.h @@ -25,10 +25,10 @@ */ #ifndef __AVR_ATmega2560__ - #error "Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Arduino/Genuino Mega or Mega 2560' in 'Tools > Board.'" #endif -#if E_STEPPERS > 2 || HOTENDS > 2 +#if HOTENDS > 2 || E_STEPPERS > 2 #error "Formbot supports up to 2 hotends / E-steppers. Comment this line to keep going." #endif @@ -113,9 +113,9 @@ // SPI for Max6675 or Max31855 Thermocouple #if DISABLED(SDSUPPORT) - #define MAX6675_SS 66 // Do not use pin 53 if there is even the remote possibility of using Display/SD card + #define MAX6675_SS_PIN 66 // Do not use pin 53 if there is even the remote possibility of using Display/SD card #else - #define MAX6675_SS 66 // Do not use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present + #define MAX6675_SS_PIN 66 // Do not use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present #endif // @@ -160,10 +160,6 @@ // Use the RAMPS 1.4 Analog input 5 on the AUX2 connector #define FILWIDTH_PIN 5 // Analog Input -#ifndef PS_ON_PIN - #define PS_ON_PIN 12 -#endif - // // LCD / Controller // diff --git a/Marlin/src/pins/pins_FYSETC_F6_13.h b/Marlin/src/pins/pins_FYSETC_F6_13.h index 061c8921a3..d343e82f5e 100644 --- a/Marlin/src/pins/pins_FYSETC_F6_13.h +++ b/Marlin/src/pins/pins_FYSETC_F6_13.h @@ -25,12 +25,18 @@ // #ifndef __AVR_ATmega2560__ - #error "Oops! Make sure you have 'FYSETC_F6' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'FYSETC F6' in 'Tools > Board.'" #endif -#ifndef BOARD_NAME - #define BOARD_NAME "FYSETC_F6_13" -#endif +#define BOARD_NAME "FYSETC F6 1.3" + +// +// Servos +// +#define SERVO0_PIN 13 +#define SERVO1_PIN 11 // (PS_ON_PIN) +#define SERVO2_PIN 10 // (FIL_RUNOUT_PIN) +#define SERVO3_PIN 4 // (RGB_LED_G_PIN) // // Limit Switches @@ -43,7 +49,7 @@ #define Z_MAX_PIN 9 #ifndef FIL_RUNOUT_PIN - #define FIL_RUNOUT_PIN 10 + #define FIL_RUNOUT_PIN SERVO2_PIN #endif // @@ -158,14 +164,14 @@ #define KILL_PIN 41 #ifndef PS_ON_PIN - #define PS_ON_PIN 11 // Servos pin + #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 4 + #define RGB_LED_G_PIN SERVO3_PIN #endif #ifndef RGB_LED_B_PIN #define RGB_LED_B_PIN 9 diff --git a/Marlin/src/pins/pins_GEN3_MONOLITHIC.h b/Marlin/src/pins/pins_GEN3_MONOLITHIC.h index 5d64e94290..dc3a22fcd9 100644 --- a/Marlin/src/pins/pins_GEN3_MONOLITHIC.h +++ b/Marlin/src/pins/pins_GEN3_MONOLITHIC.h @@ -50,7 +50,7 @@ */ #ifndef __AVR_ATmega644P__ - #error "Oops! Make sure you have 'Sanguino' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Sanguino' in 'Tools > Board.'" #endif #define BOARD_NAME "Gen3 Monolithic" diff --git a/Marlin/src/pins/pins_GEN3_PLUS.h b/Marlin/src/pins/pins_GEN3_PLUS.h index 85c47305b3..e30fee2c30 100644 --- a/Marlin/src/pins/pins_GEN3_PLUS.h +++ b/Marlin/src/pins/pins_GEN3_PLUS.h @@ -51,10 +51,10 @@ #if !defined(__AVR_ATmega644P__) && !defined(__AVR_ATmega1284P__) - #error "Oops! Make sure you have 'Sanguino' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Sanguino' in 'Tools > Boards' and 'ATmega644P' or 'ATmega1284P' in 'Tools > Processor.'" #endif -#define BOARD_NAME "Gen3+" +#define BOARD_NAME "Gen3+" // // Limit Switches diff --git a/Marlin/src/pins/pins_GEN6.h b/Marlin/src/pins/pins_GEN6.h index 1c5e2069ae..437302d60f 100644 --- a/Marlin/src/pins/pins_GEN6.h +++ b/Marlin/src/pins/pins_GEN6.h @@ -52,7 +52,7 @@ */ #if !defined(__AVR_ATmega644P__) && !defined(__AVR_ATmega1284P__) - #error "Oops! Make sure you have 'Sanguino' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Sanguino' in 'Tools > Boards' and 'ATmega644P' or 'ATmega1284P' in 'Tools > Processor.'" #endif #ifndef BOARD_NAME diff --git a/Marlin/src/pins/pins_GEN7_12.h b/Marlin/src/pins/pins_GEN7_12.h index 1afaae9abc..87bf70f32a 100644 --- a/Marlin/src/pins/pins_GEN7_12.h +++ b/Marlin/src/pins/pins_GEN7_12.h @@ -52,7 +52,7 @@ */ #if !defined(__AVR_ATmega644P__) && !defined(__AVR_ATmega644__) && !defined(__AVR_ATmega1284P__) - #error "Oops! Make sure you have 'Sanguino' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Sanguino' in 'Tools > Boards' and 'ATmega644', 'ATmega644P', or 'ATmega1284P' in 'Tools > Processor.'" #endif #ifndef BOARD_NAME diff --git a/Marlin/src/pins/pins_GEN7_14.h b/Marlin/src/pins/pins_GEN7_14.h index dedd227ca0..6a171a8376 100644 --- a/Marlin/src/pins/pins_GEN7_14.h +++ b/Marlin/src/pins/pins_GEN7_14.h @@ -52,7 +52,7 @@ */ #if !defined(__AVR_ATmega644P__) && !defined(__AVR_ATmega644__) && !defined(__AVR_ATmega1284P__) - #error "Oops! Make sure you have 'Sanguino' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Sanguino' in 'Tools > Boards' and 'ATmega644', 'ATmega644P', or 'ATmega1284P' in 'Tools > Processor.'" #endif #define BOARD_NAME "Gen7 v1.4" diff --git a/Marlin/src/pins/pins_GEN7_CUSTOM.h b/Marlin/src/pins/pins_GEN7_CUSTOM.h index fdfb6b5fa1..7d0f44d7f3 100644 --- a/Marlin/src/pins/pins_GEN7_CUSTOM.h +++ b/Marlin/src/pins/pins_GEN7_CUSTOM.h @@ -55,10 +55,10 @@ */ #if !defined(__AVR_ATmega644P__) && !defined(__AVR_ATmega644__) && !defined(__AVR_ATmega1284P__) - #error "Oops! Make sure you have 'Sanguino' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Sanguino' in 'Tools > Boards' and 'ATmega644', 'ATmega644P', or 'ATmega1284P' in 'Tools > Processor.'" #endif -#define BOARD_NAME "Gen7 Custom" +#define BOARD_NAME "Gen7 Custom" // // Limit Switches diff --git a/Marlin/src/pins/pins_GT2560_REV_A.h b/Marlin/src/pins/pins_GT2560_REV_A.h index 63f166ab32..8805f5c22f 100644 --- a/Marlin/src/pins/pins_GT2560_REV_A.h +++ b/Marlin/src/pins/pins_GT2560_REV_A.h @@ -27,7 +27,7 @@ */ #if !defined(__AVR_ATmega1280__) && !defined(__AVR_ATmega2560__) - #error "Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Arduino/Genuino Mega or Mega 2560' in 'Tools > Board.'" #endif #ifndef BOARD_NAME diff --git a/Marlin/src/pins/pins_GT2560_V3.h b/Marlin/src/pins/pins_GT2560_V3.h index 414780a273..96ecd8e0b0 100644 --- a/Marlin/src/pins/pins_GT2560_V3.h +++ b/Marlin/src/pins/pins_GT2560_V3.h @@ -26,7 +26,7 @@ */ #if !defined(__AVR_ATmega1280__) && !defined(__AVR_ATmega2560__) - #error "Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Arduino/Genuino Mega or Mega 2560' in 'Tools > Board.'" #endif #ifndef BOARD_NAME diff --git a/Marlin/src/pins/pins_GT2560_V3_MC2.h b/Marlin/src/pins/pins_GT2560_V3_MC2.h new file mode 100644 index 0000000000..a0c9d96ccf --- /dev/null +++ b/Marlin/src/pins/pins_GT2560_V3_MC2.h @@ -0,0 +1,41 @@ +/** + * 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 . + * + */ + +/***************************************************************** + * GT2560 V3.0 pin assignment (for Mecreator 2) + *****************************************************************/ + +#define BOARD_NAME "GT2560 V3.0 (MC2)" + +#include "pins_GT2560_V3.h" + +#undef X_MIN_PIN +#define X_MIN_PIN 22 + +#undef X_MAX_PIN +#define X_MAX_PIN 24 + +#undef Y_MIN_PIN +#define Y_MIN_PIN 26 + +#undef Y_MAX_PIN +#define Y_MAX_PIN 28 diff --git a/Marlin/src/pins/pins_GTM32_PRO_VB.h b/Marlin/src/pins/pins_GTM32_PRO_VB.h index 41f45f54b3..1914db0b43 100644 --- a/Marlin/src/pins/pins_GTM32_PRO_VB.h +++ b/Marlin/src/pins/pins_GTM32_PRO_VB.h @@ -20,17 +20,22 @@ * */ -#ifndef __STM32F1__ - #error "Oops! Make sure you have an STM32F1 board selected from the 'Tools -> Boards' menu." -#endif - /** - * 24.05.2018 Axel "chepo" Sepúlveda Marlin for (stm32f103vet6) sch of board https://github.com/chepo92/Smartto/blob/master/Rostock301/Hardware_GTM32_PRO_VB.pdf + * 24 May 2018 - @chepo for STM32F103VET6 + * Schematic: https://github.com/chepo92/Smartto/blob/master/circuit_diagram/Rostock301/Hardware_GTM32_PRO_VB.pdf */ +#ifndef __STM32F1__ + #error "Oops! Select an STM32F1 board in 'Tools > Board.'" +#endif + #define DEFAULT_MACHINE_NAME "STM32F103VET6" #define BOARD_NAME "GTM32 Pro VB" +//#define DISABLE_DEBUG +#define DISABLE_JTAG +//#define DISABLE_JTAGSWD + // Ignore temp readings during development. #define BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE @@ -53,47 +58,137 @@ #define Y_STEP_PIN PA12 #define Y_DIR_PIN PA11 -#define Y_ENABLE_PIN PA15 // core conflict? +#define Y_ENABLE_PIN PA15 #define Z_STEP_PIN PD6 #define Z_DIR_PIN PD3 -#define Z_ENABLE_PIN PB3 // core conflict? +#define Z_ENABLE_PIN PB3 -#define E0_STEP_PIN PC14 -#define E0_DIR_PIN PC13 -#define E0_ENABLE_PIN PC15 +#define E0_STEP_PIN PB2 +#define E0_DIR_PIN PB11 +#define E0_ENABLE_PIN PC4 #define E1_STEP_PIN PA0 #define E1_DIR_PIN PB6 #define E1_ENABLE_PIN PA1 -#define E2_STEP_PIN PB2 -#define E2_DIR_PIN PB11 -#define E2_ENABLE_PIN PC4 - -// -// Temperature Sensors -// -#define TEMP_BED_PIN PC0 -#define TEMP_0_PIN PC1 -#define TEMP_1_PIN PC2 -#define TEMP_2_PIN PC3 +#define E2_STEP_PIN PC14 +#define E2_DIR_PIN PC13 +#define E2_ENABLE_PIN PC15 // // Heaters / Fans // -#define HEATER_0_PIN PB4 // EXTRUDER 1 -#define HEATER_1_PIN PB5 // EXTRUDER 2 -#define HEATER_2_PIN PB0 // EXTRUDER 3 -#define HEATER_BED_PIN PB1 // BED +#define HEATER_0_PIN PB0 +#define HEATER_1_PIN PB5 +#define HEATER_2_PIN PB4 +#define HEATER_BED_PIN PB1 -#ifndef FAN_PIN - #define FAN_PIN PB7 // (Sprinter config) -#endif -#define FAN1_PIN PB8 -#define FAN2_PIN PB9 +#define FAN0_PIN PB7 // TODO: Add functionality +#define FAN1_PIN PB8 // TODO: Add functionality +#define FAN2_PIN PB9 // TODO: Add functionality + +// +// Temperature Sensors +// +#define TEMP_0_PIN PC2 // PORT NUMBERING +#define TEMP_1_PIN PC1 // PORT NUMBERING +#define TEMP_2_PIN PC0 // PORT NUMBERING +#define TEMP_BED_PIN PC3 // PORT NUMBERING // // Misc. Functions // -#define LED_PIN PD12 +#define LED_PWM PD12 // External LED, pin 2 on LED labeled connector +//#define RESET_PIN NRST +#define T_PEN PE6 + +#define BEEPER_PIN PB10 + +// +// LCD / Controller +// +#if ENABLED(ULTRA_LCD) + + #if ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER) + #define LCD_PINS_RS PE6 // CS chip select /SS chip slave select + #define LCD_PINS_ENABLE PE14 // SID (MOSI) + #define LCD_PINS_D4 PD8 // SCK (CLK) clock + #define LCD_PINS_D5 PD9 + #define LCD_PINS_D6 PD10 + #define LCD_PINS_D7 PE15 + + #define BTN_EN1 PE8 + #define BTN_EN2 PE9 + #define BTN_ENC PE13 + + #define SD_DETECT_PIN PC7 + #define KILL_PIN -1 + #endif + + #ifndef ST7920_DELAY_1 + #define ST7920_DELAY_1 DELAY_NS(96) + #endif + #ifndef ST7920_DELAY_2 + #define ST7920_DELAY_2 DELAY_NS(48) + #endif + #ifndef ST7920_DELAY_3 + #define ST7920_DELAY_3 DELAY_NS(715) + #endif + + // + // UART LCD Pins, if used + // + //#define LCD_PINS_D14 PD9 // RXD3 + //#define LCD_PINS_D13 PD8 // TXD3 + +#endif // ULTRA_LCD + +// +// SPI2 on LCD conn +// +#define SPI2_MOSI PB15 +#define SPI2_MISO PB14 +#define SPI2_SCK PB13 +#define SPI2_NSS PB12 + +// +// SD Card on LCD +// +#define SD_CD PC7 +#define SD_DATA0 PC8 +#define SD_DATA1 PC9 +#define SD_DATA2 PC10 +#define SD_DATA3 PC11 +#define SD_CMD PD2 +#define SD_CLK PC12 + +// +// SPI Flash (on board Card Socket) +// +#define SPI1_NSS PA4 +#define SPI1_SCK PA5 +#define SPI1_MISO PA6 +#define SPI1_MOSI PA7 + +// +// Debug +// +//#define SDA PA13 +//#define SCL PA14 + +// +// Wifi +// +#define USART2_RX PA3 // Default alternate function +#define USART2_TX PA2 // Default alternate function + +// +// For future use +// +//#undef USB_DM +//#undef CAN_TX +//#undef USB_DP +//#undef CAN_RX +//#undef BOARD_JTDI_PIN +//#define BOOT0 BOOT0 diff --git a/Marlin/src/pins/pins_LEAPFROG.h b/Marlin/src/pins/pins_LEAPFROG.h index 9a31520e8a..946e20eef5 100644 --- a/Marlin/src/pins/pins_LEAPFROG.h +++ b/Marlin/src/pins/pins_LEAPFROG.h @@ -25,10 +25,10 @@ */ #if !defined(__AVR_ATmega1280__) && !defined(__AVR_ATmega2560__) - #error "Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Mega 1280' or 'Mega 2560' in 'Tools > Board.'" #endif -#define BOARD_NAME "Leapfrog" +#define BOARD_NAME "Leapfrog" // // Limit Switches diff --git a/Marlin/src/pins/pins_MALYAN_M200.h b/Marlin/src/pins/pins_MALYAN_M200.h index c9887fa71f..97dffd1e27 100644 --- a/Marlin/src/pins/pins_MALYAN_M200.h +++ b/Marlin/src/pins/pins_MALYAN_M200.h @@ -88,4 +88,3 @@ // If someone hacks to put a direct power fan on the controller, PB3 could // be used as a separate print cooling fan. #define ORIG_E0_AUTO_FAN_PIN PB8 - diff --git a/Marlin/src/pins/pins_MEGACONTROLLER.h b/Marlin/src/pins/pins_MEGACONTROLLER.h index 709dc413be..71e3d8a01f 100644 --- a/Marlin/src/pins/pins_MEGACONTROLLER.h +++ b/Marlin/src/pins/pins_MEGACONTROLLER.h @@ -25,7 +25,7 @@ */ #ifndef __AVR_ATmega2560__ - #error "Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Arduino/Genuino Mega or Mega 2560' in 'Tools > Board.'" #endif #if HOTENDS > 2 || E_STEPPERS > 2 diff --git a/Marlin/src/pins/pins_MEGATRONICS.h b/Marlin/src/pins/pins_MEGATRONICS.h index 8b608eff88..781529020d 100644 --- a/Marlin/src/pins/pins_MEGATRONICS.h +++ b/Marlin/src/pins/pins_MEGATRONICS.h @@ -25,10 +25,10 @@ */ #ifndef __AVR_ATmega2560__ - #error "Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Arduino/Genuino Mega or Mega 2560' in 'Tools > Board.'" #endif -#define BOARD_NAME "Megatronics" +#define BOARD_NAME "Megatronics" // // Limit Switches // diff --git a/Marlin/src/pins/pins_MEGATRONICS_2.h b/Marlin/src/pins/pins_MEGATRONICS_2.h index 9bd8b4506d..2c98ea3f15 100644 --- a/Marlin/src/pins/pins_MEGATRONICS_2.h +++ b/Marlin/src/pins/pins_MEGATRONICS_2.h @@ -25,7 +25,7 @@ */ #ifndef __AVR_ATmega2560__ - #error "Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Arduino/Genuino Mega or Mega 2560' in 'Tools > Board.'" #endif #define BOARD_NAME "Megatronics v2.0" diff --git a/Marlin/src/pins/pins_MEGATRONICS_3.h b/Marlin/src/pins/pins_MEGATRONICS_3.h index 119c63a585..51c5c6a878 100644 --- a/Marlin/src/pins/pins_MEGATRONICS_3.h +++ b/Marlin/src/pins/pins_MEGATRONICS_3.h @@ -25,7 +25,7 @@ */ #ifndef __AVR_ATmega2560__ - #error "Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Arduino/Genuino Mega or Mega 2560' in 'Tools > Board.'" #endif #if MB(MEGATRONICS_31) diff --git a/Marlin/src/pins/pins_MELZI_CREALITY.h b/Marlin/src/pins/pins_MELZI_CREALITY.h index 8bfd3b860a..3c86dcbbaa 100644 --- a/Marlin/src/pins/pins_MELZI_CREALITY.h +++ b/Marlin/src/pins/pins_MELZI_CREALITY.h @@ -53,6 +53,10 @@ #define LCD_PINS_D4 30 // ST9720 CLK #define FIL_RUNOUT_PIN -1 // Uses Beeper/LED Pin Pulled to GND +#if DISABLED(SPEAKER) && ENABLED(BLTOUCH) + #define SERVO0_PIN 27 +#endif + // Alter timing for graphical display #ifndef ST7920_DELAY_1 #define ST7920_DELAY_1 DELAY_NS(125) diff --git a/Marlin/src/pins/pins_MIGHTYBOARD_REVE.h b/Marlin/src/pins/pins_MIGHTYBOARD_REVE.h index 989533d53e..8fb67c8419 100644 --- a/Marlin/src/pins/pins_MIGHTYBOARD_REVE.h +++ b/Marlin/src/pins/pins_MIGHTYBOARD_REVE.h @@ -53,7 +53,7 @@ */ #if !defined(__AVR_ATmega1280__) && !defined(__AVR_ATmega2560__) - #error "Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Mega 1280' or 'Mega 2560' in 'Tools > Board.'" #endif #define DEFAULT_MACHINE_NAME "MB Replicator" @@ -136,12 +136,14 @@ // #define THERMO_SCK_PIN 78 // E2 #define THERMO_DO_PIN 3 // E5 -#define THERMO_CS1 5 // E3 -#define THERMO_CS2 2 // E4 +#define THERMO_CS1_PIN 5 // E3 +#define THERMO_CS2_PIN 2 // E4 -#define MAX6675_SS THERMO_CS1 +#define MAX6675_SS_PIN THERMO_CS1_PIN +#define MAX6675_SS2_PIN THERMO_CS2_PIN #define MAX6675_SCK_PIN THERMO_SCK_PIN #define MAX6675_DO_PIN THERMO_DO_PIN + // // Augmentation for auto-assigning plugs // diff --git a/Marlin/src/pins/pins_MINIRAMBO.h b/Marlin/src/pins/pins_MINIRAMBO.h index 89335ea8d4..44fc4206ac 100644 --- a/Marlin/src/pins/pins_MINIRAMBO.h +++ b/Marlin/src/pins/pins_MINIRAMBO.h @@ -21,17 +21,17 @@ */ /** - * Mini-Rambo pin assignments + * Mini-RAMBo pin assignments */ #ifndef __AVR_ATmega2560__ - #error "Oops! Make sure you have 'Rambo' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'RAMBo' in 'Tools > Board.'" #endif #if MB(MINIRAMBO_10A) - #define BOARD_NAME "Mini Rambo 1.0a" + #define BOARD_NAME "Mini RAMBo 1.0a" #else - #define BOARD_NAME "Mini Rambo" + #define BOARD_NAME "Mini RAMBo" #endif // diff --git a/Marlin/src/pins/pins_MINITRONICS.h b/Marlin/src/pins/pins_MINITRONICS.h index f5fdac21d2..7ebaf1c4a1 100644 --- a/Marlin/src/pins/pins_MINITRONICS.h +++ b/Marlin/src/pins/pins_MINITRONICS.h @@ -32,14 +32,14 @@ */ #ifndef __AVR_ATmega1281__ - #error "Oops! Make sure you have 'Minitronics' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Minitronics' in 'Tools > Board.'" #endif #if HOTENDS > 2 || E_STEPPERS > 2 #error "Minitronics supports up to 2 hotends / E-steppers. Comment out this line to continue." #endif -#define BOARD_NAME "Minitronics v1.0 / v1.1" +#define BOARD_NAME "Minitronics v1.0/1.1" // // Limit Switches // diff --git a/Marlin/src/pins/pins_MKS_SBASE.h b/Marlin/src/pins/pins_MKS_SBASE.h index 7a58198342..4784a8c2a0 100644 --- a/Marlin/src/pins/pins_MKS_SBASE.h +++ b/Marlin/src/pins/pins_MKS_SBASE.h @@ -26,23 +26,16 @@ */ #ifndef TARGET_LPC1768 - #error "Oops! Make sure you have the LPC1768 environment selected in your IDE." + #error "Oops! Make sure you have the LPC1768 environment selected in your IDE." #endif -#ifndef BOARD_NAME - #define BOARD_NAME "MKS SBASE" - #define DEFAULT_WEBSITE_URL "https://github.com/makerbase-mks/MKS-SBASE" -#endif +#define BOARD_NAME "MKS SBASE" +#define DEFAULT_WEBSITE_URL "https://github.com/makerbase-mks/MKS-SBASE" -// unused -/* -#define PIN_P0_27 P0_27 // EXP2/Onboard SD -#define PIN_P0_28 P0_28 // EXP2 -#define PIN_P0_02 P0_02 // AUX1 (Interrupt Capable/ADC/Serial Port 0) -#define PIN_P0_03 P0_03 // AUX1 (Interrupt Capable/ADC/Serial Port 0) -*/ - -#define LED_PIN P1_18 // LED2 P1_19, LED3 P1_20, LED4 P1_21 +#define LED_PIN P1_18 // Used as a status indicator +#define LED2_PIN P1_19 +#define LED3_PIN P1_20 +#define LED4_PIN P1_21 // // Servo pin @@ -140,9 +133,93 @@ // // Misc. Functions // -#define PS_ON_PIN P0_25 //TH3 Connector -#define LPC_SOFTWARE_SPI // MKS_SBASE needs a software SPI because the - // selected pins are not on a hardware SPI controller +#define PS_ON_PIN P0_25 // TH3 Connector + +// +// Ethernet pins +// +#ifndef ULTIPANEL + #define ENET_MDIO P1_17 // J12-4 + #define ENET_RX_ER P1_14 // J12-6 + #define ENET_RXD1 P1_10 // J12-8 +#endif + +#define ENET_MOC P1_16 // J12-3 +#define REF_CLK P1_15 // J12-5 +#define ENET_RXD0 P1_09 // J12-7 +#define ENET_CRS P1_08 // J12-9 +#define ENET_TX_EN P1_04 // J12-10 +#define ENET_TXD0 P1_00 // J12-11 +#define ENET_TXD1 P1_01 // J12-12 + +/** + * The SBase can share the on-board SD card with a PC via USB the following + * definitions control this feature: + */ +//#define USB_SD_DISABLED +#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device + +/** + * There are a number of configurations available for the SBase SD card reader. + * - A custom cable can be used to allow access to the LCD based SD card. + * - A standard cable can be used for access to the LCD SD card (but no SD detect). + * - The onboard SD card can be used and optionally shared with a PC via USB. + */ + +//#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD +//#define LPC_SD_LCD // Marlin uses the SD drive attached to the LCD +#define LPC_SD_ONBOARD // Marlin uses the SD drive attached to the control board + +#if ENABLED(LPC_SD_CUSTOM_CABLE) + + /** + * A custom cable is needed. See the README file in the + * Marlin\src\config\examples\Mks\Sbase directory + * P0.27 is on EXP2 and the on-board SD card's socket. That means it can't be + * used as the SD_DETECT for the LCD's SD card. + * + * The best solution is to use the custom cable to connect the LCD's SD_DETECT + * to a pin NOT on EXP2. + * + * If you can't find a pin to use for the LCD's SD_DETECT then comment out + * SD_DETECT_PIN entirely and remove that wire from the the custom cable. + */ + #define SD_DETECT_PIN P2_11 // J8-5 (moved from EXP2 P0.27) + #define SCK_PIN P1_22 // J8-2 (moved from EXP2 P0.7) + #define MISO_PIN P1_23 // J8-3 (moved from EXP2 P0.8) + #define MOSI_PIN P2_12 // J8-4 (moved from EXP2 P0.9) + #define SS_PIN P0_28 // Chip select for SD card used by Marlin + #define ONBOARD_SD_CS P0_06 // Chip select for "System" SD card + #define LPC_SOFTWARE_SPI // With a custom cable we need software SPI because the + // selected pins are not on a hardware SPI controller +#elif ENABLED(LPC_SD_LCD) + + // use standard cable and header, SPI and SD detect sre shared with on-board SD card + // hardware SPI is used for both SD cards. The detect pin is shred between the + // LCD and onboard SD readers so we disable it. + #define SCK_PIN P0_07 + #define MISO_PIN P0_08 + #define MOSI_PIN P0_09 + #define SS_PIN P0_28 // 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) + + // The external SD card is not used. Hardware SPI is used to access the card. + #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 + #else + #define SD_DETECT_PIN P0_27 + #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 /** * Smart LCD adapter @@ -166,34 +243,12 @@ #define LCD_SDSS P0_28 // EXP2.4 #define LCD_PINS_ENABLE P0_18 // EXP1.3 #define LCD_PINS_D4 P0_15 // EXP1.5 + #if ENABLED(VIKI2) || ENABLED(miniVIKI) + #define DOGLCD_SCK SCK_PIN + #define DOGLCD_MOSI MOSI_PIN + #endif #endif -// -// Ethernet pins -// -#ifndef ULTIPANEL - #define ENET_MDIO P1_17 // J12-4 - #define ENET_RX_ER P1_14 // J12-6 - #define ENET_RXD1 P1_10 // J12-8 -#endif - -#define ENET_MOC P1_16 // J12-3 -#define REF_CLK P1_15 // J12-5 -#define ENET_RXD0 P1_09 // J12-7 -#define ENET_CRS P1_08 // J12-9 -#define ENET_TX_EN P1_04 // J12-10 -#define ENET_TXD0 P1_00 // J12-11 -#define ENET_TXD1 P1_01 // J12-12 - -// A custom cable is needed. See the README file in the -// Marlin\src\config\examples\Mks\Sbase directory - -#define SCK_PIN P1_22 // J8-2 (moved from EXP2 P0.7) -#define MISO_PIN P1_23 // J8-3 (moved from EXP2 P0.8) -#define MOSI_PIN P2_12 // J8-4 (moved from EXP2 P0.5) -#define SS_PIN P0_28 -#define SDSS P0_06 - /** * Example for trinamic drivers using the J8 connector on MKs Sbase. * 2130s need 1 pin for each driver. 2208s need 2 pins for serial control. @@ -223,6 +278,7 @@ #endif #endif #endif + #if HAS_DRIVER(TMC2208) // The shortage of pins becomes apparent. // Worst case you may have to give up the LCD @@ -237,17 +293,11 @@ #define E0_SERIAL_RX_PIN P0_26 // TH4 #endif -/** - * P0.27 is on EXP2 and the on-board SD card's socket. That means it can't be - * used as the SD_DETECT for the LCD's SD card. - * - * The best solution is to use the custom cable to connect the LCD's SD_DETECT - * to a pin NOT on EXP2. - * - * If you can't find a pin to use for the LCD's SD_DETECT then comment out - * SD_DETECT_PIN entirely and remove that wire from the the custom cable. - */ -#define SD_DETECT_PIN P2_11 // J8-5 (moved from EXP2 P0.27) +// UNUSED +#define PIN_P0_27 P0_27 // EXP2/Onboard SD +#define PIN_P0_28 P0_28 // EXP2 +#define PIN_P0_02 P0_02 // AUX1 (Interrupt Capable/ADC/Serial Port 0) +#define PIN_P0_03 P0_03 // AUX1 (Interrupt Capable/ADC/Serial Port 0) /** * PWMs diff --git a/Marlin/src/pins/pins_MORPHEUS.h b/Marlin/src/pins/pins_MORPHEUS.h index 24ccf47a2d..e60f930d7d 100644 --- a/Marlin/src/pins/pins_MORPHEUS.h +++ b/Marlin/src/pins/pins_MORPHEUS.h @@ -30,7 +30,7 @@ */ #ifndef __STM32F1__ - #error "Oops! Make sure you have an STM32F1 board selected from the 'Tools -> Boards' menu." + #error "Oops! Select an STM32F1 board in 'Tools > Board.'" #endif #define BOARD_NAME "Bluepill based board" diff --git a/Marlin/src/pins/pins_OMCA.h b/Marlin/src/pins/pins_OMCA.h index 6ee6fabe6b..85d8faa224 100644 --- a/Marlin/src/pins/pins_OMCA.h +++ b/Marlin/src/pins/pins_OMCA.h @@ -23,7 +23,7 @@ /** * Open Motion controller with enable based extruders (Final!) * - * ATMega644 + * ATmega644 * * +---\/---+ * (D 0) PB0 1| |40 PA0 (AI 0 / D31) @@ -77,10 +77,10 @@ */ #if !defined(__AVR_ATmega644P__) && !defined(__AVR_ATmega644__) - #error "Oops! Make sure you have 'Sanguino' selected from the 'Tools -> Boards' menu. (Final OMCA board)" + #error "Oops! Select 'Sanguino' in 'Tools > Board' and 'ATmega644' or 'ATmega644P' in 'Tools > Processor.'" #endif -#define BOARD_NAME "Final OMCA" +#define BOARD_NAME "Final OMCA" // // Limit Switches diff --git a/Marlin/src/pins/pins_OMCA_A.h b/Marlin/src/pins/pins_OMCA_A.h index 777c80b22f..19f0e43f92 100644 --- a/Marlin/src/pins/pins_OMCA_A.h +++ b/Marlin/src/pins/pins_OMCA_A.h @@ -23,7 +23,7 @@ /** * Open Motion controller with enable based extruders (Alpha!) * - * ATMega644 + * ATmega644 * * +---\/---+ * (D 0) PB0 1| |40 PA0 (AI 0 / D31) @@ -76,10 +76,10 @@ */ #ifndef __AVR_ATmega644__ - #error "Oops! Make sure you have 'Sanguino' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Sanguino' in 'Tools > Board' and ATmega644 in 'Tools > Processor.'" #endif -#define BOARD_NAME "Alpha OMCA" +#define BOARD_NAME "Alpha OMCA" // // Limit Switches diff --git a/Marlin/src/pins/pins_PRINTRBOARD.h b/Marlin/src/pins/pins_PRINTRBOARD.h index 42632d174a..a6193d6466 100644 --- a/Marlin/src/pins/pins_PRINTRBOARD.h +++ b/Marlin/src/pins/pins_PRINTRBOARD.h @@ -31,7 +31,7 @@ * and with the mainstream Marlin software. * * Teensyduino - http://www.pjrc.com/teensy/teensyduino.html - * Select Teensy++ 2.0 in Arduino IDE from the 'Tools -> Boards' menu + * Select Teensy++ 2.0 in Arduino IDE from the 'Tools > Board' menu * * Installation instructions are at the above URL. Don't bother loading the * libraries - they are not used with the Marlin software. @@ -46,7 +46,7 @@ * hardware directory in Arduino. The Arduino hardware directory will probably * be located in a path similar to this: C:\Program Files (x86)\Arduino\hardware. * 3. Restart Arduino. - * 4. Select "Printrboard" from the 'Tools -> Boards' menu. + * 4. Select "Printrboard" from the 'Tools > Board' menu. * * Teensyduino is the most popular option. Printrboard is used if your board doesn't have * the Teensyduino bootloader on it. @@ -62,10 +62,10 @@ */ #ifndef __AVR_AT90USB1286__ - #error "Oops! Make sure you have 'Teensy++ 2.0' or 'Printrboard' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Teensy++ 2.0' or 'Printrboard' in 'Tools > Board.'" #endif -#define BOARD_NAME "Printrboard" +#define BOARD_NAME "Printrboard" // Disable JTAG pins so they can be used for the Extrudrboard #define DISABLE_JTAG diff --git a/Marlin/src/pins/pins_PRINTRBOARD_REVF.h b/Marlin/src/pins/pins_PRINTRBOARD_REVF.h index 8239a91586..e7249702cc 100644 --- a/Marlin/src/pins/pins_PRINTRBOARD_REVF.h +++ b/Marlin/src/pins/pins_PRINTRBOARD_REVF.h @@ -33,7 +33,7 @@ * Teensyduino - https://www.pjrc.com/teensy/teensyduino.html * Installation - https://www.pjrc.com/teensy/td_download.html * - * Select Teensy++ 2.0 in Arduino IDE from the 'Tools -> Boards' menu + * Select Teensy++ 2.0 in Arduino IDE from the 'Tools > Board' menu * * Note: With Teensyduino extension, the Arduino IDE will report 130048 bytes of program storage space available, * but there is actually only 122880 bytes due to the larger DFU bootloader shipped by default on all Printrboard RevF. @@ -48,7 +48,7 @@ * hardware directory in Arduino. The Arduino hardware directory will probably * be located in a path similar to this: C:\Program Files (x86)\Arduino\hardware. * 3. Restart Arduino. - * 4. Select "Printrboard" from the 'Tools -> Boards' menu. + * 4. Select "Printrboard" from the 'Tools > Board' menu. * * Teensyduino is the most popular and easiest option. */ @@ -63,14 +63,15 @@ */ #ifndef __AVR_AT90USB1286__ - #error "Oops! Make sure you have 'Teensy++ 2.0' or 'Printrboard' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Teensy++ 2.0' or 'Printrboard' in 'Tools > Board.'" #endif #ifndef USBCON #error "USBCON should be defined by the platform for this board." #endif -#define BOARD_NAME "Printrboard Rev.F" +#define BOARD_NAME "Printrboard Rev.F" + // Disable JTAG pins so EXP1 pins work correctly // (Its pins are used for the Extrudrboard and filament sensor, for example). #define DISABLE_JTAG diff --git a/Marlin/src/pins/pins_RADDS.h b/Marlin/src/pins/pins_RADDS.h index be16898103..68f001aaed 100644 --- a/Marlin/src/pins/pins_RADDS.h +++ b/Marlin/src/pins/pins_RADDS.h @@ -25,10 +25,10 @@ */ #ifndef __SAM3X8E__ - #error "Oops! Make sure you have 'Arduino Due' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Arduino Due' in 'Tools > Board.'" #endif -#define BOARD_NAME "RADDS" +#define BOARD_NAME "RADDS" // // Servos @@ -131,7 +131,6 @@ #define RADDS_EXT_MSI_PIN 69 - #define MAX_EXTRUDERS 6 #define BOARD_INIT() OUT_WRITE(RADDS_EXT_VDD_PIN, HIGH) #else @@ -173,9 +172,9 @@ // SPI for Max6675 or Max31855 Thermocouple #if DISABLED(SDSUPPORT) - #define MAX6675_SS 53 + #define MAX6675_SS_PIN 53 #else - #define MAX6675_SS 49 + #define MAX6675_SS_PIN 49 #endif // @@ -194,7 +193,6 @@ // // Misc. Functions // -#define SDSS 4 #define SD_DETECT_PIN 14 #define PS_ON_PIN 40 // SERVO3_PIN @@ -228,7 +226,6 @@ #define BTN_BACK 71 - #undef SDSS #define SDSS 10 #define SD_DETECT_PIN 14 @@ -247,6 +244,9 @@ #define BTN_EN2 52 #define BTN_ENC 48 + #define SDSS 10 + #define SD_DETECT_PIN 14 + #elif ENABLED(SSD1306_OLED_I2C_CONTROLLER) #define BTN_EN1 50 @@ -269,3 +269,7 @@ #endif // SPARK_FULL_GRAPHICS #endif // ULTRA_LCD + +#ifndef SDSS + #define SDSS 4 +#endif diff --git a/Marlin/src/pins/pins_RAMBO.h b/Marlin/src/pins/pins_RAMBO.h index f2ea3d33bd..7934d49810 100644 --- a/Marlin/src/pins/pins_RAMBO.h +++ b/Marlin/src/pins/pins_RAMBO.h @@ -41,7 +41,7 @@ */ #ifndef __AVR_ATmega2560__ - #error "Oops! Make sure you have 'Arduino Mega 2560' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Arduino/Genuino Mega or Mega 2560' in 'Tools > Board.'" #endif #define BOARD_NAME "Rambo" diff --git a/Marlin/src/pins/pins_RAMPS.h b/Marlin/src/pins/pins_RAMPS.h index b8c6233da7..6b9bd11148 100644 --- a/Marlin/src/pins/pins_RAMPS.h +++ b/Marlin/src/pins/pins_RAMPS.h @@ -45,14 +45,14 @@ */ #if ENABLED(TARGET_LPC1768) - #error "Oops! Set MOTHERBOARD to an LPC1768-based board when building for LPC1768." + #error "Oops! Set MOTHERBOARD to an LPC1768-based board when building for LPC1768." #elif defined(__STM32F1__) - #error "Oops! Set MOTHERBOARD to an STM32F1-based board when building for STM32F1." + #error "Oops! Set MOTHERBOARD to an STM32F1-based board when building for STM32F1." #endif #if DISABLED(IS_RAMPS_SMART) && DISABLED(IS_RAMPS_DUO) && DISABLED(IS_RAMPS4DUE) && DISABLED(TARGET_LPC1768) #if !defined(__AVR_ATmega1280__) && !defined(__AVR_ATmega2560__) - #error "Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Arduino/Genuino Mega or Mega 2560' in 'Tools > Board.'" #endif #endif @@ -205,9 +205,9 @@ // SPI for Max6675 or Max31855 Thermocouple #if DISABLED(SDSUPPORT) - #define MAX6675_SS 66 // Do not use pin 53 if there is even the remote possibility of using Display/SD card + #define MAX6675_SS_PIN 66 // Do not use pin 53 if there is even the remote possibility of using Display/SD card #else - #define MAX6675_SS 66 // Do not use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present + #define MAX6675_SS_PIN 66 // Do not use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present #endif // diff --git a/Marlin/src/pins/pins_RAMPS4DUE.h b/Marlin/src/pins/pins_RAMPS4DUE.h index 5f4cbc4810..dc56d814dc 100644 --- a/Marlin/src/pins/pins_RAMPS4DUE.h +++ b/Marlin/src/pins/pins_RAMPS4DUE.h @@ -39,12 +39,10 @@ */ #if !defined(__SAM3X8E__) && !defined(__AVR_ATmega2560__) - #error "Oops! Make sure you have 'Arduino Due' or 'Arduino Mega' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Arduino Due' or 'Arduino/Genuino Mega or Mega 2560' in 'Tools > Board.'" #endif -#ifndef BOARD_NAME - #define BOARD_NAME "RAMPS4DUE" -#endif +#define BOARD_NAME "RAMPS4DUE" #define IS_RAMPS4DUE #include "pins_RAMPS.h" diff --git a/Marlin/src/pins/pins_RAMPS_CREALITY.h b/Marlin/src/pins/pins_RAMPS_CREALITY.h new file mode 100644 index 0000000000..1365c29f54 --- /dev/null +++ b/Marlin/src/pins/pins_RAMPS_CREALITY.h @@ -0,0 +1,43 @@ +/** + * 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 . + * + */ + +#if HOTENDS > 2 || E_STEPPERS > 2 + #error "Creality3D RAMPS supports only 2 hotends / E-steppers. Comment out this line to continue." +#endif + +#define BOARD_NAME "Creality3D RAMPS" + +// +// Heaters / Fans +// + +// Power outputs EFBF or EFBE +#define MOSFET_D_PIN 7 + +#define FIL_RUNOUT_PIN 2 + +#include "pins_RAMPS.h" + +#define EXP1_PIN 65 // A11 +#define EXP2_PIN 66 // A12 +#define EXP3_PIN 11 // SERVO0_PIN +#define EXP4_PIN 12 // PS_ON_PIN diff --git a/Marlin/src/pins/pins_RAMPS_DUO.h b/Marlin/src/pins/pins_RAMPS_DUO.h index f0c0e74da2..efbd647edd 100644 --- a/Marlin/src/pins/pins_RAMPS_DUO.h +++ b/Marlin/src/pins/pins_RAMPS_DUO.h @@ -43,12 +43,10 @@ */ #if !defined(__SAM3X8E__) && !defined(__AVR_ATmega2560__) - #error "Oops! Make sure you have 'Arduino Due' or 'Arduino Mega' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Arduino Due' or 'Arduino/Genuino Mega or Mega 2560' in 'Tools > Board.'" #endif -#ifndef BOARD_NAME - #define BOARD_NAME "RAMPS Duo" -#endif +#define BOARD_NAME "RAMPS Duo" #define IS_RAMPS_DUO #include "pins_RAMPS.h" @@ -66,11 +64,11 @@ #define TEMP_BED_PIN 10 // Analog Input // SPI for Max6675 or Max31855 Thermocouple -#undef MAX6675_SS +#undef MAX6675_SS_PIN #if DISABLED(SDSUPPORT) - #define MAX6675_SS 69 // Do not use pin 53 if there is even the remote possibility of using Display/SD card + #define MAX6675_SS_PIN 69 // Do not use pin 53 if there is even the remote possibility of using Display/SD card #else - #define MAX6675_SS 69 // Do not use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present + #define MAX6675_SS_PIN 69 // Do not use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present #endif // diff --git a/Marlin/src/pins/pins_RAMPS_ENDER_4.h b/Marlin/src/pins/pins_RAMPS_ENDER_4.h index a14ace25ba..96e5dab2bc 100644 --- a/Marlin/src/pins/pins_RAMPS_ENDER_4.h +++ b/Marlin/src/pins/pins_RAMPS_ENDER_4.h @@ -27,3 +27,9 @@ #define BOARD_NAME "Ender-4" #include "pins_RAMPS.h" + +// The board only has one controllable fan connector, the others are just plain 12V connectors +// in the default configuration, this is used to control the brightness of the LED band +// hotend and controller fan are therefore always-on +#define ENDER4_FAN_PIN RAMPS_D9_PIN +#undef FAN_PIN diff --git a/Marlin/src/pins/pins_RAMPS_FD_V1.h b/Marlin/src/pins/pins_RAMPS_FD_V1.h index 3b8294ef86..88df3fdae7 100644 --- a/Marlin/src/pins/pins_RAMPS_FD_V1.h +++ b/Marlin/src/pins/pins_RAMPS_FD_V1.h @@ -28,11 +28,11 @@ */ #ifndef __SAM3X8E__ - #error "Oops! Make sure you have 'Arduino Due' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Arduino Due' in 'Tools > Board.'" #endif #ifndef BOARD_NAME - #define BOARD_NAME "RAMPS-FD" + #define BOARD_NAME "RAMPS-FD v1" #endif #define INVERTED_HEATER_PINS @@ -112,9 +112,9 @@ // SPI for Max6675 or Max31855 Thermocouple #if DISABLED(SDSUPPORT) - #define MAX6675_SS 53 + #define MAX6675_SS_PIN 53 #else - #define MAX6675_SS 49 + #define MAX6675_SS_PIN 49 #endif // diff --git a/Marlin/src/pins/pins_RAMPS_FD_V2.h b/Marlin/src/pins/pins_RAMPS_FD_V2.h index dec5cf4d53..d4d7012557 100644 --- a/Marlin/src/pins/pins_RAMPS_FD_V2.h +++ b/Marlin/src/pins/pins_RAMPS_FD_V2.h @@ -27,7 +27,7 @@ * Use 1k thermistor tables */ -#define BOARD_NAME "RAMPS-FD v2" +#define BOARD_NAME "RAMPS-FD v2" #ifndef E0_CS_PIN #define E0_CS_PIN 69 // moved from A13 to A15 on v2.2, if not earlier diff --git a/Marlin/src/pins/pins_RAMPS_OLD.h b/Marlin/src/pins/pins_RAMPS_OLD.h index da047e2b0a..3181d0f752 100644 --- a/Marlin/src/pins/pins_RAMPS_OLD.h +++ b/Marlin/src/pins/pins_RAMPS_OLD.h @@ -25,10 +25,10 @@ */ #if !defined(__AVR_ATmega1280__) && !defined(__AVR_ATmega2560__) - #error "Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Arduino/Genuino Mega or Mega 2560' in 'Tools > Board.'" #endif -#define BOARD_NAME "MEGA/RAMPS <1.2" +#define BOARD_NAME "RAMPS <1.2" // Uncomment the following line for RAMPS v1.0 //#define RAMPS_V_1_0 @@ -77,9 +77,9 @@ // SPI for Max6675 or Max31855 Thermocouple #if DISABLED(SDSUPPORT) - #define MAX6675_SS 66 // Do not use pin 53 if there is even the remote possibility of using Display/SD card + #define MAX6675_SS_PIN 66 // Do not use pin 53 if there is even the remote possibility of using Display/SD card #else - #define MAX6675_SS 66 // Do not use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present + #define MAX6675_SS_PIN 66 // Do not use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present #endif // diff --git a/Marlin/src/pins/pins_RAMPS_PLUS.h b/Marlin/src/pins/pins_RAMPS_PLUS.h index 77e0e140c0..3a945353cc 100644 --- a/Marlin/src/pins/pins_RAMPS_PLUS.h +++ b/Marlin/src/pins/pins_RAMPS_PLUS.h @@ -38,12 +38,10 @@ */ #if !defined(__AVR_ATmega1280__) && !defined(__AVR_ATmega2560__) - #error "Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Arduino/Genuino Mega or Mega 2560' in 'Tools > Board.'" #endif -#ifndef BOARD_NAME - #define BOARD_NAME "RAMPS 1.4 Plus" -#endif +#define BOARD_NAME "RAMPS 1.4 Plus" #define RAMPS_D8_PIN 10 #define RAMPS_D10_PIN 8 diff --git a/Marlin/src/pins/pins_RAMPS_RE_ARM.h b/Marlin/src/pins/pins_RAMPS_RE_ARM.h index 6f0c604ffb..29f31fc630 100644 --- a/Marlin/src/pins/pins_RAMPS_RE_ARM.h +++ b/Marlin/src/pins/pins_RAMPS_RE_ARM.h @@ -34,15 +34,13 @@ * */ -// numbers in parenthesis () are the mega2560 equivalent pin numbers +// Numbers in parentheses () are the corresponding mega2560 pin numbers #ifndef TARGET_LPC1768 - #error "Oops! Make sure you have the LPC1768 environment selected in your IDE." + #error "Oops! Make sure you have the LPC1768 environment selected in your IDE." #endif -#ifndef BOARD_NAME - #define BOARD_NAME "Re-ARM RAMPS 1.4" -#endif +#define BOARD_NAME "Re-ARM RAMPS 1.4" // // Servos @@ -100,13 +98,6 @@ #define E1_CS_PIN -1 #endif -//#define E2_STEP_PIN P2_08 // (36) -//#define E2_DIR_PIN P2_13 // (34) -//#define E2_ENABLE_PIN P4_29 // (30) -//#ifndef E2_CS_PIN -// #define E2_CS_PIN -1 -//#endif - // // Software SPI pins for TMC2130 stepper drivers // @@ -120,14 +111,14 @@ // Temperature Sensors // 3.3V max when defined as an analog input // -#define TEMP_0_PIN 0 // A0 (T0) - (67) - TEMP_0_PIN -#define TEMP_BED_PIN 1 // A1 (T1) - (68) - TEMP_BED_PIN -#define TEMP_1_PIN 2 // A2 (T2) - (69) - TEMP_1_PIN -#define TEMP_2_PIN 3 // A3 - (63) - J5-3 & AUX-2 -#define TEMP_3_PIN 4 // A4 - (37) - BUZZER_PIN -//#define TEMP_4_PIN 5 // A5 - (49) - SD_DETECT_PIN -//#define ?? 6 // A6 - ( 0) - RXD0 - J4-4 & AUX-1 -#define FILWIDTH_PIN 7 // A7 - ( 1) - TXD0 - J4-5 & AUX-1 +#define TEMP_0_PIN 0 // A0 (T0) - (67) - TEMP_0_PIN +#define TEMP_BED_PIN 1 // A1 (T1) - (68) - TEMP_BED_PIN +#define TEMP_1_PIN 2 // A2 (T2) - (69) - TEMP_1_PIN +#define TEMP_2_PIN 3 // A3 - (63) - J5-3 & AUX-2 +#define TEMP_3_PIN 4 // A4 - (37) - BUZZER_PIN +//#define TEMP_4_PIN 5 // A5 - (49) - SD_DETECT_PIN +//#define ?? 6 // A6 - ( 0) - RXD0 - J4-4 & AUX-1 +#define FILWIDTH_PIN 7 // A7 - ( 1) - TXD0 - J4-5 & AUX-1 // // Augmentation for auto-assigning RAMPS plugs @@ -197,56 +188,57 @@ // // Misc. Functions // -#define LED_PIN P4_28 // (13) -#define SDSS P1_23 // (53) +#define LED_PIN P4_28 // (13) // define digital pin 4 for the filament runout sensor. Use the RAMPS 1.4 digital input 4 on the servos connector #ifndef FIL_RUNOUT_PIN - #define FIL_RUNOUT_PIN P1_18 // (4) + #define FIL_RUNOUT_PIN P1_18 // (4) #endif -#define PS_ON_PIN P2_12 // (12) +#define PS_ON_PIN P2_12 // (12) #if ENABLED(CASE_LIGHT_ENABLE) && !PIN_EXISTS(CASE_LIGHT) && !defined(SPINDLE_LASER_ENABLE_PIN) - #if !defined(NUM_SERVOS) || NUM_SERVOS < 4 // try to use servo connector - #define CASE_LIGHT_PIN P1_18 // (4) MUST BE HARDWARE PWM + #if !defined(NUM_SERVOS) || NUM_SERVOS < 4 // Try to use servo connector + #define CASE_LIGHT_PIN P1_18 // (4) MUST BE HARDWARE PWM #endif #endif // // M3/M4/M5 - Spindle/Laser Control +// Use servo pins, if available // #if ENABLED(SPINDLE_LASER_ENABLE) && !PIN_EXISTS(SPINDLE_LASER_ENABLE) - #if !defined(NUM_SERVOS) || NUM_SERVOS == 1 // must use servo connector - #undef SERVO1 - #undef SERVO2 - #undef SERVO3 - #define SPINDLE_LASER_ENABLE_PIN P1_21 // (6) Pin should have a pullup/pulldown! - #define SPINDLE_LASER_PWM_PIN P1_18 // (4) MUST BE HARDWARE PWM - #define SPINDLE_DIR_PIN P1_19 // (5) + #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_PWM_PIN SERVO3_PIN // (4) MUST BE HARDWARE PWM + #define SPINDLE_DIR_PIN SERVO2_PIN // (5) #endif // // Průša i3 MK2 Multiplexer Support // #if SERIAL_PORT != 0 && SERIAL_PORT_2 != 0 - #define E_MUX0_PIN P0_03 // ( 0) Z_CS_PIN - #define E_MUX1_PIN P0_02 // ( 1) E0_CS_PIN + #define E_MUX0_PIN P0_03 // ( 0) Z_CS_PIN + #define E_MUX1_PIN P0_02 // ( 1) E0_CS_PIN #endif #define E_MUX2_PIN P0_26 // (63) E1_CS_PIN /** * LCD / Controller * - * All controllers can use J3 and J5 on the Re-ARM board. Custom cabling will be required. + * All controllers can use J3 and J5 on the Re-ARM board. Custom cabling will be required. + * + * - https://github.com/wolfmanjm/universal-panel-adapter + * - http://panucattdevices.freshdesk.com/support/solutions/articles/1000243195-lcd-display-installation */ /** * Smart LCD adapter * * The Smart LCD adapter can be used for the two 10 pin LCD controllers such as - * REPRAP_DISCOUNT_SMART_CONTROLLER. It can't be used for controllers that use + * REPRAP_DISCOUNT_SMART_CONTROLLER. It can't be used for controllers that use * DOGLCD_A0, DOGLCD_CS, LCD_PINS_D5, LCD_PINS_D6 or LCD_PINS_D7. A custom cable * is needed to pick up 5V for the EXP1 connection. * @@ -255,95 +247,91 @@ * that the garbage/lines are erased immediately after the SD card accesses are completed. */ -#if ENABLED(ULTRA_LCD) +#if ENABLED(CR10_STOCKDISPLAY) - #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 - // 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 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 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) - #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) +#elif ENABLED(ULTRA_LCD) + #define BEEPER_PIN P1_30 // (37) not 5V tolerant + + #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) J3-1 & AUX-3 (NOT 5V tolerant) + #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 + + #if ENABLED(NEWPANEL) + #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) J3-1 & AUX-3 (NOT 5V tolerant) + #endif #else + //#define SHIFT_CLK P3_26 // (31) J3-2 & AUX-4 + //#define SHIFT_LD P3_25 // (33) J3-4 & AUX-4 + //#define SHIFT_OUT P2_11 // (35) J3-3 & AUX-4 + //#define SHIFT_EN P1_22 // (41) J5-4 & AUX-4 + #endif - #define BEEPER_PIN P1_30 // (37) not 5V tolerant + #if ENABLED(VIKI2) || ENABLED(miniVIKI) + // #define LCD_SCREEN_ROT_180 - #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 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 SD_DETECT_PIN P1_31 // (49) J3-1 & AUX-3 (NOT 5V tolerant) + #define KILL_PIN P1_22 // (41) J5-4 & AUX-4 - #if ENABLED(NEWPANEL) - #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 - #endif - #else - //#define SHIFT_CLK P3_26 // (31) J3-2 & AUX-4 - //#define SHIFT_LD P3_25 // (33) J3-4 & AUX-4 - //#define SHIFT_OUT P2_11 // (35) J3-3 & AUX-4 - //#define SHIFT_EN P1_22 // (41) J5-4 & AUX-4 + #define DOGLCD_CS P0_16 // (16) + #define DOGLCD_A0 P2_06 // (59) J3-8 & 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 + #define DOGLCD_CS P0_26 // (63) J5-3 & AUX-2 + #define DOGLCD_A0 P2_06 // (59) J3-8 & AUX-2 + #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 + #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 + #endif - #if ENABLED(VIKI2) || ENABLED(miniVIKI) - // #define LCD_SCREEN_ROT_180 - - #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 DOGLCD_CS P0_16 // (16) - #define DOGLCD_A0 P2_06 // (59) J3-8 & 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 - #define DOGLCD_CS P0_26 // (63) J5-3 & AUX-2 - #define DOGLCD_A0 P2_06 // (59) J3-8 & AUX-2 - #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 - #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 - #endif - - //#define MISO_PIN P0_17 // (50) system defined J3-10 & AUX-3 - //#define MOSI_PIN P0_18 // (51) system defined J3-10 & AUX-3 - //#define SCK_PIN P0_15 // (52) system defined J3-9 & AUX-3 - //#define SS_PIN P1_23 // (53) system defined J3-5 & AUX-3 - sometimes called SDSS - - #if ENABLED(MINIPANEL) - // GLCD features - //#define LCD_CONTRAST 190 - // Uncomment screen orientation - //#define LCD_SCREEN_ROT_90 - //#define LCD_SCREEN_ROT_180 - //#define LCD_SCREEN_ROT_270 - #endif + //#define MISO_PIN P0_17 // (50) system defined J3-10 & AUX-3 + //#define MOSI_PIN P0_18 // (51) system defined J3-10 & AUX-3 + //#define SCK_PIN P0_15 // (52) system defined J3-9 & AUX-3 + //#define SS_PIN P1_23 // (53) system defined J3-5 & AUX-3 (Sometimes called SDSS) + #if ENABLED(MINIPANEL) + // GLCD features + //#define LCD_CONTRAST 190 + // Uncomment screen orientation + //#define LCD_SCREEN_ROT_90 + //#define LCD_SCREEN_ROT_180 + //#define LCD_SCREEN_ROT_270 #endif #endif // ULTRA_LCD @@ -352,70 +340,85 @@ // Ethernet pins // #if DISABLED(ULTIPANEL) - #define ENET_MDIO P1_17 // (71) J12-4 - #define ENET_RX_ER P1_14 // (73) J12-6 - #define ENET_RXD1 P1_10 // (75) J12-8 + #define ENET_MDIO P1_17 // (71) J12-4 + #define ENET_RX_ER P1_14 // (73) J12-6 + #define ENET_RXD1 P1_10 // (75) J12-8 +#endif +#define ENET_MOC P1_16 // (70) J12-3 +#define REF_CLK P1_15 // (72) J12-5 +#define ENET_RXD0 P1_09 // (74) J12-7 +#define ENET_CRS P1_08 // (76) J12-9 +#define ENET_TX_EN P1_04 // (77) J12-10 +#define ENET_TXD0 P1_00 // (78) J12-11 +#define ENET_TXD1 P1_01 // (79) J12-12 + +//#define USB_SD_DISABLED +#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device + +//#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 + +#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 -#define ENET_MOC P1_16 // (70) J12-3 -#define REF_CLK P1_15 // (72) J12-5 -#define ENET_RXD0 P1_09 // (74) J12-7 -#define ENET_CRS P1_08 // (76) J12-9 -#define ENET_TX_EN P1_04 // (77) J12-10 -#define ENET_TXD0 P1_00 // (78) J12-11 -#define ENET_TXD1 P1_01 // (79) J12-12 /** - * Fast PWMS + * Fast PWMs * - * The LPC1768's hardware PWM controller has 6 channels. Each channel + * The LPC1768's hardware PWM controller has 6 channels. Each channel * can be setup to either control a dedicated pin directly or to generate - * an interrupt. The direct method's duty cycle is accurate to within a - * a microsecond. The interrupt method's average duty cycle has the + * an interrupt. The direct method's duty cycle is accurate to within a + * a microsecond. The interrupt method's average duty cycle has the * the same accuracy but the individual cycles can vary because of higher * priority interrupts. * * All Fast PWMs have a 50Hz rate. * - * The following pins/signals use the direct method. All other pins use the + * The following pins/signals use the direct method. All other pins use the * the interrupt method. Note that SERVO2_PIN and RAMPS_D8_PIN use the * interrupt method. + * * P1_20 (11) SERVO0_PIN * P1_21 ( 6) SERVO1_PIN J5-1 * P0_18 ( 4) SERVO3_PIN 5V output * *P2_04 ( 9) RAMPS_D9_PIN * *P2_05 (10) RAMPS_D10_PIN * - * * - If used as a heater driver then a Fast PWM is NOT assigned. If used as + * * - If used as a heater driver then a Fast PWM is NOT assigned. If used as * a fan driver then enabling FAST_PWM_FAN assigns a Fast PWM to it. */ /** - * special pins - * P1_30 (37) - not 5V tolerant - * P1_31 (49) - not 5V tolerant - * P0_27 (57) - open collector - * P0_28 (58) - open collector - * - */ + * Special pins + * P1_30 (37) (NOT 5V tolerant) + * P1_31 (49) (NOT 5V tolerant) + * P0_27 (57) (Open collector) + * P0_28 (58) (Open collector) + */ /** - * The following mega2560 pins are NOT available in a Re-ARM system - * 7 - * 17 - * 22 - * 23 - * 25 - * 27 - * 29 - * 32 - * 39 - * 40 - * 42 - * 43 - * 44 - * 45 - * 47 - * 64 - * 65 - * 66 + * The following mega2560 pins are NOT available in a Re-ARM system: + * + * 7, 17, 22, 23, 25, 27, 29, 32, 39, 40, 42, 43, 44, 45, 47, 64, 65, 66 */ diff --git a/Marlin/src/pins/pins_RAMPS_SMART.h b/Marlin/src/pins/pins_RAMPS_SMART.h index 6de539cd3f..851117cad5 100644 --- a/Marlin/src/pins/pins_RAMPS_SMART.h +++ b/Marlin/src/pins/pins_RAMPS_SMART.h @@ -60,12 +60,10 @@ */ #ifndef __SAM3X8E__ - #error "Oops! Make sure you have 'Arduino Due' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Arduino Due' in 'Tools > Board.'" #endif -#ifndef BOARD_NAME - #define BOARD_NAME "RAMPS-SMART" -#endif +#define BOARD_NAME "RAMPS-SMART" #define IS_RAMPS_SMART #include "pins_RAMPS.h" @@ -89,12 +87,11 @@ #define TEMP_BED_PIN 11 // Analog Input // SPI for Max6675 or Max31855 Thermocouple +#undef MAX6675_SS_PIN #if DISABLED(SDSUPPORT) - #undef MAX6675_SS - #define MAX6675_SS 67 // Do not use pin 53 if there is even the remote possibility of using Display/SD card + #define MAX6675_SS_PIN 67 // Do not use pin 53 if there is even the remote possibility of using Display/SD card #else - #undef MAX6675_SS - #define MAX6675_SS 67 // Do not use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present + #define MAX6675_SS_PIN 67 // Do not use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present #endif // diff --git a/Marlin/src/pins/pins_REMRAM_V1.h b/Marlin/src/pins/pins_REMRAM_V1.h new file mode 100644 index 0000000000..78c796a7bd --- /dev/null +++ b/Marlin/src/pins/pins_REMRAM_V1.h @@ -0,0 +1,132 @@ +/** + * 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 . + * + */ + +#ifndef STM32F7xx + #error "Oops! Select an STM32F7 board in 'Tools > Board.'" +#endif + +#define DEFAULT_MACHINE_NAME "RemRam" +#define BOARD_NAME "RemRam v1" + +#define EEPROM_EMULATED_WITH_SRAM // Emulate the EEPROM using Backup SRAM + +#if HOTENDS > 1 || E_STEPPERS > 1 + #error "RemRam supports only one hotend / E-stepper." +#endif + +// +// Limit Switches +// +#if DISABLED(SENSORLESS_HOMING) + #define X_MIN_PIN 58 + #define X_MAX_PIN 59 + #define Y_MIN_PIN 60 + #define Y_MAX_PIN 61 + #define Z_MIN_PIN 62 + #define Z_MAX_PIN 63 +#else + #define X_STOP_PIN 36 + #define Y_STOP_PIN 39 + #define Z_MIN_PIN 62 + #define Z_MAX_PIN 42 +#endif + +// +// Z Probe (when not Z_MIN_PIN) +// +#ifndef Z_MIN_PROBE_PIN + #define Z_MIN_PROBE_PIN 26 // EXT_D1 +#endif + +// +// Steppers +// +#define X_STEP_PIN 22 +#define X_DIR_PIN 35 +#define X_ENABLE_PIN 34 +#define X_CS_PIN 14 + +#define Y_STEP_PIN 23 +#define Y_DIR_PIN 38 +#define Y_ENABLE_PIN 37 +#define Y_CS_PIN 15 + +#define Z_STEP_PIN 24 +#define Z_DIR_PIN 41 +#define Z_ENABLE_PIN 40 +#define Z_CS_PIN 16 + +#define E0_STEP_PIN 25 +#define E0_DIR_PIN 44 +#define E0_ENABLE_PIN 43 +#define E0_CS_PIN 10 + +// +// Temperature Sensors +// +#define TEMP_0_PIN 64 // THERM_1 +#define TEMP_1_PIN 65 // THERM_2 +#define TEMP_BED_PIN 66 // THERM_3 + +// +// Heaters / Fans +// +#define HEATER_0_PIN 33 +#define HEATER_BED_PIN 31 + +#ifndef FAN_PIN + #define FAN_PIN 30 // "FAN1" +#endif +#define FAN1_PIN 32 // "FAN2" + +#define ORIG_E0_AUTO_FAN_PIN 32 // Use this by NOT overriding E0_AUTO_FAN_PIN + +// +// Servos +// +#define SERVO0_PIN 26 // PWM_EXT1 +#define SERVO1_PIN 27 // PWM_EXT2 + +#define SDSS 57 // Onboard SD card reader +//#define SDSS 9 // LCD SD card reader +#define LED_PIN 21 // STATUS_LED + +// +// LCD / Controller +// +#define SD_DETECT_PIN 56 // SD_CARD_DET +#define BEEPER_PIN 46 // LCD_BEEPER +#define LCD_PINS_RS 49 // LCD_RS +#define LCD_PINS_ENABLE 48 // LCD_EN +#define LCD_PINS_D4 50 // LCD_D4 +#define LCD_PINS_D5 51 // LCD_D5 +#define LCD_PINS_D6 52 // LCD_D6 +#define LCD_PINS_D7 53 // LCD_D7 +#define BTN_EN1 54 // BTN_EN1 +#define BTN_EN2 55 // BTN_EN2 +#define BTN_ENC 47 // BTN_ENC + +// +// Timers +// + +#define STEP_TIMER 2 diff --git a/Marlin/src/pins/pins_RIGIDBOARD.h b/Marlin/src/pins/pins_RIGIDBOARD.h index f783d83c61..4247ace87c 100644 --- a/Marlin/src/pins/pins_RIGIDBOARD.h +++ b/Marlin/src/pins/pins_RIGIDBOARD.h @@ -73,11 +73,11 @@ #define TEMP_BED_PIN 15 // Analog Input // SPI for Max6675 or Max31855 Thermocouple -#undef MAX6675_SS +#undef MAX6675_SS_PIN #if DISABLED(SDSUPPORT) - #define MAX6675_SS 53 // Don't use pin 53 if there is even the remote possibility of using Display/SD card + #define MAX6675_SS_PIN 53 // Don't use pin 53 if there is even the remote possibility of using Display/SD card #else - #define MAX6675_SS 49 // Don't use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present + #define MAX6675_SS_PIN 49 // Don't use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present #endif // diff --git a/Marlin/src/pins/pins_RUMBA.h b/Marlin/src/pins/pins_RUMBA.h index 160dae55b8..b2869f1205 100644 --- a/Marlin/src/pins/pins_RUMBA.h +++ b/Marlin/src/pins/pins_RUMBA.h @@ -25,7 +25,7 @@ */ #ifndef __AVR_ATmega2560__ - #error "Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Arduino/Genuino Mega or Mega 2560' in 'Tools > Board.'" #endif #if HOTENDS > 3 || E_STEPPERS > 3 diff --git a/Marlin/src/pins/pins_RURAMPS4D_11.h b/Marlin/src/pins/pins_RURAMPS4D_11.h index d05b74b04c..0785085cc5 100644 --- a/Marlin/src/pins/pins_RURAMPS4D_11.h +++ b/Marlin/src/pins/pins_RURAMPS4D_11.h @@ -33,12 +33,10 @@ */ #ifndef __SAM3X8E__ - #error "Oops! Make sure you have 'Arduino Due' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Arduino Due' in 'Tools > Board.'" #endif -#ifndef BOARD_NAME - #define BOARD_NAME "RuRAMPS4Due v1.1" -#endif +#define BOARD_NAME "RuRAMPS4Due v1.1" // // Servos @@ -119,9 +117,6 @@ //#define E3_MS1_PIN ? //#define E3_MS2_PIN ? //#define E3_MS3_PIN ? -//#define Z2_MS1_PIN ? // shared with E3_MS1_PIN -//#define Z2_MS2_PIN ? // shared with E3_MS2_PIN -//#define Z2_MS3_PIN ? // shared with E3_MS3_PIN #if DISABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) #define Z_MIN_PROBE_PIN 49 @@ -163,11 +158,13 @@ #endif // SPI for Max6675 or Max31855 Thermocouple -//#if DISABLED(SDSUPPORT) -// #define MAX6675_SS 53 -//#else -// #define MAX6675_SS 49 -//#endif +/* +#if DISABLED(SDSUPPORT) + #define MAX6675_SS_PIN 53 +#else + #define MAX6675_SS_PIN 49 +#endif +*/ // // Misc. Functions diff --git a/Marlin/src/pins/pins_RURAMPS4D_13.h b/Marlin/src/pins/pins_RURAMPS4D_13.h index ca80c21132..629e61da1f 100644 --- a/Marlin/src/pins/pins_RURAMPS4D_13.h +++ b/Marlin/src/pins/pins_RURAMPS4D_13.h @@ -33,12 +33,10 @@ */ #ifndef __SAM3X8E__ - #error "Oops! Make sure you have 'Arduino Due' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Arduino Due' in 'Tools > Board.'" #endif -#ifndef BOARD_NAME - #define BOARD_NAME "RuRAMPS4Due v1.3" -#endif +#define BOARD_NAME "RuRAMPS4Due v1.3" // // Servos @@ -146,11 +144,13 @@ #endif // SPI for Max6675 or Max31855 Thermocouple -//#if DISABLED(SDSUPPORT) -// #define MAX6675_SS 53 -//#else -// #define MAX6675_SS 49 -//#endif +/* +#if DISABLED(SDSUPPORT) + #define MAX6675_SS_PIN 53 +#else + #define MAX6675_SS_PIN 49 +#endif +*/ // // Misc. Functions diff --git a/Marlin/src/pins/pins_SANGUINOLOLU_11.h b/Marlin/src/pins/pins_SANGUINOLOLU_11.h index 0d9af5b5a8..802f79dd9d 100644 --- a/Marlin/src/pins/pins_SANGUINOLOLU_11.h +++ b/Marlin/src/pins/pins_SANGUINOLOLU_11.h @@ -52,7 +52,7 @@ */ #if !defined(__AVR_ATmega644P__) && !defined(__AVR_ATmega1284P__) - #error "Oops! Make sure you have 'Sanguino' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Sanguino' in 'Tools > Boards' and 'ATmega644P' or 'ATmega1284P' in 'Tools > Processor.'" #endif #ifndef BOARD_NAME @@ -153,7 +153,7 @@ // // LCD / Controller // -#if ENABLED(ULTRA_LCD) && ENABLED(NEWPANEL) +#if ENABLED(ULTRA_LCD) #if ENABLED(DOGLCD) @@ -217,9 +217,6 @@ #endif // !DOGLCD - #define BTN_EN1 11 - #define BTN_EN2 10 - #if ENABLED(LCD_I2C_PANELOLU2) #if ENABLED(IS_MELZI) @@ -258,7 +255,6 @@ #define LCD_PINS_D7 17 #define ADC_KEYPAD_PIN 1 - // Not used #define BTN_EN1 -1 #define BTN_EN2 -1 @@ -269,9 +265,14 @@ #endif + #if ENABLED(NEWPANEL) && !defined(BTN_EN1) + #define BTN_EN1 11 + #define BTN_EN2 10 + #endif + #define SD_DETECT_PIN -1 -#endif // ULTRA_LCD && NEWPANEL +#endif // ULTRA_LCD // // M3/M4/M5 - Spindle/Laser Control diff --git a/Marlin/src/pins/pins_SAV_MKI.h b/Marlin/src/pins/pins_SAV_MKI.h index 8945594495..c9039736e5 100644 --- a/Marlin/src/pins/pins_SAV_MKI.h +++ b/Marlin/src/pins/pins_SAV_MKI.h @@ -31,7 +31,7 @@ * and with the mainstream Marlin software. * * Teensyduino - http://www.pjrc.com/teensy/teensyduino.html - * Select Teensy++ 2.0 in Arduino IDE from the 'Tools -> Boards' menu + * Select Teensy++ 2.0 in Arduino IDE from the 'Tools > Board' menu * * Installation instructions are at the above URL. Don't bother loading the * libraries - they are not used with the Marlin software. @@ -46,7 +46,7 @@ * hardware directory in Arduino. The Arduino hardware directory will probably * be located in a path similar to this: C:\Program Files (x86)\Arduino\hardware. * 3. Restart Arduino. - * 4. Select "Printrboard" from the 'Tools -> Boards' menu. + * 4. Select "Printrboard" from the 'Tools > Board' menu. * * Teensyduino is the most popular option. Printrboard is used if your board doesn't have * the Teensyduino bootloader on it. @@ -62,7 +62,7 @@ */ #ifndef __AVR_AT90USB1286__ - #error "Oops! Make sure you have 'Teensy++ 2.0' or 'Printrboard' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Teensy++ 2.0' or 'Printrboard' in 'Tools > Board.'" #endif #define DEFAULT_MACHINE_NAME "SAV MkI" diff --git a/Marlin/src/pins/pins_SCOOVO_X9H.h b/Marlin/src/pins/pins_SCOOVO_X9H.h index ea6685def4..e061aec52e 100644 --- a/Marlin/src/pins/pins_SCOOVO_X9H.h +++ b/Marlin/src/pins/pins_SCOOVO_X9H.h @@ -25,7 +25,7 @@ ************************************************/ #ifndef __AVR_ATmega2560__ - #error "Oops! Make sure you have 'Arduino Mega 2560' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Arduino/Genuino Mega or Mega 2560' in 'Tools > Board.'" #endif #define BOARD_NAME "Scoovo X9H" diff --git a/Marlin/src/pins/pins_SELENA_COMPACT.h b/Marlin/src/pins/pins_SELENA_COMPACT.h index 5ea2d3bf54..ce2324c30e 100644 --- a/Marlin/src/pins/pins_SELENA_COMPACT.h +++ b/Marlin/src/pins/pins_SELENA_COMPACT.h @@ -26,13 +26,11 @@ */ #ifndef TARGET_LPC1768 - #error "Oops! Make sure you have the LPC1768 environment selected in your IDE." + #error "Oops! Make sure you have the LPC1768 environment selected in your IDE." #endif -#ifndef BOARD_NAME - #define BOARD_NAME "Selena Compact" - #define DEFAULT_WEBSITE_URL "https://github.com/Ales2-k/Selena" -#endif +#define BOARD_NAME "Selena Compact" +#define DEFAULT_WEBSITE_URL "https://github.com/Ales2-k/Selena" // // Limit Switches diff --git a/Marlin/src/pins/pins_SETHI.h b/Marlin/src/pins/pins_SETHI.h index 801560e5e3..270d1514fe 100644 --- a/Marlin/src/pins/pins_SETHI.h +++ b/Marlin/src/pins/pins_SETHI.h @@ -50,7 +50,7 @@ */ #if !defined(__AVR_ATmega644P__) && !defined(__AVR_ATmega644__) && !defined(__AVR_ATmega1284P__) - #error "Oops! Make sure you have 'Sethi 3D' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Sanguino' in 'Tools > Boards' and 'ATmega644', 'ATmega644P', or 'ATmega1284P' in 'Tools > Processor.'" #endif #define BOARD_NAME "Sethi 3D_1" diff --git a/Marlin/src/pins/pins_SILVER_GATE.h b/Marlin/src/pins/pins_SILVER_GATE.h index 005c4c6eca..09bd33024c 100644 --- a/Marlin/src/pins/pins_SILVER_GATE.h +++ b/Marlin/src/pins/pins_SILVER_GATE.h @@ -21,12 +21,10 @@ */ #if !defined(__AVR_ATmega1281__) && !defined(__AVR_ATmega2561__) - #error Oops! Make sure you have 'Silvergate' selected from the 'Tools -> Boards' menu. + #error "Oops! Select 'Silvergate' in 'Tools > Board.'" #endif -#ifndef BOARD_NAME - #define BOARD_NAME "Silver Gate" -#endif +#define BOARD_NAME "Silver Gate" #define X_STEP_PIN 43 #define X_DIR_PIN 44 diff --git a/Marlin/src/pins/pins_SMOOTHIEBOARD.h b/Marlin/src/pins/pins_SMOOTHIEBOARD.h index f41f57020a..7e12ec66f2 100644 --- a/Marlin/src/pins/pins_SMOOTHIEBOARD.h +++ b/Marlin/src/pins/pins_SMOOTHIEBOARD.h @@ -26,13 +26,11 @@ */ #ifndef TARGET_LPC1768 - #error "Oops! Make sure you have the LPC1768 environment selected in your IDE." + #error "Oops! Make sure you have the LPC1768 environment selected in your IDE." #endif -#ifndef BOARD_NAME - #define BOARD_NAME "Smoothieboard" - #define DEFAULT_WEBSITE_URL "http://smoothieware.org/smoothieboard" -#endif +#define BOARD_NAME "Smoothieboard" +#define DEFAULT_WEBSITE_URL "http://smoothieware.org/smoothieboard" #undef F_CPU #define F_CPU 120000000 diff --git a/Marlin/src/pins/pins_STM32F1R.h b/Marlin/src/pins/pins_STM32F1R.h index f827a7ef9b..74cfa37f77 100644 --- a/Marlin/src/pins/pins_STM32F1R.h +++ b/Marlin/src/pins/pins_STM32F1R.h @@ -21,7 +21,7 @@ */ #ifndef __STM32F1__ - #error "Oops! Make sure you have an STM32F1 board selected from the 'Tools -> Boards' menu." + #error "Oops! Select an STM32F1 board in 'Tools > Board.'" #endif /** diff --git a/Marlin/src/pins/pins_STM32F4.h b/Marlin/src/pins/pins_STM32F4.h index 22c8389635..fba82a8721 100644 --- a/Marlin/src/pins/pins_STM32F4.h +++ b/Marlin/src/pins/pins_STM32F4.h @@ -21,7 +21,7 @@ */ #if !defined(STM32F4) && !defined(STM32F4xx) - #error "Oops! Make sure you have an STM32F4 board selected from the 'Tools -> Boards' menu." + #error "Oops! Select an STM32F4 board in 'Tools > Board.'" #endif #define DEFAULT_MACHINE_NAME "STM32F407VET6" @@ -34,7 +34,7 @@ // Ignore temp readings during develpment. //#define BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE -#if E_STEPPERS > 2 || HOTENDS > 2 +#if HOTENDS > 2 || E_STEPPERS > 2 #error "STM32F4 supports up to 2 hotends / E-steppers." #endif diff --git a/Marlin/src/pins/pins_STM3R_MINI.h b/Marlin/src/pins/pins_STM3R_MINI.h index 2ffb09e2d5..31ce268290 100644 --- a/Marlin/src/pins/pins_STM3R_MINI.h +++ b/Marlin/src/pins/pins_STM3R_MINI.h @@ -21,7 +21,7 @@ */ #if !defined(__STM32F1__) && !defined(__STM32F4__) - #error "Oops! Make sure you have an STM32F1/4 board selected from the 'Tools -> Boards' menu." + #error "Oops! Select an STM32F1/4 board in 'Tools > Board.'" #endif /** diff --git a/Marlin/src/pins/pins_TEENSY2.h b/Marlin/src/pins/pins_TEENSY2.h index 736be6f73e..beb7ca0011 100644 --- a/Marlin/src/pins/pins_TEENSY2.h +++ b/Marlin/src/pins/pins_TEENSY2.h @@ -31,7 +31,7 @@ * and with the mainstream Marlin software. * * Teensyduino - http://www.pjrc.com/teensy/teensyduino.html - * Select Teensy++ 2.0 in Arduino IDE from the 'Tools -> Boards' menu + * Select Teensy++ 2.0 in Arduino IDE from the 'Tools > Board' menu * * Installation instructions are at the above URL. Don't bother loading the * libraries - they are not used with the Marlin software. @@ -46,7 +46,7 @@ * hardware directory in Arduino. The Arduino hardware directory will probably * be located in a path similar to this: C:\Program Files (x86)\Arduino\hardware. * 3. Restart Arduino. - * 4. Select "Printrboard" from the 'Tools -> Boards' menu. + * 4. Select "Printrboard" from the 'Tools > Board' menu. * * Teensyduino is the most popular option. Printrboard is used if your board doesn't have * the Teensyduino bootloader on it. @@ -107,10 +107,10 @@ */ #ifndef __AVR_AT90USB1286__ - #error "Oops! Make sure you have 'Teensy++ 2.0' or 'Printrboard' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Teensy++ 2.0' or 'Printrboard' in 'Tools > Board.'" #endif -#define BOARD_NAME "Teensy++2.0" +#define BOARD_NAME "Teensy++2.0" // // Limit Switches diff --git a/Marlin/src/pins/pins_TEENSY31_32.h b/Marlin/src/pins/pins_TEENSY31_32.h index a37a2407d8..7b86e10daa 100644 --- a/Marlin/src/pins/pins_TEENSY31_32.h +++ b/Marlin/src/pins/pins_TEENSY31_32.h @@ -27,7 +27,7 @@ ****************************************************************************************/ #if !IS_32BIT_TEENSY - #error "Oops! Make sure you have 'Teensy 3.1' or 'Teensy 3.2' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Teensy 3.1' or 'Teensy 3.2' in 'Tools > Board.'" #endif #if IS_TEENSY32 diff --git a/Marlin/src/pins/pins_TEENSY35_36.h b/Marlin/src/pins/pins_TEENSY35_36.h index f21438b129..9d81d3c0bc 100644 --- a/Marlin/src/pins/pins_TEENSY35_36.h +++ b/Marlin/src/pins/pins_TEENSY35_36.h @@ -27,7 +27,7 @@ ****************************************************************************************/ #if !IS_32BIT_TEENSY - #error "Oops! Make sure you have 'Teensy 3.5' or 'Teensy 3.6' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Teensy 3.5' or 'Teensy 3.6' in 'Tools > Board.'" #endif #if IS_TEENSY35 @@ -62,7 +62,7 @@ AUX2 25 | 41 * * 52 | A21 DAC0 AUX2 FAN_PIN SCL2 TX1 26 | 42 * * 51 | 39 A20 MISO0 SDSS AUX2 Z-PROBE PWR SCK0 RX1 27 | * * * * * | 38 A19 PWM SDA1 AUX2 SOL1_PIN MOSI0 28 | 43 * * 50 | 37 A18 PWM SCL1 -D10 CONTROLLERFAN_PIN CAN0TX PWM 29 | 44 * * 49 | 36 A17 PWM +D10 CONTROLLER_FAN_PIN CAN0TX PWM 29 | 44 * * 49 | 36 A17 PWM D9 HEATER_0_PIN CAN0RX PWM 30 | 45 * * 48 | 35 A16 PWM E1_ENABLE_PIN D8 HEATER_BED_PIN CS1 RX4 A12 31 | 46 * * 47 | 34 A15 PWM SDA0 RX5 E1_DIR_PIN SCK1 TX4 A13 32 |__GND_*_*_3.3V_| 33 A14 PWM SCL0 TX5 E1_STEP_PIN @@ -146,7 +146,16 @@ D8 HEATER_BED_PIN CS1 RX4 A12 31 | 46 * * 47 | 34 A15 PWM #define LCD_PINS_D5 43 #define LCD_PINS_D6 44 #define LCD_PINS_D7 45 +#endif + +#if ENABLED(NEWPANEL) #define BTN_EN1 46 #define BTN_EN2 47 #define BTN_ENC 48 #endif + +#if ENABLED(REPRAPWORLD_KEYPAD) + #define SHIFT_OUT 40 + #define SHIFT_CLK 44 + #define SHIFT_LD 42 +#endif diff --git a/Marlin/src/pins/pins_TEENSYLU.h b/Marlin/src/pins/pins_TEENSYLU.h index e733b98287..13002607ac 100644 --- a/Marlin/src/pins/pins_TEENSYLU.h +++ b/Marlin/src/pins/pins_TEENSYLU.h @@ -31,7 +31,7 @@ * and with the mainstream Marlin software. All have been used with Arduino 1.6.12 * * Teensyduino - http://www.pjrc.com/teensy/teensyduino.html - * Select Teensy++ 2.0 in Arduino IDE from the 'Tools -> Boards' menu + * Select Teensy++ 2.0 in Arduino IDE from the 'Tools > Board' menu * * Installation instructions are at the above URL. Don't bother loading the * libraries - they are not used with the Marlin software. @@ -48,7 +48,7 @@ * hardware directory in Arduino. The Arduino hardware directory will probably * be located in a path similar to this: C:\Program Files (x86)\Arduino\hardware. * 3. Restart Arduino. - * 4. Select "Printrboard" from the 'Tools -> Boards' menu. + * 4. Select "Printrboard" from the 'Tools > Board' menu. * * Teensyduino is the most popular option. Printrboard is used if your board doesn't have * the Teensyduino bootloader on it. @@ -74,10 +74,10 @@ */ #if !defined(__AVR_AT90USB1286__) && !defined(__AVR_AT90USB1286P__) - #error "Oops! Make sure you have 'Teensy++ 2.0' or 'Printrboard' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Teensy++ 2.0' or 'Printrboard' in 'Tools > Board.'" #endif -#define BOARD_NAME "Teensylu" +#define BOARD_NAME "Teensylu" // // Limit Switch definitions that match the SCHEMATIC diff --git a/Marlin/src/pins/pins_THE_BORG.h b/Marlin/src/pins/pins_THE_BORG.h index 8a762fba21..e75f13b42d 100644 --- a/Marlin/src/pins/pins_THE_BORG.h +++ b/Marlin/src/pins/pins_THE_BORG.h @@ -21,7 +21,7 @@ */ #if !defined(STM32F7) - #error "Oops! Make sure you have an STM32F7 board selected from the 'Tools -> Boards' menu." + #error "Oops! Select an STM32F7 board in 'Tools > Board.'" #endif #define DEFAULT_MACHINE_NAME "The-Borge" @@ -32,7 +32,7 @@ // Ignore temp readings during develpment. #define BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE -#if E_STEPPERS > 3 || HOTENDS > 3 +#if HOTENDS > 3 || E_STEPPERS > 3 #error "The-Borg supports up to 3 hotends / E-steppers." #endif diff --git a/Marlin/src/pins/pins_TRIGORILLA_13.h b/Marlin/src/pins/pins_TRIGORILLA_13.h index 0907eaf286..ee0687439e 100644 --- a/Marlin/src/pins/pins_TRIGORILLA_13.h +++ b/Marlin/src/pins/pins_TRIGORILLA_13.h @@ -24,9 +24,7 @@ * Arduino Mega with RAMPS v1.3 for Anycubic */ -#ifndef BOARD_NAME - #define BOARD_NAME "Anycubic RAMPS 1.3" -#endif +#define BOARD_NAME "Anycubic RAMPS 1.3" #define IS_RAMPS_EFB #define RAMPS_D9_PIN 44 diff --git a/Marlin/src/pins/pins_TRIGORILLA_14.h b/Marlin/src/pins/pins_TRIGORILLA_14.h index 3244cf278e..5e9b58be7d 100644 --- a/Marlin/src/pins/pins_TRIGORILLA_14.h +++ b/Marlin/src/pins/pins_TRIGORILLA_14.h @@ -24,24 +24,46 @@ * Arduino Mega with RAMPS v1.4 for Anycubic */ -#ifndef BOARD_NAME - #define BOARD_NAME "Anycubic RAMPS 1.4" -#endif +#define BOARD_NAME "Anycubic RAMPS 1.4" -// Remap MOSFET pins to common usages -#if HOTENDS > 1 - #define RAMPS_D9_PIN 45 // EEB, EEF +// Labeled pins +#define TRIGORILLA_HEATER_BED_PIN 8 +#define TRIGORILLA_HEATER_0_PIN 10 +#define TRIGORILLA_HEATER_1_PIN 45 // Anycubic Kossel: Unused + +#define TRIGORILLA_FAN0_PIN 9 // Anycubic Kossel: Usually the part cooling fan +#define TRIGORILLA_FAN1_PIN 7 // Anycubic Kossel: Unused +#define TRIGORILLA_FAN2_PIN 44 // Anycubic Kossel: Hotend fan + +// Remap MOSFET pins to common usages: + +#define RAMPS_D10_PIN TRIGORILLA_HEATER_0_PIN // HEATER_0_PIN is always RAMPS_D10_PIN in pins_RAMPS.h + +#if HOTENDS > 1 // EEF and EEB + #define RAMPS_D9_PIN TRIGORILLA_HEATER_1_PIN #if !TEMP_SENSOR_BED - #define RAMPS_D8_PIN 9 // EEF + // EEF + #define RAMPS_D8_PIN TRIGORILLA_FAN0_PIN + #else + // EEB + #define RAMPS_D8_PIN TRIGORILLA_HEATER_BED_PIN + #define FAN_PIN TRIGORILLA_FAN0_PIN // Override pin 4 in pins_RAMPS.h #endif #elif TEMP_SENSOR_BED - #define FAN1_PIN 7 // EFB + // EFB (Anycubic Kossel default) + #define RAMPS_D9_PIN TRIGORILLA_FAN0_PIN + #define RAMPS_D8_PIN TRIGORILLA_HEATER_BED_PIN #else - #define FAN2_PIN 44 // EFF + // EFF + #define RAMPS_D9_PIN TRIGORILLA_FAN1_PIN + #define RAMPS_D8_PIN TRIGORILLA_FAN0_PIN #endif -// D44 - Typical Extruder Fan on Anycubic Delta devices -#define ORIG_E0_AUTO_FAN_PIN 44 +#if HOTENDS > 1 || TEMP_SENSOR_BED // EEF, EEB, EFB + #define FAN1_PIN TRIGORILLA_FAN1_PIN +#endif +#define FAN2_PIN TRIGORILLA_FAN2_PIN +#define ORIG_E0_AUTO_FAN_PIN TRIGORILLA_FAN2_PIN // Used in Anycubic Kossel example config #include "pins_RAMPS.h" diff --git a/Marlin/src/pins/pins_ULTIMAIN_2.h b/Marlin/src/pins/pins_ULTIMAIN_2.h index ea7a8325c0..8516781cf2 100644 --- a/Marlin/src/pins/pins_ULTIMAIN_2.h +++ b/Marlin/src/pins/pins_ULTIMAIN_2.h @@ -33,7 +33,7 @@ */ #ifndef __AVR_ATmega2560__ - #error "Oops! Make sure you have 'Arduino Mega 2560' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Arduino/Genuino Mega or Mega 2560' in 'Tools > Board.'" #endif #define DEFAULT_MACHINE_NAME "Ultimaker" diff --git a/Marlin/src/pins/pins_ULTIMAKER.h b/Marlin/src/pins/pins_ULTIMAKER.h index 23941a1624..63c953587a 100644 --- a/Marlin/src/pins/pins_ULTIMAKER.h +++ b/Marlin/src/pins/pins_ULTIMAKER.h @@ -33,7 +33,7 @@ */ #if !defined(__AVR_ATmega1280__) && !defined(__AVR_ATmega2560__) - #error "Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Arduino/Genuino Mega or Mega 2560' in 'Tools > Board.'" #endif #define DEFAULT_MACHINE_NAME "Ultimaker" diff --git a/Marlin/src/pins/pins_ULTIMAKER_OLD.h b/Marlin/src/pins/pins_ULTIMAKER_OLD.h index c07f2d0e75..7b546661bf 100644 --- a/Marlin/src/pins/pins_ULTIMAKER_OLD.h +++ b/Marlin/src/pins/pins_ULTIMAKER_OLD.h @@ -61,7 +61,7 @@ #if !defined(__AVR_ATmega1280__) && !defined(__AVR_ATmega2560__) - #error "Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu." + #error "Oops! Select 'Arduino/Genuino Mega or Mega 2560' in 'Tools > Board.'" #endif #define DEFAULT_MACHINE_NAME "Ultimaker" diff --git a/Marlin/src/pins/pins_ULTRATRONICS_PRO.h b/Marlin/src/pins/pins_ULTRATRONICS_PRO.h index 42bdd7f645..699d472586 100644 --- a/Marlin/src/pins/pins_ULTRATRONICS_PRO.h +++ b/Marlin/src/pins/pins_ULTRATRONICS_PRO.h @@ -24,13 +24,12 @@ * ReprapWorld ULTRATRONICS v1.0 */ -#define KNOWN_BOARD -#define BOARD_NAME "Ultratronics v1.0" - #ifndef ARDUINO_ARCH_SAM - #error Oops! Make sure you have 'Arduino Due' selected from the 'Tools -> Boards' menu. + #error "Oops! Select 'Arduino Due' in 'Tools > Board.'" #endif +#define BOARD_NAME "Ultratronics v1.0" + // // Servos // @@ -126,7 +125,7 @@ #define SPI_FLASH_CS -1 // SPI for Max6675 or Max31855 Thermocouple -#define MAX6675_SS 65 +#define MAX6675_SS_PIN 65 #define MAX31855_SS0 65 #define MAX31855_SS1 52 #define MAX31855_SS2 50 diff --git a/Marlin/src/pins/sensitive_pins.h b/Marlin/src/pins/sensitive_pins.h new file mode 100644 index 0000000000..8b885bb0b6 --- /dev/null +++ b/Marlin/src/pins/sensitive_pins.h @@ -0,0 +1,516 @@ +/** + * 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 . + * + */ +#pragma once + +// +// Prepare a list of protected pins for M42/M43 +// + +#if PIN_EXISTS(X_MIN) + #define _X_MIN X_MIN_PIN, +#else + #define _X_MIN +#endif +#if PIN_EXISTS(X_MAX) + #define _X_MAX X_MAX_PIN, +#else + #define _X_MAX +#endif +#if PIN_EXISTS(X_CS) + #define _X_CS X_CS_PIN, +#else + #define _X_CS +#endif +#if PIN_EXISTS(X_MS1) + #define _X_MS1 X_MS1_PIN, +#else + #define _X_MS1 +#endif +#if PIN_EXISTS(X_MS2) + #define _X_MS2 X_MS2_PIN, +#else + #define _X_MS2 +#endif +#if PIN_EXISTS(X_MS3) + #define _X_MS3 X_MS3_PIN, +#else + #define _X_MS3 +#endif + +#define _X_PINS X_STEP_PIN, X_DIR_PIN, X_ENABLE_PIN, _X_MIN _X_MAX _X_MS1 _X_MS2 _X_MS3 _X_CS + +#if PIN_EXISTS(Y_MIN) + #define _Y_MIN Y_MIN_PIN, +#else + #define _Y_MIN +#endif +#if PIN_EXISTS(Y_MAX) + #define _Y_MAX Y_MAX_PIN, +#else + #define _Y_MAX +#endif +#if PIN_EXISTS(Y_CS) + #define _Y_CS Y_CS_PIN, +#else + #define _Y_CS +#endif +#if PIN_EXISTS(Y_MS1) + #define _Y_MS1 Y_MS1_PIN, +#else + #define _Y_MS1 +#endif +#if PIN_EXISTS(Y_MS2) + #define _Y_MS2 Y_MS2_PIN, +#else + #define _Y_MS2 +#endif +#if PIN_EXISTS(Y_MS3) + #define _Y_MS3 Y_MS3_PIN, +#else + #define _Y_MS3 +#endif + +#define _Y_PINS Y_STEP_PIN, Y_DIR_PIN, Y_ENABLE_PIN, _Y_MIN _Y_MAX _Y_MS1 _Y_MS2 _Y_MS3 _Y_CS + +#if PIN_EXISTS(Z_MIN) + #define _Z_MIN Z_MIN_PIN, +#else + #define _Z_MIN +#endif +#if PIN_EXISTS(Z_MAX) + #define _Z_MAX Z_MAX_PIN, +#else + #define _Z_MAX +#endif +#if PIN_EXISTS(Z_CS) + #define _Z_CS Z_CS_PIN, +#else + #define _Z_CS +#endif +#if PIN_EXISTS(Z_MS1) + #define _Z_MS1 Z_MS1_PIN, +#else + #define _Z_MS1 +#endif +#if PIN_EXISTS(Z_MS2) + #define _Z_MS2 Z_MS2_PIN, +#else + #define _Z_MS2 +#endif +#if PIN_EXISTS(Z_MS3) + #define _Z_MS3 Z_MS3_PIN, +#else + #define _Z_MS3 +#endif + +#define _Z_PINS Z_STEP_PIN, Z_DIR_PIN, Z_ENABLE_PIN, _Z_MIN _Z_MAX _Z_MS1 _Z_MS2 _Z_MS3 _Z_CS + +// +// Extruder Chip Select, Digital Micro-steps +// + +// Mixing stepper, Switching stepper, or regular stepper +#define E_NEEDED(N) (ENABLED(MIXING_EXTRUDER) && MIXING_STEPPERS > N) \ + || (ENABLED(SWITCHING_EXTRUDER) && E_STEPPERS > N) \ + || (DISABLED(SWITCHING_EXTRUDER) && DISABLED(MIXING_EXTRUDER) && EXTRUDERS > N) + +#if PIN_EXISTS(E0_CS) + #define _E0_CS E0_CS_PIN, +#else + #define _E0_CS +#endif +#if PIN_EXISTS(E0_MS1) + #define _E0_MS1 E0_MS1_PIN, +#else + #define _E0_MS1 +#endif +#if PIN_EXISTS(E0_MS2) + #define _E0_MS2 E0_MS2_PIN, +#else + #define _E0_MS2 +#endif +#if PIN_EXISTS(E0_MS3) + #define _E0_MS3 E0_MS3_PIN, +#else + #define _E0_MS3 +#endif + +#define _E1_CS +#define _E1_MS1 +#define _E1_MS2 +#define _E1_MS3 + +#if E_NEEDED(1) + #if PIN_EXISTS(E1_CS) + #undef _E1_CS + #define _E1_CS E1_CS_PIN, + #endif + #if PIN_EXISTS(E1_MS1) + #undef _E1_MS1 + #define _E1_MS1 E1_MS1_PIN, + #endif + #if PIN_EXISTS(E1_MS2) + #undef _E1_MS2 + #define _E1_MS2 E1_MS2_PIN, + #endif + #if PIN_EXISTS(E1_MS3) + #undef _E1_MS3 + #define _E1_MS3 E1_MS3_PIN, + #endif +#endif + +#define _E2_CS +#define _E2_MS1 +#define _E2_MS2 +#define _E2_MS3 + +#if E_NEEDED(2) + #if PIN_EXISTS(E2_CS) + #undef _E2_CS + #define _E2_CS E2_CS_PIN, + #endif + #if PIN_EXISTS(E2_MS1) + #undef _E2_MS1 + #define _E2_MS1 E2_MS1_PIN, + #endif + #if PIN_EXISTS(E2_MS2) + #undef _E2_MS2 + #define _E2_MS2 E2_MS2_PIN, + #endif + #if PIN_EXISTS(E2_MS3) + #undef _E2_MS3 + #define _E2_MS3 E2_MS3_PIN, + #endif +#endif + +#define _E3_CS +#define _E3_MS1 +#define _E3_MS2 +#define _E3_MS3 + +#if E_NEEDED(3) + #if PIN_EXISTS(E3_CS) + #undef _E3_CS + #define _E3_CS E3_CS_PIN, + #endif + #if PIN_EXISTS(E3_MS1) + #undef _E3_MS1 + #define _E3_MS1 E3_MS1_PIN, + #endif + #if PIN_EXISTS(E3_MS2) + #undef _E3_MS2 + #define _E3_MS2 E3_MS2_PIN, + #endif + #if PIN_EXISTS(E3_MS3) + #undef _E3_MS3 + #define _E3_MS3 E3_MS3_PIN, + #endif +#endif + +#define _E4_CS +#define _E4_MS1 +#define _E4_MS2 +#define _E4_MS3 + +#if E_NEEDED(4) + #if PIN_EXISTS(E4_CS) + #undef _E4_CS + #define _E4_CS E4_CS_PIN, + #endif + #if PIN_EXISTS(E4_MS1) + #undef _E4_MS1 + #define _E4_MS1 E4_MS1_PIN, + #endif + #if PIN_EXISTS(E4_MS2) + #undef _E4_MS2 + #define _E4_MS2 E4_MS2_PIN, + #endif + #if PIN_EXISTS(E4_MS3) + #undef _E4_MS3 + #define _E4_MS3 E4_MS3_PIN, + #endif +#endif + +#define _E5_CS +#define _E5_MS1 +#define _E5_MS2 +#define _E5_MS3 + +#if E_NEEDED(5) + #if PIN_EXISTS(E5_CS) + #undef _E5_CS + #define _E5_CS E5_CS_PIN, + #endif + #if PIN_EXISTS(E5_MS1) + #undef _E5_MS1 + #define _E5_MS1 E5_MS1_PIN, + #endif + #if PIN_EXISTS(E5_MS2) + #undef _E5_MS2 + #define _E5_MS2 E5_MS2_PIN, + #endif + #if PIN_EXISTS(E5_MS3) + #undef _E5_MS3 + #define _E5_MS3 E5_MS3_PIN, + #endif +#endif + +// +// E Steppers +// + +#define _E0_PINS E0_STEP_PIN, E0_DIR_PIN, E0_ENABLE_PIN, _E0_CS _E0_MS1 _E0_MS2 _E0_MS3 +#define _E1_PINS +#define _E2_PINS +#define _E3_PINS +#define _E4_PINS +#define _E5_PINS + +#if ENABLED(SWITCHING_EXTRUDER) + // Tools 0 and 1 use E0 + #if EXTRUDERS > 2 // Tools 2 and 3 use E1 + #undef _E1_PINS + #define _E1_PINS E1_STEP_PIN, E1_DIR_PIN, E1_ENABLE_PIN, _E1_CS _E1_MS1 _E1_MS2 _E1_MS3 + #if EXTRUDERS > 4 // Tools 4 and 5 use E2 + #undef _E2_PINS + #define _E2_PINS E2_STEP_PIN, E2_DIR_PIN, E2_ENABLE_PIN, _E2_CS _E2_MS1 _E2_MS2 _E2_MS3 + #endif + #endif +#elif EXTRUDERS > 1 || ENABLED(MIXING_EXTRUDER) + #undef _E1_PINS + #define _E1_PINS E1_STEP_PIN, E1_DIR_PIN, E1_ENABLE_PIN, _E1_CS _E1_MS1 _E1_MS2 _E1_MS3 + #if EXTRUDERS > 2 || (ENABLED(MIXING_EXTRUDER) && MIXING_STEPPERS > 2) + #undef _E2_PINS + #define _E2_PINS E2_STEP_PIN, E2_DIR_PIN, E2_ENABLE_PIN, _E2_CS _E2_MS1 _E2_MS2 _E2_MS3 + #if EXTRUDERS > 3 || (ENABLED(MIXING_EXTRUDER) && MIXING_STEPPERS > 3) + #undef _E3_PINS + #define _E3_PINS E3_STEP_PIN, E3_DIR_PIN, E3_ENABLE_PIN, _E3_CS _E3_MS1 _E3_MS2 _E3_MS3 + #if EXTRUDERS > 4 || (ENABLED(MIXING_EXTRUDER) && MIXING_STEPPERS > 4) + #undef _E4_PINS + #define _E4_PINS E4_STEP_PIN, E4_DIR_PIN, E4_ENABLE_PIN, _E4_CS _E4_MS1 _E4_MS2 _E4_MS3 + #if EXTRUDERS > 5 || (ENABLED(MIXING_EXTRUDER) && MIXING_STEPPERS > 5) + #undef _E5_PINS + #define _E5_PINS E5_STEP_PIN, E5_DIR_PIN, E5_ENABLE_PIN, _E5_CS _E5_MS1 _E5_MS2 _E5_MS3 + #endif // EXTRUDERS > 5 || MIXING_EXTRUDER > 5 + #endif // EXTRUDERS > 4 || MIXING_EXTRUDER > 4 + #endif // EXTRUDERS > 3 || MIXING_EXTRUDER > 3 + #endif // EXTRUDERS > 2 || MIXING_EXTRUDER > 2 +#endif // EXTRUDERS > 1 || MIXING_EXTRUDER + +// +// Heaters, Fans, Temp Sensors +// + +#define _H0_PINS HEATER_0_PIN, E0_AUTO_FAN_PIN, analogInputToDigitalPin(TEMP_0_PIN), +#define _H1_PINS +#define _H2_PINS +#define _H3_PINS +#define _H4_PINS +#define _H5_PINS + +#if HOTENDS > 1 + #undef _H1_PINS + #define _H1_PINS HEATER_1_PIN, E1_AUTO_FAN_PIN, analogInputToDigitalPin(TEMP_1_PIN), + #if HOTENDS > 2 + #undef _H2_PINS + #define _H2_PINS HEATER_2_PIN, E2_AUTO_FAN_PIN, analogInputToDigitalPin(TEMP_2_PIN), + #if HOTENDS > 3 + #undef _H3_PINS + #define _H3_PINS HEATER_3_PIN, E3_AUTO_FAN_PIN, analogInputToDigitalPin(TEMP_3_PIN), + #if HOTENDS > 4 + #undef _H4_PINS + #define _H4_PINS HEATER_4_PIN, E4_AUTO_FAN_PIN, analogInputToDigitalPin(TEMP_4_PIN), + #if HOTENDS > 5 + #undef _H5_PINS + #define _H5_PINS HEATER_5_PIN, E5_AUTO_FAN_PIN, analogInputToDigitalPin(TEMP_5_PIN), + #endif // HOTENDS > 5 + #endif // HOTENDS > 4 + #endif // HOTENDS > 3 + #endif // HOTENDS > 2 +#endif // HOTENDS > 1 + +#define _BED_PINS HEATER_BED_PIN, analogInputToDigitalPin(TEMP_BED_PIN), + +// +// Dual X, Dual Y, Multi-Z +// Chip Select and Digital Micro-stepping +// + +#if ENABLED(DUAL_X_CARRIAGE) || ENABLED(X_DUAL_STEPPER_DRIVERS) + #if PIN_EXISTS(X2_CS) + #define _X2_CS X2_CS_PIN, + #else + #define _X2_CS + #endif + #if PIN_EXISTS(X2_MS1) + #define _X2_MS1 X2_MS1_PIN, + #else + #define _X2_MS1 + #endif + #if PIN_EXISTS(X2_MS2) + #define _X2_MS2 X2_MS2_PIN, + #else + #define _X2_MS2 + #endif + #if PIN_EXISTS(X2_MS3) + #define _X2_MS3 X2_MS3_PIN, + #else + #define _X2_MS3 + #endif + #define _X2_PINS X2_STEP_PIN, X2_DIR_PIN, X2_ENABLE_PIN, _X2_CS _X2_MS1 _X2_MS2 _X2_MS3 +#else + #define _X2_PINS +#endif + +#if ENABLED(Y_DUAL_STEPPER_DRIVERS) + #if PIN_EXISTS(Y2_CS) + #define _Y2_CS Y2_CS_PIN, + #else + #define _Y2_CS + #endif + #if PIN_EXISTS(Y2_MS1) + #define _Y2_MS1 Y2_MS1_PIN, + #else + #define _Y2_MS1 + #endif + #if PIN_EXISTS(Y2_MS2) + #define _Y2_MS2 Y2_MS2_PIN, + #else + #define _Y2_MS2 + #endif + #if PIN_EXISTS(Y2_MS3) + #define _Y2_MS3 Y2_MS3_PIN, + #else + #define _Y2_MS3 + #endif + #define _Y2_PINS Y2_STEP_PIN, Y2_DIR_PIN, Y2_ENABLE_PIN, _Y2_CS _Y2_MS1 _Y2_MS2 _Y2_MS3 +#else + #define _Y2_PINS +#endif + +#if Z_MULTI_STEPPER_DRIVERS + #if PIN_EXISTS(Z2_CS) + #define _Z2_CS Z2_CS_PIN, + #else + #define _Z2_CS + #endif + #if PIN_EXISTS(Z2_MS1) + #define _Z2_MS1 Z2_MS1_PIN, + #else + #define _Z2_MS1 + #endif + #if PIN_EXISTS(Z2_MS2) + #define _Z2_MS2 Z2_MS2_PIN, + #else + #define _Z2_MS2 + #endif + #if PIN_EXISTS(Z2_MS3) + #define _Z2_MS3 Z2_MS3_PIN, + #else + #define _Z2_MS3 + #endif + #define _Z2_PINS Z2_STEP_PIN, Z2_DIR_PIN, Z2_ENABLE_PIN, _Z2_CS _Z2_MS1 _Z2_MS2 _Z2_MS3 +#else + #define _Z2_PINS +#endif + +#if ENABLED(Z_TRIPLE_STEPPER_DRIVERS) + #if PIN_EXISTS(Z3_CS) + #define _Z3_CS Z3_CS_PIN, + #else + #define _Z3_CS + #endif + #if PIN_EXISTS(Z3_MS1) + #define _Z3_MS1 Z3_MS1_PIN, + #else + #define _Z3_MS1 + #endif + #if PIN_EXISTS(Z3_MS2) + #define _Z3_MS2 Z3_MS2_PIN, + #else + #define _Z3_MS2 + #endif + #if PIN_EXISTS(Z3_MS3) + #define _Z3_MS3 Z3_MS3_PIN, + #else + #define _Z3_MS3 + #endif + #define _Z3_PINS Z3_STEP_PIN, Z3_DIR_PIN, Z3_ENABLE_PIN, _Z3_CS _Z3_MS1 _Z3_MS2 _Z3_MS3 +#else + #define _Z3_PINS +#endif + +// +// Generate the final Sensitive Pins array, +// keeping the array as small as possible. +// + +#if PIN_EXISTS(PS_ON) + #define _PS_ON PS_ON_PIN, +#else + #define _PS_ON +#endif + +#if HAS_BED_PROBE && PIN_EXISTS(Z_MIN_PROBE) + #define _Z_PROBE Z_MIN_PROBE_PIN, +#else + #define _Z_PROBE +#endif + +#if TEMP_SENSOR_BED && PIN_EXISTS(HEATER_BED) + #define _HEATER_BED HEATER_BED_PIN, +#else + #define _HEATER_BED +#endif + +#if PIN_EXISTS(FAN) + #define _FAN0 FAN_PIN, +#else + #define _FAN0 +#endif +#if PIN_EXISTS(FAN1) + #define _FAN1 FAN1_PIN, +#else + #define _FAN1 +#endif +#if PIN_EXISTS(FAN2) + #define _FAN2 FAN2_PIN, +#else + #define _FAN2 +#endif +#if PIN_EXISTS(CONTROLLER_FAN) + #define _FANC CONTROLLER_FAN_PIN, +#else + #define _FANC +#endif + +#ifndef HAL_SENSITIVE_PINS + #define HAL_SENSITIVE_PINS +#endif + +#define SENSITIVE_PINS { \ + _X_PINS _Y_PINS _Z_PINS _X2_PINS _Y2_PINS _Z2_PINS _Z3_PINS _Z_PROBE \ + _E0_PINS _E1_PINS _E2_PINS _E3_PINS _E4_PINS _E5_PINS _BED_PINS \ + _H0_PINS _H1_PINS _H2_PINS _H3_PINS _H4_PINS _H5_PINS \ + _PS_ON _HEATER_BED _FAN0 _FAN1 _FAN2 _FANC \ + HAL_SENSITIVE_PINS \ +} diff --git a/Marlin/src/sd/Sd2Card.cpp b/Marlin/src/sd/Sd2Card.cpp index b52e4fa16d..d1116cdb35 100644 --- a/Marlin/src/sd/Sd2Card.cpp +++ b/Marlin/src/sd/Sd2Card.cpp @@ -30,7 +30,7 @@ #include "../inc/MarlinConfig.h" -#if ENABLED(SDSUPPORT) +#if ENABLED(SDSUPPORT) && DISABLED(USB_FLASH_DRIVE_SUPPORT) /* Enable FAST CRC computations - You can trade speed for FLASH space if * needed by disabling the following define */ @@ -240,7 +240,7 @@ bool Sd2Card::init(uint8_t sckRateID, pin_t chipSelectPin) { errorCode_ = type_ = 0; chipSelectPin_ = chipSelectPin; // 16-bit init start time allows over a minute - uint16_t t0 = (uint16_t)millis(); + const millis_t init_timeout = millis() + SD_INIT_TIMEOUT; uint32_t arg; // If init takes more than 4s it could trigger @@ -268,7 +268,7 @@ bool Sd2Card::init(uint8_t sckRateID, pin_t chipSelectPin) { // Command to go idle in SPI mode while ((status_ = cardCommand(CMD0, 0)) != R1_IDLE_STATE) { - if (((uint16_t)millis() - t0) > SD_INIT_TIMEOUT) { + if (ELAPSED(millis(), init_timeout)) { error(SD_CARD_ERROR_CMD0); goto FAIL; } @@ -297,7 +297,7 @@ bool Sd2Card::init(uint8_t sckRateID, pin_t chipSelectPin) { break; } - if (((uint16_t)millis() - t0) > SD_INIT_TIMEOUT) { + if (ELAPSED(millis(), init_timeout)) { error(SD_CARD_ERROR_CMD8); goto FAIL; } @@ -312,7 +312,7 @@ bool Sd2Card::init(uint8_t sckRateID, pin_t chipSelectPin) { arg = type() == SD_CARD_TYPE_SD2 ? 0x40000000 : 0; while ((status_ = cardAcmd(ACMD41, arg)) != R1_READY_STATE) { // check for timeout - if (((uint16_t)millis() - t0) > SD_INIT_TIMEOUT) { + if (ELAPSED(millis(), init_timeout)) { error(SD_CARD_ERROR_ACMD41); goto FAIL; } @@ -449,9 +449,9 @@ bool Sd2Card::readData(uint8_t* dst) { bool Sd2Card::readData(uint8_t* dst, uint16_t count) { // wait for start block token - uint16_t t0 = millis(); + const millis_t read_timeout = millis() + SD_READ_TIMEOUT; while ((status_ = spiRec()) == 0xFF) { - if (((uint16_t)millis() - t0) > SD_READ_TIMEOUT) { + if (ELAPSED(millis(), read_timeout)) { error(SD_CARD_ERROR_READ_TIMEOUT); goto FAIL; } @@ -553,10 +553,10 @@ bool Sd2Card::setSckRate(uint8_t sckRateID) { } // wait for card to go not busy -bool Sd2Card::waitNotBusy(uint16_t timeoutMillis) { - uint16_t t0 = millis(); +bool Sd2Card::waitNotBusy(const millis_t timeout_ms) { + const millis_t wait_timeout = millis() + timeout_ms; while (spiRec() != 0xFF) - if (((uint16_t)millis() - t0) >= timeoutMillis) return false; + if (ELAPSED(millis(), wait_timeout)) return false; return true; } diff --git a/Marlin/src/sd/Sd2Card.h b/Marlin/src/sd/Sd2Card.h index 0df9c0ba64..8f14073df8 100644 --- a/Marlin/src/sd/Sd2Card.h +++ b/Marlin/src/sd/Sd2Card.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * \file @@ -31,9 +32,6 @@ * * This file is part of the Arduino Sd2Card Library */ -#ifndef _SD2CARD_H_ -#define _SD2CARD_H_ - #include "SdFatConfig.h" #include "SdInfo.h" @@ -200,8 +198,6 @@ class Sd2Card { void chipDeselect(); void chipSelect(); void type(uint8_t value) { type_ = value; } - bool waitNotBusy(uint16_t timeoutMillis); + bool waitNotBusy(const millis_t timeout_ms); bool writeData(uint8_t token, const uint8_t* src); }; - -#endif // _SD2CARD_H_ diff --git a/Marlin/src/sd/SdBaseFile.h b/Marlin/src/sd/SdBaseFile.h index d8139d20c0..8fa91a650f 100644 --- a/Marlin/src/sd/SdBaseFile.h +++ b/Marlin/src/sd/SdBaseFile.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * \file @@ -31,9 +32,6 @@ * * This file is part of the Arduino Sd2Card Library */ -#ifndef _SDBASEFILE_H_ -#define _SDBASEFILE_H_ - #include "SdFatConfig.h" #include "SdVolume.h" @@ -387,5 +385,3 @@ class SdBaseFile { bool openCachedEntry(uint8_t cacheIndex, uint8_t oflags); dir_t* readDirCache(); }; - -#endif // _SDBASEFILE_H_ diff --git a/Marlin/src/sd/SdFatConfig.h b/Marlin/src/sd/SdFatConfig.h index d2c769a014..d203aa38ae 100644 --- a/Marlin/src/sd/SdFatConfig.h +++ b/Marlin/src/sd/SdFatConfig.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * SdFatConfig.h @@ -28,12 +29,8 @@ * This file is part of the Arduino Sd2Card Library */ -#ifndef _SDFATCONFIG_H_ -#define _SDFATCONFIG_H_ - #include "../inc/MarlinConfig.h" - /** * To use multiple SD cards set USE_MULTIPLE_CARDS nonzero. * @@ -113,5 +110,3 @@ // Total bytes needed to store a single long filename #define LONG_FILENAME_LENGTH (FILENAME_LENGTH * MAX_VFAT_ENTRIES + 1) - -#endif // _SDFATCONFIG_H_ diff --git a/Marlin/src/sd/SdFatStructs.h b/Marlin/src/sd/SdFatStructs.h index 7b84b1ad0c..eaf7a03ea3 100644 --- a/Marlin/src/sd/SdFatStructs.h +++ b/Marlin/src/sd/SdFatStructs.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * \file @@ -31,8 +32,6 @@ * * This file is part of the Arduino Sd2Card Library */ -#ifndef SDFATSTRUCTS_H -#define SDFATSTRUCTS_H #include @@ -613,5 +612,3 @@ static inline uint8_t DIR_IS_SUBDIR(const dir_t* dir) { static inline uint8_t DIR_IS_FILE_OR_SUBDIR(const dir_t* dir) { return (dir->attributes & DIR_ATT_VOLUME_ID) == 0; } - -#endif // SDFATSTRUCTS_H diff --git a/Marlin/src/sd/SdFatUtil.cpp b/Marlin/src/sd/SdFatUtil.cpp index 1110d1dc9c..b06ee74a5d 100644 --- a/Marlin/src/sd/SdFatUtil.cpp +++ b/Marlin/src/sd/SdFatUtil.cpp @@ -32,6 +32,7 @@ #if ENABLED(SDSUPPORT) #include "SdFatUtil.h" +#include /** * Amount of free RAM diff --git a/Marlin/src/sd/SdFatUtil.h b/Marlin/src/sd/SdFatUtil.h index 1deb1eb8f3..e510ee8e13 100644 --- a/Marlin/src/sd/SdFatUtil.h +++ b/Marlin/src/sd/SdFatUtil.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Arduino SdFat Library @@ -26,10 +27,6 @@ * * This file is part of the Arduino Sd2Card Library */ -#ifndef _SDFATUTIL_H_ -#define _SDFATUTIL_H_ - -#include /** * \file @@ -41,5 +38,3 @@ namespace SdFatUtil { } using namespace SdFatUtil; // NOLINT - -#endif // _SDFATUTIL_H_ diff --git a/Marlin/src/sd/SdFile.h b/Marlin/src/sd/SdFile.h index dd250110a1..e555797c75 100644 --- a/Marlin/src/sd/SdFile.h +++ b/Marlin/src/sd/SdFile.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * \file @@ -31,8 +32,6 @@ * * This file is part of the Arduino Sd2Card Library */ -#ifndef _SDFILE_H_ -#define _SDFILE_H_ #include "SdBaseFile.h" @@ -58,5 +57,3 @@ class SdFile : public SdBaseFile/*, public Print*/ { void write_P(PGM_P str); void writeln_P(PGM_P str); }; - -#endif // _SDFILE_H_ diff --git a/Marlin/src/sd/SdInfo.h b/Marlin/src/sd/SdInfo.h index 91cb35da9e..62a445d06d 100644 --- a/Marlin/src/sd/SdInfo.h +++ b/Marlin/src/sd/SdInfo.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * Arduino Sd2Card Library @@ -26,8 +27,6 @@ * * This file is part of the Arduino Sd2Card Library */ -#ifndef _SDINFO_H_ -#define _SDINFO_H_ #include @@ -264,5 +263,3 @@ union csd_t { csd1_t v1; csd2_t v2; }; - -#endif // _SDINFO_H_ diff --git a/Marlin/src/sd/SdVolume.h b/Marlin/src/sd/SdVolume.h index d67d98f8be..0f3839362f 100644 --- a/Marlin/src/sd/SdVolume.h +++ b/Marlin/src/sd/SdVolume.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * \file @@ -31,13 +32,15 @@ * * This file is part of the Arduino Sd2Card Library */ -#ifndef _SDVOLUME_H_ -#define _SDVOLUME_H_ + +#if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #include "usb_flashdrive/Sd2Card_FlashDrive.h" +#else + #include "Sd2Card.h" +#endif #include "SdFatConfig.h" -#include "Sd2Card.h" #include "SdFatStructs.h" - #include //============================================================================== @@ -191,5 +194,3 @@ class SdVolume { bool readBlock(uint32_t block, uint8_t* dst) { return sdCard_->readBlock(block, dst); } bool writeBlock(uint32_t block, const uint8_t* dst) { return sdCard_->writeBlock(block, dst); } }; - -#endif // _SDVOLUME_H_ diff --git a/Marlin/src/sd/cardreader.cpp b/Marlin/src/sd/cardreader.cpp index 9ba018a2cf..d8508ad70b 100644 --- a/Marlin/src/sd/cardreader.cpp +++ b/Marlin/src/sd/cardreader.cpp @@ -33,6 +33,10 @@ #include "../core/language.h" #include "../gcode/queue.h" +#if ENABLED(EMERGENCY_PARSER) + #include "../feature/emergency_parser.h" +#endif + #if ENABLED(POWER_LOSS_RECOVERY) #include "../feature/power_loss_recovery.h" #endif @@ -41,7 +45,75 @@ #include "../feature/pause.h" #endif -#include +// public: + +card_flags_t CardReader::flag; +char CardReader::filename[FILENAME_LENGTH], CardReader::longFilename[LONG_FILENAME_LENGTH]; +int8_t CardReader::autostart_index; + +#if ENABLED(FAST_FILE_TRANSFER) + #if NUM_SERIAL > 1 + uint8_t CardReader::transfer_port; + #endif +#endif + +// private: + +SdFile CardReader::root, CardReader::workDir, CardReader::workDirParents[MAX_DIR_DEPTH]; +uint8_t CardReader::workDirDepth; + +#if ENABLED(SDCARD_SORT_ALPHA) + uint16_t CardReader::sort_count; + #if ENABLED(SDSORT_GCODE) + bool CardReader::sort_alpha; + int CardReader::sort_folders; + //bool CardReader::sort_reverse; + #endif + + #if ENABLED(SDSORT_DYNAMIC_RAM) + uint8_t *CardReader::sort_order; + #else + uint8_t CardReader::sort_order[SDSORT_LIMIT]; + #endif + + #if ENABLED(SDSORT_USES_RAM) + + #if ENABLED(SDSORT_CACHE_NAMES) + #if ENABLED(SDSORT_DYNAMIC_RAM) + char **CardReader::sortshort, **CardReader::sortnames; + #else + char CardReader::sortshort[SDSORT_LIMIT][FILENAME_LENGTH]; + char CardReader::sortnames[SDSORT_LIMIT][SORTED_LONGNAME_MAXLEN]; + #endif + #elif DISABLED(SDSORT_USES_STACK) + char CardReader::sortnames[SDSORT_LIMIT][SORTED_LONGNAME_MAXLEN]; + #endif + + #if HAS_FOLDER_SORTING + #if ENABLED(SDSORT_DYNAMIC_RAM) + uint8_t *CardReader::isDir; + #elif ENABLED(SDSORT_CACHE_NAMES) || DISABLED(SDSORT_USES_STACK) + uint8_t CardReader::isDir[(SDSORT_LIMIT+7)>>3]; + #endif + #endif + + #endif // SDSORT_USES_RAM + +#endif // SDCARD_SORT_ALPHA + +Sd2Card CardReader::sd2card; +SdVolume CardReader::volume; +SdFile CardReader::file; + +uint8_t CardReader::file_subcall_ctr; +uint32_t CardReader::filespos[SD_PROCEDURE_DEPTH]; +char CardReader::proc_filenames[SD_PROCEDURE_DEPTH][MAXPATHNAMELENGTH]; + +uint32_t CardReader::filesize, CardReader::sdpos; + +LsAction CardReader::lsAction; //stored for recursion. +uint16_t CardReader::nrFiles; //counter for the files in the current directory and recycled as position counter for getting the nrFiles'th name in the directory. +char *CardReader::diveDirName; CardReader::CardReader() { #if ENABLED(SDCARD_SORT_ALPHA) @@ -52,9 +124,8 @@ CardReader::CardReader() { //sort_reverse = false; #endif #endif - sdprinting = cardOK = saving = logging = false; - filesize = 0; - sdpos = 0; + flag.sdprinting = flag.cardOK = flag.saving = flag.logging = false; + filesize = sdpos = 0; file_subcall_ctr = 0; workDirDepth = 0; @@ -69,7 +140,7 @@ CardReader::CardReader() { #endif } -char *createFilename(char *buffer, const dir_t &p) { //buffer > 12characters +char *createFilename(char *buffer, const dir_t &p) { char *pos = buffer; for (uint8_t i = 0; i < 11; i++) { if (p.name[i] == ' ') continue; @@ -116,8 +187,8 @@ void CardReader::lsDive(const char *prepend, SdFile parent, const char * const m // It contains the full path to the "parent" argument. // We now have the full path to the item in this folder. strcpy(path, prepend_is_empty ? "/" : prepend); // root slash if prepend is empty - strcat(path, dosFilename); // FILENAME_LENGTH-1 characters maximum - strcat(path, "/"); // 1 character + strcat(path, dosFilename); // FILENAME_LENGTH characters maximum + strcat(path, "/"); // 1 character // Serial.print(path); @@ -146,9 +217,9 @@ void CardReader::lsDive(const char *prepend, SdFile parent, const char * const m if (!DIR_IS_FILE_OR_SUBDIR(&p) || (p.attributes & DIR_ATT_HIDDEN)) continue; - filenameIsDir = DIR_IS_SUBDIR(&p); + flag.filenameIsDir = DIR_IS_SUBDIR(&p); - if (!filenameIsDir && (p.name[8] != 'G' || p.name[9] == '~')) continue; + if (!flag.filenameIsDir && (p.name[8] != 'G' || p.name[9] == '~')) continue; switch (lsAction) { // 1 based file count case LS_Count: @@ -238,7 +309,7 @@ void CardReader::ls( SERIAL_PROTOCOL_P(port, longFilename[0] ? longFilename : "???"); // If the filename was printed then that's it - if (!filenameIsDir) break; + if (!flag.filenameIsDir) break; // SERIAL_ECHOPGM_P(port, "Opening dir: "); SERIAL_ECHOLN_P(port, segment); @@ -289,7 +360,7 @@ void CardReader::printFilename( } void CardReader::initsd() { - cardOK = false; + flag.cardOK = false; if (root.isOpen()) root.close(); #ifndef SPI_SPEED @@ -314,7 +385,7 @@ void CardReader::initsd() { SERIAL_ERRORLNPGM(MSG_SD_OPENROOT_FAIL); } else { - cardOK = true; + flag.cardOK = true; SERIAL_ECHO_START(); SERIAL_ECHOLNPGM(MSG_SD_CARD_OK); } @@ -322,8 +393,8 @@ void CardReader::initsd() { } void CardReader::release() { - sdprinting = false; - cardOK = false; + stopSDPrint(); + flag.cardOK = false; } void CardReader::openAndPrintFile(const char *name) { @@ -335,8 +406,8 @@ void CardReader::openAndPrintFile(const char *name) { } void CardReader::startFileprint() { - if (cardOK) { - sdprinting = true; + if (flag.cardOK) { + flag.sdprinting = true; #if SD_RESORT flush_presort(); #endif @@ -351,7 +422,7 @@ void CardReader::stopSDPrint( #if ENABLED(ADVANCED_PAUSE_FEATURE) did_pause_print = 0; #endif - sdprinting = false; + flag.sdprinting = flag.abort_sd_printing = false; if (isFileOpen()) file.close(); #if SD_RESORT if (re_sort) presort(); @@ -359,7 +430,7 @@ void CardReader::stopSDPrint( } void CardReader::openLogFile(char * const path) { - logging = true; + flag.logging = true; openFile(path, false); } @@ -376,7 +447,7 @@ void CardReader::getAbsFilename(char *t) { for (uint8_t i = 0; i < workDirDepth; i++) // Loop to current work dir appendAtom(workDirParents[i], t, cnt); - if (cnt < MAXPATHNAMELENGTH - (FILENAME_LENGTH)) { + if (cnt < MAXPATHNAMELENGTH - (FILENAME_LENGTH) - 1) { // Leave room for filename and nul appendAtom(file, t, cnt); --t; } @@ -385,7 +456,7 @@ void CardReader::getAbsFilename(char *t) { void CardReader::openFile(char * const path, const bool read, const bool subcall/*=false*/) { - if (!cardOK) return; + if (!flag.cardOK) return; uint8_t doing = 0; if (isFileOpen()) { // Replacing current file or doing a subroutine @@ -394,7 +465,7 @@ void CardReader::openFile(char * const path, const bool read, const bool subcall SERIAL_ERROR_START(); SERIAL_ERRORPGM("trying to call sub-gcode files with too many levels. MAX level is:"); SERIAL_ERRORLN((int)SD_PROCEDURE_DEPTH); - kill(PSTR(MSG_KILLED)); + kill(); return; } @@ -442,7 +513,7 @@ void CardReader::openFile(char * const path, const bool read, const bool subcall SERIAL_PROTOCOLLNPGM(MSG_SD_FILE_SELECTED); getfilename(0, fname); - lcd_setstatus(longFilename[0] ? longFilename : fname); + ui.set_status(longFilename[0] ? longFilename : fname); //if (longFilename[0]) { // SERIAL_PROTOCOLPAIR(MSG_SD_FILE_LONG_NAME, longFilename); //} @@ -460,17 +531,21 @@ void CardReader::openFile(char * const path, const bool read, const bool subcall SERIAL_EOL(); } else { - saving = true; - SERIAL_PROTOCOLLNPAIR(MSG_SD_WRITE_TO_FILE, path); - lcd_setstatus(fname); + flag.saving = true; + getfilename(0, fname); + #if ENABLED(EMERGENCY_PARSER) + emergency_parser.disable(); + #endif + SERIAL_PROTOCOLLNPAIR(MSG_SD_WRITE_TO_FILE, fname); + ui.set_status(fname); } } } void CardReader::removeFile(const char * const name) { - if (!cardOK) return; + if (!flag.cardOK) return; - stopSDPrint(); + //stopSDPrint(); SdFile *curDir; const char * const fname = diveToFile(curDir, name, false); @@ -496,7 +571,7 @@ void CardReader::getStatus( const int8_t port/*= -1*/ #endif ) { - if (cardOK && sdprinting) { + if (flag.cardOK && flag.sdprinting) { SERIAL_PROTOCOLPGM_P(port, MSG_SD_PRINTING_BYTE); SERIAL_PROTOCOL_P(port, sdpos); SERIAL_PROTOCOLCHAR_P(port, '/'); @@ -535,17 +610,17 @@ void CardReader::write_command(char *buf) { void CardReader::checkautostart() { - if (autostart_index < 0 || sdprinting) return; + if (autostart_index < 0 || flag.sdprinting) return; - if (!cardOK) initsd(); + if (!flag.cardOK) initsd(); - if (cardOK + if (flag.cardOK #if ENABLED(POWER_LOSS_RECOVERY) - && !jobRecoverFileExists() // Don't run auto#.g when a resume file exists + && !recovery.valid() // Don't run auto#.g when a resume file exists #endif ) { - char autoname[10]; - sprintf_P(autoname, PSTR("auto%i.g"), int(autostart_index)); + char autoname[8]; + sprintf_P(autoname, PSTR("auto%c.g"), autostart_index + '0'); dir_t p; root.rewind(); while (root.readDir(&p, NULL) > 0) { @@ -568,7 +643,11 @@ void CardReader::beginautostart() { void CardReader::closefile(const bool store_location) { file.sync(); file.close(); - saving = logging = false; + flag.saving = flag.logging = false; + sdpos = 0; + #if ENABLED(EMERGENCY_PARSER) + emergency_parser.enable(); + #endif if (store_location) { //future: store printer state, filename and position for continuing a stopped print @@ -591,7 +670,7 @@ void CardReader::getfilename(uint16_t nr, const char * const match/*=NULL*/) { if (nr < sort_count) { strcpy(filename, sortshort[nr]); strcpy(longFilename, sortnames[nr]); - filenameIsDir = TEST(isDir[nr>>3], nr & 0x07); + flag.filenameIsDir = TEST(isDir[nr>>3], nr & 0x07); return; } #endif // SDSORT_CACHE_NAMES @@ -611,8 +690,12 @@ uint16_t CardReader::getnrfilenames() { } /** - * Dive to the given file path, with optional echo. - * On exit set curDir and return the name part of the path. + * Dive to the given DOS 8.3 file path, with optional echo of the dive paths. + * + * On exit, curDir contains an SdFile reference to the file's directory. + * + * Returns a pointer to the last segment (filename) of the given DOS 8.3 path. + * * A NULL result indicates an unrecoverable error. */ const char* CardReader::diveToFile(SdFile*& curDir, const char * const path, const bool echo) { @@ -696,6 +779,33 @@ void CardReader::setroot() { ); } + #if ENABLED(SDSORT_USES_RAM) + #if ENABLED(SDSORT_DYNAMIC_RAM) + // Use dynamic method to copy long filename + #define SET_SORTNAME(I) (sortnames[I] = strdup(longest_filename())) + #if ENABLED(SDSORT_CACHE_NAMES) + // When caching also store the short name, since + // we're replacing the getfilename() behavior. + #define SET_SORTSHORT(I) (sortshort[I] = strdup(filename)) + #else + #define SET_SORTSHORT(I) NOOP + #endif + #else + // Copy filenames into the static array + #if SORTED_LONGNAME_MAXLEN != LONG_FILENAME_LENGTH + #define SET_SORTNAME(I) do{ strncpy(sortnames[I], longest_filename(), SORTED_LONGNAME_MAXLEN); \ + sortnames[I][SORTED_LONGNAME_MAXLEN] = '\0'; }while(0) + #else + #define SET_SORTNAME(I) strncpy(sortnames[I], longest_filename(), SORTED_LONGNAME_MAXLEN) + #endif + #if ENABLED(SDSORT_CACHE_NAMES) + #define SET_SORTSHORT(I) strcpy(sortshort[I], filename) + #else + #define SET_SORTSHORT(I) NOOP + #endif + #endif + #endif + /** * Read all the files and produce a sort key * @@ -755,7 +865,7 @@ void CardReader::setroot() { // By default re-read the names from SD for every compare // retaining only two filenames at a time. This is very // slow but is safest and uses minimal RAM. - char name1[LONG_FILENAME_LENGTH + 1]; + char name1[LONG_FILENAME_LENGTH]; #endif @@ -767,33 +877,15 @@ void CardReader::setroot() { // If using RAM then read all filenames now. #if ENABLED(SDSORT_USES_RAM) getfilename(i); - #if ENABLED(SDSORT_DYNAMIC_RAM) - // Use dynamic method to copy long filename - sortnames[i] = strdup(longest_filename()); - #if ENABLED(SDSORT_CACHE_NAMES) - // When caching also store the short name, since - // we're replacing the getfilename() behavior. - sortshort[i] = strdup(filename); - #endif - #else - // Copy filenames into the static array - #if SORTED_LONGNAME_MAXLEN != LONG_FILENAME_LENGTH - strncpy(sortnames[i], longest_filename(), SORTED_LONGNAME_MAXLEN); - sortnames[i][SORTED_LONGNAME_MAXLEN - 1] = '\0'; - #else - strncpy(sortnames[i], longest_filename(), SORTED_LONGNAME_MAXLEN); - #endif - #if ENABLED(SDSORT_CACHE_NAMES) - strcpy(sortshort[i], filename); - #endif - #endif + SET_SORTNAME(i); + SET_SORTSHORT(i); // char out[30]; - // sprintf_P(out, PSTR("---- %i %s %s"), i, filenameIsDir ? "D" : " ", sortnames[i]); + // sprintf_P(out, PSTR("---- %i %s %s"), i, flag.filenameIsDir ? "D" : " ", sortnames[i]); // SERIAL_ECHOLN(out); #if HAS_FOLDER_SORTING const uint16_t bit = i & 0x07, ind = i >> 3; if (bit == 0) isDir[ind] = 0x00; - if (filenameIsDir) isDir[ind] |= _BV(bit); + if (flag.filenameIsDir) isDir[ind] |= _BV(bit); #endif #endif } @@ -821,7 +913,7 @@ void CardReader::setroot() { ? _SORT_CMP_NODIR() \ : (isDir[fs > 0 ? ind1 : ind2] & (fs > 0 ? _BV(bit1) : _BV(bit2))) != 0) #else - #define _SORT_CMP_DIR(fs) ((dir1 == filenameIsDir) ? _SORT_CMP_NODIR() : (fs > 0 ? dir1 : !dir1)) + #define _SORT_CMP_DIR(fs) ((dir1 == flag.filenameIsDir) ? _SORT_CMP_NODIR() : (fs > 0 ? dir1 : !dir1)) #endif #endif @@ -831,7 +923,7 @@ void CardReader::setroot() { getfilename(o1); strcpy(name1, longest_filename()); // save (or getfilename below will trounce it) #if HAS_FOLDER_SORTING - bool dir1 = filenameIsDir; + bool dir1 = flag.filenameIsDir; #endif getfilename(o2); char *name2 = longest_filename(); // use the string in-place @@ -869,27 +961,17 @@ void CardReader::setroot() { else { sort_order[0] = 0; #if ENABLED(SDSORT_USES_RAM) && ENABLED(SDSORT_CACHE_NAMES) - getfilename(0); #if ENABLED(SDSORT_DYNAMIC_RAM) sortnames = new char*[1]; - sortnames[0] = strdup(longest_filename()); // malloc #if ENABLED(SDSORT_CACHE_NAMES) sortshort = new char*[1]; - sortshort[0] = strdup(filename); // malloc #endif isDir = new uint8_t[1]; - #else - #if SORTED_LONGNAME_MAXLEN != LONG_FILENAME_LENGTH - strncpy(sortnames[0], longest_filename(), SORTED_LONGNAME_MAXLEN); - sortnames[0][SORTED_LONGNAME_MAXLEN - 1] = '\0'; - #else - strncpy(sortnames[0], longest_filename(), SORTED_LONGNAME_MAXLEN); - #endif - #if ENABLED(SDSORT_CACHE_NAMES) - strcpy(sortshort[0], filename); - #endif #endif - isDir[0] = filenameIsDir ? 0x01 : 0x00; + getfilename(0); + SET_SORTNAME(0); + SET_SORTSHORT(0); + isDir[0] = flag.filenameIsDir ? 0x01 : 0x00; #endif } @@ -936,7 +1018,7 @@ void CardReader::printingHasFinished() { startFileprint(); } else { - sdprinting = false; + stopSDPrint(); #if ENABLED(POWER_LOSS_RECOVERY) removeJobRecoveryFile(); @@ -952,10 +1034,10 @@ void CardReader::printingHasFinished() { presort(); #endif #if ENABLED(ULTRA_LCD) && ENABLED(LCD_SET_PROGRESS_MANUALLY) - progress_bar_percent = 0; + ui.progress_bar_percent = 0; #endif #if ENABLED(SD_REPRINT_LAST_SELECTED_FILE) - lcd_reselect_last_file(); + ui.reselect_last_file(); #endif } } @@ -982,12 +1064,18 @@ void CardReader::printingHasFinished() { #if ENABLED(POWER_LOSS_RECOVERY) - char job_recovery_file_name[4] = "bin"; + constexpr char job_recovery_file_name[4] = "BIN"; + + bool CardReader::jobRecoverFileExists() { + const bool exists = recovery.file.open(&root, job_recovery_file_name, O_READ); + if (exists) recovery.file.close(); + return exists; + } void CardReader::openJobRecoveryFile(const bool read) { - if (!cardOK) return; - if (jobRecoveryFile.isOpen()) return; - if (!jobRecoveryFile.open(&root, job_recovery_file_name, read ? O_READ : O_CREAT | O_WRITE | O_TRUNC | O_SYNC)) { + if (!flag.cardOK) return; + if (recovery.file.isOpen()) return; + if (!recovery.file.open(&root, job_recovery_file_name, read ? O_READ : O_CREAT | O_WRITE | O_TRUNC | O_SYNC)) { SERIAL_PROTOCOLPAIR(MSG_SD_OPEN_FILE_FAIL, job_recovery_file_name); SERIAL_PROTOCOLCHAR('.'); SERIAL_EOL(); @@ -996,31 +1084,12 @@ void CardReader::printingHasFinished() { SERIAL_PROTOCOLLNPAIR(MSG_SD_WRITE_TO_FILE, job_recovery_file_name); } - void CardReader::closeJobRecoveryFile() { jobRecoveryFile.close(); } - - bool CardReader::jobRecoverFileExists() { - const bool exists = jobRecoveryFile.open(&root, job_recovery_file_name, O_READ); - if (exists) jobRecoveryFile.close(); - return exists; - } - - int16_t CardReader::saveJobRecoveryInfo() { - jobRecoveryFile.seekSet(0); - const int16_t ret = jobRecoveryFile.write(&job_recovery_info, sizeof(job_recovery_info)); - #if ENABLED(DEBUG_POWER_LOSS_RECOVERY) - if (ret == -1) SERIAL_PROTOCOLLNPGM("Power-loss file write failed."); - #endif - return ret; - } - - int16_t CardReader::loadJobRecoveryInfo() { - return jobRecoveryFile.read(&job_recovery_info, sizeof(job_recovery_info)); - } - + // Removing the job recovery file currently requires closing + // the file being printed, so during SD printing the file should + // be zeroed and written instead of deleted. void CardReader::removeJobRecoveryFile() { - job_recovery_info.valid_head = job_recovery_info.valid_foot = job_recovery_commands_count = 0; if (jobRecoverFileExists()) { - closefile(); + //closefile(); removeFile(job_recovery_file_name); #if ENABLED(DEBUG_POWER_LOSS_RECOVERY) SERIAL_PROTOCOLPGM("Power-loss file delete"); diff --git a/Marlin/src/sd/cardreader.h b/Marlin/src/sd/cardreader.h index 8e29bd9a6f..b9c71875c8 100644 --- a/Marlin/src/sd/cardreader.h +++ b/Marlin/src/sd/cardreader.h @@ -19,9 +19,7 @@ * along with this program. If not, see . * */ - -#ifndef _CARDREADER_H_ -#define _CARDREADER_H_ +#pragma once #include "../inc/MarlinConfig.h" @@ -29,108 +27,121 @@ #define SD_RESORT ENABLED(SDCARD_SORT_ALPHA) && ENABLED(SDSORT_DYNAMIC_RAM) -#define MAX_DIR_DEPTH 10 // Maximum folder depth +#define MAX_DIR_DEPTH 10 // Maximum folder depth +#define MAXDIRNAMELENGTH 8 // DOS folder name size +#define MAXPATHNAMELENGTH (1 + (MAXDIRNAMELENGTH + 1) * (MAX_DIR_DEPTH) + 1 + FILENAME_LENGTH) // "/" + N * ("ADIRNAME/") + "filename.ext" #include "SdFile.h" +enum LsAction : uint8_t { LS_SerialPrint, LS_Count, LS_GetFilename }; + +typedef struct { + bool saving:1, + logging:1, + sdprinting:1, + cardOK:1, + filenameIsDir:1, + abort_sd_printing:1 + #if ENABLED(FAST_FILE_TRANSFER) + , binary_mode:1 + #endif + ; +} card_flags_t; + class CardReader { public: CardReader(); - void initsd(); - void write_command(char *buf); + static void initsd(); + static void write_command(char *buf); - void beginautostart(); - void checkautostart(); + static void beginautostart(); + static void checkautostart(); - void openFile(char * const path, const bool read, const bool subcall=false); - void openLogFile(char * const path); - void removeFile(const char * const name); - void closefile(const bool store_location=false); - void release(); - void openAndPrintFile(const char *name); - void startFileprint(); - void stopSDPrint( + static void openFile(char * const path, const bool read, const bool subcall=false); + static void openLogFile(char * const path); + static void removeFile(const char * const name); + static void closefile(const bool store_location=false); + static void release(); + static void openAndPrintFile(const char *name); + static void startFileprint(); + static void stopSDPrint( #if SD_RESORT const bool re_sort=false #endif ); - void getStatus( + static void getStatus( #if NUM_SERIAL > 1 const int8_t port = -1 #endif ); - void printingHasFinished(); - void printFilename( + static void printingHasFinished(); + static void printFilename( #if NUM_SERIAL > 1 const int8_t port = -1 #endif ); #if ENABLED(LONG_FILENAME_HOST_SUPPORT) - void printLongPath(char *path + static void printLongPath(char *path #if NUM_SERIAL > 1 , const int8_t port = -1 #endif ); #endif - void getfilename(uint16_t nr, const char* const match=NULL); - uint16_t getnrfilenames(); + static void getfilename(uint16_t nr, const char* const match=NULL); + static uint16_t getnrfilenames(); - void getAbsFilename(char *t); + static void getAbsFilename(char *t); - void ls( + static void ls( #if NUM_SERIAL > 1 const int8_t port = -1 #endif ); - void chdir(const char *relpath); - int8_t updir(); - void setroot(); + static void chdir(const char *relpath); + static int8_t updir(); + static void setroot(); - const char* diveToFile(SdFile*& curDir, const char * const path, const bool echo); + static const char* diveToFile(SdFile*& curDir, const char * const path, const bool echo); - uint16_t get_num_Files(); + static uint16_t get_num_Files(); #if ENABLED(SDCARD_SORT_ALPHA) - void presort(); - void getfilename_sorted(const uint16_t nr); + static void presort(); + static void getfilename_sorted(const uint16_t nr); #if ENABLED(SDSORT_GCODE) - FORCE_INLINE void setSortOn(bool b) { sort_alpha = b; presort(); } - FORCE_INLINE void setSortFolders(int i) { sort_folders = i; presort(); } - //FORCE_INLINE void setSortReverse(bool b) { sort_reverse = b; } + FORCE_INLINE static void setSortOn(bool b) { sort_alpha = b; presort(); } + FORCE_INLINE static void setSortFolders(int i) { sort_folders = i; presort(); } + //FORCE_INLINE static void setSortReverse(bool b) { sort_reverse = b; } #endif + #else + FORCE_INLINE static void getfilename_sorted(const uint16_t nr) { getfilename(nr); } #endif #if ENABLED(POWER_LOSS_RECOVERY) - void openJobRecoveryFile(const bool read); - void closeJobRecoveryFile(); - bool jobRecoverFileExists(); - int16_t saveJobRecoveryInfo(); - int16_t loadJobRecoveryInfo(); - void removeJobRecoveryFile(); + static bool jobRecoverFileExists(); + static void openJobRecoveryFile(const bool read); + static void removeJobRecoveryFile(); #endif - FORCE_INLINE void pauseSDPrint() { sdprinting = false; } - FORCE_INLINE bool isFileOpen() { return file.isOpen(); } - FORCE_INLINE bool eof() { return sdpos >= filesize; } - FORCE_INLINE int16_t get() { sdpos = file.curPosition(); return (int16_t)file.read(); } - FORCE_INLINE void setIndex(const uint32_t index) { sdpos = index; file.seekSet(index); } - FORCE_INLINE uint32_t getIndex() { return sdpos; } - FORCE_INLINE uint8_t percentDone() { return (isFileOpen() && filesize) ? sdpos / ((filesize + 99) / 100) : 0; } - FORCE_INLINE char* getWorkDirName() { workDir.getFilename(filename); return filename; } + static inline void pauseSDPrint() { flag.sdprinting = false; } + static inline bool isFileOpen() { return file.isOpen(); } + static inline bool eof() { return sdpos >= filesize; } + static inline int16_t get() { sdpos = file.curPosition(); return (int16_t)file.read(); } + static inline void setIndex(const uint32_t index) { sdpos = index; file.seekSet(index); } + static inline uint32_t getIndex() { return sdpos; } + static inline uint8_t percentDone() { return (isFileOpen() && filesize) ? sdpos / ((filesize + 99) / 100) : 0; } + static inline char* getWorkDirName() { workDir.getFilename(filename); return filename; } + static inline int16_t read(void* buf, uint16_t nbyte) { return file.isOpen() ? file.read(buf, nbyte) : -1; } + static inline int16_t write(void* buf, uint16_t nbyte) { return file.isOpen() ? file.write(buf, nbyte) : -1; } - #if defined(__STM32F1__) && ENABLED(EEPROM_SETTINGS) && DISABLED(FLASH_EEPROM_EMULATION) - FORCE_INLINE int16_t read(void* buf, uint16_t nbyte) { return file.isOpen() ? file.read(buf, nbyte) : -1; } - FORCE_INLINE int16_t write(void* buf, uint16_t nbyte) { return file.isOpen() ? file.write(buf, nbyte) : -1; } - #endif - - Sd2Card& getSd2Card() { return sd2card; } + static Sd2Card& getSd2Card() { return sd2card; } #if ENABLED(AUTO_REPORT_SD_STATUS) - void auto_report_sd_status(void); - FORCE_INLINE void set_auto_report_interval(uint8_t v + static void auto_report_sd_status(void); + static inline void set_auto_report_interval(uint8_t v #if NUM_SERIAL > 1 , int8_t port #endif @@ -144,30 +155,39 @@ public: } #endif - FORCE_INLINE char* longest_filename() { return longFilename[0] ? longFilename : filename; } + static inline char* longest_filename() { return longFilename[0] ? longFilename : filename; } public: - bool saving, logging, sdprinting, cardOK, filenameIsDir; - char filename[FILENAME_LENGTH], longFilename[LONG_FILENAME_LENGTH]; - int8_t autostart_index; + static card_flags_t flag; + static char filename[FILENAME_LENGTH], longFilename[LONG_FILENAME_LENGTH]; + static int8_t autostart_index; + + #if ENABLED(FAST_FILE_TRANSFER) + #if NUM_SERIAL > 1 + static uint8_t transfer_port; + #else + static constexpr uint8_t transfer_port = 0; + #endif + #endif + private: - SdFile root, workDir, workDirParents[MAX_DIR_DEPTH]; - uint8_t workDirDepth; + static SdFile root, workDir, workDirParents[MAX_DIR_DEPTH]; + static uint8_t workDirDepth; // Sort files and folders alphabetically. #if ENABLED(SDCARD_SORT_ALPHA) - uint16_t sort_count; // Count of sorted items in the current directory + static uint16_t sort_count; // Count of sorted items in the current directory #if ENABLED(SDSORT_GCODE) - bool sort_alpha; // Flag to enable / disable the feature - int sort_folders; // Flag to enable / disable folder sorting - //bool sort_reverse; // Flag to enable / disable reverse sorting + static bool sort_alpha; // Flag to enable / disable the feature + static int sort_folders; // Folder sorting before/none/after + //static bool sort_reverse; // Flag to enable / disable reverse sorting #endif // By default the sort index is static #if ENABLED(SDSORT_DYNAMIC_RAM) - uint8_t *sort_order; + static uint8_t *sort_order; #else - uint8_t sort_order[SDSORT_LIMIT]; + static uint8_t sort_order[SDSORT_LIMIT]; #endif #if ENABLED(SDSORT_USES_RAM) && ENABLED(SDSORT_CACHE_NAMES) && DISABLED(SDSORT_DYNAMIC_RAM) @@ -182,21 +202,21 @@ private: // If using dynamic ram for names, allocate on the heap. #if ENABLED(SDSORT_CACHE_NAMES) #if ENABLED(SDSORT_DYNAMIC_RAM) - char **sortshort, **sortnames; + static char **sortshort, **sortnames; #else - char sortshort[SDSORT_LIMIT][FILENAME_LENGTH]; - char sortnames[SDSORT_LIMIT][SORTED_LONGNAME_MAXLEN]; + static char sortshort[SDSORT_LIMIT][FILENAME_LENGTH]; + static char sortnames[SDSORT_LIMIT][SORTED_LONGNAME_MAXLEN]; #endif #elif DISABLED(SDSORT_USES_STACK) - char sortnames[SDSORT_LIMIT][SORTED_LONGNAME_MAXLEN]; + static char sortnames[SDSORT_LIMIT][SORTED_LONGNAME_MAXLEN]; #endif // Folder sorting uses an isDir array when caching items. #if HAS_FOLDER_SORTING #if ENABLED(SDSORT_DYNAMIC_RAM) - uint8_t *isDir; + static uint8_t *isDir; #elif ENABLED(SDSORT_CACHE_NAMES) || DISABLED(SDSORT_USES_STACK) - uint8_t isDir[(SDSORT_LIMIT+7)>>3]; + static uint8_t isDir[(SDSORT_LIMIT+7)>>3]; #endif #endif @@ -204,32 +224,31 @@ private: #endif // SDCARD_SORT_ALPHA - Sd2Card sd2card; - SdVolume volume; - SdFile file; + static Sd2Card sd2card; + static SdVolume volume; + static SdFile file; - #if ENABLED(POWER_LOSS_RECOVERY) - SdFile jobRecoveryFile; + #ifndef SD_PROCEDURE_DEPTH + #define SD_PROCEDURE_DEPTH 1 #endif - #define SD_PROCEDURE_DEPTH 1 - #define MAXPATHNAMELENGTH (FILENAME_LENGTH*MAX_DIR_DEPTH + MAX_DIR_DEPTH + 1) - uint8_t file_subcall_ctr; - uint32_t filespos[SD_PROCEDURE_DEPTH]; - char proc_filenames[SD_PROCEDURE_DEPTH][MAXPATHNAMELENGTH]; - uint32_t filesize, sdpos; + static uint8_t file_subcall_ctr; + static uint32_t filespos[SD_PROCEDURE_DEPTH]; + static char proc_filenames[SD_PROCEDURE_DEPTH][MAXPATHNAMELENGTH]; - LsAction lsAction; //stored for recursion. - uint16_t nrFiles; //counter for the files in the current directory and recycled as position counter for getting the nrFiles'th name in the directory. - char* diveDirName; - void lsDive(const char *prepend, SdFile parent, const char * const match=NULL + static uint32_t filesize, sdpos; + + static LsAction lsAction; //stored for recursion. + static uint16_t nrFiles; //counter for the files in the current directory and recycled as position counter for getting the nrFiles'th name in the directory. + static char *diveDirName; + static void lsDive(const char *prepend, SdFile parent, const char * const match=NULL #if NUM_SERIAL > 1 , const int8_t port = -1 #endif ); #if ENABLED(SDCARD_SORT_ALPHA) - void flush_presort(); + static void flush_presort(); #endif #if ENABLED(AUTO_REPORT_SD_STATUS) @@ -241,27 +260,27 @@ private: #endif }; -#if PIN_EXISTS(SD_DETECT) +#if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define IS_SD_INSERTED() Sd2Card::isInserted() +#elif PIN_EXISTS(SD_DETECT) #if ENABLED(SD_DETECT_INVERTED) - #define IS_SD_INSERTED (READ(SD_DETECT_PIN) == HIGH) + #define IS_SD_INSERTED() READ(SD_DETECT_PIN) #else - #define IS_SD_INSERTED (READ(SD_DETECT_PIN) == LOW) + #define IS_SD_INSERTED() !READ(SD_DETECT_PIN) #endif #else // No card detect line? Assume the card is inserted. - #define IS_SD_INSERTED true + #define IS_SD_INSERTED() true #endif +#define IS_SD_PRINTING() card.flag.sdprinting +#define IS_SD_FILE_OPEN() card.isFileOpen() + extern CardReader card; -#endif // SDSUPPORT +#else // !SDSUPPORT -#if ENABLED(SDSUPPORT) - #define IS_SD_PRINTING (card.sdprinting) - #define IS_SD_FILE_OPEN (card.isFileOpen()) -#else - #define IS_SD_PRINTING (false) - #define IS_SD_FILE_OPEN (false) -#endif +#define IS_SD_PRINTING() false +#define IS_SD_FILE_OPEN() false -#endif // _CARDREADER_H_ +#endif // !SDSUPPORT diff --git a/Marlin/src/sd/usb_flashdrive/SOURCES.txt b/Marlin/src/sd/usb_flashdrive/SOURCES.txt new file mode 100644 index 0000000000..66f170a203 --- /dev/null +++ b/Marlin/src/sd/usb_flashdrive/SOURCES.txt @@ -0,0 +1,48 @@ + +==== SUMMARY ==== + +Source Path: Repository: License: +------------ ----------- -------- +usb_flashdrive/lib github.com/felis/USB_Host_Shield_2.0 GPLv2 or later +usb_flashdrive/lib/masstorage.cpp [1] github.com/greiman/UsbFat MIT +usb_flashdrive/lib/settings.h [1] github.com/greiman/UsbFat MIT + +[1] Changes related to SKIP_WRITE_PROTECT and DELAY only + + +==== USB HOST SHIELD 2.0 LIBRARY ==== + +The lib/ folder contains a subset of the files from the USB Host Shield 2.0 +library: + + https://github.com/felis/USB_Host_Shield_2.0 + +While the original library was released under the GPLv2 and could not be +commingled with Marlin, the developers have graciously re-licenced the +files needed for Marlin as "GPLv2 or later", as documented in this thread. + + https://github.com/felis/USB_Host_Shield_2.0/issues/364 + +Small modifications have been made to the source. Please search for +USB_FLASH_DRIVE_SUPPORT or look at the patch file to see what was changed. + + +==== PERFORMANCE ENHANCEMENTS FOR USB DRIVES ==== + +There are also some small performance enhancements from Bill Greiman, regarding +SKIP_WRITE_PROTECT and DELAY. These changes came from the following repo: + + https://github.com/greiman/UsbFat + +While the original library was released under the GPLv2 and could not be +commingled with Marlin, the developer has graciously re-licenced his changes +under the "MIT" license, as documented here: + + https://github.com/greiman/UsbFat/issues/8 + +==== MARLIN INTEGRATION WORK ==== + +All additional work done to integrate USB into Marlin was performed by AlephObjects, Inc. +and is licensed under the GPLv3. + +-- marcio@alephobjects.com diff --git a/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.cpp b/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.cpp new file mode 100644 index 0000000000..f4fda4b3c9 --- /dev/null +++ b/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.cpp @@ -0,0 +1,156 @@ +/** + * 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 "../../inc/MarlinConfigPre.h" + +#if ENABLED(USB_FLASH_DRIVE_SUPPORT) + +#include "../../core/serial.h" + +#include "lib/Usb.h" +#include "lib/masstorage.h" + +#include "Sd2Card_FlashDrive.h" + +USB usb; +BulkOnly bulk(&usb); + +Sd2Card::state_t Sd2Card::state; + +// The USB library needs to be called periodically to detect USB thumbdrive +// insertion and removals. Call this idle() function periodically to allow +// the USB library to monitor for such events. This function also takes care +// of initializing the USB library for the first time. + +void Sd2Card::idle() { + static uint32_t next_retry; + + switch (state) { + case USB_HOST_DELAY_INIT: + next_retry = millis() + 10000; + state = USB_HOST_WAITING; + break; + case USB_HOST_WAITING: + if (ELAPSED(millis(), next_retry)) { + next_retry = millis() + 10000; + state = USB_HOST_UNINITIALIZED; + } + break; + case USB_HOST_UNINITIALIZED: + SERIAL_ECHOLNPGM("Starting USB host"); + if (!usb.start()) { + SERIAL_ECHOLNPGM("USB host failed to start. Will retry in 10 seconds."); + state = USB_HOST_DELAY_INIT; + } + else { + SERIAL_ECHOLNPGM("USB host initialized"); + state = USB_HOST_INITIALIZED; + } + break; + case USB_HOST_INITIALIZED: + const uint8_t lastUsbTaskState = usb.getUsbTaskState(); + usb.Task(); + const uint8_t newUsbTaskState = usb.getUsbTaskState(); + + if (lastUsbTaskState == USB_STATE_RUNNING && newUsbTaskState != USB_STATE_RUNNING) { + // the user pulled the flash drive. Make sure the bulk storage driver releases the address + #ifdef USB_DEBUG + SERIAL_ECHOLNPGM("USB drive removed"); + #endif + //bulk.Release(); + } + if (lastUsbTaskState != USB_STATE_RUNNING && newUsbTaskState == USB_STATE_RUNNING) { + #ifdef USB_DEBUG + SERIAL_ECHOLNPGM("USB drive inserted"); + #endif + } + break; + } +} + +// Marlin calls this function to check whether an USB drive is inserted. +// This is equivalent to polling the SD_DETECT when using SD cards. +bool Sd2Card::isInserted() { + return usb.getUsbTaskState() == USB_STATE_RUNNING; +}; + +// Marlin calls this to initialize an SD card once it is inserted. +bool Sd2Card::init(uint8_t sckRateID, uint8_t chipSelectPin) { + if (!ready()) return false; + + if (!bulk.LUNIsGood(0)) { + SERIAL_ECHOLNPGM("LUN zero is not good"); + return false; + } + + const uint32_t sectorSize = bulk.GetSectorSize(0); + if (sectorSize != 512) { + SERIAL_ECHOLNPAIR("Expecting sector size of 512, got:", sectorSize); + return false; + } + + #ifdef USB_DEBUG + lun0_capacity = bulk.GetCapacity(0); + SERIAL_ECHOLNPAIR("LUN Capacity (in blocks): ", lun0_capacity); + #endif + return true; +} + +// Returns the capacity of the card in blocks. +uint32_t Sd2Card::cardSize() { + if (!ready()) return 0; + #ifndef USB_DEBUG + const uint32_t + #endif + lun0_capacity = bulk.GetCapacity(0); + return lun0_capacity; +} + +bool Sd2Card::readBlock(uint32_t block, uint8_t* dst) { + if (!ready()) return false; + #ifdef USB_DEBUG + if (block >= lun0_capacity) { + SERIAL_ECHOLNPAIR("Attempt to read past end of LUN: ", block); + return false; + } + #if USB_DEBUG > 1 + SERIAL_ECHOLNPAIR("Read block ", block); + #endif + #endif + return bulk.Read(0, block, 512, 1, dst) == 0; +} + +bool Sd2Card::writeBlock(uint32_t block, const uint8_t* src) { + if (!ready()) return false; + #ifdef USB_DEBUG + if (block >= lun0_capacity) { + SERIAL_ECHOLNPAIR("Attempt to write past end of LUN: ", block); + return false; + } + #if USB_DEBUG > 1 + SERIAL_ECHOLNPAIR("Write block ", block); + #endif + #endif + return bulk.Write(0, block, 512, 1, src) == 0; +} + +#endif // USB_FLASH_DRIVE_SUPPORT diff --git a/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.h b/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.h new file mode 100644 index 0000000000..ee044a19b6 --- /dev/null +++ b/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.h @@ -0,0 +1,99 @@ +/** + * 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 . + * + */ +#pragma once + +/** + * \file + * \brief Sd2Card class for V2 SD/SDHC cards + */ + +/* Uncomment USB_DEBUG to enable debugging. + * 1 - basic debugging and bounds checking + * 2 - print each block access + */ +//#define USB_DEBUG 1 + + +#include "../SdFatConfig.h" +#include "../SdInfo.h" + +/** + * define SOFTWARE_SPI to use bit-bang SPI + */ +#if MEGA_SOFT_SPI || USE_SOFTWARE_SPI + #define SOFTWARE_SPI +#endif + +// SPI pin definitions - do not edit here - change in SdFatConfig.h +#if DISABLED(SOFTWARE_SPI) + // hardware pin defs + #define SD_CHIP_SELECT_PIN SS_PIN // The default chip select pin for the SD card is SS. + // The following three pins must not be redefined for hardware SPI. + #define SPI_MOSI_PIN MOSI_PIN // SPI Master Out Slave In pin + #define SPI_MISO_PIN MISO_PIN // SPI Master In Slave Out pin + #define SPI_SCK_PIN SCK_PIN // SPI Clock pin +#else // SOFTWARE_SPI + #define SD_CHIP_SELECT_PIN SOFT_SPI_CS_PIN // SPI chip select pin + #define SPI_MOSI_PIN SOFT_SPI_MOSI_PIN // SPI Master Out Slave In pin + #define SPI_MISO_PIN SOFT_SPI_MISO_PIN // SPI Master In Slave Out pin + #define SPI_SCK_PIN SOFT_SPI_SCK_PIN // SPI Clock pin +#endif // SOFTWARE_SPI + +class Sd2Card { + private: + + typedef enum { + USB_HOST_DELAY_INIT, + USB_HOST_WAITING, + USB_HOST_UNINITIALIZED, + USB_HOST_INITIALIZED + } state_t; + + static state_t state; + + uint32_t pos; + #ifdef USB_DEBUG + uint32_t lun0_capacity; + #endif + + static inline bool ready() {return state == USB_HOST_INITIALIZED;} + + public: + bool init(uint8_t sckRateID = 0, uint8_t chipSelectPin = SD_CHIP_SELECT_PIN); + + static void idle(); + + bool readStart(uint32_t block) { pos = block; return ready(); } + bool readData(uint8_t* dst) { return readBlock(pos++, dst); } + bool readStop() { return true; } + + bool writeStart(uint32_t block, uint32_t eraseCount) { pos = block; return ready(); } + bool writeData(uint8_t* src) { return writeBlock(pos++, src); } + bool writeStop() { return true; } + + + bool readBlock(uint32_t block, uint8_t* dst); + bool writeBlock(uint32_t blockNumber, const uint8_t* src); + + uint32_t cardSize(); + static bool isInserted(); +}; diff --git a/Marlin/src/sd/usb_flashdrive/lib/Usb.cpp b/Marlin/src/sd/usb_flashdrive/lib/Usb.cpp new file mode 100644 index 0000000000..55774fb045 --- /dev/null +++ b/Marlin/src/sd/usb_flashdrive/lib/Usb.cpp @@ -0,0 +1,832 @@ +/* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. + +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 2 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, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Contact information +------------------- + +Circuits At Home, LTD +Web : http://www.circuitsathome.com +e-mail : support@circuitsathome.com + */ +/* USB functions */ + +#include "../../../inc/MarlinConfigPre.h" + +#if ENABLED(USB_FLASH_DRIVE_SUPPORT) + +#include "Usb.h" + +static uint8_t usb_error = 0; +static uint8_t usb_task_state; + +/* constructor */ +USB::USB() : bmHubPre(0) { + usb_task_state = USB_DETACHED_SUBSTATE_INITIALIZE; //set up state machine + init(); +} + +/* Initialize data structures */ +void USB::init() { + //devConfigIndex = 0; + bmHubPre = 0; +} + +uint8_t USB::getUsbTaskState(void) { + return ( usb_task_state); +} + +void USB::setUsbTaskState(uint8_t state) { + usb_task_state = state; +} + +EpInfo* USB::getEpInfoEntry(uint8_t addr, uint8_t ep) { + UsbDevice *p = addrPool.GetUsbDevicePtr(addr); + + if(!p || !p->epinfo) + return NULL; + + EpInfo *pep = p->epinfo; + + for(uint8_t i = 0; i < p->epcount; i++) { + if((pep)->epAddr == ep) + return pep; + + pep++; + } + return NULL; +} + +/* set device table entry */ + +/* each device is different and has different number of endpoints. This function plugs endpoint record structure, defined in application, to devtable */ +uint8_t USB::setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo* eprecord_ptr) { + if(!eprecord_ptr) + return USB_ERROR_INVALID_ARGUMENT; + + UsbDevice *p = addrPool.GetUsbDevicePtr(addr); + + if(!p) + return USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL; + + p->address.devAddress = addr; + p->epinfo = eprecord_ptr; + p->epcount = epcount; + + return 0; +} + +uint8_t USB::SetAddress(uint8_t addr, uint8_t ep, EpInfo **ppep, uint16_t *nak_limit) { + UsbDevice *p = addrPool.GetUsbDevicePtr(addr); + + if(!p) + return USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL; + + if(!p->epinfo) + return USB_ERROR_EPINFO_IS_NULL; + + *ppep = getEpInfoEntry(addr, ep); + + if(!*ppep) + return USB_ERROR_EP_NOT_FOUND_IN_TBL; + + *nak_limit = (0x0001UL << (((*ppep)->bmNakPower > USB_NAK_MAX_POWER) ? USB_NAK_MAX_POWER : (*ppep)->bmNakPower)); + (*nak_limit)--; + /* + USBTRACE2("\r\nAddress: ", addr); + USBTRACE2(" EP: ", ep); + USBTRACE2(" NAK Power: ",(*ppep)->bmNakPower); + USBTRACE2(" NAK Limit: ", nak_limit); + USBTRACE("\r\n"); + */ + regWr(rPERADDR, addr); //set peripheral address + + uint8_t mode = regRd(rMODE); + + //Serial.print("\r\nMode: "); + //Serial.println( mode, HEX); + //Serial.print("\r\nLS: "); + //Serial.println(p->lowspeed, HEX); + + + + // Set bmLOWSPEED and bmHUBPRE in case of low-speed device, reset them otherwise + regWr(rMODE, (p->lowspeed) ? mode | bmLOWSPEED | bmHubPre : mode & ~(bmHUBPRE | bmLOWSPEED)); + + return 0; +} + +/* Control transfer. Sets address, endpoint, fills control packet with necessary data, dispatches control packet, and initiates bulk IN transfer, */ +/* depending on request. Actual requests are defined as inlines */ +/* return codes: */ +/* 00 = success */ + +/* 01-0f = non-zero HRSLT */ +uint8_t USB::ctrlReq(uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi, + uint16_t wInd, uint16_t total, uint16_t nbytes, uint8_t* dataptr, USBReadParser *p) { + bool direction = false; //request direction, IN or OUT + uint8_t rcode; + SETUP_PKT setup_pkt; + + EpInfo *pep = NULL; + uint16_t nak_limit = 0; + + rcode = SetAddress(addr, ep, &pep, &nak_limit); + + if(rcode) + return rcode; + + direction = ((bmReqType & 0x80) > 0); + + /* fill in setup packet */ + setup_pkt.ReqType_u.bmRequestType = bmReqType; + setup_pkt.bRequest = bRequest; + setup_pkt.wVal_u.wValueLo = wValLo; + setup_pkt.wVal_u.wValueHi = wValHi; + setup_pkt.wIndex = wInd; + setup_pkt.wLength = total; + + bytesWr(rSUDFIFO, 8, (uint8_t*) & setup_pkt); //transfer to setup packet FIFO + + rcode = dispatchPkt(tokSETUP, ep, nak_limit); //dispatch packet + + if(rcode) //return HRSLT if not zero + return ( rcode); + + if(dataptr != NULL) //data stage, if present + { + if(direction) //IN transfer + { + uint16_t left = total; + + pep->bmRcvToggle = 1; //bmRCVTOG1; + + while(left) { + // Bytes read into buffer + uint16_t read = nbytes; + //uint16_t read = (leftbmRcvToggle = (regRd(rHRSL) & bmSNDTOGRD) ? 0 : 1; + continue; + } + + if(rcode) + return rcode; + + // Invoke callback function if inTransfer completed successfully and callback function pointer is specified + if(!rcode && p) + ((USBReadParser*)p)->Parse(read, dataptr, total - left); + + left -= read; + + if(read < nbytes) + break; + } + } else //OUT transfer + { + pep->bmSndToggle = 1; //bmSNDTOG1; + rcode = OutTransfer(pep, nak_limit, nbytes, dataptr); + } + if(rcode) //return error + return ( rcode); + } + // Status stage + return dispatchPkt((direction) ? tokOUTHS : tokINHS, ep, nak_limit); //GET if direction +} + +/* IN transfer to arbitrary endpoint. Assumes PERADDR is set. Handles multiple packets if necessary. Transfers 'nbytes' bytes. */ +/* Keep sending INs and writes data to memory area pointed by 'data' */ + +/* rcode 0 if no errors. rcode 01-0f is relayed from dispatchPkt(). Rcode f0 means RCVDAVIRQ error, + fe USB xfer timeout */ +uint8_t USB::inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t* data, uint8_t bInterval /*= 0*/) { + EpInfo *pep = NULL; + uint16_t nak_limit = 0; + + uint8_t rcode = SetAddress(addr, ep, &pep, &nak_limit); + + if(rcode) { + USBTRACE3("(USB::InTransfer) SetAddress Failed ", rcode, 0x81); + USBTRACE3("(USB::InTransfer) addr requested ", addr, 0x81); + USBTRACE3("(USB::InTransfer) ep requested ", ep, 0x81); + return rcode; + } + return InTransfer(pep, nak_limit, nbytesptr, data, bInterval); +} + +uint8_t USB::InTransfer(EpInfo *pep, uint16_t nak_limit, uint16_t *nbytesptr, uint8_t* data, uint8_t bInterval /*= 0*/) { + uint8_t rcode = 0; + uint8_t pktsize; + + uint16_t nbytes = *nbytesptr; + //printf("Requesting %i bytes ", nbytes); + uint8_t maxpktsize = pep->maxPktSize; + + *nbytesptr = 0; + regWr(rHCTL, (pep->bmRcvToggle) ? bmRCVTOG1 : bmRCVTOG0); //set toggle value + + // use a 'break' to exit this loop + while(1) { + rcode = dispatchPkt(tokIN, pep->epAddr, nak_limit); //IN packet to EP-'endpoint'. Function takes care of NAKS. + if(rcode == hrTOGERR) { + // yes, we flip it wrong here so that next time it is actually correct! + pep->bmRcvToggle = (regRd(rHRSL) & bmRCVTOGRD) ? 0 : 1; + regWr(rHCTL, (pep->bmRcvToggle) ? bmRCVTOG1 : bmRCVTOG0); //set toggle value + continue; + } + if(rcode) { + //printf(">>>>>>>> Problem! dispatchPkt %2.2x\r\n", rcode); + break; //should be 0, indicating ACK. Else return error code. + } + /* check for RCVDAVIRQ and generate error if not present */ + /* the only case when absence of RCVDAVIRQ makes sense is when toggle error occurred. Need to add handling for that */ + if((regRd(rHIRQ) & bmRCVDAVIRQ) == 0) { + //printf(">>>>>>>> Problem! NO RCVDAVIRQ!\r\n"); + rcode = 0xf0; //receive error + break; + } + pktsize = regRd(rRCVBC); //number of received bytes + //printf("Got %i bytes \r\n", pktsize); + // This would be OK, but... + //assert(pktsize <= nbytes); + if(pktsize > nbytes) { + // This can happen. Use of assert on Arduino locks up the Arduino. + // So I will trim the value, and hope for the best. + //printf(">>>>>>>> Problem! Wanted %i bytes but got %i.\r\n", nbytes, pktsize); + pktsize = nbytes; + } + + int16_t mem_left = (int16_t)nbytes - *((int16_t*)nbytesptr); + + if(mem_left < 0) + mem_left = 0; + + data = bytesRd(rRCVFIFO, ((pktsize > mem_left) ? mem_left : pktsize), data); + + regWr(rHIRQ, bmRCVDAVIRQ); // Clear the IRQ & free the buffer + *nbytesptr += pktsize; // add this packet's byte count to total transfer length + + /* The transfer is complete under two conditions: */ + /* 1. The device sent a short packet (L.T. maxPacketSize) */ + /* 2. 'nbytes' have been transferred. */ + if((pktsize < maxpktsize) || (*nbytesptr >= nbytes)) // have we transferred 'nbytes' bytes? + { + // Save toggle value + pep->bmRcvToggle = ((regRd(rHRSL) & bmRCVTOGRD)) ? 1 : 0; + //printf("\r\n"); + rcode = 0; + break; + } else if(bInterval > 0) + delay(bInterval); // Delay according to polling interval + } //while( 1 ) + return ( rcode); +} + +/* OUT transfer to arbitrary endpoint. Handles multiple packets if necessary. Transfers 'nbytes' bytes. */ +/* Handles NAK bug per Maxim Application Note 4000 for single buffer transfer */ + +/* rcode 0 if no errors. rcode 01-0f is relayed from HRSL */ +uint8_t USB::outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* data) { + EpInfo *pep = NULL; + uint16_t nak_limit = 0; + + uint8_t rcode = SetAddress(addr, ep, &pep, &nak_limit); + + if(rcode) + return rcode; + + return OutTransfer(pep, nak_limit, nbytes, data); +} + +uint8_t USB::OutTransfer(EpInfo *pep, uint16_t nak_limit, uint16_t nbytes, uint8_t *data) { + uint8_t rcode = hrSUCCESS, retry_count; + uint8_t *data_p = data; //local copy of the data pointer + uint16_t bytes_tosend, nak_count; + uint16_t bytes_left = nbytes; + + uint8_t maxpktsize = pep->maxPktSize; + + if(maxpktsize < 1 || maxpktsize > 64) + return USB_ERROR_INVALID_MAX_PKT_SIZE; + + uint32_t timeout = (uint32_t)millis() + USB_XFER_TIMEOUT; + + regWr(rHCTL, (pep->bmSndToggle) ? bmSNDTOG1 : bmSNDTOG0); //set toggle value + + while(bytes_left) { + retry_count = 0; + nak_count = 0; + bytes_tosend = (bytes_left >= maxpktsize) ? maxpktsize : bytes_left; + bytesWr(rSNDFIFO, bytes_tosend, data_p); //filling output FIFO + regWr(rSNDBC, bytes_tosend); //set number of bytes + regWr(rHXFR, (tokOUT | pep->epAddr)); //dispatch packet + while(!(regRd(rHIRQ) & bmHXFRDNIRQ)); //wait for the completion IRQ + regWr(rHIRQ, bmHXFRDNIRQ); //clear IRQ + rcode = (regRd(rHRSL) & 0x0f); + + while(rcode && ((int32_t)((uint32_t)millis() - timeout) < 0L)) { + switch(rcode) { + case hrNAK: + nak_count++; + if(nak_limit && (nak_count == nak_limit)) + goto breakout; + //return ( rcode); + break; + case hrTIMEOUT: + retry_count++; + if(retry_count == USB_RETRY_LIMIT) + goto breakout; + //return ( rcode); + break; + case hrTOGERR: + // yes, we flip it wrong here so that next time it is actually correct! + pep->bmSndToggle = (regRd(rHRSL) & bmSNDTOGRD) ? 0 : 1; + regWr(rHCTL, (pep->bmSndToggle) ? bmSNDTOG1 : bmSNDTOG0); //set toggle value + break; + default: + goto breakout; + }//switch( rcode + + /* process NAK according to Host out NAK bug */ + regWr(rSNDBC, 0); + regWr(rSNDFIFO, *data_p); + regWr(rSNDBC, bytes_tosend); + regWr(rHXFR, (tokOUT | pep->epAddr)); //dispatch packet + while(!(regRd(rHIRQ) & bmHXFRDNIRQ)); //wait for the completion IRQ + regWr(rHIRQ, bmHXFRDNIRQ); //clear IRQ + rcode = (regRd(rHRSL) & 0x0f); + }//while( rcode && .... + bytes_left -= bytes_tosend; + data_p += bytes_tosend; + }//while( bytes_left... +breakout: + + pep->bmSndToggle = (regRd(rHRSL) & bmSNDTOGRD) ? 1 : 0; //bmSNDTOG1 : bmSNDTOG0; //update toggle + return ( rcode); //should be 0 in all cases +} +/* dispatch USB packet. Assumes peripheral address is set and relevant buffer is loaded/empty */ +/* If NAK, tries to re-send up to nak_limit times */ +/* If nak_limit == 0, do not count NAKs, exit after timeout */ +/* If bus timeout, re-sends up to USB_RETRY_LIMIT times */ + +/* return codes 0x00-0x0f are HRSLT( 0x00 being success ), 0xff means timeout */ +uint8_t USB::dispatchPkt(uint8_t token, uint8_t ep, uint16_t nak_limit) { + uint32_t timeout = (uint32_t)millis() + USB_XFER_TIMEOUT; + uint8_t tmpdata; + uint8_t rcode = hrSUCCESS; + uint8_t retry_count = 0; + uint16_t nak_count = 0; + + while((int32_t)((uint32_t)millis() - timeout) < 0L) { +#if defined(ESP8266) || defined(ESP32) + yield(); // needed in order to reset the watchdog timer on the ESP8266 +#endif + regWr(rHXFR, (token | ep)); //launch the transfer + rcode = USB_ERROR_TRANSFER_TIMEOUT; + + while((int32_t)((uint32_t)millis() - timeout) < 0L) //wait for transfer completion + { +#if defined(ESP8266) || defined(ESP32) + yield(); // needed in order to reset the watchdog timer on the ESP8266 +#endif + tmpdata = regRd(rHIRQ); + + if(tmpdata & bmHXFRDNIRQ) { + regWr(rHIRQ, bmHXFRDNIRQ); //clear the interrupt + rcode = 0x00; + break; + }//if( tmpdata & bmHXFRDNIRQ + + }//while ( millis() < timeout + + //if (rcode != 0x00) //exit if timeout + // return ( rcode); + + rcode = (regRd(rHRSL) & 0x0f); //analyze transfer result + + switch(rcode) { + case hrNAK: + nak_count++; + if(nak_limit && (nak_count == nak_limit)) + return (rcode); + break; + case hrTIMEOUT: + retry_count++; + if(retry_count == USB_RETRY_LIMIT) + return (rcode); + break; + default: + return (rcode); + }//switch( rcode + + }//while( timeout > millis() + return ( rcode); +} + +/* USB main task. Performs enumeration/cleanup */ +void USB::Task(void) //USB state machine +{ + uint8_t rcode; + uint8_t tmpdata; + static uint32_t delay = 0; + //USB_DEVICE_DESCRIPTOR buf; + bool lowspeed = false; + + MAX3421E::Task(); + + tmpdata = getVbusState(); + + /* modify USB task state if Vbus changed */ + switch(tmpdata) { + case SE1: //illegal state + usb_task_state = USB_DETACHED_SUBSTATE_ILLEGAL; + lowspeed = false; + break; + case SE0: //disconnected + if((usb_task_state & USB_STATE_MASK) != USB_STATE_DETACHED) + usb_task_state = USB_DETACHED_SUBSTATE_INITIALIZE; + lowspeed = false; + break; + case LSHOST: + + lowspeed = true; + //intentional fallthrough + case FSHOST: //attached + if((usb_task_state & USB_STATE_MASK) == USB_STATE_DETACHED) { + delay = (uint32_t)millis() + USB_SETTLE_DELAY; + usb_task_state = USB_ATTACHED_SUBSTATE_SETTLE; + } + break; + }// switch( tmpdata + + for(uint8_t i = 0; i < USB_NUMDEVICES; i++) + if(devConfig[i]) + rcode = devConfig[i]->Poll(); + + switch(usb_task_state) { + case USB_DETACHED_SUBSTATE_INITIALIZE: + init(); + + for(uint8_t i = 0; i < USB_NUMDEVICES; i++) + if(devConfig[i]) + rcode = devConfig[i]->Release(); + + usb_task_state = USB_DETACHED_SUBSTATE_WAIT_FOR_DEVICE; + break; + case USB_DETACHED_SUBSTATE_WAIT_FOR_DEVICE: //just sit here + break; + case USB_DETACHED_SUBSTATE_ILLEGAL: //just sit here + break; + case USB_ATTACHED_SUBSTATE_SETTLE: //settle time for just attached device + if((int32_t)((uint32_t)millis() - delay) >= 0L) + usb_task_state = USB_ATTACHED_SUBSTATE_RESET_DEVICE; + else break; // don't fall through + case USB_ATTACHED_SUBSTATE_RESET_DEVICE: + regWr(rHCTL, bmBUSRST); //issue bus reset + usb_task_state = USB_ATTACHED_SUBSTATE_WAIT_RESET_COMPLETE; + break; + case USB_ATTACHED_SUBSTATE_WAIT_RESET_COMPLETE: + if((regRd(rHCTL) & bmBUSRST) == 0) { + tmpdata = regRd(rMODE) | bmSOFKAENAB; //start SOF generation + regWr(rMODE, tmpdata); + usb_task_state = USB_ATTACHED_SUBSTATE_WAIT_SOF; + //delay = (uint32_t)millis() + 20; //20ms wait after reset per USB spec + } + break; + case USB_ATTACHED_SUBSTATE_WAIT_SOF: //todo: change check order + if(regRd(rHIRQ) & bmFRAMEIRQ) { + //when first SOF received _and_ 20ms has passed we can continue + /* + if (delay < (uint32_t)millis()) //20ms passed + usb_task_state = USB_STATE_CONFIGURING; + */ + usb_task_state = USB_ATTACHED_SUBSTATE_WAIT_RESET; + delay = (uint32_t)millis() + 20; + } + break; + case USB_ATTACHED_SUBSTATE_WAIT_RESET: + if((int32_t)((uint32_t)millis() - delay) >= 0L) usb_task_state = USB_STATE_CONFIGURING; + else break; // don't fall through + case USB_STATE_CONFIGURING: + + //Serial.print("\r\nConf.LS: "); + //Serial.println(lowspeed, HEX); + + rcode = Configuring(0, 0, lowspeed); + + if(rcode) { + if(rcode != USB_DEV_CONFIG_ERROR_DEVICE_INIT_INCOMPLETE) { + usb_error = rcode; + usb_task_state = USB_STATE_ERROR; + } + } else + usb_task_state = USB_STATE_RUNNING; + break; + case USB_STATE_RUNNING: + break; + case USB_STATE_ERROR: + //MAX3421E::Init(); + break; + } // switch( usb_task_state ) +} + +uint8_t USB::DefaultAddressing(uint8_t parent, uint8_t port, bool lowspeed) { + //uint8_t buf[12]; + uint8_t rcode; + UsbDevice *p0 = NULL, *p = NULL; + + // Get pointer to pseudo device with address 0 assigned + p0 = addrPool.GetUsbDevicePtr(0); + + if(!p0) + return USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL; + + if(!p0->epinfo) + return USB_ERROR_EPINFO_IS_NULL; + + p0->lowspeed = (lowspeed) ? true : false; + + // Allocate new address according to device class + uint8_t bAddress = addrPool.AllocAddress(parent, false, port); + + if(!bAddress) + return USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL; + + p = addrPool.GetUsbDevicePtr(bAddress); + + if(!p) + return USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL; + + p->lowspeed = lowspeed; + + // Assign new address to the device + rcode = setAddr(0, 0, bAddress); + + if(rcode) { + addrPool.FreeAddress(bAddress); + bAddress = 0; + return rcode; + } + return 0; +}; + +uint8_t USB::AttemptConfig(uint8_t driver, uint8_t parent, uint8_t port, bool lowspeed) { + //printf("AttemptConfig: parent = %i, port = %i\r\n", parent, port); + uint8_t retries = 0; + +again: + uint8_t rcode = devConfig[driver]->ConfigureDevice(parent, port, lowspeed); + if(rcode == USB_ERROR_CONFIG_REQUIRES_ADDITIONAL_RESET) { + if(parent == 0) { + // Send a bus reset on the root interface. + regWr(rHCTL, bmBUSRST); //issue bus reset + delay(102); // delay 102ms, compensate for clock inaccuracy. + } else { + // reset parent port + devConfig[parent]->ResetHubPort(port); + } + } else if(rcode == hrJERR && retries < 3) { // Some devices returns this when plugged in - trying to initialize the device again usually works + delay(100); + retries++; + goto again; + } else if(rcode) + return rcode; + + rcode = devConfig[driver]->Init(parent, port, lowspeed); + if(rcode == hrJERR && retries < 3) { // Some devices returns this when plugged in - trying to initialize the device again usually works + delay(100); + retries++; + goto again; + } + if(rcode) { + // Issue a bus reset, because the device may be in a limbo state + if(parent == 0) { + // Send a bus reset on the root interface. + regWr(rHCTL, bmBUSRST); //issue bus reset + delay(102); // delay 102ms, compensate for clock inaccuracy. + } else { + // reset parent port + devConfig[parent]->ResetHubPort(port); + } + } + return rcode; +} + +/* + * This is broken. We need to enumerate differently. + * It causes major problems with several devices if detected in an unexpected order. + * + * + * Oleg - I wouldn't do anything before the newly connected device is considered sane. + * i.e.(delays are not indicated for brevity): + * 1. reset + * 2. GetDevDescr(); + * 3a. If ACK, continue with allocating address, addressing, etc. + * 3b. Else reset again, count resets, stop at some number (5?). + * 4. When max.number of resets is reached, toggle power/fail + * If desired, this could be modified by performing two resets with GetDevDescr() in the middle - however, from my experience, if a device answers to GDD() + * it doesn't need to be reset again + * New steps proposal: + * 1: get address pool instance. exit on fail + * 2: pUsb->getDevDescr(0, 0, constBufSize, (uint8_t*)buf). exit on fail. + * 3: bus reset, 100ms delay + * 4: set address + * 5: pUsb->setEpInfoEntry(bAddress, 1, epInfo), exit on fail + * 6: while (configurations) { + * for(each configuration) { + * for (each driver) { + * 6a: Ask device if it likes configuration. Returns 0 on OK. + * If successful, the driver configured device. + * The driver now owns the endpoints, and takes over managing them. + * The following will need codes: + * Everything went well, instance consumed, exit with success. + * Instance already in use, ignore it, try next driver. + * Not a supported device, ignore it, try next driver. + * Not a supported configuration for this device, ignore it, try next driver. + * Could not configure device, fatal, exit with fail. + * } + * } + * } + * 7: for(each driver) { + * 7a: Ask device if it knows this VID/PID. Acts exactly like 6a, but using VID/PID + * 8: if we get here, no driver likes the device plugged in, so exit failure. + * + */ +uint8_t USB::Configuring(uint8_t parent, uint8_t port, bool lowspeed) { + //uint8_t bAddress = 0; + //printf("Configuring: parent = %i, port = %i\r\n", parent, port); + uint8_t devConfigIndex; + uint8_t rcode = 0; + uint8_t buf[sizeof (USB_DEVICE_DESCRIPTOR)]; + USB_DEVICE_DESCRIPTOR *udd = reinterpret_cast(buf); + UsbDevice *p = NULL; + EpInfo *oldep_ptr = NULL; + EpInfo epInfo; + + epInfo.epAddr = 0; + epInfo.maxPktSize = 8; + epInfo.bmSndToggle = 0; + epInfo.bmRcvToggle = 0; + epInfo.bmNakPower = USB_NAK_MAX_POWER; + + //delay(2000); + AddressPool &addrPool = GetAddressPool(); + // Get pointer to pseudo device with address 0 assigned + p = addrPool.GetUsbDevicePtr(0); + if(!p) { + //printf("Configuring error: USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL\r\n"); + return USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL; + } + + // Save old pointer to EP_RECORD of address 0 + oldep_ptr = p->epinfo; + + // Temporary assign new pointer to epInfo to p->epinfo in order to + // avoid toggle inconsistence + + p->epinfo = &epInfo; + + p->lowspeed = lowspeed; + // Get device descriptor + rcode = getDevDescr(0, 0, sizeof (USB_DEVICE_DESCRIPTOR), (uint8_t*)buf); + + // Restore p->epinfo + p->epinfo = oldep_ptr; + + if(rcode) { + //printf("Configuring error: Can't get USB_DEVICE_DESCRIPTOR\r\n"); + return rcode; + } + + // to-do? + // Allocate new address according to device class + //bAddress = addrPool.AllocAddress(parent, false, port); + + uint16_t vid = udd->idVendor; + uint16_t pid = udd->idProduct; + uint8_t klass = udd->bDeviceClass; + uint8_t subklass = udd->bDeviceSubClass; + // Attempt to configure if VID/PID or device class matches with a driver + // Qualify with subclass too. + // + // VID/PID & class tests default to false for drivers not yet ported + // subclass defaults to true, so you don't have to define it if you don't have to. + // + for(devConfigIndex = 0; devConfigIndex < USB_NUMDEVICES; devConfigIndex++) { + if(!devConfig[devConfigIndex]) continue; // no driver + if(devConfig[devConfigIndex]->GetAddress()) continue; // consumed + if(devConfig[devConfigIndex]->DEVSUBCLASSOK(subklass) && (devConfig[devConfigIndex]->VIDPIDOK(vid, pid) || devConfig[devConfigIndex]->DEVCLASSOK(klass))) { + rcode = AttemptConfig(devConfigIndex, parent, port, lowspeed); + if(rcode != USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED) + break; + } + } + + if(devConfigIndex < USB_NUMDEVICES) { + return rcode; + } + + + // blindly attempt to configure + for(devConfigIndex = 0; devConfigIndex < USB_NUMDEVICES; devConfigIndex++) { + if(!devConfig[devConfigIndex]) continue; + if(devConfig[devConfigIndex]->GetAddress()) continue; // consumed + if(devConfig[devConfigIndex]->DEVSUBCLASSOK(subklass) && (devConfig[devConfigIndex]->VIDPIDOK(vid, pid) || devConfig[devConfigIndex]->DEVCLASSOK(klass))) continue; // If this is true it means it must have returned USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED above + rcode = AttemptConfig(devConfigIndex, parent, port, lowspeed); + + //printf("ERROR ENUMERATING %2.2x\r\n", rcode); + if(!(rcode == USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED || rcode == USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE)) { + // in case of an error dev_index should be reset to 0 + // in order to start from the very beginning the + // next time the program gets here + //if (rcode != USB_DEV_CONFIG_ERROR_DEVICE_INIT_INCOMPLETE) + // devConfigIndex = 0; + return rcode; + } + } + // if we get here that means that the device class is not supported by any of registered classes + rcode = DefaultAddressing(parent, port, lowspeed); + + return rcode; +} + +uint8_t USB::ReleaseDevice(uint8_t addr) { + if(!addr) + return 0; + + for(uint8_t i = 0; i < USB_NUMDEVICES; i++) { + if(!devConfig[i]) continue; + if(devConfig[i]->GetAddress() == addr) + return devConfig[i]->Release(); + } + return 0; +} + +#if 1 //!defined(USB_METHODS_INLINE) +//get device descriptor + +uint8_t USB::getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* dataptr) { + return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, 0x00, USB_DESCRIPTOR_DEVICE, 0x0000, nbytes, nbytes, dataptr, NULL)); +} +//get configuration descriptor + +uint8_t USB::getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t* dataptr) { + return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, conf, USB_DESCRIPTOR_CONFIGURATION, 0x0000, nbytes, nbytes, dataptr, NULL)); +} + +/* Requests Configuration Descriptor. Sends two Get Conf Descr requests. The first one gets the total length of all descriptors, then the second one requests this + total length. The length of the first request can be shorter ( 4 bytes ), however, there are devices which won't work unless this length is set to 9 */ +uint8_t USB::getConfDescr(uint8_t addr, uint8_t ep, uint8_t conf, USBReadParser *p) { + const uint8_t bufSize = 64; + uint8_t buf[bufSize]; + USB_CONFIGURATION_DESCRIPTOR *ucd = reinterpret_cast(buf); + + uint8_t ret = getConfDescr(addr, ep, 9, conf, buf); + + if(ret) + return ret; + + uint16_t total = ucd->wTotalLength; + + //USBTRACE2("\r\ntotal conf.size:", total); + + return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, conf, USB_DESCRIPTOR_CONFIGURATION, 0x0000, total, bufSize, buf, p)); +} + +//get string descriptor + +uint8_t USB::getStrDescr(uint8_t addr, uint8_t ep, uint16_t ns, uint8_t index, uint16_t langid, uint8_t* dataptr) { + return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, index, USB_DESCRIPTOR_STRING, langid, ns, ns, dataptr, NULL)); +} +//set address + +uint8_t USB::setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr) { + uint8_t rcode = ctrlReq(oldaddr, ep, bmREQ_SET, USB_REQUEST_SET_ADDRESS, newaddr, 0x00, 0x0000, 0x0000, 0x0000, NULL, NULL); + //delay(2); //per USB 2.0 sect.9.2.6.3 + delay(300); // Older spec says you should wait at least 200ms + return rcode; + //return ( ctrlReq(oldaddr, ep, bmREQ_SET, USB_REQUEST_SET_ADDRESS, newaddr, 0x00, 0x0000, 0x0000, 0x0000, NULL, NULL)); +} +//set configuration + +uint8_t USB::setConf(uint8_t addr, uint8_t ep, uint8_t conf_value) { + return ( ctrlReq(addr, ep, bmREQ_SET, USB_REQUEST_SET_CONFIGURATION, conf_value, 0x00, 0x0000, 0x0000, 0x0000, NULL, NULL)); +} + +#endif // defined(USB_METHODS_INLINE) +#endif // USB_FLASH_DRIVE_SUPPORT diff --git a/Marlin/src/sd/usb_flashdrive/lib/Usb.h b/Marlin/src/sd/usb_flashdrive/lib/Usb.h new file mode 100644 index 0000000000..fef7b814a3 --- /dev/null +++ b/Marlin/src/sd/usb_flashdrive/lib/Usb.h @@ -0,0 +1,52 @@ +/* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. + +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 2 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, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Contact information +------------------- + +Circuits At Home, LTD +Web : http://www.circuitsathome.com +e-mail : support@circuitsathome.com + */ +/* USB functions */ +#ifndef _usb_h_ +#define _usb_h_ + +#include "../../../inc/MarlinConfigPre.h" + +// WARNING: Do not change the order of includes, or stuff will break! +#include +#include +#include + +// None of these should ever be included by a driver, or a user's sketch. +#include "settings.h" +#include "printhex.h" +#include "message.h" + +#include "hexdump.h" +//#include "sink_parser.h" +#include "max3421e.h" +#include "address.h" +//#include "avrpins.h" +#include "usb_ch9.h" +//#include "usbhost.h" +#include "../usb_host.h" +#include "UsbCore.h" +#include "parsetools.h" +#include "confdescparser.h" + +#endif //_usb_h_ diff --git a/Marlin/src/sd/usb_flashdrive/lib/UsbCore.h b/Marlin/src/sd/usb_flashdrive/lib/UsbCore.h new file mode 100644 index 0000000000..5bd60a6803 --- /dev/null +++ b/Marlin/src/sd/usb_flashdrive/lib/UsbCore.h @@ -0,0 +1,311 @@ +/* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. + +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 2 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, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Contact information +------------------- + +Circuits At Home, LTD +Web : http://www.circuitsathome.com +e-mail : support@circuitsathome.com + */ + +#ifndef _usb_h_ + #error "Never include UsbCore.h directly; include Usb.h instead" +#endif + +#pragma once + +// Not used anymore? If anyone uses this, please let us know so that this may be +// moved to the proper place, settings.h. +//#define USB_METHODS_INLINE + +/* shield pins. First parameter - SS pin, second parameter - INT pin */ + +#ifdef __MARLIN_FIRMWARE__ +typedef MAX3421e MAX3421E; // Marlin redefines this class in "../usb_host.h" +#elif defined(BOARD_BLACK_WIDDOW) +typedef MAX3421e MAX3421E; // Black Widow +#elif defined(CORE_TEENSY) && (defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)) +#if EXT_RAM +typedef MAX3421e MAX3421E; // Teensy++ 2.0 with XMEM2 +#else +typedef MAX3421e MAX3421E; // Teensy++ 1.0 and 2.0 +#endif +#elif defined(BOARD_MEGA_ADK) +typedef MAX3421e MAX3421E; // Arduino Mega ADK +#elif defined(ARDUINO_AVR_BALANDUINO) +typedef MAX3421e MAX3421E; // Balanduino +#elif defined(__ARDUINO_X86__) && PLATFORM_ID == 0x06 +typedef MAX3421e MAX3421E; // The Intel Galileo supports much faster read and write speed at pin 2 and 3 +#elif defined(ESP8266) +typedef MAX3421e MAX3421E; // ESP8266 boards +#elif defined(ESP32) +typedef MAX3421e MAX3421E; // ESP32 boards +#else +typedef MAX3421e MAX3421E; // Official Arduinos (UNO, Duemilanove, Mega, 2560, Leonardo, Due etc.), Intel Edison, Intel Galileo 2 or Teensy 2.0 and 3.x +#endif + +/* Common setup data constant combinations */ +#define bmREQ_GET_DESCR USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_STANDARD|USB_SETUP_RECIPIENT_DEVICE //get descriptor request type +#define bmREQ_SET USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_STANDARD|USB_SETUP_RECIPIENT_DEVICE //set request type for all but 'set feature' and 'set interface' +#define bmREQ_CL_GET_INTF USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_INTERFACE //get interface request type + +// D7 data transfer direction (0 - host-to-device, 1 - device-to-host) +// D6-5 Type (0- standard, 1 - class, 2 - vendor, 3 - reserved) +// D4-0 Recipient (0 - device, 1 - interface, 2 - endpoint, 3 - other, 4..31 - reserved) + +// USB Device Classes +#define USB_CLASS_USE_CLASS_INFO 0x00 // Use Class Info in the Interface Descriptors +#define USB_CLASS_AUDIO 0x01 // Audio +#define USB_CLASS_COM_AND_CDC_CTRL 0x02 // Communications and CDC Control +#define USB_CLASS_HID 0x03 // HID +#define USB_CLASS_PHYSICAL 0x05 // Physical +#define USB_CLASS_IMAGE 0x06 // Image +#define USB_CLASS_PRINTER 0x07 // Printer +#define USB_CLASS_MASS_STORAGE 0x08 // Mass Storage +#define USB_CLASS_HUB 0x09 // Hub +#define USB_CLASS_CDC_DATA 0x0a // CDC-Data +#define USB_CLASS_SMART_CARD 0x0b // Smart-Card +#define USB_CLASS_CONTENT_SECURITY 0x0d // Content Security +#define USB_CLASS_VIDEO 0x0e // Video +#define USB_CLASS_PERSONAL_HEALTH 0x0f // Personal Healthcare +#define USB_CLASS_DIAGNOSTIC_DEVICE 0xdc // Diagnostic Device +#define USB_CLASS_WIRELESS_CTRL 0xe0 // Wireless Controller +#define USB_CLASS_MISC 0xef // Miscellaneous +#define USB_CLASS_APP_SPECIFIC 0xfe // Application Specific +#define USB_CLASS_VENDOR_SPECIFIC 0xff // Vendor Specific + +// Additional Error Codes +#define USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED 0xD1 +#define USB_DEV_CONFIG_ERROR_DEVICE_INIT_INCOMPLETE 0xD2 +#define USB_ERROR_UNABLE_TO_REGISTER_DEVICE_CLASS 0xD3 +#define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL 0xD4 +#define USB_ERROR_HUB_ADDRESS_OVERFLOW 0xD5 +#define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL 0xD6 +#define USB_ERROR_EPINFO_IS_NULL 0xD7 +#define USB_ERROR_INVALID_ARGUMENT 0xD8 +#define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE 0xD9 +#define USB_ERROR_INVALID_MAX_PKT_SIZE 0xDA +#define USB_ERROR_EP_NOT_FOUND_IN_TBL 0xDB +#define USB_ERROR_CONFIG_REQUIRES_ADDITIONAL_RESET 0xE0 +#define USB_ERROR_FailGetDevDescr 0xE1 +#define USB_ERROR_FailSetDevTblEntry 0xE2 +#define USB_ERROR_FailGetConfDescr 0xE3 +#define USB_ERROR_TRANSFER_TIMEOUT 0xFF + +#define USB_XFER_TIMEOUT 5000 // (5000) USB transfer timeout in milliseconds, per section 9.2.6.1 of USB 2.0 spec +//#define USB_NAK_LIMIT 32000 // NAK limit for a transfer. 0 means NAKs are not counted +#define USB_RETRY_LIMIT 3 // 3 retry limit for a transfer +#define USB_SETTLE_DELAY 200 // settle delay in milliseconds + +#define USB_NUMDEVICES 16 //number of USB devices +//#define HUB_MAX_HUBS 7 // maximum number of hubs that can be attached to the host controller +#define HUB_PORT_RESET_DELAY 20 // hub port reset delay 10 ms recomended, can be up to 20 ms + +/* USB state machine states */ +#define USB_STATE_MASK 0xf0 + +#define USB_STATE_DETACHED 0x10 +#define USB_DETACHED_SUBSTATE_INITIALIZE 0x11 +#define USB_DETACHED_SUBSTATE_WAIT_FOR_DEVICE 0x12 +#define USB_DETACHED_SUBSTATE_ILLEGAL 0x13 +#define USB_ATTACHED_SUBSTATE_SETTLE 0x20 +#define USB_ATTACHED_SUBSTATE_RESET_DEVICE 0x30 +#define USB_ATTACHED_SUBSTATE_WAIT_RESET_COMPLETE 0x40 +#define USB_ATTACHED_SUBSTATE_WAIT_SOF 0x50 +#define USB_ATTACHED_SUBSTATE_WAIT_RESET 0x51 +#define USB_ATTACHED_SUBSTATE_GET_DEVICE_DESCRIPTOR_SIZE 0x60 +#define USB_STATE_ADDRESSING 0x70 +#define USB_STATE_CONFIGURING 0x80 +#define USB_STATE_RUNNING 0x90 +#define USB_STATE_ERROR 0xa0 + +class USBDeviceConfig { +public: + + virtual uint8_t Init(uint8_t parent __attribute__((unused)), uint8_t port __attribute__((unused)), bool lowspeed __attribute__((unused))) { + return 0; + } + + virtual uint8_t ConfigureDevice(uint8_t parent __attribute__((unused)), uint8_t port __attribute__((unused)), bool lowspeed __attribute__((unused))) { + return 0; + } + + virtual uint8_t Release() { + return 0; + } + + virtual uint8_t Poll() { + return 0; + } + + virtual uint8_t GetAddress() { + return 0; + } + + virtual void ResetHubPort(uint8_t port __attribute__((unused))) { + return; + } // Note used for hubs only! + + virtual bool VIDPIDOK(uint16_t vid __attribute__((unused)), uint16_t pid __attribute__((unused))) { + return false; + } + + virtual bool DEVCLASSOK(uint8_t klass __attribute__((unused))) { + return false; + } + + virtual bool DEVSUBCLASSOK(uint8_t subklass __attribute__((unused))) { + return true; + } + +}; + +/* USB Setup Packet Structure */ +typedef struct { + + union { // offset description + uint8_t bmRequestType; // 0 Bit-map of request type + + struct { + uint8_t recipient : 5; // Recipient of the request + uint8_t type : 2; // Type of request + uint8_t direction : 1; // Direction of data X-fer + } __attribute__((packed)); + } ReqType_u; + uint8_t bRequest; // 1 Request + + union { + uint16_t wValue; // 2 Depends on bRequest + + struct { + uint8_t wValueLo; + uint8_t wValueHi; + } __attribute__((packed)); + } wVal_u; + uint16_t wIndex; // 4 Depends on bRequest + uint16_t wLength; // 6 Depends on bRequest +} __attribute__((packed)) SETUP_PKT, *PSETUP_PKT; + + + +// Base class for incoming data parser + +class USBReadParser { +public: + virtual void Parse(const uint16_t len, const uint8_t *pbuf, const uint16_t &offset) = 0; +}; + +class USB : public MAX3421E { + AddressPoolImpl addrPool; + USBDeviceConfig* devConfig[USB_NUMDEVICES]; + uint8_t bmHubPre; + +public: + USB(void); + + void SetHubPreMask() { + bmHubPre |= bmHUBPRE; + }; + + void ResetHubPreMask() { + bmHubPre &= (~bmHUBPRE); + }; + + AddressPool& GetAddressPool() { + return (AddressPool&)addrPool; + }; + + uint8_t RegisterDeviceClass(USBDeviceConfig *pdev) { + for(uint8_t i = 0; i < USB_NUMDEVICES; i++) { + if(!devConfig[i]) { + devConfig[i] = pdev; + return 0; + } + } + return USB_ERROR_UNABLE_TO_REGISTER_DEVICE_CLASS; + }; + + void ForEachUsbDevice(UsbDeviceHandleFunc pfunc) { + addrPool.ForEachUsbDevice(pfunc); + }; + uint8_t getUsbTaskState(void); + void setUsbTaskState(uint8_t state); + + EpInfo* getEpInfoEntry(uint8_t addr, uint8_t ep); + uint8_t setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo* eprecord_ptr); + + /* Control requests */ + uint8_t getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* dataptr); + uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t* dataptr); + + uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint8_t conf, USBReadParser *p); + + uint8_t getStrDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t index, uint16_t langid, uint8_t* dataptr); + uint8_t setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr); + uint8_t setConf(uint8_t addr, uint8_t ep, uint8_t conf_value); + /**/ + uint8_t ctrlData(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* dataptr, bool direction); + uint8_t ctrlStatus(uint8_t ep, bool direction, uint16_t nak_limit); + uint8_t inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t* data, uint8_t bInterval = 0); + uint8_t outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* data); + uint8_t dispatchPkt(uint8_t token, uint8_t ep, uint16_t nak_limit); + + void Task(void); + + uint8_t DefaultAddressing(uint8_t parent, uint8_t port, bool lowspeed); + uint8_t Configuring(uint8_t parent, uint8_t port, bool lowspeed); + uint8_t ReleaseDevice(uint8_t addr); + + uint8_t ctrlReq(uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi, + uint16_t wInd, uint16_t total, uint16_t nbytes, uint8_t* dataptr, USBReadParser *p); + +private: + void init(); + uint8_t SetAddress(uint8_t addr, uint8_t ep, EpInfo **ppep, uint16_t *nak_limit); + uint8_t OutTransfer(EpInfo *pep, uint16_t nak_limit, uint16_t nbytes, uint8_t *data); + uint8_t InTransfer(EpInfo *pep, uint16_t nak_limit, uint16_t *nbytesptr, uint8_t *data, uint8_t bInterval = 0); + uint8_t AttemptConfig(uint8_t driver, uint8_t parent, uint8_t port, bool lowspeed); +}; + +#if 0 //defined(USB_METHODS_INLINE) +//get device descriptor + +inline uint8_t USB::getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* dataptr) { + return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, 0x00, USB_DESCRIPTOR_DEVICE, 0x0000, nbytes, dataptr)); +} +//get configuration descriptor + +inline uint8_t USB::getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t* dataptr) { + return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, conf, USB_DESCRIPTOR_CONFIGURATION, 0x0000, nbytes, dataptr)); +} +//get string descriptor + +inline uint8_t USB::getStrDescr(uint8_t addr, uint8_t ep, uint16_t nuint8_ts, uint8_t index, uint16_t langid, uint8_t* dataptr) { + return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, index, USB_DESCRIPTOR_STRING, langid, nuint8_ts, dataptr)); +} +//set address + +inline uint8_t USB::setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr) { + return ( ctrlReq(oldaddr, ep, bmREQ_SET, USB_REQUEST_SET_ADDRESS, newaddr, 0x00, 0x0000, 0x0000, NULL)); +} +//set configuration + +inline uint8_t USB::setConf(uint8_t addr, uint8_t ep, uint8_t conf_value) { + return ( ctrlReq(addr, ep, bmREQ_SET, USB_REQUEST_SET_CONFIGURATION, conf_value, 0x00, 0x0000, 0x0000, NULL)); +} + +#endif // defined(USB_METHODS_INLINE) diff --git a/Marlin/src/sd/usb_flashdrive/lib/address.h b/Marlin/src/sd/usb_flashdrive/lib/address.h new file mode 100644 index 0000000000..0cc0ab16e5 --- /dev/null +++ b/Marlin/src/sd/usb_flashdrive/lib/address.h @@ -0,0 +1,290 @@ +/* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. + +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 2 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, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Contact information +------------------- + +Circuits At Home, LTD +Web : http://www.circuitsathome.com +e-mail : support@circuitsathome.com + */ + +#if !defined(_usb_h_) || defined(__ADDRESS_H__) +#error "Never include address.h directly; include Usb.h instead" +#else +#define __ADDRESS_H__ + + + +/* NAK powers. To save space in endpoint data structure, amount of retries before giving up and returning 0x4 is stored in */ +/* bmNakPower as a power of 2. The actual nak_limit is then calculated as nak_limit = ( 2^bmNakPower - 1) */ +#define USB_NAK_MAX_POWER 15 //NAK binary order maximum value +#define USB_NAK_DEFAULT 14 //default 32K-1 NAKs before giving up +#define USB_NAK_NOWAIT 1 //Single NAK stops transfer +#define USB_NAK_NONAK 0 //Do not count NAKs, stop retrying after USB Timeout + +struct EpInfo { + uint8_t epAddr; // Endpoint address + uint8_t maxPktSize; // Maximum packet size + + union { + uint8_t epAttribs; + + struct { + uint8_t bmSndToggle : 1; // Send toggle, when zero bmSNDTOG0, bmSNDTOG1 otherwise + uint8_t bmRcvToggle : 1; // Send toggle, when zero bmRCVTOG0, bmRCVTOG1 otherwise + uint8_t bmNakPower : 6; // Binary order for NAK_LIMIT value + } __attribute__((packed)); + }; +} __attribute__((packed)); + +// 7 6 5 4 3 2 1 0 +// --------------------------------- +// | | H | P | P | P | A | A | A | +// --------------------------------- +// +// H - if 1 the address is a hub address +// P - parent hub address +// A - device address / port number in case of hub +// + +struct UsbDeviceAddress { + + union { + + struct { + uint8_t bmAddress : 3; // device address/port number + uint8_t bmParent : 3; // parent hub address + uint8_t bmHub : 1; // hub flag + uint8_t bmReserved : 1; // reserved, must be zero + } __attribute__((packed)); + uint8_t devAddress; + }; +} __attribute__((packed)); + +#define bmUSB_DEV_ADDR_ADDRESS 0x07 +#define bmUSB_DEV_ADDR_PARENT 0x38 +#define bmUSB_DEV_ADDR_HUB 0x40 + +struct UsbDevice { + EpInfo *epinfo; // endpoint info pointer + UsbDeviceAddress address; + uint8_t epcount; // number of endpoints + bool lowspeed; // indicates if a device is the low speed one + // uint8_t devclass; // device class +} __attribute__((packed)); + +class AddressPool { +public: + virtual UsbDevice* GetUsbDevicePtr(uint8_t addr) = 0; + virtual uint8_t AllocAddress(uint8_t parent, bool is_hub = false, uint8_t port = 0) = 0; + virtual void FreeAddress(uint8_t addr) = 0; +}; + +typedef void (*UsbDeviceHandleFunc)(UsbDevice *pdev); + +#define ADDR_ERROR_INVALID_INDEX 0xFF +#define ADDR_ERROR_INVALID_ADDRESS 0xFF + +template +class AddressPoolImpl : public AddressPool { + EpInfo dev0ep; //Endpoint data structure used during enumeration for uninitialized device + + uint8_t hubCounter; // hub counter is kept + // in order to avoid hub address duplication + + UsbDevice thePool[MAX_DEVICES_ALLOWED]; + + // Initializes address pool entry + + void InitEntry(uint8_t index) { + thePool[index].address.devAddress = 0; + thePool[index].epcount = 1; + thePool[index].lowspeed = 0; + thePool[index].epinfo = &dev0ep; + }; + + // Returns thePool index for a given address + + uint8_t FindAddressIndex(uint8_t address = 0) { + for(uint8_t i = 1; i < MAX_DEVICES_ALLOWED; i++) { + if(thePool[i].address.devAddress == address) + return i; + } + return 0; + }; + + // Returns thePool child index for a given parent + + uint8_t FindChildIndex(UsbDeviceAddress addr, uint8_t start = 1) { + for(uint8_t i = (start < 1 || start >= MAX_DEVICES_ALLOWED) ? 1 : start; i < MAX_DEVICES_ALLOWED; i++) { + if(thePool[i].address.bmParent == addr.bmAddress) + return i; + } + return 0; + }; + + // Frees address entry specified by index parameter + + void FreeAddressByIndex(uint8_t index) { + // Zero field is reserved and should not be affected + if(index == 0) + return; + + UsbDeviceAddress uda = thePool[index].address; + // If a hub was switched off all port addresses should be freed + if(uda.bmHub == 1) { + for(uint8_t i = 1; (i = FindChildIndex(uda, i));) + FreeAddressByIndex(i); + + // If the hub had the last allocated address, hubCounter should be decremented + if(hubCounter == uda.bmAddress) + hubCounter--; + } + InitEntry(index); + } + + // Initializes the whole address pool at once + + void InitAllAddresses() { + for(uint8_t i = 1; i < MAX_DEVICES_ALLOWED; i++) + InitEntry(i); + + hubCounter = 0; + }; + +public: + + AddressPoolImpl() : hubCounter(0) { + // Zero address is reserved + InitEntry(0); + + thePool[0].address.devAddress = 0; + thePool[0].epinfo = &dev0ep; + dev0ep.epAddr = 0; + dev0ep.maxPktSize = 8; + dev0ep.bmSndToggle = 0; // Set DATA0/1 toggles to 0 + dev0ep.bmRcvToggle = 0; + dev0ep.bmNakPower = USB_NAK_MAX_POWER; + + InitAllAddresses(); + }; + + // Returns a pointer to a specified address entry + + virtual UsbDevice* GetUsbDevicePtr(uint8_t addr) { + if(!addr) + return thePool; + + uint8_t index = FindAddressIndex(addr); + + return (!index) ? NULL : thePool + index; + }; + + // Performs an operation specified by pfunc for each addressed device + + void ForEachUsbDevice(UsbDeviceHandleFunc pfunc) { + if(!pfunc) + return; + + for(uint8_t i = 1; i < MAX_DEVICES_ALLOWED; i++) + if(thePool[i].address.devAddress) + pfunc(thePool + i); + }; + + // Allocates new address + + virtual uint8_t AllocAddress(uint8_t parent, bool is_hub = false, uint8_t port = 0) { + /* if (parent != 0 && port == 0) + USB_HOST_SERIAL.println("PRT:0"); */ + UsbDeviceAddress _parent; + _parent.devAddress = parent; + if(_parent.bmReserved || port > 7) + //if(parent > 127 || port > 7) + return 0; + + if(is_hub && hubCounter == 7) + return 0; + + // finds first empty address entry starting from one + uint8_t index = FindAddressIndex(0); + + if(!index) // if empty entry is not found + return 0; + + if(_parent.devAddress == 0) { + if(is_hub) { + thePool[index].address.devAddress = 0x41; + hubCounter++; + } else + thePool[index].address.devAddress = 1; + + return thePool[index].address.devAddress; + } + + UsbDeviceAddress addr; + addr.devAddress = 0; // Ensure all bits are zero + addr.bmParent = _parent.bmAddress; + if(is_hub) { + addr.bmHub = 1; + addr.bmAddress = ++hubCounter; + } else { + addr.bmHub = 0; + addr.bmAddress = port; + } + thePool[index].address = addr; + /* + USB_HOST_SERIAL.print("Addr:"); + USB_HOST_SERIAL.print(addr.bmHub, HEX); + USB_HOST_SERIAL.print("."); + USB_HOST_SERIAL.print(addr.bmParent, HEX); + USB_HOST_SERIAL.print("."); + USB_HOST_SERIAL.println(addr.bmAddress, HEX); + */ + return thePool[index].address.devAddress; + }; + + // Empties pool entry + + virtual void FreeAddress(uint8_t addr) { + // if the root hub is disconnected all the addresses should be initialized + if(addr == 0x41) { + InitAllAddresses(); + return; + } + uint8_t index = FindAddressIndex(addr); + FreeAddressByIndex(index); + }; + + // Returns number of hubs attached + // It can be rather helpfull to find out if there are hubs attached than getting the exact number of hubs. + //uint8_t GetNumHubs() + //{ + // return hubCounter; + //}; + //uint8_t GetNumDevices() + //{ + // uint8_t counter = 0; + + // for (uint8_t i=1; i +class ConfigDescParser : public USBReadParser { + UsbConfigXtracter *theXtractor; + MultiValueBuffer theBuffer; + MultiByteValueParser valParser; + ByteSkipper theSkipper; + uint8_t varBuffer[16 /*sizeof(USB_CONFIGURATION_DESCRIPTOR)*/]; + + uint8_t stateParseDescr; // ParseDescriptor state + + uint8_t dscrLen; // Descriptor length + uint8_t dscrType; // Descriptor type + + bool isGoodInterface; // Apropriate interface flag + uint8_t confValue; // Configuration value + uint8_t protoValue; // Protocol value + uint8_t ifaceNumber; // Interface number + uint8_t ifaceAltSet; // Interface alternate settings + + bool UseOr; + bool ParseDescriptor(uint8_t **pp, uint16_t *pcntdn); + void PrintHidDescriptor(const USB_HID_DESCRIPTOR *pDesc); + +public: + + void SetOR(void) { + UseOr = true; + } + ConfigDescParser(UsbConfigXtracter *xtractor); + void Parse(const uint16_t len, const uint8_t *pbuf, const uint16_t &offset); +}; + +template +ConfigDescParser::ConfigDescParser(UsbConfigXtracter *xtractor) : +theXtractor(xtractor), +stateParseDescr(0), +dscrLen(0), +dscrType(0), +UseOr(false) { + theBuffer.pValue = varBuffer; + valParser.Initialize(&theBuffer); + theSkipper.Initialize(&theBuffer); +}; + +template +void ConfigDescParser::Parse(const uint16_t len, const uint8_t *pbuf, const uint16_t &offset __attribute__((unused))) { + uint16_t cntdn = (uint16_t)len; + uint8_t *p = (uint8_t*)pbuf; + + while(cntdn) + if(!ParseDescriptor(&p, &cntdn)) + return; +} + +/* Parser for the configuration descriptor. Takes values for class, subclass, protocol fields in interface descriptor and + compare masks for them. When the match is found, calls EndpointXtract passing buffer containing endpoint descriptor */ +template +bool ConfigDescParser::ParseDescriptor(uint8_t **pp, uint16_t *pcntdn) { + USB_CONFIGURATION_DESCRIPTOR* ucd = reinterpret_cast(varBuffer); + USB_INTERFACE_DESCRIPTOR* uid = reinterpret_cast(varBuffer); + switch(stateParseDescr) { + case 0: + theBuffer.valueSize = 2; + valParser.Initialize(&theBuffer); + stateParseDescr = 1; + case 1: + if(!valParser.Parse(pp, pcntdn)) + return false; + dscrLen = *((uint8_t*)theBuffer.pValue); + dscrType = *((uint8_t*)theBuffer.pValue + 1); + stateParseDescr = 2; + case 2: + // This is a sort of hack. Assuming that two bytes are all ready in the buffer + // the pointer is positioned two bytes ahead in order for the rest of descriptor + // to be read right after the size and the type fields. + // This should be used carefully. varBuffer should be used directly to handle data + // in the buffer. + theBuffer.pValue = varBuffer + 2; + stateParseDescr = 3; + case 3: + switch(dscrType) { + case USB_DESCRIPTOR_INTERFACE: + isGoodInterface = false; + break; + case USB_DESCRIPTOR_CONFIGURATION: + case USB_DESCRIPTOR_ENDPOINT: + case HID_DESCRIPTOR_HID: + break; + } + theBuffer.valueSize = dscrLen - 2; + valParser.Initialize(&theBuffer); + stateParseDescr = 4; + case 4: + switch(dscrType) { + case USB_DESCRIPTOR_CONFIGURATION: + if(!valParser.Parse(pp, pcntdn)) + return false; + confValue = ucd->bConfigurationValue; + break; + case USB_DESCRIPTOR_INTERFACE: + if(!valParser.Parse(pp, pcntdn)) + return false; + if((MASK & CP_MASK_COMPARE_CLASS) && uid->bInterfaceClass != CLASS_ID) + break; + if((MASK & CP_MASK_COMPARE_SUBCLASS) && uid->bInterfaceSubClass != SUBCLASS_ID) + break; + if(UseOr) { + if((!((MASK & CP_MASK_COMPARE_PROTOCOL) && uid->bInterfaceProtocol))) + break; + } else { + if((MASK & CP_MASK_COMPARE_PROTOCOL) && uid->bInterfaceProtocol != PROTOCOL_ID) + break; + } + isGoodInterface = true; + ifaceNumber = uid->bInterfaceNumber; + ifaceAltSet = uid->bAlternateSetting; + protoValue = uid->bInterfaceProtocol; + break; + case USB_DESCRIPTOR_ENDPOINT: + if(!valParser.Parse(pp, pcntdn)) + return false; + if(isGoodInterface) + if(theXtractor) + theXtractor->EndpointXtract(confValue, ifaceNumber, ifaceAltSet, protoValue, (USB_ENDPOINT_DESCRIPTOR*)varBuffer); + break; + //case HID_DESCRIPTOR_HID: + // if (!valParser.Parse(pp, pcntdn)) + // return false; + // PrintHidDescriptor((const USB_HID_DESCRIPTOR*)varBuffer); + // break; + default: + if(!theSkipper.Skip(pp, pcntdn, dscrLen - 2)) + return false; + } + theBuffer.pValue = varBuffer; + stateParseDescr = 0; + } + return true; +} + +template +void ConfigDescParser::PrintHidDescriptor(const USB_HID_DESCRIPTOR *pDesc) { + Notify(PSTR("\r\n\r\nHID Descriptor:\r\n"), 0x80); + Notify(PSTR("bDescLength:\t\t"), 0x80); + PrintHex (pDesc->bLength, 0x80); + + Notify(PSTR("\r\nbDescriptorType:\t"), 0x80); + PrintHex (pDesc->bDescriptorType, 0x80); + + Notify(PSTR("\r\nbcdHID:\t\t\t"), 0x80); + PrintHex (pDesc->bcdHID, 0x80); + + Notify(PSTR("\r\nbCountryCode:\t\t"), 0x80); + PrintHex (pDesc->bCountryCode, 0x80); + + Notify(PSTR("\r\nbNumDescriptors:\t"), 0x80); + PrintHex (pDesc->bNumDescriptors, 0x80); + + for(uint8_t i = 0; i < pDesc->bNumDescriptors; i++) { + HID_CLASS_DESCRIPTOR_LEN_AND_TYPE *pLT = (HID_CLASS_DESCRIPTOR_LEN_AND_TYPE*)&(pDesc->bDescrType); + + Notify(PSTR("\r\nbDescrType:\t\t"), 0x80); + PrintHex (pLT[i].bDescrType, 0x80); + + Notify(PSTR("\r\nwDescriptorLength:\t"), 0x80); + PrintHex (pLT[i].wDescriptorLength, 0x80); + } + Notify(PSTR("\r\n"), 0x80); +} + + +#endif // __CONFDESCPARSER_H__ diff --git a/Marlin/src/sd/usb_flashdrive/lib/hexdump.h b/Marlin/src/sd/usb_flashdrive/lib/hexdump.h new file mode 100644 index 0000000000..3cdb9e2a11 --- /dev/null +++ b/Marlin/src/sd/usb_flashdrive/lib/hexdump.h @@ -0,0 +1,69 @@ +/* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. + +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 2 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, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Contact information +------------------- + +Circuits At Home, LTD +Web : http://www.circuitsathome.com +e-mail : support@circuitsathome.com + */ + +#if !defined(_usb_h_) || defined(__HEXDUMP_H__) +#error "Never include hexdump.h directly; include Usb.h instead" +#else +#define __HEXDUMP_H__ + +extern int UsbDEBUGlvl; + +template +class HexDumper : public BASE_CLASS { + uint8_t byteCount; + OFFSET_TYPE byteTotal; + +public: + + HexDumper() : byteCount(0), byteTotal(0) { + }; + + void Initialize() { + byteCount = 0; + byteTotal = 0; + }; + + void Parse(const LEN_TYPE len, const uint8_t *pbuf, const OFFSET_TYPE &offset); +}; + +template +void HexDumper::Parse(const LEN_TYPE len, const uint8_t *pbuf, const OFFSET_TYPE &offset __attribute__((unused))) { + if(UsbDEBUGlvl >= 0x80) { // Fully bypass this block of code if we do not debug. + for(LEN_TYPE j = 0; j < len; j++, byteCount++, byteTotal++) { + if(!byteCount) { + PrintHex (byteTotal, 0x80); + E_Notify(PSTR(": "), 0x80); + } + PrintHex (pbuf[j], 0x80); + E_Notify(PSTR(" "), 0x80); + + if(byteCount == 15) { + E_Notify(PSTR("\r\n"), 0x80); + byteCount = 0xFF; + } + } + } +} + +#endif // __HEXDUMP_H__ diff --git a/Marlin/src/sd/usb_flashdrive/lib/macros.h b/Marlin/src/sd/usb_flashdrive/lib/macros.h new file mode 100644 index 0000000000..f5517904ca --- /dev/null +++ b/Marlin/src/sd/usb_flashdrive/lib/macros.h @@ -0,0 +1,86 @@ +/* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. + +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 2 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, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Contact information +------------------- + +Circuits At Home, LTD +Web : http://www.circuitsathome.com +e-mail : support@circuitsathome.com + */ + +#ifndef _usb_h_ + #error "Never include macros.h directly; include Usb.h instead" +#endif + +#pragma once + +//////////////////////////////////////////////////////////////////////////////// +// HANDY MACROS +//////////////////////////////////////////////////////////////////////////////// + +#define VALUE_BETWEEN(v,l,h) (((v)>(l)) && ((v)<(h))) +#define VALUE_WITHIN(v,l,h) (((v)>=(l)) && ((v)<=(h))) +#define output_pgm_message(wa,fp,mp,el) wa = &mp, fp((char *)pgm_read_pointer(wa), el) +#define output_if_between(v,l,h,wa,fp,mp,el) if(VALUE_BETWEEN(v,l,h)) output_pgm_message(wa,fp,mp[v-(l+1)],el); + +#define SWAP(a, b) (((a) ^= (b)), ((b) ^= (a)), ((a) ^= (b))) +#ifndef __BYTE_GRABBING_DEFINED__ +#define __BYTE_GRABBING_DEFINED__ 1 +#ifdef BROKEN_OPTIMIZER_LITTLE_ENDIAN +// Note: Use this if your compiler generates horrible assembler! +#define BGRAB0(__usi__) (((uint8_t *)&(__usi__))[0]) +#define BGRAB1(__usi__) (((uint8_t *)&(__usi__))[1]) +#define BGRAB2(__usi__) (((uint8_t *)&(__usi__))[2]) +#define BGRAB3(__usi__) (((uint8_t *)&(__usi__))[3]) +#define BGRAB4(__usi__) (((uint8_t *)&(__usi__))[4]) +#define BGRAB5(__usi__) (((uint8_t *)&(__usi__))[5]) +#define BGRAB6(__usi__) (((uint8_t *)&(__usi__))[6]) +#define BGRAB7(__usi__) (((uint8_t *)&(__usi__))[7]) +#else +// Note: The cast alone to uint8_t is actually enough. +// GCC throws out the "& 0xff", and the size is no different. +// Some compilers need it. +#define BGRAB0(__usi__) ((uint8_t)((__usi__) & 0xff )) +#define BGRAB1(__usi__) ((uint8_t)(((__usi__) >> 8) & 0xff)) +#define BGRAB2(__usi__) ((uint8_t)(((__usi__) >> 16) & 0xff)) +#define BGRAB3(__usi__) ((uint8_t)(((__usi__) >> 24) & 0xff)) +#define BGRAB4(__usi__) ((uint8_t)(((__usi__) >> 32) & 0xff)) +#define BGRAB5(__usi__) ((uint8_t)(((__usi__) >> 40) & 0xff)) +#define BGRAB6(__usi__) ((uint8_t)(((__usi__) >> 48) & 0xff)) +#define BGRAB7(__usi__) ((uint8_t)(((__usi__) >> 56) & 0xff)) +#endif +#define BOVER1(__usi__) ((uint16_t)(__usi__) << 8) +#define BOVER2(__usi__) ((uint32_t)(__usi__) << 16) +#define BOVER3(__usi__) ((uint32_t)(__usi__) << 24) +#define BOVER4(__usi__) ((uint64_t)(__usi__) << 32) +#define BOVER5(__usi__) ((uint64_t)(__usi__) << 40) +#define BOVER6(__usi__) ((uint64_t)(__usi__) << 48) +#define BOVER7(__usi__) ((uint64_t)(__usi__) << 56) + +// These are the smallest and fastest ways I have found so far in pure C/C++. +#define BMAKE16(__usc1__,__usc0__) ((uint16_t)((uint16_t)(__usc0__) | (uint16_t)BOVER1(__usc1__))) +#define BMAKE32(__usc3__,__usc2__,__usc1__,__usc0__) ((uint32_t)((uint32_t)(__usc0__) | (uint32_t)BOVER1(__usc1__) | (uint32_t)BOVER2(__usc2__) | (uint32_t)BOVER3(__usc3__))) +#define BMAKE64(__usc7__,__usc6__,__usc5__,__usc4__,__usc3__,__usc2__,__usc1__,__usc0__) ((uint64_t)((uint64_t)__usc0__ | (uint64_t)BOVER1(__usc1__) | (uint64_t)BOVER2(__usc2__) | (uint64_t)BOVER3(__usc3__) | (uint64_t)BOVER4(__usc4__) | (uint64_t)BOVER5(__usc5__) | (uint64_t)BOVER6(__usc6__) | (uint64_t)BOVER1(__usc7__))) +#endif + +/* + * Debug macros: Strings are stored in progmem (flash) instead of RAM. + */ +#define USBTRACE(s) (Notify(PSTR(s), 0x80)) +#define USBTRACE1(s,l) (Notify(PSTR(s), l)) +#define USBTRACE2(s,r) (Notify(PSTR(s), 0x80), D_PrintHex((r), 0x80), Notify(PSTR("\r\n"), 0x80)) +#define USBTRACE3(s,r,l) (Notify(PSTR(s), l), D_PrintHex((r), l), Notify(PSTR("\r\n"), l)) diff --git a/Marlin/src/sd/usb_flashdrive/lib/masstorage.cpp b/Marlin/src/sd/usb_flashdrive/lib/masstorage.cpp new file mode 100644 index 0000000000..e139febf3d --- /dev/null +++ b/Marlin/src/sd/usb_flashdrive/lib/masstorage.cpp @@ -0,0 +1,1282 @@ +/* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. + +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 2 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, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Contact information +------------------- + +Circuits At Home, LTD +Web : http://www.circuitsathome.com +e-mail : support@circuitsathome.com + */ + +#include "../../../inc/MarlinConfigPre.h" + +#if ENABLED(USB_FLASH_DRIVE_SUPPORT) + +#include "masstorage.h" + +const uint8_t BulkOnly::epDataInIndex = 1; +const uint8_t BulkOnly::epDataOutIndex = 2; +const uint8_t BulkOnly::epInterruptInIndex = 3; + +//////////////////////////////////////////////////////////////////////////////// + +// Interface code + +//////////////////////////////////////////////////////////////////////////////// + +/** + * Get the capacity of the media + * + * @param lun Logical Unit Number + * @return media capacity + */ +uint32_t BulkOnly::GetCapacity(uint8_t lun) { + if(LUNOk[lun]) + return CurrentCapacity[lun]; + return 0LU; +} + +/** + * Get the sector (block) size used on the media + * + * @param lun Logical Unit Number + * @return media sector size + */ +uint16_t BulkOnly::GetSectorSize(uint8_t lun) { + if(LUNOk[lun]) + return CurrentSectorSize[lun]; + return 0U; +} + +/** + * Test if LUN is ready for use + * + * @param lun Logical Unit Number + * @return true if LUN is ready for use + */ +bool BulkOnly::LUNIsGood(uint8_t lun) { + return LUNOk[lun]; +} + +/** + * Test if LUN is write protected + * + * @param lun Logical Unit Number + * @return cached status of write protect switch + */ +bool BulkOnly::WriteProtected(uint8_t lun) { + return WriteOk[lun]; +} + +/** + * Wrap and execute a SCSI CDB with length of 6 + * + * @param cdb CDB to execute + * @param buf_size Size of expected transaction + * @param buf Buffer + * @param dir MASS_CMD_DIR_IN | MASS_CMD_DIR_OUT + * @return + */ +uint8_t BulkOnly::SCSITransaction6(CDB6_t *cdb, uint16_t buf_size, void *buf, uint8_t dir) { + // promote buf_size to 32bits. + CommandBlockWrapper cbw = CommandBlockWrapper(++dCBWTag, (uint32_t)buf_size, cdb, dir); + //SetCurLUN(cdb->LUN); + return (HandleSCSIError(Transaction(&cbw, buf_size, buf))); +} + +/** + * Wrap and execute a SCSI CDB with length of 10 + * + * @param cdb CDB to execute + * @param buf_size Size of expected transaction + * @param buf Buffer + * @param dir MASS_CMD_DIR_IN | MASS_CMD_DIR_OUT + * @return + */ +uint8_t BulkOnly::SCSITransaction10(CDB10_t *cdb, uint16_t buf_size, void *buf, uint8_t dir) { + // promote buf_size to 32bits. + CommandBlockWrapper cbw = CommandBlockWrapper(++dCBWTag, (uint32_t)buf_size, cdb, dir); + //SetCurLUN(cdb->LUN); + return (HandleSCSIError(Transaction(&cbw, buf_size, buf))); +} + +/** + * Lock or Unlock the tray or door on device. + * Caution: Some devices with buggy firmware will lock up. + * + * @param lun Logical Unit Number + * @param lock 1 to lock, 0 to unlock + * @return + */ +uint8_t BulkOnly::LockMedia(uint8_t lun, uint8_t lock) { + Notify(PSTR("\r\nLockMedia\r\n"), 0x80); + Notify(PSTR("---------\r\n"), 0x80); + + CDB6_t cdb = CDB6_t(SCSI_CMD_PREVENT_REMOVAL, lun, (uint8_t)0, lock); + return SCSITransaction6(&cdb, (uint16_t)0, NULL, (uint8_t)MASS_CMD_DIR_IN); +} + +/** + * Media control, for spindle motor and media tray or door. + * This includes CDROM, TAPE and anything with a media loader. + * + * @param lun Logical Unit Number + * @param ctl 0x00 Stop Motor, 0x01 Start Motor, 0x02 Eject Media, 0x03 Load Media + * @return 0 on success + */ +uint8_t BulkOnly::MediaCTL(uint8_t lun, uint8_t ctl) { + Notify(PSTR("\r\nMediaCTL\r\n"), 0x80); + Notify(PSTR("-----------------\r\n"), 0x80); + + uint8_t rcode = MASS_ERR_UNIT_NOT_READY; + if(bAddress) { + CDB6_t cdb = CDB6_t(SCSI_CMD_START_STOP_UNIT, lun, ctl & 0x03, 0); + rcode = SCSITransaction6(&cdb, (uint16_t)0, NULL, (uint8_t)MASS_CMD_DIR_OUT); + } else { + SetCurLUN(lun); + } + return rcode; +} + +/** + * Read data from media + * + * @param lun Logical Unit Number + * @param addr LBA address on media to read + * @param bsize size of a block (we should probably use the cached size) + * @param blocks how many blocks to read + * @param buf memory that is able to hold the requested data + * @return 0 on success + */ +uint8_t BulkOnly::Read(uint8_t lun, uint32_t addr, uint16_t bsize, uint8_t blocks, uint8_t *buf) { + if(!LUNOk[lun]) return MASS_ERR_NO_MEDIA; + Notify(PSTR("\r\nRead LUN:\t"), 0x80); + D_PrintHex (lun, 0x90); + Notify(PSTR("\r\nLBA:\t\t"), 0x90); + D_PrintHex (addr, 0x90); + Notify(PSTR("\r\nblocks:\t\t"), 0x90); + D_PrintHex (blocks, 0x90); + Notify(PSTR("\r\nblock size:\t"), 0x90); + D_PrintHex (bsize, 0x90); + Notify(PSTR("\r\n---------\r\n"), 0x80); + CDB10_t cdb = CDB10_t(SCSI_CMD_READ_10, lun, blocks, addr); + +again: + uint8_t er = SCSITransaction10(&cdb, ((uint16_t)bsize * blocks), buf, (uint8_t)MASS_CMD_DIR_IN); + + if(er == MASS_ERR_STALL) { + MediaCTL(lun, 1); + delay(150); + if(!TestUnitReady(lun)) goto again; + } + return er; +} + +/** + * Write data to media + * + * @param lun Logical Unit Number + * @param addr LBA address on media to write + * @param bsize size of a block (we should probably use the cached size) + * @param blocks how many blocks to write + * @param buf memory that contains the data to write + * @return 0 on success + */ +uint8_t BulkOnly::Write(uint8_t lun, uint32_t addr, uint16_t bsize, uint8_t blocks, const uint8_t * buf) { + if(!LUNOk[lun]) return MASS_ERR_NO_MEDIA; + if(!WriteOk[lun]) return MASS_ERR_WRITE_PROTECTED; + Notify(PSTR("\r\nWrite LUN:\t"), 0x80); + D_PrintHex (lun, 0x90); + Notify(PSTR("\r\nLBA:\t\t"), 0x90); + D_PrintHex (addr, 0x90); + Notify(PSTR("\r\nblocks:\t\t"), 0x90); + D_PrintHex (blocks, 0x90); + Notify(PSTR("\r\nblock size:\t"), 0x90); + D_PrintHex (bsize, 0x90); + Notify(PSTR("\r\n---------\r\n"), 0x80); + CDB10_t cdb = CDB10_t(SCSI_CMD_WRITE_10, lun, blocks, addr); + +again: + uint8_t er = SCSITransaction10(&cdb, ((uint16_t)bsize * blocks), (void*)buf, (uint8_t)MASS_CMD_DIR_OUT); + + if(er == MASS_ERR_WRITE_STALL) { + MediaCTL(lun, 1); + delay(150); + if(!TestUnitReady(lun)) goto again; + } + return er; +} + +// End of user functions, the remaining code below is driver internals. +// Only developer serviceable parts below! + +//////////////////////////////////////////////////////////////////////////////// + +// Main driver code + +//////////////////////////////////////////////////////////////////////////////// + +BulkOnly::BulkOnly(USB *p) : +pUsb(p), +bAddress(0), +bIface(0), +bNumEP(1), +qNextPollTime(0), +bPollEnable(false), +//dCBWTag(0), +bLastUsbError(0) { + ClearAllEP(); + dCBWTag = 0; + if(pUsb) + pUsb->RegisterDeviceClass(this); +} + +/** + * USB_ERROR_CONFIG_REQUIRES_ADDITIONAL_RESET == success + * We need to standardize either the rcode, or change the API to return values + * so a signal that additional actions are required can be produced. + * Some of these codes do exist already. + * + * TECHNICAL: We could do most of this code elsewhere, with the exception of checking the class instance. + * Doing so would save some program memory when using multiple drivers. + * + * @param parent USB address of parent + * @param port address of port on parent + * @param lowspeed true if device is low speed + * @return + */ +uint8_t BulkOnly::ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed) { + + const uint8_t constBufSize = sizeof (USB_DEVICE_DESCRIPTOR); + + uint8_t buf[constBufSize]; + USB_DEVICE_DESCRIPTOR * udd = reinterpret_cast(buf); + uint8_t rcode; + UsbDevice *p = NULL; + EpInfo *oldep_ptr = NULL; + USBTRACE("MS ConfigureDevice\r\n"); + ClearAllEP(); + AddressPool &addrPool = pUsb->GetAddressPool(); + + + if(bAddress) + return USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE; + + // + // Get pointer to pseudo device with address 0 assigned + p = addrPool.GetUsbDevicePtr(0); + if(!p) { + return USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL; + } + + if(!p->epinfo) { + USBTRACE("epinfo\r\n"); + return USB_ERROR_EPINFO_IS_NULL; + } + + // Save old pointer to EP_RECORD of address 0 + oldep_ptr = p->epinfo; + + // Temporary assign new pointer to epInfo to p->epinfo in order to avoid toggle inconsistence + p->epinfo = epInfo; + + p->lowspeed = lowspeed; + // Get device descriptor + rcode = pUsb->getDevDescr(0, 0, constBufSize, (uint8_t*)buf); + + // Restore p->epinfo + p->epinfo = oldep_ptr; + + if(rcode) { + goto FailGetDevDescr; + } + // Allocate new address according to device class + bAddress = addrPool.AllocAddress(parent, false, port); + + if(!bAddress) + return USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL; + + // Extract Max Packet Size from the device descriptor + epInfo[0].maxPktSize = udd->bMaxPacketSize0; + // Steal and abuse from epInfo structure to save on memory. + epInfo[1].epAddr = udd->bNumConfigurations; + // + return USB_ERROR_CONFIG_REQUIRES_ADDITIONAL_RESET; + +FailGetDevDescr: +#ifdef DEBUG_USB_HOST + NotifyFailGetDevDescr(rcode); +#endif + rcode = USB_ERROR_FailGetDevDescr; + + Release(); + return rcode; +}; + +/** + * + * @param parent (not used) + * @param port (not used) + * @param lowspeed true if device is low speed + * @return 0 for success + */ +uint8_t BulkOnly::Init(uint8_t parent __attribute__((unused)), uint8_t port __attribute__((unused)), bool lowspeed) { + uint8_t rcode; + uint8_t num_of_conf = epInfo[1].epAddr; // number of configurations + epInfo[1].epAddr = 0; + USBTRACE("MS Init\r\n"); + + AddressPool &addrPool = pUsb->GetAddressPool(); + UsbDevice *p = addrPool.GetUsbDevicePtr(bAddress); + + if(!p) + return USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL; + + // Assign new address to the device + delay(2000); + rcode = pUsb->setAddr(0, 0, bAddress); + + if(rcode) { + p->lowspeed = false; + addrPool.FreeAddress(bAddress); + bAddress = 0; + USBTRACE2("setAddr:", rcode); + return rcode; + } + + USBTRACE2("Addr:", bAddress); + + p->lowspeed = false; + + p = addrPool.GetUsbDevicePtr(bAddress); + + if(!p) + return USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL; + + p->lowspeed = lowspeed; + + // Assign epInfo to epinfo pointer + rcode = pUsb->setEpInfoEntry(bAddress, 1, epInfo); + + if(rcode) + goto FailSetDevTblEntry; + + USBTRACE2("NC:", num_of_conf); + + for(uint8_t i = 0; i < num_of_conf; i++) { + ConfigDescParser< USB_CLASS_MASS_STORAGE, + MASS_SUBCLASS_SCSI, + MASS_PROTO_BBB, + CP_MASK_COMPARE_CLASS | + CP_MASK_COMPARE_SUBCLASS | + CP_MASK_COMPARE_PROTOCOL > BulkOnlyParser(this); + + rcode = pUsb->getConfDescr(bAddress, 0, i, &BulkOnlyParser); + + if(rcode) + goto FailGetConfDescr; + + if(bNumEP > 1) + break; + } + + if(bNumEP < 3) + return USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED; + + // Assign epInfo to epinfo pointer + pUsb->setEpInfoEntry(bAddress, bNumEP, epInfo); + + USBTRACE2("Conf:", bConfNum); + + // Set Configuration Value + rcode = pUsb->setConf(bAddress, 0, bConfNum); + + if(rcode) + goto FailSetConfDescr; + + //Linux does a 1sec delay after this. + delay(1000); + + rcode = GetMaxLUN(&bMaxLUN); + if(rcode) + goto FailGetMaxLUN; + + if(bMaxLUN >= MASS_MAX_SUPPORTED_LUN) bMaxLUN = MASS_MAX_SUPPORTED_LUN - 1; + ErrorMessage (PSTR("MaxLUN"), bMaxLUN); + + delay(1000); // Delay a bit for slow firmware. + + for(uint8_t lun = 0; lun <= bMaxLUN; lun++) { + InquiryResponse response; + rcode = Inquiry(lun, sizeof (InquiryResponse), (uint8_t*) & response); + if(rcode) { + ErrorMessage (PSTR("Inquiry"), rcode); + } else { +#if 0 + printf("LUN %i `", lun); + uint8_t *buf = response.VendorID; + for(int i = 0; i < 28; i++) printf("%c", buf[i]); + printf("'\r\nQualifier %1.1X ", response.PeripheralQualifier); + printf("Device type %2.2X ", response.DeviceType); + printf("RMB %1.1X ", response.Removable); + printf("SSCS %1.1X ", response.SCCS); + uint8_t sv = response.Version; + printf("SCSI version %2.2X\r\nDevice conforms to ", sv); + switch(sv) { + case 0: + printf("No specific"); + break; + case 1: + printf("ANSI X3.131-1986 (ANSI 1)"); + break; + case 2: + printf("ANSI X3.131-1994 (ANSI 2)"); + break; + case 3: + printf("ANSI INCITS 301-1997 (SPC)"); + break; + case 4: + printf("ANSI INCITS 351-2001 (SPC-2)"); + break; + case 5: + printf("ANSI INCITS 408-2005 (SPC-4)"); + break; + case 6: + printf("T10/1731-D (SPC-4)"); + break; + default: + printf("unknown"); + } + printf(" standards.\r\n"); +#endif + uint8_t tries = 0xf0; + while((rcode = TestUnitReady(lun))) { + if(rcode == 0x08) break; // break on no media, this is OK to do. + // try to lock media and spin up + if(tries < 14) { + LockMedia(lun, 1); + MediaCTL(lun, 1); // I actually have a USB stick that needs this! + } else delay(2 * (tries + 1)); + tries++; + if(!tries) break; + } + if(!rcode) { + delay(1000); + LUNOk[lun] = CheckLUN(lun); + if(!LUNOk[lun]) LUNOk[lun] = CheckLUN(lun); + } + } + } + + + CheckMedia(); + + rcode = OnInit(); + + if(rcode) + goto FailOnInit; + +#ifdef DEBUG_USB_HOST + USBTRACE("MS configured\r\n\r\n"); +#endif + + bPollEnable = true; + + //USBTRACE("Poll enabled\r\n"); + return 0; + +FailSetConfDescr: +#ifdef DEBUG_USB_HOST + NotifyFailSetConfDescr(); + goto Fail; +#endif + +FailOnInit: +#ifdef DEBUG_USB_HOST + USBTRACE("OnInit:"); + goto Fail; +#endif + +FailGetMaxLUN: +#ifdef DEBUG_USB_HOST + USBTRACE("GetMaxLUN:"); + goto Fail; +#endif + + //#ifdef DEBUG_USB_HOST + //FailInvalidSectorSize: + // USBTRACE("Sector Size is NOT VALID: "); + // goto Fail; + //#endif + +FailSetDevTblEntry: +#ifdef DEBUG_USB_HOST + NotifyFailSetDevTblEntry(); + goto Fail; +#endif + +FailGetConfDescr: +#ifdef DEBUG_USB_HOST + NotifyFailGetConfDescr(); +#endif + +#ifdef DEBUG_USB_HOST +Fail: + NotifyFail(rcode); +#endif + Release(); + return rcode; +} + +/** + * For driver use only. + * + * @param conf + * @param iface + * @param alt + * @param proto + * @param pep + */ +void BulkOnly::EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto __attribute__((unused)), const USB_ENDPOINT_DESCRIPTOR * pep) { + ErrorMessage (PSTR("Conf.Val"), conf); + ErrorMessage (PSTR("Iface Num"), iface); + ErrorMessage (PSTR("Alt.Set"), alt); + + bConfNum = conf; + + uint8_t index; + +#if 1 + if((pep->bmAttributes & bmUSB_TRANSFER_TYPE) == USB_TRANSFER_TYPE_BULK) { + index = ((pep->bEndpointAddress & 0x80) == 0x80) ? epDataInIndex : epDataOutIndex; + // Fill in the endpoint info structure + epInfo[index].epAddr = (pep->bEndpointAddress & 0x0F); + epInfo[index].maxPktSize = (uint8_t)pep->wMaxPacketSize; + epInfo[index].bmSndToggle = 0; + epInfo[index].bmRcvToggle = 0; + + bNumEP++; + + PrintEndpointDescriptor(pep); + + } +#else + if((pep->bmAttributes & bmUSB_TRANSFER_TYPE) == USB_TRANSFER_TYPE_INTERRUPT && (pep->bEndpointAddress & 0x80) == 0x80) + index = epInterruptInIndex; + else if((pep->bmAttributes & bmUSB_TRANSFER_TYPE) == USB_TRANSFER_TYPE_BULK) + index = ((pep->bEndpointAddress & 0x80) == 0x80) ? epDataInIndex : epDataOutIndex; + else + return; + + // Fill in the endpoint info structure + epInfo[index].epAddr = (pep->bEndpointAddress & 0x0F); + epInfo[index].maxPktSize = (uint8_t)pep->wMaxPacketSize; + epInfo[index].bmSndToggle = 0; + epInfo[index].bmRcvToggle = 0; + + bNumEP++; + + PrintEndpointDescriptor(pep); +#endif +} + +/** + * For driver use only. + * + * @return + */ +uint8_t BulkOnly::Release() { + ClearAllEP(); + pUsb->GetAddressPool().FreeAddress(bAddress); + return 0; +} + +/** + * For driver use only. + * + * @param lun Logical Unit Number + * @return true if LUN is ready for use. + */ +bool BulkOnly::CheckLUN(uint8_t lun) { + uint8_t rcode; + Capacity capacity; + for(uint8_t i = 0; i < 8; i++) capacity.data[i] = 0; + + rcode = ReadCapacity10(lun, (uint8_t*)capacity.data); + if(rcode) { + //printf(">>>>>>>>>>>>>>>>ReadCapacity returned %i\r\n", rcode); + return false; + } + ErrorMessage (PSTR(">>>>>>>>>>>>>>>>CAPACITY OK ON LUN"), lun); + for(uint8_t i = 0; i < 8 /*sizeof (Capacity)*/; i++) + D_PrintHex (capacity.data[i], 0x80); + Notify(PSTR("\r\n\r\n"), 0x80); + // Only 512/1024/2048/4096 are valid values! + uint32_t c = BMAKE32(capacity.data[4], capacity.data[5], capacity.data[6], capacity.data[7]); + if(c != 0x0200LU && c != 0x0400LU && c != 0x0800LU && c != 0x1000LU) { + return false; + } + // Store capacity information. + CurrentSectorSize[lun] = (uint16_t)(c); // & 0xFFFF); + + CurrentCapacity[lun] = BMAKE32(capacity.data[0], capacity.data[1], capacity.data[2], capacity.data[3]) + 1; + if(CurrentCapacity[lun] == /*0xffffffffLU */ 0x01LU || CurrentCapacity[lun] == 0x00LU) { + // Buggy firmware will report 0xffffffff or 0 for no media + if(CurrentCapacity[lun]) + ErrorMessage (PSTR(">>>>>>>>>>>>>>>>BUGGY FIRMWARE. CAPACITY FAIL ON LUN"), lun); + return false; + } + delay(20); + Page3F(lun); + if(!TestUnitReady(lun)) return true; + return false; +} + +/** + * For driver use only. + * + * Scan for media change on all LUNs + */ +void BulkOnly::CheckMedia() { + for(uint8_t lun = 0; lun <= bMaxLUN; lun++) { + if(TestUnitReady(lun)) { + LUNOk[lun] = false; + continue; + } + if(!LUNOk[lun]) + LUNOk[lun] = CheckLUN(lun); + } +#if 0 + printf("}}}}}}}}}}}}}}}}STATUS "); + for(uint8_t lun = 0; lun <= bMaxLUN; lun++) { + if(LUNOk[lun]) + printf("#"); + else printf("."); + } + printf("\r\n"); +#endif + qNextPollTime = (uint32_t)millis() + 2000; +} + +/** + * For driver use only. + * + * @return + */ +uint8_t BulkOnly::Poll() { + //uint8_t rcode = 0; + + if(!bPollEnable) + return 0; + + if((int32_t)((uint32_t)millis() - qNextPollTime) >= 0L) { + CheckMedia(); + } + //rcode = 0; + + return 0; +} + +//////////////////////////////////////////////////////////////////////////////// + + +// SCSI code + + +//////////////////////////////////////////////////////////////////////////////// + +/** + * For driver use only. + * + * @param plun + * @return + */ +uint8_t BulkOnly::GetMaxLUN(uint8_t *plun) { + uint8_t ret = pUsb->ctrlReq(bAddress, 0, bmREQ_MASSIN, MASS_REQ_GET_MAX_LUN, 0, 0, bIface, 1, 1, plun, NULL); + + if(ret == hrSTALL) + *plun = 0; + + return 0; +} + +/** + * For driver use only. Used during Driver Init + * + * @param lun Logical Unit Number + * @param bsize + * @param buf + * @return + */ +uint8_t BulkOnly::Inquiry(uint8_t lun, uint16_t bsize, uint8_t *buf) { + Notify(PSTR("\r\nInquiry\r\n"), 0x80); + Notify(PSTR("---------\r\n"), 0x80); + + CDB6_t cdb = CDB6_t(SCSI_CMD_INQUIRY, lun, 0LU, (uint8_t)bsize, 0); + uint8_t rc = SCSITransaction6(&cdb, bsize, buf, (uint8_t)MASS_CMD_DIR_IN); + + return rc; +} + +/** + * For driver use only. + * + * @param lun Logical Unit Number + * @return + */ +uint8_t BulkOnly::TestUnitReady(uint8_t lun) { + //SetCurLUN(lun); + if(!bAddress) + return MASS_ERR_UNIT_NOT_READY; + + Notify(PSTR("\r\nTestUnitReady\r\n"), 0x80); + Notify(PSTR("-----------------\r\n"), 0x80); + + CDB6_t cdb = CDB6_t(SCSI_CMD_TEST_UNIT_READY, lun, (uint8_t)0, 0); + return SCSITransaction6(&cdb, 0, NULL, (uint8_t)MASS_CMD_DIR_IN); + +} + +/** + * For driver use only. + * + * @param lun Logical Unit Number + * @param pc + * @param page + * @param subpage + * @param len + * @param pbuf + * @return + */ +uint8_t BulkOnly::ModeSense6(uint8_t lun, uint8_t pc, uint8_t page, uint8_t subpage, uint8_t len, uint8_t * pbuf) { + Notify(PSTR("\r\rModeSense\r\n"), 0x80); + Notify(PSTR("------------\r\n"), 0x80); + + CDB6_t cdb = CDB6_t(SCSI_CMD_MODE_SENSE_6, lun, (uint32_t)((((pc << 6) | page) << 8) | subpage), len, 0); + return SCSITransaction6(&cdb, len, pbuf, (uint8_t)MASS_CMD_DIR_IN); +} + +/** + * For driver use only. + * + * @param lun Logical Unit Number + * @param bsize + * @param buf + * @return + */ +uint8_t BulkOnly::ReadCapacity10(uint8_t lun, uint8_t *buf) { + Notify(PSTR("\r\nReadCapacity\r\n"), 0x80); + Notify(PSTR("---------------\r\n"), 0x80); + + CDB10_t cdb = CDB10_t(SCSI_CMD_READ_CAPACITY_10, lun); + return SCSITransaction10(&cdb, 8, buf, (uint8_t)MASS_CMD_DIR_IN); +} + +/** + * For driver use only. + * + * Page 3F contains write protect status. + * + * @param lun Logical Unit Number to test. + * @return Write protect switch status. + */ +uint8_t BulkOnly::Page3F(uint8_t lun) { + uint8_t buf[192]; + for(int i = 0; i < 192; i++) { + buf[i] = 0x00; + } + WriteOk[lun] = true; + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) && defined(SKIP_WRITE_PROTECT) + return 0; + #endif + uint8_t rc = ModeSense6(lun, 0, 0x3f, 0, 192, buf); + if(!rc) { + WriteOk[lun] = ((buf[2] & 0x80) == 0); + Notify(PSTR("Mode Sense: "), 0x80); + for(int i = 0; i < 4; i++) { + D_PrintHex (buf[i], 0x80); + Notify(PSTR(" "), 0x80); + } + Notify(PSTR("\r\n"), 0x80); + } + return rc; +} + +/** + * For driver use only. + * + * @param lun Logical Unit Number + * @param size + * @param buf + * @return + */ +uint8_t BulkOnly::RequestSense(uint8_t lun, uint16_t size, uint8_t *buf) { + Notify(PSTR("\r\nRequestSense\r\n"), 0x80); + Notify(PSTR("----------------\r\n"), 0x80); + + CDB6_t cdb = CDB6_t(SCSI_CMD_REQUEST_SENSE, lun, 0LU, (uint8_t)size, 0); + CommandBlockWrapper cbw = CommandBlockWrapper(++dCBWTag, (uint32_t)size, &cdb, (uint8_t)MASS_CMD_DIR_IN); + //SetCurLUN(lun); + return Transaction(&cbw, size, buf); +} + + +//////////////////////////////////////////////////////////////////////////////// + + +// USB code + + +//////////////////////////////////////////////////////////////////////////////// + +/** + * For driver use only. + * + * @param index + * @return + */ +uint8_t BulkOnly::ClearEpHalt(uint8_t index) { + if(index == 0) + return 0; + + uint8_t ret = 0; + + while((ret = (pUsb->ctrlReq(bAddress, 0, USB_SETUP_HOST_TO_DEVICE | USB_SETUP_TYPE_STANDARD | USB_SETUP_RECIPIENT_ENDPOINT, USB_REQUEST_CLEAR_FEATURE, USB_FEATURE_ENDPOINT_HALT, 0, ((index == epDataInIndex) ? (0x80 | epInfo[index].epAddr) : epInfo[index].epAddr), 0, 0, NULL, NULL)) == 0x01)) + delay(6); + + if(ret) { + ErrorMessage (PSTR("ClearEpHalt"), ret); + ErrorMessage (PSTR("EP"), ((index == epDataInIndex) ? (0x80 | epInfo[index].epAddr) : epInfo[index].epAddr)); + return ret; + } + epInfo[index].bmSndToggle = 0; + epInfo[index].bmRcvToggle = 0; + return 0; +} + +/** + * For driver use only. + * + */ +void BulkOnly::Reset() { + while(pUsb->ctrlReq(bAddress, 0, bmREQ_MASSOUT, MASS_REQ_BOMSR, 0, 0, bIface, 0, 0, NULL, NULL) == 0x01) delay(6); +} + +/** + * For driver use only. + * + * @return 0 if successful + */ +uint8_t BulkOnly::ResetRecovery() { + Notify(PSTR("\r\nResetRecovery\r\n"), 0x80); + Notify(PSTR("-----------------\r\n"), 0x80); + + delay(6); + Reset(); + delay(6); + ClearEpHalt(epDataInIndex); + delay(6); + bLastUsbError = ClearEpHalt(epDataOutIndex); + delay(6); + return bLastUsbError; +} + +/** + * For driver use only. + * + * Clear all EP data and clear all LUN status + */ +void BulkOnly::ClearAllEP() { + for(uint8_t i = 0; i < MASS_MAX_ENDPOINTS; i++) { + epInfo[i].epAddr = 0; + epInfo[i].maxPktSize = (i) ? 0 : 8; + epInfo[i].bmSndToggle = 0; + epInfo[i].bmRcvToggle = 0; + epInfo[i].bmNakPower = USB_NAK_DEFAULT; + } + + for(uint8_t i = 0; i < MASS_MAX_SUPPORTED_LUN; i++) { + LUNOk[i] = false; + WriteOk[i] = false; + CurrentCapacity[i] = 0lu; + CurrentSectorSize[i] = 0; + } + + bIface = 0; + bNumEP = 1; + bAddress = 0; + qNextPollTime = 0; + bPollEnable = false; + bLastUsbError = 0; + bMaxLUN = 0; + bTheLUN = 0; +} + +/** + * For driver use only. + * + * @param pcsw + * @param pcbw + * @return + */ +bool BulkOnly::IsValidCSW(CommandStatusWrapper *pcsw, CommandBlockWrapperBase *pcbw) { + if(pcsw->dCSWSignature != MASS_CSW_SIGNATURE) { + Notify(PSTR("CSW:Sig error\r\n"), 0x80); + return false; + } + if(pcsw->dCSWTag != pcbw->dCBWTag) { + Notify(PSTR("CSW:Wrong tag\r\n"), 0x80); + return false; + } + return true; +} + +/** + * For driver use only. + * + * @param error + * @param index + * @return + */ +uint8_t BulkOnly::HandleUsbError(uint8_t error, uint8_t index) { + uint8_t count = 3; + + bLastUsbError = error; + //if (error) + //ClearEpHalt(index); + while(error && count) { + if(error != hrSUCCESS) { + ErrorMessage (PSTR("USB Error"), error); + ErrorMessage (PSTR("Index"), index); + } + switch(error) { + // case hrWRONGPID: + case hrSUCCESS: + return MASS_ERR_SUCCESS; + case hrBUSY: + // SIE is busy, just hang out and try again. + return MASS_ERR_UNIT_BUSY; + case hrTIMEOUT: + case hrJERR: return MASS_ERR_DEVICE_DISCONNECTED; + case hrSTALL: + if(index == 0) + return MASS_ERR_STALL; + ClearEpHalt(index); + if(index != epDataInIndex) + return MASS_ERR_WRITE_STALL; + return MASS_ERR_STALL; + + case hrNAK: + if(index == 0) + return MASS_ERR_UNIT_BUSY; + return MASS_ERR_UNIT_BUSY; + + case hrTOGERR: + // Handle a very super rare corner case, where toggles become de-synched. + // I have only ran into one device that has this firmware bug, and this is + // the only clean way to get back into sync with the buggy device firmware. + // --AJK + if(bAddress && bConfNum) { + error = pUsb->setConf(bAddress, 0, bConfNum); + + if(error) + break; + } + return MASS_ERR_SUCCESS; + default: + ErrorMessage (PSTR("\r\nUSB"), error); + return MASS_ERR_GENERAL_USB_ERROR; + } + count--; + } // while + + return ((error && !count) ? MASS_ERR_GENERAL_USB_ERROR : MASS_ERR_SUCCESS); +} + +#if MS_WANT_PARSER + +uint8_t BulkOnly::Transaction(CommandBlockWrapper *pcbw, uint16_t buf_size, void *buf) { + return Transaction(CommandBlockWrapper *pcbw, uint16_t buf_size, void *buf, 0); +} +#endif + +/** + * For driver use only. + * + * @param pcbw + * @param buf_size + * @param buf + * @param flags + * @return + */ +uint8_t BulkOnly::Transaction(CommandBlockWrapper *pcbw, uint16_t buf_size, void *buf +#if MS_WANT_PARSER + , uint8_t flags +#endif + ) { + +#if MS_WANT_PARSER + uint16_t bytes = (pcbw->dCBWDataTransferLength > buf_size) ? buf_size : pcbw->dCBWDataTransferLength; + printf("Transfersize %i\r\n", bytes); + delay(1000); + + bool callback = (flags & MASS_TRANS_FLG_CALLBACK) == MASS_TRANS_FLG_CALLBACK; +#else + uint16_t bytes = buf_size; +#endif + bool write = (pcbw->bmCBWFlags & MASS_CMD_DIR_IN) != MASS_CMD_DIR_IN; + uint8_t ret = 0; + uint8_t usberr; + CommandStatusWrapper csw; // up here, we allocate ahead to save cpu cycles. + SetCurLUN(pcbw->bmCBWLUN); + ErrorMessage (PSTR("CBW.dCBWTag"), pcbw->dCBWTag); + + while((usberr = pUsb->outTransfer(bAddress, epInfo[epDataOutIndex].epAddr, sizeof (CommandBlockWrapper), (uint8_t*)pcbw)) == hrBUSY) delay(1); + + ret = HandleUsbError(usberr, epDataOutIndex); + //ret = HandleUsbError(pUsb->outTransfer(bAddress, epInfo[epDataOutIndex].epAddr, sizeof (CommandBlockWrapper), (uint8_t*)pcbw), epDataOutIndex); + if(ret) { + ErrorMessage (PSTR("============================ CBW"), ret); + } else { + if(bytes) { + if(!write) { +#if MS_WANT_PARSER + if(callback) { + uint8_t rbuf[bytes]; + while((usberr = pUsb->inTransfer(bAddress, epInfo[epDataInIndex].epAddr, &bytes, rbuf)) == hrBUSY) delay(1); + if(usberr == hrSUCCESS) ((USBReadParser*)buf)->Parse(bytes, rbuf, 0); + } else { +#endif + while((usberr = pUsb->inTransfer(bAddress, epInfo[epDataInIndex].epAddr, &bytes, (uint8_t*)buf)) == hrBUSY) delay(1); +#if MS_WANT_PARSER + + } +#endif + ret = HandleUsbError(usberr, epDataInIndex); + } else { + while((usberr = pUsb->outTransfer(bAddress, epInfo[epDataOutIndex].epAddr, bytes, (uint8_t*)buf)) == hrBUSY) delay(1); + ret = HandleUsbError(usberr, epDataOutIndex); + } + if(ret) { + ErrorMessage (PSTR("============================ DAT"), ret); + } + } + } + + { + bytes = sizeof (CommandStatusWrapper); + int tries = 2; + while(tries--) { + while((usberr = pUsb->inTransfer(bAddress, epInfo[epDataInIndex].epAddr, &bytes, (uint8_t*) & csw)) == hrBUSY) delay(1); + if(!usberr) break; + ClearEpHalt(epDataInIndex); + if(tries) ResetRecovery(); + } + if(!ret) { + Notify(PSTR("CBW:\t\tOK\r\n"), 0x80); + Notify(PSTR("Data Stage:\tOK\r\n"), 0x80); + } else { + // Throw away csw, IT IS NOT OF ANY USE. + ResetRecovery(); + return ret; + } + ret = HandleUsbError(usberr, epDataInIndex); + if(ret) { + ErrorMessage (PSTR("============================ CSW"), ret); + } + if(usberr == hrSUCCESS) { + if(IsValidCSW(&csw, pcbw)) { + //ErrorMessage (PSTR("CSW.dCBWTag"), csw.dCSWTag); + //ErrorMessage (PSTR("bCSWStatus"), csw.bCSWStatus); + //ErrorMessage (PSTR("dCSWDataResidue"), csw.dCSWDataResidue); + Notify(PSTR("CSW:\t\tOK\r\n\r\n"), 0x80); + return csw.bCSWStatus; + } else { + // NOTE! Sometimes this is caused by the reported residue being wrong. + // Get a different device. It isn't compliant, and should have never passed Q&A. + // I own one... 05e3:0701 Genesys Logic, Inc. USB 2.0 IDE Adapter. + // Other devices that exhibit this behavior exist in the wild too. + // Be sure to check quirks in the Linux source code before reporting a bug. --xxxajk + Notify(PSTR("Invalid CSW\r\n"), 0x80); + ResetRecovery(); + //return MASS_ERR_SUCCESS; + return MASS_ERR_INVALID_CSW; + } + } + } + return ret; +} + +/** + * For driver use only. + * + * @param lun Logical Unit Number + * @return + */ +uint8_t BulkOnly::SetCurLUN(uint8_t lun) { + if(lun > bMaxLUN) + return MASS_ERR_INVALID_LUN; + bTheLUN = lun; + return MASS_ERR_SUCCESS; +}; + +/** + * For driver use only. + * + * @param status + * @return + */ +uint8_t BulkOnly::HandleSCSIError(uint8_t status) { + uint8_t ret = 0; + + switch(status) { + case 0: return MASS_ERR_SUCCESS; + + case 2: + ErrorMessage (PSTR("Phase Error"), status); + ErrorMessage (PSTR("LUN"), bTheLUN); + ResetRecovery(); + return MASS_ERR_GENERAL_SCSI_ERROR; + + case 1: + ErrorMessage (PSTR("SCSI Error"), status); + ErrorMessage (PSTR("LUN"), bTheLUN); + RequestSenseResponce rsp; + + ret = RequestSense(bTheLUN, sizeof (RequestSenseResponce), (uint8_t*) & rsp); + + if(ret) { + return MASS_ERR_GENERAL_SCSI_ERROR; + } + ErrorMessage (PSTR("Response Code"), rsp.bResponseCode); + if(rsp.bResponseCode & 0x80) { + Notify(PSTR("Information field: "), 0x80); + for(int i = 0; i < 4; i++) { + D_PrintHex (rsp.CmdSpecificInformation[i], 0x80); + Notify(PSTR(" "), 0x80); + } + Notify(PSTR("\r\n"), 0x80); + } + ErrorMessage (PSTR("Sense Key"), rsp.bmSenseKey); + ErrorMessage (PSTR("Add Sense Code"), rsp.bAdditionalSenseCode); + ErrorMessage (PSTR("Add Sense Qual"), rsp.bAdditionalSenseQualifier); + // warning, this is not testing ASQ, only SK and ASC. + switch(rsp.bmSenseKey) { + case SCSI_S_UNIT_ATTENTION: + switch(rsp.bAdditionalSenseCode) { + case SCSI_ASC_MEDIA_CHANGED: + return MASS_ERR_MEDIA_CHANGED; + default: + return MASS_ERR_UNIT_NOT_READY; + } + case SCSI_S_NOT_READY: + switch(rsp.bAdditionalSenseCode) { + case SCSI_ASC_MEDIUM_NOT_PRESENT: + return MASS_ERR_NO_MEDIA; + default: + return MASS_ERR_UNIT_NOT_READY; + } + case SCSI_S_ILLEGAL_REQUEST: + switch(rsp.bAdditionalSenseCode) { + case SCSI_ASC_LBA_OUT_OF_RANGE: + return MASS_ERR_BAD_LBA; + default: + return MASS_ERR_CMD_NOT_SUPPORTED; + } + default: + return MASS_ERR_GENERAL_SCSI_ERROR; + } + + // case 4: return MASS_ERR_UNIT_BUSY; // Busy means retry later. + // case 0x05/0x14: we stalled out + // case 0x15/0x16: we naked out. + default: + ErrorMessage (PSTR("Gen SCSI Err"), status); + ErrorMessage (PSTR("LUN"), bTheLUN); + return status; + } // switch +} + + +//////////////////////////////////////////////////////////////////////////////// + + +// Debugging code + + +//////////////////////////////////////////////////////////////////////////////// + +/** + * + * @param ep_ptr + */ +void BulkOnly::PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR * ep_ptr) { + Notify(PSTR("Endpoint descriptor:"), 0x80); + Notify(PSTR("\r\nLength:\t\t"), 0x80); + D_PrintHex (ep_ptr->bLength, 0x80); + Notify(PSTR("\r\nType:\t\t"), 0x80); + D_PrintHex (ep_ptr->bDescriptorType, 0x80); + Notify(PSTR("\r\nAddress:\t"), 0x80); + D_PrintHex (ep_ptr->bEndpointAddress, 0x80); + Notify(PSTR("\r\nAttributes:\t"), 0x80); + D_PrintHex (ep_ptr->bmAttributes, 0x80); + Notify(PSTR("\r\nMaxPktSize:\t"), 0x80); + D_PrintHex (ep_ptr->wMaxPacketSize, 0x80); + Notify(PSTR("\r\nPoll Intrv:\t"), 0x80); + D_PrintHex (ep_ptr->bInterval, 0x80); + Notify(PSTR("\r\n"), 0x80); +} + + +//////////////////////////////////////////////////////////////////////////////// + + +// misc/to kill/to-do + + +//////////////////////////////////////////////////////////////////////////////// + +/* We won't be needing this... */ +uint8_t BulkOnly::Read(uint8_t lun __attribute__((unused)), uint32_t addr __attribute__((unused)), uint16_t bsize __attribute__((unused)), uint8_t blocks __attribute__((unused)), USBReadParser * prs __attribute__((unused))) { +#if MS_WANT_PARSER + if(!LUNOk[lun]) return MASS_ERR_NO_MEDIA; + Notify(PSTR("\r\nRead (With parser)\r\n"), 0x80); + Notify(PSTR("---------\r\n"), 0x80); + + CommandBlockWrapper cbw = CommandBlockWrapper(); + + cbw.dCBWSignature = MASS_CBW_SIGNATURE; + cbw.dCBWTag = ++dCBWTag; + cbw.dCBWDataTransferLength = ((uint32_t)bsize * blocks); + cbw.bmCBWFlags = MASS_CMD_DIR_IN, + cbw.bmCBWLUN = lun; + cbw.bmCBWCBLength = 10; + + cbw.CBWCB[0] = SCSI_CMD_READ_10; + cbw.CBWCB[8] = blocks; + cbw.CBWCB[2] = ((addr >> 24) & 0xff); + cbw.CBWCB[3] = ((addr >> 16) & 0xff); + cbw.CBWCB[4] = ((addr >> 8) & 0xff); + cbw.CBWCB[5] = (addr & 0xff); + + return HandleSCSIError(Transaction(&cbw, bsize, prs, 1)); +#else + return MASS_ERR_NOT_IMPLEMENTED; +#endif +} + +#endif // USB_FLASH_DRIVE_SUPPORT diff --git a/Marlin/src/sd/usb_flashdrive/lib/masstorage.h b/Marlin/src/sd/usb_flashdrive/lib/masstorage.h new file mode 100644 index 0000000000..672f55b250 --- /dev/null +++ b/Marlin/src/sd/usb_flashdrive/lib/masstorage.h @@ -0,0 +1,576 @@ +/* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. + +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 2 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, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Contact information +------------------- + +Circuits At Home, LTD +Web : http://www.circuitsathome.com +e-mail : support@circuitsathome.com + */ + +#pragma once + +// Cruft removal, makes driver smaller, faster. +#ifndef MS_WANT_PARSER + #define MS_WANT_PARSER 0 +#endif + +#include "Usb.h" + +#define bmREQ_MASSOUT USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_INTERFACE +#define bmREQ_MASSIN USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_INTERFACE + +// Mass Storage Subclass Constants +#define MASS_SUBCLASS_SCSI_NOT_REPORTED 0x00 // De facto use +#define MASS_SUBCLASS_RBC 0x01 +#define MASS_SUBCLASS_ATAPI 0x02 // MMC-5 (ATAPI) +#define MASS_SUBCLASS_OBSOLETE1 0x03 // Was QIC-157 +#define MASS_SUBCLASS_UFI 0x04 // Specifies how to interface Floppy Disk Drives to USB +#define MASS_SUBCLASS_OBSOLETE2 0x05 // Was SFF-8070i +#define MASS_SUBCLASS_SCSI 0x06 // SCSI Transparent Command Set +#define MASS_SUBCLASS_LSDFS 0x07 // Specifies how host has to negotiate access before trying SCSI +#define MASS_SUBCLASS_IEEE1667 0x08 + +// Mass Storage Class Protocols +#define MASS_PROTO_CBI 0x00 // CBI (with command completion interrupt) +#define MASS_PROTO_CBI_NO_INT 0x01 // CBI (without command completion interrupt) +#define MASS_PROTO_OBSOLETE 0x02 +#define MASS_PROTO_BBB 0x50 // Bulk Only Transport +#define MASS_PROTO_UAS 0x62 + +// Request Codes +#define MASS_REQ_ADSC 0x00 +#define MASS_REQ_GET 0xFC +#define MASS_REQ_PUT 0xFD +#define MASS_REQ_GET_MAX_LUN 0xFE +#define MASS_REQ_BOMSR 0xFF // Bulk-Only Mass Storage Reset + +#define MASS_CBW_SIGNATURE 0x43425355 +#define MASS_CSW_SIGNATURE 0x53425355 + +#define MASS_CMD_DIR_OUT 0 // (0 << 7) +#define MASS_CMD_DIR_IN 0x80 //(1 << 7) + +/* + * Reference documents from T10 (http://www.t10.org) + * SCSI Primary Commands - 3 (SPC-3) + * SCSI Block Commands - 2 (SBC-2) + * Multi-Media Commands - 5 (MMC-5) + */ + +/* Group 1 commands (CDB's here are should all be 6-bytes) */ +#define SCSI_CMD_TEST_UNIT_READY 0x00 +#define SCSI_CMD_REQUEST_SENSE 0x03 +#define SCSI_CMD_FORMAT_UNIT 0x04 +#define SCSI_CMD_READ_6 0x08 +#define SCSI_CMD_WRITE_6 0x0A +#define SCSI_CMD_INQUIRY 0x12 +#define SCSI_CMD_MODE_SELECT_6 0x15 +#define SCSI_CMD_MODE_SENSE_6 0x1A +#define SCSI_CMD_START_STOP_UNIT 0x1B +#define SCSI_CMD_PREVENT_REMOVAL 0x1E +/* Group 2 Commands (CDB's here are 10-bytes) */ +#define SCSI_CMD_READ_FORMAT_CAPACITIES 0x23 +#define SCSI_CMD_READ_CAPACITY_10 0x25 +#define SCSI_CMD_READ_10 0x28 +#define SCSI_CMD_WRITE_10 0x2A +#define SCSI_CMD_SEEK_10 0x2B +#define SCSI_CMD_ERASE_10 0x2C +#define SCSI_CMD_WRITE_AND_VERIFY_10 0x2E +#define SCSI_CMD_VERIFY_10 0x2F +#define SCSI_CMD_SYNCHRONIZE_CACHE 0x35 +#define SCSI_CMD_WRITE_BUFFER 0x3B +#define SCSI_CMD_READ_BUFFER 0x3C +#define SCSI_CMD_READ_SUBCHANNEL 0x42 +#define SCSI_CMD_READ_TOC 0x43 +#define SCSI_CMD_READ_HEADER 0x44 +#define SCSI_CMD_PLAY_AUDIO_10 0x45 +#define SCSI_CMD_GET_CONFIGURATION 0x46 +#define SCSI_CMD_PLAY_AUDIO_MSF 0x47 +#define SCSI_CMD_PLAY_AUDIO_TI 0x48 +#define SCSI_CMD_PLAY_TRACK_REL_10 0x49 +#define SCSI_CMD_GET_EVENT_STATUS 0x4A +#define SCSI_CMD_PAUSE_RESUME 0x4B +#define SCSI_CMD_READ_DISC_INFORMATION 0x51 +#define SCSI_CMD_READ_TRACK_INFORMATION 0x52 +#define SCSI_CMD_RESERVE_TRACK 0x53 +#define SCSI_CMD_SEND_OPC_INFORMATION 0x54 +#define SCSI_CMD_MODE_SELECT_10 0x55 +#define SCSI_CMD_REPAIR_TRACK 0x58 +#define SCSI_CMD_MODE_SENSE_10 0x5A +#define SCSI_CMD_CLOSE_TRACK_SESSION 0x5B +#define SCSI_CMD_READ_BUFFER_CAPACITY 0x5C +#define SCSI_CMD_SEND_CUE_SHEET 0x5D +/* Group 5 Commands (CDB's here are 12-bytes) */ +#define SCSI_CMD_REPORT_LUNS 0xA0 +#define SCSI_CMD_BLANK 0xA1 +#define SCSI_CMD_SECURITY_PROTOCOL_IN 0xA2 +#define SCSI_CMD_SEND_KEY 0xA3 +#define SCSI_CMD_REPORT_KEY 0xA4 +#define SCSI_CMD_PLAY_AUDIO_12 0xA5 +#define SCSI_CMD_LOAD_UNLOAD 0xA6 +#define SCSI_CMD_SET_READ_AHEAD 0xA7 +#define SCSI_CMD_READ_12 0xA8 +#define SCSI_CMD_PLAY_TRACK_REL_12 0xA9 +#define SCSI_CMD_WRITE_12 0xAA +#define SCSI_CMD_READ_MEDIA_SERIAL_12 0xAB +#define SCSI_CMD_GET_PERFORMANCE 0xAC +#define SCSI_CMD_READ_DVD_STRUCTURE 0xAD +#define SCSI_CMD_SECURITY_PROTOCOL_OUT 0xB5 +#define SCSI_CMD_SET_STREAMING 0xB6 +#define SCSI_CMD_READ_MSF 0xB9 +#define SCSI_CMD_SET_SPEED 0xBB +#define SCSI_CMD_MECHANISM_STATUS 0xBD +#define SCSI_CMD_READ_CD 0xBE +#define SCSI_CMD_SEND_DISC_STRUCTURE 0xBF +/* Vendor-unique Commands, included for completeness */ +#define SCSI_CMD_CD_PLAYBACK_STATUS 0xC4 /* SONY unique */ +#define SCSI_CMD_PLAYBACK_CONTROL 0xC9 /* SONY unique */ +#define SCSI_CMD_READ_CDDA 0xD8 /* Vendor unique */ +#define SCSI_CMD_READ_CDXA 0xDB /* Vendor unique */ +#define SCSI_CMD_READ_ALL_SUBCODES 0xDF /* Vendor unique */ + +/* SCSI error codes */ +#define SCSI_S_NOT_READY 0x02 +#define SCSI_S_MEDIUM_ERROR 0x03 +#define SCSI_S_ILLEGAL_REQUEST 0x05 +#define SCSI_S_UNIT_ATTENTION 0x06 +#define SCSI_ASC_LBA_OUT_OF_RANGE 0x21 +#define SCSI_ASC_MEDIA_CHANGED 0x28 +#define SCSI_ASC_MEDIUM_NOT_PRESENT 0x3A + +/* USB error codes */ +#define MASS_ERR_SUCCESS 0x00 +#define MASS_ERR_PHASE_ERROR 0x02 +#define MASS_ERR_UNIT_NOT_READY 0x03 +#define MASS_ERR_UNIT_BUSY 0x04 +#define MASS_ERR_STALL 0x05 +#define MASS_ERR_CMD_NOT_SUPPORTED 0x06 +#define MASS_ERR_INVALID_CSW 0x07 +#define MASS_ERR_NO_MEDIA 0x08 +#define MASS_ERR_BAD_LBA 0x09 +#define MASS_ERR_MEDIA_CHANGED 0x0A +#define MASS_ERR_DEVICE_DISCONNECTED 0x11 +#define MASS_ERR_UNABLE_TO_RECOVER 0x12 // Reset recovery error +#define MASS_ERR_INVALID_LUN 0x13 +#define MASS_ERR_WRITE_STALL 0x14 +#define MASS_ERR_READ_NAKS 0x15 +#define MASS_ERR_WRITE_NAKS 0x16 +#define MASS_ERR_WRITE_PROTECTED 0x17 +#define MASS_ERR_NOT_IMPLEMENTED 0xFD +#define MASS_ERR_GENERAL_SCSI_ERROR 0xFE +#define MASS_ERR_GENERAL_USB_ERROR 0xFF +#define MASS_ERR_USER 0xA0 // For subclasses to define their own error codes + +#define MASS_TRANS_FLG_CALLBACK 0x01 // Callback is involved +#define MASS_TRANS_FLG_NO_STALL_CHECK 0x02 // STALL condition is not checked +#define MASS_TRANS_FLG_NO_PHASE_CHECK 0x04 // PHASE_ERROR is not checked + +#define MASS_MAX_ENDPOINTS 3 + +struct Capacity { + uint8_t data[8]; + //uint32_t dwBlockAddress; + //uint32_t dwBlockLength; +} __attribute__((packed)); + +struct BASICCDB { + uint8_t Opcode; + + unsigned unused : 5; + unsigned LUN : 3; + + uint8_t info[12]; +} __attribute__((packed)); + +typedef BASICCDB BASICCDB_t; + +struct CDB6 { + uint8_t Opcode; + + unsigned LBAMSB : 5; + unsigned LUN : 3; + + uint8_t LBAHB; + uint8_t LBALB; + uint8_t AllocationLength; + uint8_t Control; + +public: + + CDB6(uint8_t _Opcode, uint8_t _LUN, uint32_t LBA, uint8_t _AllocationLength, uint8_t _Control) : + Opcode(_Opcode), LBAMSB(BGRAB2(LBA) & 0x1f), LUN(_LUN), LBAHB(BGRAB1(LBA)), LBALB(BGRAB0(LBA)), + AllocationLength(_AllocationLength), Control(_Control) { + } + + CDB6(uint8_t _Opcode, uint8_t _LUN, uint8_t _AllocationLength, uint8_t _Control) : + Opcode(_Opcode), LBAMSB(0), LUN(_LUN), LBAHB(0), LBALB(0), + AllocationLength(_AllocationLength), Control(_Control) { + } +} __attribute__((packed)); + +typedef CDB6 CDB6_t; + +struct CDB10 { + uint8_t Opcode; + + unsigned Service_Action : 5; + unsigned LUN : 3; + + uint8_t LBA_L_M_MB; + uint8_t LBA_L_M_LB; + uint8_t LBA_L_L_MB; + uint8_t LBA_L_L_LB; + + uint8_t Misc2; + + uint8_t ALC_MB; + uint8_t ALC_LB; + + uint8_t Control; +public: + + CDB10(uint8_t _Opcode, uint8_t _LUN) : + Opcode(_Opcode), Service_Action(0), LUN(_LUN), + LBA_L_M_MB(0), LBA_L_M_LB(0), LBA_L_L_MB(0), LBA_L_L_LB(0), + Misc2(0), ALC_MB(0), ALC_LB(0), Control(0) { + } + + CDB10(uint8_t _Opcode, uint8_t _LUN, uint16_t xflen, uint32_t _LBA) : + Opcode(_Opcode), Service_Action(0), LUN(_LUN), + LBA_L_M_MB(BGRAB3(_LBA)), LBA_L_M_LB(BGRAB2(_LBA)), LBA_L_L_MB(BGRAB1(_LBA)), LBA_L_L_LB(BGRAB0(_LBA)), + Misc2(0), ALC_MB(BGRAB1(xflen)), ALC_LB(BGRAB0(xflen)), Control(0) { + } +} __attribute__((packed)); + +typedef CDB10 CDB10_t; + +struct CDB12 { + uint8_t Opcode; + + unsigned Service_Action : 5; + unsigned Misc : 3; + + uint8_t LBA_L_M_LB; + uint8_t LBA_L_L_MB; + uint8_t LBA_L_L_LB; + + uint8_t ALC_M_LB; + uint8_t ALC_L_MB; + uint8_t ALC_L_LB; + uint8_t Control; +} __attribute__((packed)); + +typedef CDB12 CDB12_t; + +struct CDB_LBA32_16 { + uint8_t Opcode; + + unsigned Service_Action : 5; + unsigned Misc : 3; + + uint8_t LBA_L_M_MB; + uint8_t LBA_L_M_LB; + uint8_t LBA_L_L_MB; + uint8_t LBA_L_L_LB; + + uint8_t A_M_M_MB; + uint8_t A_M_M_LB; + uint8_t A_M_L_MB; + uint8_t A_M_L_LB; + + uint8_t ALC_M_MB; + uint8_t ALC_M_LB; + uint8_t ALC_L_MB; + uint8_t ALC_L_LB; + + uint8_t Misc2; + uint8_t Control; +} __attribute__((packed)); + +struct CDB_LBA64_16 { + uint8_t Opcode; + uint8_t Misc; + + uint8_t LBA_M_M_MB; + uint8_t LBA_M_M_LB; + uint8_t LBA_M_L_MB; + uint8_t LBA_M_L_LB; + + uint8_t LBA_L_M_MB; + uint8_t LBA_L_M_LB; + uint8_t LBA_L_L_MB; + uint8_t LBA_L_L_LB; + + uint8_t ALC_M_MB; + uint8_t ALC_M_LB; + uint8_t ALC_L_MB; + uint8_t ALC_L_LB; + + uint8_t Misc2; + uint8_t Control; +} __attribute__((packed)); + +struct InquiryResponse { + uint8_t DeviceType : 5; + uint8_t PeripheralQualifier : 3; + + unsigned Reserved : 7; + unsigned Removable : 1; + + uint8_t Version; + + unsigned ResponseDataFormat : 4; + unsigned HISUP : 1; + unsigned NormACA : 1; + unsigned TrmTsk : 1; + unsigned AERC : 1; + + uint8_t AdditionalLength; + //uint8_t Reserved3[2]; + + unsigned PROTECT : 1; + unsigned Res : 2; + unsigned ThreePC : 1; + unsigned TPGS : 2; + unsigned ACC : 1; + unsigned SCCS : 1; + + unsigned ADDR16 : 1; + unsigned R1 : 1; + unsigned R2 : 1; + unsigned MCHNGR : 1; + unsigned MULTIP : 1; + unsigned VS : 1; + unsigned ENCSERV : 1; + unsigned BQUE : 1; + + unsigned SoftReset : 1; + unsigned CmdQue : 1; + unsigned Reserved4 : 1; + unsigned Linked : 1; + unsigned Sync : 1; + unsigned WideBus16Bit : 1; + unsigned WideBus32Bit : 1; + unsigned RelAddr : 1; + + uint8_t VendorID[8]; + uint8_t ProductID[16]; + uint8_t RevisionID[4]; +} __attribute__((packed)); + +struct CommandBlockWrapperBase { + uint32_t dCBWSignature; + uint32_t dCBWTag; + uint32_t dCBWDataTransferLength; + uint8_t bmCBWFlags; +public: + + CommandBlockWrapperBase() { + } + + CommandBlockWrapperBase(uint32_t tag, uint32_t xflen, uint8_t flgs) : + dCBWSignature(MASS_CBW_SIGNATURE), dCBWTag(tag), dCBWDataTransferLength(xflen), bmCBWFlags(flgs) { + } +} __attribute__((packed)); + +struct CommandBlockWrapper : public CommandBlockWrapperBase { + + struct { + uint8_t bmCBWLUN : 4; + uint8_t bmReserved1 : 4; + }; + + struct { + uint8_t bmCBWCBLength : 4; + uint8_t bmReserved2 : 4; + }; + + uint8_t CBWCB[16]; + +public: + // All zeroed. + + CommandBlockWrapper() : + CommandBlockWrapperBase(0, 0, 0), bmReserved1(0), bmReserved2(0) { + for(int i = 0; i < 16; i++) CBWCB[i] = 0; + } + + // Generic Wrap, CDB zeroed. + + CommandBlockWrapper(uint32_t tag, uint32_t xflen, uint8_t flgs, uint8_t lu, uint8_t cmdlen, uint8_t cmd) : + CommandBlockWrapperBase(tag, xflen, flgs), + bmCBWLUN(lu), bmReserved1(0), bmCBWCBLength(cmdlen), bmReserved2(0) { + for(int i = 0; i < 16; i++) CBWCB[i] = 0; + // Type punning can cause optimization problems and bugs. + // Using reinterpret_cast to a dreinterpretifferent object is the proper way to do this. + //(((BASICCDB_t *) CBWCB)->LUN) = cmd; + BASICCDB_t *x = reinterpret_cast(CBWCB); + x->LUN = cmd; + } + + // Wrap for CDB of 6 + + CommandBlockWrapper(uint32_t tag, uint32_t xflen, CDB6_t *cdb, uint8_t dir) : + CommandBlockWrapperBase(tag, xflen, dir), + bmCBWLUN(cdb->LUN), bmReserved1(0), bmCBWCBLength(6), bmReserved2(0) { + memcpy(&CBWCB, cdb, 6); + } + // Wrap for CDB of 10 + + CommandBlockWrapper(uint32_t tag, uint32_t xflen, CDB10_t *cdb, uint8_t dir) : + CommandBlockWrapperBase(tag, xflen, dir), + bmCBWLUN(cdb->LUN), bmReserved1(0), bmCBWCBLength(10), bmReserved2(0) { + memcpy(&CBWCB, cdb, 10); + } +} __attribute__((packed)); + +struct CommandStatusWrapper { + uint32_t dCSWSignature; + uint32_t dCSWTag; + uint32_t dCSWDataResidue; + uint8_t bCSWStatus; +} __attribute__((packed)); + +struct RequestSenseResponce { + uint8_t bResponseCode; + uint8_t bSegmentNumber; + + uint8_t bmSenseKey : 4; + uint8_t bmReserved : 1; + uint8_t bmILI : 1; + uint8_t bmEOM : 1; + uint8_t bmFileMark : 1; + + uint8_t Information[4]; + uint8_t bAdditionalLength; + uint8_t CmdSpecificInformation[4]; + uint8_t bAdditionalSenseCode; + uint8_t bAdditionalSenseQualifier; + uint8_t bFieldReplaceableUnitCode; + uint8_t SenseKeySpecific[3]; +} __attribute__((packed)); + +class BulkOnly : public USBDeviceConfig, public UsbConfigXtracter { +protected: + static const uint8_t epDataInIndex; // DataIn endpoint index + static const uint8_t epDataOutIndex; // DataOUT endpoint index + static const uint8_t epInterruptInIndex; // InterruptIN endpoint index + + USB *pUsb; + uint8_t bAddress; + uint8_t bConfNum; // configuration number + uint8_t bIface; // interface value + uint8_t bNumEP; // total number of EP in the configuration + uint32_t qNextPollTime; // next poll time + bool bPollEnable; // poll enable flag + + EpInfo epInfo[MASS_MAX_ENDPOINTS]; + + uint32_t dCBWTag; // Tag + //uint32_t dCBWDataTransferLength; // Data Transfer Length + uint8_t bLastUsbError; // Last USB error + uint8_t bMaxLUN; // Max LUN + uint8_t bTheLUN; // Active LUN + uint32_t CurrentCapacity[MASS_MAX_SUPPORTED_LUN]; // Total sectors + uint16_t CurrentSectorSize[MASS_MAX_SUPPORTED_LUN]; // Sector size, clipped to 16 bits + bool LUNOk[MASS_MAX_SUPPORTED_LUN]; // use this to check for media changes. + bool WriteOk[MASS_MAX_SUPPORTED_LUN]; + void PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR* ep_ptr); + + + // Additional Initialization Method for Subclasses + + virtual uint8_t OnInit() { + return 0; + }; + +public: + BulkOnly(USB *p); + + uint8_t GetLastUsbError() { + return bLastUsbError; + }; + + uint8_t GetbMaxLUN() { + return bMaxLUN; // Max LUN + } + + uint8_t GetbTheLUN() { + return bTheLUN; // Active LUN + } + + bool WriteProtected(uint8_t lun); + uint8_t MediaCTL(uint8_t lun, uint8_t ctl); + uint8_t Read(uint8_t lun, uint32_t addr, uint16_t bsize, uint8_t blocks, uint8_t *buf); + uint8_t Read(uint8_t lun, uint32_t addr, uint16_t bsize, uint8_t blocks, USBReadParser *prs); + uint8_t Write(uint8_t lun, uint32_t addr, uint16_t bsize, uint8_t blocks, const uint8_t *buf); + uint8_t LockMedia(uint8_t lun, uint8_t lock); + + bool LUNIsGood(uint8_t lun); + uint32_t GetCapacity(uint8_t lun); + uint16_t GetSectorSize(uint8_t lun); + + // USBDeviceConfig implementation + uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed); + uint8_t ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed); + + uint8_t Release(); + uint8_t Poll(); + + virtual uint8_t GetAddress() { + return bAddress; + }; + + // UsbConfigXtracter implementation + void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep); + + virtual bool DEVCLASSOK(uint8_t klass) { + return (klass == USB_CLASS_MASS_STORAGE); + } + + uint8_t SCSITransaction6(CDB6_t *cdb, uint16_t buf_size, void *buf, uint8_t dir); + uint8_t SCSITransaction10(CDB10_t *cdb, uint16_t buf_size, void *buf, uint8_t dir); + +private: + uint8_t Inquiry(uint8_t lun, uint16_t size, uint8_t *buf); + uint8_t TestUnitReady(uint8_t lun); + uint8_t RequestSense(uint8_t lun, uint16_t size, uint8_t *buf); + uint8_t ModeSense6(uint8_t lun, uint8_t pc, uint8_t page, uint8_t subpage, uint8_t len, uint8_t *buf); + uint8_t GetMaxLUN(uint8_t *max_lun); + uint8_t SetCurLUN(uint8_t lun); + void Reset(); + uint8_t ResetRecovery(); + uint8_t ReadCapacity10(uint8_t lun, uint8_t *buf); + void ClearAllEP(); + void CheckMedia(); + bool CheckLUN(uint8_t lun); + uint8_t Page3F(uint8_t lun); + bool IsValidCBW(uint8_t size, uint8_t *pcbw); + bool IsMeaningfulCBW(uint8_t size, uint8_t *pcbw); + + bool IsValidCSW(CommandStatusWrapper *pcsw, CommandBlockWrapperBase *pcbw); + + uint8_t ClearEpHalt(uint8_t index); + #if MS_WANT_PARSER + uint8_t Transaction(CommandBlockWrapper *cbw, uint16_t bsize, void *buf, uint8_t flags); + #endif + uint8_t Transaction(CommandBlockWrapper *cbw, uint16_t bsize, void *buf); + uint8_t HandleUsbError(uint8_t error, uint8_t index); + uint8_t HandleSCSIError(uint8_t status); + +}; diff --git a/Marlin/src/sd/usb_flashdrive/lib/max3421e.h b/Marlin/src/sd/usb_flashdrive/lib/max3421e.h new file mode 100644 index 0000000000..1ad1e3d301 --- /dev/null +++ b/Marlin/src/sd/usb_flashdrive/lib/max3421e.h @@ -0,0 +1,235 @@ +/* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. + +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 2 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, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Contact information +------------------- + +Circuits At Home, LTD +Web : http://www.circuitsathome.com +e-mail : support@circuitsathome.com + */ +#if !defined(_usb_h_) || defined(_max3421e_h_) +#error "Never include max3421e.h directly; include Usb.h instead" +#else + +#define _max3421e_h_ + +/* MAX3421E register/bit names and bitmasks */ + +/* Arduino pin definitions */ +/* pin numbers to port numbers */ + +#define SE0 0 +#define SE1 1 +#define FSHOST 2 +#define LSHOST 3 + +/* MAX3421E command byte format: rrrrr0wa where 'r' is register number */ +// +// MAX3421E Registers in HOST mode. +// +#define rRCVFIFO 0x08 //1<<3 +#define rSNDFIFO 0x10 //2<<3 +#define rSUDFIFO 0x20 //4<<3 +#define rRCVBC 0x30 //6<<3 +#define rSNDBC 0x38 //7<<3 + +#define rUSBIRQ 0x68 //13<<3 +/* USBIRQ Bits */ +#define bmVBUSIRQ 0x40 //b6 +#define bmNOVBUSIRQ 0x20 //b5 +#define bmOSCOKIRQ 0x01 //b0 + +#define rUSBIEN 0x70 //14<<3 +/* USBIEN Bits */ +#define bmVBUSIE 0x40 //b6 +#define bmNOVBUSIE 0x20 //b5 +#define bmOSCOKIE 0x01 //b0 + +#define rUSBCTL 0x78 //15<<3 +/* USBCTL Bits */ +#define bmCHIPRES 0x20 //b5 +#define bmPWRDOWN 0x10 //b4 + +#define rCPUCTL 0x80 //16<<3 +/* CPUCTL Bits */ +#define bmPUSLEWID1 0x80 //b7 +#define bmPULSEWID0 0x40 //b6 +#define bmIE 0x01 //b0 + +#define rPINCTL 0x88 //17<<3 +/* PINCTL Bits */ +#define bmFDUPSPI 0x10 //b4 +#define bmINTLEVEL 0x08 //b3 +#define bmPOSINT 0x04 //b2 +#define bmGPXB 0x02 //b1 +#define bmGPXA 0x01 //b0 +// GPX pin selections +#define GPX_OPERATE 0x00 +#define GPX_VBDET 0x01 +#define GPX_BUSACT 0x02 +#define GPX_SOF 0x03 + +#define rREVISION 0x90 //18<<3 + +#define rIOPINS1 0xa0 //20<<3 + +/* IOPINS1 Bits */ +#define bmGPOUT0 0x01 +#define bmGPOUT1 0x02 +#define bmGPOUT2 0x04 +#define bmGPOUT3 0x08 +#define bmGPIN0 0x10 +#define bmGPIN1 0x20 +#define bmGPIN2 0x40 +#define bmGPIN3 0x80 + +#define rIOPINS2 0xa8 //21<<3 +/* IOPINS2 Bits */ +#define bmGPOUT4 0x01 +#define bmGPOUT5 0x02 +#define bmGPOUT6 0x04 +#define bmGPOUT7 0x08 +#define bmGPIN4 0x10 +#define bmGPIN5 0x20 +#define bmGPIN6 0x40 +#define bmGPIN7 0x80 + +#define rGPINIRQ 0xb0 //22<<3 +/* GPINIRQ Bits */ +#define bmGPINIRQ0 0x01 +#define bmGPINIRQ1 0x02 +#define bmGPINIRQ2 0x04 +#define bmGPINIRQ3 0x08 +#define bmGPINIRQ4 0x10 +#define bmGPINIRQ5 0x20 +#define bmGPINIRQ6 0x40 +#define bmGPINIRQ7 0x80 + +#define rGPINIEN 0xb8 //23<<3 +/* GPINIEN Bits */ +#define bmGPINIEN0 0x01 +#define bmGPINIEN1 0x02 +#define bmGPINIEN2 0x04 +#define bmGPINIEN3 0x08 +#define bmGPINIEN4 0x10 +#define bmGPINIEN5 0x20 +#define bmGPINIEN6 0x40 +#define bmGPINIEN7 0x80 + +#define rGPINPOL 0xc0 //24<<3 +/* GPINPOL Bits */ +#define bmGPINPOL0 0x01 +#define bmGPINPOL1 0x02 +#define bmGPINPOL2 0x04 +#define bmGPINPOL3 0x08 +#define bmGPINPOL4 0x10 +#define bmGPINPOL5 0x20 +#define bmGPINPOL6 0x40 +#define bmGPINPOL7 0x80 + +#define rHIRQ 0xc8 //25<<3 +/* HIRQ Bits */ +#define bmBUSEVENTIRQ 0x01 // indicates BUS Reset Done or BUS Resume +#define bmRWUIRQ 0x02 +#define bmRCVDAVIRQ 0x04 +#define bmSNDBAVIRQ 0x08 +#define bmSUSDNIRQ 0x10 +#define bmCONDETIRQ 0x20 +#define bmFRAMEIRQ 0x40 +#define bmHXFRDNIRQ 0x80 + +#define rHIEN 0xd0 //26<<3 + +/* HIEN Bits */ +#define bmBUSEVENTIE 0x01 +#define bmRWUIE 0x02 +#define bmRCVDAVIE 0x04 +#define bmSNDBAVIE 0x08 +#define bmSUSDNIE 0x10 +#define bmCONDETIE 0x20 +#define bmFRAMEIE 0x40 +#define bmHXFRDNIE 0x80 + +#define rMODE 0xd8 //27<<3 + +/* MODE Bits */ +#define bmHOST 0x01 +#define bmLOWSPEED 0x02 +#define bmHUBPRE 0x04 +#define bmSOFKAENAB 0x08 +#define bmSEPIRQ 0x10 +#define bmDELAYISO 0x20 +#define bmDMPULLDN 0x40 +#define bmDPPULLDN 0x80 + +#define rPERADDR 0xe0 //28<<3 + +#define rHCTL 0xe8 //29<<3 +/* HCTL Bits */ +#define bmBUSRST 0x01 +#define bmFRMRST 0x02 +#define bmSAMPLEBUS 0x04 +#define bmSIGRSM 0x08 +#define bmRCVTOG0 0x10 +#define bmRCVTOG1 0x20 +#define bmSNDTOG0 0x40 +#define bmSNDTOG1 0x80 + +#define rHXFR 0xf0 //30<<3 +/* Host transfer token values for writing the HXFR register (R30) */ +/* OR this bit field with the endpoint number in bits 3:0 */ +#define tokSETUP 0x10 // HS=0, ISO=0, OUTNIN=0, SETUP=1 +#define tokIN 0x00 // HS=0, ISO=0, OUTNIN=0, SETUP=0 +#define tokOUT 0x20 // HS=0, ISO=0, OUTNIN=1, SETUP=0 +#define tokINHS 0x80 // HS=1, ISO=0, OUTNIN=0, SETUP=0 +#define tokOUTHS 0xA0 // HS=1, ISO=0, OUTNIN=1, SETUP=0 +#define tokISOIN 0x40 // HS=0, ISO=1, OUTNIN=0, SETUP=0 +#define tokISOOUT 0x60 // HS=0, ISO=1, OUTNIN=1, SETUP=0 + +#define rHRSL 0xf8 //31<<3 + +/* HRSL Bits */ +#define bmRCVTOGRD 0x10 +#define bmSNDTOGRD 0x20 +#define bmKSTATUS 0x40 +#define bmJSTATUS 0x80 +#define bmSE0 0x00 //SE0 - disconnect state +#define bmSE1 0xc0 //SE1 - illegal state + +/* Host error result codes, the 4 LSB's in the HRSL register */ +#define hrSUCCESS 0x00 +#define hrBUSY 0x01 +#define hrBADREQ 0x02 +#define hrUNDEF 0x03 +#define hrNAK 0x04 +#define hrSTALL 0x05 +#define hrTOGERR 0x06 +#define hrWRONGPID 0x07 +#define hrBADBC 0x08 +#define hrPIDERR 0x09 +#define hrPKTERR 0x0A +#define hrCRCERR 0x0B +#define hrKERR 0x0C +#define hrJERR 0x0D +#define hrTIMEOUT 0x0E +#define hrBABBLE 0x0F + +#define MODE_FS_HOST (bmDPPULLDN|bmDMPULLDN|bmHOST|bmSOFKAENAB) +#define MODE_LS_HOST (bmDPPULLDN|bmDMPULLDN|bmHOST|bmLOWSPEED|bmSOFKAENAB) + + +#endif //_max3421e_h_ diff --git a/Marlin/src/sd/usb_flashdrive/lib/message.cpp b/Marlin/src/sd/usb_flashdrive/lib/message.cpp new file mode 100644 index 0000000000..ac73794c4b --- /dev/null +++ b/Marlin/src/sd/usb_flashdrive/lib/message.cpp @@ -0,0 +1,130 @@ +/* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. + +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 2 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, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Contact information +------------------- + +Circuits At Home, LTD +Web : http://www.circuitsathome.com +e-mail : support@circuitsathome.com + */ + +#include "../../../inc/MarlinConfigPre.h" + +#if ENABLED(USB_FLASH_DRIVE_SUPPORT) + +#include "Usb.h" + +// 0x80 is the default (i.e. trace) to turn off set this global to something lower. +// this allows for 126 other debugging levels. +// TO-DO: Allow assignment to a different serial port by software +int UsbDEBUGlvl = 0x80; + +void E_Notifyc(char c, int lvl) { + if(UsbDEBUGlvl < lvl) return; +#if defined(ARDUINO) && ARDUINO >=100 + USB_HOST_SERIAL.print(c); +#else + USB_HOST_SERIAL.print(c, BYTE); +#endif + //USB_HOST_SERIAL.flush(); +} + +void E_Notify(char const * msg, int lvl) { + if(UsbDEBUGlvl < lvl) return; + if(!msg) return; + char c; + + while((c = pgm_read_byte(msg++))) E_Notifyc(c, lvl); +} + +void E_NotifyStr(char const * msg, int lvl) { + if(UsbDEBUGlvl < lvl) return; + if(!msg) return; + char c; + + while((c = *msg++)) E_Notifyc(c, lvl); +} + +void E_Notify(uint8_t b, int lvl) { + if(UsbDEBUGlvl < lvl) return; +#if defined(ARDUINO) && ARDUINO >=100 + USB_HOST_SERIAL.print(b); +#else + USB_HOST_SERIAL.print(b, DEC); +#endif + //USB_HOST_SERIAL.flush(); +} + +void E_Notify(double d, int lvl) { + if(UsbDEBUGlvl < lvl) return; + USB_HOST_SERIAL.print(d); + //USB_HOST_SERIAL.flush(); +} + +#ifdef DEBUG_USB_HOST + +void NotifyFailGetDevDescr(void) { + Notify(PSTR("\r\ngetDevDescr "), 0x80); +} + +void NotifyFailSetDevTblEntry(void) { + Notify(PSTR("\r\nsetDevTblEn "), 0x80); +} + +void NotifyFailGetConfDescr(void) { + Notify(PSTR("\r\ngetConf "), 0x80); +} + +void NotifyFailSetConfDescr(void) { + Notify(PSTR("\r\nsetConf "), 0x80); +} + +void NotifyFailGetDevDescr(uint8_t reason) { + NotifyFailGetDevDescr(); + NotifyFail(reason); +} + +void NotifyFailSetDevTblEntry(uint8_t reason) { + NotifyFailSetDevTblEntry(); + NotifyFail(reason); + +} + +void NotifyFailGetConfDescr(uint8_t reason) { + NotifyFailGetConfDescr(); + NotifyFail(reason); +} + +void NotifyFailSetConfDescr(uint8_t reason) { + NotifyFailSetConfDescr(); + NotifyFail(reason); +} + +void NotifyFailUnknownDevice(uint16_t VID, uint16_t PID) { + Notify(PSTR("\r\nUnknown Device Connected - VID: "), 0x80); + D_PrintHex (VID, 0x80); + Notify(PSTR(" PID: "), 0x80); + D_PrintHex (PID, 0x80); +} + +void NotifyFail(uint8_t rcode) { + D_PrintHex (rcode, 0x80); + Notify(PSTR("\r\n"), 0x80); +} +#endif // DEBUG_USB_HOST + +#endif // USB_FLASH_DRIVE_SUPPORT diff --git a/Marlin/src/sd/usb_flashdrive/lib/message.h b/Marlin/src/sd/usb_flashdrive/lib/message.h new file mode 100644 index 0000000000..71c0f7bcde --- /dev/null +++ b/Marlin/src/sd/usb_flashdrive/lib/message.h @@ -0,0 +1,85 @@ +/* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. + +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 2 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, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Contact information +------------------- + +Circuits At Home, LTD +Web : http://www.circuitsathome.com +e-mail : support@circuitsathome.com + */ +#if !defined(_usb_h_) || defined(__MESSAGE_H__) +#error "Never include message.h directly; include Usb.h instead" +#else +#define __MESSAGE_H__ + +extern int UsbDEBUGlvl; + +void E_Notify(char const * msg, int lvl); +void E_Notify(uint8_t b, int lvl); +void E_NotifyStr(char const * msg, int lvl); +void E_Notifyc(char c, int lvl); + +#ifdef DEBUG_USB_HOST +#define Notify E_Notify +#define NotifyStr E_NotifyStr +#define Notifyc E_Notifyc +void NotifyFailGetDevDescr(uint8_t reason); +void NotifyFailSetDevTblEntry(uint8_t reason); +void NotifyFailGetConfDescr(uint8_t reason); +void NotifyFailSetConfDescr(uint8_t reason); +void NotifyFailGetDevDescr(void); +void NotifyFailSetDevTblEntry(void); +void NotifyFailGetConfDescr(void); +void NotifyFailSetConfDescr(void); +void NotifyFailUnknownDevice(uint16_t VID, uint16_t PID); +void NotifyFail(uint8_t rcode); +#else +#define Notify(...) ((void)0) +#define NotifyStr(...) ((void)0) +#define Notifyc(...) ((void)0) +#define NotifyFailGetDevDescr(...) ((void)0) +#define NotifyFailSetDevTblEntry(...) ((void)0) +#define NotifyFailGetConfDescr(...) ((void)0) +#define NotifyFailGetDevDescr(...) ((void)0) +#define NotifyFailSetDevTblEntry(...) ((void)0) +#define NotifyFailGetConfDescr(...) ((void)0) +#define NotifyFailSetConfDescr(...) ((void)0) +#define NotifyFailUnknownDevice(...) ((void)0) +#define NotifyFail(...) ((void)0) +#endif + +template +void ErrorMessage(uint8_t level, char const * msg, ERROR_TYPE rcode = 0) { +#ifdef DEBUG_USB_HOST + Notify(msg, level); + Notify(PSTR(": "), level); + D_PrintHex (rcode, level); + Notify(PSTR("\r\n"), level); +#endif +} + +template +void ErrorMessage(char const * msg __attribute__((unused)), ERROR_TYPE rcode __attribute__((unused)) = 0) { +#ifdef DEBUG_USB_HOST + Notify(msg, 0x80); + Notify(PSTR(": "), 0x80); + D_PrintHex (rcode, 0x80); + Notify(PSTR("\r\n"), 0x80); +#endif +} + +#endif // __MESSAGE_H__ diff --git a/Marlin/src/sd/usb_flashdrive/lib/parsetools.cpp b/Marlin/src/sd/usb_flashdrive/lib/parsetools.cpp new file mode 100644 index 0000000000..1d2a542df7 --- /dev/null +++ b/Marlin/src/sd/usb_flashdrive/lib/parsetools.cpp @@ -0,0 +1,81 @@ +/* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. + +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 2 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, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Contact information +------------------- + +Circuits At Home, LTD +Web : http://www.circuitsathome.com +e-mail : support@circuitsathome.com + */ + +#include "../../../inc/MarlinConfigPre.h" + +#if ENABLED(USB_FLASH_DRIVE_SUPPORT) + +#include "Usb.h" + +bool MultiByteValueParser::Parse(uint8_t **pp, uint16_t *pcntdn) { + if(!pBuf) { + Notify(PSTR("Buffer pointer is NULL!\r\n"), 0x80); + return false; + } + for(; countDown && (*pcntdn); countDown--, (*pcntdn)--, (*pp)++) + pBuf[valueSize - countDown] = (**pp); + + if(countDown) + return false; + + countDown = valueSize; + return true; +} + +bool PTPListParser::Parse(uint8_t **pp, uint16_t *pcntdn, PTP_ARRAY_EL_FUNC pf, const void *me) { + switch(nStage) { + case 0: + pBuf->valueSize = lenSize; + theParser.Initialize(pBuf); + nStage = 1; + + case 1: + if(!theParser.Parse(pp, pcntdn)) + return false; + + arLen = 0; + arLen = (pBuf->valueSize >= 4) ? *((uint32_t*)pBuf->pValue) : (uint32_t)(*((uint16_t*)pBuf->pValue)); + arLenCntdn = arLen; + nStage = 2; + + case 2: + pBuf->valueSize = valSize; + theParser.Initialize(pBuf); + nStage = 3; + + case 3: + for(; arLenCntdn; arLenCntdn--) { + if(!theParser.Parse(pp, pcntdn)) + return false; + + if(pf) + pf(pBuf, (arLen - arLenCntdn), me); + } + + nStage = 0; + } + return true; +} + +#endif // USB_FLASH_DRIVE_SUPPORT diff --git a/Marlin/src/sd/usb_flashdrive/lib/parsetools.h b/Marlin/src/sd/usb_flashdrive/lib/parsetools.h new file mode 100644 index 0000000000..6289206157 --- /dev/null +++ b/Marlin/src/sd/usb_flashdrive/lib/parsetools.h @@ -0,0 +1,147 @@ +/* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. + +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 2 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, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Contact information +------------------- + +Circuits At Home, LTD +Web : http://www.circuitsathome.com +e-mail : support@circuitsathome.com + */ + +#if !defined(_usb_h_) || defined(__PARSETOOLS_H__) +#error "Never include parsetools.h directly; include Usb.h instead" +#else +#define __PARSETOOLS_H__ + +struct MultiValueBuffer { + uint8_t valueSize; + void *pValue; +} __attribute__((packed)); + +class MultiByteValueParser { + uint8_t * pBuf; + uint8_t countDown; + uint8_t valueSize; + +public: + + MultiByteValueParser() : pBuf(NULL), countDown(0), valueSize(0) { + }; + + const uint8_t* GetBuffer() { + return pBuf; + }; + + void Initialize(MultiValueBuffer * const pbuf) { + pBuf = (uint8_t*)pbuf->pValue; + countDown = valueSize = pbuf->valueSize; + }; + + bool Parse(uint8_t **pp, uint16_t *pcntdn); +}; + +class ByteSkipper { + uint8_t *pBuf; + uint8_t nStage; + uint16_t countDown; + +public: + + ByteSkipper() : pBuf(NULL), nStage(0), countDown(0) { + }; + + void Initialize(MultiValueBuffer *pbuf) { + pBuf = (uint8_t*)pbuf->pValue; + countDown = 0; + }; + + bool Skip(uint8_t **pp, uint16_t *pcntdn, uint16_t bytes_to_skip) { + switch(nStage) { + case 0: + countDown = bytes_to_skip; + nStage++; + case 1: + for(; countDown && (*pcntdn); countDown--, (*pp)++, (*pcntdn)--); + + if(!countDown) + nStage = 0; + }; + return (!countDown); + }; +}; + +// Pointer to a callback function triggered for each element of PTP array when used with PTPArrayParser +typedef void (*PTP_ARRAY_EL_FUNC)(const MultiValueBuffer * const p, uint32_t count, const void *me); + +class PTPListParser { +public: + + enum ParseMode { + modeArray, modeRange/*, modeEnum*/ + }; + +private: + uint8_t nStage; + uint8_t enStage; + + uint32_t arLen; + uint32_t arLenCntdn; + + uint8_t lenSize; // size of the array length field in bytes + uint8_t valSize; // size of the array element in bytes + + MultiValueBuffer *pBuf; + + // The only parser for both size and array element parsing + MultiByteValueParser theParser; + + uint8_t /*ParseMode*/ prsMode; + +public: + + PTPListParser() : + nStage(0), + enStage(0), + arLen(0), + arLenCntdn(0), + lenSize(0), + valSize(0), + pBuf(NULL), + prsMode(modeArray) { + }; + + void Initialize(const uint8_t len_size, const uint8_t val_size, MultiValueBuffer * const p, const uint8_t mode = modeArray) { + pBuf = p; + lenSize = len_size; + valSize = val_size; + prsMode = mode; + + if(prsMode == modeRange) { + arLenCntdn = arLen = 3; + nStage = 2; + } else { + arLenCntdn = arLen = 0; + nStage = 0; + } + enStage = 0; + theParser.Initialize(p); + }; + + bool Parse(uint8_t **pp, uint16_t *pcntdn, PTP_ARRAY_EL_FUNC pf, const void *me = NULL); +}; + +#endif // __PARSETOOLS_H__ diff --git a/Marlin/src/sd/usb_flashdrive/lib/printhex.h b/Marlin/src/sd/usb_flashdrive/lib/printhex.h new file mode 100644 index 0000000000..1261a2889d --- /dev/null +++ b/Marlin/src/sd/usb_flashdrive/lib/printhex.h @@ -0,0 +1,91 @@ +/* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. + +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 2 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, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Contact information +------------------- + +Circuits At Home, LTD +Web : http://www.circuitsathome.com +e-mail : support@circuitsathome.com + */ + +#if !defined(_usb_h_) || defined(__PRINTHEX_H__) +#error "Never include printhex.h directly; include Usb.h instead" +#else +#define __PRINTHEX_H__ + +void E_Notifyc(char c, int lvl); + +template +void PrintHex(T val, int lvl) { + int num_nibbles = sizeof (T) * 2; + + do { + char v = 48 + (((val >> (num_nibbles - 1) * 4)) & 0x0f); + if(v > 57) v += 7; + E_Notifyc(v, lvl); + } while(--num_nibbles); +} + +template +void PrintBin(T val, int lvl) { + for(T mask = (((T)1) << ((sizeof (T) << 3) - 1)); mask; mask >>= 1) + if(val & mask) + E_Notifyc('1', lvl); + else + E_Notifyc('0', lvl); +} + +template +void SerialPrintHex(T val) { + int num_nibbles = sizeof (T) * 2; + + do { + char v = 48 + (((val >> (num_nibbles - 1) * 4)) & 0x0f); + if(v > 57) v += 7; + USB_HOST_SERIAL.print(v); + } while(--num_nibbles); +} + +template +void PrintHex2(Print *prn, T val) { + T mask = (((T)1) << (((sizeof (T) << 1) - 1) << 2)); + + while(mask > 1) { + if(val < mask) + prn->print("0"); + + mask >>= 4; + } + prn->print((T)val, HEX); +} + +template void D_PrintHex(T val __attribute__((unused)), int lvl __attribute__((unused))) { +#ifdef DEBUG_USB_HOST + PrintHex (val, lvl); +#endif +} + +template +void D_PrintBin(T val, int lvl) { +#ifdef DEBUG_USB_HOST + PrintBin (val, lvl); +#endif +} + + + +#endif // __PRINTHEX_H__ diff --git a/Marlin/src/sd/usb_flashdrive/lib/settings.h b/Marlin/src/sd/usb_flashdrive/lib/settings.h new file mode 100644 index 0000000000..f59467b355 --- /dev/null +++ b/Marlin/src/sd/usb_flashdrive/lib/settings.h @@ -0,0 +1,233 @@ +/* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. + +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 2 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, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Contact information +------------------- + +Circuits At Home, LTD +Web : http://www.circuitsathome.com +e-mail : support@circuitsathome.com + */ + +#pragma once + +#include "../../../inc/MarlinConfig.h" + +#include "macros.h" + +#if ENABLED(USB_FLASH_DRIVE_SUPPORT) + //////////////////////////////////////////////////////////////////////////////// + /* Added by Bill Greiman to speed up mass storage initialization with USB + * flash drives and simple USB hard drives. + * Disable this by defining DELAY(x) to be delay(x). + */ + #define delay(x) if((x) < 200) safe_delay(x) + /* Almost all USB flash drives and simple USB hard drives fail the write + * protect test and add 20 - 30 seconds to USB init. Set SKIP_WRITE_PROTECT + * to nonzero to skip the test and assume the drive is writable. + */ + #define SKIP_WRITE_PROTECT 1 + /* Since Marlin only cares about USB flash drives, we only need one LUN. */ + #define MASS_MAX_SUPPORTED_LUN 1 +#endif +//////////////////////////////////////////////////////////////////////////////// +// SPI Configuration +//////////////////////////////////////////////////////////////////////////////// +#ifndef USB_SPI + #define USB_SPI SPI + //#define USB_SPI SPI1 +#endif + +//////////////////////////////////////////////////////////////////////////////// +// DEBUGGING +//////////////////////////////////////////////////////////////////////////////// + +/* Set this to 1 to activate serial debugging */ +#define ENABLE_UHS_DEBUGGING 0 + +/* This can be used to select which serial port to use for debugging if + * multiple serial ports are available. + * For example Serial3. + */ +#if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_HOST_SERIAL MYSERIAL0 +#endif + +#ifndef USB_HOST_SERIAL + #define USB_HOST_SERIAL Serial +#endif + +//////////////////////////////////////////////////////////////////////////////// +// Manual board activation +//////////////////////////////////////////////////////////////////////////////// + +/* Set this to 1 if you are using an Arduino Mega ADK board with MAX3421e built-in */ +#define USE_UHS_MEGA_ADK 0 // If you are using Arduino 1.5.5 or newer there is no need to do this manually + +/* Set this to 1 if you are using a Black Widdow */ +#define USE_UHS_BLACK_WIDDOW 0 + +/* Set this to a one to use the xmem2 lock. This is needed for multitasking and threading */ +#define USE_XMEM_SPI_LOCK 0 + +//////////////////////////////////////////////////////////////////////////////// +// Wii IR camera +//////////////////////////////////////////////////////////////////////////////// + +/* Set this to 1 to activate code for the Wii IR camera */ +#define ENABLE_WII_IR_CAMERA 0 + +//////////////////////////////////////////////////////////////////////////////// +// MASS STORAGE +//////////////////////////////////////////////////////////////////////////////// +// ******* IMPORTANT ******* +// Set this to 1 to support single LUN devices, and save RAM. -- I.E. thumb drives. +// Each LUN needs ~13 bytes to be able to track the state of each unit. +#ifndef MASS_MAX_SUPPORTED_LUN + #define MASS_MAX_SUPPORTED_LUN 8 +#endif + +//////////////////////////////////////////////////////////////////////////////// +// Set to 1 to use the faster spi4teensy3 driver. +//////////////////////////////////////////////////////////////////////////////// +#ifndef USE_SPI4TEENSY3 + #define USE_SPI4TEENSY3 1 +#endif + +// Disabled on the Teensy LC, as it is incompatible for now +#ifdef __MKL26Z64__ + #undef USE_SPI4TEENSY3 + #define USE_SPI4TEENSY3 0 +#endif + +//////////////////////////////////////////////////////////////////////////////// +// AUTOMATIC Settings +//////////////////////////////////////////////////////////////////////////////// + +// No user serviceable parts below this line. +// DO NOT change anything below here unless you are a developer! + +//#include "version_helper.h" + +#if defined(__GNUC__) && defined(__AVR__) + #ifndef GCC_VERSION + #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) + #endif + #if GCC_VERSION < 40602 // Test for GCC < 4.6.2 + #ifdef PROGMEM + #undef PROGMEM + #define PROGMEM __attribute__((section(".progmem.data"))) // Workaround for http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34734#c4 + #ifdef PSTR + #undef PSTR + #define PSTR(s) (__extension__({static const char __c[] PROGMEM = (s); &__c[0];})) // Copied from pgmspace.h in avr-libc source + #endif + #endif + #endif +#endif + +#if !defined(DEBUG_USB_HOST) && ENABLE_UHS_DEBUGGING + #define DEBUG_USB_HOST +#endif + +#if !defined(WIICAMERA) && ENABLE_WII_IR_CAMERA + #define WIICAMERA +#endif + +// To use some other locking (e.g. freertos), +// define XMEM_ACQUIRE_SPI and XMEM_RELEASE_SPI to point to your lock and unlock. +// NOTE: NO argument is passed. You have to do this within your routine for +// whatever you are using to lock and unlock. +#if !defined(XMEM_ACQUIRE_SPI) + #if USE_XMEM_SPI_LOCK || defined(USE_MULTIPLE_APP_API) + #include + #else + #define XMEM_ACQUIRE_SPI() (void(0)) + #define XMEM_RELEASE_SPI() (void(0)) + #endif +#endif + +#if !defined(EXT_RAM) && defined(EXT_RAM_STACK) || defined(EXT_RAM_HEAP) + #include +#else + #define EXT_RAM 0 +#endif + +#if defined(CORE_TEENSY) && defined(KINETISK) + #define USING_SPI4TEENSY3 USE_SPI4TEENSY3 +#else + #define USING_SPI4TEENSY3 0 +#endif +#if ((defined(ARDUINO_SAM_DUE) && defined(__SAM3X8E__)) || defined(__ARDUINO_X86__) || ARDUINO >= 10600) && !USING_SPI4TEENSY3 + #include // Use the Arduino SPI library for the Arduino Due, Intel Galileo 1 & 2, Intel Edison or if the SPI library with transaction is available +#endif +#ifdef RBL_NRF51822 + #include + #include + #define SPI SPI_Master + #define MFK_CASTUINT8T (uint8_t) // RBLs return type for sizeof needs casting to uint8_t +#endif +#if defined(__PIC32MX__) || defined(__PIC32MZ__) + #include <../../../../hardware/pic32/libraries/SPI/SPI.h> // Hack to use the SPI library +#endif + +#if defined(ESP8266) || defined(ESP32) + #define MFK_CASTUINT8T (uint8_t) // ESP return type for sizeof needs casting to uint8_t +#endif + +#ifdef STM32F4 + #include "stm32f4xx_hal.h" + extern SPI_HandleTypeDef SPI_Handle; // Needed to be declared in your main.cpp +#endif + +// Fix defines on Arduino Due +#ifdef ARDUINO_SAM_DUE + #ifdef tokSETUP + #undef tokSETUP + #endif + #ifdef tokIN + #undef tokIN + #endif + #ifdef tokOUT + #undef tokOUT + #endif + #ifdef tokINHS + #undef tokINHS + #endif + #ifdef tokOUTHS + #undef tokOUTHS + #endif +#endif + +// Set defaults +#ifndef MFK_CASTUINT8T + #define MFK_CASTUINT8T +#endif + +// Workaround issue: https://github.com/esp8266/Arduino/issues/2078 +#ifdef ESP8266 + #undef PROGMEM + #define PROGMEM +#undef PSTR + #define PSTR(s) (s) +#undef pgm_read_byte + #define pgm_read_byte(addr) (*reinterpret_cast(addr)) + #undef pgm_read_word + #define pgm_read_word(addr) (*reinterpret_cast(addr)) +#endif + +#ifdef ARDUINO_ESP8266_WIFIO + #error "This board is currently not supported" +#endif diff --git a/Marlin/src/sd/usb_flashdrive/lib/usb_ch9.h b/Marlin/src/sd/usb_flashdrive/lib/usb_ch9.h new file mode 100644 index 0000000000..8b5e503fcc --- /dev/null +++ b/Marlin/src/sd/usb_flashdrive/lib/usb_ch9.h @@ -0,0 +1,173 @@ +/* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. + +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 2 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, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Contact information +------------------- + +Circuits At Home, LTD +Web : http://www.circuitsathome.com +e-mail : support@circuitsathome.com + */ + +#if !defined(_usb_h_) || defined(_ch9_h_) +#error "Never include usb_ch9.h directly; include Usb.h instead" +#else + +/* USB chapter 9 structures */ +#define _ch9_h_ + +/* Misc.USB constants */ +#define DEV_DESCR_LEN 18 //device descriptor length +#define CONF_DESCR_LEN 9 //configuration descriptor length +#define INTR_DESCR_LEN 9 //interface descriptor length +#define EP_DESCR_LEN 7 //endpoint descriptor length + +/* Standard Device Requests */ + +#define USB_REQUEST_GET_STATUS 0 // Standard Device Request - GET STATUS +#define USB_REQUEST_CLEAR_FEATURE 1 // Standard Device Request - CLEAR FEATURE +#define USB_REQUEST_SET_FEATURE 3 // Standard Device Request - SET FEATURE +#define USB_REQUEST_SET_ADDRESS 5 // Standard Device Request - SET ADDRESS +#define USB_REQUEST_GET_DESCRIPTOR 6 // Standard Device Request - GET DESCRIPTOR +#define USB_REQUEST_SET_DESCRIPTOR 7 // Standard Device Request - SET DESCRIPTOR +#define USB_REQUEST_GET_CONFIGURATION 8 // Standard Device Request - GET CONFIGURATION +#define USB_REQUEST_SET_CONFIGURATION 9 // Standard Device Request - SET CONFIGURATION +#define USB_REQUEST_GET_INTERFACE 10 // Standard Device Request - GET INTERFACE +#define USB_REQUEST_SET_INTERFACE 11 // Standard Device Request - SET INTERFACE +#define USB_REQUEST_SYNCH_FRAME 12 // Standard Device Request - SYNCH FRAME + +#define USB_FEATURE_ENDPOINT_HALT 0 // CLEAR/SET FEATURE - Endpoint Halt +#define USB_FEATURE_DEVICE_REMOTE_WAKEUP 1 // CLEAR/SET FEATURE - Device remote wake-up +#define USB_FEATURE_TEST_MODE 2 // CLEAR/SET FEATURE - Test mode + +/* Setup Data Constants */ + +#define USB_SETUP_HOST_TO_DEVICE 0x00 // Device Request bmRequestType transfer direction - host to device transfer +#define USB_SETUP_DEVICE_TO_HOST 0x80 // Device Request bmRequestType transfer direction - device to host transfer +#define USB_SETUP_TYPE_STANDARD 0x00 // Device Request bmRequestType type - standard +#define USB_SETUP_TYPE_CLASS 0x20 // Device Request bmRequestType type - class +#define USB_SETUP_TYPE_VENDOR 0x40 // Device Request bmRequestType type - vendor +#define USB_SETUP_RECIPIENT_DEVICE 0x00 // Device Request bmRequestType recipient - device +#define USB_SETUP_RECIPIENT_INTERFACE 0x01 // Device Request bmRequestType recipient - interface +#define USB_SETUP_RECIPIENT_ENDPOINT 0x02 // Device Request bmRequestType recipient - endpoint +#define USB_SETUP_RECIPIENT_OTHER 0x03 // Device Request bmRequestType recipient - other + +/* USB descriptors */ + +#define USB_DESCRIPTOR_DEVICE 0x01 // bDescriptorType for a Device Descriptor. +#define USB_DESCRIPTOR_CONFIGURATION 0x02 // bDescriptorType for a Configuration Descriptor. +#define USB_DESCRIPTOR_STRING 0x03 // bDescriptorType for a String Descriptor. +#define USB_DESCRIPTOR_INTERFACE 0x04 // bDescriptorType for an Interface Descriptor. +#define USB_DESCRIPTOR_ENDPOINT 0x05 // bDescriptorType for an Endpoint Descriptor. +#define USB_DESCRIPTOR_DEVICE_QUALIFIER 0x06 // bDescriptorType for a Device Qualifier. +#define USB_DESCRIPTOR_OTHER_SPEED 0x07 // bDescriptorType for a Other Speed Configuration. +#define USB_DESCRIPTOR_INTERFACE_POWER 0x08 // bDescriptorType for Interface Power. +#define USB_DESCRIPTOR_OTG 0x09 // bDescriptorType for an OTG Descriptor. + +#define HID_DESCRIPTOR_HID 0x21 + + + +/* OTG SET FEATURE Constants */ +#define OTG_FEATURE_B_HNP_ENABLE 3 // SET FEATURE OTG - Enable B device to perform HNP +#define OTG_FEATURE_A_HNP_SUPPORT 4 // SET FEATURE OTG - A device supports HNP +#define OTG_FEATURE_A_ALT_HNP_SUPPORT 5 // SET FEATURE OTG - Another port on the A device supports HNP + +/* USB Endpoint Transfer Types */ +#define USB_TRANSFER_TYPE_CONTROL 0x00 // Endpoint is a control endpoint. +#define USB_TRANSFER_TYPE_ISOCHRONOUS 0x01 // Endpoint is an isochronous endpoint. +#define USB_TRANSFER_TYPE_BULK 0x02 // Endpoint is a bulk endpoint. +#define USB_TRANSFER_TYPE_INTERRUPT 0x03 // Endpoint is an interrupt endpoint. +#define bmUSB_TRANSFER_TYPE 0x03 // bit mask to separate transfer type from ISO attributes + + +/* Standard Feature Selectors for CLEAR_FEATURE Requests */ +#define USB_FEATURE_ENDPOINT_STALL 0 // Endpoint recipient +#define USB_FEATURE_DEVICE_REMOTE_WAKEUP 1 // Device recipient +#define USB_FEATURE_TEST_MODE 2 // Device recipient + +/* descriptor data structures */ + +/* Device descriptor structure */ +typedef struct { + uint8_t bLength; // Length of this descriptor. + uint8_t bDescriptorType; // DEVICE descriptor type (USB_DESCRIPTOR_DEVICE). + uint16_t bcdUSB; // USB Spec Release Number (BCD). + uint8_t bDeviceClass; // Class code (assigned by the USB-IF). 0xFF-Vendor specific. + uint8_t bDeviceSubClass; // Subclass code (assigned by the USB-IF). + uint8_t bDeviceProtocol; // Protocol code (assigned by the USB-IF). 0xFF-Vendor specific. + uint8_t bMaxPacketSize0; // Maximum packet size for endpoint 0. + uint16_t idVendor; // Vendor ID (assigned by the USB-IF). + uint16_t idProduct; // Product ID (assigned by the manufacturer). + uint16_t bcdDevice; // Device release number (BCD). + uint8_t iManufacturer; // Index of String Descriptor describing the manufacturer. + uint8_t iProduct; // Index of String Descriptor describing the product. + uint8_t iSerialNumber; // Index of String Descriptor with the device's serial number. + uint8_t bNumConfigurations; // Number of possible configurations. +} __attribute__((packed)) USB_DEVICE_DESCRIPTOR; + +/* Configuration descriptor structure */ +typedef struct { + uint8_t bLength; // Length of this descriptor. + uint8_t bDescriptorType; // CONFIGURATION descriptor type (USB_DESCRIPTOR_CONFIGURATION). + uint16_t wTotalLength; // Total length of all descriptors for this configuration. + uint8_t bNumInterfaces; // Number of interfaces in this configuration. + uint8_t bConfigurationValue; // Value of this configuration (1 based). + uint8_t iConfiguration; // Index of String Descriptor describing the configuration. + uint8_t bmAttributes; // Configuration characteristics. + uint8_t bMaxPower; // Maximum power consumed by this configuration. +} __attribute__((packed)) USB_CONFIGURATION_DESCRIPTOR; + +/* Interface descriptor structure */ +typedef struct { + uint8_t bLength; // Length of this descriptor. + uint8_t bDescriptorType; // INTERFACE descriptor type (USB_DESCRIPTOR_INTERFACE). + uint8_t bInterfaceNumber; // Number of this interface (0 based). + uint8_t bAlternateSetting; // Value of this alternate interface setting. + uint8_t bNumEndpoints; // Number of endpoints in this interface. + uint8_t bInterfaceClass; // Class code (assigned by the USB-IF). 0xFF-Vendor specific. + uint8_t bInterfaceSubClass; // Subclass code (assigned by the USB-IF). + uint8_t bInterfaceProtocol; // Protocol code (assigned by the USB-IF). 0xFF-Vendor specific. + uint8_t iInterface; // Index of String Descriptor describing the interface. +} __attribute__((packed)) USB_INTERFACE_DESCRIPTOR; + +/* Endpoint descriptor structure */ +typedef struct { + uint8_t bLength; // Length of this descriptor. + uint8_t bDescriptorType; // ENDPOINT descriptor type (USB_DESCRIPTOR_ENDPOINT). + uint8_t bEndpointAddress; // Endpoint address. Bit 7 indicates direction (0=OUT, 1=IN). + uint8_t bmAttributes; // Endpoint transfer type. + uint16_t wMaxPacketSize; // Maximum packet size. + uint8_t bInterval; // Polling interval in frames. +} __attribute__((packed)) USB_ENDPOINT_DESCRIPTOR; + +/* HID descriptor */ +typedef struct { + uint8_t bLength; + uint8_t bDescriptorType; + uint16_t bcdHID; // HID class specification release + uint8_t bCountryCode; + uint8_t bNumDescriptors; // Number of additional class specific descriptors + uint8_t bDescrType; // Type of class descriptor + uint16_t wDescriptorLength; // Total size of the Report descriptor +} __attribute__((packed)) USB_HID_DESCRIPTOR; + +typedef struct { + uint8_t bDescrType; // Type of class descriptor + uint16_t wDescriptorLength; // Total size of the Report descriptor +} __attribute__((packed)) HID_CLASS_DESCRIPTOR_LEN_AND_TYPE; + +#endif // _ch9_h_ diff --git a/Marlin/src/sd/usb_flashdrive/usb-2.0-host-library-changes.patch b/Marlin/src/sd/usb_flashdrive/usb-2.0-host-library-changes.patch new file mode 100644 index 0000000000..c057aaba04 --- /dev/null +++ b/Marlin/src/sd/usb_flashdrive/usb-2.0-host-library-changes.patch @@ -0,0 +1,187 @@ +diff -Naur /home/aleph/Downloads/USB_Host_Shield_2.0-master/masstorage.cpp lib/masstorage.cpp +--- /home/aleph/Downloads/USB_Host_Shield_2.0-master/masstorage.cpp 2018-09-21 10:19:36.107502252 -0600 ++++ lib/masstorage.cpp 2018-09-21 09:46:19.620175519 -0600 +@@ -24,6 +24,8 @@ + + #include "masstorage.h" + ++#if ENABLED(USB_FLASH_DRIVE_SUPPORT) ++ + const uint8_t BulkOnly::epDataInIndex = 1; + const uint8_t BulkOnly::epDataOutIndex = 2; + const uint8_t BulkOnly::epInterruptInIndex = 3; +@@ -796,6 +798,9 @@ + buf[i] = 0x00; + } + WriteOk[lun] = true; ++ #if ENABLED(USB_FLASH_DRIVE_SUPPORT) && defined(SKIP_WRITE_PROTECT) ++ return 0; ++ #endif + uint8_t rc = ModeSense6(lun, 0, 0x3f, 0, 192, buf); + if(!rc) { + WriteOk[lun] = ((buf[2] & 0x80) == 0); +@@ -1271,3 +1276,5 @@ + return MASS_ERR_NOT_IMPLEMENTED; + #endif + } ++ ++#endif // USB_FLASH_DRIVE_SUPPORT +\ No newline at end of file +diff -Naur /home/aleph/Downloads/USB_Host_Shield_2.0-master/message.cpp lib/message.cpp +--- /home/aleph/Downloads/USB_Host_Shield_2.0-master/message.cpp 2018-09-21 10:20:15.995647957 -0600 ++++ lib/message.cpp 2018-09-19 07:43:46.520339375 -0600 +@@ -23,6 +23,9 @@ + */ + + #include "Usb.h" ++ ++#if ENABLED(USB_FLASH_DRIVE_SUPPORT) ++ + // 0x80 is the default (i.e. trace) to turn off set this global to something lower. + // this allows for 126 other debugging levels. + // TO-DO: Allow assignment to a different serial port by software +@@ -120,4 +123,6 @@ + D_PrintHex (rcode, 0x80); + Notify(PSTR("\r\n"), 0x80); + } +-#endif ++#endif // DEBUG_USB_HOST ++ ++#endif // USB_FLASH_DRIVE_SUPPORT +\ No newline at end of file +diff -Naur /home/aleph/Downloads/USB_Host_Shield_2.0-master/parsetools.cpp lib/parsetools.cpp +--- /home/aleph/Downloads/USB_Host_Shield_2.0-master/parsetools.cpp 2018-09-21 10:21:16.215867769 -0600 ++++ lib/parsetools.cpp 2018-09-19 07:43:46.520339375 -0600 +@@ -23,6 +23,8 @@ + */ + #include "Usb.h" + ++#if ENABLED(USB_FLASH_DRIVE_SUPPORT) ++ + bool MultiByteValueParser::Parse(uint8_t **pp, uint16_t *pcntdn) { + if(!pBuf) { + Notify(PSTR("Buffer pointer is NULL!\r\n"), 0x80); +@@ -72,3 +74,5 @@ + } + return true; + } ++ ++#endif // USB_FLASH_DRIVE_SUPPORT +\ No newline at end of file +diff -Naur /home/aleph/Downloads/USB_Host_Shield_2.0-master/settings.h lib/settings.h +--- /home/aleph/Downloads/USB_Host_Shield_2.0-master/settings.h 2018-09-21 10:22:21.792106872 -0600 ++++ lib/settings.h 2018-09-21 10:01:53.383594081 -0600 +@@ -25,7 +25,21 @@ + #ifndef USB_HOST_SHIELD_SETTINGS_H + #define USB_HOST_SHIELD_SETTINGS_H + #include "macros.h" +- ++#if ENABLED(USB_FLASH_DRIVE_SUPPORT) ++ //////////////////////////////////////////////////////////////////////////////// ++ /* Added by Bill Greiman to speed up mass storage initialization with USB ++ * flash drives and simple USB hard drives. ++ * Disable this by defining DELAY(x) to be delay(x). ++ */ ++ #define delay(x) if((x) < 200) safe_delay(x) ++ /* Almost all USB flash drives and simple USB hard drives fail the write ++ * protect test and add 20 - 30 seconds to USB init. Set SKIP_WRITE_PROTECT ++ * to nonzero to skip the test and assume the drive is writable. ++ */ ++ #define SKIP_WRITE_PROTECT 1 ++ /* Since Marlin only cares about USB flash drives, we only need one LUN. */ ++ #define MASS_MAX_SUPPORTED_LUN 1 ++#endif + //////////////////////////////////////////////////////////////////////////////// + // SPI Configuration + //////////////////////////////////////////////////////////////////////////////// +@@ -45,6 +59,10 @@ + * multiple serial ports are available. + * For example Serial3. + */ ++#if ENABLED(USB_FLASH_DRIVE_SUPPORT) ++ #define USB_HOST_SERIAL MYSERIAL0 ++#endif ++ + #ifndef USB_HOST_SERIAL + #define USB_HOST_SERIAL Serial + #endif +@@ -99,7 +117,7 @@ + // No user serviceable parts below this line. + // DO NOT change anything below here unless you are a developer! + +-#include "version_helper.h" ++//#include "version_helper.h" + + #if defined(__GNUC__) && defined(__AVR__) + #ifndef GCC_VERSION +@@ -149,7 +167,6 @@ + #else + #define USING_SPI4TEENSY3 0 + #endif +- + #if ((defined(ARDUINO_SAM_DUE) && defined(__SAM3X8E__)) || defined(__ARDUINO_X86__) || ARDUINO >= 10600) && !USING_SPI4TEENSY3 + #include // Use the Arduino SPI library for the Arduino Due, Intel Galileo 1 & 2, Intel Edison or if the SPI library with transaction is available + #endif +diff -Naur /home/aleph/Downloads/USB_Host_Shield_2.0-master/UsbCore.h lib/UsbCore.h +--- /home/aleph/Downloads/USB_Host_Shield_2.0-master/UsbCore.h 2018-09-21 10:23:09.348280107 -0600 ++++ lib/UsbCore.h 2018-09-19 07:43:46.520339375 -0600 +@@ -32,7 +32,10 @@ + //#define USB_METHODS_INLINE + + /* shield pins. First parameter - SS pin, second parameter - INT pin */ +-#ifdef BOARD_BLACK_WIDDOW ++ ++#if defined(__MARLIN_H__) ++typedef MAX3421e MAX3421E; // Marlin redefines this class in "../usb_host.h" ++#elif defined(BOARD_BLACK_WIDDOW) + typedef MAX3421e MAX3421E; // Black Widow + #elif defined(CORE_TEENSY) && (defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)) + #if EXT_RAM +diff -Naur /home/aleph/Downloads/USB_Host_Shield_2.0-master/Usb.cpp lib/Usb.cpp +--- /home/aleph/Downloads/USB_Host_Shield_2.0-master/Usb.cpp 2018-09-21 10:23:20.732321559 -0600 ++++ lib/Usb.cpp 2018-09-19 07:43:46.520339375 -0600 +@@ -25,6 +25,8 @@ + + #include "Usb.h" + ++#if ENABLED(USB_FLASH_DRIVE_SUPPORT) ++ + static uint8_t usb_error = 0; + static uint8_t usb_task_state; + +@@ -825,3 +827,4 @@ + } + + #endif // defined(USB_METHODS_INLINE) ++#endif // USB_FLASH_DRIVE_SUPPORT +diff -Naur /home/aleph/Downloads/USB_Host_Shield_2.0-master/Usb.h lib/Usb.h +--- /home/aleph/Downloads/USB_Host_Shield_2.0-master/Usb.h 2018-09-21 10:23:33.756368972 -0600 ++++ lib/Usb.h 2018-09-19 07:43:46.520339375 -0600 +@@ -25,6 +25,8 @@ + #ifndef _usb_h_ + #define _usb_h_ + ++#include "../../../Marlin.h" ++ + // WARNING: Do not change the order of includes, or stuff will break! + #include + #include +@@ -34,13 +36,15 @@ + #include "settings.h" + #include "printhex.h" + #include "message.h" ++ + #include "hexdump.h" +-#include "sink_parser.h" ++//#include "sink_parser.h" + #include "max3421e.h" + #include "address.h" +-#include "avrpins.h" ++//#include "avrpins.h" + #include "usb_ch9.h" +-#include "usbhost.h" ++//#include "usbhost.h" ++#include "../usb_host.h" + #include "UsbCore.h" + #include "parsetools.h" + #include "confdescparser.h" diff --git a/Marlin/src/sd/usb_flashdrive/usb_host.cpp b/Marlin/src/sd/usb_flashdrive/usb_host.cpp new file mode 100644 index 0000000000..71155b82ac --- /dev/null +++ b/Marlin/src/sd/usb_flashdrive/usb_host.cpp @@ -0,0 +1,213 @@ +/**************** + * usb_host.cpp * + ****************/ + +/**************************************************************************** + * Written By Marcio Teixeira 2018 - Aleph Objects, Inc. * + * * + * 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. * + * * + * To view a copy of the GNU General Public License, go to the following * + * location: . * + ****************************************************************************/ + +/* What follows is a modified version of the MAX3421e originally defined in + * lib/usbhost.c". This has been rewritten to use SPI routines from the + * Marlin HAL */ + +#include "../../inc/MarlinConfigPre.h" + +#if ENABLED(USB_FLASH_DRIVE_SUPPORT) + +#include "lib/Usb.h" +#include "usb_host.h" + +uint8_t MAX3421e::vbusState = 0; + +// constructor +void MAX3421e::cs() { + WRITE(USB_CS_PIN,0); +} + +void MAX3421e::ncs() { + WRITE(USB_CS_PIN,1); +} + +// write single byte into MAX3421 register +void MAX3421e::regWr(uint8_t reg, uint8_t data) { + cs(); + spiSend(reg | 0x02); + spiSend(data); + ncs(); +}; + +// multiple-byte write +// return a pointer to memory position after last written +uint8_t* MAX3421e::bytesWr(uint8_t reg, uint8_t nbytes, uint8_t* data_p) { + cs(); + spiSend(reg | 0x02); + while (nbytes--) spiSend(*data_p++); + ncs(); + return data_p; +} + +// GPIO write +// GPIO byte is split between 2 registers, so two writes are needed to write one byte + +// GPOUT bits are in the low nybble. 0-3 in IOPINS1, 4-7 in IOPINS2 +void MAX3421e::gpioWr(uint8_t data) { + regWr(rIOPINS1, data); + regWr(rIOPINS2, data >> 4); +} + +// single host register read +uint8_t MAX3421e::regRd(uint8_t reg) { + cs(); + spiSend(reg); + uint8_t rv = spiRec(); + ncs(); + return rv; +} +// multiple-byte register read + +// return a pointer to a memory position after last read +uint8_t* MAX3421e::bytesRd(uint8_t reg, uint8_t nbytes, uint8_t* data_p) { + cs(); + spiSend(reg); + while (nbytes--) *data_p++ = spiRec(); + ncs(); + return data_p; +} +// GPIO read. See gpioWr for explanation + +// GPIN pins are in high nybbles of IOPINS1, IOPINS2 +uint8_t MAX3421e::gpioRd() { + return (regRd(rIOPINS2) & 0xf0) | // pins 4-7, clean lower nybble + (regRd(rIOPINS1) >> 4); // shift low bits and OR with upper from previous operation. +} + +// reset MAX3421e. Returns false if PLL failed to stabilize 1 second after reset +bool MAX3421e::reset() { + regWr(rUSBCTL, bmCHIPRES); + regWr(rUSBCTL, 0x00); + for (uint8_t i = 100; i--;) { + if (regRd(rUSBIRQ) & bmOSCOKIRQ) return true; + delay(10); + } + return false; +} + +// initialize MAX3421e. Set Host mode, pullups, and stuff. Returns 0 if success, -1 if not +bool MAX3421e::start() { + // Initialize pins and SPI bus + + SET_OUTPUT(USB_CS_PIN); + SET_INPUT_PULLUP(USB_INTR_PIN); + ncs(); + spiBegin(); + + spiInit( + #ifdef SPI_SPEED + SPI_SPEED + #else + SPI_FULL_SPEED + #endif + ); + + // MAX3421e - full-duplex, level interrupt, vbus off. + regWr(rPINCTL, (bmFDUPSPI | bmINTLEVEL | GPX_VBDET)); + + const uint8_t revision = regRd(rREVISION); + if (revision == 0x00 || revision == 0xFF) { + SERIAL_ECHOLNPAIR("Revision register appears incorrect on MAX3421e initialization, got ", revision); + return false; + } + + if (!reset()) { + SERIAL_ECHOLNPGM("OSCOKIRQ hasn't asserted in time"); + return false; + } + + // Delay a minimum of 1 second to ensure any capacitors are drained. + // 1 second is required to make sure we do not smoke a Microdrive! + + delay(1000); + + regWr(rMODE, bmDPPULLDN | bmDMPULLDN | bmHOST); // set pull-downs, Host + regWr(rHIEN, bmCONDETIE | bmFRAMEIE); // connection detection + + // check if device is connected + regWr(rHCTL, bmSAMPLEBUS); // sample USB bus + while (!(regRd(rHCTL) & bmSAMPLEBUS)) delay(10); // wait for sample operation to finish + + busprobe(); // check if anything is connected + + regWr(rHIRQ, bmCONDETIRQ); // clear connection detect interrupt + regWr(rCPUCTL, 0x01); // enable interrupt pin + + // GPX pin on. This is done here so that busprobe will fail if we have a switch connected. + regWr(rPINCTL, bmFDUPSPI | bmINTLEVEL); + + return true; +} + +// Probe bus to determine device presence and speed. Switch host to this speed. +void MAX3421e::busprobe() { + // Switch on just the J & K bits + switch (regRd(rHRSL) & (bmJSTATUS | bmKSTATUS)) { + case bmJSTATUS: + if ((regRd(rMODE) & bmLOWSPEED) == 0) { + regWr(rMODE, MODE_FS_HOST); // start full-speed host + vbusState = FSHOST; + } + else { + regWr(rMODE, MODE_LS_HOST); // start low-speed host + vbusState = LSHOST; + } + break; + case bmKSTATUS: + if ((regRd(rMODE) & bmLOWSPEED) == 0) { + regWr(rMODE, MODE_LS_HOST); // start low-speed host + vbusState = LSHOST; + } + else { + regWr(rMODE, MODE_FS_HOST); // start full-speed host + vbusState = FSHOST; + } + break; + case bmSE1: // illegal state + vbusState = SE1; + break; + case bmSE0: // disconnected state + regWr(rMODE, bmDPPULLDN | bmDMPULLDN | bmHOST | bmSEPIRQ); + vbusState = SE0; + break; + } +} + +// MAX3421 state change task and interrupt handler +uint8_t MAX3421e::Task(void) { + return READ(USB_INTR_PIN) ? 0 : IntHandler(); +} + +uint8_t MAX3421e::IntHandler() { + uint8_t HIRQ = regRd(rHIRQ), // determine interrupt source + HIRQ_sendback = 0x00; + if (HIRQ & bmCONDETIRQ) { + busprobe(); + HIRQ_sendback |= bmCONDETIRQ; + } + // End HIRQ interrupts handling, clear serviced IRQs + regWr(rHIRQ, HIRQ_sendback); + return HIRQ_sendback; +} + +#endif // USB_FLASH_DRIVE_SUPPORT diff --git a/Marlin/src/sd/usb_flashdrive/usb_host.h b/Marlin/src/sd/usb_flashdrive/usb_host.h new file mode 100644 index 0000000000..f5e8651556 --- /dev/null +++ b/Marlin/src/sd/usb_flashdrive/usb_host.h @@ -0,0 +1,58 @@ +/************** + * usb_host.h * + **************/ + +/**************************************************************************** + * Written By Marcio Teixeira 2018 - Aleph Objects, Inc. * + * * + * 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. * + * * + * To view a copy of the GNU General Public License, go to the following * + * location: . * + ****************************************************************************/ + +#pragma once + +/* This the following comes from "lib/usbhost.h", but has been rewritten + * to use the SPI functions from Marlin's HAL */ + +class MAX3421e { + private: + static uint8_t vbusState; + void cs(); + void ncs(); + + uint8_t GpxHandler(); + uint8_t IntHandler(); + + public: + bool start(); + + void regWr(uint8_t reg, uint8_t data); + uint8_t* bytesWr(uint8_t reg, uint8_t nbytes, uint8_t* data_p); + void gpioWr(uint8_t data); + uint8_t regRd(uint8_t reg); + uint8_t* bytesRd(uint8_t reg, uint8_t nbytes, uint8_t* data_p); + uint8_t gpioRd(); + bool reset(); + + uint8_t getVbusState(void) {return vbusState;}; + + void busprobe(); + + uint8_t Task(); +}; + +#define USE_MARLIN_MAX3421E + +#if defined(__SAM3X8E__) && !defined(ARDUINO_SAM_DUE) + #define ARDUINO_SAM_DUE // Spoof the USB library that this is a DUE +#endif